[Bug tree-optimization/126637] wrong code at -O{s,2,3} with -fwhole-program on x86_64-linux-gnu

"rguenth at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 13:03:11 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126637

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection, wrong-code
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-04

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testcase w/o -fwhole-program, fails with -O2, works with -O2 -fno-tree-vrp:

static double *a;
static void b(int c) {
  int d =3D 1;
  double e =3D 1.0;
  a =3D &e;
  while (1) {
  if (!(e ? e : 4.0 < -c))
    break;
  e =3D d - 1;
  *a =3D -e;
  d =3D 2;
}
}
int main() { b(0); }=