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
Keywords: ice-on-valid-code
Depends on:
Reported: 2014-10-17 16:49 UTC by Paul Pluzhnikov
Modified: 2021-08-12 04:48 UTC (History)
4 users (show)

See Also:
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


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


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*)
0xe36955 type_hash_canon(unsigned int, tree_node*)
0xe5344c build_type_attribute_qual_variant(tree_node*, tree_node*, int)
0x7a4966 decl_attributes(tree_node**, tree_node*, int)
0x670604 cplus_decl_attributes(tree_node**, tree_node*, int)
0x5d1162 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**)
0x6b9a2a cp_parser_init_declarator
0x6bb559 cp_parser_simple_declaration
0x69b0d3 cp_parser_block_declaration
0x6c6df9 cp_parser_declaration
0x6c5a3a cp_parser_declaration_seq_opt
0x6c72e2 cp_parser_translation_unit
0x6c72e2 c_parse_file()
0x7f1942 c_common_parse_file()
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.