lto-common.c (lto_register_canonical_types_for_odr_types): Copy CXX_ODR_P from the...
authorJan Hubicka <jh@suse.cz>
Tue, 2 Jul 2019 08:23:02 +0000 (10:23 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 2 Jul 2019 08:23:02 +0000 (08:23 +0000)
* lto-common.c (lto_register_canonical_types_for_odr_types):
Copy CXX_ODR_P from the main variant.

From-SVN: r272923

gcc/lto/ChangeLog
gcc/lto/lto-common.c

index e853f5c9827ce1a60f580ed2570c31d3baf79c8d..ae4e1572496edbc097458a1dddf65aebade714b9 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-27  Jan Hubicka  <jh@suse.cz>
+
+       * lto-common.c (lto_register_canonical_types_for_odr_types):
+       Copy CXX_ODR_P from the main variant.
+
 2019-06-27  Jan Hubicka  <jh@suse.cz>
 
        * lto-common.c: tree-pretty-print.h
index 1275b673506a414add8fe24d532947a863f7ecaa..2b3165a77f481fdd6fa9b18c062eb12eb4490157 100644 (file)
@@ -568,8 +568,17 @@ lto_register_canonical_types_for_odr_types ()
 
   /* Register all remaining types.  */
   FOR_EACH_VEC_ELT (*types_to_register, i, t)
-    if (!TYPE_CANONICAL (t))
-      gimple_register_canonical_type (t);
+    {
+      /* For pre-streamed types like va-arg it is possible that main variant
+        is !CXX_ODR_P while the variant (which is streamed) is.
+        Copy CXX_ODR_P to make type verifier happy.  This is safe because
+        in canonical type calculation we only consider main variants.
+        However we can not change this flag before streaming is finished
+        to not affect tree merging.  */
+      TYPE_CXX_ODR_P (t) = TYPE_CXX_ODR_P (TYPE_MAIN_VARIANT (t));
+      if (!TYPE_CANONICAL (t))
+        gimple_register_canonical_type (t);
+    }
 }