aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-07-24 12:00:01 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-07-25 11:38:16 +0200
commitb03237b8deef238a1321752fe4d401f10934f084 (patch)
tree95fd299fedd4f9f89433e250d0fe4ddb6cae3738 /validation
parent57d11fc64aebe648c0c64e10e47503d3e2f60218 (diff)
downloadsparse-dev-b03237b8deef238a1321752fe4d401f10934f084.tar.gz
testcases: missing evaluation of side effects in typeof(VLA)
The argument of the typeof operator is normally not evaluated but it should be when it involves a VLA. Add a testcase for this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/eval-typeof-vla.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/validation/eval-typeof-vla.c b/validation/eval-typeof-vla.c
new file mode 100644
index 00000000..56a9ec20
--- /dev/null
+++ b/validation/eval-typeof-vla.c
@@ -0,0 +1,26 @@
+extern int a[1];
+
+static int foo(int n)
+{
+ int i = 0;
+ int (*p)[1] = (typeof(++i, (int (*)[n])a)) &a;
+
+ (void) p;
+
+ return i;
+}
+
+/*
+ * check-name: eval-typeof-vla
+ * check-command: test-linearize -Wno-vla $file
+ * check-known-to-fail
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ ret.32 $1
+
+
+ * check-output-end
+ */