aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-05-20 16:01:41 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-05-20 16:01:41 +0000
commitd98e8686339d5b50821077a730f7a3b2006251f2 (patch)
treefdab576bb1a6b5daa8c14a1230d6407d28218072 /gcc/fold-const.c
parent37c5043589c8a28e3e2dc64bdc78fa22be5f96e1 (diff)
downloadgcc-d98e8686339d5b50821077a730f7a3b2006251f2.zip
gcc-d98e8686339d5b50821077a730f7a3b2006251f2.tar.gz
gcc-d98e8686339d5b50821077a730f7a3b2006251f2.tar.bz2
fold-const.c (build_fold_addr_expr_with_type): Take the address of the operand of VIEW_CONVERT_EXPR.
* fold-const.c (build_fold_addr_expr_with_type): Take the address of the operand of VIEW_CONVERT_EXPR. From-SVN: r147739
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4b8fe38..0ac9e29 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7999,6 +7999,13 @@ build_fold_addr_expr_with_type (tree t, tree ptrtype)
if (TREE_TYPE (t) != ptrtype)
t = build1 (NOP_EXPR, ptrtype, t);
}
+ else if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
+ {
+ t = build_fold_addr_expr (TREE_OPERAND (t, 0));
+
+ if (TREE_TYPE (t) != ptrtype)
+ t = fold_convert (ptrtype, t);
+ }
else
t = build1 (ADDR_EXPR, ptrtype, t);