diff options
author | Richard Guenther <rguenther@suse.de> | 2009-04-03 12:38:08 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-04-03 12:38:08 +0000 |
commit | 0c908ffc09740cce5c717fb2f8260866a425b04b (patch) | |
tree | 0f6732c338f53048de7aa953a2e24a8a8db203bb /gcc | |
parent | 075f83f5b0ce91fddf3947fb115e0982b96f68ff (diff) | |
download | gcc-0c908ffc09740cce5c717fb2f8260866a425b04b.zip gcc-0c908ffc09740cce5c717fb2f8260866a425b04b.tar.gz gcc-0c908ffc09740cce5c717fb2f8260866a425b04b.tar.bz2 |
re PR tree-optimization/2480 (aliasing problem with global structures)
2009-04-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/2480
PR tree-optimization/23086
* gcc.dg/tree-ssa/pr2480.c: New testcase.
* gcc.dg/tree-ssa/pr23086.c: Likewise.
From-SVN: r145499
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr23086.c | 35 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr2480.c | 53 |
3 files changed, 95 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e9f0ff4..ded87d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2009-04-03 Richard Guenther <rguenther@suse.de> + PR tree-optimization/2480 + PR tree-optimization/23086 + * gcc.dg/tree-ssa/pr2480.c: New testcase. + * gcc.dg/tree-ssa/pr23086.c: Likewise. + +2009-04-03 Richard Guenther <rguenther@suse.de> + PR tree-optimization/34743 * gcc.dg/pr38984.c: Remove XFAIL, adjust. * gcc.dg/tree-ssa/20070302-1.c: Remove XFAIL. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c new file mode 100644 index 0000000..206b92d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +extern void link_error (void); +extern void abort (void); + +int *t; +int __attribute__((noinline)) g(int *a) +{ + t = a; + *a = 2; +} + +void __attribute__((noinline)) f(int *a) +{ + int b; + b = 1; + g(&b); + b = 2; + *a = 1; + if (b != 2) + link_error(); +} + +int main(void) +{ + int t; + f(&t); + if (t != 1) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c b/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c new file mode 100644 index 0000000..d7f7af4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c @@ -0,0 +1,53 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ + +/* We have enough cascading at -O2 to cover the missed control-dependence + in SCCVN (which considers the link_error calls to clobber the structs). */ + +struct example +{ + char a; + int b; + char c; +} *ex1; + +extern void link_error(void); + +void +bar (void) +{ + ex1->a = 1; + ex1->b = 2; + ex1->c = 3; + + if (ex1->a != 1) + link_error (); + if (ex1->b != 2) + link_error (); + if (ex1->c != 3) + link_error (); + +} + +void +foo (struct example *ex2) +{ + ex2->a = 1; + ex2->b = 2; + ex2->c = 3; + + if (ex2->a != 1) + link_error (); + if (ex2->b != 2) + link_error (); + if (ex2->c != 3) + link_error (); + +} + +int main (void) +{ + bar (); + foo (ex1); + return 0; +} |