re PR fortran/19926 ([4.0 only] Incorrect rank with PARAMETER and array element.)
authorErik Edelmann <eedelman@acclab.helsinki.fi>
Sat, 18 Jun 2005 18:16:22 +0000 (18:16 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 18 Jun 2005 18:16:22 +0000 (18:16 +0000)
PR fortran/19926
* primary.c (gfc_match_rvalue):  expr_type can be EXPR_CONSTANT
  for an array; check that sym->as is NULL.

Co-Authored-By: Steven G. Kargl <kargls@comast.net>
From-SVN: r101161

gcc/fortran/ChangeLog
gcc/fortran/primary.c

index 0b3d117..1d180a2 100644 (file)
@@ -1,3 +1,11 @@
+2005-06-18  Erik Edelman  <eedelman@acclab.helsinki.fi>
+           Steven G. Kargl <kargls@comast.net>
+
+       PR fortran/19926
+       * primary.c (gfc_match_rvalue):  expr_type can be EXPR_CONSTANT
+       for an array; check that sym->as is NULL.
+
+
 2005-06-18  Steven G. Kargl  <kargls@comcast.net>
 
        * intrinsic.c (gfc_intrinsic_func_interface): Enable errors for generic
index 38f9939..e1acfbf 100644 (file)
@@ -1802,8 +1802,11 @@ gfc_match_rvalue (gfc_expr ** result)
       break;
 
     case FL_PARAMETER:
-      if (sym->value
-         && sym->value->expr_type != EXPR_ARRAY)
+      /* A statement of the form "REAL, parameter :: a(0:10) = 1" will
+        end up here.  Unfortunately, sym->value->expr_type is set to 
+        EXPR_CONSTANT, and so the if () branch would be followed without
+        the !sym->as check.  */
+      if (sym->value && sym->value->expr_type != EXPR_ARRAY && !sym->as)
        e = gfc_copy_expr (sym->value);
       else
        {