[PATCH] Fix an ICE in PR94192

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix an ICE in PR94192

gcc - fortran mailing list
This patch fixes the ICE found in PR94192.

Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 280157)
+++ gcc/fortran/simplify.c (working copy)
@@ -4148,10 +4148,15 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_ex
 
   gcc_unreachable ();
 
- done:
+done:
 
-  if (as && (as->type == AS_DEFERRED || as->type == AS_ASSUMED_RANK
-     || (as->type == AS_ASSUMED_SHAPE && upper)))
+  /* If an error has already been reported, then return NULL to
+     prevent the below assert (which may not occur if the error
+     is corrected.  See PR94192).  */
+  gfc_get_errors (NULL, &d);
+  if (d > 0
+      || (as && (as->type == AS_DEFERRED || as->type == AS_ASSUMED_RANK
+ || (as->type == AS_ASSUMED_SHAPE && upper))))
     return NULL;
 
   gcc_assert (!as

--
Steve