[RFC] Hack for PRs 43996,45081, 58027, 59910, and 60993

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


Compiling PRs 43996,45081, 58027, 59910, and 60993 gives the ICE

internal compiler error: in gfc_conv_array_initializer, at fortran/trans-array.c:5703

Compiling these PRs with  '-fno-range-check -fmax-array-constructor=1000000' succeeds except PR45081 (note that the output for pr 60993 does not seem to be the one expected by the reporter).

I have played with the following patch which gives the error

Fatal Error: A problem with BOZ and/or PARAMETER occurred at (1), try to compile with -fnorange-check and/or to increase the allowed 65535 upper limit for the '-fmax-array-constructor’ option

Is there a (simple) way to distinguish between the cases compiling with -fnorange-check and those requiring an increase of the default value for -fmax-array-constructor?

Indeed I know that the problem should be fixed upstream, but would it be acceptable to apply this kind of patch meanwhile?

Cheers,

Dominique

--- ../_clean/gcc/fortran/trans-array.c	2015-11-11 15:23:35.000000000 +0100
+++ gcc/fortran/trans-array.c	2015-11-14 22:02:20.000000000 +0100
@@ -5699,7 +5699,21 @@ gfc_conv_array_initializer (tree type, g
     case EXPR_NULL:
       return gfc_build_null_descriptor (type);
 
+    case EXPR_FUNCTION:
+      /* Problems occur when we get something like
+         integer :: a(lots) = (/(i, i=1, lots)/)  */
+      gfc_fatal_error ("A problem with BOZ and/or PARAMETER occurred "
+		       "at %L, try to compile with -fnorange-check and/or "
+		       "to increase the allowed %d upper limit for the "
+		       "%<-fmax-array-constructor%> option",
+		       &expr->where, flag_max_array_constructor);
+      return NULL_TREE;
+      /* int errors;
+      gfc_get_errors (NULL, &errors);
+      gfc_fatal_error ("Something wrong: errors count is %d", errors); */
+
     default:
+      printf ("expr->expr_type is %d\n", expr->expr_type);
       gcc_unreachable ();
     }
 



More information about the Fortran mailing list