diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-30 08:22:15 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-30 08:22:15 +0000 |
commit | 4d6c561bfad8de02b048f8947a8f2ef803ca979c (patch) | |
tree | 44218b6855bc66127f9b11af7c5a184ffc5ce829 | |
parent | 663870fcfbd8a82aa73cb4d24002416b3c3920df (diff) | |
download | gcc-4d6c561bfad8de02b048f8947a8f2ef803ca979c.tar.gz |
2010-04-30 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43879
* tree-ssa-structalias.c (get_constraint_for_1): Properly
handle non-zero initializers.
* gcc.dg/torture/pr43879_1.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158924 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr43879_1.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr43879_2.c | 17 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 6 |
5 files changed, 59 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d20e202253c..936a8386137 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2010-04-30 Richard Guenther <rguenther@suse.de> + PR tree-optimization/43879 + * tree-ssa-structalias.c (get_constraint_for_1): Properly + handle non-zero initializers. + +2010-04-30 Richard Guenther <rguenther@suse.de> + * builtins.c (fold_builtin_1): Delete free (0). 2010-04-29 Jan HUbicka <jh@suse.cz> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf678b87ef3..f3284dc07ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2010-04-30 Richard Guenther <rguenther@suse.de> + PR tree-optimization/43879 + * gcc.dg/torture/pr43879_1.c: New testcase. + +2010-04-30 Richard Guenther <rguenther@suse.de> + * gcc.dg/tree-ssa/builtin-free.c: New testcase. 2010-04-29 Fabien ChĂȘne <fabien.chene@gmail.com> diff --git a/gcc/testsuite/gcc.dg/torture/pr43879_1.c b/gcc/testsuite/gcc.dg/torture/pr43879_1.c new file mode 100644 index 00000000000..151a184cb19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr43879_1.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fipa-pta" } */ +/* { dg-additional-sources "pr43879_2.c" } */ + +void bar(int c) +{ + static int x = 1; + if (c != x) __builtin_abort(); + x--; +} + +void baz(int *i) +{ + (*i)--; +} + +struct TBL { + int (*p)(int *i); +}; +extern struct TBL tbl; + +int main() +{ + int c = 1; + return tbl.p(&c); +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr43879_2.c b/gcc/testsuite/gcc.dg/torture/pr43879_2.c new file mode 100644 index 00000000000..8155653a627 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr43879_2.c @@ -0,0 +1,17 @@ +struct TBL { + int (*p)(int *i); +}; + +extern void bar(int i); +extern void baz(int *i); + +static int foo(int *i) +{ + bar(*i); + baz(i); + bar(*i); + return *i; +} + +struct TBL tbl = { foo }; + diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 08d3fa7e15b..928dc04d131 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3285,8 +3285,10 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p) && ((TREE_CODE (t) == INTEGER_CST && integer_zerop (t)) /* The only valid CONSTRUCTORs in gimple with pointer typed - elements are zero-initializer. */ - || TREE_CODE (t) == CONSTRUCTOR)) + elements are zero-initializer. But in IPA mode we also + process global initializers, so verify at least. */ + || (TREE_CODE (t) == CONSTRUCTOR + && CONSTRUCTOR_NELTS (t) == 0))) { temp.var = nothing_id; temp.type = ADDRESSOF; |