[PATCH] Fix PR43505

Jan Hubicka hubicka@ucw.cz
Sun Mar 28 23:19:00 GMT 2010


> > 
> > This fixes update_clone_info messing with types of variables in
> > the original bodies of clones.  Which looks bogus, but I can't
> > make sense of much of the code.  So, Honza, does this look ok?
> 
Hi,
the problem is that we apply the transformations twice.  Once when materializing
the virtual clone and second time when saving body for further inlining.  The
second change should not happen but it does because we copy update tables
while producing inline clones.  Fixed by the following patch

Bootstrapped/regtested x86_64-linux, commited.

	* cgraph.c (cgraph_clone_node): When clonning a clone, replacement
	map should not be copied.
	* gfortran.dg/pr43505.f90: New testcase.
Index: cgraph.c
===================================================================
*** cgraph.c	(revision 157772)
--- cgraph.c	(working copy)
*************** cgraph_clone_node (struct cgraph_node *n
*** 1891,1896 ****
--- 1891,1897 ----
    new_node->rtl = n->rtl;
    new_node->count = count;
    new_node->clone = n->clone;
+   new_node->clone.tree_map = 0;
    if (n->count)
      {
        if (new_node->count > n->count)
Index: testsuite/gfortran.dg/pr43505.f90
===================================================================
*** testsuite/gfortran.dg/pr43505.f90	(revision 0)
--- testsuite/gfortran.dg/pr43505.f90	(revision 0)
***************
*** 0 ****
--- 1,43 ----
+  MODULE MAIN1
+       INTEGER , PARAMETER :: MXGLVL = 87
+       CHARACTER(8) :: SRCTYP
+       REAL :: GRIDWS(MXGLVL)
+       REAL :: ZI, HS
+     END MODULE MAIN1
+ 
+     PROGRAM TEST
+       USE MAIN1
+       IF (HS >= ZI) THEN
+       ELSEIF (      SRCTYP == 'AREA'     &
+                .OR. SRCTYP == 'AREAPOLY' &
+                .OR. SRCTYP == 'AREACIRC' &
+                .OR. SRCTYP == 'OPENPIT'   ) THEN
+          CALL ANYAVG (MXGLVL, GRIDWS)
+          CALL ANYAVG (MXGLVL, GRIDWS)
+       ELSE
+          IF ( HS > 0.0 ) THEN
+             CALL ANYAVG (MXGLVL, GRIDWS)
+             CALL ANYAVG (MXGLVL, GRIDWS)
+             CALL ANYAVG (MXGLVL, GRIDWS)
+          ENDIF
+       ENDIF
+       IF (HS.LT.ZI) THEN
+          ZI = HS
+       ENDIF
+     contains
+       SUBROUTINE ANYAVG(NLVLS,HTS)
+         INTEGER NLVLS
+         REAL HTS(NLVLS)
+         IF (5.LT.NLVLS) THEN
+            CALL GINTRP (HTS(5),HTS(5+1))
+         ENDIF
+         CALL GINTRP (HTS(5-1), HTS(5))
+       END SUBROUTINE ANYAVG
+ 
+       subroutine gintrp (x1, x2)
+         print *, x1, x2
+       end subroutine
+ 
+     END PROGRAM TEST
+ 
+ 



More information about the Gcc-patches mailing list