I'm working with a legacy + academic + numerical fortran-77 code that requires g77 3.2.x in order to compile and run successfully ... I'm using that compiler on Red Hat Linux 9 for i386
One of those fortran-77 files defines a subroutine with lots of real, integer, and double precision arrays as local variables ... if I compile it using:
$ g77 -c thefile.F -o thefile.o
it produces an object file of size around 10kB ... but the following:
$ g77 -finit-local-zero -c thefile.F -o thefile.o
produces an object file of size 14MB
I tried strip
'ing the object file but the size doesn't change much
a couple dozen such files in the code and the executable binary ends up being 200MB in size
Any idea about what's going on? more importantly what can I do to get back to saner object/binary sizes?
P.S.: when I compressed the 200MB binary into tar.gz, the tarball was under 1 MB ... means probably the 200MB is full of 0's or something (I could open it in a hex-editor but i'm feeling too lazy right now)
P.S.: the compiler details are given below (using the -v flag of g77)
$ g77 -v -finit-local-zero -c thefile.F -o thefile.o
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/tradcpp0 -lang-fortran -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ thefile.F /tmp/ccXXvzMA.f
GNU traditional CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771 /tmp/ccXXvzMA.f -quiet -dumpbase thefile.F -version -finit-local-zero -o /tmp/cck0Blw1.s
GNU F77 version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
as -V -Qy -o thefile.o /tmp/cck0Blw1.s
GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version 2.13.90.0.18 20030206
EDIT: newer g77/gfortran versions don't have that problem (object file size stays almost the same with -finit-local-zero) but I can't use them (making the code produce correct results with latest compiler versions would be a project in itself) ... and I need the -finit-local-zero flag (code hangs without it)
EDIT 2: I took a hex dump and sure enough 99% of the file consists of zeros!
From the on-line documentation:
http://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html
A: Yup. Sounds like you've answered your own question :)