aboutsummaryrefslogtreecommitdiff
path: root/lib/std/special/compiler_rt/compareXf2.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-05 20:28:29 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-05 20:36:04 -0700
commit9ed599b4e3f5c9f48089a3acd61d0338e27e88f6 (patch)
tree97f51ac789f90050f659b3faceb4a665aa304868 /lib/std/special/compiler_rt/compareXf2.zig
parent01ad6c0b020193a6c5c82e13296a12e847f78d05 (diff)
downloadzig-9ed599b4e3f5c9f48089a3acd61d0338e27e88f6.tar.gz
zig-9ed599b4e3f5c9f48089a3acd61d0338e27e88f6.zip
stage2: LLVM backend: miscompilation fixes
* work around a stage1 miscompilation leading to the wrong integer comparison predicate being emitted. * fix the bug of not annotating callsites with the calling convention of the callee, leading to undefined behavior. * add the `nobuiltin` attribute when building freestanding libc or compiler_rt libraries to prevent e.g. memcpy from being "optimized" into a call to itself. * compiler-rt: change a call to be comptime to make the generated LLVM IR simpler and easier to study. I still can't enable the widening tests due to the compiler-rt compare function being miscompiled in some not-yet-diagnosed way.
Diffstat (limited to 'lib/std/special/compiler_rt/compareXf2.zig')
-rw-r--r--lib/std/special/compiler_rt/compareXf2.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/special/compiler_rt/compareXf2.zig b/lib/std/special/compiler_rt/compareXf2.zig
index 951632b351..9f3750094e 100644
--- a/lib/std/special/compiler_rt/compareXf2.zig
+++ b/lib/std/special/compiler_rt/compareXf2.zig
@@ -32,7 +32,7 @@ pub inline fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT {
const exponentBits = std.math.floatExponentBits(T);
const signBit = (@as(rep_t, 1) << (significandBits + exponentBits));
const absMask = signBit - 1;
- const infT = std.math.inf(T);
+ const infT = comptime std.math.inf(T);
const infRep = @bitCast(rep_t, infT);
const aInt = @bitCast(srep_t, a);