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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-18
           Priority|P3                          |P4
   Target Milestone|---                         |17.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
      this_iter = duplicate_insn_chain (head_insn, tail_insn, NULL, &id);

but tail_insn (65) is before head_insn (20):

(note 7 1 81 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
...
(insn 65 13 15 2 (cond_exec (ne (reg:SI 1 A1)
            (const_int 0 [0]))
        (set (reg:QI 3 A3 [orig:76 a_lsm_flag.12 ] [76])
            (const_int 1 [0x1])))
"/space/rguenther/src/gcc-clean/gcc/testsuite/gcc.c-torture/execute/pr64682.c":16:17
discrim 2 349 {*p movqi_insn}
     (expr_list:REG_DEAD (reg:SI 1 A1)
        (expr_list:REG_EQUAL (const_int 1 [0x1])
            (nil))))

(code_label 15 65 16 3 8 (nil) [2 uses])
(note 16 15 17 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(note 17 16 20 3 NOTE_INSN_DELETED)
(jump_insn:TI 20 17 21 3 (parallel [
            (set (pc)
                (if_then_else (ne (reg:SI 0 A0 [orig:75 ivtmp_15 ] [75])
                        (const_int 1 [0x1]))
                    (label_ref:SI 15)
                    (pc)))
            (set (reg:SI 0 A0 [orig:75 ivtmp_15 ] [75])
                (plus:SI (reg:SI 0 A0 [orig:75 ivtmp_15 ] [75])
                    (const_int -1 [0xffffffffffffffff])))
            (clobber (scratch:SI))
        ])
"/space/rguenther/src/gcc-clean/gcc/testsuite/gcc.c-torture/execute/pr64682.c":16:17
discrim 2 80 {loop_end}
     (int_list:REG_BR_PROB 1054616657 (nil))
 -> 15)

bb is loop->head (BB3),

  tail_insn = prev_real_insn (BB_END (bb));

ends up before the loop.  "oops"

Reply via email to