Issue with sscanf not parsing correctly

Keith Packard keithp@keithp.com
Mon Aug 16 16:42:34 GMT 2021


Alexandre Raymond <alexandre.j.raymond@gmail.com> writes:

> Greetings!
>
> I have been developing on a Teensy 4.1 platform, which I'm told uses
> newlib under the hood, and encountered a strange issue with sscanf,
> where different parameter orderings yield different results with
> stdint types.

Odd. I've just tested this using the qemu model for the
thumb_v7e_m_dp_hard gcc target for the picolibc build set to use the
legacy stdio bits from newlib and it seems to work just fine (it also
works fine with the new stdio bits from picolibc).

Could this libc be built to not support C99 formats? That would cause
all kinds of issues as sscanf would fail when it hit the '%hhu' format.

Here's the regular C test code I used for this:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sscanf-order.c
Type: text/x-csrc
Size: 1023 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20210816/7e70f81c/attachment.bin>
-------------- next part --------------

I've added this as a picolibc test so it will be regularly checked
against both newlib and picolibc stdio bits going forward.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20210816/7e70f81c/attachment.sig>


More information about the Newlib mailing list