[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] gsl_histogram_get_range
From: |
James Bergstra |
Subject: |
Re: [Help-gsl] gsl_histogram_get_range |
Date: |
Fri, 16 Jun 2006 10:44:45 -0400 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
On Fri, Jun 16, 2006 at 04:23:14PM +0200, Thomas Weber wrote:
> Hi,
>
> Am Donnerstag, den 15.06.2006, 12:10 +0200 schrieb Emiliano Olivieri:
> > double lower,upper;
> > gsl_histogram_get_range (h,gsl_histogram_max_bin (h),&lower,&upper);
> >
> >
> > In this other case, my programs stop with the message: "Bus error"
> >
> > double *lower,*upper;
> > gsl_histogram_get_range (h,gsl_histogram_max_bin (h),lower,upper);
>
> You have a pointer to a double variable; but no space for it is
> allocated.
>
> So, reserving some space for your doubles (malloc()) would be good.
Sometimes you can prevent this error by ensuring that all your doubles
are properly aligned in memory, which is to say on double-word or
quad-word boundaries. Buffers allocated from malloc are aligned fine,
but buffers (including your single-element buffers lower and upper)
allocated on the stack may not be, if you don't force the compiler (gcc
might do it with -falign-doubles but not sure).
This is a hacky workaround... btw.
James