@@ -14,21 +14,22 @@ void violation() [[clang::nonblocking]] {
1414 {
1515 __rtsan::ScopedDisabler disabler{};
1616 ptr = malloc (2 );
17- printf ( " ptr: %p \n " , ptr); // ensure we don't optimize out the malloc
17+ fprintf (stderr, " Allocated pointer %p in disabled context \n " , ptr);
1818 }
1919
2020 // ensure nested disablers don't interfere with one another
21- void *ptr2;
2221 {
22+ void *ptr2;
2323 __rtsan::ScopedDisabler disabler{};
2424 {
2525 __rtsan::ScopedDisabler disabler2{};
2626 ptr2 = malloc (2 );
27- printf (" ptr: %p\n " , ptr); // ensure we don't optimize out the malloc
27+ fprintf (stderr, " Allocated second pointer %p in disabled context\n " ,
28+ ptr2);
2829 }
2930
3031 free (ptr2);
31- printf ( " Free'd second pointer in disabled context without crashing \n " );
32+ fprintf (stderr, " Free'd second pointer in disabled context\n " );
3233 }
3334
3435 free (ptr);
@@ -37,10 +38,12 @@ void violation() [[clang::nonblocking]] {
3738int main () {
3839 violation ();
3940 return 0 ;
41+ // CHECK: Allocated pointer {{.*}} in disabled context
42+ // CHECK: Allocated second pointer {{.*}} in disabled context
43+ // CHECK: Free'd second pointer in disabled context
4044 // CHECK: {{.*Real-time violation.*}}
4145 // CHECK-NOT: {{.*malloc*}}
42- // CHECK: Free'd second pointer in disabled context without crashing
43- // CHECK: {{.*real-time unsafe function `free`.*}}
46+ // CHECK-NEXT: {{.*free.*}}
4447}
4548
4649// CHECK-ENABLED-IR: {{.*@__rtsan_disable.*}}
0 commit comments