Bug 35315 - [4.4 regression] ICE with attribute transparent_union
Summary: [4.4 regression] ICE with attribute transparent_union
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks: 43370
  Show dependency treegraph
 
Reported: 2008-02-23 17:44 UTC by Volker Reichelt
Modified: 2011-03-18 15:06 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-02-25 18:11:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-02-23 17:44:24 UTC
The following valid code snippet triggers an ICE on mainline:

=================================================================
typedef union { int i; } U __attribute__((transparent_union));

static void foo(U) {}
static void foo(int) {}

void bar()
{
  foo(0);
}
=================================================================

bug.cc: In function 'void bar()':
bug.cc:8: internal compiler error: same canonical type node for different types <anonymous union> and U
Please submit a full bug report, [etc.]
Comment 1 dgregor 2008-02-26 07:16:26 UTC
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01272.html
Comment 2 Jason Merrill 2008-02-26 18:09:47 UTC
Subject: Bug 35315

Author: jason
Date: Tue Feb 26 18:09:02 2008
New Revision: 132681

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132681
Log:
        PR c++/35315
        * attribs.c (decl_attributes): Leave ATTR_FLAG_TYPE_IN_PLACE
        alone if it's the naming decl for the type's main variant.
        * cp/decl.c (grokdeclarator): Allow a typedef of an unnamed struct
        to name the struct for linkage purposes even if it has attributes.
        (start_decl): In that case, set ATTR_FLAG_TYPE_IN_PLACE.

Added:
    trunk/gcc/testsuite/g++.dg/ext/attrib32.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/attribs.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c

Comment 3 dgregor 2008-02-29 21:42:27 UTC
Subject: Bug 35315

Author: dgregor
Date: Fri Feb 29 21:41:38 2008
New Revision: 132779

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132779
Log:
2008-02-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35315
	* tree-inline.c (build_duplicate_type): When we make a
	duplicate type, make it unique in the canonical types system.

2008-02-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35315
	* g++.dg/ext/attrib32.C: Add another test case.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/attrib32.C
    trunk/gcc/tree-inline.c

Comment 4 dgregor 2008-03-01 05:38:33 UTC
Subject: Bug 35315

Author: dgregor
Date: Sat Mar  1 05:37:41 2008
New Revision: 132798

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132798
Log:
2008-02-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35315
	* tree-inline.c (build_duplicate_type): When we make a
	duplicate type, make it unique in the canonical types system.

2008-02-29  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35315
	* g++.dg/ext/attrib32.C: New.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/ext/attrib32.C
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/gcc/tree-inline.c

Comment 5 dgregor 2008-03-01 16:29:35 UTC
Fixed on mainline and 4.3 branch.
Comment 6 Jason Merrill 2011-03-18 15:06:47 UTC
Author: jason
Date: Fri Mar 18 15:06:41 2011
New Revision: 171145

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171145
Log:
	PR c++/35315
	* c-common.c (handle_transparent_union_attribute): Don't
	make a duplicate type in C++.

Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/attrib32.C