diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fb54ffa..7c05e0f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14341,6 +14341,24 @@ split_address_to_core_and_offset (tree exp, &volatilep); core = build_fold_addr_expr_loc (loc, core); } + else if (TREE_CODE (exp) == POINTER_PLUS_EXPR) + { + core = TREE_OPERAND (exp, 0); + STRIP_NOPS (core); + *pbitpos = 0; + *poffset = TREE_OPERAND (exp, 1); + if (TREE_CODE (*poffset) == INTEGER_CST) + { + offset_int tem = wi::sext (wi::to_offset (*poffset), + TYPE_PRECISION (TREE_TYPE (*poffset))); + tem <<= LOG2_BITS_PER_UNIT; + if (wi::fits_shwi_p (tem)) + { + *pbitpos = tem.to_shwi (); + *poffset = NULL_TREE; + } + } + } else { core = exp; |