aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-25 07:13:48 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-25 07:13:48 +0000
commitb745b65632292a38fcca5a90eda20bc851964b2d (patch)
treef40e0754fe57cf6ccebf878a32456f5dde203129
parenteee88414a523c581519229185a7b2b4ecc4d221a (diff)
2006-08-24 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/28807 * tree-ssa-operands.c (access_can_touch_variable): Don't say the access through a base which has an alias set of 0 cannot touch the variable. 2006-08-24 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/28807 * gcc.c-torture/execute/mayalias-2.c: New test. * gcc.dg/tree-ssa/alias-13.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116393 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/mayalias-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/alias-13.c33
-rw-r--r--gcc/tree-ssa-operands.c5
5 files changed, 68 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d27b877677..d6d4d017840 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,11 @@
-2006-08-24 Bill Wendling <wendling@apple.com>
+2006-08-24 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR tree-opt/28807
+ * tree-ssa-operands.c (access_can_touch_variable): Don't say
+ the access through a base which has an alias set of 0 cannot
+ touch the variable.
+
+2006-08-24 Bill Wendling <wendling@apple.com>
* doc/tm.texi (TARGET_DEFAULT_PACK_STRUCT): Fixed English.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 92a3acbe721..e7d53d3e323 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-24 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR tree-opt/28807
+ * gcc.c-torture/execute/mayalias-2.c: New test.
+ * gcc.dg/tree-ssa/alias-13.c: New test.
+
2006-08-24 Jan Hubicka <jh@suse.cz>
PR debug/26881
diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c
new file mode 100644
index 00000000000..5a1a9d5e4a1
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c
@@ -0,0 +1,17 @@
+struct S { short x; };
+typedef struct S __attribute__((__may_alias__)) test;
+
+int f() {
+ int a=10;
+ test *p=(test *)&a;
+ p->x = 1;
+ return a;
+}
+
+int main() {
+ if (f() == 10)
+ __builtin_abort();
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-13.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-13.c
new file mode 100644
index 00000000000..ae7cc82148a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-13.c
@@ -0,0 +1,33 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+
+struct a
+{
+ char a1;
+};
+
+int *aa;
+
+void g(int *a)
+{
+ aa = a;
+ *a = 2;
+}
+
+int t(int i, struct a *b)
+{
+ g(&i);
+ b->a1 = 1;
+ i = 2;
+ if (b->a1 != 1)
+ link_failure ();
+}
+int main(void)
+{
+ struct a b;
+ t(1, &b);
+ return 0;
+}
+
+
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 05637814f13..0e931ca74a9 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1150,7 +1150,10 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
|| TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
&& !AGGREGATE_TYPE_P (TREE_TYPE (alias))
&& TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
- && !POINTER_TYPE_P (TREE_TYPE (alias)))
+ && !POINTER_TYPE_P (TREE_TYPE (alias))
+ /* 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 ");