https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123089
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Moving l_1250 to the function level scope of func_34 rather than the inner one
fixes the infinite loop. So yes it is undefined behavior.
It was part of this scope before:
{
int32_t *l_1251[7][5][1] =
{{{&g_165},{&l_873},{(void*)0},{(void*)0},{&l_873}},{{(void*)0},{(void*)0},{&l_873},{&g_165},{(void*)0}},{{(void*)0},{&g_165},{&l_873},{(void*)0},{(void*)0}},{{&l_873},{(void*)0},{(void*)0},{&l_873},{&g_165}},{{(void*)0},{(void*)0},{&g_165},{&l_873},{(void*)0}},{{(void*)0},{&l_873},{(void*)0},{&l_873},{&g_165}},{{(void*)0},{(void*)0},{(void*)0},{(void*)0},{&g_165}}};
int8_t l_1254 = 0x94L;
int i, j, k;
for (i = 0; i < 8; i++)
l_1250[i] = 0x9D124CAEL;
--l_1255;
if (p_37.f5)
goto lbl_1258;
g_307 = ((*g_195) = &l_1250[3]);
}
And that is undefined as g_307 was defered outside out of this scope.