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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
           Severity|normal                      |enhancement

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm also not sure I see how such an attribute/built-in could be used as
described.  What might perhaps be useful is the ability to create an
association between a pointer and a size of the object it points to, e.g., like
so:

  struct MemPool {
    size_t block_size;
    char pool[] __attribute__ ((alloc_size (block_size)));
  };

This way, in cases when GCC could determine the (constant) value or range of
block_size it could use that value (or range) to detect buffer overflows.

I have no idea if this is something sufficiently common to justify the effort
it would take to add such an extension.

Reply via email to