From d8901a2835d3f464d394631d85dc7aa9493fc095 Mon Sep 17 00:00:00 2001 From: Josef Ahmad Date: Thu, 15 Sep 2022 06:14:58 +0000 Subject: SERVER-69611 Set the -ffp-contract=off compiler option by default --- SConstruct | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index ec37dea4ea4..77c2400c609 100755 --- a/SConstruct +++ b/SConstruct @@ -2478,6 +2478,15 @@ for suboption in get_option('experimental-runtime-hardening'): elif suboption.startswith('+'): selected_experimental_runtime_hardenings.add(suboption[1:]) +# Disable floating-point contractions such as forming of fused multiply-add operations. +if env.ToolchainIs('clang', 'gcc'): + env.Append(CCFLAGS=["-ffp-contract=off"]) +else: + # msvc defaults to /fp:precise. Visual Studio 2022 does not emit floating-point contractions + # with /fp:precise, but previous versions can. Disable contractions altogether by using + # /fp:strict. + env.Append(CCFLAGS=["/fp:strict"]) + if env.TargetOSIs('linux'): env.Append(LIBS=["m"]) if not env.TargetOSIs('android'): -- cgit v1.2.1