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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.4
           Keywords|                            |wrong-code
            Summary|Flag -O2 causes code to     |[11 Regression] Flag -O2
                   |misbehave                   |causes code to misbehave
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-05-13
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This went away with r12-3918-g5b8b1522e04adc20980f396571be1929a32d148a
on the trunk and started r11-3772-gc8fd2be174a15ff154a3102decb0e643f67cad02
typedef struct { unsigned int num; } info_t;
typedef struct { unsigned int flag, type; } block_t;
info_t info;
block_t blocks[] = { {2,0}, {3,0}, {1,0}, {1,0} };

static block_t *
f (info_t *i, block_t *b) {
  while (1) {
    unsigned int is_last = b->flag & 0x01;
    i->num++;
    if (b->flag & 0x02) {
      if (b->type != 0x1) b->type = b->type;
      b = f (i, b+1);
    }
    if (is_last)
      break;
    b++;
  }
  return b;
}

int
main () {
  f(&info, &blocks[0]);
  if (info.num != 4)
    __builtin_abort ();
}

Reply via email to