Is omp construct valid in a simd routine.

Is this example valid

int counter;

#pragma omp declare simd simdlen(16)

void attribute((noinline)) foo(bool isSIMD){

if (!isSIMD) {

#pragma omp parallel num_threads(1)

printf("%d\n", counter);

} else {

printf("%d\n", counter);



void bar() {

foo(false); // Is the user wrong to expect this call to foo honor “#pragma omp parallel” in foo?


void baz() {

#pragma omp simd

for(int i = 0; i < 32; i++)

foo(true); // Is it the compiler’s responsibility to ignore the “#pragma omp parallel” inside foo() for this call?


The spec says

The execution of the function or subroutine, when called from a SIMD loop, cannot result in the

execution of an OpenMP construct except for an ordered construct with the simd clause or an

atomic construct.



Please ignore. Wrong mailing list. Wanted to send it to OpenMP Lang Committee.