Hi
It seems that pgc++ (15.7) has an issue with a leading exclamation mark in an if clause of an OpenMP construct:
const bool nothing_to_do = true;
std::vector<int> numbers(1024);
#ifdef _OPENMP
#pragma omp parallel for default(none) if( !nothing_to_do ) shared(numbers)
for(size_t i=0;i<numbers.size();++i){
numbers[i] = i*i;
}
#endif
results in the following compile error:
main.C:
"main.C", line 39: error: expected an identifier
#pragma omp parallel for default(none) if( !nothing_to_do ) shared(numbers)
^
"main.C", line 39: error: invalid text in pragma
#pragma omp parallel for default(none) if( !nothing_to_do ) shared(numbers)
^
"main.C", line 39: error: extra text after expected end of preprocessing
directive
#pragma omp parallel for default(none) if( !nothing_to_do ) shared(numbers)
^
"main.C", line 36: error: variable "nothing_to_do" was declared but never
referenced
const bool nothing_to_do = true;
However, changing the if clause to
if(true && !nothing_to_do)
compiles without any problems. gcc doesn’t have a problem with either expression and probably the OpenMP standard requires any boolean expression to be supported.
Thanks,
LS