On 11/18/20 3:41 PM, Martin Sebor via Gcc-patches wrote:
> The access attribute handler doesn't check to make sure the mode
> argument is an identifier and readily accepts string arguments
> which are assumed to be the condensed internal representation
> the user attribute is translated to. This can cause all sorts
> of unintended behavior when the user supplies a bogus string,
> either by accident or in an effort to break things.
>
> The attached patch tightens up the attribute handler to reject
> strings and any other modes that aren't the expected indentifiers.
> It distinguishes the internal strings by introducing a new flag,
> ATTR_FLAG_INTERNAL, and calling decl_attributes() with it.
>
> Martin
>
> gcc-97879.diff
>
> PR middle-end/97879 - ICE on invalid mode in attribute access
>
> gcc/c-family/ChangeLog:
>
> PR middle-end/97879
> * c-attribs.c (handle_access_attribute): Handle ATTR_FLAG_INTERNAL.
> Error out on invalid modes.
>
> gcc/ChangeLog:
>
> PR middle-end/97879
> * tree-core.h (enum attribute_flags): Add ATTR_FLAG_INTERNAL.
>
> gcc/testsuite/ChangeLog:
>
> PR middle-end/97879
> * gcc.dg/attr-access-3.c: New test.
OK
jeff