The following "fixes" PR82129 (hides the issue). It folds writes from uninitialized data to CLOBBERs:
- *h5_26(D) = tv_24(D); + *h5_26(D) ={v} {CLOBBER}; Bootstrap & regtest running on x86_64-unknown-linux-gnu. Richard. 2017-09-12 Richard Biener <rguent...@suse.de> PR tree-optimization/82129 * gimple-fold.c (fold_gimple_assign): Fold stores from undefined values to clobbers. * gcc.dg/torture/pr82129.c: New testcase. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 252002) +++ gcc/gimple-fold.c (working copy) @@ -410,6 +410,20 @@ fold_gimple_assign (gimple_stmt_iterator else if (DECL_P (rhs)) return get_symbol_constant_value (rhs); + + else if (TREE_CODE (rhs) == SSA_NAME + && SSA_NAME_IS_DEFAULT_DEF (rhs) + && ! ssa_defined_default_def_p (rhs) + && gimple_store_p (stmt) + && ! gimple_has_volatile_ops (stmt)) + { + /* Replace a store from an undefined value with a clobber + which will not generate code, thus avoid doing this when + the store is volatile. */ + tree clobber = build_constructor (TREE_TYPE (rhs), NULL); + TREE_THIS_VOLATILE (clobber) = true; + return clobber; + } } break; Index: gcc/testsuite/gcc.dg/torture/pr82129.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr82129.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr82129.c (working copy) @@ -0,0 +1,51 @@ +/* { dg-do compile } */ + +int pj; + +void +g4 (unsigned long int *bc, unsigned long int *h5) +{ + if (pj != 0) + { + int ib = 0; + + while (bc != 0) + { +m6: + for (pj = 0; pj < 2; ++pj) + pj = 0; + + while (pj != 0) + { + for (;;) + { + } + + while (ib != 0) + { + unsigned long int tv = *bc; + unsigned long int n7; + + *bc = 1; + while (*bc != 0) + { + } + +ut: + if (pj == 0) + n7 = *h5 > 0; + else + { + *h5 = tv; + n7 = *h5; + } + ib += n7; + } + } + } + + goto ut; + } + + goto m6; +}