[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 15:35:59 PST 2024


andykaylor wrote:

I don't know anything about how non-x86 targets implement DAZ/FTZ, but for x86-based targets, I think trying to make any assumptions about the setting is bound to be wrong. In theory, it's part of the floating-point environment and shouldn't be modified during execution unless fenv-access is enabled.

In practical terms, I can't see any reason that you would ever want a shared library to be able to control this. I don't like the idea of adding an option to maintain that behavior, and I think we should make it a high priority to stop doing it by default when a shared library is compiled with fast-math enabled.

More generally, if you're going to be mixing fast-math with non-fast-math within a program, you don't want FTZ/DAZ to be enabled just because some parts of the program are using fast-math, so the current behavior of linking with crtfastmath.o is fairly reckless.

https://github.com/llvm/llvm-project/pull/80475


More information about the cfe-commits mailing list