Skip to content

Fix unreachable on bin op between numeric and undefined #4005

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

Closed
wants to merge 1 commit into from

Conversation

Vexu
Copy link
Member

@Vexu Vexu commented Dec 30, 2019

Closes #4004

@daurnimator daurnimator added the stage1 The process of building from source via WebAssembly and the C backend. label Dec 30, 2019
@andrewrk
Copy link
Member

I wouldn't expect you to find this information, given the fact that we don't have the language specification yet (#75), but have a look at #1947 for the general idea here.

In summary, mathematical operations on undefined operands produce undefined values as results, but not undefined behavior. However, branching on undefined values is undefined behavior. So the expected behavior here is for 5 == undefined to produce the value @as(bool, undefined).

For what it's worth, I'm planning on starting the draft of the language specification soon, within a few weeks here.

I pushed a05150e to fix #4004.

@andrewrk andrewrk closed this Dec 31, 2019
@Vexu Vexu deleted the fix-4004 branch December 31, 2019 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unreachable at src/ir.cpp:15265 in ir_analyze_bin_op_cmp. This is a bug in the Zig compiler.
3 participants