[Bug c++/97627] [9/10/11 Regression] loop end condition missing - endless loop with -fPIC

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 29 12:21:47 GMT 2020


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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Doesn't reproduce on the trunk since
r11-3300-g83e037364e0d6dd74d595751e8bc8c461b4cb8fa
Adjusted testcase so that it doesn't loop forever when not miscompiled and
doesn't need -fPIC either:

struct S { unsigned short x, y; } m = { 1, 0 };

__attribute__((noipa)) void
bar ()
{
  throw 1;
}

void
foo ()
{
  while (1)
    {
      int a = m.x + 1;
      int b = m.y + 1;
      for (int h = 0; h < a; h++)
        for (int w = 0; w < b; w++)
          __builtin_printf ("w: %d, b: %d\n", w, b);
      bar ();
    }
}

int
main ()
{
  try
    {
      foo ();
    }
  catch (int)
    {
    }
  return 0;
}


More information about the Gcc-bugs mailing list