Commit 266404a8 by Steven G. Kargl

[multiple changes]

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  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/83093
	* gfortran.dg/allocate_with_typespec_7.f90: New test.

From-SVN: r256455
parent 88324fd0
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
......
......@@ -11664,10 +11664,17 @@ resolve_charlen (gfc_charlen *cl)
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
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment