From e7d18411dfc6a74ebb59fb3d57f524bbd6e993e2 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Wed, 14 Jul 2021 16:53:34 -0500 Subject: 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. --- numpy/distutils/ccompiler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 061f4862d..6d063ee4e 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -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 -- cgit v1.2.1