From d98e8686339d5b50821077a730f7a3b2006251f2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 20 May 2009 16:01:41 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/fold-const.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ac176d..dd17f89 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-05-20 Eric Botcazou + + * fold-const.c (build_fold_addr_expr_with_type): Take the address of + the operand of VIEW_CONVERT_EXPR. + 2009-05-20 H.J. Lu * config/i386/driver-i386.c (host_detect_local_cpu): Check 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); -- 2.7.4