[backport gcc-4.9/trunk r198340, fixes PR57045 regression from PR56982 fix ] gcc/ 2013-04-26 Jakub Jelinek PR go/57045 * tree-ssa-uninit.c (compute_uninit_opnds_pos): In functions with nonlocal goto receivers or returns twice calls, ignore unininitialized values from abnormal edges to nl goto receiver or returns twice call. gcc/testsuite/ 2013-04-26 Jakub Jelinek PR go/57045 * gcc.dg/setjmp-5.c: New test. --- gcc-4.8.0/gcc/testsuite/gcc.dg/setjmp-5.c.~1~ 1970-01-01 01:00:00.000000000 +0100 +++ gcc-4.8.0/gcc/testsuite/gcc.dg/setjmp-5.c 2013-04-27 13:24:17.988363519 +0200 @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall" } */ + +#include + +void bar (int); + +jmp_buf buf; +int v; + +void +foo (void) +{ + int i; + bar (0); + bar (1); + i = 5; + int j = setjmp (buf); + if (j == 0) + bar (2); + v = i; /* { dg-bogus "may be used uninitialized in this function" } */ +} --- gcc-4.8.0/gcc/tree-ssa-uninit.c.~1~ 2013-03-02 19:42:26.000000000 +0100 +++ gcc-4.8.0/gcc/tree-ssa-uninit.c 2013-04-27 13:24:17.988363519 +0200 @@ -151,7 +151,21 @@ compute_uninit_opnds_pos (gimple phi) if (TREE_CODE (op) == SSA_NAME && ssa_undefined_value_p (op) && !can_skip_redundant_opnd (op, phi)) - MASK_SET_BIT (uninit_opnds, i); + { + /* Ignore SSA_NAMEs on abnormal edges to setjmp + or nonlocal goto receiver. */ + if (cfun->has_nonlocal_label || cfun->calls_setjmp) + { + edge e = gimple_phi_arg_edge (phi, i); + if (e->flags & EDGE_ABNORMAL) + { + gimple last = last_stmt (e->src); + if (last && stmt_can_make_abnormal_goto (last)) + continue; + } + } + MASK_SET_BIT (uninit_opnds, i); + } } return uninit_opnds; }