http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50273

             Bug #: 50273
           Summary: [4.5/4.6/4.7 Regression] -Walign-commons no longer
                    effective
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Motivated by the thread:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1f5e2018f744e5c6


With gfortran 4.4, one got the warning:

  common /global_var/ a, b, c
                     1
Warning: COMMON 'global_var' at (1) requires 3 bytes of padding at start;
reorder elements or use -fno-align-commons


However, with gfortran 4.5/4.6/4.7, it compiles without warning - not even with
-Walign-commons


Note: In 4.5 there was a change in how padding works. Before, the padding was
added before the "too short" variable, now it is added after the variable. The
advantage is a better compatibility with C struct and for common blocks of
different length in different scopes (which is valid for blank commons).
Cf. http://gcc.gnu.org/gcc-4.5/changes.html#Fortran

I assume that this change broke the test.

Example (cf. link for a longer, C+Fortran example):

subroutine test()
   character :: a
   integer   :: b
   character :: c
   common /global_var/ a, b, c
   print *, a, b, c
end subroutine test

Reply via email to