http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-17
09:28:55 UTC ---
#include <stdio.h>
#include <setjmp.h>
static sigjmp_buf env;
static inline int g (int x)
{
if (x)
{
fprintf (stderr, "Returning 0\n");
return 0;
}
else
{
fprintf (stderr, "Returning 1\n");
return 1;
}
}
__attribute__ ((noinline))
void bar (int n)
{
if (n == 0)
exit (0);
static int x;
if (x++) abort ();
longjmp (env, 42);
}
int
f (int *e)
{
int n = *e;
if (n)
return 1;
int x = setjmp (env);
n = g (x);
fprintf (stderr, "x = %i, n = %i\n", x, n);
bar (n);
}
int
main ()
{
int v = 0;
return f (&v);
}
Adjusted testcase that fails even with GCC 4.7.2 at -O2, works with -O2
-fno-dominator-opts (which disables uncprop). Again, I don't see how
this could be declared invalid, while n is declared before the setjmp, it is
not live across the setjmp call. This adjusted testcase regressed in April
2005 (i.e. 4.1+ regression).