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 23:07:13 -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 23:07 -------
There's no multiplication in the source code. The multiplication is an
implementation detail. You can hardly use it to justify the semantics of the
operation.
I would expect that std::bad_alloc is thrown. But I agree that the C++ standard
isn't very clear in this area. The implementation must ensure that the
postcondition in 5.3.4(10) holds, but the standard doesn't provide a means to
signal failure. I'm going to post a note to comp.std.c++ on this matter, but
hopefully this will be fixed in GCC as a quality of implementation issue.
The necessary overflow check is should be very cheap because the multiplication
is always by a constant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19351