[Bug c++/19351] operator new[] can return heap blocks which are too small

fw at deneb dot enyo dot de gcc-bugzilla@gcc.gnu.org
Sun Jan 9 22:35:00 GMT 2005


------- Additional Comments From fw at deneb dot enyo dot de  2005-01-09 22:35 -------
Why is this undefined behavior?  Would you quote chapter and verse, please?

GCC's behavior violates 5.3.4(10):

"A new-expression passes the amount of space requested to the allocation
function as the first argument of type std::size_t.  That argument shall be no
less than the size of the object being created; [...]"

In this case, the passed value is 16, which is much smaller than the size of the
array.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19351



More information about the Gcc-bugs mailing list