From 12e21be52331c06e00a4ed4406fec167daae3f4b Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 1 Nov 2008 17:20:48 +0000 Subject: [PATCH] write a testapp that really test functionality (so we can actually detect the implementation bugs) [r23355] --- parsetest/gnu99/local_label.c | 61 +++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/parsetest/gnu99/local_label.c b/parsetest/gnu99/local_label.c index 345f2c5..47a07ac 100644 --- a/parsetest/gnu99/local_label.c +++ b/parsetest/gnu99/local_label.c @@ -1,29 +1,50 @@ +extern void puts(const char *str); + int test(int a, int b) { - if (a) { - __label__ label; - if (b) - goto label; - b = 1; + puts("here"); + if (a) { + __label__ label; + puts("P1"); + if (b) { + puts("before goto"); + goto label; + } + puts("behind if"); + b = 1; label: label2: - ++b; - } - if (a) { - __label__ label; - if (a) { - __label__ label; - label: - ; + puts("behind label (1)"); + ++b; } - if (b) - goto label; - b = 1; + + if (a) { + __label__ label; + puts("P2"); + goto label; + if (a) { + __label__ label; +label3: + puts("behind label3"); + goto label; +label: ; + puts("behind label (2)"); + } + if (b) { + puts("goto fininsh"); + goto finish; + } + b = 1; label: - ++b; - } - return b; + puts("behind label (3)"); + ++b; + goto label3; + } +finish: + puts("finished"); + return b; } int main(int argc, char *argv[]) { - return 0; + test(1, 42); + return 0; } -- 2.20.1