How to force 16-byte alignment with gfortran?

FX Coudert fxcoudert@gmail.com
Wed May 30 00:59:00 GMT 2007


[cross-posting to gcc-help, we may have other ideas and opinions there]

> Is there a way to tell gfortran to allign all variables and  
> datastructures
> (like arrays) at 16-byte boundaries? Not only the static ones but even
> if I do an ALLOCATE(A(N,M)) I want the start of the array to be on an
> adress whichs last 4 bits are "0000"?

gfortran translates ALLOCATE calls using malloc(), so if your system  
malloc() returns correctly aligned memory, it should work out-of-the- 
box. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24261 for some  
discussion about this.

> Why am I asking this? On the Cell BE architectures the DMA-transfers
> from main memory to the LS of the SPU's must be 16-byte aligned. I am
> writing a library which gets called by Fortran and performs the
> caclulations on the SPU's. So if I want to get the data into the Local
> Stores it has to be 16-byte aligned.




More information about the Gcc-help mailing list