-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite/020-nonlocal-goto/001.c: expand test
- Loading branch information
Showing
1 changed file
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |