> 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. Index: tree.c =================================================================== --- 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, name, NULL_TREE); 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); return tu; } Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 221977) +++ ipa-devirt.c (working copy) @@ -979,6 +979,21 @@ warn_odr (tree t1, tree t2, tree st1, tr return; 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)); + if (warned) *warned = true; }