2016-02-11 Jakub Jelinek Backported from mainline 2016-01-11 Jakub Jelinek PR tree-optimization/69214 * tree-vrp.c (simplify_cond_using_ranges): Don't propagate innerop into a comparison if SSA_NAME_OCCURS_IN_ABNORMAL_PHI. Formatting fix. * gcc.c-torture/compile/pr69214.c: New test. --- gcc/tree-vrp.c (revision 232234) +++ gcc/tree-vrp.c (revision 232235) @@ -9534,7 +9534,8 @@ simplify_cond_using_ranges (gcond *stmt) innerop = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (innerop) == SSA_NAME - && !POINTER_TYPE_P (TREE_TYPE (innerop))) + && !POINTER_TYPE_P (TREE_TYPE (innerop)) + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop)) { value_range_t *vr = get_value_range (innerop); @@ -9565,8 +9566,8 @@ simplify_cond_using_ranges (gcond *stmt) else location = gimple_location (stmt); warning_at (location, OPT_Wstrict_overflow, - "assuming signed overflow does not occur when " - "simplifying conditional"); + "assuming signed overflow does not occur when " + "simplifying conditional"); } tree newconst = fold_convert (TREE_TYPE (innerop), op1); --- gcc/testsuite/gcc.c-torture/compile/pr69214.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr69214.c (revision 232235) @@ -0,0 +1,17 @@ +/* PR tree-optimization/69214 */ + +extern void bar (void); +extern int __setjmp (char *); + +void +foo (char *p) +{ + int d = 0; + bar (); + if (__setjmp (p)) + return; + long a = d; + d = 8; + if (!a) + bar (); +}