The following openmp test case will not compile when it is first separating processed by the preprocessor:
$ cat bug2885b.c #include <omp.h> #include <stdio.h> #define NT 4 int actual_num_threads; int main(){ #pragma omp parallel default(none) shared(actual_num_threads) num_threads(NT) { #pragma omp master { actual_num_threads = omp_get_num_threads(); } } printf("actual_num_threads: %d\n",actual_num_threads); printf("num_threads NT: %d\n",NT); return 0; } $ gcc --version gcc (GCC) 4.3.1 20080606 (rpm:5) Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ <Works: Not running through the preprocessor separately> $ gcc -fopenmp bug2885b.c; ./a.out actual_num_threads: 4 num_threads NT: 4 $ <Error: Running the preprocessor separately> $ gcc -E -fopenmp bug2885b.c > bug.c $ gcc -fopenmp bug.c bug2885b.c: In function 'main': bug2885b.c:7: error: 'NT' undeclared (first use in this function) bug2885b.c:7: error: (Each undeclared identifier is reported only once bug2885b.c:7: error: for each function it appears in.) bug2885b.c:7: error: expected integer expression before end of line $ -- Summary: Macro is not passed to openmp pragma when preprocessor is used Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: geir at cray dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37764