diff mbox

[SPARC] Fix off-by-one error in reg+off addressing mode

Message ID 2710668.e9lmyiSqVL@polaris
State New
Headers show

Commit Message

Eric Botcazou Feb. 4, 2015, 10:36 p.m. UTC
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.
diff mbox

Patch

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.