Re: Warning: The structure contains misaligned fields
- From: Steve Lionel <Steve.Lionel@xxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 15:24:06 -0400
On Mon, 28 Apr 2008 11:06:45 -0800, glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
wrote:
I thought that padding was allowed, though. COMMON in Fortran 66
was usually believed not to allow padding, creating alignment
problems fairly often. C struct definitely allows padding, which
is good because many current processors don't allow misaligned
access. (IA32 does, but it is often much slower.)
Doesn't COMMON now allow for padding?
Only to the length of a "storage unit" if you still want to meet the letter of
the standard.
If SEQUENCE types work with C interoperability they better
use the same padding that is used by the appropriate C compiler.
A type can be either SEQUENCE or BIND(C) - it can't be both. A type with
BIND(C) is supposed to have exactly the same memory layout that the
corresponding C compiler would use.
SEQUENCE types may or may not be padded, depending on the implementation and
options. The Intel compiler does not pad SEQUENCE types by default, but
padding is available through a switch.
Before BIND(C), SEQUENCE would be recommended for sharing structures with C.
Now one would prefer BIND(C).
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH
For email address, replace "invalid" with "com"
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran
.
- Follow-Ups:
- Re: Warning: The structure contains misaligned fields
- From: glen herrmannsfeldt
- Re: Warning: The structure contains misaligned fields
- References:
- Warning: The structure contains misaligned fields
- From: blitheli
- Re: Warning: The structure contains misaligned fields
- From: Gordon Sande
- Re: Warning: The structure contains misaligned fields
- From: blitheli
- Re: Warning: The structure contains misaligned fields
- From: Craig Powers
- Re: Warning: The structure contains misaligned fields
- From: jamesgiles@xxxxxxx
- Re: Warning: The structure contains misaligned fields
- From: glen herrmannsfeldt
- Warning: The structure contains misaligned fields
- Prev by Date: Re: Warning: The structure contains misaligned fields
- Next by Date: Re: RESULT attribute not working
- Previous by thread: Re: Warning: The structure contains misaligned fields
- Next by thread: Re: Warning: The structure contains misaligned fields
- Index(es):
Relevant Pages
|