From: Richard Biener Date: Mon, 17 Oct 2016 13:46:34 +0000 (+0000) Subject: re PR tree-optimization/77988 (ICE on valid code at -Os and above on x86_64-linux... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44b00dbca0929cbed83b1f326b5f96e3d0bc3f2d;p=gcc.git re PR tree-optimization/77988 (ICE on valid code at -Os and above on x86_64-linux-gnu: verify_gimple failed) 2016-10-17 Richard Biener PR tree-optimization/77988 * tree-vrp.c (remove_range_assertions): Use replace_uses_by. * gcc.dg/torture/pr77988.c: New testcase. From-SVN: r241242 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b5e65289366..86df616ab8d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-17 Richard Biener + + PR tree-optimization/77988 + * tree-vrp.c (remove_range_assertions): Use replace_uses_by. + 2016-10-17 Marek Polacek * Makefile.in (C_COMMON_OBJS): Add c-family/c-attribs.o. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b99ce7b6326..e73fcf59fbf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-17 Richard Biener + + PR tree-optimization/77988 + * gcc.dg/torture/pr77988.c: New testcase. + 2016-10-17 Prathamesh Kulkarni * gcc.dg/pr71636-1.c: New test-case. diff --git a/gcc/testsuite/gcc.dg/torture/pr77988.c b/gcc/testsuite/gcc.dg/torture/pr77988.c new file mode 100644 index 00000000000..9db6b9c6b23 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77988.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +static int a = 2; +int b[1], c, d; + +int main () +{ + int e = a, *f = &b[0]; + if (d) + for (e = 0; e < 1; e++) + ; + if (e) + { +L1: + if (b < f) + __builtin_abort (); + if (*f) + c++; + return 0; + } + f = 0; + goto L1; + return 0; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 00a08fdff6d..1aebc722f7a 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6882,7 +6882,6 @@ remove_range_assertions (void) for (si = gsi_after_labels (bb), is_unreachable = -1; !gsi_end_p (si);) { gimple *stmt = gsi_stmt (si); - gimple *use_stmt; if (is_gimple_assign (stmt) && gimple_assign_rhs_code (stmt) == ASSERT_EXPR) @@ -6890,8 +6889,6 @@ remove_range_assertions (void) tree lhs = gimple_assign_lhs (stmt); tree rhs = gimple_assign_rhs1 (stmt); tree var; - use_operand_p use_p; - imm_use_iterator iter; var = ASSERT_EXPR_VAR (rhs); @@ -6927,12 +6924,7 @@ remove_range_assertions (void) } /* Propagate the RHS into every use of the LHS. */ - FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs) - { - FOR_EACH_IMM_USE_ON_STMT (use_p, iter) - SET_USE (use_p, var); - update_stmt (use_stmt); - } + replace_uses_by (lhs, var); /* And finally, remove the copy, it is not needed. */ gsi_remove (&si, true);