@@ -14,21 +14,22 @@ void violation() [[clang::nonblocking]] {
14
14
{
15
15
__rtsan::ScopedDisabler disabler{};
16
16
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);
18
18
}
19
19
20
20
// ensure nested disablers don't interfere with one another
21
- void *ptr2;
22
21
{
22
+ void *ptr2;
23
23
__rtsan::ScopedDisabler disabler{};
24
24
{
25
25
__rtsan::ScopedDisabler disabler2{};
26
26
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);
28
29
}
29
30
30
31
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 " );
32
33
}
33
34
34
35
free (ptr);
@@ -37,10 +38,12 @@ void violation() [[clang::nonblocking]] {
37
38
int main () {
38
39
violation ();
39
40
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
40
44
// CHECK: {{.*Real-time violation.*}}
41
45
// 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.*}}
44
47
}
45
48
46
49
// CHECK-ENABLED-IR: {{.*@__rtsan_disable.*}}
0 commit comments