[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SegFault in 2**111111111 calculation
From: |
Torbjorn Granlund |
Subject: |
Re: SegFault in 2**111111111 calculation |
Date: |
06 Dec 2000 22:04:54 +0100 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6 |
Pearu Peterson <address@hidden> writes:
On Wed, 6 Dec 2000, Pearu Peterson wrote:
> Also note that SegFault happens before the malloc call (see the
> supplied gmpy_allocate function).
Sorry, this is not obvious. But with
static void * gmpy_allocate(size_t size)
{
void *res;
fprintf(stderr, "mp_allocate( %d )\n", size);
res = (void *)malloc(size);
fprintf(stderr, "mp_allocate( %d ) ->%8p\n", size, res);
return res;
}
I'll get
Calculating 2**111111111:
mp_allocate( 4 )
mp_allocate( 4 ) ->0x8049ba0
Segmentation fault
Which shows that the problem is not in malloc, at least not in the one
called in gmpy_allocate.
It doesn't show that.
Try doing a memset(res,17,size) after the malloc.
I suspect you'll get the crash there instead.
--
Torbjörn
Re: SegFault in 2**111111111 calculation, Kevin Ryde, 2000/12/06