summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Warray-bounds-3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Warray-bounds-3.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-3.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-3.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-3.C
new file mode 100644
index 000000000..a85857179
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-3.C
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+extern void function(void * x);
+
+struct A {
+ long x;
+ char d[0];
+};
+
+
+void test(A * a) {
+ function((char *)a - 4); /* { dg-bogus "below array bounds" } */
+}
+