view test/scope.c @ 491:a379da780856

cond signed/unsigned
author kono
date Wed, 21 Dec 2005 11:33:53 +0900
parents eaf9e2746c83
children dbfd6e88e2c3
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("#0045:inner %d %d %0x\n",i,k,&&exit1==exit);
    }
    k++;
exit0:
    printf("#0049:outer %d %d %0x\n",i,k,&&exit0==exit);
    return 0;
}