xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

gcc-13 triggers EXPECT_EQ floating point comparison failure

Open drew-parsons opened this issue 2 years ago • 2 comments

#2435 (PR #2436) fixed some instances of EXPECT_EQ being used for floating point comparison instead of EXPECT_DOUBLE_EQ. gcc-13 appears to have uncovered a few more, causing test failure on i386 and s390x. Tests were previously passing with gcc-12 and are still passing with clang.

Test logs are available for i386 (xtensor 0.24.6)

The error is

861s ./test_xtensor_lib
861s [doctest] doctest version is "2.4.11"
861s [doctest] run with "--help" for options
861s Built without XSIMD
861s Built without XSIMD
861s ===============================================================================
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xbuilder.cpp:146:
861s TEST CASE:  xbuilder.arange_min_max_step
861s 
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xbuilder.cpp:166: FATAL ERROR: REQUIRE_EQ( 3.f * 0.3f, l3[{3}] ) is NOT correct!
861s   values: REQUIRE_EQ( 0.9, 0.9 )
861s 
861s ===============================================================================
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xcomplex.cpp:297:
861s TEST CASE:  xcomplex.longdouble
861s 
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xcomplex.cpp:304: ERROR: CHECK_EQ( a(4, 4), cmplx(123.321, -123.321) ) is NOT correct!
861s   values: CHECK_EQ( (123.321,-123.321), (123.321,-123.321) )
861s 
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xcomplex.cpp:308: ERROR: CHECK_EQ( a(0, 0), cmplx(-123.321, -123.321) ) is NOT correct!
861s   values: CHECK_EQ( (-123.321,-123.321), (-123.321,-123.321) )
861s 
861s /tmp/autopkgtest-lxc.h85ujcsf/downtmp/autopkgtest_tmp/test_xcomplex.cpp:309: ERROR: CHECK_EQ( a(4, 4), cmplx(-123.321, -123.321) ) is NOT correct!
861s   values: CHECK_EQ( (-123.321,-123.321), (-123.321,-123.321) )
861s 
861s ===============================================================================
861s [doctest] test cases:  1196 |  1194 passed | 2 failed | 0 skipped
861s [doctest] assertions: 19564 | 19560 passed | 4 failed |
861s [doctest] Status: FAILURE!

As far as I can tell it's just further instances where EXPECT_DOUBLE_EQ is required instead of EXPECT_EQ, or similar, following the example of #2436

The gcc-13 trigger might be excess precision changes, https://gcc.gnu.org/gcc-13/porting_to.html

drew-parsons avatar Jul 26 '23 21:07 drew-parsons

l.33 in test_xinfo.cpp is also expected to be a problem with llvm-16. But this is a string comparison not a floating point comparison, so can't be fixed the same way. Why would llvm-16 be returning "le" instead of "double"? Is it a bug in llvm-16?

drew-parsons avatar Aug 03 '23 15:08 drew-parsons

The latter problem with test_xinfo and llvm-16 is Issue #2694

drew-parsons avatar Sep 25 '23 12:09 drew-parsons