[Prev][Next][Index][Thread]
Bugs in IEFBR14
---- Forwarded Mail
Article 3326 of net.unix:
ion: version B 2.10.2 9/18/84; site masscomp.UUCP
From: [email protected] (Andrew Klossner)
Newsgroups: net.unix
Subject: Bugs in IEFBR14
Date: 28 Dec 84 02:01:47 GMT
Organization: Tektronix, Wilsonville OR
This has nothing to do with Unix, but traffic is light over Christmas
...
IEFBR14, if written as the obvious, single-instruction program " BR 14",
does not work.
Reason: It fails to set a proper value for its return code, which means
that
it may fail mysteriously. An entertaining rumor has it that this bug
actually existed in IEFBR14 once. But don't get too cocky--the same bug
also
exists in the UNIX world, since many C programs terminate by falling out
the
bottom of the main program and most C startup routines simply take
whatever
garbage return value this produces as the exit status of the program.
Under OS/360, the location for the exit status is register 15. The
calling
convention for all procedures (including the main program) is that
register
15 be loaded with the program's start address. This helps the procedure
get
started in finding itself, since a program can be loaded anywhere in
memory
and there is no Unix-style relocation going on. A program cannot use
absolute addressing, and so all addressing is done through an index
register. (Some programs use the supplied value in register 15;
otherwise
use the instruction "BALR reg,0" -- Branch And Link Register (subroutine
call), but destination 0 means don't branch -- to load the current PC
into
reg.)
The result was that IEFBR14 returned its start address as its status.
Since
a program is never loaded to location 0, the status was never 0, and so
the
program never succeeded.
-- Andrew Klossner (decvax!tektronix!orca!andrew) [UUCP]
(orca!andrew.tektronix@csnet-relay) [ARPA]
---- End of Forwarded Mail
Carl Hommel
http://www.notelrac.com/notelrac/