Bug 12726 - [3.3.2/3.4 regression] ICE (segfault) on trivial code
Summary: [3.3.2/3.4 regression] ICE (segfault) on trivial code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.2
: P1 critical
Target Milestone: 3.3.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 12765 13192 13235 13281 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-22 17:08 UTC by Vladimir Zidar
Modified: 2004-01-17 04:22 UTC (History)
6 users (show)

See Also:
Host: i386-redhat-linux
Target: i386-redhat-linux
Build: i386-redhat-linux
Known to work:
Known to fail:
Last reconfirmed: 2003-10-22 19:54:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Zidar 2003-10-22 17:08:46 UTC
#include <string>
 
struct foobar {
    std::string s;
  };
 
int main(int argc, char **argv)
{
foobar fb;
 
fb = (foobar) { "abcd" };
 
return 0;
}


-----

[mr_w@mravojed ~/build/xtest] $ /usr/local/gcc/3.3.2/bin/g++ -v -save-temps xt9.
cpp
Reading specs from /usr/local/gcc/3.3.2/lib/gcc-lib/i386-redhat-linux/3.3.
2/specs
Configured with: ../configure --prefix=/usr/local/gcc/3.3.2 
--infodir=/usr/local/gcc/3.3.2/share/info --mandir=/usr/local/gcc/3.3.
2/share/man --disable-static --enable-shared --enable-threads=posix 
--enable-__cxa_atexit --enable-languages=c,c++,f77,objc,java,ksi --enable-c99 
--enable-long-long --enable-multilib --enable-nls --with-gnu-as --with-gnu-ld 
--with-system-zlib --with-slibdir=/lib --without-x i386-redhat-linux
Thread model: posix
gcc version 3.3.2 (PLD Linux)
 /usr/local/gcc/3.3.2/lib/gcc-lib/i386-redhat-linux/3.3.2/cc1plus -E 
-D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 
-D_GNU_SOURCE xt9.cpp xt9.ii
ignoring nonexistent directory "/usr/local/gcc/3.3.2/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc/3.3.2/include/c++/3.3.2
 /usr/local/gcc/3.3.2/include/c++/3.3.2/i386-redhat-linux
 /usr/local/gcc/3.3.2/include/c++/3.3.2/backward
 /usr/local/include
 /usr/local/gcc/3.3.2/include
 /usr/local/gcc/3.3.2/lib/gcc-lib/i386-redhat-linux/3.3.2/include
 /usr/include
End of search list.
 /usr/local/gcc/3.3.2/lib/gcc-lib/i386-redhat-linux/3.3.2/cc1plus -fpreprocessed 
xt9.ii -quiet -dumpbase xt9.cpp -auxbase xt9 -version -o xt9.s
GNU C++ version 3.3.2 (PLD Linux) (i386-redhat-linux)
        compiled by GNU C version 3.3.2 (PLD Linux).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31913
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://bugs.pld.org.pl/> for instructions.
Comment 1 Wolfgang Bangerth 2003-10-22 19:14:02 UTC
Confirmed. This seems to go into an infinite loop with 3.3 and
mainline. I don't presently have the time to track it down, just
wanted to confirm it.

W.
Comment 2 Volker Reichelt 2003-10-22 19:54:32 UTC
Indeed. Crashes 3.3.2, but not 3.3.1 or mainline.
Here's a reduced code snippet:

===============================================
struct A
{
    A();
    A(const A&);
    A(int);
};

struct B
{
    A a;
};

void foo()
{
    B b;
    b = (B){0};
}
===============================================

According to Phil's tester, the regression was introduced
between 2003-10-14-3.3 (#246) and 2003-10-15-3.3 (#247).
Comment 3 Volker Reichelt 2003-10-22 19:59:44 UTC
Sorry, I just checked with an outdate version of mainline.

The program indeed crashes gcc 3.3.2 and mainline.
Comment 4 Volker Reichelt 2003-10-22 20:06:29 UTC
Jason, I suspect your patch

http://gcc.gnu.org/ml/gcc-cvs/2003-10/msg00551.html

as being responsible for the regression.
(I can't check right now, though.)

Could you please have a look anyway?
Comment 5 GCC Commits 2003-10-23 06:40:58 UTC
Subject: Bug 12726

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2003-10-23 06:40:52

Added files:
	gcc/testsuite/g++.dg/ext: complit2.C 

Log message:
	PR c++/12726
	* tree.c (build_target_expr_with_type): Don't call force_rvalue
	for CONSTRUCTORs.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/complit2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 GCC Commits 2003-10-23 06:41:34 UTC
Subject: Bug 12726

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2003-10-23 06:41:31

Modified files:
	gcc/cp         : ChangeLog tree.c 

Log message:
	PR c++/12726
	* tree.c (build_target_expr_with_type): Don't call force_rvalue
	for CONSTRUCTORs.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3742&r2=1.3743
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.353&r2=1.354

Comment 7 Andrew Pinski 2003-10-23 06:49:38 UTC
Only a 3.2.3 regression now.
Comment 8 Volker Reichelt 2003-10-23 07:59:01 UTC
Typo in Jason's comment: It's a 3.3.2-only regression now!
Comment 9 GCC Commits 2003-10-23 10:48:10 UTC
Subject: Bug 12726

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	jason@gcc.gnu.org	2003-10-23 10:48:06

Modified files:
	gcc/cp         : ChangeLog tree.c 

Log message:
	PR c++/12726
	* tree.c (build_target_expr_with_type): Don't call force_rvalue
	for CONSTRUCTORs.

Patches:
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.218&r2=1.3076.2.219
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.307.2.5&r2=1.307.2.6

Comment 10 Andrew Pinski 2003-10-23 14:35:13 UTC
Fixed for 3.3.3 and 3.4.
Comment 11 Jason Merrill 2003-10-27 19:05:32 UTC
*** Bug 12765 has been marked as a duplicate of this bug. ***
Comment 12 GCC Commits 2003-11-03 21:29:39 UTC
Subject: Bug 12726

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2003-11-03 21:29:35

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/ext: complit2.C 

Log message:
	PR c++/12726
	* g++.dg/ext/complit2.C: Replace test with self-contained version.
	* ChangeLog: Add missing first entry for above test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3166&r2=1.3167
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/complit2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 13 Volker Reichelt 2003-11-26 01:52:19 UTC
*** Bug 13192 has been marked as a duplicate of this bug. ***
Comment 14 Volker Reichelt 2003-12-03 14:47:37 UTC
*** Bug 13281 has been marked as a duplicate of this bug. ***
Comment 15 Volker Reichelt 2003-12-08 00:57:48 UTC
*** Bug 13235 has been marked as a duplicate of this bug. ***