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

Crash: cast float to non-existent enum #660

Closed
ehaas opened this issue Apr 1, 2024 · 0 comments · Fixed by #663
Closed

Crash: cast float to non-existent enum #660

ehaas opened this issue Apr 1, 2024 · 0 comments · Fixed by #663
Labels
bug Something isn't working crash A bug that causes the compiler to crash

Comments

@ehaas
Copy link
Collaborator

ehaas commented Apr 1, 2024

void foo(void) {
    (enum E)2.0;
}
panic: attempt to use null value
/Users/ehaas/source/arocc/src/aro/Value.zig:174:57: 0x1084a7b40 in floatToInt (arocc)
    const bits: usize = @intCast(dest_ty.bitSizeof(comp).?);
                                                        ^
/Users/ehaas/source/arocc/src/aro/Parser.zig:5962:43: 0x108614be4 in castType (arocc)
                _ = try res.val.floatToInt(to, p.comp);
                                          ^
/Users/ehaas/source/arocc/src/aro/Parser.zig:6704:29: 0x108612460 in castExpr (arocc)
        try operand.castType(p, ty, operand_tok, l_paren);
                            ^
/Users/ehaas/source/arocc/src/aro/Parser.zig:6597:29: 0x108608285 in mulExpr (arocc)
    var lhs = try p.castExpr();
                            ^
@ehaas ehaas added bug Something isn't working crash A bug that causes the compiler to crash labels Apr 1, 2024
ehaas added a commit to ehaas/arocc that referenced this issue Apr 1, 2024
@Vexu Vexu closed this as completed in #663 Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash A bug that causes the compiler to crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant