[Bug c/118043] -Wattributes: [[gnu::access(wo, n)]]: False positive with VLA

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Dec 14 19:25:39 GMT 2024


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|diagnostic                  |documentation

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
          /* The two specs designate different size arguments.  It's okay
             for the explicit spec to specify a size where none is provided
             by the implicit (VLA) one, as in:
               __attribute__ ((access (read_write, 1, 2)))
               void f (int*, int);
             but not for two explicit access attributes to do that.  */



Looks like this is by design, you still need to supply the size argument to
write_only.  Note this is not documented though.


More information about the Gcc-bugs mailing list