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_apin...@quicinc.com>
---
 gcc/gimple-ssa-sccopy.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/gimple-ssa-sccopy.cc b/gcc/gimple-ssa-sccopy.cc
index 7ebb6c05caf..19a656e2822 100644
--- a/gcc/gimple-ssa-sccopy.cc
+++ b/gcc/gimple-ssa-sccopy.cc
@@ -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'.
-- 
2.39.3

Reply via email to