Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[ICE] Compound assignment is not desugared properly #393

Open
jyn514 opened this issue May 1, 2020 · 1 comment
Open

[ICE] Compound assignment is not desugared properly #393

jyn514 opened this issue May 1, 2020 · 1 comment
Labels
analyzer Issue with semantic analysis fuzz Found via fuzz testing ICE Internal Compiler Error (panic)

Comments

@jyn514
Copy link
Owner

jyn514 commented May 1, 2020

Code

char arr[2];
int main() {
  if (arr[1] %= 2);
}
The application panicked (crashed).
Message:  bug in parser: loaded a variable that was not declared
Location: /home/joshua/src/rust/rcc/src/ir/expr.rs:417

Expected behavior

This should be the same as if (a[1] = a[1] % 2);.

Backtrace
The application panicked (crashed).
Message:  bug in parser: loaded a variable that was not declared
Location: /home/joshua/src/rust/rcc/src/ir/expr.rs:417

Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                          (5 post panic frames hidden)                          
 5: core::option::expect_failed::h9a8bff6ff005b30d
    at src/libcore/option.rs:1203
 6: core::option::Option<T>::expect::h2934587c484701a8
    at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/option.rs:347
 7: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::load_addr::hdffc9674d91efc32
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:417
 8: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::compile_expr::ha020d1d06687a05e
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:42
 9: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::compile_expr::ha020d1d06687a05e
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:46
10: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::compile_expr::ha020d1d06687a05e
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:133
11: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::assignment::hda033cabe997521f
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:470
12: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::compile_expr::ha020d1d06687a05e
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:74
13: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::binary_assign_op::he84c04b445cb52eb
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:261
14: rcc::ir::expr::<impl rcc::ir::Compiler<B>>::compile_expr::ha020d1d06687a05e
    at /home/joshua/src/rust/rcc/src/ir/expr.rs:77
15: rcc::ir::stmt::<impl rcc::ir::Compiler<B>>::if_stmt::he3580cab9d968527
    at /home/joshua/src/rust/rcc/src/ir/stmt.rs:109
16: rcc::ir::stmt::<impl rcc::ir::Compiler<B>>::compile_stmt::h22bfea63bd52acbe
    at /home/joshua/src/rust/rcc/src/ir/stmt.rs:54
17: rcc::ir::stmt::<impl rcc::ir::Compiler<B>>::compile_all::hda4558f5a1a26d2f
    at /home/joshua/src/rust/rcc/src/ir/stmt.rs:19
18: rcc::ir::Compiler<B>::compile_func::h455898c302517ed0
    at /home/joshua/src/rust/rcc/src/ir/mod.rs:333
19: rcc::ir::compile::h064ded66bca454d2
    at /home/joshua/src/rust/rcc/src/ir/mod.rs:112
20: rcc::compile::h7e7691f880c5ebf4
    at /home/joshua/src/rust/rcc/src/lib.rs:222
21: rcc::aot_main::h8def1ca0324b8884
    at src/main.rs:134
22: rcc::real_main::h192812ffe776ee2f
    at src/main.rs:122
23: rcc::main::hc67a23664e8d7b5c
    at src/main.rs:200
@jyn514 jyn514 added ICE Internal Compiler Error (panic) analyzer Issue with semantic analysis labels May 1, 2020
@jyn514
Copy link
Owner Author

jyn514 commented May 1, 2020

Found through fuzz testing (thank you @Byter09!). I also noticed that I don't have a --debug-semantics flag, I should add that.

@jyn514 jyn514 added the fuzz Found via fuzz testing label May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
analyzer Issue with semantic analysis fuzz Found via fuzz testing ICE Internal Compiler Error (panic)
Projects
None yet
Development

No branches or pull requests

1 participant