Bug 1783

Summary: printf %hhd is broken
Product: uClibc Reporter: Michael Deutschmann <michael>
Component: stdioAssignee: Carmelo Amoroso <carmelo.amoroso>
Status: RESOLVED FIXED    
Severity: minor CC: uclibc-cvs
Priority: P5    
Version: 0.9.31   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: Patch to fix printf hhd conversion

Description Michael Deutschmann 2010-05-19 01:22:22 UTC
Created attachment 1753 [details]
Patch to fix printf hhd conversion

The %hhd printf conversion is treated identically to %hhu.  This causes "255" to be output instead of "-1".

This misbehavior causes a spurious test failure in the MPFR library.

This is a regression from 0.9.30.3, but the change that caused the problem isn't actually in the stdio files.  It happens because uClibc is now built with -funsigned-char.

Attached is a fix that changes a critical cast from "(char)" to "(signed char)", restoring the original semantics.
Comment 1 Carmelo Amoroso 2010-05-19 05:18:22 UTC
Thanks Michael,
please next time try to use git to format patch.
Comment 2 Carmelo Amoroso 2010-05-19 05:22:25 UTC
Applied on master.

Thanks
Comment 3 Michael Deutschmann 2011-06-17 13:19:34 UTC
uClibc 0.9.32 doesn't contain this fix.

The old patch still applies.