Bug 13392 - [3.3/3.4 regression] ICE in convert_from_eh_region_ranges_1, at except.c:1133
Summary: [3.3/3.4 regression] ICE in convert_from_eh_region_ranges_1, at except.c:1133
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.3.3
Assignee: Not yet assigned to anyone
URL:
Keywords: EH, ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2003-12-13 01:39 UTC by Benjamin Kosnik
Modified: 2004-01-17 04:22 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu (FC1)
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-12-15 09:14:22


Attachments
pre-processed file from LLVM cvs (100.50 KB, application/x-tar)
2003-12-13 01:40 UTC, Benjamin Kosnik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kosnik 2003-12-13 01:39:23 UTC
Trying to build LLVM with current mainline g++ fails. Interestingly, it only
fails at -O0, but at -O2 it works. Strange. 

%COMP.sh "--version"
g++ (GCC) 3.4 20031208 (experimental)

%COMP.sh "-c -O0" CommandLine.ii
/mnt/hd/src/llvm/lib/Support/CommandLine.cpp: In function `void
llvm::RemoveArgument(const char*, llvm::cl::Option*)':
/mnt/hd/src/llvm/lib/Support/CommandLine.cpp:77: internal compiler error: in
convert_from_eh_region_ranges_1, at except.c:1133
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

vs.


<bkoz@roscoe> /home/bkoz %COMP.sh "-c -O2" CommandLine.ii
g++: -lv3test: linker input file unused because linking not done
Comment 1 Benjamin Kosnik 2003-12-13 01:40:33 UTC
Created attachment 5325 [details]
pre-processed file from LLVM cvs
Comment 2 Wolfgang Bangerth 2003-12-15 09:14:18 UTC
Confirmed. A regression in 3.3 and mainline from 3.2.3. Here is 
something smaller: 
---------------------- 
#include <string> 
 
bool foo(std::string s = std::string()) { 
  return false; 
} 
 
void RemoveArgument() { 
  (__builtin_expect (foo() && true, 1) ? 0 : (abort(), 0)); 
} 
---------------------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc: In function `void RemoveArgument()': 
x.cc:9: internal compiler error: in convert_from_eh_region_ranges_1, at 
except.c:1133 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
g/x>  
g/x>  
g/x>  
g/x>  
g/x> /home/bangerth/bin/gcc-3.3.3-pre/bin/c++ -c x.cc 
x.cc: In function `void RemoveArgument()': 
x.cc:9: internal compiler error: in convert_from_eh_region_ranges_1, at  
   except.c:1159 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
I'll work on something self-contained. 
 
W. 
Comment 3 Wolfgang Bangerth 2003-12-15 09:22:40 UTC
So here we go: 
--------------------- 
extern void abort (void) throw () __attribute__ ((__noreturn__)); 
 
struct X { 
    ~X () throw() {} 
}; 
 
bool foo(X s = X()) { return false; } 
 
void bar() { 
  (__builtin_expect (foo() && true, 1) ? 0 : (abort(), 0)); 
} 
----------------------------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc: In function `void bar()': 
x.cc:11: internal compiler error: in convert_from_eh_region_ranges_1, at 
except.c:1133 
Please submit a full bug report, 
 
Comment 4 Benjamin Kosnik 2003-12-15 16:14:17 UTC
Subject: Re:  ICE in convert_from_eh_region_ranges_1, at
 except.c:1133


>Confirmed. A regression in 3.3 and mainline from 3.2.3. Here is 
>something smaller: 
>---------------------- 
>#include <string> 
> 
>bool foo(std::string s = std::string()) { 
>  return false; 
>} 
> 
>void RemoveArgument() { 
>  (__builtin_expect (foo() && true, 1) ? 0 : (abort(), 0)); 
>} 
>---------------------- 

Wow, this reduction is pretty impressive. You went from 856k to 5 lines! Awesome. 

-benjamin
Comment 5 Wolfgang Bangerth 2003-12-15 17:22:27 UTC
:-) And this one was even one of the simpler ones and took me less than 10 
minutes. I've learned to find the cut-points in the string headers 
quickly, and what patterns eh-related bugs follow w.r.t. string and 
allocator classes. A year ago, this would have been a testcase I would 
have dreaded, and which would have taken me one or two hours to reduce. 
The pattern-matching powers of the human brain are impressive ;-) 
 
W. 
Comment 6 Andrew Pinski 2003-12-16 16:32:15 UTC
From Phil's regression hunter: Search converges between 2003-03-23-trunk (#253) and 2003-03
-30-trunk (#254).
: Search converges between 2003-03-23-3.3 (#85) and 2003-03-30-3.3 (#86).
Comment 7 janis187 2003-12-22 23:08:47 UTC
The regression in PR 13392 was introduced or exposed with this patch:

2003-03-24  Jakub Jelinek  <jakub@redhat.com>

        * dojump.c (do_jump): Handle UNSAVE_EXPR specially.

The regression hunt took place on i686-pc-linux-gnu using the minimized
test case from comment #3 compiled with default options, starting with
the range identified by Phil's regression hunter.
Comment 8 Andrew Pinski 2003-12-22 23:30:53 UTC
This is Execption handling related (yes the ICE is eh also but if I compile the self-containted 
example with -fno-exceptions, it compiles just fine).
Comment 10 GCC Commits 2004-01-11 19:05:38 UTC
Subject: Bug 13392

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2004-01-11 19:05:34

Modified files:
	gcc            : ChangeLog builtins.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: expect2.C 

Log message:
	PR middle-end/13392
	* builtins.c (expand_builtin_expect_jump): Handle conditional jumps
	to drop through label.  Don't fall back to SCC even when conditional
	jump has not been found.
	
	* g++.dg/opt/expect2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2224&r2=2.2225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.270&r2=1.271
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3359&r2=1.3360
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/expect2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 11 GCC Commits 2004-01-11 19:13:15 UTC
Subject: Bug 13392

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	jakub@gcc.gnu.org	2004-01-11 19:13:13

Modified files:
	gcc            : ChangeLog builtins.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: expect2.C 

Log message:
	PR middle-end/13392
	* builtins.c (expand_builtin_expect_jump): Handle conditional jumps
	to drop through label.  Don't fall back to SCC even when conditional
	jump has not been found.
	
	* g++.dg/opt/expect2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.872&r2=1.16114.2.873
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.165.2.9&r2=1.165.2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.351&r2=1.2261.2.352
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/expect2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1

Comment 12 Andrew Pinski 2004-01-11 19:34:13 UTC
Fixed for 3.3.3.
Comment 13 GCC Commits 2004-02-28 11:16:18 UTC
Subject: Bug 13392

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_2-rhl8-branch
Changes by:	jakub@gcc.gnu.org	2004-02-28 11:16:07

Modified files:
	gcc            : ChangeLog builtins.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: expect2.C 

Log message:
	PR middle-end/13392
	* builtins.c (expand_builtin_expect_jump): Handle conditional jumps
	to drop through label.  Don't fall back to SCC even when conditional
	jump has not been found.
	
	* g++.dg/opt/expect2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.13152.2.657.2.27.2.182&r2=1.13152.2.657.2.27.2.183
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.142.2.2.8.14&r2=1.142.2.2.8.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.1672.2.166.2.8.2.76&r2=1.1672.2.166.2.8.2.77
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/expect2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=NONE&r2=1.1.20.1