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]

Re: g++ 2.95.3: throw does zero byte malloc?


On Mon, Feb 19, 2001 at 01:24:46PM +0000, Bernd Schmidt wrote:
> On Sat, 17 Feb 2001, Sebastian Rittau wrote:
> 
> > Consider the following program:
> >
> > | int main(int argc, char **argv)
> > | {
> > |   throw 5;
> > | }
> >
> > If I compile and link this with libefence (electric-fence malloc
> > debugger), efence claims that a zero byte memory allocation is made:
> 
> Does it happen with 2.95.2 as well?

Yes, just tried with

srittau@cella:~$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)
srittau@cella:~$ dpkg -s g++ | grep ^Version:
Version: 1:2.95.2-18

I forgot to include a gdb stack backtrace. Here it is:

#0  0x400b3e51 in kill () from /lib/libc.so.6
#1  0x40021c56 in EF_Abort () from /usr/lib/libefence.so.0
#2  0x40021246 in memalign () from /usr/lib/libefence.so.0
#3  0x4002183c in malloc () from /usr/lib/libefence.so.0
#4  0x40049ce1 in exception::what () from /usr/lib/libstdc++-libc6.2-2.so.3
#5  0x40049de5 in exception::what () from /usr/lib/libstdc++-libc6.2-2.so.3
#6  0x4004a57c in __frame_state_for () from /usr/lib/libstdc++-libc6.2-2.so.3
#7  0x40048ec5 in __throw () from /usr/lib/libstdc++-libc6.2-2.so.3
#8  0x8048680 in main ()
#9  0x400a4c1c in __libc_start_main () from /lib/libc.so.6

(Stack frames #0 to #3 are internal electric fence functions.)

BTW: This is probably not a real bug in g++ as zero byte memory
allocations are allowed AFAIK, but it complicates debugging. So
this is more a "wishlist" item than an actual bug.

 - Sebastian


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