]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/lto/lto-common.c
Make ltrans type canonicals compatible with WPA ones
[thirdparty/gcc.git] / gcc / lto / lto-common.c
index 6944c469f89708ce5ed1877ea3cbf316bfa4727c..0a3033c369535d595aed3c34fa35d4120c808650 100644 (file)
@@ -415,8 +415,8 @@ gimple_register_canonical_type_1 (tree t, hashval_t hash)
      that we can use to lookup structurally equivalent non-ODR type.
      In case we decide to treat type as unique ODR type we recompute hash based
      on name and let TBAA machinery know about our decision.  */
-  if (RECORD_OR_UNION_TYPE_P (t)
-      && odr_type_p (t) && !odr_type_violation_reported_p (t))
+  if (RECORD_OR_UNION_TYPE_P (t) && odr_type_p (t)
+      && TYPE_CXX_ODR_P (t) && !odr_type_violation_reported_p (t))
     {
       /* Anonymous namespace types never conflict with non-C++ types.  */
       if (type_with_linkage_p (t) && type_in_anonymous_namespace_p (t))
@@ -434,6 +434,7 @@ gimple_register_canonical_type_1 (tree t, hashval_t hash)
       if (slot && !TYPE_CXX_ODR_P (*(tree *)slot))
        {
          tree nonodr = *(tree *)slot;
+         gcc_checking_assert (!flag_ltrans);
          if (symtab->dump_file)
            {
              fprintf (symtab->dump_file,