From: Steven G. Kargl Date: Tue, 27 Oct 2015 16:42:24 +0000 (+0000) Subject: re PR fortran/68108 (erroneous error message 'scalar integer expression expected') X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54b96a2d6adb14e7158097f5d75c0aff6df8987f;p=gcc.git re PR fortran/68108 (erroneous error message 'scalar integer expression expected') 2015-10-27 Steven G. Kargl PR fortran/68108 * decl.c (char_len_param_value): Check for REF_ARRAY. 2015-10-27 Steven G. Kargl PR fortran/68108 * gfortran.dg/pr67805_2.f90: New test. From-SVN: r229446 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 51eeb0b61f5..37956ce444a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-10-27 Steven G. Kargl + + PR fortran/68108 + * decl.c (char_len_param_value): Check for REF_ARRAY. + 2015-10-26 Louis Krupp PR fortran/66056 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 651f1b0265d..07c539162f4 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -748,13 +748,15 @@ char_len_param_value (gfc_expr **expr, bool *deferred) /* This catches the invalid code "[character(m(2:3)) :: 'x', 'y']", which causes an ICE if gfc_reduce_init_expr() is called. */ - if (e->ref && e->ref->u.ar.type == AR_UNKNOWN + if (e->ref && e->ref->type == REF_ARRAY + && e->ref->u.ar.type == AR_UNKNOWN && e->ref->u.ar.dimen_type[0] == DIMEN_RANGE) goto syntax; gfc_reduce_init_expr (e); - if ((e->ref && e->ref->u.ar.type != AR_ELEMENT) + if ((e->ref && e->ref->type == REF_ARRAY + && e->ref->u.ar.type != AR_ELEMENT) || (!e->ref && e->expr_type == EXPR_ARRAY)) { gfc_free_expr (e); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc176e37e05..ab53bc1ff3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ + 2015-10-27 Steven G. Kargl + + PR fortran/68108 + * gfortran.dg/pr67805_2.f90: New test. + 2015-10-27 Abderrazek Zaafrani Aditya Kumar diff --git a/gcc/testsuite/gfortran.dg/pr67805_2.f90 b/gcc/testsuite/gfortran.dg/pr67805_2.f90 new file mode 100644 index 00000000000..4438d3e6912 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67805_2.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/68108 +! Code contributed by Juergen Reuter (juergen.reuter at desy dot de) +! Test fix for regression caused by PR fortran/67805. +module lexers + implicit none + type :: template_t + character(256) :: charset1 + integer :: len1 + end type template_t + +contains + + subroutine match_quoted (tt, s, n) + type(template_t), intent(in) :: tt + character(*), intent(in) :: s + integer, intent(out) :: n + character(tt%len1) :: ch1 + ch1 = tt%charset1 + end subroutine match_quoted + +end module lexers