Hi,
While working on some SH builtins I ran into the issue that the function
true_regnum in jump.c tries to access the reg_renumber array without
checking for nullptr. The particular use case here is using true_regnum
in a predicate that is invoked during builtin function expansion in the
TARGET_EXPAND_BUILTIN function. It seems that at that time reg_renumber
hasn't been initialized yet. Adding the nullptr check fixes the issue.
OK for trunk?
Cheers,
Oleg
gcc/ChangeLog:
* jump.c (true_regnum): Check that reg_renumber is not null
before accessing it.
Index: gcc/jump.c
===================================================================
--- gcc/jump.c (revision 216350)
+++ gcc/jump.c (working copy)
@@ -1908,7 +1908,8 @@
if (REG_P (x))
{
if (REGNO (x) >= FIRST_PSEUDO_REGISTER
- && (lra_in_progress || reg_renumber[REGNO (x)] >= 0))
+ && (lra_in_progress ||
+ (reg_renumber != NULL && reg_renumber[REGNO (x)] >= 0)))
return reg_renumber[REGNO (x)];
return REGNO (x);
}