llvm-capstone/openmp/runtime/test/misc_bugs/omp_nothing.c
Sandeep Kosuri ecc080c07d
[OpenMP] return empty stmt for nothing (#74042)
- `nothing` directive was effecting the `if` block structure which it
should not. So return an empty statement instead of an error statement
while parsing to avoid this.
2023-12-03 13:33:38 +05:30

27 lines
397 B
C

// RUN: %libomp-compile
// RUN: %libomp-run | FileCheck %s --check-prefix OMP-CHECK
#include <stdio.h>
void foo(int x) {
printf("foo");
return;
}
int main() {
int x = 4;
// should call foo()
if (x % 2 == 0)
#pragma omp nothing
foo(x);
// should not call foo()
x = 3;
if (x % 2 == 0)
#pragma omp nothing
foo(x);
// OMP-CHECK: foo
// OMP-CHECK-NOT: foo
return 0;
}