https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100450

            Bug ID: 100450
           Summary: Missing ' ' space for '-E' preprocessing output, works
                    with direct compilation
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following code compiles with
  -c -fopenmp -Wall test.c

But the output with -E + compilation shows:
  warning: ignoring ‘#pragma omp forreduction’ [-Wunknown-pragmas]

as the -E preprocessor outputs:
  #pragma omp forreduction(+:red)
instead of the expected
  #pragma omp for reduction(+:red)
-----------------^

Testcase:
-----------------------------------
#define TEST(T) { \
     {T} \
}
#define CLAUSES reduction(+:red)
#define PARALLEL_FOR(X) TEST({ \
_Pragma("omp for CLAUSES") \
X \
})

void foo()
{
  int red = 0;
  int A[3] = {};
  #pragma omp parallel shared(red)
  PARALLEL_FOR( for(int i=0; i < 3; i++) red += A[i]; )
}

Reply via email to