Skip to content

LLVM 14 regression: std.fmt.parseFloat gives wrong bit pattern for NaN on aarch64  #12027

Closed
@andrewrk

Description

@andrewrk

Zig Version: 0.10.0-dev.2896+fa40bddf2

Reproduce:

$ stage1/bin/zig test ../lib/std/std.zig -target aarch64-linux-none
Test [801/2198] fmt.parse_float.test "std-aarch64-linux-none-Debug-bare-multi-default f... expected 32257, found 31745
Test [801/2198] fmt.parse_float.test "std-aarch64-linux-none-Debug-bare-multi-default f... FAIL (TestExpectedEqual)
2118 passed; 79 skipped; 1 failed.
error: the following test command failed with exit code 1:
qemu-aarch64 /home/andy/dev/zig/zig-cache/o/554571ccb0691b6a5f1b1367cbe29186/test /home/andy/dev/zig/build-llvm14-debug/stage1/bin/zig
test...The following command exited with error code 1:
/home/andy/dev/zig/build-llvm14-debug/stage1/bin/zig test /home/andy/dev/zig/lib/std/std.zig --test-name-prefix std-aarch64-linux-none-Debug-bare-multi-default  --cache-dir /home/andy/dev/zig/zig-cache --global-cache-dir /home/andy/.cache/zig --name test -fno-single-threaded -target aarch64-linux-none -mcpu generic --test-cmd qemu-aarch64 --test-cmd-bin -I /home/andy/dev/zig/test -L /home/andy/local/llvm14-debug/lib -isystem /home/andy/local/llvm14-debug/include --zig-lib-dir /home/andy/dev/zig/lib --enable-cache 

Failing test case is:

try expectEqual(@bitCast(Z, try parseFloat(T, "nAn")), @bitCast(Z, std.math.nan(T)));

Next steps:

  1. Create LLVM IR test case
  2. use llvm-reduce to create reduction
  3. Check if bug is present on trunk
  4. File upstream bug report

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-aarch6464-bit ARMbackend-llvmThe LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.miscompilationThe compiler reports success but produces semantically incorrect code.regressionIt worked in a previous version of Zig, but stopped working.upstreamAn issue with a third party project that Zig uses.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions