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

Unreachable condition in compiler #945

Closed
hryx opened this issue Apr 23, 2018 · 1 comment
Closed

Unreachable condition in compiler #945

hryx opened this issue Apr 23, 2018 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@hryx
Copy link
Sponsor Contributor

hryx commented Apr 23, 2018

Here is a short program which causes the compiler to output "unreachable" and be killed with SIGABRT:

https://gist.github.com/hryx/c274aa28ed7a03e189203354b1b32fa4

The program itself is probably invalid, but I was told this may still be a compiler bug.

My setup: macOS 10.12.6, zig 0.2.0 (via Homebrew), fish 2.7.1. I ran zig build-exe main.zig.

@BraedonWooding
Copy link
Contributor

BraedonWooding commented Apr 23, 2018

Good find it is a bug :).

I get the following error message when doing on latest master;

Assertion failed: (target_value_ptr->value.type->id == TypeTableEntryIdPointer), function ir_analyze_instruction_switch_target, file /.../Zig/src/ir.cpp, line 14785.
Abort trap: 6

Assertions mean compiler bugs. I put a fix in #946 till this gets cleared up, most likely it is just a bad error message.

@andrewrk andrewrk added this to the 0.3.0 milestone Apr 23, 2018
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants