Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crash when using simple return expression #150

Open
bungcip opened this issue Jan 29, 2023 · 1 comment
Open

Compiler crash when using simple return expression #150

bungcip opened this issue Jan 29, 2023 · 1 comment

Comments

@bungcip
Copy link

bungcip commented Jan 29, 2023

This simple code

foo = return 4

causing compiler to panic

thread 'main' panicked at 'you cannot add an instruction to a block already filled', /home/bungcip/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-frontend-0.86.1/src/frontend.rs:417:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@jfecher
Copy link
Owner

jfecher commented Feb 15, 2023

Apologies for the very delayed response!

This is a known error, although it is one that is somewhat cumbersome to solve well as it requires a more thorough checking of where return is in code. A proper fix is two-fold:

  1. Creating a new warning for when there is code sequenced after a return
  2. Fixing the backend to stop code generation in a block after a return, or remove all offending Ast nodes in advance beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants