+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83093
+ * resolve.c (resolve_charlen): Check the type of cl->length
+ after resolution.
+
2018-01-10 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83740
specification_expr = saved_specification_expr;
return false;
}
+
+ /* cl->length has been resolved. It should have an integer type. */
+ if (cl->length->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Scalar INTEGER expression expected at %L",
+ &cl->length->where);
+ return false;
+ }
}
else
{
-
if (!resolve_index_expr (cl->length))
{
specification_expr = saved_specification_expr;
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83093
+ * gfortran.dg/allocate_with_typespec_7.f90: New test.
+
2018-01-10 Peter Bergner <bergner@vnet.ibm.com>
PR target/83399
--- /dev/null
+! { dg-do compile }
+! PR Fortran/83093
+! Contributed by Gerhard Steinmetz <gscfq at t-online dot de>
+program p
+ integer, parameter :: n(2) = [1,2]
+ real :: x = 2
+ character(:), allocatable :: z, zz, zzz
+ character(:), allocatable :: y, yy
+ allocate (character(a) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(x) :: zz) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character((1.0)) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(y) :: y) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(n(1:2)) :: y)! { dg-error "Scalar INTEGER expression" }
+end