]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorAndrey Belevantsev <abel@gcc.gnu.org>
Wed, 12 Aug 2009 11:50:22 +0000 (15:50 +0400)
committerAndrey Belevantsev <abel@gcc.gnu.org>
Wed, 12 Aug 2009 11:50:22 +0000 (15:50 +0400)
2009-08-12  Andrey Belevantsev  <abel@ispras.ru>

    PR rtl-optimization/41033
    * alias.c (nonoverlapping_component_refs_p): Punt if strict aliasing is disabled.

2009-08-12  Richard Guenther  <rguenther@suse.de>

    PR rtl-optimization/41033
    * gcc.dg/pr41033.c: New test.

From-SVN: r150680

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr41033.c [new file with mode: 0644]

index d146a2efe08eddb8830527a73449dc3dd7da7f0c..335436f56e7d27be89ece0552b5a6fc9e540c0b9 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-12  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/41033
+       * alias.c (nonoverlapping_component_refs_p): Punt when strict 
+       aliasing is disabled.
+
 2009-08-11  Adam Nemet  <anemet@caviumnetworks.com>
 
        * config/mips/predicates.md (qi_mask_operand, hi_mask_operand,
index fc259b8ef2df72ae7b0fbd4b8051f6490a152f1c..442be827a75ea3c3138dad90ef963ac2a4bb933b 100644 (file)
@@ -1980,6 +1980,9 @@ nonoverlapping_component_refs_p (const_tree x, const_tree y)
 {
   const_tree fieldx, fieldy, typex, typey, orig_y;
 
+  if (!flag_strict_aliasing)
+    return false;
+
   do
     {
       /* The comparison has to be done at a common type, since we don't
index a6e5bea1d3c302d88bf89fbd9c8a77e13764ae5e..11309d89c98b0feca44bc740638a9205a188a562 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-12  Richard Guenther  <rguenther@suse.de>
+    
+       PR rtl-optimization/41033
+       * gcc.dg/pr41033.c: New test. 
+
 2009-08-11  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/41022
diff --git a/gcc/testsuite/gcc.dg/pr41033.c b/gcc/testsuite/gcc.dg/pr41033.c
new file mode 100644 (file)
index 0000000..5043be2
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-options "-O1 -fno-strict-aliasing" } */
+/* PR rtl-optimization/41033 */
+
+struct X {
+  int i;
+  int j;
+};
+
+int foo(struct X *p, struct X *q)
+{
+  p->j = 1;
+  q->i = 0;
+  return p->j;
+}
+
+extern void abort (void);
+
+int main()
+{
+  struct X x;
+  if (foo (&x, (struct X *)&x.j) != 0)
+    abort ();
+  return 0;
+}