$ cat common.f program main character*1 c common /foo/ c,r c = 'a' r = 1.2 end $ g77 common.f common.f: In program `main': common.f:3: warning: common /foo/ c,r ^ Initial padding for common block `foo' is 3 bytes at (^) -- consider reorderingmembers, largest-type-size first $ gfortran common.f $ gfortran -v Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,c++,f95 : (reconfigured) ../gcc/configure --prefix=/home/ig25 --with-gcc-version-trigger=/home/ig25/gcc/gcc/version.c --enable-languages=c,c++,f95 --no-create --no-recursion Thread model: posix gcc version 4.0.0 20041129 (experimental)
Just about any Fortran compiler warns about this sort of thing (and they should, the performance penalty for this kind of thing can be severe). -- Summary: warn about common variable alignment problems Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Thomas dot Koenig at online dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18794