diff options
author | Martin Jambor <mjambor@suse.cz> | 2010-01-14 14:29:44 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2010-01-14 14:29:44 +0100 |
commit | 92e97cdd7d8f1f1a078d6afeb10f8de537ba3e50 (patch) | |
tree | f2febcbe59eba4389ef16ad0d9e2c5294a498685 /gcc/tree-sra.c | |
parent | a0463099e76db6b342de8b0149a622de788b8a66 (diff) | |
download | gcc-92e97cdd7d8f1f1a078d6afeb10f8de537ba3e50.zip gcc-92e97cdd7d8f1f1a078d6afeb10f8de537ba3e50.tar.gz gcc-92e97cdd7d8f1f1a078d6afeb10f8de537ba3e50.tar.bz2 |
re PR tree-optimization/42714 (ICE in create_tmp_var, at gimplify.c:504)
2010-01-14 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42714
* tree-sra.c (sra_ipa_modify_assign): Handle incompatible-type
constructors specially.
* gcc/testsuite/g++.dg/torture/pr42714.C: New test.
From-SVN: r155905
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index e9766d7..4797667 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -3712,8 +3712,20 @@ sra_ipa_modify_assign (gimple *stmt_ptr, gimple_stmt_iterator *gsi, void *data) tree new_rhs = NULL_TREE; if (!useless_type_conversion_p (TREE_TYPE (*lhs_p), TREE_TYPE (*rhs_p))) - new_rhs = fold_build1_loc (gimple_location (stmt), VIEW_CONVERT_EXPR, - TREE_TYPE (*lhs_p), *rhs_p); + { + if (TREE_CODE (*rhs_p) == CONSTRUCTOR) + { + /* V_C_Es of constructors can cause trouble (PR 42714). */ + if (is_gimple_reg_type (TREE_TYPE (*lhs_p))) + *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node); + else + *rhs_p = build_constructor (TREE_TYPE (*lhs_p), 0); + } + else + new_rhs = fold_build1_loc (gimple_location (stmt), + VIEW_CONVERT_EXPR, TREE_TYPE (*lhs_p), + *rhs_p); + } else if (REFERENCE_CLASS_P (*rhs_p) && is_gimple_reg_type (TREE_TYPE (*lhs_p)) && !is_gimple_reg (*lhs_p)) |