[Bug c++/69826] New: problem with cilkplus pragma and preprocessor variable

ycollette.nospam at free dot fr gcc-bugzilla@gcc.gnu.org
Mon Feb 15 14:48:00 GMT 2016


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

            Bug ID: 69826
           Summary: problem with cilkplus pragma and preprocessor variable
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ycollette.nospam at free dot fr
  Target Milestone: ---

For cilkplus, the pragma cilk grainsize doesn't seems to accept preprocessor
variables.

Here is a small example:

test.cpp

#include <cilk/cilk.h>

#define CILK_FOR_GRAINSIZE 128

void CoinAbcScatterUpdate(int number)
{
  int result = 0;

#pragma cilk grainsize=CILK_FOR_GRAINSIZE
  cilk_for(int j=0; j < number; j+=2) {
    result+=j;
  }
}

The compilation:

$ g++ -c -fcilkplus test.cpp -o test.o

The Error message:

test.cpp: Dans la fonction ‘void CoinAbcScatterUpdate(int)’:
test.cpp:9:24: erreur: ‘CILK_FOR_GRAINSIZE’ was not declared in this scope
 #pragma cilk grainsize=CILK_FOR_GRAINSIZE
                        ^
test.cpp:9:9: erreur: invalid grainsize for _Cilk_for
 #pragma cilk grainsize=CILK_FOR_GRAINSIZE
         ^

If I replace #define CILK_FOR_GRAINSIZE 128 by int CILK_FOR_GRAINSIZE = 128;
then the compilation went fine.


More information about the Gcc-bugs mailing list