[cfe-dev] [LLVMdev] RFC: Adding attribute(nonnull) to things in libc++
Joerg Sonnenberger
joerg at britannica.bec.de
Mon Jun 1 13:47:16 PDT 2015
On Mon, Jun 01, 2015 at 10:52:20AM -0700, Marshall Clow wrote:
> On Mon, Jun 1, 2015 at 10:35 AM, Joerg Sonnenberger <joerg at britannica.bec.de
> > wrote:
>
> > On Mon, Jun 01, 2015 at 09:57:17AM -0700, Reid Kleckner wrote:
> > > Why should memset / memcpy be attribute nonnull? Is there standardese
> > that
> > > supports that?
> >
> > The generic entry text of the standard section. IMO this is a standard
> > bug and someone should *please* get it fixed. It is ridiculous that zero
> > sized operations are considered UB.
> >
>
> That would require a change to the C standard, and, as far as I know, there
> are no current plans to issue a revised C standard.
Well, a good start would be to get a position on whether this
interpretation is intentional. Especially given GCC's aggressive
exploitation. It doesn't make sense to me as there doesn't seem to be a
way that "if len is 0, the pointer must be not-null" can improve an
implementation on any system where memory operations can trap.
Joerg
More information about the cfe-dev
mailing list