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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Testing the following patch:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 21c8797c938..45a04dab703 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -8108,12 +8108,12 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code,
bool *array_alloc_wo_spec)
            goto failure;

          case  DIMEN_RANGE:
-           if (ar->start[i] == 0 || ar->end[i] == 0)
+           // F2018:R937:
+           // allocate-coshape-spec is [ lower-bound-expr : ] upper-bound-expr
+           if (ar->start[i] == 0 || ar->end[i] == 0 || ar->stride[i] != NULL)
              {
-               /* If ar->stride[i] is NULL, we issued a previous error.  */
-               if (ar->stride[i] == NULL)
-                 gfc_error ("Bad array specification in ALLOCATE statement "
-                            "at %L", &e->where);
+               gfc_error ("Bad array specification in ALLOCATE statement "
+                          "at %L", &e->where);
                goto failure;
              }
            else if (gfc_dep_compare_expr (ar->start[i], ar->end[i]) == 1)

Reply via email to