Prevent excess precision errors on 32-bit builds

The compile flag -ffloat-store requires floating point values to be
stored in memory rather than in registers to prevent errors when two
numbers are compared that were stored in different locations.

(cherry picked from commit 40c70dd008)
This commit is contained in:
Seth Hillbrand 2018-10-22 19:39:32 -07:00
parent 49753d9dad
commit 2701bdbbac
1 changed files with 4 additions and 0 deletions

View File

@ -274,6 +274,10 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( TO_LINKER -XLinker )
else()
set( TO_LINKER -Wl )
# Set 32-bit flag for GCC to prevent excess precision
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )
endif()
endif()
# Establish -Wall early, so specialized relaxations of this may come