Hi! As the testcase shows, simplify_cond_using_ranges has one place where it can extend range of SSA_NAME_OCCURS_IN_ABNORMAL_PHI ssa names and cause SSA corruption by that.
Fixed by only optimizing that if it is not (ab). The optimized statements are GIMPLE_CONDs with SSA_NAME cmp INTEGER_CST, so the (ab) SSA_NAME certainly is not used on the cond stmt. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-01-11 Jakub Jelinek <ja...@redhat.com> 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.jj 2016-01-09 08:36:15.000000000 +0100 +++ gcc/tree-vrp.c 2016-01-11 13:43:07.477623410 +0100 @@ -9478,7 +9478,8 @@ simplify_cond_using_ranges (gcond *stmt) if (TREE_CODE (innerop) == SSA_NAME && !POINTER_TYPE_P (TREE_TYPE (innerop)) - && desired_pro_or_demotion_p (TREE_TYPE (innerop), TREE_TYPE (op0))) + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop) + && desired_pro_or_demotion_p (TREE_TYPE (innerop), TREE_TYPE (op0))) { value_range *vr = get_value_range (innerop); @@ -9509,8 +9510,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.jj 2016-01-11 13:47:44.162767118 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr69214.c 2016-01-11 13:47:30.000000000 +0100 @@ -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 (); +} Jakub