This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14176] New: standard allocator crashes when deallocating segment of zero length.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]