Subject: first 'interesting' patch to NetBSD/alpha...
To: None <port-alpha@NetBSD.ORG>
From: Chris G Demetriou <Chris_G_Demetriou@LAGAVULIN.PDL.CS.CMU.EDU>
List: port-alpha
Date: 02/25/1995 06:33:36
i've fixed the problem that caused diff to croak; apply the patch
below to src/lib/libc/arch/alpha/gen/divrem.m4, recompile/install
libc, and recompile diff.  it probably affects other programs, as
well.  i've now run 3.5+ _gigs_ of random numbers through the division
and remainder functions, and diffed the results against OSF/1's
versions, so there should be no more of these problems in the future.  8-)

It's been applied to the NetBSD master sources; I'm sending it to this
list for the use of people who will be using my private snapshots, and
aren't on my private mailing list yet.  Here, it'll be archived.  8-)



chris
===================================================================
RCS file: /usr/users/cgd/NetBSD/cvs/src/lib/libc/arch/alpha/gen/divrem.m4,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 divrem.m4
*** 1.1.1.1	1995/02/14 23:15:58
--- divrem.m4	1995/02/25 03:10:22
***************
*** 84,90 ****
  	/* B is definitely negative, no matter how we got here. */
  	subq	zero, B, B
  Ldoit:
! ')
  
  	/* kill the special cases. */
  	beq	B, Ldotrap			/* division by zero! XXX */
--- 84,98 ----
  	/* B is definitely negative, no matter how we got here. */
  	subq	zero, B, B
  Ldoit:
! ', `
! ifelse(WORDSIZE, `32', `
! 	/*
! 	 * Clear the top 32 bits of each operand, as the compiler may
! 	 * have sign extended them, if the 31st bit was set.
! 	 */
! 	zap	A, 0xf0, A
! 	zap	B, 0xf0, B
! ')' )
  
  	/* kill the special cases. */
  	beq	B, Ldotrap			/* division by zero! XXX */
***************
*** 164,169 ****
--- 172,180 ----
  Ldotrap:
  	CONST(-2, a0)			/* This is the signal to SIGFPE! */
  	call_pal PAL_gentrap
+ ifelse(OP, `div',
+ `', `	mov	zero, A			/* so that zero will be returned */
+ ')
  	br	zero, Lret_result
  
  END(NAME)