From owner-freebsd-bugs Tue Jul 13 3:51:29 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id B7ACA152AD for ; Tue, 13 Jul 1999 03:51:22 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA49002; Tue, 13 Jul 1999 03:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Tue, 13 Jul 1999 03:50:02 -0700 (PDT) Message-Id: <199907131050.DAA49002@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Sheldon Hearn Subject: Re: bin/12611: /usr/bin/jot crashes with floating point exception Reply-To: Sheldon Hearn Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/12611; it has been noted by GNATS. From: Sheldon Hearn To: frodef@acm.org Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/12611: /usr/bin/jot crashes with floating point exception Date: Tue, 13 Jul 1999 12:46:45 +0200 On Mon, 12 Jul 1999 11:05:07 MST, frodef@acm.org wrote: > >How-To-Repeat: > % jot -r 1 -p 4294967296 > zsh: floating point exception (core dumped) jot -r 1 -p 4294967296 It's not always reproducible because it relies on a random number, which might be small on any given run. However, when it does fail, I get the following: | (gdb) set args -r 1 -p 4294967296 | (gdb) run | Starting program: /usr/bin/jot -r 1 -p 4294967296 | | Program received signal SIGFPE, Arithmetic exception. | 0x804918b in putdata (x=4058183150.1194973, notlast=0) | at /usr/src/usr.bin/jot/jot.c:313 | 313 long d = x; | (gdb) back | #0 0x804918b in putdata (x=4058183150.1194973, notlast=0) | at /usr/src/usr.bin/jot/jot.c:313 | #1 0x804881e in main (argc=5, argv=0xbfbfd680) | at /usr/src/usr.bin/jot/jot.c:106 | #2 0x80486d1 in _start () It looks like a simple assignment from a long to a double. Try the following patch. Ciao, Sheldon. Index: jot.c =================================================================== RCS file: /home/ncvs/src/usr.bin/jot/jot.c,v retrieving revision 1.9 diff -u -d -r1.9 jot.c --- jot.c 1999/05/13 12:18:24 1.9 +++ jot.c 1999/07/13 10:42:06 @@ -310,8 +310,8 @@ double x; long notlast; { - long d = x; - register long *dp = &d; + double d = x; + register double *dp = &d; if (boring) /* repeated word */ printf(format); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message