Skip to content

Commit 70c5c86

Browse files
committed
Do not use -Ofast
-Ofast implies -funsafe-math-optimizations, which affects the global FP state for all programs: when used at link time, it may include libraries or startup files that change the default FPU control word or other similar optimizations. -Ofast enables (directly or indirectly): - ❌ -fallow-store-data-races - ✔ -fno-semantic-interposition - ✔ -fno-math-errno - ❌ -funsafe-math-optimizations - ❌ -ffinite-math-only - ✔ -fno-rounding-math (_default_) - ✔ -fno-signaling-nans (_default_) - ❔ -fcx-limited-range - ✔ -fexcess-precision=fast - ✔ -fno-signed-zeros - ✔ -fno-trapping-math - ✔ -fassociative-math - ❌ -freciprocal-math (disabled in #8280) We should not use -fallow-store-data-races, -ffinite-math-only. We should not use -funsafe-math-optimizations at link time, as it affects the global FP state. It's probably easier to replace it with the individual options -fno-signed-zeros, -fno-trapping-math and -fassociative-math. We may revisit -fcx-limited-range if we do use Complex arithmetics. -freciprocal-math was already disabled explicitly, see #8280.
1 parent cce7e6a commit 70c5c86

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
<tool name="ofast-flag" version="1.0" revision="1">
2-
<flags CXXFLAGS="-Ofast -fno-reciprocal-math"/>
3-
<ifarch match="ppc64le|amd64|x86_64">
4-
<flags CXXFLAGS="-mrecip=none"/>
5-
</ifarch>
6-
<ifarchitecture name="slc6_">
7-
<ifcompiler name="llvm">
8-
<flags CXXFLAGS="-fno-builtin"/>
9-
</ifcompiler>
10-
</ifarchitecture>
11-
<flags NO_RECURSIVE_EXPORT="1"/>
12-
</tool>
1+
<tool name="ofast-flag" version="2.0" revision="1">
2+
<!--
3+
As of GCC version 13.3.0, `-Ofast` enables (directly or indirectly):
4+
- `-fallow-store-data-races`
5+
- `-fno-semantic-interposition`
6+
- `-fno-math-errno`
7+
- `-funsafe-math-optimizations`
8+
- `-ffinite-math-only`
9+
- `-fno-rounding-math` (enabled by default)
10+
- `-fno-signaling-nans` (enabled by default)
11+
- `-fcx-limited-range`
12+
- `-fexcess-precision=fast`
13+
- `-fno-signed-zeros`
14+
- `-fno-trapping-math`
15+
- `-fassociative-math`
16+
- `-freciprocal-math` (disabled in cms-sw/cmsdist#8280)
17+
We disable `-fallow-store-data-races`, `-funsafe-math-optimizations`, `-ffinite-math-only` and `-freciprocal-math` (see cms-sw/cmsdist#8280).
18+
-->
19+
<flags CXXFLAGS="-fno-semantic-interposition -fno-math-errno -fno-rounding-math -fno-signaling-nans -fexcess-precision=fast -fno-signed-zeros -fno-trapping-math -fassociative-math -fno-reciprocal-math"/>
20+
<ifarch match="ppc64le|amd64|x86_64">
21+
<flags CXXFLAGS="-mrecip=none"/>
22+
</ifarch>
23+
<flags NO_RECURSIVE_EXPORT="1"/>
24+
</tool>

0 commit comments

Comments
 (0)