diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-01-15 17:33:24 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-01-15 17:33:24 +0100 |
commit | a7818b54bb17249c16494bce0d85dca2af97424a (patch) | |
tree | 233c3be517e334266d67afb8bd40f84a91531a62 /gcc/tree-sra.c | |
parent | b0fe107eedb0f6d1f86639372e614587d8df3a5d (diff) | |
download | gcc-a7818b54bb17249c16494bce0d85dca2af97424a.zip gcc-a7818b54bb17249c16494bce0d85dca2af97424a.tar.gz gcc-a7818b54bb17249c16494bce0d85dca2af97424a.tar.bz2 |
re PR tree-optimization/55920 (ICE in expand_debug_locations, at cfgexpand.c:3753)
PR tree-optimization/55920
* tree-sra.c (sra_modify_assign): If for lacc->grp_to_be_debug_replaced
there is non-useless type conversion needed from debug rhs to lhs,
use build_debug_ref_for_model and/or VIEW_CONVERT_EXPR.
* gcc.c-torture/compile/pr55920.c: New test.
From-SVN: r195209
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 367e32b..e5fbcf2 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -3108,8 +3108,20 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) if (lacc && lacc->grp_to_be_debug_replaced) { - gimple ds = gimple_build_debug_bind (get_access_replacement (lacc), - unshare_expr (rhs), *stmt); + tree dlhs = get_access_replacement (lacc); + tree drhs = unshare_expr (rhs); + if (!useless_type_conversion_p (TREE_TYPE (dlhs), TREE_TYPE (drhs))) + { + if (AGGREGATE_TYPE_P (TREE_TYPE (drhs)) + && !contains_vce_or_bfcref_p (drhs)) + drhs = build_debug_ref_for_model (loc, drhs, 0, lacc); + if (drhs + && !useless_type_conversion_p (TREE_TYPE (dlhs), + TREE_TYPE (drhs))) + drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, + TREE_TYPE (dlhs), drhs); + } + gimple ds = gimple_build_debug_bind (dlhs, drhs, *stmt); gsi_insert_before (gsi, ds, GSI_SAME_STMT); } |