re PR fortran/40472 (Simplification of spread intrinsic takes a long time)
authorTobias Burnus <burnus@net-b.de>
Mon, 22 Jun 2009 20:24:18 +0000 (22:24 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 22 Jun 2009 20:24:18 +0000 (22:24 +0200)
2009-06-22  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40472
        PR fortran/50520
        * simplify.c (gfc_simplify_spread): Fix the case that source=
        is a scalar.

From-SVN: r148814

gcc/fortran/ChangeLog
gcc/fortran/simplify.c

index c42c91d..b502caf 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-22  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/40472
+       PR fortran/50520
+       * simplify.c (gfc_simplify_spread): Fix the case that source=
+       is a scalar.
+
 2009-06-22  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/40443
index 79341d3..f57f68e 100644 (file)
@@ -5117,7 +5117,14 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
 
   /* Do not allow the array size to exceed the limit for an array
      constructor.  */
-  gfc_array_size (source, &size);
+  if (source->expr_type == EXPR_ARRAY)
+    {
+      if (gfc_array_size (source, &size) == FAILURE)
+       gfc_internal_error ("Failure getting length of a constant array.");
+    }
+  else
+    mpz_init_set_ui (size, 1);
+
   if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor)
     return NULL;