Message ID | 20191002000637.GA48786@troutmask.apl.washington.edu |
---|---|
State | New |
Headers | show |
Series | PR fortran/91785 -- Set locus for inquiry parameter | expand |
On 10/1/19 5:06 PM, Steve Kargl wrote: > The attached patch has been tested on x86_64-*-freebsd. > OK to commit? > Ok Steve, Thanks, Jerry > The patch prevents an ICE by setting the locus of an > inquiry parameter. > > 2019-10-01 Steven G. Kargl <kargl@gcc.gnu.rog. > > PR fortran/91785 > * primary.c (gfc_match_varspec): Ensure an inquiry parameter has > it locus set. > > > 2019-10-01 Steven G. Kargl <kargl@gcc.gnu.rog. > > PR fortran/91785 > * gfortran.dg/pr91785.f90: New test. >
Index: gcc/fortran/primary.c =================================================================== --- gcc/fortran/primary.c (revision 276426) +++ gcc/fortran/primary.c (working copy) @@ -2331,6 +2331,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_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) Index: gcc/testsuite/gfortran.dg/pr91785.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr91785.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr91785.f90 (working copy) @@ -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