[PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()

Dominique d'Humières dominiq@lps.ens.fr
Sat Nov 14 13:51:00 GMT 2015


Hi Steve,

Although I have not strong objection to your proposed patch, I’ld prefer the following one

--- ../_clean/gcc/fortran/primary.c	2015-10-18 13:07:28.000000000 +0200
+++ gcc/fortran/primary.c	2015-11-13 23:32:08.000000000 +0100
@@ -2194,7 +2194,7 @@ check_substring:
 symbol_attribute
 gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
 {
-  int dimension, codimension, pointer, allocatable, target, n;
+  int dimension, codimension, pointer, allocatable, target;
   symbol_attribute attr;
   gfc_ref *ref;
   gfc_symbol *sym;
@@ -2253,22 +2253,9 @@ gfc_variable_attr (gfc_expr *expr, gfc_t
 	  case AR_UNKNOWN:
 	    /* If any of start, end or stride is not integer, there will
 	       already have been an error issued.  */
-	    for (n = 0; n < ref->u.ar.as->rank; n++)
-	      {
-		int errors;
-		gfc_get_errors (NULL, &errors);
-		if (((ref->u.ar.start[n]
-		      && ref->u.ar.start[n]->ts.type == BT_UNKNOWN)
-		     ||
-		     (ref->u.ar.end[n]
-		      && ref->u.ar.end[n]->ts.type == BT_UNKNOWN)
-		     ||
-		     (ref->u.ar.stride[n]
-		      && ref->u.ar.stride[n]->ts.type == BT_UNKNOWN))
-		    && errors > 0)
-		  break;
-	      }
-	    if (n == ref->u.ar.as->rank)
+	    int errors;
+	    gfc_get_errors (NULL, &errors);
+	    if (errors == 0)
 	      gfc_internal_error ("gfc_variable_attr(): Bad array reference");
 	  }
 
Now both patches are just papering over the real issues:

(1) Why is this block reached when compiling with -ffrontend-optimize, but not with -fno-frontend-optimize (Thomas)?
(2) Is there expected side effect(s) when removing the' for‘ block introduced at revision r221955 for pr56852 (Paul)?

Dominique



More information about the Fortran mailing list