aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/flex-array-sizeof.c
diff options
Diffstat (limited to 'validation/flex-array-sizeof.c')
-rw-r--r--validation/flex-array-sizeof.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/validation/flex-array-sizeof.c b/validation/flex-array-sizeof.c
new file mode 100644
index 00000000..3359509d
--- /dev/null
+++ b/validation/flex-array-sizeof.c
@@ -0,0 +1,19 @@
+struct s {
+ int i;
+ long f[];
+};
+
+static int foo(struct s *s)
+{
+ return sizeof(*s);
+}
+
+/*
+ * check-name: flex-array-sizeof
+ * check-command: sparse -Wflexible-array-sizeof $file
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-sizeof.c:8:16: warning: using sizeof on a flexible structure
+ * check-error-end
+ */