From: Thomas Koenig Date: Wed, 13 Mar 2019 22:15:33 +0000 (+0000) Subject: re PR fortran/87673 (Errors caused by using function for character length in allocate... X-Git-Tag: releases/gcc-7.5.0~543 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e001a79f80527cd087e8329c6f56dadb717e5ced;p=thirdparty%2Fgcc.git re PR fortran/87673 (Errors caused by using function for character length in allocate with typespec) 2019-03-13 Thomas Koenig PR fortran/87673 Backport from trunk * match.c (gfc_match_type_spec): Remove call to gfc_resolve_expr for character length. 2019-03-13 Thomas Koenig PR fortran/87673 Backport from trunk * gfortran.dg/charlen_17.f90: New test. From-SVN: r269666 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1346f4a5d36c..7e6ca7007754 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-03-13 Thomas Koenig + + PR fortran/87673 + Backport from trunk + * match.c (gfc_match_type_spec): Remove call to + gfc_resolve_expr for character length. + 2019-03-10 Thomas Koenig PR fortran/71544 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 222c8d0068ed..0200366d4ed1 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2050,8 +2050,6 @@ gfc_match_type_spec (gfc_typespec *ts) ts->type = BT_CHARACTER; m = gfc_match_char_spec (ts); - if (ts->u.cl && ts->u.cl->length) - gfc_resolve_expr (ts->u.cl->length); if (m == MATCH_NO) m = MATCH_YES; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ebde6c185aa1..16636e13182c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-13 Thomas Koenig + + PR fortran/87673 + Backport from trunk + * gfortran.dg/charlen_17.f90: New test. + 2019-03-13 Andre Vieira Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/charlen_17.f90 b/gcc/testsuite/gfortran.dg/charlen_17.f90 new file mode 100644 index 000000000000..6b766d8f4338 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/charlen_17.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! PR 87673 - used to cause errors about non-pure functions. + +module x + implicit none +contains + pure function foo() result(res) + character(len=:), allocatable :: res + allocate (character(bar()) :: res) + end function foo + pure integer function bar() + bar = 1 + end function bar +end module x