This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Type Alignment


Jeff Squyres wrote:
> Here's what we need:
> 
> 1. What is a reliable / correct test to determine the alignment of a  
> Fortran type?  (I don't care a whit about the previous tests -- if  
> they're wrong, we'll throw them out)

Portably, there isn't.  Fortran doesn't make any guarantees.  I believe for
gfortran they will always be the same as for gcc, but a middleend or backend
person would have to verify this.

> 2. Will this alignment be the same between compatible Fortran 77 and  
> Fortran 90 compilers?  (e.g., compilers of the same vendor/version,  
> or, in a trivial case, using the same "gfortran" to compile f77 and  
> f90 compilation units)

Yes, it's the same compiler after all.

> 3. Am I reading these replies correctly that the *alignment* of a  
> type may change depending on whether a derived type is sequenced or  
> not?  I can understand how members might be re-ordered in memory by  
> the compiler (and that's not a problem for us), but can it really  
> change the datatype's alignment?  If so, this could be a Big Problem  
> for us.

In principle yes.  Again, the Fortran standard doesn't make any guarantees
about this.

- Tobi


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