public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] Fix PR 92755
@ 2019-12-08 12:29 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2019-12-08 12:29 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hello world,

In the fix for PR 91783, I had not considered the case that
the _data ref could also be somewhere inside. The solution was
obvious and simple: Move the check into the loop over the refs.

Committed as r279086 after regression-testing.

Regards

	Thomas

2019-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92755
	* dependency.c (gfc_dep_resolver):  Move skipping of _data ref
	into the loop.

2019-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92755
	* gfortran.dg/dependency_57.f90: New test.

[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 1612 bytes --]

Index: dependency.c
===================================================================
--- dependency.c	(Revision 279064)
+++ dependency.c	(Arbeitskopie)
@@ -2098,18 +2098,6 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gf
   gfc_dependency this_dep;
   bool same_component = false;
 
-  /* The refs might come in mixed, one with a _data component and one
-     without.  Look at their next reference in order to avoid an
-     ICE.  */
-
-  if (lref && lref->type == REF_COMPONENT && lref->u.c.component
-      && strcmp (lref->u.c.component->name, "_data") == 0)
-    lref = lref->next;
-
-  if (rref && rref->type == REF_COMPONENT && rref->u.c.component
-      && strcmp (rref->u.c.component->name, "_data") == 0)
-    rref = rref->next;
-
   this_dep = GFC_DEP_ERROR;
   fin_dep = GFC_DEP_ERROR;
   /* Dependencies due to pointers should already have been identified.
@@ -2117,6 +2105,18 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gf
 
   while (lref && rref)
     {
+      /* The refs might come in mixed, one with a _data component and one
+	 without.  Look at their next reference in order to avoid an
+	 ICE.  */
+
+      if (lref && lref->type == REF_COMPONENT && lref->u.c.component
+	  && strcmp (lref->u.c.component->name, "_data") == 0)
+	lref = lref->next;
+
+      if (rref && rref->type == REF_COMPONENT && rref->u.c.component
+	  && strcmp (rref->u.c.component->name, "_data") == 0)
+	rref = rref->next;
+
       /* We're resolving from the same base symbol, so both refs should be
 	 the same type.  We traverse the reference chain until we find ranges
 	 that are not equal.  */

[-- Attachment #3: dependency_57.f90 --]
[-- Type: text/x-fortran, Size: 229 bytes --]

! { dg-do compile }
! PR 92755 - this used to cause an ICE.
! Original test case by Gerhard Steinmetz
program p
   type t
   end type
   type t2
      class(t), allocatable :: a(:)
   end type
   type(t2) :: z
   z%a = [z%a]
end

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

only message in thread, other threads:[~2019-12-08 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 12:29 [patch, fortran] Fix PR 92755 Thomas Koenig

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).