This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14176] New: standard allocator crashes when deallocating segment of zero length.
- From: "nivelle at mpi-sb dot mpg dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Feb 2004 14:14:57 -0000
- Subject: [Bug c++/14176] New: standard allocator crashes when deallocating segment of zero length.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello,
I am not certain what the standard says about this, but the following code
causes a segmentation fault under various versions of g++ .
It is a bit strange off course to allocate segments of length 0, but
for symmetry it makes sense to allow it.
yours,
Hans.
#include <memory>
int main( int argc, char * argv[] )
{
unsigned int len = 0;
std::allocator< int > a;
int* p = a. allocate( len );
a. deallocate( p, len );
};
--
Summary: standard allocator crashes when deallocating segment of
zero length.
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nivelle at mpi-sb dot mpg dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14176