From 4d01c30fb52de3af8ebfda893e84a61563f6b78a Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Fri, 28 May 1993 19:01:21 +0000 Subject: [PATCH] (GO_IF_LEGITIMATE_INDEX): Check explicitly for upper and lower bounds of valid INDEX. From-SVN: r4584 --- gcc/config/arm/arm.h | 53 +++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 9172925..2f26583 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -678,31 +678,34 @@ enum reg_class /* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can only be small constants. */ -#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \ -do \ -{ \ - int range; \ - \ - if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \ - range = 1024; \ - else \ - { \ - if (INDEX_REGISTER_RTX_P (INDEX)) \ - goto LABEL; \ - if (GET_MODE_SIZE (MODE) <= 4 && GET_CODE (INDEX) == MULT) \ - { \ - rtx xiop0 = XEXP (INDEX, 0); \ - rtx xiop1 = XEXP (INDEX, 1); \ - if (INDEX_REGISTER_RTX_P (xiop0) && power_of_two_operand (xiop1, SImode)) \ - goto LABEL; \ - if (INDEX_REGISTER_RTX_P (xiop1) && power_of_two_operand (xiop0, SImode)) \ - goto LABEL; \ - } \ - range = 4096; \ - } \ - \ - if (GET_CODE (INDEX) == CONST_INT && abs (INTVAL (INDEX)) < range) \ - goto LABEL; \ +#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \ +do \ +{ \ + int range; \ + \ + if (GET_MODE_CLASS (MODE) == MODE_FLOAT) \ + range = 1024; \ + else \ + { \ + if (INDEX_REGISTER_RTX_P (INDEX)) \ + goto LABEL; \ + if (GET_MODE_SIZE (MODE) <= 4 && GET_CODE (INDEX) == MULT) \ + { \ + rtx xiop0 = XEXP (INDEX, 0); \ + rtx xiop1 = XEXP (INDEX, 1); \ + if (INDEX_REGISTER_RTX_P (xiop0) \ + && power_of_two_operand (xiop1, SImode)) \ + goto LABEL; \ + if (INDEX_REGISTER_RTX_P (xiop1) \ + && power_of_two_operand (xiop0, SImode)) \ + goto LABEL; \ + } \ + range = 4096; \ + } \ + \ + if (GET_CODE (INDEX) == CONST_INT && INTVAL (INDEX) < range \ + && INTVAL (INDEX) > -range) \ + goto LABEL; \ } while (0) /* Jump to LABEL if X is a valid address RTX. This must also take -- 2.7.4