This is the mail archive of the
mailing list for the GCC project.
Re: lto bootstrap fails.
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Trevor Saunders <tbsaunde at tbsaunde dot org>, gcc at gcc dot gnu dot org
- Date: Sat, 11 Apr 2015 01:33:21 +0200
- Subject: Re: lto bootstrap fails.
- Authentication-results: sourceware.org; auth=none
- References: <5527D737 dot 5060409 at moene dot org> <20150410151219 dot GA4555 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com> <20150410152727 dot GW19273 at tucnak dot redhat dot com>
> On Fri, Apr 10, 2015 at 11:18:39AM -0400, Trevor Saunders wrote:
> > On Fri, Apr 10, 2015 at 03:59:19PM +0200, Toon Moene wrote:
> > > Like this:
> > >
> > > https://gcc.gnu.org/ml/gcc-testresults/2015-04/msg01086.html
> > >
> > > ODR rears its head again ...
> > huh, why is c/c-lang.h getting included in files linked into cc1plus?
> > that seems strange.
> readelf -wl cc1plus | grep c-lang.h
> doesn't show anything.
I tried to reproduce it and my bootstrap passes with same options as Toon's
The following patch ought to be able to tell the particular translation unit
causing the conflict.
--- tree.c (revision 221977)
+++ tree.c (working copy)
@@ -4679,6 +4679,8 @@ build_translation_unit_decl (tree name)
tree tu = build_decl (UNKNOWN_LOCATION, TRANSLATION_UNIT_DECL,
TRANSLATION_UNIT_LANGUAGE (tu) = lang_hooks.name;
+ if (main_input_filename)
+ DECL_NAME (tu) = get_identifier (main_input_filename);
vec_safe_push (all_translation_units, tu);
--- ipa-devirt.c (revision 221977)
+++ ipa-devirt.c (working copy)
@@ -979,6 +979,21 @@ warn_odr (tree t1, tree t2, tree st1, tr
inform (DECL_SOURCE_LOCATION (decl2), reason);
+ tree name = TYPE_NAME (t1);
+ tree name1 = decl2;
+ /* See if we have info about the translation unit. It may not be around
+ if types was already merged. */
+ while (TREE_CODE (name) != TRANSLATION_UNIT_DECL)
+ name = TYPE_P (name) ? TYPE_CONTEXT (name) : DECL_CONTEXT (name);
+ while (TREE_CODE (name1) != TRANSLATION_UNIT_DECL)
+ name1 = TYPE_P (name1) ? TYPE_CONTEXT (name1) : DECL_CONTEXT (name1);
+ name = DECL_NAME (name);
+ name1 = DECL_NAME (name1);
+ if (name != name1 && name && name1)
+ inform (UNKNOWN_LOCATION, "Conflicting compilation units: %s and %s",
+ IDENTIFIER_POINTER (name),
+ IDENTIFIER_POINTER (name1));
*warned = true;