[hwasan] [test] fix test broken by argument promotion pass
authorFlorian Mayer <fmayer@google.com>
Sat, 15 Apr 2023 01:50:22 +0000 (18:50 -0700)
committerFlorian Mayer <fmayer@google.com>
Sat, 15 Apr 2023 01:50:48 +0000 (18:50 -0700)
compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp

index 5a2d0dc..a79810e 100644 (file)
 int main() {
   std::function<int()> f;
   {
-    int x = 0;
+    volatile int x = 0;
     f = [&x]() __attribute__((noinline)) {
       return x; // BOOM
       // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
-      // CHECK: #0 0x{{.*}} in {{.*}}use-after-scope-capture.cpp:[[@LINE-2]]
+      // We cannot assert the line, after the argument promotion pass this crashes
+      // in the BOOM line below instead, when the ref gets turned into a value.
+      // CHECK: 0x{{.*}} in {{.*}}use-after-scope-capture.cpp
       // CHECK: Cause: stack tag-mismatch
     };
   }