https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103808
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It starts during var-tracking and not ix86_reorg.
The problem is we have:
(debug_insn 110 103 104 4 (var_location:TI D#2 (reg:TI 6 bp [orig:111 x ]
[111])) -1
(nil))
and
(debug_insn 25 24 26 3 (var_location:TI x (concatn/v:TI [
(reg:DI 6 bp [orig:111 x ] [111])
(subreg:DI (debug_expr:TI D#2) 8)
])) "pr103808.c":8:9 -1
(nil))
I guess it is originally from a paradoxical subreg or what, but RA can't
because of debug insns decide differently and not allocate pseudo 111 into bp
register.
When var-tracking.c attempts to simplify the (subreg:DI (reg:TI 6 bp [orig:111
x ] [111]) 8)
simplify-rtx.c calls gen_rtx_REG_offset which calls gen_rtx_REG and that
returns stack_pointer_rtx and later the function changes REG_ATTRS on that
shared rtx.
That is just wrong.
So, IMHO either gen_rtx_REG_offset should be changed to call gen_raw_REG
instead of gen_rtx_REG, or alternatively it shouldn't call update_reg_offset if
gen_rtx_REG returned one of the shared rtxes
({{frame,hard_frame,arg,return_address,stack}_pointer,pic_offset_table}_rtx).