[patch] tst-vfork-longjmp failure

Paul Brook paul at codesourcery.com
Fri Nov 17 18:00:55 UTC 2006

test/setjmp/tst-vfork-longjmp.c relies on the value of automatic local 
variables modified between setjmp and longjmp. This is explicitly not allowed 
by ISO C. The compiler eliminates the ++cnt and turns the test into an 
infinite loop.

Patch below fixes this by making these variables static.


--- test/setjmp/tst-vfork-longjmp.c	(revision 155037)
+++ test/setjmp/tst-vfork-longjmp.c	(local)
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
 	const char *prog;
 	jmp_buf env;
 	sigjmp_buf sigenv;
-	int cnt, max, ret;
+	static int cnt, max, ret;
 	memset(&orig_mask, 0x00, sizeof(orig_mask));
 	ret = sigprocmask(SIG_BLOCK, NULL, &orig_mask);

More information about the uClibc mailing list