diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-10 01:03:25 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-10 01:03:25 +0100 |
| commit | 0c43faa22682ab65525638be813632b44c7a45fd (patch) | |
| tree | 425b2d0852860af6bfbaad6606c55c6d20774cad /validation | |
| parent | d6d857f2d160fc2740137dea4eec605dbd93b1ef (diff) | |
| parent | 78ce37356fd090e5353bc61031de1c8e717d24f6 (diff) | |
| download | sparse-dev-0c43faa22682ab65525638be813632b44c7a45fd.tar.gz | |
Merge branch 'fix-non-const-case' into tip
* fix linearization of non-constant switch-cases
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/linear/non-const-case.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/validation/linear/non-const-case.c b/validation/linear/non-const-case.c new file mode 100644 index 00000000..7291589c --- /dev/null +++ b/validation/linear/non-const-case.c @@ -0,0 +1,37 @@ +static int foo(int a) +{ + switch (a) { + case 0: + return a; + case a: + return 0; + case (a - a): + return 1; + default: + return a; + } +} + +static int bar(int a) +{ + switch (a) { + case 0: + break; + case a: + a++; +label: + return a; + } + + goto label; +} + + +/* + * check-name: non-const-case + * check-command: test-linearize -Wno-decl $file + * + * check-error-ignore + * check-output-ignore + * check-output-excludes:switch \\. + */ |
