From 307de1007192b12dcf5b21b4444904567a543b2e Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 2 Oct 2019 17:09:45 +0000 Subject: [PATCH] re PR fortran/91785 (ICE in check_assumed_size_reference, at fortran/resolve.c:1601) 2019-10-02 Steven G. Kargl PR fortran/91785 * primary.c (gfc_match_varspec): Ensure an inquiry parameter has it locus set. 2019-10-02 Steven G. Kargl PR fortran/91785 * gfortran.dg/pr91785.f90: New test. From-SVN: r276473 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/primary.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr91785.f90 | 8 ++++++++ 4 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr91785.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 476973d5cf2..bf8702f2e9d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-02 Steven G. Kargl + + PR fortran/91785 + * primary.c (gfc_match_varspec): Ensure an inquiry parameter has + it locus set. + 2019-10-02 Steven G. Kargl PR fortran/91942 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index e94ea821ba7..7c65b2e604b 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2331,6 +2331,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, if (tmp && tmp->type == REF_INQUIRY) { + if (!primary->where.lb || !primary->where.nextc) + primary->where = gfc_current_locus; gfc_simplify_expr (primary, 0); if (primary->expr_type == EXPR_CONSTANT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 88e4d32695b..cdd99ef0c1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-02 Steven G. Kargl + + PR fortran/91785 + * gfortran.dg/pr91785.f90: New test. + 2019-10-02 Steven G. Kargl PR fortran/91942 diff --git a/gcc/testsuite/gfortran.dg/pr91785.f90 b/gcc/testsuite/gfortran.dg/pr91785.f90 new file mode 100644 index 00000000000..fb3d964fc06 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91785.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/91785 +! Code contributed by Gerhard Steinmetz +program p + complex :: a(*) ! { dg-error "Assumed size array at" } + real :: b(2) + b = a%im ! { dg-error "upper bound in the last dimension" } +end -- 2.30.2