summaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-16 13:41:13 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-16 13:41:13 +0000
commitdb812c94e0a17bff65551c01ad88eea8549b2847 (patch)
tree85a0b59e6028d56e1f2946e68d742d5259cd6aff /gcc/tree-inline.c
parente34df749c2b4bfa08fa90a76be51e16c0ef2120a (diff)
downloadgcc-db812c94e0a17bff65551c01ad88eea8549b2847.tar.gz
2008-01-16 Jakub Jelinek <jakub@redhat.com>
Richard Guenther <rguenther@suse.de> PR c/34668 * gimplify.c (fold_indirect_ref_rhs): Rename to ... (gimple_fold_indirect_ref_rhs): ... this. (gimple_fold_indirect_ref): New function with foldings that preserve lvalueness. (gimplify_modify_expr_rhs): Call gimple_fold_indirect_ref_rhs. * tree-flow.h (gimple_fold_indirect_ref): Declare. * tree-inline.c (copy_body_r): Use gimple_fold_indirect_ref to fold an INDIRECT_REF, fall back to the old use of fold_indirect_ref_1. * gcc.dg/pr34668-1.c: New test. * gcc.dg/pr34668-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131572 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f825c5d88fb..6ac367ef0ce 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -696,11 +696,18 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
tree type = TREE_TYPE (TREE_TYPE (*n));
new = unshare_expr (*n);
old = *tp;
- *tp = fold_indirect_ref_1 (type, new);
+ *tp = gimple_fold_indirect_ref (new);
if (! *tp)
{
if (TREE_CODE (new) == ADDR_EXPR)
- *tp = TREE_OPERAND (new, 0);
+ {
+ *tp = fold_indirect_ref_1 (type, new);
+ /* ??? We should either assert here or build
+ a VIEW_CONVERT_EXPR instead of blindly leaking
+ incompatible types to our IL. */
+ if (! *tp)
+ *tp = TREE_OPERAND (new, 0);
+ }
else
{
*tp = build1 (INDIRECT_REF, type, new);