Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!NAC.NO!finnd%vax.runit.unit.uninett From: finnd%vax.runit.unit.uninett@NAC.NO (Finn Drablos) Newsgroups: comp.sys.sgi Subject: f77 -O bug Message-ID: <55*finnd@vax.runit.unit.uninett> Date: 17 Aug 89 12:21:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 38 I have a fortran program where file names are made in several steps, mainly in order to create unique file names. The following short test program shows how it is done. ================== program string c Short program to test -O optimization in f77 character*25 line character*10 name c i0 = ichar('0') i = 1 name = 'filename' iend = 8 c line = 'FILE '//name(1:iend)//'.ext.'//char(i0+i) write(*,*) line stop end ================== If I compile this program with f77, the output is 'FILE filename.ext.1'. However, if I use f77 -O the output is 'FILE filename.ext.', and my filename is not unique. Of course, the solution is to compile without the -O option. I don't know if I trust the global optimization any more .... ================== Finn Drablos PHONE +47 7 597710 FAX +47 7 597708 MR-Senteret, SINTEF MHS(EAN) : finnd@vax.runit.unit.uninett N-7034 TRONDHEIM, NORWAY EARN/BITNET : drabloes@norunit ----------------------------------------------------------------------- ==================