Skip to content

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

Open
@drew-parsons

Description

@drew-parsons

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions