aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-04-09 23:58:10 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-21 17:27:45 +0200
commitaa42800cc4aca57bb29cdc90fcace6c352449078 (patch)
treea223493fc2f407bcfe5603e01cc92b9a65913e9e /validation/linear
parent154278d4e26d9d48fbb5f2668533a4c4e598b564 (diff)
downloadsparse-dev-aa42800cc4aca57bb29cdc90fcace6c352449078.tar.gz
bad-goto: add testcase for 'jump inside discarded expression statement'
A goto done into an piece of code discarded at expand or linearize time will produce an invalid IR. Add a testcase for it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear')
-rw-r--r--validation/linear/goto-and-expr-stmt0.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/linear/goto-and-expr-stmt0.c b/validation/linear/goto-and-expr-stmt0.c
new file mode 100644
index 00000000..54881353
--- /dev/null
+++ b/validation/linear/goto-and-expr-stmt0.c
@@ -0,0 +1,28 @@
+int t(void)
+{
+ goto inside;
+ return 1 ? 2 : ({
+inside:
+ return 3;
+ 4;
+ });
+}
+
+void f(int x, int y)
+{
+ 1 ? x : ({
+a:
+ y;
+ });
+ goto a;
+}
+
+/*
+ * check-name: goto-and-expr-stmt0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: END
+ * check-error-ignore
+ */