[OpenMP][Tool] Fix possible NULL-pointer dereference in test

Avoid dereferencing a possibly uninitialized pointer as mentioned in D91280.
This commit is contained in:
Joachim Protze 2020-11-11 20:10:54 +01:00
parent ce0911b3e9
commit 3fa2e19338
1 changed files with 1 additions and 9 deletions

View File

@ -34,7 +34,7 @@ int main() {
usleep(10000); usleep(10000);
a++; a++;
printf("%i: calling omp_fulfill_event\n", omp_get_thread_num()); printf("%i: calling omp_fulfill_event\n", omp_get_thread_num());
omp_fulfill_event(*f_event); omp_fulfill_event(event);
//#pragma omp task if (0) depend(in : f_event) //#pragma omp task if (0) depend(in : f_event)
// {} // {}
b++; b++;
@ -47,14 +47,6 @@ int main() {
// no race for a++ in line 32: // no race for a++ in line 32:
// CHECK-NOT: #0 {{.*}}task_late_fulfill.c:35 // CHECK-NOT: #0 {{.*}}task_late_fulfill.c:35
// we expect a race on f_event:
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: {{(Write|Read)}} of size 8
// CHECK-NEXT: #0 {{.*}}task_late_fulfill.c:37
// CHECK: Previous write of size 8
// CHECK-NEXT: #0 {{.*}}task_late_fulfill.c:26
// CHECK: WARNING: ThreadSanitizer: data race // CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: {{(Write|Read)}} of size 4 // CHECK-NEXT: {{(Write|Read)}} of size 4
// CHECK-NEXT: #0 {{.*}}task_late_fulfill.c:31 // CHECK-NEXT: #0 {{.*}}task_late_fulfill.c:31