libstdc++/7111: cout of null pointer causes core dump

Phil Edwards phil@jaj.com
Wed Jul 3 10:46:00 GMT 2002


The following reply was made to PR libstdc++/7111; it has been noted by GNATS.

From: Phil Edwards <phil@jaj.com>
To: rdhunt@sandia.gov
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/7111: cout of null pointer causes core dump
Date: Wed, 3 Jul 2002 13:45:41 -0400

 On Mon, Jun 24, 2002 at 10:20:23PM -0000, rdhunt@sandia.gov wrote:
 > >Description:
 > Trying to print a null character pointer causes this program to core dump.
 > This works fine under GCC 2.95.  I know null pointers are sensitive and
 > am not completely sure if this is truly a bug or what the correct way of
 > handling this is.
 
 It's undefined behavior, so coredumping is strictly allowed (while annoying,
 and obviously not friendly).  As bkoz mentioned, the sources have been changed
 to notice and throw an exception.
 
 GCC 2.x used a completely different library as 3.x.
 
 
 > >How-To-Repeat:
 > Compile it and run it.  If I change the char* to be void* it works fine.
 
 For void* I think you'd be getting a pointer address.
 
 Phil
 
 -- 
 If ye love wealth greater than liberty, the tranquility of servitude greater
 than the animating contest for freedom, go home and leave us in peace.  We seek
 not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
 and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Gcc-prs mailing list