Bug 63578 - ICE with may_alias and auto
Summary: ICE with may_alias and auto
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2014-10-17 16:49 UTC by Paul Pluzhnikov
Modified: 2021-08-12 04:48 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.8.2, 4.9.1, 5.0, 8.2.0, 9.0
Last reconfirmed: 2020-12-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pluzhnikov 2014-10-17 16:49:51 UTC
Google ref: b/18024040

Test:

int *b;
auto __attribute__ ((may_alias)) a = b;  // replace auto with "int*" to fix

Using trunk @r216408:


r216408/bin/g++ -c -std=c++11 t.ii
t.ii:2:34: internal compiler error: in layout_type, at stor-layout.c:2398
 auto __attribute__ ((may_alias)) a = b;
                                  ^
0xbef8f3 layout_type(tree_node*)
        ../../gcc/stor-layout.c:2398
0xe36955 type_hash_canon(unsigned int, tree_node*)
        ../../gcc/tree.c:6821
0xe5344c build_type_attribute_qual_variant(tree_node*, tree_node*, int)
        ../../gcc/tree.c:4668
0x7a4966 decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/attribs.c:621
0x670604 cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/cp/decl2.c:1470
0x5d1162 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**)
        ../../gcc/cp/decl.c:4630
0x6b9a2a cp_parser_init_declarator
        ../../gcc/cp/parser.c:17060
0x6bb559 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:11538
0x69b0d3 cp_parser_block_declaration
        ../../gcc/cp/parser.c:11419
0x6c6df9 cp_parser_declaration
        ../../gcc/cp/parser.c:11316
0x6c5a3a cp_parser_declaration_seq_opt
        ../../gcc/cp/parser.c:11202
0x6c72e2 cp_parser_translation_unit
        ../../gcc/cp/parser.c:4090
0x6c72e2 c_parse_file()
        ../../gcc/cp/parser.c:32207
0x7f1942 c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1046
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.

Also broken in gcc-4.8
Comment 1 Marek Polacek 2019-06-18 21:06:55 UTC
Here we're calling cplus_decl_attributes on a variable that is undeduced_auto_decl; calling layout_type then of course crashes because the middle end can't handle undeduced auto.