Common Bug 7, Problem identified

	SUBROUTINE calcup(vector)
$$INCLUDE 'C$INC:BCS.INC'
$$INCLUDE 'YBOS$LIBRARY:ERRCOD.INC'
	REAL vector(6)	! array to be processed
	INTEGER wbank	! YBOS work bank creator
	INTEGER wdrop	! YBOS work bank dropper
	INTEGER windex	! work bank index
	INTEGER offset	! offset halfway into work bank
	INTEGER status	! error return status
	INTEGER i,j	! DO loop indices
C.................................

	status = wbank(iw, windex, 240)
	IF(status .NE. yesucc) RETURN	! defeated
	offset = windex + 120	!!!!!!!!!<<-------------DANGEROUS!
	CALL getbnk(windex, offset)	! find JETS and load
					! eta in low half and
					! phi in high half of
					! work bank
	DO 1 i = 1, 40
	 DO 2 j = 1, 3
	 vector(j) = vector(j)+rw(windex+1+i+(j-1)*40)
	 vector(3+j) = vector(3+j) + TAN(rw(offset+1+i+(j-1)*40))
2	CONTINUE
1	CONTINUE

	status = wdrop(iw, windex, 1)
	RETURN
	END

The problem here is that the work bank index is dynamic. YBOS can and will do work-bank garbage collection behind your back. If something in `getbnk' sparks a garbage collection, the word containing `windex' will be automatically updated. The word containing `offset' will not. There are two choices: rewrite `getbnk' to accept one argument (not always possible), or generate two work banks.

This is a source of nasty intermittent errors, which can be very hard to trace. Worst of all, it may stomp on somebody else's chunk of YBOS, causing problems in routines you know nothing about.

BACK to YBOS , Look Again, Bug 8