diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-06 21:20:49 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-06 21:20:49 +0000 |
commit | 4867426656c7746507ba92f654931c74595ae327 (patch) | |
tree | e96c1e164c8e0a70789c96a57a9bd3fd508a3528 | |
parent | 4f0e221478a312300106cda044efb238dfb3fa1d (diff) | |
download | gcc-4867426656c7746507ba92f654931c74595ae327.tar.gz |
2008-04-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/35400
* tree-vrp.c (vrp_evaluate_conditional): Only query value-range
information from SSA_NAMEs.
* gcc.dg/torture/pr35400.c: New testcase.
* g++.dg/torture/pr35400.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133967 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr35400.C | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr35400.c | 22 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 3 |
5 files changed, 49 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da2f5a7cdf8..921982ecbb4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35400 + * tree-vrp.c (vrp_evaluate_conditional): Only query value-range + information from SSA_NAMEs. + 2008-04-06 Anatoly Sokolov <aesok@post.ru> * config/avr/avr.h (avr_mega_p): Remove declaration. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5b21556f04..beac0eb46d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35400 + * gcc.dg/torture/pr35400.c: New testcase. + * g++.dg/torture/pr35400.C: Likewise. + 2008-04-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/35780 diff --git a/gcc/testsuite/g++.dg/torture/pr35400.C b/gcc/testsuite/g++.dg/torture/pr35400.C new file mode 100644 index 00000000000..021135df813 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr35400.C @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtype-limits" } */ + +struct A +{ + A(); + ~A(); +}; + +void foo() +{ + A x[1]; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr35400.c b/gcc/testsuite/gcc.dg/torture/pr35400.c new file mode 100644 index 00000000000..285dc72e3a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35400.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Wtype-limits" } */ + +struct A +{ + struct A *p; +}; + +int foo(const struct A *q) +{ + return q->p == q; +} + +void bar(int); + +void baz() +{ + struct A a; + + while (foo(&a)) + bar(foo(&a)); +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 9741262dba2..273b5fdfdc0 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -5385,7 +5385,8 @@ vrp_evaluate_conditional (tree cond, tree stmt) if (warn_type_limits && ret - && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison) + && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison + && TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME) { /* If the comparison is being folded and the operand on the LHS is being compared against a constant value that is outside of |