https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115881

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Hmm, yeah.  This is due to an inconsistency between simplify_subreg_regno
(which rightly refuses to generate (reg:SI sp)) and validate_subreg,
which instead uses subreg_offset_representable_p + some preparatory tests.
Those preparatory tests are similar, but not quite identical to, the first
tests in simplify_subre_regno.  And they don't include the stack and frame
pointer tests.

In principle, it feels like the validate_subreg test should just be:

  /* For hard registers, check that the subreg can be folded to a REG.  */
  if (reg && REG_P (reg) && HARD_REGISTER_P (reg))
    return simplify_subreg_regno (REGNO (reg), imode, offset, omode) >= 0;

but I've no idea how much that will break.  Will try it and see.

Reply via email to