Re: The structure contains one or more misaligned fields
- From: Fei Liu <fei.liu@xxxxxxxxx>
- Date: Fri, 04 Apr 2008 15:00:45 -0400
Steve Lionel wrote:
On Fri, 04 Apr 2008 14:17:43 -0400, Fei Liu <fei.liu@xxxxxxxxx> wrote:Hi Steve
The Intel Fortran compiler v10.0.023 makes a lot of noise about this warning when compiling a fairly big Fortran code base. What's the implication of this warning? How to fix it (see P.S. for a sample)? If it's harmless, is there a compile flag to disable this warning?
I see no P.S.
This is telling you that you have defined a derived type or a STRUCTURE with
fields that are at offsets not a multiple of their size. Accessing these
misaligned fields can reduce performance, but is otherwise harmless.
There are multiple ways to disable the warning, depending on what you want to
do. If you simply want to turn them off everywhere, use /warn:noalign
(Windows) or -warn noalign (Linux/Mac). You can also selectively disable this
warning for individual declarations (see documentation of OPTIONS directive).
If this is a derived type (and not a STRUCTURE), it might make sense for you
to add SEQUENCE to the declaration (this won't disable the warning but it is
appropriate if you are sharing this structure with non-Fortran code.)
Of course, if you are able to, it's best to rearrange the components so that
they are naturally aligned. The same goes for laying out variables in COMMON.
For more details, see the Intel Fortran documentation under Optimizing
Applications > Programming Guidelines > Understanding Data Alignment
--
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
Sorry I got distracted by the other gfortran bug thread. I attached the definition (derived type) in another reply. But here is a simpler structure that still causes problem:
type ESMF_Field
sequence
type (ESMF_FieldType), pointer :: ftypep
ESMF_INIT_DECLARE
end type
As you can see this structure has only 2 memebers (ESMF_INIT_DECLARE is a macro and gets translated to
type ESMF_Field
sequence
type (ESMF_FieldType), pointer :: ftypep
integer(8) :: isInit = 76838410
end type
What's troubling is that even something like this causes alignment warnings. And due to interop requirement, we can't rearrange the order of ftypep and isInit in ESMF_Field definition.
Fei
.
- Follow-Ups:
- Re: The structure contains one or more misaligned fields
- From: Steve Lionel
- Re: The structure contains one or more misaligned fields
- References:
- The structure contains one or more misaligned fields
- From: Fei Liu
- Re: The structure contains one or more misaligned fields
- From: Steve Lionel
- The structure contains one or more misaligned fields
- Prev by Date: Re: The structure contains one or more misaligned fields
- Next by Date: Re: Fortran 77 parser
- Previous by thread: Re: The structure contains one or more misaligned fields
- Next by thread: Re: The structure contains one or more misaligned fields
- Index(es):
Relevant Pages
|
|