Bug#1106876: sscanf doesn't work in newlib
Package: libnewlib-arm-none-eabi
Version: 4.4.0.20231231-2
It appears sscanf always returns 0 when compiling to a Raspberry Pi RP2040
using the gcc-arm-none-eabi toolchain with libstdc++ and newlib.
Here is a transcript of the code triggering the issue; I no longer have the device
to test further.
auto device::parse_version_string(const char *version) -> bool
{
const char *input = "1";
uint8_t one{};
int matched = std::sscanf(input, "%hhu", &one);
if (matched == 1) {
LOGD.printf("FROG13: parsed '%s' into 1 components one=%d", input, one);
} else {
LOGD.printf("FROG13: failed to parse '%s' into 1 components, got %d components", inp
ut, matched);
}
.
.
.
}
Yields: "FROG13: failed to parse '1' into 1 components, got 0 components"
Reply to: