re PR ipa/87957 (ICE tree check: expected tree that contains ‘decl minimal’ structure...
authorJan Hubicka <hubicka@ucw.cz>
Mon, 19 Nov 2018 23:27:10 +0000 (00:27 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 19 Nov 2018 23:27:10 +0000 (23:27 +0000)
PR lto/87957
* ipa-devirt.c (free_enum_values): Do not ICE on ODR vilations.

From-SVN: r266289

gcc/ChangeLog
gcc/ipa-devirt.c

index 0a1f956cb0d39f75e5add2fd29242c1443465c58..6669b20b1f4f441cc6fd8b275f567892b84fd769 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-19  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR lto/87957
+       * ipa-devirt.c (free_enum_values): Do not ICE on ODR vilations.
+
 2018-11-19  Sandra Loosemore  <sandra@codesourcery.com>
 
        PR driver/50250
index db8d34c4027403246793e790f9de1b91d0893d25..ca583c4930956ca2d90d022e84cc82214aa7331e 100644 (file)
@@ -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;
 }