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

--- Comment #12 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Here's a similar, simpler testcase:

int f1 (void);
void f2 (int);
long f3 (long);

void tst (void)
{
  int badDataSize[3] = { 1, 1, 1 };

  for (int i = 0; i < 3; i++)
    {
      int emax;
      if (i == 2)
        emax = f1 ();
      int status = f3 (badDataSize[i]);
      if (f1 ())
        f1 ();
      if (status)
        f1 ();
      if (i == 2)
        f2 (emax);
    }
}

gcc-12 (Debian 12.2.0-14) 12.2.0 warns at -O1, but not at -O2.
gcc-13 (Debian 13.1.0-5) 13.1.0 is worse, as it warns at both -O1 and -O2.

Reply via email to