view test/scope.c @ 483:77cab9687d3f

*** empty log message ***
author kono
date Sun, 11 Dec 2005 23:53:27 +0900
parents eaf9e2746c83
children a379da780856
line wrap: on
line source

/* 

    gcc -g -std=gnu99 test/scope.c

 */

#include <stdio.h>

void
f(int *i,void *label)
{
    static int k = 3;
    {
	static int k = 3;
	*i =  k++;
    }
    k--;
    printf("#0017:f %d\n",k);
} 

int
main()
{
    int i,k;
    void *exit = &&exit0;
    i = 3;k=10;
    for(int k=0;k<10;k++) { 
	int i;
	i = 4;
	if (({
	    __label__ exit0; 
	    int i; 
		f(&i,&&exit0); 
		if (i==5) 
		    goto exit0;
		printf("#0035:2nd inner %d %d %0x\n",i,k,&&exit1==exit);
	    exit0:
	    i;
	    })!=7) {
	    goto exit1;
	} else
	    goto *exit;
	/* not reached */
	i = ({ int k=3; k; });
exit1:
	printf("#0043:inner %d %d %0x\n",i,k,&&exit1==exit);
    }
    k++;
exit0:
    printf("#0047:outer %d %d %0x\n",i,k,&&exit0==exit);
    return 0;
}