public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
@ 2022-04-19  6:27 asolokha at gmx dot com
  2022-04-19  9:35 ` [Bug ipa/105306] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2022-04-19  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105306
           Summary: [12 Regression] ICE: verify_cgraph_node failed (error:
                    semantic interposition mismatch)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

g++ 12.0.1 20220417 snapshot (g:000c1b89d259fadb466e1f2e63c79da45fd17372) ICEs
when compiling gcc/testsuite/g++.dg/opt/pr59947.C w/ -Ofast:

% g++-12.0.1 -Ofast -c gcc/testsuite/g++.dg/opt/pr59947.C
gcc/testsuite/g++.dg/opt/pr59947.C:34:24: error: semantic interposition
mismatch
   34 | template class E <char>;
      |                        ^
_ZN1BD1Ev/6 (B::~B()) @0x7fdd9c891880
  Type: function definition analyzed alias cpp_implicit_alias
  Visibility: externally_visible public weak comdat comdat_group:_ZN1BD5Ev
one_only
  Same comdat group as: _ZN1BD2Ev/5
  References: _ZN1BD2Ev/5 (alias)
  Referring:
  Availability: available
  Function flags:
  Called by: _ZN1CI1DED2Ev/9
  Calls:
during IPA pass: visibility
gcc/testsuite/g++.dg/opt/pr59947.C:34:24: internal compiler error:
verify_cgraph_node failed
0xcfe1e0 cgraph_node::verify_node()
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cgraph.cc:3873
0xced4f4 symtab_node::verify()
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/symtab.cc:1359
0xcee6e7 symtab_node::verify_symtab_nodes()
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/symtab.cc:1387
0xfb169c symtab_node::checking_verify_symtab_nodes()
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cgraph.h:682
0xfb169c symbol_table::remove_unreachable_nodes(_IO_FILE*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/ipa.cc:679
0x10c9be9 execute_todo
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/passes.cc:2153

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
@ 2022-04-19  9:35 ` rguenth at gcc dot gnu.org
  2022-04-19  9:57 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-19  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
  2022-04-19  9:35 ` [Bug ipa/105306] " rguenth at gcc dot gnu.org
@ 2022-04-19  9:57 ` jakub at gcc dot gnu.org
  2022-04-19 10:01 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-19  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
           Priority|P3                          |P1
   Last reconfirmed|                            |2022-04-19

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-5412-g458d2c689963d8461d84670a3d8988cd6ecbfd81

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
  2022-04-19  9:35 ` [Bug ipa/105306] " rguenth at gcc dot gnu.org
  2022-04-19  9:57 ` jakub at gcc dot gnu.org
@ 2022-04-19 10:01 ` jakub at gcc dot gnu.org
  2022-04-19 10:08 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-19 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, with -Ofast -fsemantic-interposition or -Ofast
-fno-semantic-interposition, there is no ICE with any of r12-1, r12-5411,
r12-5412 or r12-8189.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-04-19 10:01 ` jakub at gcc dot gnu.org
@ 2022-04-19 10:08 ` marxin at gcc dot gnu.org
  2022-04-19 11:58 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-19 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat semantic.C
#pragma GCC optimize 0
template <typename T> void foo(T);
struct B {
  ~B() {}
};
struct C {
  B f;
};
template <typename> struct E {
  void bar() { foo(g); }
  C g;
};
template class E<char>;

$ g++ semantic.C  -c -Ofast
semantic.C:13:23: error: semantic interposition mismatch
   13 | template class E<char>;
      |                       ^
_ZN1BD1Ev/2 (B::~B()) @0x7ffff778e220
  Type: function definition analyzed alias cpp_implicit_alias
  Visibility: externally_visible public weak comdat comdat_group:_ZN1BD5Ev
one_only
  Same comdat group as: _ZN1BD2Ev/1
  References: _ZN1BD2Ev/1 (alias) 
  Referring: 
  Availability: available
  Function flags:
  Called by: _ZN1CD2Ev/5 
  Calls: 
during IPA pass: visibility

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-04-19 10:08 ` marxin at gcc dot gnu.org
@ 2022-04-19 11:58 ` jakub at gcc dot gnu.org
  2022-04-20  7:25 ` cvs-commit at gcc dot gnu.org
  2022-04-20  7:25 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-19 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52832
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52832&action=edit
gcc12-pr105306.patch

Untested fix.  Initializing semantic_interposition flag from
flag_semantic_interposition works well only if all the cgraph nodes are created
while those fndecls are current_function_decl, but that isn't always the case.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-04-19 11:58 ` jakub at gcc dot gnu.org
@ 2022-04-20  7:25 ` cvs-commit at gcc dot gnu.org
  2022-04-20  7:25 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-20  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:2a6d372ba96cc0836bfd46579ad78c1ee5a3cf8a

commit r12-8202-g2a6d372ba96cc0836bfd46579ad78c1ee5a3cf8a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 20 09:24:18 2022 +0200

    cgraph: Fix up semantic_interposition handling [PR105306]

    cgraph_node has a semantic_interposition flag which should mirror
    opt_for_fn (decl, flag_semantic_interposition).  But it actually is
    initialized not from that, but from flag_semantic_interposition in the
      explicit symtab_node (symtab_type t)
        : type (t), resolution (LDPR_UNKNOWN), definition (false), alias
(false),
    ...
          semantic_interposition (flag_semantic_interposition),
    ...
          x_comdat_group (NULL_TREE), x_section (NULL)
      {}
    ctor.  I think that might be fine for varpool nodes, but since
    flag_semantic_interposition is now implied from -Ofast it isn't correct
    for cgraph nodes, unless we guarantee that cgraph node for a particular
    function decl is always created while that function is
    current_function_decl.  That is often the case, but not always as the
    following function shows.
    Because symtab_node's ctor doesn't know for which decl the cgraph node
    is being created, the following patch keeps that as is, but updates it from
    opt_for_fn (decl, flag_semantic_interposition) when we know that, or for
    clones copies that flag (often it is then overridden in
    set_new_clone_decl_and_node_flags, but not always).

    2022-04-20  Jakub Jelinek  <jakub@redhat.com>

            PR ipa/105306
            * cgraph.cc (cgraph_node::create): Set node->semantic_interposition
            to opt_for_fn (decl, flag_semantic_interposition).
            * cgraphclones.cc (cgraph_node::create_clone): Copy over
            semantic_interposition flag.

            * g++.dg/opt/pr105306.C: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug ipa/105306] [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch)
  2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-04-20  7:25 ` cvs-commit at gcc dot gnu.org
@ 2022-04-20  7:25 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-20  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-20  7:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  6:27 [Bug ipa/105306] New: [12 Regression] ICE: verify_cgraph_node failed (error: semantic interposition mismatch) asolokha at gmx dot com
2022-04-19  9:35 ` [Bug ipa/105306] " rguenth at gcc dot gnu.org
2022-04-19  9:57 ` jakub at gcc dot gnu.org
2022-04-19 10:01 ` jakub at gcc dot gnu.org
2022-04-19 10:08 ` marxin at gcc dot gnu.org
2022-04-19 11:58 ` jakub at gcc dot gnu.org
2022-04-20  7:25 ` cvs-commit at gcc dot gnu.org
2022-04-20  7:25 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).