https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68851

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So the mentioned revision is responsible for creation of a new consprop clone:

IPA decision stage:
...
 - Creating a specialized node of virtual bool
blink::HTMLFormControlElement::isFormControlElement() const/14820 for all known
contexts.
...
IPA constant propagation end


and the symbol is identified to be set to a comdat group in ipa-comdats.c:365:

          if (is_a <cgraph_node *> (symbol))
           dyn_cast <cgraph_node *>(symbol)->call_for_symbol_thunks_and_aliases
                  (set_comdat_group_1,
                   *comdat_head_map.get (group),
                   true);

as the function calls 'set_comdat_group_1' for the constprop cloned function,
the original function of the clone is thunk and calls the clone. So that
set_comdat_group_1
is called for the original function:

_ZThn96_NK5blink22HTMLFormControlElement20isFormControlElementEv/14822 (virtual
bool
blink::HTMLFormControlElement::_ZThn96_NK5blink22HTMLFormControlElement20isFormControlElementEv()
const) @0x7fffeb51b8a0
  Type: function definition analyzed
  Visibility: externally_visible asm_written public weak comdat
comdat_group:_ZNK5blink22HTMLFormControlElement20isFormControlElementEv
one_only
section:.text._ZNK5blink22HTMLFormControlElement20isFormControlElementEv
(implicit_section) virtual artificial
  Same comdat group as:
_ZNK5blink22HTMLFormControlElement20isFormControlElementEv.constprop.39/31390
  Aux: @0x1  References: 
  Referring: 
  Availability: available
  First run: 0
  Function flags: nonfreeing_fn
  Thunk fixed offset -96 virtual value 0 has virtual offset 0)
  Called by: 
  Calls:
_ZNK5blink22HTMLFormControlElement20isFormControlElementEv.constprop.39/31390
(1.00 per call) (can throw external) 

constprop clone:

_ZNK5blink22HTMLFormControlElement20isFormControlElementEv.constprop.39/31390
(<built-in>) @0x7fffe8bc6000
  Type: function definition analyzed
  Visibility:
comdat_group:_ZNK5blink22HTMLFormControlElement20isFormControlElementEv
  Same comdat group as:
_ZNK5blink22HTMLFormControlElement20isFormControlElementEv/14820
  previous sharing asm name: 31394
  References: 
  Referring: 
  Clone of _ZNK5blink22HTMLFormControlElement20isFormControlElementEv/14820
  Availability: local
  First run: 0
  Function flags: local nonfreeing_fn
  Called by:
_ZThn96_NK5blink22HTMLFormControlElement20isFormControlElementEv/14822 (1.00
per call) (can throw external) 
  Calls: 

Problem is that the original function has already set comdat_group here:

#0  symtab_node::set_comdat_group (this=0x7fffeb51b8a0, group=0x7fffeb4dc620)
at ../../gcc/cgraph.h:220
#1  0x0000000000a53972 in symtab_node::add_to_same_comdat_group
(this=0x7fffeb51b8a0, old_node=0x7fffeb51b5c0) at ../../gcc/symtab.c:461
#2  0x00000000008d05e2 in use_thunk (thunk_fndecl=0x7fffeb4ec7e0, emit_p=true)
at ../../gcc/cp/method.c:396
#3  0x00000000008e2979 in emit_associated_thunks (fn=0x7fffeb4dc620) at
../../gcc/cp/semantics.c:4080
#4  0x00000000008e2cb8 in expand_or_defer_fn (fn=0x7fffeb4dc620) at
../../gcc/cp/semantics.c:4178
#5  0x000000000087a103 in cp_parser_function_definition_after_declarator
(parser=0x7ffff7feeb40, inline_p=true) at ../../gcc/cp/parser.c:25212
#6  0x000000000087b772 in cp_parser_late_parsing_for_member
(parser=0x7ffff7feeb40, member_function=0x7fffeb4dc620) at
../../gcc/cp/parser.c:26033
#7  0x00000000008745f7 in cp_parser_class_specifier_1 (parser=0x7ffff7feeb40)
at ../../gcc/cp/parser.c:21412
#8  0x00000000008746bb in cp_parser_class_specifier (parser=0x7ffff7feeb40) at
../../gcc/cp/parser.c:21438
#9  0x000000000086b65b in cp_parser_type_specifier (parser=0x7ffff7feeb40,
flags=1, decl_specs=0x7fffffffd6b0, is_declaration=true,
declares_class_or_enum=0x7fffffffd634, is_cv_qualifier=0x7fffffffd633) at
../../gcc/cp/parser.c:15736
#10 0x0000000000867008 in cp_parser_decl_specifier_seq (parser=0x7ffff7feeb40,
flags=1, decl_specs=0x7fffffffd6b0, declares_class_or_enum=0x7fffffffd6ac) at
../../gcc/cp/parser.c:12657
#11 0x0000000000866645 in cp_parser_simple_declaration (parser=0x7ffff7feeb40,
function_definition_allowed_p=true, maybe_range_for_decl=0x0) at
../../gcc/cp/parser.c:12200
#12 0x00000000008665cd in cp_parser_block_declaration (parser=0x7ffff7feeb40,
statement_p=false) at ../../gcc/cp/parser.c:12147
#13 0x000000000086634f in cp_parser_declaration (parser=0x7ffff7feeb40) at
../../gcc/cp/parser.c:12044
#14 0x0000000000865e7b in cp_parser_declaration_seq_opt (parser=0x7ffff7feeb40)
at ../../gcc/cp/parser.c:11923
#15 0x000000000086e172 in cp_parser_namespace_body (parser=0x7ffff7feeb40) at
../../gcc/cp/parser.c:17505
#16 0x000000000086e113 in cp_parser_namespace_definition
(parser=0x7ffff7feeb40) at ../../gcc/cp/parser.c:17482
#17 0x000000000086624d in cp_parser_declaration (parser=0x7ffff7feeb40) at
../../gcc/cp/parser.c:12024
#18 0x0000000000865e7b in cp_parser_declaration_seq_opt (parser=0x7ffff7feeb40)
at ../../gcc/cp/parser.c:11923
#19 0x0000000000857aaa in cp_parser_translation_unit (parser=0x7ffff7feeb40) at
../../gcc/cp/parser.c:4246
#20 0x00000000008993b6 in c_parse_file () at ../../gcc/cp/parser.c:37268
#21 0x00000000009b64a4 in c_common_parse_file () at
../../gcc/c-family/c-opts.c:1064
#22 0x0000000000ead6a1 in compile_file () at ../../gcc/toplev.c:464
#23 0x0000000000eafb58 in do_compile () at ../../gcc/toplev.c:1977
#24 0x0000000000eafdd7 in toplev::main (this=0x7fffffffdb10, argc=16,
argv=0x7fffffffdc18) at ../../gcc/toplev.c:2084
#25 0x00000000017d099b in main (argc=16, argv=0x7fffffffdc18) at
../../gcc/main.c:39

Martin

Reply via email to