From: jakub Date: Mon, 2 Dec 2013 22:41:23 +0000 (+0000) Subject: PR tree-optimization/59358 X-Git-Tag: upstream/4.9.2~2505 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fb9d91fbf54aced848777ce0479feff6f70d106;p=platform%2Fupstream%2Flinaro-gcc.git PR tree-optimization/59358 * tree-vrp.c (union_ranges): To check for the partially overlapping ranges or adjacent ranges, also compare *vr0max with vr1max. * gcc.c-torture/execute/pr59358.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205607 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d65e4a..ef19166 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ -2013-12-02 Sterling Augustine   +2013-12-02 Jakub Jelinek + + PR tree-optimization/59358 + * tree-vrp.c (union_ranges): To check for the partially + overlapping ranges or adjacent ranges, also compare *vr0max + with vr1max. + +2013-12-02 Sterling Augustine   * dwarf2out.c (output_pubnames): Use comp_unit_die ()->die_offset when there isn't a skeleton die. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9c2b6e..c79226b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-12-02 Jakub Jelinek + PR tree-optimization/59358 + * gcc.c-torture/execute/pr59358.c: New test. + PR lto/59326 * gcc.target/i386/i386.exp (check_effective_target_avx2): Move to... * lib/target-supports.exp (check_effective_target_avx2): ... here. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59358.c b/gcc/testsuite/gcc.c-torture/execute/pr59358.c new file mode 100644 index 0000000..674026d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr59358.c @@ -0,0 +1,44 @@ +/* PR tree-optimization/59358 */ + +__attribute__((noinline, noclone)) int +foo (int *x, int y) +{ + int z = *x; + if (y > z && y <= 16) + while (y > z) + z *= 2; + return z; +} + +int +main () +{ + int i; + for (i = 1; i < 17; i++) + { + int j = foo (&i, 16); + int k; + if (i >= 8 && i <= 15) + k = 16 + (i - 8) * 2; + else if (i >= 4 && i <= 7) + k = 16 + (i - 4) * 4; + else if (i == 3) + k = 24; + else + k = 16; + if (j != k) + __builtin_abort (); + j = foo (&i, 7); + if (i >= 7) + k = i; + else if (i >= 4) + k = 8 + (i - 4) * 2; + else if (i == 3) + k = 12; + else + k = 8; + if (j != k) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index ce2de47..89f2ffd 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7758,7 +7758,8 @@ union_ranges (enum value_range_type *vr0type, } else if ((operand_less_p (vr1min, *vr0max) == 1 || operand_equal_p (vr1min, *vr0max, 0)) - && operand_less_p (*vr0min, vr1min) == 1) + && operand_less_p (*vr0min, vr1min) == 1 + && operand_less_p (*vr0max, vr1max) == 1) { /* [ ( ] ) or [ ]( ) */ if (*vr0type == VR_RANGE @@ -7792,7 +7793,8 @@ union_ranges (enum value_range_type *vr0type, } else if ((operand_less_p (*vr0min, vr1max) == 1 || operand_equal_p (*vr0min, vr1max, 0)) - && operand_less_p (vr1min, *vr0min) == 1) + && operand_less_p (vr1min, *vr0min) == 1 + && operand_less_p (vr1max, *vr0max) == 1) { /* ( [ ) ] or ( )[ ] */ if (*vr0type == VR_RANGE