summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1ccea7e69b3..d8c511a615e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10446,6 +10446,10 @@ fold_relational_const (enum tree_code code, tree type, tree op0, tree op1)
tree
build_fold_addr_expr_with_type (tree t, tree ptrtype)
{
+ /* The size of the object is not relevant when talking about its address. */
+ if (TREE_CODE (t) == WITH_SIZE_EXPR)
+ t = TREE_OPERAND (t, 0);
+
if (TREE_CODE (t) == INDIRECT_REF)
{
t = TREE_OPERAND (t, 0);