Bug 7050 - [3.2/3.3/3.4 regression] g++ segfaults on: (i ? get_string() : throw)
Summary: [3.2/3.3/3.4 regression] g++ segfaults on: (i ? get_string() : throw)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.0.4
: P3 normal
Target Milestone: ---
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-06-17 02:16 UTC by tuomas
Modified: 2004-01-17 04:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
test.ii.bz2 (38.05 KB, application/octet-stream)
2003-05-21 15:16 UTC, tuomas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tuomas 2002-06-17 02:16:01 UTC
g++-3.0 gives an internal error when compiling this source code.

Complete g++ output:
--------------------
tuomas@zerox:/tmp/test$ g++-3.0 -v -save-temps test.cc
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4
 /usr/lib/gcc-lib/i386-linux/3.0.4/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.cc test.ii
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-v3
 /usr/include/g++-v3/i386-linux
 /usr/include/g++-v3/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/3.0.4/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-linux/3.0.4/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.cc -version -o test.s
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.4 (i386-linux)
        compiled by GNU C version 3.0.4.
test.cc: In function `int main()':
test.cc:10: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
----------------------

Release:
gcc version 3.0.4

Environment:
System: Linux zerox 2.4.17 #1 Tue Jan 15 03:24:21 EET 2002 i686 unknown
Architecture: i686
(Plain Debian "Woody" installation on an AMD Athlon.)

tuomas@zerox:/tmp/test$ g++-3.0 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4

How-To-Repeat:
Here is the complete source code.
---------------------------------
#include <string>
using std::string;

string get_string() {
    return "foo";
}

int main(void) {
    int i=0;
    (i ? get_string() : throw);
}
Comment 1 Kriang Lerdsuwanakij 2002-06-17 07:14:08 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 2 Wolfgang Bangerth 2003-01-22 20:57:56 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7050
Date: Wed, 22 Jan 2003 20:57:56 -0600 (CST)

 This is a regression from 2.95, which is why I just adjusted the priority.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 
Comment 3 Jason Merrill 2003-03-04 20:26:07 UTC
Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-Why: shepherding a patch from Andrew Lewycky  <andrew@mxc.ca>
Comment 4 Jason Merrill 2003-03-12 22:24:48 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7050
Date: 12 Mar 2003 22:24:48 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-12 22:24:48
 
 Modified files:
 	gcc            : ChangeLog expr.c 
 	gcc/cp         : ChangeLog expr.c 
 
 Log message:
 	PR c++/7050
 	* expr.c (store_expr): Don't attempt to store void-typed trees,
 	just evaluate them for side effects.
 	* cp/expr.c (cxx_expand_expr): Return const0_rtx for throw
 	expressions.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17055&r2=1.17056
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.511&r2=1.512
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3267&r2=1.3268
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/expr.c.diff?cvsroot=gcc&r1=1.71&r2=1.72
 

Comment 5 Jason Merrill 2003-03-12 22:51:57 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7050
Date: 12 Mar 2003 22:51:57 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	jason@gcc.gnu.org	2003-03-12 22:51:57
 
 Modified files:
 	gcc            : ChangeLog expr.c 
 	gcc/cp         : ChangeLog expr.c 
 
 Log message:
 	PR c++/7050
 	* expr.c (store_expr): Don't attempt to store void-typed trees,
 	just evaluate them for side effects.
 	* cp/expr.c (cxx_expand_expr): Return const0_rtx for throw
 	expressions.
 
 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.292&r2=1.16114.2.293
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.498.2.8&r2=1.498.2.9
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.79&r2=1.3076.2.80
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.66&r2=1.66.4.1
 

Comment 6 Jason Merrill 2003-03-12 22:59:38 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7050
Date: 12 Mar 2003 22:59:38 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	jason@gcc.gnu.org	2003-03-12 22:59:37
 
 Modified files:
 	gcc            : ChangeLog expr.c 
 	gcc/cp         : ChangeLog expr.c 
 
 Log message:
 	PR c++/7050
 	* expr.c (store_expr): Don't attempt to store void-typed trees,
 	just evaluate them for side effects.
 	* cp/expr.c (cxx_expand_expr): Return const0_rtx for throw
 	expressions.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.256&r2=1.13152.2.657.2.257
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.423.2.19.4.8&r2=1.423.2.19.4.9
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.68&r2=1.2685.2.114.2.69
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.63&r2=1.63.6.1
 
Comment 7 Jason Merrill 2003-03-13 00:20:43 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: fix applied.
Comment 8 Jason Merrill 2003-03-21 07:08:02 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7050
Date: 21 Mar 2003 07:08:02 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-21 07:08:02
 
 Added files:
 	gcc/testsuite/g++.dg/eh: cond1.C 
 
 Log message:
 	PR c++/7050
 	* expr.c (store_expr): Don't attempt to store void-typed trees,
 	just evaluate them for side effects.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/eh/cond1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1