This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[SPARC] Fix off-by-one error in reg+off addressing mode
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 04 Feb 2015 23:36:02 +0100
- Subject: [SPARC] Fix off-by-one error in reg+off addressing mode
- Authentication-results: sourceware.org; auth=none
It's probably there for a long time: the TARGET_LEGITIMATE_ADDRESS_P hook
rejects the last allowed positive offset in the reg+off addressing mode.
Tested on SPARC/Solaris, applied on the mainline.
2015-02-04 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sparc.c (RTX_OK_FOR_OFFSET_P): Fix off-by-one error.
(RTX_OK_FOR_OLO10_P): Likewise.
--
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c (revision 220369)
+++ config/sparc/sparc.c (working copy)
@@ -3925,12 +3925,12 @@ legitimate_pic_operand_p (rtx x)
#define RTX_OK_FOR_OFFSET_P(X, MODE) \
(CONST_INT_P (X) \
&& INTVAL (X) >= -0x1000 \
- && INTVAL (X) < (0x1000 - GET_MODE_SIZE (MODE)))
+ && INTVAL (X) <= (0x1000 - GET_MODE_SIZE (MODE)))
#define RTX_OK_FOR_OLO10_P(X, MODE) \
(CONST_INT_P (X) \
&& INTVAL (X) >= -0x1000 \
- && INTVAL (X) < (0xc00 - GET_MODE_SIZE (MODE)))
+ && INTVAL (X) <= (0xc00 - GET_MODE_SIZE (MODE)))
/* Handle the TARGET_LEGITIMATE_ADDRESS_P target hook.