[Bug c/89341] [7/8/9 Regression] ICE in get, at cgraph.h:1332
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89341 --- Comment #5 from David Malcolm --- Both decls of "foo" are using the same FUNCTION_DECL. node->alias is set in varasm.c: assemble_alias here: 5991cgraph_node::get_create (decl)->alias = true; when processing the second decl of "foo" here: void foo (); since the FUNCTION_DECL for "foo" has an "alias" attribute, given to it by handle_weakref_attribute when parsing the first decl of here: __attribute__((weakref("bar"))) static void foo () { }
[Bug c/89341] [7/8/9 Regression] ICE in get, at cgraph.h:1332
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89341 --- Comment #4 from David Malcolm --- The -Wattributes warning would be emitted here in cgraphunit.c: process_function_and_variable_attributes: 777 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)) 778 && (node->definition && !node->alias)) 779 { 780 warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes, 781 "% attribute ignored" 782 " because function is defined"); 783 DECL_WEAK (decl) = 0; 784 DECL_ATTRIBUTES (decl) = remove_attribute ("weakref", 785 DECL_ATTRIBUTES (decl)); 786 } but the alias stops the clause from firing: (gdb) p node $3 = (gdb) p node->definition $4 = 1 (gdb) p node->alias $5 = 1 The alias exclusion was added to the warning in r174952 (aka c70f46b057cd12973d33c01c8fa0da5c14ba3944) by Honza: @@ -880,7 +977,7 @@ process_function_and_variable_attributes (struct cgraph_node *first, cgraph_mark_needed_node (node); } if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)) - && node->local.finalized) + && (node->local.finalized && !node->alias)) { warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes, "% attribute ignored"
[Bug c/89341] [7/8/9 Regression] ICE in get, at cgraph.h:1332
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89341 Jakub Jelinek changed: What|Removed |Added CC||hubicka at gcc dot gnu.org, ||jakub at gcc dot gnu.org Target Milestone|--- |7.5 Summary|ICE in get, at |[7/8/9 Regression] ICE in |cgraph.h:1332 |get, at cgraph.h:1332 --- Comment #3 from Jakub Jelinek --- This used to be accepted before r154115 (so e.g. in GCC 4.2), then it started to ICE: pr89341.c:3:1: internal compiler error: in function_and_variable_visibility, at ipa.c:662 then (likely) r169332 started rejecting this: pr89341.c:2:13: warning: ‘weakref’ attribute ignored because function is defined [-Wattributes] pr89341.c:2:13: error: ‘foo’ aliased to undefined symbol ‘bar’ then r174952 started to ICE on this again.