Skip to content

Commit

Permalink
Disable -ffast-math for etc2comp
Browse files Browse the repository at this point in the history
Apparently -ffast-math generates incorrect code with recent versions of
GCC and Clang. The manual page for GCC warns about this possibility.

In my tests it doesn't actually appear to be measurably slower in this
case, and this is used in a batch process so it seems safe to disable
this.

This fixes godotengine#10758 and fixes godotengine#10070
  • Loading branch information
hpvb committed Aug 30, 2017
1 parent 181420f commit d44414c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/etc/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ env_etc.add_source_files(env.modules_sources, "*.cpp")

# upstream uses c++11
env_etc.Append(CXXFLAGS="-std=gnu++11")
# -ffast-math seems to be incompatible with ec2comp on recent versions of
# GCC and Clang
if '-ffast-math' in env_etc['CCFLAGS']:
env_etc['CCFLAGS'].remove('-ffast-math')
4 changes: 3 additions & 1 deletion platform/x11/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def configure(env):
## Build type

if (env["target"] == "release"):
env.Prepend(CCFLAGS=['-Ofast'])
# -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
# -ffast-math in code for which it generates wrong results.
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
if (env["debug_release"] == "yes"):
env.Prepend(CCFLAGS=['-g2'])

Expand Down

0 comments on commit d44414c

Please sign in to comment.