diff options
author | Martin Sebor <msebor@redhat.com> | 2020-01-10 17:04:00 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2020-01-10 10:04:00 -0700 |
commit | f25e33fa1b62a6f6c8dddf8e6a7961fae6847a0e (patch) | |
tree | 88ce9f9f24cbdac4e53f3a41c5ea98f9aac5a2c4 /gcc/c-family/c-attribs.c | |
parent | b2f5b38042f6a8772237d37cdf20fc139ed0f8fe (diff) | |
download | gcc-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/c-family/c-attribs.c')
-rw-r--r-- | gcc/c-family/c-attribs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 77649e8..dc9579c 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -3970,14 +3970,15 @@ append_access_attrs (tree t, tree attrs, const char *attrstr, return NULL_TREE; } - if (n2 && strncmp (attrstr + n1 + 1, pos + n1, n2)) + if (n2 && strncmp (attrspec + n1 + 1, pos + n1, n2)) { /* Mismatch in the value of the size argument. */ auto_diagnostic_group d; if (warning (OPT_Wattributes, - "attribute %qs mismatch positional argument " + "attribute %qs mismatched positional argument " "values %i and %i", - attrstr, atoi (attrstr + n1 + 1), atoi (pos + n1)) + attrstr, atoi (attrspec + n1 + 1) + 1, + atoi (pos + n1) + 1) && DECL_P (t)) inform (DECL_SOURCE_LOCATION (t), "previous declaration here"); |