SCCP: Fix ODR issues when compiling with LTO [PR 113054}

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>
This commit is contained in:
Andrew Pinski 2023-12-18 08:18:13 -08:00
parent 88a398a487
commit 4554a151d0

View 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'.