Commit 576319a7 by DJ Delorie Committed by DJ Delorie

cfgexpand.c (expand_debug_expr): Check for mismatched modes in POINTER_PLUS_EXPR and fix them.

* cfgexpand.c (expand_debug_expr): Check for mismatched modes in
POINTER_PLUS_EXPR and fix them.

From-SVN: r158532
parent 578ad141
2010-04-19 DJ Delorie <dj@redhat.com>
* cfgexpand.c (expand_debug_expr): Check for mismatched modes in
POINTER_PLUS_EXPR and fix them.
2010-04-19 Eric B. Weddington <eric.weddington@atmel.com> 2010-04-19 Eric B. Weddington <eric.weddington@atmel.com>
* config/avr/avr-devices.c (avr_mcu_types): Add support for new * config/avr/avr-devices.c (avr_mcu_types): Add support for new
......
...@@ -2616,6 +2616,22 @@ expand_debug_expr (tree exp) ...@@ -2616,6 +2616,22 @@ expand_debug_expr (tree exp)
return gen_rtx_FIX (mode, op0); return gen_rtx_FIX (mode, op0);
case POINTER_PLUS_EXPR: case POINTER_PLUS_EXPR:
/* For the rare target where pointers are not the same size as
size_t, we need to check for mis-matched modes and correct
the addend. */
if (op0 && op1
&& GET_MODE (op0) != VOIDmode && GET_MODE (op1) != VOIDmode
&& GET_MODE (op0) != GET_MODE (op1))
{
if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1)))
op1 = gen_rtx_TRUNCATE (GET_MODE (op0), op1);
else
/* We always sign-extend, regardless of the signedness of
the operand, because the operand is always unsigned
here even if the original C expression is signed. */
op1 = gen_rtx_SIGN_EXTEND (GET_MODE (op0), op1);
}
/* Fall through. */
case PLUS_EXPR: case PLUS_EXPR:
return gen_rtx_PLUS (mode, op0, op1); return gen_rtx_PLUS (mode, op0, op1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment