printf formatting regression with field width and hh (%02hhx)

Bug #1516185 reported by Ambroz Bizjak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

The field width (0) and precision (.) options in format specifiers have become broken when used in conjunction with "hh" format at least.

Correct behavior (4.9-2015q2-20150609)
printf("%02hhx", (uint8_t)42) --> 2a
printf("%.2hhx", (uint8_t)42) --> 2a

Faulty behavior (4.9-2015q3-20150921)
printf("%02hhx", (uint8_t)42) --> 0hx
printf("%.2hhx", (uint8_t)42) --> 0hx

Note that "hhx" is also what PRIx8 from <inttypes.h> is defined to.
printf("%02x", (unsigned int)42) is still OK.

Revision history for this message
Ambroz Bizjak (ambrop7) wrote :

Hello, please look at this.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.