aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2019-11-20 09:26:52 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-11-20 09:26:52 +0100
commit06e8db10cd80d88fb3a6afedf2c35da6c1fa6d85 (patch)
tree63bfe92cbc1e4a74c4813954690d30c5e9542564 /gcc/tree-ssa-phiopt.c
parentc04341ec45cf332e4f1a7057a6cdb461629275ab (diff)
downloadgcc-06e8db10cd80d88fb3a6afedf2c35da6c1fa6d85.zip
gcc-06e8db10cd80d88fb3a6afedf2c35da6c1fa6d85.tar.gz
gcc-06e8db10cd80d88fb3a6afedf2c35da6c1fa6d85.tar.bz2
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
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r--gcc/tree-ssa-phiopt.c5
1 files changed, 4 insertions, 1 deletions
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. */