reorder elements or use -fno-align-commons

William B. Clodius wclodius@los-alamos.net
Tue Jan 20 05:52:00 GMT 2009


On Jan 19, 2009, at 4:42 PM, Jack Howarth wrote:

>  What exactly are the implications of warnings like...
>
>    Included at xadc.f:785:
>
>      COMMON /IXADC1/  EXPXADCPTRS,
>                     1
> Warning: COMMON 'ixadc1' at (1) requires 4 bytes of padding at  
> start; reorder elements or use -fno-align-commons
> xadc.fcm:75.21:
>
> ...from current gcc trunk. I see a number of these warnings when  
> compiling xplor-nih
> but they don't seem to be associated with any regressions. Do these  
> warnings imply a
> possible wrong-code generation because of the incorrect alignment or  
> just a suboptimal
> ability for gfortran to do code optimizations? Thanks in advance for  
> any clarifications
> on this warning.
>          Jack
>
In this case it implies a suboptimal use of storage. Generally every  
data type has an optimal alignment, such that not placing an object of  
that type at an aligned memory location has a substantial performance  
impact. For the intrinsic Fortran data types this alignment is  
typically a multiple of the size of the data type. In order to ensure  
efficient operation, padding (unused small regions of memory) can be  
used to align larger objects. The default in Fortran compilers is  
typically to optimize performance and not memory usage. The semantics  
of common blocks is such that (baring whole program optimization) the  
objects must be laid out in sequence. Further some common abuses of  
common blocks assume no padding between objects in the block, and by  
default all compilers avoid inserting such padding. In any event you  
will typically get the optimal combination of performance and memory  
usage if the objects in the block are in the order largest to  
smallest. This message indicates that you have smaller objects before  
a larger object, and the compiler is inserting padding a the start so  
that larger object is properly aligned for optimal performance.



More information about the Fortran mailing list