This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fortran, complex types, and STRICT_ALIGNMENT


Steve Kargl <sgk@troutmask.apl.washington.edu> writes:

> On Wed, Jan 12, 2005 at 08:26:54AM -0500, James Morrison wrote:
> >
> > Right now in fortran/iresolve.c it is assumed that complex types can
> > be used in places where integers twice the size of an element in the
> > complex number can be used.
> 
> This sounds odd to me, and may indicate a bug.  Can you be
> more specific with regards to a location where this 
> assumption applies?

 gfc_resolve_transpose is the best example.
 
> As far as alignment and padding, the only requirement 
> in the Fortran standard is that sizeof(REAL) == sizeof(INTEGER)
> and sizeof(COMPLEX) == 2 * sizeof(REAL) for the default
> kinds.

 So, given these sizes and the assumption that complex floats are
8 bytes of consecutive bytes.  The transpose function for 8 byte
integers can be used for 8 byte complex floats as well as 8 byte
integers.  This causes a problem on STRICT_ALIGNMENT platforms where
the alignment of 8 byte integers is 8 byte boundary, but 8 byte complex
floats are only aligned at a 4 byte boundary.

>  AFAIK, the standard does not mandate anything about the
> actual layout in memory.  If sizeof(REAL)=4 bytes, then sizeof(COMPLEX)
> is 8 bytes, but those do not need to be 8 consecutive bytes in
> memory.
> 
> 
> -- 
> Steve


 I'll try upping the alignment for complex types on STRICT_ALIGNMENT
targets to see what results I get.


-- 
Thanks,
Jim

http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]