incorrect print -1 using %hhd

Khem Raj raj.khem at gmail.com
Wed Mar 28 13:19:37 UTC 2012


Signed ness of char is arch dependent eg ppc defaults to signed but arm
doesn't so demanding a given signedness ain't that bad
 On Mar 28, 2012 12:52 AM, "Bernhard Reutner-Fischer" <rep.dot.nop at gmail.com>
wrote:

> On 28 March 2012 08:38, Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
> wrote:
> > On 03/28/2012 02:36 AM, Michael Deutschmann wrote:
> >>
> >> On Tue, 27 Mar 2012, Mike Frysinger wrote:
> >>>
> >>> On Tuesday 27 March 2012 10:28:29 Andrew Rybchenko wrote:
> >>>>
> >>>> Is it known issue that uClibc 0.9.32 incorrectly prints -1 using
> >>>> %hhd (and %hhi) specifier? The following program:
> >>>
> >>> please file a bug
> >>
> >> No need, this is bug #1783.
> >>
> >> It was closed as fixed-in-the-next-release when I reported it against
> >> 0.9.31, but somehow the fix hasn't percolated into any release version
> of
> >> uClibc yet.
> >>
> >> The fix is really simple.  Just change the cast from "(char)" to
> "(signed
> >> char)" in libc/stdio/_load_inttype.c .  The bug was introduced not by
> any
> >> change in the sourcecode itself, but because the Makefiles started
> >> specifying -funsigned-char everywhere.
>
> And that's exactly why using -funsigned-char is a really bad idea.
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>


More information about the uClibc mailing list