[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 20 01:51:09 PDT 2024


================
@@ -318,12 +320,12 @@
 
 // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
 // RUN:     -fno-trapping-math -ftrapping-math -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
 
 // CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-cc1"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-mreassociate"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-mreassociate"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
----------------
arsenm wrote:

I don't think this testing technique works. All of these flags would be printed on the same line as cc1. You would need to use CHECK-SAME-NOT, but I'm not sure you can actually compose -SAME and -NOT checks 

-NOT checks are hazardous this way, can we positively check for the flags that are emitted.

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


More information about the cfe-commits mailing list