http://llvm.org/bugs/show_bug.cgi?id=21321

Marshall Clow (home) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Marshall Clow (home) <[email protected]> ---
The C++ standard explicitly allows zero-sized allocations
(Quoting from N3937, but it's the same in C++03 and C++11)

See 3.7.4.1/2:

Even if the size of the space requested is zero, the request can fail. If the
request succeeds, the value returned shall be a non-null pointer value (4.10)
p0 different from any previously returned value p1, unless that value p1 was
subsequently passed to an operator delete. The effect of indirecting through a
pointer returned as a request for zero size is undefined. (36)

[ bottom of page ]
36) The intent is to have operator new() implementable by calling std::malloc()
or std::calloc(), so the rules are sub-stantially the same. C++ differs from C
in requiring a zero request to return a non-null pointer.


Note: I'd be happy if you were to open a bug against scan-build for this issue
:-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to