8000 BLD: Add clang `-ftrapping-math` also for `compiler_so` by seberg · Pull Request #19479 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
Next Next commit
BLD: Use -ftrapping-math for clang and for _so
Apparently, there is a second `compiler_so` that is actually the
main compiler being used, and modifying only the first one is just
futile.

The old try was `-ffp-exception-behavior=strict`, but that seems to
be a fairly new addition (and doesn't even work on MacOS with 10.0)

`-ftrapping-math` seems to be the older, equivalent option.
  • Loading branch information
seberg committed Jul 15, 2021
commit e7d18411dfc6a74ebb59fb3d57f524bbd6e993e2
3 changes: 2 additions & 1 deletion numpy/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ def CCompiler_customize_cmd(self, cmd, ignore=()):
if hasattr(self, 'compiler') and 'clang' in self.compiler[0]:
# clang defaults to a non-strict floating error point model.
# Since NumPy and most Python libs give warnings for these, override:
self.compiler.append('-ffp-exception-behavior=strict')
self.compiler.append('-ftrapping-math')
self.compiler_so.append('-ftrapping-math')

def allow(attr):
return getattr(cmd, attr, None) is not None and attr not in ignore
Expand Down
0