Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site elsie.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!decvax!harpo!ihnp4!houxm!hogpc!houti!ariel!vax135!floyd!cmcl2!seismo!rlgvax!cvl!elsie!ado From: ado@elsie.UUCP Newsgroups: net.bugs.4bsd Subject: asin a la "-lnm" clobbers registers (with fix) Message-ID: <925@elsie.UUCP> Date: Mon, 21-May-84 16:45:49 EDT Article-I.D.: elsie.925 Posted: Mon May 21 16:45:49 1984 Date-Received: Fri, 25-May-84 00:48:09 EDT Organization: NIH-LEC, Bethesda, MD Lines: 35 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