Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!fauern!opal!mailgzrz!w414zrz!jaenicke From: jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) Newsgroups: comp.sys.apollo Subject: Re: Problems with Fortran-Compiler Message-ID: <262@mailgzrz.tu-berlin.de> Date: 27 Feb 91 13:20:39 GMT References: <250@mailgzrz.tu-berlin.de> <4ff9d7df.3593b@digital.sps.mot.com> Sender: news@mailgzrz.tu-berlin.de Organization: TUBerlin Lines: 64 Nntp-Posting-Host: w414zrz.ee.tu-berlin.de In article hanche@imf.unit.no (Harald Hanche-Olsen) writes: >In article <4ff9d7df.3593b@digital.sps.mot.com> chen@digital.sps.mot.com (Jinfu Chen) writes: > > In article <250@mailgzrz.tu-berlin.de> jaenicke@w414zrz.zrz.tu-berlin.de (Lutz Jaenicke) writes: > > [ Description of large FORTRAN arrays filling up the executable ] > > I noticed similar situation with cc6.7. It turns out when a large size of > static variable is declared (large array), the executable is filled. Then I > found out a compiler switch -compress in /com/cc (-W0,-compress in /bin/cc) > which works quite well. > > Checking over ftn.hlp and man f77 I couldn't find similar switch. Maybe > someone knows FORTRAN could help? > >One common way to deal with large arrays in FORTRAN is the following: >Make your FORTRAN main program a subroutine, then write a tiny C >routine main() that allocates the array using malloc() and then passes >the resulting pointer to the FORTRAN program. This has the added >advantage that you could specify the amount of storage on the command >line. > During the last days i tried several combinations of compiler and linker switches and i found some strange way to reduce the size of the executable files. Since the LOCAL variables are allocated on the stack, i declared my PROGRAM blocks to be subroutines and wrote a new PROGRAM block which is just one line with a call. The variables are declared in the SUBROUTINE and like "abracadabra" the filesize is minimized: Normal CODE: NEW CODE: program test program test1 real (large_number),... call test() ... end c subroutine test() real (large_number),... ... The Compiler does argue about an exceeded stack_size, but declaring a larger stack using "-A stacksize,hexnum" ld-switch ore just linking as before doesn't make any difference. The program is running well (but may be i'm naive and the program crash will occure some minutes after i posted this information). BTW, i found another problem with the fortran compiler: When i do use the "#include"-Statement and use the sourcefile with .F extension, preprocessing is performed well, but the ftn-compiler will not process the file, because some lines "#..." are left. I have to trick ftn by -W0,-inline,# (is Ok, because it was easy to rewrite the sources, so there is no other "#"-sign left). Under SR10.2 there were none of these problems at all. Since "ld" is new (Jul 2 1990 ld) and "f77" is new (Jul 27 1990 f77), the question is left, if the above mentioned points are new FEATURES ore if there is a new compiler version, which we will need soon. Lutz Jaenicke, TU-Berlin, Institut fuer Elektrische Maschinen jaenicke@w414zrz.ee.tu-berlin.de ----