Hello world,

New year, new bug, new patch :-)

I have just committed as obvious and simple the attached patch
as r279821, where we failed to account for %re and %im in dependency
checking. This is a 10 regression, gcc 9 works.

Regards

        Thomas

Handle REF_INQUIRY for dependency checking.

2020-01-01  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/93113
        * dependency.c (gfc_dep_resolver): Handle REF_INQUIRY in switch
        for ref types.

2020-01-01  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/93113
        * gfortran.dg/dependency_58.f90: New test.
Index: dependency.c
===================================================================
--- dependency.c	(Revision 279765)
+++ dependency.c	(Arbeitskopie)
@@ -2286,6 +2286,12 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gf
 	     subsequent references also overlap.  */
 	  break;
 
+	case REF_INQUIRY:
+	  if (lref->u.i != rref->u.i)
+	    return 0;
+
+	  break;
+
 	default:
 	  gcc_unreachable ();
 	}
! { dg-do run }
! { dg-additional-options "-ffrontend-optimize -Warray-temporaries" }
! PR 93113 - this used to ICE, and should not generate a temporary.
program main
  integer, parameter :: n = 10
  complex, dimension(n,n) :: a, b, c
  real, dimension(n,n) :: r
  call random_number (r)
  c%re = r
  call random_number (r)
  c%im = r

  a = c
  b = c
  b%re = a%re - 0.5
  b%im = a%im - 0.5
  a%re = a%re - 0.5
  a%im = a%im - 0.5
  if (any (a /= b)) stop 1
  b%im = a%re
  a%im = a%re
  if (any (a /= b)) stop 2
  a = c
  b = c
  b(2:n,:)%re = a(1:n-1,:)%re
  a(2:n,:)%re = a(1:n-1,:)%re
  if (any (a /= b)) stop 3
  a = c
  b = c
  b(1:n-1,:)%im = a(2:,:)%im
  a(1:n-1,:)%im = a(2:,:)%im
  if (any (a /= b)) stop 3
end program main

Reply via email to