Are 'goto' + trampolines broken?
Richard Henderson
rth@redhat.com
Sat May 14 23:49:00 GMT 2005
On Sat, May 14, 2005 at 11:59:28AM +0200, Ãyvind Harboe wrote:
> void test(void (*t)(void))
> {
> int i;
> for (i=0; i<10; i++)
> {
> t();
...
> int skip=0xdeadbeef;
>
> void do_goto (void)
> {
> goto l1;
> }
>
> test(do_goto);
...
> l1:
> if (skip!=0xdeadbeef)
> }
>
> int main ()
> {
> recursive (10, abort);
> abort ();
> }
Well of course your program always aborts. Control never enters
the recursive part of recursive(). It flows straight through and
returns, which hits the abort in main.
r~
More information about the Gcc
mailing list