public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
@ 2022-04-26 22:27 slyfox at gcc dot gnu.org
2022-04-27 6:10 ` [Bug lto/105399] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-04-26 22:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
Bug ID: 105399
Summary: [12 Regression] -O2/-Ofast -flto ICEs as internal
compiler error: verify_cgraph_node failed
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Found as an ICE on ncnn project. Minimized example:
// cat bug.cpp.cpp
struct S {
S();
};
S::S() {}
$ g++ -fPIC -flto -Ofast -o bug.o -c bug.cpp.cpp
$ g++ -fPIC -flto -O2 -shared -o libncnn.so bug.o
lto1: error: semantic interposition mismatch
_ZN1SC1Ev/2 (__ct_comp ) @0x7f8bd1e14110
Type: function definition analyzed alias
Visibility: externally_visible prevailing_def_ironly_exp public
References: _ZN1SC2Ev/1 (alias)
Referring:
Read from file: bug.o
Unit id: 1
Function flags:
Called by:
Calls:
during IPA pass: modref
lto1: internal compiler error: verify_cgraph_node failed
0x97eec0 cgraph_node::verify_node()
../../gcc-12-20220424/gcc/cgraph.cc:3874
0x96eb84 symtab_node::verify()
../../gcc-12-20220424/gcc/symtab.cc:1359
0x96fcf7 symtab_node::verify_symtab_nodes()
../../gcc-12-20220424/gcc/symtab.cc:1387
0xc13224 symtab_node::checking_verify_symtab_nodes()
../../gcc-12-20220424/gcc/cgraph.h:682
0xc13224 symbol_table::remove_unreachable_nodes(_IO_FILE*)
../../gcc-12-20220424/gcc/ipa.cc:679
0x8f57f5 read_cgraph_and_symbols(unsigned int, char const**)
../../gcc-12-20220424/gcc/lto/lto-common.cc:2960
0x8dcdb2 lto_main()
../../gcc-12-20220424/gcc/lto/lto.cc:626
$ g++ -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-debug-12.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-debug-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220424 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
@ 2022-04-27 6:10 ` rguenth at gcc dot gnu.org
2022-04-27 8:49 ` marxin 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-27 6:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |jakub at gcc dot gnu.org
Target Milestone|--- |12.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
IIRC Jakub fixed a similar bug recently, and Honza had followup comments.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
2022-04-27 6:10 ` [Bug lto/105399] " rguenth at gcc dot gnu.org
@ 2022-04-27 8:49 ` marxin at gcc dot gnu.org
2022-04-27 9:03 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-27 8:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-04-27
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
2022-04-27 6:10 ` [Bug lto/105399] " rguenth at gcc dot gnu.org
2022-04-27 8:49 ` marxin at gcc dot gnu.org
@ 2022-04-27 9:03 ` jakub at gcc dot gnu.org
2022-04-27 9:08 ` jakub 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-27 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Because of -Ofast initial compilation, opt_for_fn (decl,
flag_semantic_interposition) is false for all the decls for which a cgraph node
is created, but they have NULL DECL_FUNCTION_SPECIFIC_OPTIMIZATION, and thus
they look up the bit in optimization_default_node.
That results in node->semantic_interposition to be 0 as well.
Next comes free_lang_data_in_decl, which does:
if (TREE_CODE (decl) == FUNCTION_DECL)
...
if (gimple_has_body_p (decl) || (node && node->thunk))
...
if (!DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl))
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
= optimization_default_node;
Now, free_lang_data_in_decl is called on 3 FUNCTION_DECLs,
_ZN1SC1Ev aka __ct_comp, which is node->alias && !node->semantic_interposition,
gimple_has_body_p (decl) is false for it and we don't do anything.
Next it is called on _ZN1SC4Ev aka __ct, which has NULL node and
gimple_has_body_p (decl) is false for it too.
Last it is called for _ZN1SC2Ev aka __ct_base, which is !node->alias &&
!node->semantic_interposition, gimple_has_body_p (decl) is true and we set
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) to optimization_default_node.
Then we stream all this out, and stream it back, except that
optimization_default_node is one for -O2 with x_flag_semantic_interposition set
for it.
_ZN1SC2Ev passes the verification, node->semantic_interposition is false
and opt_for_fn (decl, flag_semantic_interposition) is false as well.
But for _ZN1SC1Ev we ICE on:
if (definition && externally_visible
&& semantic_interposition
!= opt_for_fn (decl, flag_semantic_interposition))
{
error ("semantic interposition mismatch");
error_found = true;
}
That is because for aliases which don't have a body, we kept
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) NULL.
One way to fix this would be
- if (definition && externally_visible
+ if (definition
+ && externally_visible
+ && (!alias || thunk)
&& semantic_interposition
!= opt_for_fn (decl, flag_semantic_interposition))
{
error ("semantic interposition mismatch");
error_found = true;
}
i.e. don't bother verification of mismatches for aliases. Another would be
to adjust DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) in free_lang_data_in_decl
even for aliases.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2022-04-27 9:03 ` jakub at gcc dot gnu.org
@ 2022-04-27 9:08 ` jakub at gcc dot gnu.org
2022-04-27 9:57 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-27 9:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I can't easily bisect when this started but bet with
r12-5412-g458d2c689963d8461d84670a3d8988cd6ecbfd81
or later.
Not sure if this should be P1 because it is ice-checking only, in release
compilers flag_checking defaults to 0 and so it isn't done unless -fchecking is
used.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2022-04-27 9:08 ` jakub at gcc dot gnu.org
@ 2022-04-27 9:57 ` jakub at gcc dot gnu.org
2022-04-28 13:46 ` cvs-commit at gcc dot gnu.org
2022-04-28 13:49 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-27 9:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52889
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52889&action=edit
gcc12-pr105399.patch
One possible untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
` (4 preceding siblings ...)
2022-04-27 9:57 ` jakub at gcc dot gnu.org
@ 2022-04-28 13:46 ` cvs-commit at gcc dot gnu.org
2022-04-28 13:49 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-28 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
--- 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:b85e79dce149df68b92ef63ca2a40ff1dfa61396
commit r12-8312-gb85e79dce149df68b92ef63ca2a40ff1dfa61396
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Apr 28 15:45:33 2022 +0200
cgraph: Don't verify semantic_interposition flag for aliases [PR105399]
The following testcase ICEs, because the ctors during cc1plus all have
!opt_for_fn (decl, flag_semantic_interposition) - they have NULL
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) and optimization_default_node
is for -Ofast and so has flag_semantic_interposition cleared.
During free lang data, we set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
for the ctor which has body (or for thunks), but don't touch it for
aliases.
During lto1 optimization_default_node reflects the lto1 flags which
are -O2 rather than -Ofast and so has flag_semantic_interposition
set, for the ctor which has body that makes no difference, but as the
alias doesn't still have DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) set,
we now trigger this verification check.
The following patch just doesn't verify it for aliases during lto1.
Another possibility would be to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION
(decl)
during free lang data even for aliases.
2022-04-28 Jakub Jelinek <jakub@redhat.com>
PR lto/105399
* cgraph.cc (cgraph_node::verify_node): Don't verify
semantic_interposition flag against
opt_for_fn (decl, flag_semantic_interposition) for aliases in lto1.
* g++.dg/lto/pr105399_0.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
` (5 preceding siblings ...)
2022-04-28 13:46 ` cvs-commit at gcc dot gnu.org
@ 2022-04-28 13:49 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-28 13:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399
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-28 13:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 22:27 [Bug lto/105399] New: [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed slyfox at gcc dot gnu.org
2022-04-27 6:10 ` [Bug lto/105399] " rguenth at gcc dot gnu.org
2022-04-27 8:49 ` marxin at gcc dot gnu.org
2022-04-27 9:03 ` jakub at gcc dot gnu.org
2022-04-27 9:08 ` jakub at gcc dot gnu.org
2022-04-27 9:57 ` jakub at gcc dot gnu.org
2022-04-28 13:46 ` cvs-commit at gcc dot gnu.org
2022-04-28 13:49 ` 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).