This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19351] operator new[] can return heap blocks which are too small
- From: "fw at deneb dot enyo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jan 2005 22:35:01 -0000
- Subject: [Bug c++/19351] operator new[] can return heap blocks which are too small
- References: <20050109221816.19351.fw@deneb.enyo.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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