Message ID | 1413495200.31394.132.camel@yam-132-YW-E178-FTW |
---|---|
State | New |
Headers | show |
On 10/16/14 15:33, Oleg Endo wrote: > 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. You're not supposed to be using true_regnum prior to register allocation. You're probably better off with a new predicate to handle this case. jeff
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); }