https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64722
Ilya Enkovich <enkovich.gnu at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |enkovich.gnu at gmail dot com --- Comment #4 from Ilya Enkovich <enkovich.gnu at gmail dot com> --- (In reply to Jakub Jelinek from comment #3) > But then wonder if/how target_reinit works for i?86 32-bit. > Perhaps pic_offset_table_rtx should be cleared in init_emit_regs before > computing it? > pic_offset_table_rtx = NULL_RTX; > if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) > pic_offset_table_rtx = gen_raw_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); Clearing pic_offset_table_rtx here would mean PIC_OFFSET_TABLE_REGNUM tranfroms into EBX and pic_offset_table_rtx is initialized with EBX which is not what we want. Probably we just shouldn't try to initialize pic_offset_table_rtx with a hard reg in case target assumes pseudo pic reg? diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index df85366..51ef3a5 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -5872,7 +5872,8 @@ init_emit_regs (void) = gen_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM); #endif - if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) + if (!targetm.use_pseudo_pic_reg () + && (unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) pic_offset_table_rtx = gen_raw_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); else pic_offset_table_rtx = NULL_RTX;