cilk_for syntax differs between icc and gcc?

cilk_for syntax differs between icc and gcc?

Has the difference in syntax requirement been explained? 

Source code which works with icc produces with gcc:

gcc -std=c99 -v -fcilkplus -c loopscean.c
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.9 --enable-languages='c c++ fortran' : (reconfigured) ../configure --prefix=/usr/local/gcc-4.9 --enable-languages='c c++ fortran'
Thread model: posix
gcc version 4.9.0 20131031 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-std=c99' '-v' '-fcilkplus' '-c' '-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1 -quiet -v loopscean.c -quiet -dumpbase loopscean.c -mtune=generic -march=x86-64 -auxbase loopscean -std=c99 -version -fcilkplus -o /tmp/ccaLHKKv.s
GNU C (GCC) version 4.9.0 20131031 (experimental) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.0 20131031 (experimental), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

loopscean.c:410:7: warning: implicit declaration of function ‘_Cilk_for’ [-Wimplicit-function-declaration]
       cilk_for(int j = 2; j <= i__2; j++) {
loopscean.c:410:16: error: expected expression before ‘int’
       cilk_for(int j = 2; j <= i__2; j++) {
loopscean.c:410:43: error: expected ‘;’ before ‘{’ token
       cilk_for(int j = 2; j <= i__2; j++) {

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Have you made sure you're including cilk/cilk.h and, that failing, that you have -lcilkrts in your Makefile? The implicit declaration warning for the _Cilk_for function probably means that the function has not been defined.


The translation from cilk_for to __Cilk_for is done by cilk.h, so it clearly was used by gcc. I agree that implicit warning makes one suspect problems with include file hierarchy.  -lcilkrts of course was used to run successfully with icc, but is irrelevant when the source syntax isn't accepted.

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen