cgraph: Don't verify semantic_interposition flag for aliases [PR105399]
authorJakub Jelinek <jakub@redhat.com>
Thu, 28 Apr 2022 13:45:33 +0000 (15:45 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 28 Apr 2022 13:45:33 +0000 (15:45 +0200)
commitb85e79dce149df68b92ef63ca2a40ff1dfa61396
treec7ea3350f2e4ee42c2024dd513537d65500cc32e
parent2a570f11a2fecf23998d7fe1d5cabad62cfe5cec
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.
gcc/cgraph.cc
gcc/testsuite/g++.dg/lto/pr105399_0.C [new file with mode: 0644]