On Mon, Feb 10, 2020 at 10:20:50AM -0700, Martin Sebor wrote:
> PR 93641 points out a number of off-by-one mistakes in calls to strncmp
> in GCC where the bound is (unintentionally) less than the length of
> the string literal argument.
>
> PR 93640 is a separate report of another such mistake in the code that
> validates the mode argument in attribute access. As a result, the code
> accepts even some invalid modes. The attached patch fixes these.
>
> It's not technically a regression so I was going to wait until stage
> 1 to submit a fix but seeing that Jakub already committed fixes for
> the former I figure I should also handle this one for GCC 10.
>
> Tested on x86_64-linux.
Ok, thanks.
> PR c/93640 - The write_only and read_write attributes can be mistyped due to
> invalid strncmp size argument
>
> gcc/c-family/ChangeLog:
>
> PR c/93640
> * c-attribs.c (handle_access_attribute): Correct off-by-one mistakes.
>
> gcc/testsuite/ChangeLog:
>
> PR c/93640
> * gcc.dg/attr-access.c: New test.
Jakub