Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26744 Discussions

Warning #6379: The structure contains one or more misaligned fields

chauvjo
Beginner
344 Views

The following derived type definition generates the warning: warning #6379: The structure contains one or more misaligned fields

 type table_format   
      sequence         
      real(kind=dp), dimension(:), ALLOCATABLE :: array_data     

      real(kind=dp)    :: aa              
      real(kind=dp)    :: bb     
      real(kind=dp)    :: cc      

      integer(kind=i4) :: nn   
      integer(kind=i4) :: kk      
      integer(kind=i4) :: jj       

      character(len=52) :: title                                                 
                                        
   end type table_format

Can someone explain how to align the fields of this derived type?  Does the use of the keyword "sequence" provide a performance benefit by storing all the derived type elements in adjacent memory location or do I not understand how to use sequence? In other words, should I not be using sequence?

Thanks....

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
344 Views

The problem here is that the descriptor for the allocatable array isn't a multiple of 8 bytes, so it causes the real(dp) components to be misaligned when compiled for 32-bits.

Move that component to after the real and integer components.

Don't use SEQUENCE - it hurts performance in some cases by preventing the compiler from naturally aligning the components.

Reply