This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Are 'goto' + trampolines broken?


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]