Bug in vfprintf?

J. Johnston jjohnstn@redhat.com
Mon Feb 3 17:16:00 GMT 2003


I found a problem.  My fix was using ndigits instead of
orig_ndigits for the "%g" format.  A revised patch is attached.

-- Jeff J.

Jason Tishler wrote:
> Jeff,
> 
> On Fri, Jan 31, 2003 at 07:56:05PM -0500, J. Johnston wrote:
> 
>>Ok, another patch for you.
> 
> 
> The attached patch fixes my most recently reported problems with "%f"
> formatting.  However, my previously reported problem with:
> 
>     "%#.109g", -3333333333333333371313292264111748921061485000000.0
> 
> is back.
> 
> Unfortunately, I'm having difficulties isolating the problem in C, but
> the following simple Python script SEGVs during exit (i.e., during
> garbage collection):
> 
>     s = "%#.109g" % (-1.e+49/3.)
>     print s
> 
> Attached is my C translation of the above.  Single stepping in gdb, I
> haven't found the overwrite yet.  I will try to dig deeper, but I hope
> that reporting what I have found will help you see what I'm missing.
> 
> Thanks,
> Jason
> 
> 
> 
> ------------------------------------------------------------------------
> 
> #include <stdio.h>
> 
> int
> main(int argc, char* argv[])
> {
> 	const char* format = "%#.109g";
> 	double value = -1.e+49/3.;
> 	printf(format, value);
> 	printf("\n");
> 	return 0;
> }

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ldtoa.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20030203/57c8cb48/attachment.ksh>


More information about the Newlib mailing list