Skip to content

@floatToInt compiler crash on c_longdouble #1188

Closed
@tiehuis

Description

@tiehuis

Minor, since c_longdouble isn't commonly used.

pub fn main() void {
    const a: c_longdouble = 1.4;
    const b = @floatToInt(u32, a);
}
unreachable: /home/me/src/zig/src/ir.cpp:eval_const_expr_implicit_cast:8961
#0  0x00007ffff630886b in raise () from /usr/lib/libc.so.6
#1  0x00007ffff62f340e in abort () from /usr/lib/libc.so.6
#2  0x0000555555e04e5c in zig_panic(char const*, ...) ()
#3  0x0000555555f1601c in ir_resolve_cast(IrAnalyze*, IrInstruction*, IrInstruction*, TypeTableEntry*, CastOp, bool) ()
#4  0x0000555555f24c2d in ir_analyze_instruction_decl_var(IrAnalyze*, IrInstructionDeclVar*) ()
#5  0x0000555555f3b6b1 in ir_analyze_instruction_nocast(IrAnalyze*, IrInstruction*) ()
#6  0x0000555555f3d2b1 in ir_analyze(CodeGen*, IrExecutable*, IrExecutable*, TypeTableEntry*, AstNode*) ()
#7  0x0000555555edd1f5 in analyze_fn_ir(CodeGen*, FnTableEntry*, AstNode*) ()
#8  0x0000555555eddf00 in semantic_analyze(CodeGen*) ()
#9  0x0000555555f031f8 in codegen_build(CodeGen*) ()
#10 0x0000555555e4855d in main ()

Metadata

Metadata

Assignees

Labels

bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions