diff options
author | Easwaran Raman <eraman@google.com> | 2011-04-20 18:34:59 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@gcc.gnu.org> | 2011-04-20 18:34:59 +0000 |
commit | 4a25752bbd26c53f9c1c821afcfaf4b92ccb0527 (patch) | |
tree | 82b888cb47014836fd0f723d4bff154d61225312 /gcc | |
parent | 1809ba94d466b185e0f468999138796cf0da54c7 (diff) | |
download | gcc-4a25752bbd26c53f9c1c821afcfaf4b92ccb0527.zip gcc-4a25752bbd26c53f9c1c821afcfaf4b92ccb0527.tar.gz gcc-4a25752bbd26c53f9c1c821afcfaf4b92ccb0527.tar.bz2 |
cfgexpand.c (add_alias_set_conflicts): Add conflicts with a variable containing union type only with -fstrict-aliasing.
2011-04-20 Easwaran Raman <eraman@google.com>
* cfgexpand.c (add_alias_set_conflicts): Add conflicts with a variable
containing union type only with -fstrict-aliasing.
2011-04-20 Easwaran Raman <eraman@google.com>
* gcc.dg/stack-layout-1.c: New test.
From-SVN: r172788
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/stack-layout-1.c | 25 |
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86a2b83..85ec2e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-20 Easwaran Raman <eraman@google.com> + + * cfgexpand.c (add_alias_set_conflicts): Add conflicts with a variable + containing union type only with -fstrict-aliasing. + 2011-04-20 Jim Meyering <meyering@redhat.com> Remove useless if-before-free tests. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index a3abc84..e88bec1 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -373,8 +373,9 @@ add_alias_set_conflicts (void) to elements will conflict. In case of unions we have to be careful as type based aliasing rules may say access to the same memory does not conflict. So play - safe and add a conflict in this case. */ - || contains_union) + safe and add a conflict in this case when + -fstrict-aliasing is used. */ + || (contains_union && flag_strict_aliasing)) add_stack_var_conflict (i, j); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3528f3e..dfa5c8c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-20 Easwaran Raman <eraman@google.com> + + * gcc.dg/stack-layout-1.c: New test. + 2011-04-20 Daniel Jacobowitz <dan@codesourcery.com> * gcc.dg/vect/vect-shift-3.c, gcc.dg/vect/vect-shift-4.c: New. diff --git a/gcc/testsuite/gcc.dg/stack-layout-1.c b/gcc/testsuite/gcc.dg/stack-layout-1.c new file mode 100644 index 0000000..389a4eb --- /dev/null +++ b/gcc/testsuite/gcc.dg/stack-layout-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fdump-rtl-expand" } */ +union U { + int a; + float b; +}; +struct A { + union U u1; + char a[100]; +}; +void bar (struct A *); +void foo () + { + { + struct A a; + bar (&a); + } + { + struct A a; + bar (&a); + } + } + +/* { dg-final { scan-rtl-dump-times "Partition" 1 "expand" } } */ +/* { dg-final { cleanup-rtl-dump "expand" } } */ |