computed goto test

This commit is contained in:
bellard 2002-11-03 00:44:07 +00:00
parent 804d0c8d41
commit 923627f030

View file

@ -325,6 +325,7 @@ void loop_test()
void goto_test()
{
int i;
static void *label_table[3] = { &&label1, &&label2, &&label3 };
printf("goto:\n");
i = 0;
@ -336,6 +337,20 @@ void goto_test()
goto s_loop;
s_end:
printf("\n");
/* we also test computed gotos (GCC extension) */
for(i=0;i<3;i++) {
goto *label_table[i];
label1:
printf("label1\n");
goto next;
label2:
printf("label2\n");
goto next;
label3:
printf("label3\n");
next: ;
}
}
enum {