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


On Feb 21, 2006, at 6:13 PM, Tobias Schlüter wrote:

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 fortran they will always be the same as for gcc, but a middleend or backend person would have to verify this.

Yikes. Let me re-phrase my question...


Fortran standard aside, are there tests that will work with most/all Fortran compilers? I.e., even though the Fortran standard doesn't make any guarantees, do compilers obey the same/similar conventions such that one test (or a small set of tests) would result in the correct answer?

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.

Similar to above: the standard notwithstanding, are there actually compilers out there that change the alignment of a type based on whether the derived type is sequenced or not? Any idea what an MPI implementation should do in such cases?


--
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/



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