aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-10-19 15:36:05 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-10-19 15:36:05 +0000
commit36784d0e879801c081910ea958839797f5f9bb48 (patch)
tree9af82af05ff6db994ce02d04b87bc63d05a986ad /gcc
parent77aadb572826ca8b23ea61ab6ce186f9af1cbe08 (diff)
downloadgcc-36784d0e879801c081910ea958839797f5f9bb48.zip
gcc-36784d0e879801c081910ea958839797f5f9bb48.tar.gz
gcc-36784d0e879801c081910ea958839797f5f9bb48.tar.bz2
re PR middle-end/33816 (gimplification before build_array_type re-set alias set of arrays to zero)
2007-10-19 Richard Guenther <rguenther@suse.de> PR middle-end/33816 PR middle-end/32921 * stor-layout.c (layout_type): Assert that aggregates do not have their alias sets set. * alias.c (get_alias_set): Return alias set zero for incomplete types, return the alias set of the element for incomplete array types, but do not remember these. * gfortran.dg/pr32921.f: New testcase. From-SVN: r129491
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/alias.c12
-rw-r--r--gcc/stor-layout.c11
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/pr32921.f49
5 files changed, 81 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 14f14cc..f553902 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2007-10-19 Richard Guenther <rguenther@suse.de>
+ PR middle-end/33816
+ PR middle-end/32921
+ * stor-layout.c (layout_type): Assert that aggregates do not
+ have their alias sets set.
+ * alias.c (get_alias_set): Return alias set zero for incomplete
+ types, return the alias set of the element for incomplete array
+ types, but do not remember these.
+
+2007-10-19 Richard Guenther <rguenther@suse.de>
+
Revert
2007-10-19 Richard Guenther <rguenther@suse.de>
diff --git a/gcc/alias.c b/gcc/alias.c
index 1ba1ce3..6bf67f3 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -611,6 +611,18 @@ get_alias_set (tree t)
if (TYPE_ALIAS_SET_KNOWN_P (t))
return TYPE_ALIAS_SET (t);
+ /* We don't want to set TYPE_ALIAS_SET for incomplete types. */
+ if (!COMPLETE_TYPE_P (t))
+ {
+ /* For arrays with unknown size the conservative answer is the
+ alias set of the element type. */
+ if (TREE_CODE (t) == ARRAY_TYPE)
+ return get_alias_set (TREE_TYPE (t));
+
+ /* But return zero as a conservative answer for incomplete types. */
+ return 0;
+ }
+
/* See if the language has special handling for this type. */
set = lang_hooks.get_alias_set (t);
if (set != -1)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 2260917..23e0cf5 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1886,13 +1886,10 @@ layout_type (tree type)
&& TREE_CODE (type) != QUAL_UNION_TYPE)
finalize_type_size (type);
- /* If an alias set has been set for this aggregate when it was incomplete,
- force it into alias set 0.
- This is too conservative, but we cannot call record_component_aliases
- here because some frontends still change the aggregates after
- layout_type. */
- if (AGGREGATE_TYPE_P (type) && TYPE_ALIAS_SET_KNOWN_P (type))
- TYPE_ALIAS_SET (type) = 0;
+ /* We should never see alias sets on incomplete aggregates. And we
+ should not call layout_type on not incomplete aggregates. */
+ if (AGGREGATE_TYPE_P (type))
+ gcc_assert (!TYPE_ALIAS_SET_KNOWN_P (type));
}
/* Create and return a type for signed integers of PRECISION bits. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f38e390..0c8d4ca 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-19 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/33816
+ PR middle-end/32921
+ * gfortran.dg/pr32921.f: New testcase.
+
2007-10-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33544
diff --git a/gcc/testsuite/gfortran.dg/pr32921.f b/gcc/testsuite/gfortran.dg/pr32921.f
new file mode 100644
index 0000000..d110301
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr32921.f
@@ -0,0 +1,49 @@
+! { dg-do compile }
+! { dg-options "-O2 -fdump-tree-lim" }
+! gfortran -c -m32 -O2 -S junk.f
+!
+ MODULE LES3D_DATA
+
+ IMPLICIT REAL*8 (A-H,O-Z)
+
+ PARAMETER ( NSPECI = 1, ND = 7 + NSPECI )
+
+ INTEGER IMAX
+
+ DOUBLE PRECISION,ALLOCATABLE,DIMENSION(:,:,:) ::
+ > UAV,QAV
+
+
+ END MODULE LES3D_DATA
+!---------------------------------------------------------------------
+!------------------------------------------------------------------------
+ SUBROUTINE FLUXI()
+
+ USE LES3D_DATA
+ IMPLICIT REAL*8(A-H,O-Z)
+
+ ALLOCATABLE QS(:)
+
+ ALLOCATE( QS(0:IMAX))
+ QS=0D0
+
+ RETURN
+ END
+!------------------------------------------------------------------------
+!------------------------------------------------------------------------
+ SUBROUTINE EXTRAPI()
+
+ USE LES3D_DATA
+ IMPLICIT REAL*8(A-H,O-Z)
+
+ I1 = 0
+ I2 = IMAX - 1
+
+ DO I = I1, I2
+ UAV(I,1,2) = QAV(I,1,2)
+ END DO
+
+ RETURN
+ END
+! { dg-final { scan-tree-dump-times "stride" 6 "lim" } }
+! { dg-final { cleanup-tree-dump "lim" } }