aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pointer-counted-by-10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pointer-counted-by-10.c')
-rw-r--r--gcc/testsuite/gcc.dg/pointer-counted-by-10.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-10.c b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c
new file mode 100644
index 0000000..e2bd018
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pointer-counted-by-10.c
@@ -0,0 +1,8 @@
+/* Testing the correct usage of attribute counted_by for pointer to void. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Wpointer-arith" } */
+
+struct pointer_array {
+ int count;
+ void *array __attribute__ ((counted_by (count))); /* { dg-warning "attribute is used for a pointer to void" } */
+};