aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-10 01:03:25 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-10 01:03:25 +0100
commit0c43faa22682ab65525638be813632b44c7a45fd (patch)
tree425b2d0852860af6bfbaad6606c55c6d20774cad /validation
parentd6d857f2d160fc2740137dea4eec605dbd93b1ef (diff)
parent78ce37356fd090e5353bc61031de1c8e717d24f6 (diff)
downloadsparse-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.c37
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 \\.
+ */