Skip to content

Commit

Permalink
testsuite/020-nonlocal-goto/001.c: expand test
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Jan 28, 2021
1 parent 83082a8 commit 28e9e28
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions testsuite/020-nonlocal-goto/001.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
#include <stdio.h>

int main(void)
{
__label__ out;
volatile int x0 = 7;
printf("x0 at %p\n", &x0);
int f(int x)
{
volatile int y0 = 3;
printf("before non-local jump\n");
if (x && x0)
return x0 + x;
goto out;
goto out;
printf("after non-local jump\n");
return x0 + x;
}
if (f(8))
return 0;

printf("falling through\n");
out:
printf("received non-local jump\n");
printf("x0 at %p\n", &x0);
printf("x0 = %d\n", x0);
return 1;
}

0 comments on commit 28e9e28

Please sign in to comment.