https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87957
Bug ID: 87957 Summary: [9 Regression] ICE tree check: expected tree that contains ‘decl minimal’ structure, have ‘identifier_node’ in warn_odr, at ipa-devirt.c:1051 since r265519 Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- Following is causing a new ICE: $ cat 1.ii typedef struct { int a; } YYSTYPE; union yyalloc { short yyss; YYSTYPE yyvs; }; void b() { yyalloc c; } $ cat 2.ii typedef struct YYSTYPE { } YYSTYPE; union yyalloc { short yyss; YYSTYPE yyvs; }; void a() { yyalloc b; } $ g++ -flto [12].ii 1.ii:3:3: warning: type ‘struct YYSTYPE’ violates the C++ One Definition Rule [-Wodr] 3 | } YYSTYPE; | ^ lto1: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘identifier_node’ in warn_odr, at ipa-devirt.c:1051 0x6b540e tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.c:9790 0x614bd4 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.h:3268 0x614bd4 warn_odr ../../gcc/ipa-devirt.c:1051 0xa01c9e type_variants_equivalent_p ../../gcc/ipa-devirt.c:651 0xa07f68 odr_subtypes_equivalent_p ../../gcc/ipa-devirt.c:697 0xa08faa odr_types_equivalent_p ../../gcc/ipa-devirt.c:1576 0xa05ea4 add_type_duplicate ../../gcc/ipa-devirt.c:1878 0xa05ea4 get_odr_type(tree_node*, bool) ../../gcc/ipa-devirt.c:2058 0x7894d6 lto_read_decls ../../gcc/lto/lto.c:1900 0x78a78e lto_file_finalize ../../gcc/lto/lto.c:2134 0x78a78e lto_create_files_from_ids ../../gcc/lto/lto.c:2144 0x78a78e lto_file_read ../../gcc/lto/lto.c:2185 0x78a78e read_cgraph_and_symbols ../../gcc/lto/lto.c:2865 0x78a78e lto_main() ../../gcc/lto/lto.c:3401