Alignment of gfortran allocated arrays

Timo Schneider timo.schneider@s2004.tu-chemnitz.de
Tue Aug 14 18:08:00 GMT 2007


On Tuesday 14 August 2007, François-Xavier Coudert wrote:

Hi,

> > Anyway, I'm trying to ensure that arrays I allocate in gfortran are 16
> > byte aligned for use with
> > fftw  < http://www.fftw.org/>. I notice that this issue was previously
> > discussed on this list:
> >
> > http://gcc.gnu.org/ml/fortran/2007-05/msg00494.html
> >
> > and the blame for sorting this out placed on libc malloc (via the bug
> > report at:
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24261
> >
> > Has anything changed since this discussion?
>
> No, not that I know of at least.

I had the same problem a while ago (see link above) while working on the 
Cell architecture. It turned out that the -m64 switch solved my Problem. 
If that is not an option and you work on a system which supports 
$LD_PRELOAD or something similar, you could just preload your own 
malloc(), which allocates SIZE+16 Bytes and returns an "allocated" 
pointer. But be carefull, you also need to LD_PRELOAD a modified version 
of free().

Regards,
Timo



More information about the Fortran mailing list