https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93132

            Bug ID: 93132
           Summary: bogus `attribute((access))' warning when size-index is
                    specified
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p...@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---

Created attachment 47580
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47580&action=edit
Use formatted attribute specifier `attrspec', not the input one

Hi.

`append_access_attrs' at `gcc/c-family/c-attribs.c' has a slight issue when it
tries to match the size-index parameter:

3973           if (n2 && strncmp (attrstr + n1 + 1, pos + n1, n2))

The problem is that `attrstr' is the input / human-readable attribute string
(e.g. `attribute((__read_only__, 1, 2))' and not the formatted one (denoted by
`attrspec', e.g. `r0\01').  The corresponding warning message has this typo,
too, and it uses `atoi (attrstr + n1 + 1)' while it should of course use
`attrspec'.

Attached a proposed patch.  As a side note, it's possibly a bit misleading that
the values in the warning message are one less than the given inputs; Perhaps
`atoi()' values should be incremented by one.

Reply via email to