printf formatting regression with field width and hh (%02hhx)
Bug #1516185 reported by
Ambroz Bizjak
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-
printf("%02hhx", (uint8_t)42) --> 2a
printf("%.2hhx", (uint8_t)42) --> 2a
Faulty behavior (4.9-2015q3-
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.
To post a comment you must log in.
Hello, please look at this.