g++ on the trunk (revision 132140) produces ICE when compiling the attached test1.ii. I tried to reduce the code but I couldn't. $ g++-4.3 -E test.cpp -o test1.ii $ g++-4.3 -O -fopenmp test1.ii hoge.cpp: In function 'void _Z15test_learnervecP15EnvironmentBaseRSt6vectorIP11LearnerBaseSaIS3_EEiSs.omp_fn.0(void*)': hoge.cpp:85: internal compiler error: in remove_unreachable_regions, at except.c:693 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. mak@cl26:~/src/tdn$ g++-4.3 -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/home/mak/local --program-suffix=-4.3 : (reconfigured) ../configure --prefix=/home/mak/local --program-suffix=-4.3 CPPFLAGS=-I/home/mak/local/include LDFLAGS=-L/home/mak/local/lib --enable-languages=c,c++,fortran,java,objc --no-create --no-recursion Thread model: posix gcc version 4.3.0 20080206 (experimental) (GCC)
Created attachment 15103 [details] Testcase
Also ICEs on x86_64 with -m32 (but not without).
Created attachment 15110 [details] fairly reduced testcase
Confirmed. If you remove the second #pragma omp single in if( s == 0 ) { #pragma omp single #pragma omp single { for( LearnerBase * i = learners[0]; s == 0; ) { if( os ) i->getInfo(); } } then the ICE is gone. It also warns about this, but I don't see this warning in the original testcase, so the reduced testcase may not trigger exactly the same bug - who knows.
Even shorter testcase that doesn't trigger a warning: =============================== struct A { ~A() throw(); void foo(); }; struct B { B() { A().foo(); } }; void bar() { #pragma omp parallel { #pragma omp critical B(); #pragma omp for for (int i=0; i<2; ++i) B(); } } ===============================
Testing a fix.
Subject: Bug 35099 Author: jakub Date: Mon Mar 10 19:39:30 2008 New Revision: 133084 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133084 Log: PR middle-end/35099 * tree-cfg.c (new_label_mapper): Update cfun->last_label_uid. * g++.dg/gomp/pr35099.C: New test. Added: trunk/gcc/testsuite/g++.dg/gomp/pr35099.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-cfg.c
Subject: Bug 35099 Author: jakub Date: Mon Mar 10 20:51:18 2008 New Revision: 133088 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133088 Log: PR middle-end/35099 * tree-cfg.c (new_label_mapper): Update cfun->last_label_uid. * g++.dg/gomp/pr35099.C: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/gomp/pr35099.C Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/tree-cfg.c
Fixed by Jakub's patch.