aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-01-04 05:45:33 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-13 09:34:45 +0800
commitc0ad591813d823176e71e18704461e9e7f8e9af5 (patch)
tree224fd92d437e9ae6074678a646c1d47be763381f /validation
parent5636cd5cbf816f30ee57d580ec4debd8e0bd7581 (diff)
downloadsparse-dev-c0ad591813d823176e71e18704461e9e7f8e9af5.tar.gz
fix value of label statement
Normaly a label statement is not also an expression but it could be in GCC's statement expression like : ({ ...; label: <expression>; }) Currently, during linearization sparse discards the return value of the linearization of the label's sub-statement, thus also discarding the value of such statement-expressions. Trivialy fix this by not discarding the return value but returning it instead, like other statements that also are an expression and thus have a value. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/label-expr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/validation/label-expr.c b/validation/label-expr.c
new file mode 100644
index 00000000..e578ed00
--- /dev/null
+++ b/validation/label-expr.c
@@ -0,0 +1,17 @@
+int foo(void);
+int foo(void)
+{
+ int r;
+
+ r = ({ label: 1; });
+ return r;
+}
+
+/*
+ * check-name: label-expr
+ * check-command: test-linearize $file
+ * check-output-ignore
+ *
+ * check-output-excludes: ret\\.32\$
+ * check-output-contains: ret\\.32 *\\$1
+ */