Date: Wed, 18 Jan 1995 11:06:59 +0000 (GMT) From: Doug Rabson <dfr@render.com> To: "Paul F. Werkowski" <pw@snoopy.MV.COM> Cc: freebsd-hackers@freefall.cdrom.com Subject: Re: old vfprintf bug back again in 2.x Message-ID: <Pine.BSF.3.91.950118110149.3845C-100000@minnow.render.com> In-Reply-To: <199501151945.OAA07055@snoopy.mv.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.950118110149.3845C-100000>