[net.lang.f77] Equivalence problem

sjc@angband.UUCP (Steve Correll) (01/25/85)

Here's an even simpler demonstration of the phenomenon:

	IMPLICIT DOUBLE PRECISION (A-H,O-Z)
	DIMENSION W(10),NW(2)
	EQUIVALENCE (WW,NW(1)),(NQ,NW(2))
C MEMORY MAP OF WW, NW AND NQ
C WORD:		1	2
C WW	 (..............)
C NW     (...1..)(...2..)
C NQ		 (......)
C
	ww=0.0
	NQ=10
	write(*,*)'ww,nw(1),nw(2),nq',ww,nw(1),nw(2),nq
	temp=ww
	ww=temp
	write(*,*)'ww,nw(1),nw(2),nq',ww,nw(1),nw(2),nq
	end

The output is:

  ww,nw(1),nw(2),nq  0.  0  10  10
  ww,nw(1),nw(2),nq  0.  0  0  0

The "-S" option of f77 shows that it uses the "movd" instruction to transfer
"ww" to "temp" and back again. I suspect that this normalizes the floating
point value, bashing your data.
-- 
                                                           --Steve Correll
sjc@s1-c.ARPA, ...!decvax!decwrl!mordor!sjc, or ...!ucbvax!dual!mordor!sjc