diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-06-20 23:41:20 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-06-20 23:41:20 +0200 |
commit | 50aa64d58fd4cea25df2a9d9ddfc38e74dcdd94c (patch) | |
tree | 73e0044763a990884447efafc1f4b1bfa26a1407 /gcc/tree-ssa-uninit.c | |
parent | 7a9df68ec6a8752f2e95e8ca1ca1fc53384c90c6 (diff) | |
download | gcc-50aa64d58fd4cea25df2a9d9ddfc38e74dcdd94c.zip gcc-50aa64d58fd4cea25df2a9d9ddfc38e74dcdd94c.tar.gz gcc-50aa64d58fd4cea25df2a9d9ddfc38e74dcdd94c.tar.bz2 |
re PR middle-end/71581 (ICE on valid code on x86_64-linux-gnu with -Wuninitialized (Segmentation fault))
PR middle-end/71581
* tree-ssa-uninit.c (warn_uninit): If EXPR and VAR are NULL,
see if T isn't anonymous SSA_NAME with COMPLEX_EXPR created
for conversion of scalar user var to complex type and use the
underlying SSA_NAME_VAR in that case. If EXPR is still NULL,
punt.
* gcc.dg/pr71581.c: New test.
From-SVN: r237621
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
-rw-r--r-- | gcc/tree-ssa-uninit.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index 941d575..d5f0344 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -131,6 +131,29 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var, if (!has_undefined_value_p (t)) return; + /* Anonymous SSA_NAMEs shouldn't be uninitialized, but ssa_undefined_value_p + can return true if the def stmt of anonymous SSA_NAME is COMPLEX_EXPR + created for conversion from scalar to complex. Use the underlying var of + the COMPLEX_EXPRs real part in that case. See PR71581. */ + if (expr == NULL_TREE + && var == NULL_TREE + && SSA_NAME_VAR (t) == NULL_TREE + && is_gimple_assign (SSA_NAME_DEF_STMT (t)) + && gimple_assign_rhs_code (SSA_NAME_DEF_STMT (t)) == COMPLEX_EXPR) + { + tree v = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (t)); + if (TREE_CODE (v) == SSA_NAME + && has_undefined_value_p (v) + && zerop (gimple_assign_rhs2 (SSA_NAME_DEF_STMT (t)))) + { + expr = SSA_NAME_VAR (v); + var = expr; + } + } + + if (expr == NULL_TREE) + return; + /* TREE_NO_WARNING either means we already warned, or the front end wishes to suppress the warning. */ if ((context |