diff options
author | Richard Biener <rguenther@suse.de> | 2019-02-18 12:56:15 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-02-18 12:56:15 +0000 |
commit | c41491973b05547236fe0bb82ae2419607c6f3ef (patch) | |
tree | 3628650112627d97bfe1a979978983c6ac2c71fe /gcc/tree-ssa-loop-ch.c | |
parent | 022049403b80be13a495d8411aac2d0aacdf1a27 (diff) | |
download | gcc-c41491973b05547236fe0bb82ae2419607c6f3ef.zip gcc-c41491973b05547236fe0bb82ae2419607c6f3ef.tar.gz gcc-c41491973b05547236fe0bb82ae2419607c6f3ef.tar.bz2 |
re PR tree-optimization/89296 (tree copy-header masking uninitialized warning)
2019-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/89296
* tree-ssa-loop-ch.c (ch_base::copy_headers): Restrict setting
of no-warning flag to cases that might emit the bogus warning.
* gcc.dg/uninit-pr89296.c: New testcase.
From-SVN: r268986
Diffstat (limited to 'gcc/tree-ssa-loop-ch.c')
-rw-r--r-- | gcc/tree-ssa-loop-ch.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 1b8cb82..f65e2b5 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -452,11 +452,23 @@ ch_base::copy_headers (function *fun) { gimple *stmt = gsi_stmt (bsi); if (gimple_code (stmt) == GIMPLE_COND) - gimple_set_no_warning (stmt, true); + { + tree lhs = gimple_cond_lhs (stmt); + if (gimple_cond_code (stmt) != EQ_EXPR + && gimple_cond_code (stmt) != NE_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (lhs))) + gimple_set_no_warning (stmt, true); + } else if (is_gimple_assign (stmt)) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); - if (TREE_CODE_CLASS (rhs_code) == tcc_comparison) + tree rhs1 = gimple_assign_rhs1 (stmt); + if (TREE_CODE_CLASS (rhs_code) == tcc_comparison + && rhs_code != EQ_EXPR + && rhs_code != NE_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (rhs1))) gimple_set_no_warning (stmt, true); } } |