bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: memset (0, 0, 0);


From: Thomas,Stephen
Subject: RE: memset (0, 0, 0);
Date: Mon, 7 Apr 2003 11:42:44 +0100

Hi Wolfram,

xmalloc is an internal gdb routine. I just checked it, & it returns NULL for 
size=0.
(malloc on our architecture does indeed return a proper address for size=0).

Steve Thomas
SuperH (UK) Ltd.

-----Original Message-----
From: Wolfram Gloger [mailto:address@hidden 
Sent: 07 April 2003 10:44
To: Thomas,Stephen
Cc: address@hidden
Subject: Re: memset (0, 0, 0);


Hi,

> On the 1st time of calling, none of the gdbarch stuff is set up, so 
> NUM_REGS = NUM_PSEUDO_REGS = 0. So xmalloc gets called with size=0. 
> That returns 0 as the 'address', which gets passed to memset. I guess 
> this just works OK on other architectures (it does on x86 anyway).

Actually on x86-linux, malloc(0) (and therefore xmalloc(0)) returns a unique 
address, not NULL.  Both behaviours are permitted by standard C.

Regards,
Wolfram.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]