Currently, clang gives an incorrect reduction identifier error for the PLUS
operator for OpenMP version > 52. But, PLUS operator is allowed in OpenMP
version > 52. This revision fixes this issue and also modified the error
messages to show the correct expected operators in the message based on the OpenMP
version used (prior to OMP 6.0 and since OMP 6.0).
Test Src:
void foo() { int a = 0 ; #pragma omp parallel reduction(+:a) ; #pragma omp parallel reduction(-:a) ; }
Before this revision:
$ clang -fopenmp -fopenmp-version=60 test.c -c test.c:3:34: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int' 3 | #pragma omp parallel reduction(+:a) | ^ test.c:5:34: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int' 5 | #pragma omp parallel reduction(-:a) | ^ 2 errors generated.
With this revision:
$ clang -fopenmp -fopenmp-version=60 test.c -c test.c:5:34: error: incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int' 5 | #pragma omp parallel reduction(-:a) | ^
Reference:
(1) OpenMP 5.2 Page 627 Line 18
(2) OpenMP 5.2 Page 124 (Section 5.5) Line 18 and 20
(3) https://reviews.llvm.org/D150394