File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,20 @@ void violation() [[clang::nonblocking]] {
17
17
printf (" ptr: %p\n " , ptr); // ensure we don't optimize out the malloc
18
18
}
19
19
20
+ // ensure nested disablers don't interfere with one another
21
+ void *ptr2;
22
+ {
23
+ __rtsan::ScopedDisabler disabler{};
24
+ {
25
+ __rtsan::ScopedDisabler disabler2{};
26
+ ptr2 = malloc (2 );
27
+ printf (" ptr: %p\n " , ptr); // ensure we don't optimize out the malloc
28
+ }
29
+
30
+ free (ptr2);
31
+ printf (" Free'd second pointer in disabled context without crashing\n " );
32
+ }
33
+
20
34
free (ptr);
21
35
}
22
36
@@ -25,7 +39,8 @@ int main() {
25
39
return 0 ;
26
40
// CHECK: {{.*Real-time violation.*}}
27
41
// CHECK-NOT: {{.*malloc*}}
28
- // CHECK: {{.*free*}}
42
+ // CHECK: Free'd second pointer in disabled context without crashing
43
+ // CHECK: {{.*real-time unsafe function `free`.*}}
29
44
}
30
45
31
46
// CHECK-ENABLED-IR: {{.*@__rtsan_disable.*}}
You can’t perform that action at this time.
0 commit comments