diff options
Diffstat (limited to 'validation/linear')
| -rw-r--r-- | validation/linear/goto-invalid.c (renamed from validation/linear/invalid-labels0.c) | 4 | ||||
| -rw-r--r-- | validation/linear/goto-stmt-expr-conditional.c (renamed from validation/linear/goto-and-expr-stmt0.c) | 4 | ||||
| -rw-r--r-- | validation/linear/goto-stmt-expr-short-circuit.c | 32 | ||||
| -rw-r--r-- | validation/linear/label-scope-cgoto.c | 11 | ||||
| -rw-r--r-- | validation/linear/label-stmt-dropped.c | 26 | ||||
| -rw-r--r-- | validation/linear/label-stmt-expr0.c | 17 | ||||
| -rw-r--r-- | validation/linear/label-unreachable.c (renamed from validation/linear/unreachable-label0.c) | 3 |
7 files changed, 92 insertions, 5 deletions
diff --git a/validation/linear/invalid-labels0.c b/validation/linear/goto-invalid.c index ae3bf728..569d0b0d 100644 --- a/validation/linear/invalid-labels0.c +++ b/validation/linear/goto-invalid.c @@ -9,11 +9,11 @@ void bar(void) } /* - * check-name: invalid-labels0 + * check-name: goto-invalid * check-command: test-linearize -Wno-decl $file * check-known-to-fail * + * check-error-ignore * check-output-ignore * check-output-excludes: END - * check-error-ignore */ diff --git a/validation/linear/goto-and-expr-stmt0.c b/validation/linear/goto-stmt-expr-conditional.c index 54881353..6576052b 100644 --- a/validation/linear/goto-and-expr-stmt0.c +++ b/validation/linear/goto-stmt-expr-conditional.c @@ -18,11 +18,11 @@ a: } /* - * check-name: goto-and-expr-stmt0 + * check-name: goto-stmt-expr-conditional * check-command: test-linearize -Wno-decl $file * check-known-to-fail * + * check-error-ignore * check-output-ignore * check-output-excludes: END - * check-error-ignore */ diff --git a/validation/linear/goto-stmt-expr-short-circuit.c b/validation/linear/goto-stmt-expr-short-circuit.c new file mode 100644 index 00000000..426315e6 --- /dev/null +++ b/validation/linear/goto-stmt-expr-short-circuit.c @@ -0,0 +1,32 @@ +int foo(int p) +{ + goto inside; + if (0 && ({ +inside: + return 1; + 2; + })) + return 3; + return 4; +} + +int bar(int p) +{ + if (0 && ({ +inside: + return 1; + 2; + })) + return 3; + goto inside; +} + +/* + * check-name: goto-stmt-expr-short-circuit + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-error-ignore + * check-output-ignore + * check-output-excludes: END + */ diff --git a/validation/linear/label-scope-cgoto.c b/validation/linear/label-scope-cgoto.c new file mode 100644 index 00000000..592f1ce4 --- /dev/null +++ b/validation/linear/label-scope-cgoto.c @@ -0,0 +1,11 @@ +#include <label-scope-cgoto.c> + +/* + * check-name: linear/label-scope-cgoto + * check-command: test-linearize -Wno-decl -I. $file + * check-known-to-fail + * + * check-error-ignore + * check-output-ignore + * check-output-excludes: END + */ diff --git a/validation/linear/label-stmt-dropped.c b/validation/linear/label-stmt-dropped.c new file mode 100644 index 00000000..74e0f2e6 --- /dev/null +++ b/validation/linear/label-stmt-dropped.c @@ -0,0 +1,26 @@ +/* + * Verify that the statement following an unused label + * is not discarded with the label. + */ + +static int bad(int a, int b) +{ + int r = 0; + +start: + r += a; + r += b; + + if (!r) + goto start; + return r; +} + +/* + * check-name: label-stmt-dropped + * check-command: test-linearize $file + * + * check-output-ignore + * check-output-contains: add + * check-output-contains: %arg1 + */ diff --git a/validation/linear/label-stmt-expr0.c b/validation/linear/label-stmt-expr0.c new file mode 100644 index 00000000..ff3c0980 --- /dev/null +++ b/validation/linear/label-stmt-expr0.c @@ -0,0 +1,17 @@ +int foo(void); +int foo(void) +{ + int r; + + r = ({ goto label; label: 1; }); + return r; +} + +/* + * check-name: label-stmt-expr0 + * check-command: test-linearize $file + * check-output-ignore + * + * check-output-excludes: ret\\.32\$ + * check-output-contains: ret\\.32 *\\$1 + */ diff --git a/validation/linear/unreachable-label0.c b/validation/linear/label-unreachable.c index 695e5cb0..a44e1211 100644 --- a/validation/linear/unreachable-label0.c +++ b/validation/linear/label-unreachable.c @@ -10,9 +10,10 @@ label: } /* - * check-name: unreachable-label0 + * check-name: label-unreachable * check-command: test-linearize $file * + * check-error-ignore * check-output-ignore * check-output-contains: ret\\. * check-output-excludes: END |
