From a4ee7cb9bfdf444a1bd5d6f3931b6bb3d286b805 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 3 May 2013 10:35:04 -0600 Subject: re PR tree-optimization/57411 (ICE: verify_ssa failed: definition in block 4 does not dominate use in block 11 with -fno-tree-dce -ftree-vectorize) PR tree-optimization/57411 * tree-vrp.c (simplify_cond_using_ranges): Verify the constant operand of the condition will bit into the new type when eliminating a cast feeding a condition. PR tree-optimization/57411 * gcc.c-torture/execute/pr57144.c: New test. From-SVN: r198582 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr57144.c | 19 +++++++++++++++++++ gcc/tree-vrp.c | 3 ++- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr57144.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bd0ea7..5d16636 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-05-03 Jeff Law + + PR tree-optimization/57411 + * tree-vrp.c (simplify_cond_using_ranges): Verify the constant + operand of the condition will bit into the new type when eliminating + a cast feeding a condition. + 2013-05-03 Jakub Jelinek PR rtl-optimization/57130 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25a131c..1322477 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-05-02 Jeff Law + + PR tree-optimization/57411 + * gcc.c-torture/execute/pr57144.c: New test. + 2013-05-03 Jakub Jelinek PR rtl-optimization/57130 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr57144.c b/gcc/testsuite/gcc.c-torture/execute/pr57144.c new file mode 100644 index 0000000..ffa2df4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr57144.c @@ -0,0 +1,19 @@ +extern void abort (void); +extern void exit (int); + +void __attribute__ ((noinline)) +foo(int a) +{ + int z = a > 0 ? a : -a; + long long x = z; + if (x > 0x100000000LL) + abort (); + else + exit (0); +} + +int +main() +{ + foo (1); +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 6ed353f..b5de683 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -8668,7 +8668,8 @@ simplify_cond_using_ranges (gimple stmt) if (range_int_cst_p (vr) && range_fits_type_p (vr, TYPE_PRECISION (TREE_TYPE (op0)), - TYPE_UNSIGNED (TREE_TYPE (op0)))) + TYPE_UNSIGNED (TREE_TYPE (op0))) + && int_fits_type_p (op1, TREE_TYPE (innerop))) { tree newconst = fold_convert (TREE_TYPE (innerop), op1); gimple_cond_set_lhs (stmt, innerop); -- cgit v1.1