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 476973d5cf23668b93363c4b0b34408f27b47180..bf8702f2e9d997b59ef2af42383153a1a9bd1bbb 100644 (file)
@@ -1,3 +1,9 @@
+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
index e94ea821ba77a89ac2123efa11216325521de6b4..7c65b2e604b4b4610f011adb2b006bd1b42d8ba2 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 88e4d32695b82e6d75a64346ecaa0e28bb4579bb..cdd99ef0c1d7033544160a662e42f8a96ec99cf0 100644 (file)
@@ -1,3 +1,8 @@
+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
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