From: Andrey Belevantsev Date: Thu, 13 Aug 2009 08:10:21 +0000 (+0400) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.3.5~436 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00e999f3c1c790e8b74c8531c55f394e6fad7aea;p=thirdparty%2Fgcc.git [multiple changes] 2009-08-13 Andrey Belevantsev PR rtl-optimization/41033 * alias.c (nonoverlapping_component_refs_p): Punt if strict aliasing is disabled. 2009-08-13 Richard Guenther PR rtl-optimization/41033 * gcc.dg/pr41033.c: New test. From-SVN: r150714 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae1673f4dc0d..8cfc6075c74a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-08-13 Andrey Belevantsev + + PR rtl-optimization/41033 + * alias.c (nonoverlapping_component_refs_p): Punt when strict + aliasing is disabled. + 2009-08-05 Uros Bizjak Mikulas Patocka diff --git a/gcc/alias.c b/gcc/alias.c index 2148983e3b17..337ee6377297 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1881,6 +1881,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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d383ecc0e78a..685e5774c63a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-08-13 Richard Guenther + + PR rtl-optimization/41033 + * gcc.dg/pr41033.c: New test. + 2009-08-10 Kaveh R. Ghazi Backport: diff --git a/gcc/testsuite/gcc.dg/pr41033.c b/gcc/testsuite/gcc.dg/pr41033.c new file mode 100644 index 000000000000..5043be2d1191 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr41033.c @@ -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; +}