aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
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/alias.c
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/alias.c')
-rw-r--r--gcc/alias.c12
1 files changed, 12 insertions, 0 deletions
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)