From owner-freebsd-hackers Wed Jan 18 03:17:24 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id DAA17549 for hackers-outgoing; Wed, 18 Jan 1995 03:17:24 -0800 Received: from minnow.render.com (render.demon.co.uk [158.152.30.118]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id DAA17532 for ; Wed, 18 Jan 1995 03:17:10 -0800 Received: (from dfr@localhost) by minnow.render.com (8.6.9/8.6.9) id LAA03972; Wed, 18 Jan 1995 11:07:00 GMT Date: Wed, 18 Jan 1995 11:06:59 +0000 (GMT) From: Doug Rabson To: "Paul F. Werkowski" cc: freebsd-hackers@freefall.cdrom.com Subject: Re: old vfprintf bug back again in 2.x In-Reply-To: <199501151945.OAA07055@snoopy.mv.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: hackers-owner@FreeBSD.org Precedence: bulk On Sun, 15 Jan 1995, Paul F. Werkowski wrote: > > > A bug that was lurking in lib/libc/stdio/vfprintf.c prior to FreeBSD 1.1 > is now again hiding in the 2.0 and -current source. The bug is demonstrated > by this code: > > > > int main() > { > int FPRC = 16; > double d = 0; > printf( "%*.*e\n",FPRC+7,FPRC,d); > } > > which results in > 0e+00 > > instead of the correct > 0.0000000000000000e+00 > > This breaks the AKCL (now GCL) compile/load feature. > > I looked at the considerable differences between the 1.1 and 2.0 versions > of vfprintf and think I have reproduced the previous fixes. At least the > modified version passes the GCL test. Perhaps some official bug fixer can > look at this and commit to current /usr/src/lib/libc/stdio/? > > Paul > > [patch deleted] I looked into this and I believe that this patch does the same job: *** /usr/src/lib/libc/stdio/vfprintf.c Fri May 27 05:57:31 1994 --- vfprintf.c Mon Dec 19 16:46:42 1994 *************** *** 507,512 **** --- 507,514 ---- prec = (prec == -1) ? DEFPREC + 1 : prec + 1; /* FALLTHROUGH */ + if (prec != 0) + flags |= ALT; goto fp_begin; case 'f': /* always print trailing zeroes */ if (prec != 0) It certainly helps GCL anyway. Unless you have any objections, I will commit this smaller patch as it seems to be a bit less intrusive. -- Doug Rabson, RenderMorphics Ltd. Mail: dfr@render.com Phone: +44 71 251 4411 FAX: +44 71 251 0939