]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
SCCP: Fix ODR issues when compiling with LTO [PR 113054}
authorAndrew Pinski <quic_apinski@quicinc.com>
Mon, 18 Dec 2023 16:18:13 +0000 (08:18 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Mon, 18 Dec 2023 16:35:48 +0000 (08:35 -0800)
The problem here is that in C++ structs and classes have a
linkage too so the type vertex is not considered local to
the TU but will conflict with the globally defined one
in graphds.h.  The simple way to fix this is to wrap the ones
defined locally in gimple-ssa-sccopy.cc inside an anonymous namespace
and they are now considered locally to that TU.

Committed as obvious after a bootstrap/test on x86_64.

gcc/ChangeLog:

PR tree-optimization/113054
* gimple-ssa-sccopy.cc: Wrap the local types
with an anonymous namespace.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/gimple-ssa-sccopy.cc

index 7ebb6c05caf20691182becbc73e5f5bd34903dc8..19a656e282220c8debbcfa38531433288d403807 100644 (file)
@@ -95,6 +95,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Bitmap tracking statements which were propagated to be removed at the end of
    the pass.  */
 
+namespace {
 static bitmap dead_stmts;
 
 /* State of vertex during SCC discovery.
@@ -334,6 +335,8 @@ scc_discovery::compute_sccs (vec<gimple *> &stmts)
   return sccs;
 }
 
+} // anon namespace
+
 /* Could this statement potentially be a copy statement?
 
    This pass only considers statements for which this function returns 'true'.