arc: Make use reg_renumber safe.
authorClaudiu Zissulescu <claziss@synopsys.com>
Tue, 29 Dec 2020 11:30:05 +0000 (13:30 +0200)
committerClaudiu Zissulescu <claziss@synopsys.com>
Tue, 29 Dec 2020 11:41:20 +0000 (13:41 +0200)
The REGNO_OK_FOR_BASE_P is using reg_renumber array. However, it is
not always defined. Use it only when it is defined.

gcc/
2020-12-29  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.h (REGNO_OK_FOR_BASE_P): Check if defined
reg_renumber.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
gcc/config/arc/arc.h

index fd6e21adfaa33a51d1acb70ead0d0cf0f136b7d6..c3886330f1b7d0cd382c2def066862ffbe603735 100644 (file)
@@ -588,7 +588,7 @@ extern enum reg_class arc_regno_reg_class[];
    || ((REGNO) == ARG_POINTER_REGNUM)                                  \
    || ((REGNO) == FRAME_POINTER_REGNUM)                                        \
    || ((REGNO) == PCL_REG)                                             \
-   || ((unsigned) reg_renumber[REGNO] < 29)                            \
+   || (reg_renumber && ((unsigned) reg_renumber[REGNO] < 29))          \
    || ((unsigned) (REGNO) == (unsigned) arc_tp_regno)                  \
    || (fixed_regs[REGNO] == 0 && IN_RANGE (REGNO, 32, 59))             \
    || (fixed_regs[REGNO] == 0 && (REGNO) == R30_REG))