COMMON requires 4 bytes of padding at start

Janus Weil jaydub66@googlemail.com
Fri Sep 12 11:44:00 GMT 2008


>> Testing for regressions now.

The only testsuite failure was "common_5.f", which is just a test for
the "padding"-warning.


> there are platforms where the padding is required, as unaligned accesses to,
> say, real*8 are forbidden.  I believe Sparc is one of them.  On such
> platforms this can't be made the default.
>
> In general, I think we should strive for compatibility with g77 by default.
>  People have been using C structures to interoperate with COMMONs for a long
> while, we should try not to break their code.

I don't mind leaving the default behavior as it is, and only
introducing an additional flag, for compatibility's sake.
Btw g77 gives an *error* for Tobi's test case (not just a warning),
with a much more helpful error message:

common2.f: In program `prog':
common2.f:4:
          common /foo/ n1,n2(2),n3,n4
                  1
common2.f:12: (continued):
          common /foo/ n1,r1,n2,n3
                  2
Initial padding for common block `foo' is 4 bytes at (2) but 0 bytes
at (1) -- consider reordering members, largest-type-size first

Cheers,
Janus



More information about the Fortran mailing list