Skip to content

Commit

Permalink
Turn off -ffp-contract on Unix (dotnet#64847)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Feb 7, 2022
1 parent a512284 commit 805a5e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ if (CLR_CMAKE_HOST_UNIX)

add_compile_options(-Wno-unused-but-set-variable)

# Turn off floating point expression contraction because it is considered a value changing
# optimization in the IEEE 754 specification and is therefore considered unsafe.
add_compile_options(-ffp-contract=off)

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-unknown-warning-option)

Expand Down
5 changes: 5 additions & 0 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ if(GCC)
# We require C99 with some GNU extensions, e.g. `linux` macro
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()

# Turn off floating point expression contraction because it is considered a value changing
# optimization in the IEEE 754 specification and is therefore considered unsafe.
add_compile_options(-ffp-contract=off)

# The runtime code does not respect ANSI C strict aliasing rules
append("-fno-strict-aliasing" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
# We rely on signed overflow to behave
Expand Down

0 comments on commit 805a5e4

Please sign in to comment.