OSDN Git Service

2008-08-29 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Aug 2008 11:40:47 +0000 (11:40 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Aug 2008 11:40:47 +0000 (11:40 +0000)
PR middle-end/37236
* tree-ssa-structalias.c (intra_create_variable_infos): Mark
PARAM_NOALIAS tags with is_heapvar.
* tree-ssa-operands.c (access_can_touch_variable): Offset
based tests do not apply for heapvars.  Fix offset test.

* gfortran.fortran-torture/compile/pr37236.f: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139763 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr37236.f [new file with mode: 0644]
gcc/tree-ssa-operands.c
gcc/tree-ssa-structalias.c

index 3b80285..87290dc 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-29  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37236
+       * tree-ssa-structalias.c (intra_create_variable_infos): Mark
+       PARAM_NOALIAS tags with is_heapvar.
+       * tree-ssa-operands.c (access_can_touch_variable): Offset
+       based tests do not apply for heapvars.  Fix offset test.
+
 2008-08-29  Jan Hubicka  <jh@suse.cz>
 
        * doc/invoke.texi (-fipa-cp): Enabled by default at -O2/-Os/-O3
index 14b4299..d336719 100644 (file)
@@ -1,5 +1,10 @@
 2008-08-29  Richard Guenther  <rguenther@suse.de>
 
+       PR middle-end/37236
+       * gfortran.fortran-torture/compile/pr37236.f: New testcase.
+
+2008-08-29  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/37207
        * gcc.dg/tree-ssa/vrp46.c: New testcase.
 
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr37236.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr37236.f
new file mode 100644 (file)
index 0000000..8f7cc36
--- /dev/null
@@ -0,0 +1,82 @@
+C
+      SUBROUTINE FFTRC  (A,N,X,IWK,WK)
+C                                  SPECIFICATIONS FOR ARGUMENTS
+      INTEGER            N,IWK(1)
+      REAL*8             A(N),WK(1)
+      COMPLEX*16         X(1)
+C                                  SPECIFICATIONS FOR LOCAL VARIABLES
+      INTEGER            ND2P1,ND2,I,MTWO,M,IMAX,ND4,NP2,K,NMK,J
+      REAL*8             RPI,ZERO,ONE,HALF,THETA,TP,G(2),B(2),Z(2),AI,
+     1                   AR
+      COMPLEX*16         XIMAG,ALPH,BETA,GAM,S1,ZD
+      EQUIVALENCE        (GAM,G(1)),(ALPH,B(1)),(Z(1),AR),(Z(2),AI),
+     1                   (ZD,Z(1))
+      DATA               ZERO/0.0D0/,HALF/0.5D0/,ONE/1.0D0/,IMAX/24/
+      DATA               RPI/3.141592653589793D0/
+C                                  FIRST EXECUTABLE STATEMENT
+      IF (N .NE. 2) GO TO 5
+C                                  N EQUAL TO 2
+      ZD = DCMPLX(A(1),A(2))
+      THETA = AR
+      TP = AI
+      X(2) = DCMPLX(THETA-TP,ZERO)
+      X(1) = DCMPLX(THETA+TP,ZERO)
+      GO TO 9005
+    5 CONTINUE
+C                                  N GREATER THAN 2
+      ND2 = N/2
+      ND2P1 = ND2+1
+C                                  MOVE A TO X
+      J = 1
+      DO 6 I=1,ND2
+         X(I) = DCMPLX(A(J),A(J+1))
+         J = J+2
+    6 CONTINUE
+C                                  COMPUTE THE CENTER COEFFICIENT
+      GAM = DCMPLX(ZERO,ZERO)
+      DO 10 I=1,ND2
+         GAM = GAM + X(I)
+   10 CONTINUE
+      TP = G(1)-G(2)
+      GAM = DCMPLX(TP,ZERO)
+C                                  DETERMINE THE SMALLEST M SUCH THAT
+C                                  N IS LESS THAN OR EQUAL TO 2**M
+      MTWO = 2
+      M = 1
+      DO 15 I=1,IMAX
+         IF (ND2 .LE. MTWO) GO TO 20
+         MTWO = MTWO+MTWO
+         M = M+1
+   15 CONTINUE
+   20 IF (ND2 .EQ. MTWO) GO TO 25
+C                                  N IS NOT A POWER OF TWO, CALL FFTCC
+      CALL FFTCC (X,ND2,IWK,WK)
+      GO TO 30
+C                                  N IS A POWER OF TWO, CALL FFT2C
+   25 CALL FFT2C (X,M,IWK)
+   30 ALPH = X(1)
+      X(1) = B(1) + B(2)
+      ND4 = (ND2+1)/2
+      IF (ND4 .LT. 2) GO TO 40
+      NP2 = ND2 + 2
+      THETA = RPI/ND2
+      TP = THETA
+      XIMAG = DCMPLX(ZERO,ONE)
+C                                  DECOMPOSE THE COMPLEX VECTOR X
+C                                  INTO THE COMPONENTS OF THE TRANSFORM
+C                                  OF THE INPUT DATA.
+      DO 35 K = 2,ND4
+         NMK = NP2 - K
+         S1 = DCONJG(X(NMK))
+         ALPH = X(K) + S1
+         BETA = XIMAG*(S1-X(K))
+         S1 = DCMPLX(DCOS(THETA),DSIN(THETA))
+         X(K) = (ALPH+BETA*S1)*HALF
+         X(NMK) = DCONJG(ALPH-BETA*S1)*HALF
+         THETA = THETA + TP
+   35 CONTINUE
+   40 CONTINUE
+      X(ND2P1) = GAM
+ 9005 RETURN
+      END
+
index 8c94baa..801d2de 100644 (file)
@@ -1247,26 +1247,26 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
      D.874_2 = (*my_char_ref_1)[1]{lb: 1 sz: 1};
   */
   if (ref 
-          && flag_strict_aliasing
-          && TREE_CODE (ref) != INDIRECT_REF
-          && !MTAG_P (alias)
-          && base
-          && (TREE_CODE (base) != INDIRECT_REF
-              || TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
-          && (TREE_CODE (base) != INDIRECT_REF
-              || TREE_CODE (ref) != ARRAY_REF
-              || offset != 0
-              || (DECL_SIZE (alias)
-                  && TREE_CODE (DECL_SIZE (alias)) == INTEGER_CST
-                  && size != -1
-                  && (unsigned HOST_WIDE_INT)size
-                     != TREE_INT_CST_LOW (DECL_SIZE (alias))))
-          && !AGGREGATE_TYPE_P (TREE_TYPE (alias))
-          && TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
-          && !var_ann (alias)->is_heapvar
-          /* When the struct has may_alias attached to it, we need not to
-             return true.  */
-          && get_alias_set (base))
+      && flag_strict_aliasing
+      && TREE_CODE (ref) != INDIRECT_REF
+      && !MTAG_P (alias)
+      && base
+      && (TREE_CODE (base) != INDIRECT_REF
+         || TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
+      && (TREE_CODE (base) != INDIRECT_REF
+         || TREE_CODE (ref) != ARRAY_REF
+         || offset != 0
+         || (DECL_SIZE (alias)
+             && TREE_CODE (DECL_SIZE (alias)) == INTEGER_CST
+             && size != -1
+             && (unsigned HOST_WIDE_INT)size
+             != TREE_INT_CST_LOW (DECL_SIZE (alias))))
+      && !AGGREGATE_TYPE_P (TREE_TYPE (alias))
+      && TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
+      && !var_ann (alias)->is_heapvar
+      /* When the struct has may_alias attached to it, we need not to
+        return true.  */
+      && get_alias_set (base))
     {
 #ifdef ACCESS_DEBUGGING
       fprintf (stderr, "Access to ");
@@ -1285,11 +1285,12 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
           && flag_strict_aliasing
           && TREE_CODE (ref) != INDIRECT_REF
           && !MTAG_P (alias)
+          && !var_ann (alias)->is_heapvar
           && !POINTER_TYPE_P (TREE_TYPE (alias))
           && offsetgtz
           && DECL_SIZE (alias)
           && TREE_CODE (DECL_SIZE (alias)) == INTEGER_CST
-          && uoffset > TREE_INT_CST_LOW (DECL_SIZE (alias)))
+          && uoffset >= TREE_INT_CST_LOW (DECL_SIZE (alias)))
     {
 #ifdef ACCESS_DEBUGGING
       fprintf (stderr, "Access to ");
index 7ed37a5..db0912a 100644 (file)
@@ -4551,6 +4551,7 @@ intra_create_variable_infos (void)
              heapvar_insert (t, heapvar);
 
              ann = get_var_ann (heapvar);
+             ann->is_heapvar = 1;
              if (flag_argument_noalias == 1)
                ann->noalias_state = NO_ALIAS;
              else if (flag_argument_noalias == 2)