diff mbox series

testcases: missing evaluation of side effects in typeof(VLA)

Message ID 20180724170031.46056-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series testcases: missing evaluation of side effects in typeof(VLA) | expand

Commit Message

Luc Van Oostenryck July 24, 2018, 5 p.m. UTC
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>
---
 validation/eval-typeof-vla.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 validation/eval-typeof-vla.c
diff mbox series

Patch

diff --git a/validation/eval-typeof-vla.c b/validation/eval-typeof-vla.c
new file mode 100644
index 000000000..56a9ec201
--- /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
+ */