[cfe-dev] FW: GSL 'make check' failure

Kelly Wilson wilsonkk at shaw.ca
Tue Jul 8 00:15:15 PDT 2008

Hello Matthijs,

Actually I just checked and the problem with this bit of code is an unsigned
integer value for 'i'.

What I previously failed to show in the code snippet was that 'i' is
declared as type 'size_t'...which I'm guessing defaults to uint32 in this

Instead of using 'size_t i;' I replaced it with a signed int and things
worked fine. But if I used an unsigned variable then things blew up. Here is
a failure table:

short		pass
ushort	pass

int		pass
uint		fail

long		pass
ulong		fail

long long	pass
ulong long	fail

Unsigned short doesn't blow up???? Hmmmm....

I am compiling using Ubuntu 2.6.24 with a Quad6600 Intel chip and svn


P.S. This is not my code. It is the Gnu Scientific Library and it uses some
complex pure C (ie. function pointers and macro expansions that make things
harder to track). Very nicely written and an interesting testing
framework...just difficult to follow through with my quick perusal ;)

> For (i=0;i<N;i++)
> {
>   v->data[2*i] = ATOMIC(N - i);
>   v->data[2*i + 1] = ATOMIC(10 * (N - i) + 1);
> };
> fwrite().
> fclose().
> free().
I've seen similar free errors after doing out-of-bounds write. Are you sure
that data is allocated long enough (2N elements)?



More information about the cfe-dev mailing list