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 ICE in ipa-devirt


Hi,
this patch fixes the second ICE exposed by the new testcase Marxin
added. Again the ODR warning needs work, so I commit it after getting
it right.

Bootstrapped/regtested x86_64-linux, comitted.

	PR lto/87957
	* ipa-devirt.c (free_enum_values): Do not ICE on ODR vilations.
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c	(revision 266235)
+++ ipa-devirt.c	(working copy)
@@ -2268,12 +2268,14 @@ free_enum_values ()
   enum_values_freed = true;
   unsigned int i;
   for (i = 0; i < odr_types.length (); i++)
-    if (odr_types[i] && TREE_CODE (odr_types[i]->type) == ENUMERAL_TYPE)
+    if (odr_types[i])
       {
-	TYPE_VALUES (odr_types[i]->type) = NULL;
+	if (TREE_CODE (odr_types[i]->type) == ENUMERAL_TYPE)
+	  TYPE_VALUES (odr_types[i]->type) = NULL;
 	if (odr_types[i]->types)
           for (unsigned int j = 0; j < odr_types[i]->types->length (); j++)
-	    TYPE_VALUES ((*odr_types[i]->types)[j]) = NULL;
+	    if (TREE_CODE ((*odr_types[i]->types)[j]) == ENUMERAL_TYPE)
+	      TYPE_VALUES ((*odr_types[i]->types)[j]) = NULL;
       }
   enum_values_freed = true;
 }


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