https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

--- Comment #3 from kargl at gcc dot gnu.org ---
 gfcx -c a.f90
a.f90:5:13:

     allocate(character(len=*) :: string_array(2))
             1
Error: Type-spec at (1) must contain a scalar integer expression


Index: match.c
===================================================================
--- match.c     (revision 255348)
+++ match.c     (working copy)
@@ -4006,18 +4006,15 @@ gfc_match_allocate (void)
              goto cleanup;
            }

-         if (ts.type == BT_CHARACTER)
-           ts.u.cl->length_from_typespec = true;
-
-         /* TODO understand why this error does not appear but, instead,
-            the derived type is caught as a variable in primary.c.  */
-         if (gfc_spec_list_type (type_param_spec_list, NULL) != SPEC_EXPLICIT)
+         if (!ts.u.cl->length)
            {
-             gfc_error ("The type parameter spec list in the type-spec at "
-                        "%L cannot contain ASSUMED or DEFERRED parameters",
-                        &old_locus);
+             gfc_error ("Type-spec at %L must contain a scalar integer "
+                        "expression", &old_locus);
              goto cleanup;
            }
+
+         if (ts.type == BT_CHARACTER)
+           ts.u.cl->length_from_typespec = true;
        }
       else
        {

Reply via email to