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

[ICE] panic on %= #214

Closed
jyn514 opened this issue Jan 19, 2020 · 4 comments
Closed

[ICE] panic on %= #214

jyn514 opened this issue Jan 19, 2020 · 4 comments
Labels
blocked Waiting for another project to implement a feature or fix a bug bug Something isn't working ICE Internal Compiler Error (panic) parser Issue to do with parsing the abstract syntax tree

Comments

@jyn514
Copy link
Owner

jyn514 commented Jan 19, 2020

Expected behavior
i %= j should be the same as i = i % j

Actual Behavior
RCC crashes.

Code

int main () { float f = 3; return f %= 2,1; }
thread 'main' panicked at 'internal error: entered unreachable code: only valid assign binary ops should be passed to binary_assign_op (got %)', src/ir/expr.rs:324:30
Backtrace
  13: rcc::ir::expr::<impl rcc::ir::Compiler>::binary_assign_ir
  14: rcc::ir::expr::<impl rcc::ir::Compiler>::assignment
  15: rcc::ir::expr::<impl rcc::ir::Compiler>::compile_expr
  16: rcc::ir::expr::<impl rcc::ir::Compiler>::compile_expr
  17: rcc::ir::expr::<impl rcc::ir::Compiler>::cast
  18: rcc::ir::expr::<impl rcc::ir::Compiler>::compile_expr
  19: rcc::ir::stmt::<impl rcc::ir::Compiler>::compile_stmt
  20: rcc::ir::stmt::<impl rcc::ir::Compiler>::compile_all
  21: rcc::ir::Compiler::compile_func
  22: rcc::ir::compile
  23: rcc::compile
  24: rcc::real_main
  25: rcc::main

Thanks to @Byter09 for the fuzzing.

@jyn514 jyn514 added bug Something isn't working ICE Internal Compiler Error (panic) labels Jan 19, 2020
@jyn514
Copy link
Owner Author

jyn514 commented Jan 19, 2020

This should have been caught by the parser, % is invalid for floats.

@jyn514 jyn514 added the parser Issue to do with parsing the abstract syntax tree label Jan 19, 2020
@jyn514
Copy link
Owner Author

jyn514 commented Jan 20, 2020

Waiting on #151 , same reasoning as #121 .

@jyn514 jyn514 added the blocked Waiting for another project to implement a feature or fix a bug label Jan 20, 2020
@pythongirl325
Copy link
Collaborator

Does this also hold for similar operators like ^=?

@jyn514
Copy link
Owner Author

jyn514 commented Feb 2, 2020

Yes, they all need to be desugared so they do typechecking properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked Waiting for another project to implement a feature or fix a bug bug Something isn't working ICE Internal Compiler Error (panic) parser Issue to do with parsing the abstract syntax tree
Projects
None yet
Development

No branches or pull requests

2 participants