https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67581
Bug ID: 67581
Summary: ICE on transparent union with -g enabled on
x86_64-linux-gnu (verify_type failed)
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu when -g is enabled.
This is a regression from 5.2.x.
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20150914 (experimental) [trunk revision 227747] (GCC)
$
$ g++-trunk -c t.cc
$ g++-5.2 -c -g t.cc
$
$ g++-trunk -c -g t.cc
t.cc:1:7: error: type variant differs by TYPE_TRANSPARENT_AGGR.
union U
^
<union_type 0x7fefaab41348 U asm_written transparent-aggr type_5 SI
size <integer_cst 0x7fefaa9fd0a8 type <integer_type 0x7fefaa9df2a0
bitsizetype> constant 32>
unit size <integer_cst 0x7fefaa9fd0c0 type <integer_type 0x7fefaa9df1f8
sizetype> constant 4>
align 32 symtab -1432334256 alias set -1 canonical type 0x7fefaab41348
fields <field_decl 0x7fefaab3e4c0 x
type <integer_type 0x7fefaa9df7e0 int asm_written public SI size
<integer_cst 0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 symtab -1432334096 alias set -1 canonical type
0x7fefaa9df7e0 precision 32 min <integer_cst 0x7fefaa9fd060 -2147483648> max
<integer_cst 0x7fefaa9fd078 2147483647>
pointer_to_this <pointer_type 0x7fefaaa01930>>
nonlocal decl_3 SI file t.cc line 3 col 7 size <integer_cst
0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 offset_align 128
offset <integer_cst 0x7fefaa9dbe88 constant 0>
bit offset <integer_cst 0x7fefaa9dbed0 constant 0> context <union_type
0x7fefaab41348 U>
chain <field_decl 0x7fefaab3e558 y type <real_type 0x7fefaaa01540
float>
nonlocal decl_3 SF file t.cc line 4 col 9 size <integer_cst
0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 offset_align 128 offset <integer_cst 0x7fefaa9dbe88 0> bit
offset <integer_cst 0x7fefaa9dbed0 0> context <union_type 0x7fefaab41348 U>
chain <type_decl 0x7fefaab3e428 U>>> context <translation_unit_decl
0x7fefabdb01e0 D.1>
full-name "union U"
X() X(constX&) this=(X&)
chain <type_decl 0x7fefaab3e390 U>>
<union_type 0x7fefaab413f0 U type_5 SI
size <integer_cst 0x7fefaa9fd0a8 type <integer_type 0x7fefaa9df2a0
bitsizetype> constant 32>
unit size <integer_cst 0x7fefaa9fd0c0 type <integer_type 0x7fefaa9df1f8
sizetype> constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7fefaab41348
fields <field_decl 0x7fefaab3e4c0 x
type <integer_type 0x7fefaa9df7e0 int asm_written public SI size
<integer_cst 0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 symtab -1432334096 alias set -1 canonical type
0x7fefaa9df7e0 precision 32 min <integer_cst 0x7fefaa9fd060 -2147483648> max
<integer_cst 0x7fefaa9fd078 2147483647>
pointer_to_this <pointer_type 0x7fefaaa01930>>
nonlocal decl_3 SI file t.cc line 3 col 7 size <integer_cst
0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 offset_align 128
offset <integer_cst 0x7fefaa9dbe88 constant 0>
bit offset <integer_cst 0x7fefaa9dbed0 constant 0> context <union_type
0x7fefaab41348 U>
chain <field_decl 0x7fefaab3e558 y type <real_type 0x7fefaaa01540
float>
nonlocal decl_3 SF file t.cc line 4 col 9 size <integer_cst
0x7fefaa9fd0a8 32> unit size <integer_cst 0x7fefaa9fd0c0 4>
align 32 offset_align 128 offset <integer_cst 0x7fefaa9dbe88 0> bit
offset <integer_cst 0x7fefaa9dbed0 0> context <union_type 0x7fefaab41348 U>
chain <type_decl 0x7fefaab3e428 U>>> context <translation_unit_decl
0x7fefabdb01e0 D.1>
full-name "union U"
X() X(constX&) this=(X&)
chain <type_decl 0x7fefaab3e390 U>>
t.cc:1:7: internal compiler error: verify_type failed
0xf1ebf9 verify_type(tree_node const*)
../../gcc-trunk/gcc/tree.c:13583
0x97fb04 gen_type_die_with_usage
../../gcc-trunk/gcc/dwarf2out.c:20707
0x981186 gen_type_die
../../gcc-trunk/gcc/dwarf2out.c:20901
0x98d7c1 gen_decl_die
../../gcc-trunk/gcc/dwarf2out.c:21487
0x97ef9d gen_member_die
../../gcc-trunk/gcc/dwarf2out.c:20378
0x97ef9d gen_struct_or_union_type_die
../../gcc-trunk/gcc/dwarf2out.c:20483
0x97ef9d gen_tagged_type_die
../../gcc-trunk/gcc/dwarf2out.c:20684
0x9805ed gen_type_die_with_usage
../../gcc-trunk/gcc/dwarf2out.c:20846
0x981186 gen_type_die
../../gcc-trunk/gcc/dwarf2out.c:20901
0x98d7c1 gen_decl_die
../../gcc-trunk/gcc/dwarf2out.c:21487
0x98e27c dwarf2out_decl
../../gcc-trunk/gcc/dwarf2out.c:21937
0x98e5ab dwarf2out_type_decl
../../gcc-trunk/gcc/dwarf2out.c:21647
0xbbcbff rest_of_type_compilation(tree_node*, int)
../../gcc-trunk/gcc/passes.c:339
0x6a47ac finish_struct_1(tree_node*)
../../gcc-trunk/gcc/cp/class.c:6747
0x6a61e4 finish_struct(tree_node*, tree_node*)
../../gcc-trunk/gcc/cp/class.c:6913
0x6df81b cp_parser_class_specifier_1
../../gcc-trunk/gcc/cp/parser.c:20443
0x6df81b cp_parser_class_specifier
../../gcc-trunk/gcc/cp/parser.c:20671
0x6df81b cp_parser_type_specifier
../../gcc-trunk/gcc/cp/parser.c:15076
0x6ef4ab cp_parser_decl_specifier_seq
../../gcc-trunk/gcc/cp/parser.c:12042
0x703d10 cp_parser_simple_declaration
../../gcc-trunk/gcc/cp/parser.c:11608
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
-------------------------------------------
union U
{
int x;
float y;
} __attribute__ ((__transparent_union__));