Vexu / arocc

A C compiler written in Zig.

Home Page:http://aro.vexu.eu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash: cast float to non-existent enum

ehaas opened this issue · comments

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();
                            ^