From: Jakub Jelinek Date: Wed, 12 Oct 2016 07:07:33 +0000 (+0200) Subject: re PR tree-optimization/77929 (ICE: verify_gimple failed (error: non-trivial conversi... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a8b97cb8af6e8632e1674ac82611b4d45c17b53;p=gcc.git re PR tree-optimization/77929 (ICE: verify_gimple failed (error: non-trivial conversion at assignment)) PR tree-optimization/77929 * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle (*ops)[ranges[i].idx]->op != ranges[i].exp case. * gcc.c-torture/compile/pr77929.c: New test. From-SVN: r241019 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3e77945859..f64bc62ed83 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-12 Jakub Jelinek + + PR tree-optimization/77929 + * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle + (*ops)[ranges[i].idx]->op != ranges[i].exp case. + 2016-10-12 Aaron Sawdey PR target/77934 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4423684948a..5605a3e972d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-10-12 Jakub Jelinek + PR tree-optimization/77929 + * gcc.c-torture/compile/pr77929.c: New test. + * c-c++-common/Wimplicit-fallthrough-25.c: New test. * c-c++-common/Wimplicit-fallthrough-26.c: New test. * c-c++-common/Wimplicit-fallthrough-27.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr77929.c b/gcc/testsuite/gcc.c-torture/compile/pr77929.c new file mode 100644 index 00000000000..bbcb04bd4f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr77929.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/77929 */ + +void bar (void); + +void +foo (int x, unsigned short int y) +{ + int a = 0; + int b = (y != 0) ? (x < y) : (a < 0); + + if (x >= 0 & b) + bar (); +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 76663654815..7b844ddd83d 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2994,12 +2994,26 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, } else { - g = gimple_build_assign (make_ssa_name (TREE_TYPE (ranges[i].exp)), - ccode, rhs1, rhs2); + operand_entry *oe = (*ops)[ranges[i].idx]; + tree ctype = oe->op ? TREE_TYPE (oe->op) : boolean_type_node; + if (!INTEGRAL_TYPE_P (ctype) + || (TREE_CODE (ctype) != BOOLEAN_TYPE + && TYPE_PRECISION (ctype) != 1)) + ctype = boolean_type_node; + g = gimple_build_assign (make_ssa_name (ctype), ccode, rhs1, rhs2); gimple_set_uid (g, uid); gsi_insert_before (&gsi, g, GSI_SAME_STMT); + if (oe->op && ctype != TREE_TYPE (oe->op)) + { + g = gimple_build_assign (make_ssa_name (TREE_TYPE (oe->op)), + NOP_EXPR, gimple_assign_lhs (g)); + gimple_set_uid (g, uid); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + } ranges[i].exp = gimple_assign_lhs (g); - (*ops)[ranges[i].idx]->op = ranges[i].exp; + oe->op = ranges[i].exp; + ranges[i].low = build_zero_cst (TREE_TYPE (ranges[i].exp)); + ranges[i].high = ranges[i].low; } ranges[i].strict_overflow_p = false; operand_entry *oe = (*ops)[ranges[*idx].idx];