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

--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
> since the bad instruction is a compare, it does seem like it might be solved 
> via https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112572#c18 too. compare 
> elimination is going wrong.

Yeah, that fixes it. Looking at a bad case bug.cpp.317r.cmpelim contains the
following start of the function:

    1: NOTE_INSN_DELETED
  922: NOTE_INSN_BASIC_BLOCK 2
  889: [bp:DI-0x130]=di:DI
  888: r14:DI=si:DI
      REG_UNUSED r14:DI
    4: r12:DI=zero_extend(dx:SI)
      REG_DEAD dx:SI
    6: bx:DI=r8:DI
      REG_DEAD r8:DI
    7: NOTE_INSN_FUNCTION_BEG
  818: si:DI=r14:DI
   16: flags:CCZ=cmp([si:DI+0x10],0x5b)

The 'REG_UNUSED r14:DI' looks wrong. That possibly caused use of dangling
register. I wonder if `gcc` could fail in -fchecking= mode if it's a reasonable
check.

Reply via email to