asin a la "-lnm" clobbers registers (with fix)
ado at elsie.UUCP
ado at elsie.UUCP
Tue May 22 06:45:49 AEST 1984
The version of "asin" in the "new math library" clobbers registers 8 and 9.
To see the problem, compile the program below with the "-lnm" option:
main()
{
register i, j, k, l, m, n;
extern double asin();
i = j = k = l = m = n = 0;
(void) printf("BEFORE: %2d %2d %13d %13d %2d %2d\n",
i, j, k, l, m, n);
(void) asin(0.5);
(void) printf("AFTER: %2d %2d %13d %13d %2d %2d\n",
i, j, k, l, m, n);
}
The output (on our system) is:
BEFORE: 0 0 0 0 0 0
AFTER: 0 0 -333275642 -1197620649 0 0
To fix the problem, redo /usr/lib/libnm.a after replacing the line in
"/usr/src/lib/libnm/asin.s" that reads
.word 0x0c0
with the following eight lines:
#
# Since we may branch to satan,
# we get to save registers that IT clobbers
# as well as registers that we clobber.
# So we change the old
# .word 0x0c0
# to
.word 0x03c0
--
...decvax!allegra!umcp-cs!elsie!ado (301) 496-5688
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list