🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #6427

Re: Strange EQUIVALENCES and data inits

#6427
From: David M. McQueen
Date: Wed, 14 Feb 1990 20:54
99 lines
3719 bytes
/* acf4:comp.lang.fortran / morgan@ms.uky.edu (Wes Morgan) /  3:02 pm  Feb 12, 1990 */

> I am attempting to port the PD MATLAB package to a 3B20 with f77.
> The following chunk of code refuses to compile:
> 
>       DOUBLE PRECISION MASK(14),XX,MM
>       real mas(2,14)
>       equivalence (mask(1),mas(1))
>       data mas/
>      $ z'ffffffff',z'fff0ffff',
>      $ z'ffffffff',z'ff00ffff',
>      $ z'ffffffff',z'f000ffff',
>      $ z'ffffffff',z'0000ffff',
>      $ z'ffffffff',z'0000fff0',
>      $ z'ffffffff',z'0000ff00',
>      $ z'ffffffff',z'0000f000',
>      $ z'ffffffff',z'00000000',
>      $ z'fff0ffff',z'00000000',
>      $ z'ff00ffff',z'00000000',
>      $ z'f000ffff',z'00000000',
>      $ z'0000ffff',z'00000000',
>      $ z'0000fff0',z'00000000',
>      $ z'0000ff80',z'00000000'/
> 
> My errors have been "initializing noncharacter datum with a character
> string" and "invalid types in initialization".
> 
> It would appear that the original author is trying to force bit patterns
> into a real array.  My first attempt was to change the equivalence args
> to (mask(1),mas(1,1)); that crashed and burned.  My second thought was 
> to redefine mas as character*32, rather than real. That, too, bit the
> dirt.
> 
> Could some fortran wizard out there kindly fill me in on
>    a) What the author is *really* attempting to do here, and
>    b) How to make the f77 compiler swallow this mess? 
> 
> Many thanks,
> Wes Morgan
> 
> 
> -- 
>   The opinions expressed above are not those of UKECC unless so noted.
> Wes Morgan                 \       {rutgers,rayssd,uunet}!ukma!ukecc!morgan
> University of Kentucky      \   or morgan@engr.uky.edu
> Engineering Computing Center \  or morgan%engr.uky.edu@UKMA.BITNET
> /* ---------- */

I have tried your code on several machines here at NYU's Academic Computing
Facility, each purporting to use f77. I added a small loop below your data
statement to see what appears to be stored in MASK:

      do 100 k=1,14
      write(6,*) MASK(k)
  100 continue

On 3 out of 5 machines, the code compiles and then executes. On two of those
3 (Sun-3, IRIS 4D80GT) the same answers result:
 -NaN              
 -NaN              
 -NaN              
 -NaN              
 -NaN              
 -NaN              
 -NaN              
 -NaN              
 -NaN              
   -5.8290015911177+303
   -3.2990979849457+231
    1.3906499416091-309
    1.3903316422404-309
    1.3879550069546-309

and on the third (a VAX running BSD 4.3):
  -1.7014118346047d+38
  -1.7014118346047d+38
  -1.7014118346046d+38
  -1.7014118346031d+38
  -1.7014118345799d+38
  -1.7014118342086d+38
  -1.7014118282664d+38
  -1.7014117331926d+38
  -1.7014102120119d+38
  -1.7013858731204d+38
  -1.7009964508560d+38
  -1.6947656946258d+38
  -1.5950735949419d+38
  -8.5070591730235d+37

On the fourth machine, (an Astronautics ZS2), execution hangs after printing
three lines of output.

On the fifth (a Stardent, the result of Stellar and Ardent merging),
compilation fails with the error message:

line 5: Error: Syntax Error at "'ffffffff'"

I don't know specifically which vendors have supplied the f77's for each of
my machines, but clearly the results are 'system-dependent'.
Technical Details
Message-ID: <13160004@acf4.NYU.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!acf4!mcqueen
References: <14121@s.ms.uky.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!acf4!mcqueen
From: mcqueen@acf4.NYU.EDU (David M. McQueen)
Newsgroups: comp.lang.fortran
Subject: Re: Strange EQUIVALENCES and data inits
Message-ID: <13160004@acf4.NYU.EDU>
Date: 14 Feb 90 20:54:00 GMT
References: <14121@s.ms.uky.edu>
Organization: New York University
Lines: 99