Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lgamma test failing (nan) with clang 19 on arm64 #1066

Open
drew-parsons opened this issue Nov 22, 2024 · 2 comments
Open

lgamma test failing (nan) with clang 19 on arm64 #1066

drew-parsons opened this issue Nov 22, 2024 · 2 comments

Comments

@drew-parsons
Copy link

drew-parsons commented Nov 22, 2024

The lgamma test at

CHECK_EQ(extract(xsimd::lgamma(T(val))), std::lgamma(val));

is failing with clang 19 on arm64,
see debian test log https://ci.debian.net/data/autopkgtest/unstable/arm64/x/xsimd/54522214/log.gz
from https://ci.debian.net/packages/x/xsimd/unstable/arm64/

2885s     Start 1: test_xsimd
2885s 
2885s 1: Test command: /tmp/autopkgtest-lxc.8mniqst8/downtmp/build.OlH/src/test/run_test_clang_complex/test_xsimd
2885s 1: Working Directory: /tmp/autopkgtest-lxc.8mniqst8/downtmp/build.OlH/src/test/run_test_clang_complex
2885s 1: Test timeout computed to be: 10000000
2885s 1: [doctest] doctest version is "2.4.11"
2885s 1: [doctest] run with "--help" for options
2885s 1: ===============================================================================
2885s 1: /tmp/autopkgtest-lxc.8mniqst8/downtmp/build.OlH/src/test/test_xsimd_api.cpp:755:
2885s 1: TEST CASE:  [xsimd api | float types functions]<xsimd::batch<float>>
2885s 1:   lgamma
2885s 1: 
2885s 1: /tmp/autopkgtest-lxc.8mniqst8/downtmp/build.OlH/src/test/test_xsimd_api.cpp:631: ERROR: CHECK_EQ( extract(xsimd::lgamma(T(val))), std::lgamma(val) ) is NOT correct!
2885s 1:   values: CHECK_EQ( -nan, 0 )
2885s 1: 
2885s 1: ===============================================================================
2885s 1: [doctest] test cases:  320 |  319 passed | 1 failed | 0 skipped
2885s 1: [doctest] assertions: 8293 | 8292 passed | 1 failed |
2885s 1: [doctest] Status: FAILURE!
2885s 1/1 Test #1: test_xsimd .......................***Failed    0.55 sec

So, apparently xsimd::lgamma(2) is returning -nan instead of 0 when compiled with clang 19 on arm64. Perhaps it's a bug in clang, not xsimd.

For comparison, the same test is passing with gcc 14 (at 1733s in the same test log). clang 19 is passing on amd64.

Separately, I'm concerned that many tests, nearly all in fact, use equality (CHECK_EQ) to make floating point comparisons. They would want to be used with doctest::Approx, as a couple of the tests are doing. Using equality for floating point comparison inevitably fails. However in this case the bigger problem is the nan value returned, not the floating point comparison.

@drew-parsons drew-parsons changed the title lgamma test failing (nan) with clang 19 lgamma test failing (nan) with clang 19 on arm64 Nov 22, 2024
@MiroslavR
Copy link

I noticed that 6c86b23 fixed undefined behavior in lgamma, and the fix hasn't been released yet. Could this be it?

@serge-sans-paille
Copy link
Contributor

@JohanMabille you usually handle releases, can you do this, or do you want me to make that one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants