I'm using GCC with OpenMP since some years now. I find now in a Fedora
11, x86_64 system (GCC 4.4) that compiling the following code gives an
internal error.
Code:
------ gccbug.cpp -------
#include <cstdio>
#include <omp.h>
void f() {
#pragma omp parallel
{
int jx=-1, foo;
while (1) {
#pragma omp critical
{
foo = 23;
printf("hahaha \n");
}
if (jx==0) break;
}
// foo = 45;
}
}
----------------
[mstorti@galileo mgwomp]$ g++ -fopenmp -c -o gccbug.o gccbug.cpp
gccbug.cpp: In function 'void f()':
gccbug.cpp:18: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccIPB69w.out file, please attach this to your bugreport.
[mstorti@galileo mgwomp]$
Of coursem the code does nothing, it comes from a mathematical program
that I'm trying to speed up with OpenMP and when I found the error I
simplified the code, arriving to the snippet above.
I found that the error disappears and the code is corretly compiled if
1./ The printf line is uncommented.
2./ The line foo=45 is uncommented.
3./ The "#pragma omp" lines are commented.
Also, the same code compiles OK in a Fedora 9 system (GCC 4.3).
Should I report this bug at bugzilla.redhat.com?
Regards, Mario
PS: some more data follows. Attached is the preprocessed source
`ccIPB69w.out'.
Code:
[mstorti@galileo mgwomp]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i586 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)
[mstorti@galileo mgwomp]$