From 06e8db10cd80d88fb3a6afedf2c35da6c1fa6d85 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 20 Nov 2019 09:26:52 +0100 Subject: re PR middle-end/91195 (incorrect may be used uninitialized smw (272711, 273474]) PR middle-end/91195 * tree-ssa-phiopt.c (cond_store_replacement): Move lhs unsharing earlier. Set TREE_NO_WARNING on the rhs1 of the artificially added load. * gcc.dg/pr91195.c: New test. From-SVN: r278479 --- gcc/tree-ssa-phiopt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-phiopt.c') diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index c2595c8..9058309 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -2269,6 +2269,10 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore"); new_stmt = gimple_build_assign (name, lhs); gimple_set_location (new_stmt, locus); + lhs = unshare_expr (lhs); + /* Set TREE_NO_WARNING on the rhs of the load to avoid uninit + warnings. */ + TREE_NO_WARNING (gimple_assign_rhs1 (new_stmt)) = 1; gsi_insert_on_edge (e1, new_stmt); /* 3) Create a PHI node at the join block, with one argument @@ -2279,7 +2283,6 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, add_phi_arg (newphi, rhs, e0, locus); add_phi_arg (newphi, name, e1, locus); - lhs = unshare_expr (lhs); new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi)); /* 4) Insert that PHI node. */ -- cgit v1.1