10000 BLD,API: (distutils) Force strict floating point error model on clang by seberg · Pull Request #19049 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD,API: (distutils) Force strict floating point error model on clang #19049

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 2 commits into from
May 20, 2021
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
6 changes: 6 additions & 0 deletions doc/release/upcoming_changes/19049.compatibility.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Distutils forces strict floating point model on clang
-----------------------------------------------------
NumPy distutils will now always add the ``-ffp-exception-behavior=strict``
compiler flag when compiling with clang. Clang defaults to a non-strict
version, which allows the compiler to generate code that does not set
floating point warnings/errors correctly.
6 changes: 6 additions & 0 deletions numpy/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ def CCompiler_customize_cmd(self, cmd, ignore=()):
"""
log.info('customize %s using %s' % (self.__class__.__name__,
cmd.__class__.__name__))

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')

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

Expand Down
0