Bug 33459 - [4.2/4.3 regression] ICE on reference member in union
Summary: [4.2/4.3 regression] ICE on reference member in union
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.2.2
Assignee: Paolo Carlini
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-09-17 21:54 UTC by Volker Reichelt
Modified: 2007-09-20 10:05 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-09-19 14:43:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-09-17 21:54:23 UTC
The following invalid testcase triggers an ICE since GCC 4.2.1:

===================================
union A
{
  int &i;
};

void foo()
{
  A();
}
===================================

bug.cc:3: error: 'A::i' may not have reference type 'int&' because it is a member of a union
bug.cc: In function 'void foo()':
bug.cc:8: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]
Comment 1 Paolo Carlini 2007-09-18 10:55:18 UTC
Janis, is it possible to have a regression hunt? Thanks in advance.
Comment 2 Janis Johnson 2007-09-19 14:15:00 UTC
A regression hunt on powerpc-linux using the submitter's test case identified the following patch where the test starts failing:

    http://gcc.gnu.org/viewcvs?view=rev&rev=126399

    r126399 | mmitchel | 2007-07-06 01:23:54 +0000 (Fri, 06 Jul 2007)
Comment 3 Paolo Carlini 2007-09-19 14:43:10 UTC
Thanks a lot!
Comment 4 Paolo Carlini 2007-09-19 15:17:25 UTC
On it.
Comment 5 paolo@gcc.gnu.org 2007-09-20 09:49:30 UTC
Subject: Bug 33459

Author: paolo
Date: Thu Sep 20 09:49:13 2007
New Revision: 128615

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128615
Log:
cp/
2007-09-20  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33459
	* init.c (build_zero_init): If, recursively, build_zero_init
	returns a NULL_TREE, do not append it to the VEC of constructors.

testsuite/
2007-09-20  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33459
	* g++.dg/init/ref14.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/init/ref14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 paolo@gcc.gnu.org 2007-09-20 10:04:37 UTC
Subject: Bug 33459

Author: paolo
Date: Thu Sep 20 10:04:19 2007
New Revision: 128616

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128616
Log:
cp/
2007-09-20  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33459
	* init.c (build_zero_init): If, recursively, build_zero_init
	returns a NULL_TREE, do not append it to the VEC of constructors.

testsuite/
2007-09-20  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33459
	* g++.dg/init/ref14.C: New.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/init/ref14.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/init.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 7 Paolo Carlini 2007-09-20 10:05:14 UTC
Fixed.