<div dir="ltr"><div>Greetings,</div><div><br></div><div>I have a Zig implementation of ceil which is emitted into LLVM IR like this:</div><div><br></div><div><div>; Function Attrs: nobuiltin nounwind</div><div>define internal fastcc float @ceil(float) unnamed_addr #3 !dbg !644 {</div><div>Entry:</div><div>  %x = alloca float, align 4</div><div>  store float %0, float* %x</div><div>  call void @llvm.dbg.declare(metadata float* %x, metadata !649, metadata !494), !dbg !651</div><div>  %1 = load float, float* %x, !dbg !652</div><div>  %2 = call fastcc float @ceil32(float %1) #8, !dbg !656</div><div>  ret float %2, !dbg !657</div><div>}</div></div><div><br></div><div>Test case:</div><div><br></div><div><div>test "math.ceil" {</div><div>    assert(ceil(f32(0.0)) == ceil32(0.0));</div><div>    assert(ceil(f64(0.0)) == ceil64(0.0));</div><div>}</div></div><div><br></div><div><br></div><div>When I compile with optimizations on, this test case fails. The optimized code for the test case ends up being a call to panic (assertion failure), which means that LLVM determined the test failed at compile-time.</div><div><br></div><div>What's strange about this is that if I change the function name from @ceil to @ceil_asdf (and change the callers) then the test passes.</div><div><br></div><div>So I think LLVM is doing some kind of string comparison on the symbol name and detecting that it is "ceil" and then having different, undesired behavior.</div><div><br></div><div>I tried putting `nobuiltin` in the function attributes and at the callsite, but that did not change anything.</div><div><br></div><div>Any ideas what's going on?</div><div><br></div>Downstream issue: <a href="https://github.com/zig-lang/zig/issues/393">https://github.com/zig-lang/zig/issues/393</a><br><div><br></div><div>Regards,</div><div>Andrew</div></div>