diff options
author | DJ Delorie <dj@redhat.com> | 2010-04-19 19:25:31 -0400 |
---|---|---|
committer | DJ Delorie <dj@gcc.gnu.org> | 2010-04-19 19:25:31 -0400 |
commit | 576319a79ad554e2537b0d97a355f7896c8c3a35 (patch) | |
tree | 92c1907c30a7a197bc8429b4cd75fe7b9de2fba2 /gcc | |
parent | 578ad14116c61ef20c9d295da570537f6e9c5d2a (diff) | |
download | gcc-576319a79ad554e2537b0d97a355f7896c8c3a35.zip gcc-576319a79ad554e2537b0d97a355f7896c8c3a35.tar.gz gcc-576319a79ad554e2537b0d97a355f7896c8c3a35.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 682983e..5fc2dfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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> * config/avr/avr-devices.c (avr_mcu_types): Add support for new diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 48173d9..084772b 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2616,6 +2616,22 @@ expand_debug_expr (tree exp) return gen_rtx_FIX (mode, op0); 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: return gen_rtx_PLUS (mode, op0, op1); |