Skip to content

Turn off -ffp-contract on Unix #64847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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