You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nda::algorithms test breaks when using all and any when compiling nda 1.2.x at 6c71ef7 using gcc 12.2 with -Ofast. I suspect that some loop is silently optimised away in the fold algorithm.
Steps to Reproduce
Compile nda with gcc 12.2 and -Ofast
Run the tests
Actual behavior:
> ctest -V -R nda_algorithms
Test project /.../nda/cbuild
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 46
Start 46: nda_algorithms
46: Test command: /.../nda/cbuild/test/c++/nda_algorithms
46: Test timeout computed to be: 10000000
46: [==========] Running 4 tests from 1 test suite.
46: [----------] Global test environment set-up.
46: [----------] 4 tests from NDA
46: [ RUN ] NDA.any_all
46: /.../nda/test/c++/nda_algorithms.cpp:31: Failure
46: Value of: all(isnan(A))
46: Actual: false
46: Expected: true
46:
46: /.../nda/test/c++/nda_algorithms.cpp:37: Failure
46: Value of: any(isnan(A))
46: Actual: false
46: Expected: true
46:
46: [ FAILED ] NDA.any_all (0 ms)
46: [ RUN ] NDA.any_all_cplx
46: /.../nda/test/c++/nda_algorithms.cpp:51: Failure
46: Value of: all(isnan(A))
46: Actual: false
46: Expected: true
46:
46: /.../nda/test/c++/nda_algorithms.cpp:57: Failure
46: Value of: any(isnan(A))
46: Actual: false
46: Expected: true
46:
46: [ FAILED ] NDA.any_all_cplx (0 ms)
46: [ RUN ] NDA.Algo1
46: [ OK ] NDA.Algo1 (0 ms)
46: [ RUN ] NDA.AlgoMat
46: [ OK ] NDA.AlgoMat (0 ms)
46: [----------] 4 tests from NDA (0 ms total)
46:
46: [----------] Global test environment tear-down
46: [==========] 4 tests from 1 test suite ran. (0 ms total)
46: [ PASSED ] 2 tests.
46: [ FAILED ] 2 tests, listed below:
46: [ FAILED ] NDA.any_all
46: [ FAILED ] NDA.any_all_cplx
46:
46: 2 FAILED TESTS
1/1 Test #46: nda_algorithms ...................***Failed 0.05 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.08 sec
The following tests FAILED:
46 - nda_algorithms (Failed)
Errors while running CTest
This is expected. -Ofast implies -ffast-math which in turn implies -ffinite-math-only, i.e. it assumes that all floating point math is finite and there will never be any inf or nan. Therefore any instance of isnan will simply be optimized out as false. Generally the recommendation is to not use -ffast-math at all, see https://simonbyrne.github.io/notes/fastmath/
Description
The
nda::algorithms
test breaks when usingall
andany
when compiling nda 1.2.x at 6c71ef7 using gcc 12.2 with-Ofast
. I suspect that some loop is silently optimised away in thefold
algorithm.Steps to Reproduce
-Ofast
Actual behavior:
Versions
nda 1.2.x at 6c71ef7
The text was updated successfully, but these errors were encountered: