llvm / llvm/llvm-project

[libc] Investigate nexttowardbf16 failure in shared_math_test when building with gcc-13.

Open
#199,332 1 comment 0 reactions 0 assignees View on GitHub
libc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This test only fail when building with gcc-13 and only for the subtarget `libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT`.
Other versions of gcc and other subtargets work fine.

```
$ ninja libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT
[26/26] Running unit test libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT
FAILED: [code=1] libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT /usr/local/google/home/lntue/experiment/llvm/llvm-project/build/libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT
cd /usr/local/google/home/lntue/experiment/llvm/llvm-project/build/libc/test/shared && /usr/local/google/home/lntue/experiment/llvm/llvm-project/build/libc/test/shared/libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT.__build__
[==========] Running 6 tests from 1 test suite.
[ RUN ] LlvmLibcSharedMathTest.AllFloat16
[ OK ] LlvmLibcSharedMathTest.AllFloat16 (19 us)
[ RUN ] LlvmLibcSharedMathTest.AllFloat
[ OK ] LlvmLibcSharedMathTest.AllFloat (8 us)
[ RUN ] LlvmLibcSharedMathTest.AllDouble
[ OK ] LlvmLibcSharedMathTest.AllDouble (5 us)
[ RUN ] LlvmLibcSharedMathTest.AllLongDouble
[ OK ] LlvmLibcSharedMathTest.AllLongDouble (5 us)
[ RUN ] LlvmLibcSharedMathTest.AllFloat128
[ OK ] LlvmLibcSharedMathTest.AllFloat128 (13 us)
[ RUN ] LlvmLibcSharedMathTest.AllBFloat16
/usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/shared/shared_math_test.cpp:812: FAILURE
Failed to match __llvm_libc_23_0_0_git::shared::nexttowardbf16(bfloat16(0.0), 0.0L) against LIBC_NAMESPACE::testing::getMatcher< LIBC_NAMESPACE::testing::TestCond::EQ>(bfloat16(0.0)).
Expected floating point value: 0x0000 = (S: 0, E: 0x0000, M: 0x0000)
Actual floating point value: 0x0001 = (S: 0, E: 0x0000, M: 0x0001)
[ FAILED ] LlvmLibcSharedMathTest.AllBFloat16
Ran 6 tests. PASS: 5 FAIL: 1
ninja: build stopped: subcommand failed.
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `ninja libc.test.shared.shared_math_test.__unit__.__NO_FMA_OPT` using GCC 13, then inspect `libc/test/shared/shared_math_test.cpp` around line 812 and the `AllBFloat16` test. Compare `nexttowardbf16` behavior across the working subtargets and compiler versions; the investigation is complete when the GCC-13 failure is explained and the target passes or a precise required change is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.