Bug 35099 - [4.3/4.4 Regression] ICE in remove_unreachable_regions with -O -fopenmp
Summary: [4.3/4.4 Regression] ICE in remove_unreachable_regions with -O -fopenmp
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.3.1
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code, openmp
Depends on:
Blocks:
 
Reported: 2008-02-06 08:01 UTC by Takaki Makino
Modified: 2008-03-13 08:17 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.2.2
Known to fail: 4.3.0
Last reconfirmed: 2008-03-10 13:48:25


Attachments
Testcase (147.34 KB, text/plain)
2008-02-06 08:03 UTC, Takaki Makino
Details
fairly reduced testcase (765 bytes, text/plain)
2008-02-06 18:05 UTC, Ralf Wildenhues
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Takaki Makino 2008-02-06 08:01:42 UTC
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)
Comment 1 Takaki Makino 2008-02-06 08:03:12 UTC
Created attachment 15103 [details]
Testcase
Comment 2 Richard Biener 2008-02-06 12:29:06 UTC
Also ICEs on x86_64 with -m32 (but not without).
Comment 3 Ralf Wildenhues 2008-02-06 18:05:33 UTC
Created attachment 15110 [details]
fairly reduced testcase
Comment 4 Richard Biener 2008-02-06 20:58:59 UTC
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.
Comment 5 Volker Reichelt 2008-02-06 22:31:32 UTC
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();
  }
}
===============================
Comment 6 Jakub Jelinek 2008-03-10 13:48:25 UTC
Testing a fix.
Comment 7 Jakub Jelinek 2008-03-10 19:40:15 UTC
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

Comment 8 Jakub Jelinek 2008-03-10 20:52:02 UTC
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

Comment 9 Volker Reichelt 2008-03-13 08:17:46 UTC
Fixed by Jakub's patch.