Are 'goto' + trampolines broken?

Øyvind Harboe oyvind.harboe@zylin.com
Sat May 14 18:41:00 GMT 2005


While strolling through the dark corners of the testsuite, as one
does :-), I discovered the gcc.c-torture/execute/nestfunct-5.c testcase.

How can goto's out of a nested fn to the containing fn possibly work?

Here foo() & bar() have different stack-frames, saved registers, etc.

void foo()
{
	void bar()
	{
		goto L1;
	}

	/* more code */

	L1:

	/* more code */
}



Attached is a slight variant of nestfunct-5.c that crashes with the GCC
i386 compiler on my Debian machine. 

$ gcc-4.0 ~/workspace/testgcc/nestfunct-5-variant.c  -g
$ ./a.out 
Aborted

$ gcc-3.4 ~/workspace/testgcc/nestfunct-5-variant.c  -g
$ ./a.out 
Aborted

-- 
Øyvind Harboe
http://www.zylin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nestfunct-5-variant.c
Type: text/x-csrc
Size: 632 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050514/8c36fbeb/attachment.bin>


More information about the Gcc mailing list