Resolve #883 "Compiler floating-point operation optimizations causing non-BE behaviour"
- Related issues: #883 (closed)
- Requested reviewers: @kiene, @pihlajakuja
Reason why this change is needed
Starting from version 14 Apple clang compiler changed the default behaviour of FP contraction (FMA) from off
to on
. This attempts to optimize certain floating point operations, but may cause inaccurate results, e.g., on ARM Macs (short description).
This problem was observed when working on !1160 (merged) as it caused non-BE behaviour in the output before and after refactoring.
Description of the change
In CMakeLists.txt, explicitly disable the floating point operation contraction with the compiler flag
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffp-contract=off")
Affected operating points
No algorithmic changes.
If the compiler has used the floating point contraction optimizations, the result may be different after explicitly disabling them.
The intended change in operation is on Apple silicon Macs with native builds.
Related to #883 (closed)
Edited by Jouni Paulus