This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix TYPE_CXX_ODR_P mismatch on aarch64


Hi,
on aarch64 we get ICEs with -flto because pre-streamed va_arg type
becames main variant of the va_arg types read from the LTO stream.
If the LTo stream was produced by C++ then the variants have CXX_ODR_P
while the main variant, produced by lto frontend is !CXX_ODR_P.
This is harmless because we care about this flag on main variants only
but type verifier is not happy.
This patch simply copies the flag from main variant (after streaming is
done so we do not mess up with type merging).

Bootstrapped/regtested aarch64-linux, comitted.

	* lto-common.c (lto_register_canonical_types_for_odr_types):
	Copy CXX_ODR_P from the main variant.

Index: lto/lto-common.c
===================================================================
--- lto/lto-common.c	(revision 272852)
+++ lto/lto-common.c	(working copy)
@@ -568,8 +568,17 @@
 
   /* 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);
+    }
 }
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]