diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-16 14:21:53 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-16 14:21:53 +0000 |
commit | 6ee295d9872f6bf3404fba2df7c7ddafacb2ca24 (patch) | |
tree | 2b9a194e46f795ad0e483a1a60c0cc9bd9306b5b /gcc | |
parent | 476a9357566d7b02e50a73946f2fc80795bad984 (diff) | |
download | gcc-6ee295d9872f6bf3404fba2df7c7ddafacb2ca24.tar.gz |
2014-06-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/61482
* tree-vrp.c (adjust_range_with_scev): Avoid setting of
[-INF(OVF), +INF(OVF)] range.
* g++.dg/torture/pr61482.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211709 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr61482.C | 29 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 29 |
4 files changed, 52 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 244d354955d..786ed0cc832 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-06-16 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61482 + * tree-vrp.c (adjust_range_with_scev): Avoid setting of + [-INF(OVF), +INF(OVF)] range. + 2014-06-16 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> * config/i386/i386.c (ix86_expand_sse2_mulvxdi3): Issue diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b417245646a..d6a3dd3c7e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-16 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61482 + * g++.dg/torture/pr61482.C: New testcase. + 2014-06-16 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> * gcc.target/i386/xop-imul64-vector.c: Remove the check for diff --git a/gcc/testsuite/g++.dg/torture/pr61482.C b/gcc/testsuite/g++.dg/torture/pr61482.C new file mode 100644 index 00000000000..1e186cc5ed6 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr61482.C @@ -0,0 +1,29 @@ +// { dg-do compile } + +class A +{ +public: + int m_fn1 (); +}; +class B +{ + void m_fn2 (const int &p1); + A mThebesLayerDataStack; +}; +int b, c; +void B::m_fn2 (const int &p1) +{ + if (c && b) + { + int i; + i = mThebesLayerDataStack.m_fn1 (); + for (; i >= 0;) + { + ++i; + break; + } + --i; + for (; i >= 0; --i) + mThebesLayerDataStack.m_fn1 (); + } +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 428e622a217..b657546a3d7 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -3892,15 +3892,6 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, max = init; else min = init; - - /* If we would create an invalid range, then just assume we - know absolutely nothing. This may be over-conservative, - but it's clearly safe, and should happen only in unreachable - parts of code, or for invalid programs. */ - if (compare_values (min, max) == 1) - return; - - set_value_range (vr, VR_RANGE, min, max, vr->equiv); } else if (vr->type == VR_RANGE) { @@ -3933,16 +3924,20 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, || compare_values (tmax, max) == -1) max = tmax; } + } + else + return; - /* If we just created an invalid range with the minimum - greater than the maximum, we fail conservatively. - This should happen only in unreachable - parts of code, or for invalid programs. */ - if (compare_values (min, max) == 1) - return; + /* If we just created an invalid range with the minimum + greater than the maximum, we fail conservatively. + This should happen only in unreachable + parts of code, or for invalid programs. */ + if (compare_values (min, max) == 1 + || (is_negative_overflow_infinity (min) + && is_positive_overflow_infinity (max))) + return; - set_value_range (vr, VR_RANGE, min, max, vr->equiv); - } + set_value_range (vr, VR_RANGE, min, max, vr->equiv); } |