Mercurial > hg > qcc
changeset 184:198df1691375
[project @ 2002-11-03 00:44:07 by bellard]
computed goto test
author | bellard |
---|---|
date | Sun, 03 Nov 2002 00:44:07 +0000 |
parents | 3bc2202e7346 |
children | d777ee8ed7a5 |
files | tcctest.c |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tcctest.c Sun Nov 03 00:43:55 2002 +0000 +++ b/tcctest.c Sun Nov 03 00:44:07 2002 +0000 @@ -325,6 +325,7 @@ void goto_test() { int i; + static void *label_table[3] = { &&label1, &&label2, &&label3 }; printf("goto:\n"); i = 0; @@ -336,6 +337,20 @@ 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 {