home *** CD-ROM | disk | FTP | other *** search
- From: bobm@hpfcso.FC.HP.COM (Bob Montgomery)
- Date: Fri, 8 Jan 1993 19:14:12 GMT
- Subject: Re: Huge executables from f77 on 750's
- Message-ID: <7371523@hpfcso.FC.HP.COM>
- Organization: Hewlett-Packard, Fort Collins, CO, USA
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!hpfcso!bobm
- Newsgroups: comp.sys.hp
- References: <1993Jan8.143012.13078@informatik.uni-wuerzburg.de>
- Lines: 69
-
- In comp.sys.hp, lemc002@winx03.informatik.uni-wuerzburg.de
- (Franco Trani) writes:
-
- > I've a problem with f77 (what /usr/bin/f77: HPUX Fortran/ 9000s700
- > 09/19/91 B2408 A08.07). Some code I compile on a 9000s433 gives an
- > executable of 336 KB. The same code compiled with the same comp-
- > iler options results in a 29 MB monster on the 750 (it can be com-
- > pressed to a size of ~ 400 KB !).
-
- At 8.07, there are (at least) two causes of unexpectedly large
- FORTRAN executable size.
-
- They occur when using the -K compiler option or when using SAVE. If
- a subroutine with large non-common arrays is compiled -K, *and* that
- subroutine also contains a string literal or a DATA statement, then the
- large arrays will be placed in the initialized data area (and will
- consequently take up space in your executable file).
-
- Example 1:
-
- C This program illustrates the case with a large local array and
- C a string literal (check the effect of -K)
-
- program main
- integer a(100000)
- print *, 'hello', a(1), a(100000)
- end
-
- Example 2:
-
- C This program illustrates the case with a large array and
- C a data statement (check the effect of -K)
-
- program main
- integer a(100000)
- data ii/1000/
- print *, ii, a(1), a(100000)
- end
-
- Compiled without -K on 8.07 (or before), the executable files are 16384
- bytes each. Compiled with -K, they are 413696 bytes each, because the
- files now contain the a(100000) array as an image of 100000 integer
- zeros. This behavior (putting uninitialized saved arrays in the
- initialized data area when the routine contains other initialized data)
- is considered to be a bug, and is fixed in the HP-UX 9.0 release for the
- Series 700.
-
- Besides -K, you can also get this behavior by using "SAVE" in your
- source files. This is also fixed in 9.0.
-
- If you must use -K or SAVE at 8.07, one workaround (as mentioned
- previously, (thanks, Gordon)) is to place the local arrays in a named
- common block instead. As long as nothing in that common block is
- initialized by a DATA statement, that common block will be placed in
- uninitialized data, and will not consume space in the executable file.
- Another workaround is to SAVE only those local variables that must
- retain their values (hopefully not the large array), and then not use -K
- or the global SAVE statement.
-
- And you could always just wait for the 9.0 release (shipping Real Soon if
- not Right Now).
-
- > The object-files are still
- > small, the problem seems to be the linker.
-
- Try looking at the object files with size(1). If the second number
- (initialized data size) is large, you found the file of interest.
-
- Bob Montgomery, HP
-