re PR fortran/91785 (ICE in check_assumed_size_reference, at fortran/resolve.c:1601)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 2 Oct 2019 17:09:45 +0000 (17:09 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 2 Oct 2019 17:09:45 +0000 (17:09 +0000)
2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91785
* primary.c (gfc_match_varspec): Ensure an inquiry parameter has
it locus set.

2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91785
* gfortran.dg/pr91785.f90: New test.

From-SVN: r276473

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr91785.f90 [new file with mode: 0644]

index 476973d..bf8702f 100644 (file)
@@ -1,5 +1,11 @@
 2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/91785
+       * primary.c (gfc_match_varspec): Ensure an inquiry parameter has
+       it locus set.
+
+2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/91942
        * io.c (match_vtag): Check for non-NULL result->symtree.
        (match_out_tag): Check for invalid constant due to inquiry parameter.
index e94ea82..7c65b2e 100644 (file)
@@ -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)
index 88e4d32..cdd99ef 100644 (file)
@@ -1,5 +1,10 @@
 2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/91785
+       * gfortran.dg/pr91785.f90: New test.
+
+2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/91942
        * gfortran.dg/pr91587.f90: Update dg-error regex.
        * gfortran.dg/pr91942.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr91785.f90 b/gcc/testsuite/gfortran.dg/pr91785.f90
new file mode 100644 (file)
index 0000000..fb3d964
--- /dev/null
@@ -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