This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Alignment of gfortran allocated arrays
- From: Tim Prince <tprince at computer dot org>
- To: John Travers <jtravs at gmail dot com>
- Cc: Fortran List <fortran at gcc dot gnu dot org>
- Date: Thu, 16 Aug 2007 18:55:24 -0700
- Subject: Re: Alignment of gfortran allocated arrays
- References: <3a1077e70708140833g34e5b6eeqe8d4167f1ed730a1@mail.gmail.com>
John Travers wrote:
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? It didn't sound like the
libc guys were going to
change the default malloc behaviour. Has a compile switch been added
to ask for this or
perhaps an extension to gfortran to use one of the alternatives to
malloc which allows
alignment (posix_memalign or memalign)? If not, could one possibly be
added (I'll even try and
make up a patch, though I know nothing of gfortran internals and so it
may take me a while).
Basically is this issue likely to be solved or has it been solved in a
neat and official way, or
shall I go ahead and try and hack to get what I want.
malloc() hardly qualifies as a gfortran internal. It has been around
since long before gfortran or SSE. The 32-bit glibc malloc(), if that's
what you're discussing, is likely to continue as it has been for over 10
years, supporting double precision but not SSE objects. Note that
gfortran runs on a lot of systems besides those which depend on 32-bit
glibc, so if that is your world, you might clarify your posts by so
stating. As there aren't any more CPUs manufactured which don't support
64-bit OS, you might take into account that many of us use 64-bit. Not
so many years ago, people scoffed at the idea that g77 could support
even 8-byte alignments on certain 32-bit platforms. Extensions such as
_mm_malloc() (not at all portable) and aligned_malloc() arose as a
result, and probably have to be taken into account by people who build
fftw for the associated targets. It might be valuable to include
malloc wrappers for 32-bit gfortran to make the allocations 16-byte
aligned, but I am only guessing that might be what you are getting at.
We continue to have trouble in 32-bit applications which use mixed
Fortran and C, being unable to sort out where the less-than-16-byte
alignments arise.