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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
                 CC|                            |vmakarov at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This seems to go wrong during LRA.
In *.ira we have just:
(debug_insn 352 199 201 19 (var_location:SI D#2 (reg:SI 227)) -1
     (nil))
but then LRA turns that into:
(debug_insn 352 199 201 19 (var_location:SI D#2 (plus:SI (plus:SI (minus:SI
(subreg:SI (reg:HI 130 [ _15 ]) 0)
                (subreg:SI (reg:DI 325 [orig:131 _16 ] [131]) 4))
            (subreg:SI (reg:HI 130 [ _15 ]) 0))
        (zero_extend:SI (subreg:QI (mem/c:SI (reg:SI 304) [0  S4 A32]) 3)))) -1
     (nil))
and later lra_substitute_pseudo turns that into:
(debug_insn 352 199 201 19 (var_location:SI D#2 (plus:SI (plus:SI (minus:SI
(subreg:SI (subreg:HI (reg:SI 270 [ a+4 ]) 2) 0)
                (subreg:SI (reg:DI 325 [orig:131 _16 ] [131]) 4))
            (subreg:SI (subreg:HI (reg:SI 270 [ a+4 ]) 2) 0))
        (zero_extend:SI (subreg:QI (mem/c:SI (reg:SI 304) [0  S4 A32]) 3)))) -1
     (nil))
and later another lra_substitute_pseudo turns that into:
(debug_insn 352 199 201 19 (var_location:SI D#2 (plus:SI (plus:SI (minus:SI
(subreg:SI (const_int 1 [0x1]) 0)
                (subreg:SI (reg:DI 325 [orig:131 _16 ] [131]) 4))
            (subreg:SI (const_int 1 [0x1]) 0))
        (zero_extend:SI (subreg:QI (mem/c:SI (reg:SI 304) [0  S4 A32]) 3)))) -1
     (nil))
I think we can deal in debug_insns with subreg inside of subreg, but we
certainly can't deal with a subreg with VOIDmode operand (ditto for
ZERO_EXTEND/SIGN_EXTEND etc.).

E.g. combine.cc (subst) has:
              if (GET_CODE (x) == SUBREG && CONST_SCALAR_INT_P (new_rtx))
                {
                  machine_mode mode = GET_MODE (x);

                  x = simplify_subreg (GET_MODE (x), new_rtx,
                                       GET_MODE (SUBREG_REG (x)),
                                       SUBREG_BYTE (x));
                  if (! x)
                    x = gen_rtx_CLOBBER (mode, const0_rtx);
                }
              else if (CONST_SCALAR_INT_P (new_rtx)
                       && (GET_CODE (x) == ZERO_EXTEND
                           || GET_CODE (x) == SIGN_EXTEND
                           || GET_CODE (x) == FLOAT
                           || GET_CODE (x) == UNSIGNED_FLOAT))
                {
                  x = simplify_unary_operation (GET_CODE (x), GET_MODE (x),
                                                new_rtx,
                                                GET_MODE (XEXP (x, 0)));
                  if (!x)
                    return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
                }
              /* CONST_INTs shouldn't be substituted into PRE_DEC, PRE_MODIFY
                 etc. arguments, otherwise we can ICE before trying to recog
                 it.  See PR104446.  */
              else if (CONST_SCALAR_INT_P (new_rtx)
                       && GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC)
                return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
              else
                SUBST (XEXP (x, i), new_rtx);
for this (note, RTX_AUTOINC shouldn't appear in debug insns, but the rest can).

Reply via email to