Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!ut-emx!chpf127 From: chpf127@ut-emx.UUCP (John W. Eaton) Newsgroups: comp.lang.fortran Subject: Re: compiling equivalence statements ... Summary: No need for extra storage! Message-ID: <14674@ut-emx.UUCP> Date: 29 Jun 89 19:31:01 GMT References: <2679@cveg.uucp> <4128@ima.ima.isc.com> Distribution: usa Organization: The University of Texas at Austin, Austin, Texas Lines: 44 In article <4128@ima.ima.isc.com>, (John R. Levine) writes: > In article <2679@cveg.uucp>, (Scott Alan Stuff) writes: > > dimension stf (12,3) > > equivalence (is1,stf(3)) > > This is a wart in F66 that they took out of F77, although most F77 > compilers continue to accept it. In F66 equivalence statements you > could either give a normally subscripted reference or you could use > a single subscript and it would act as though it was a singly > dimensioned array of the same size. To make it work, try something > like this: > > dimension stf (12,3) > dimension xstf (12*3) > equivalence (stf,xstf) > equivalence (is1,xstf(3)) Yikes! There's no need for extra storage here, since stf(3) (if it actually was a singly subscripted array) is guaranteed to be the same as stf(3,1). Assuming that this is what the original programmer intended,% just use dimension stf(12,3) equivalence ( is1, stf(3,1) ) Also, if is1 is of type integer and stf is of type real, this program is not strictly legal, but will probably work on many machines that use the same number of bits for integer and real variables. If you get the thing to compile and it gives you mysterious results, this may be the source of some of your errors. % If this is not what was intended, you've probably got a bigger mess on your hands than you realize :-). P.S. to Scott: I tried to send mail to you but it just bounced back. -- John Eaton chpf127@emx.utexas.edu Department of Chemical Engineering The University of Texas at Austin Austin, Texas 78712