aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-01-10 17:04:00 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2020-01-10 10:04:00 -0700
commitf25e33fa1b62a6f6c8dddf8e6a7961fae6847a0e (patch)
tree88ce9f9f24cbdac4e53f3a41c5ea98f9aac5a2c4 /gcc/testsuite/gcc.dg
parentb2f5b38042f6a8772237d37cdf20fc139ed0f8fe (diff)
downloadgcc-f25e33fa1b62a6f6c8dddf8e6a7961fae6847a0e.zip
gcc-f25e33fa1b62a6f6c8dddf8e6a7961fae6847a0e.tar.gz
gcc-f25e33fa1b62a6f6c8dddf8e6a7961fae6847a0e.tar.bz2
PR c/93132 - bogus 'attribute((access))' warning when size-index is specified
gcc/c-family/ChangeLog: PR c/93132 * c-attribs.c (append_access_attrs): Validate against the translated access string rather than the human-readable representation. gcc/testsuite/ChangeLog: PR c/93132 * gcc.dg/attr-access-read-only-2.c: New test. From-SVN: r280124
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/attr-access-read-only-2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/attr-access-read-only-2.c b/gcc/testsuite/gcc.dg/attr-access-read-only-2.c
new file mode 100644
index 0000000..d3069b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-access-read-only-2.c
@@ -0,0 +1,16 @@
+/* PR c/93132 - bogus 'attribute((access))' warning when size-index
+ is specified
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void __attribute__ ((access (read_only, 1, 5)))
+f (void*, int, int, int, int); // { dg-message "previous declaration" }
+
+void __attribute__ ((access (read_only, 1, 3)))
+f (void*, int, int, int, int); // { dg-warning "attribute 'access\\\(read_only, 1, 3\\\)' mismatched positional argument values 3 and 5" }
+
+void __attribute__ ((access (read_only, 1, 4)))
+f (void*, int, int, int, int); // { dg-warning "attribute 'access\\\(read_only, 1, 4\\\)' mismatched positional argument values 4 and 5" }
+
+void __attribute__ ((access (read_only, 1, 5)))
+f (void*, int, int, int, int);