Date: Tue, 13 Jul 1999 03:50:02 -0700 (PDT) From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/12611: /usr/bin/jot crashes with floating point exception Message-ID: <199907131050.DAA49002@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/12611; it has been noted by GNATS.
From: Sheldon Hearn <sheldonh@uunet.co.za>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907131050.DAA49002>
