summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-23 09:16:46 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-23 09:16:46 +0000
commit5c98ac9060e2aa7bcdc28884f10627b2a86cc092 (patch)
treedd933f1854a322fbaad326608964432f168dfff2 /gcc/gimplify.c
parent4eda83c5bbc632985864f1e110098b141c88be05 (diff)
downloadgcc-5c98ac9060e2aa7bcdc28884f10627b2a86cc092.tar.gz
PR middle-end/17793
* gimplify.c (gimplify_addr_expr) <VIEW_CONVERT_EXPR>: Look through the operand if it is a useless type conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89488 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 51a123f325f..3d8ecdfd98e 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3093,6 +3093,13 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
??? The interactions of VIEW_CONVERT_EXPR and aliasing is not at
all clear. The impact of this transformation is even less clear. */
+
+ /* If the operand is a useless conversion, look through it. Doing so
+ guarantees that the ADDR_EXPR and its operand will remain of the
+ same type. */
+ if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0)))
+ op0 = TREE_OPERAND (op0, 0);
+
*expr_p = fold_convert (TREE_TYPE (expr),
build_fold_addr_expr (TREE_OPERAND (op0, 0)));
ret = GS_OK;