bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk number to string bug


From: Andrew J. Schorr
Subject: Re: gawk number to string bug
Date: Tue, 3 Jan 2006 22:36:32 -0500
User-agent: Mutt/1.4.1i

Ugh, I found an off-by-one error in checking the snprintf return code
(while working on a test harness).

So attached is a revised patch (which also fixes some apparent off-by-one
errors elsewhere in format_tree), as well as a start on a test script.
The test script should not produce any output if gawk is working properly.
But the existing (unpatched) gawk produces this output on linux/x86/32bits:

   $ /bin/gawk -f test/intformat.awk 
   (sprintf(%d,2^64) = 0)-1.84467e+19 = -1.84467e+19

And on linux/x86/64bits(opteron):

   $ /bin/gawk -f ../cvs/test/intformat.awk
   (sprintf(%s,2^63) = -9223372036854775808)-9.22337e+18 = -1.84467e+19
   (sprintf(%d,2^64) = 0)-1.84467e+19 = -1.84467e+19

The patch should probably be broken into pieces, but this is something
to look at.

Regards,
Andy

Attachment: intformat.awk
Description: Text document

Attachment: gawk315.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]