Bug 37764 - Macro is not passed to openmp pragma when preprocessor is used
Summary: Macro is not passed to openmp pragma when preprocessor is used
Status: RESOLVED DUPLICATE of bug 37023
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.3.1
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-07 22:35 UTC by Geir Johansen
Modified: 2008-10-07 22:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geir Johansen 2008-10-07 22:35:11 UTC
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
$
Comment 1 Andrew Pinski 2008-10-07 22:51:59 UTC

*** This bug has been marked as a duplicate of 37023 ***