public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] Fortran : ICE in gfc_find_array_ref(): No ref found PR95981
@ 2020-08-22 23:36 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 23:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7400b59c38a0394223e216d7dc236335d0c2d0c7

commit 7400b59c38a0394223e216d7dc236335d0c2d0c7
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date:   Tue Jun 30 10:15:05 2020 +0100

    Fortran  :  ICE in gfc_find_array_ref(): No ref found PR95981
    
    When looking for an array reference allow NULL references.  If
    no array reference is found dim_rank_check should return false.
    
    2020-07-13  Steven G. Kargl  <kargl@gcc.gnu.org>
    
    gcc/fortran/
    
            PR fortran/95981
            * check.c (dim_rank_check): Allow NULL references in call to
            gfc_find_array_ref and return false if no reference is found.
    
    2020-07-13  Mark Eggleston  <markeggleston@gcc.gnu.org>
    
    gcc/testsuite/
    
            PR fortran/95981
            * gfortran.dg/pr95981.f90: New test.

Diff:
---
 gcc/fortran/check.c                   | 4 +++-
 gcc/testsuite/gfortran.dg/pr95981.f90 | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 8ecf4ff4f50..89cc158fab1 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -1142,7 +1142,9 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
 
   if (array->expr_type == EXPR_VARIABLE)
     {
-      ar = gfc_find_array_ref (array);
+      ar = gfc_find_array_ref (array, true);
+      if (!ar)
+	return false;
       if (ar->as->type == AS_ASSUMED_SIZE
 	  && !allow_assumed
 	  && ar->type != AR_ELEMENT
diff --git a/gcc/testsuite/gfortran.dg/pr95981.f90 b/gcc/testsuite/gfortran.dg/pr95981.f90
new file mode 100644
index 00000000000..7da6e9bd3dd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95981.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+program p
+   type t
+   end type
+   class(t) :: x(:)        ! { dg-error "must be dummy, allocatable or pointer" }
+   type(t) :: y(size(x,1)) ! { dg-error "must be constant of INTEGER type" }
+end
+


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-22 23:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 23:36 [gcc/devel/autopar_devel] Fortran : ICE in gfc_find_array_ref(): No ref found PR95981 Giuliano Belinassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).