History

computed goto test

bellard committed 24 years ago

Commit 923627f1 parent 804d0c81 file · +15 −0Browse files

Unified · Split

tcctest.c+15−0
@@ -325,6 +325,7 @@ void loop_test() · 324 unmodified lines
325void goto_test()325void goto_test()
326{326{
327 int i;327 int i;
328 static void *label_table[3] = { &&label1, &&label2, &&label3 };
328 329
329 printf("goto:\n");330 printf("goto:\n");
330 i = 0;331 i = 0;
@@ -336,6 +337,20 @@ void goto_test() · 5 unmodified lines
336 goto s_loop;337 goto s_loop;
337 s_end:338 s_end:
338 printf("\n");339 printf("\n");
340
341 /* we also test computed gotos (GCC extension) */
342 for(i=0;i<3;i++) {
343 goto *label_table[i];
344 label1:
345 printf("label1\n");
346 goto next;
347 label2:
348 printf("label2\n");
349 goto next;
350 label3:
351 printf("label3\n");
352 next: ;
353 }
339}354}
340 355
341enum {356enum {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t