Oversized module object files on Mac OSX
Adrian Turner
akt@cpom.ucl.ac.uk
Mon Aug 20 13:43:00 GMT 2007
Dear gfortran mailing list,
I am using gfortran on a Mac OSX to compile a program that has many
modules which declare fixed size arrays. The resulting object files are
the same size as the declared array, which makes the executable
enormous. Below is an example:
program test
real, dimension(1000) :: a
end program test
gfortran test.f90 -o test.exe
This compiles fine with the size of the executable independent of the
size of the declared array. There are problems with the following module:
module test_module
real, dimension(1000) :: a
end module test_module
gfortran -c test_module.f90
The size of the test_module.o object file in this case includes the
memory allocation for the variable. e.g. if the array size is 10000000
then the size of test_module.o is 40000356 bytes. This doesn't happen
with the other fortran compilers I use. Is there any way to prevent this
from happening?
akt% uname -a
Darwin m21.cpom.ucl.ac.uk 8.10.0 Darwin Kernel Version 8.10.0: Wed May
23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh
powerpc
akt% /opt/local/bin/gfortran -v
Using built-in specs.
Target: powerpc-apple-darwin8.10.0
Configured with: ../gcc-4.2.1/configure --prefix=/opt/local
--enable-languages=c,c++,java,objc,obj-c++,fortran
--libdir=/opt/local/lib/gcc42 --includedir=/opt/local/include/gcc42
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--disable-multilib --program-suffix=-mp-4.2
--with-gxx-include-dir=/opt/local/include/gcc42/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local
Thread model: posix
gcc version 4.2.1
Regards,
Adrian Turner
Centre for Polar Observation and Modelling
University College London
More information about the Fortran
mailing list