NetBSD Problem Report #10065
Received: (qmail 15797 invoked from network); 7 May 2000 23:24:02 -0000
Message-Id: <200005072323.IAA02026@icnmp9.icg.tnr.sharp.co.jp>
Date: Mon, 8 May 2000 08:23:33 +0900 (JST)
From: itohy@netbsd.org
Reply-To: itohy@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: __divq(0x8000000000000000, 1) dies with SIGFPE
X-Send-Pr-Version: 3.95
>Number: 10065
>Category: port-alpha
>Synopsis: __divq(0x8000000000000000, 1) dies with SIGFPE
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-alpha-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 07 23:25:00 +0000 2000
>Closed-Date: Mon Jan 21 23:45:49 +0000 2002
>Last-Modified: Mon Jan 21 23:45:49 +0000 2002
>Originator: ITOH Yasufumi
>Release: 1.4X (April 28, 2000)
>Organization:
>Environment:
System: NetBSD libble.my.domain 1.4X NetBSD 1.4X (LIBBLE) #2: Mon May 1 01:01:21 JST 2000 itohy@libble.my.domain:/usr/src/sys/arch/alpha/compile/LIBBLE alpha
>Description:
__divq(0x8000000000000000, 1) causes SIGFPE
(note that __divq is not a normal function).
This causes failure on "make test" of gforth-0.4.0.
>How-To-Repeat:
Try following program.
% cc divqtest.c
% ./a.out
Floating point exception (core dumped)
%
Any combinations of arg1 and arg2 (!= 0) other than
0x8000000000000000 and 1 seem to work fine.
divqtest.c:
#include <stdio.h>
main()
{
register long arg1 asm("$24") = 0x8000000000000000;
register long arg2 asm("$25") = 1;
register long result asm("$27");
/*
* t10($24) / t11($25) -> t12($27)
* return addr is t9($23), not ra($26)
*/
asm("jsr $23,__divq" : "=r" (result) : "r" (arg1), "r" (arg2));
printf("result %lx\n", result);
return 0;
}
>Fix:
Do not raise interger overflow exception.
diff -u lib/libc/arch/alpha/gen/divrem.m4.orig lib/libc/arch/alpha/gen/divrem.m4
--- lib/libc/arch/alpha/gen/divrem.m4.orig Thu Oct 17 20:12:22 1996
+++ lib/libc/arch/alpha/gen/divrem.m4 Tue May 2 23:34:55 2000
@@ -171,7 +171,7 @@
ifelse(S, `true',
`
/* Check to see if we should negate it. */
- subqv zero, RESULT, T_0
+ subq zero, RESULT, T_0
cmovlbs NEG, T_0, RESULT
')
diff -u sys/lib/libkern/arch/alpha/divrem.m4.orig sys/lib/libkern/arch/alpha/divrem.m4
--- sys/lib/libkern/arch/alpha/divrem.m4.orig Thu Oct 17 20:21:07 1996
+++ sys/lib/libkern/arch/alpha/divrem.m4 Tue May 2 23:34:55 2000
@@ -171,7 +171,7 @@
ifelse(S, `true',
`
/* Check to see if we should negate it. */
- subqv zero, RESULT, T_0
+ subq zero, RESULT, T_0
cmovlbs NEG, T_0, RESULT
')
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: ross
State-Changed-When: Mon Jan 21 15:45:08 PST 2002
State-Changed-Why:
Patch from itohy applied; it works fine.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.