re PR tree-optimization/86231 (vrp_meet causes wrong-code)
PR tree-optimization/86231 * tree-vrp.c (union_ranges): For ( [ ) ] or ( )[ ] range and anti-range don't overwrite *vr0min before using it to compute *vr0max. * gcc.dg/tree-ssa/vrp119.c: New test. * gcc.c-torture/execute/pr86231.c: New test. From-SVN: r261805
This commit is contained in:
parent
60f02f9021
commit
c81a5aecc5
5 changed files with 63 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2018-06-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/86231
|
||||
* tree-vrp.c (union_ranges): For ( [ ) ] or ( )[ ] range and
|
||||
anti-range don't overwrite *vr0min before using it to compute *vr0max.
|
||||
|
||||
2018-06-20 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
PR tree-optimization/86097
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2018-06-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/86231
|
||||
* gcc.dg/tree-ssa/vrp119.c: New test.
|
||||
* gcc.c-torture/execute/pr86231.c: New test.
|
||||
|
||||
2018-06-20 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
PR tree-optimization/86097
|
||||
|
|
30
gcc/testsuite/gcc.c-torture/execute/pr86231.c
Normal file
30
gcc/testsuite/gcc.c-torture/execute/pr86231.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* PR tree-optimization/86231 */
|
||||
|
||||
#define ONE ((void *) 1)
|
||||
#define TWO ((void *) 2)
|
||||
|
||||
__attribute__((noipa)) int
|
||||
foo (void *p, int x)
|
||||
{
|
||||
if (p == ONE) return 0;
|
||||
if (!p)
|
||||
p = x ? TWO : ONE;
|
||||
return p == ONE ? 0 : 1;
|
||||
}
|
||||
|
||||
int v[8];
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (foo ((void *) 0, 0) != 0
|
||||
|| foo ((void *) 0, 1) != 1
|
||||
|| foo (ONE, 0) != 0
|
||||
|| foo (ONE, 1) != 0
|
||||
|| foo (TWO, 0) != 1
|
||||
|| foo (TWO, 1) != 1
|
||||
|| foo (&v[7], 0) != 1
|
||||
|| foo (&v[7], 1) != 1)
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
20
gcc/testsuite/gcc.dg/tree-ssa/vrp119.c
Normal file
20
gcc/testsuite/gcc.dg/tree-ssa/vrp119.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* PR tree-optimization/86231 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-vrp1" } */
|
||||
/* { dg-final { scan-tree-dump-not "link_error" "vrp1" } } */
|
||||
|
||||
int bar (int);
|
||||
void link_error (void);
|
||||
|
||||
int
|
||||
foo (int x, int y, int z)
|
||||
{
|
||||
if (x < 4 || x > 8) __builtin_unreachable ();
|
||||
if (y >= 2 && y <= 6) __builtin_unreachable ();
|
||||
/* x is [4, 8], y is ~[2, 6], resulting range of e should be ~[2, 3]. */
|
||||
int e = (z ? x : y);
|
||||
bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (e))))))))))));
|
||||
if (e == 2 || e == 3)
|
||||
link_error ();
|
||||
return e;
|
||||
}
|
|
@ -5922,9 +5922,9 @@ union_ranges (enum value_range_type *vr0type,
|
|||
if (TREE_CODE (*vr0min) == INTEGER_CST)
|
||||
{
|
||||
*vr0type = vr1type;
|
||||
*vr0min = vr1min;
|
||||
*vr0max = int_const_binop (MINUS_EXPR, *vr0min,
|
||||
build_int_cst (TREE_TYPE (*vr0min), 1));
|
||||
*vr0min = vr1min;
|
||||
}
|
||||
else
|
||||
goto give_up;
|
||||
|
|
Loading…
Add table
Reference in a new issue