backport: re PR fortran/83093 (ICE in fold_convert_loc, at fold-const.c:2266)
2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org> Backport from trunk 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> Backport from trunk PR fortran/83093 * gfortran.dg/allocate_with_typespec_7.f90: New test. From-SVN: r256459
This commit is contained in:
parent
ee30b822e5
commit
7a760f1977
|
@ -1,3 +1,10 @@
|
|||
2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
Backport from trunk
|
||||
PR fortran/83093
|
||||
* resolve.c (resolve_charlen): Check the type of cl->length
|
||||
after resolution.
|
||||
|
||||
2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
|
||||
|
||||
Backport r254555 from trunk
|
||||
|
|
|
@ -11458,10 +11458,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 && 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;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
Backport from trunk
|
||||
PR fortran/83093
|
||||
* gfortran.dg/allocate_with_typespec_7.f90: New test.
|
||||
|
||||
2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
|
||||
|
||||
Backport r254555 from trunk
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
! { 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
|
Loading…
Reference in New Issue