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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
"A derived class shall implement this function to return a pointer to allocated
storage (6.7.5.5.2) with a size of at least bytes, aligned to the specified
alignment."

And 6.7.5.5.2 says:

"An allocation function attempts to allocate the requested amount of storage.
If it is successful, it returns the address of the start of a block of storage
whose length in bytes is at least as large as the requested size. [...]
If the request succeeds, the value returned by a replaceable allocation
function is a non-null pointer value ([basic.compound]) p0 different from any
previously returned value p1, [...]"

It says it's non-null.

The attribute is not there to catch bugs in memory resources, it's there to
tell the compiler that the returned pointer is not null, and so it can optimize
accordingly.

In an environment where 0 is a valid address, does
-fno-delete-null-pointer-checks make any difference?

Reply via email to