[PATCH] correct off-by-one error in handling of precision of negative numbers (PR 78910)

Martin Sebor msebor@gmail.com
Wed Jan 4 21:44:00 GMT 2017


The attached patch corrects an off-by-one mistake in handling
non-zero precisions in signed conversions (%d and %i) with
negative arguments, such as in sprintf(d, "%.2", -1).  The call
which results in the three bytes "-01" on output, not 2.  I.e.,
the minus sign must be taken into consideration.

Thanks
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-78910.diff
Type: text/x-patch
Size: 7221 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170104/d905b3c8/attachment.bin>


More information about the Gcc-patches mailing list