[compiler-rt] [compiler-rt][nsan] Add support for nan detection (PR #101531)

Alexander Shaposhnikov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 11:26:36 PDT 2024


================
@@ -0,0 +1,19 @@
+// RUN: %clangxx_nsan -O0 -g %s -o %t
----------------
alexander-shaposhnikov wrote:

We also need to add a run for -O3.
See https://stackoverflow.com/questions/54481855/clang-ignoring-attribute-noinline if optimizations trigger constant folding here.
I'd recommend a slight modification (probably should suffice to make things work):
```
__attribute__((noinline)) float f(float p, float q) {
     float  ret = p / q;
     return ret;
}
```
And then call f(0., 0.)

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


More information about the llvm-commits mailing list