Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newlib-nano: Printf formatting does not work properly with "PRIu8" #17083

Closed
fjmolinas opened this issue Oct 29, 2021 · 1 comment
Closed

newlib-nano: Printf formatting does not work properly with "PRIu8" #17083

fjmolinas opened this issue Oct 29, 2021 · 1 comment
Labels
Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@fjmolinas
Copy link
Contributor

Description

When using "PRIu8" and if using newlib then it gets formatted as hu. This does not happen with picolibc.

Related to #1891, but as that one focuses on floats, a new issue is oppened.

Steps to reproduce the issue

Try a PRIu8 formated printf, eg with this diff:

diff --git a/examples/hello-world/main.c b/examples/hello-world/main.c
index f51bf8c0a0..d5fc3cf12d 100644
--- a/examples/hello-world/main.c
+++ b/examples/hello-world/main.c
@@ -20,6 +20,7 @@
  */
 
 #include <stdio.h>
+#include "inttypes.h"
 
 int main(void)
 {
@@ -28,5 +29,8 @@ int main(void)
     printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
     printf("This board features a(n) %s MCU.\n", RIOT_MCU);
 
+    uint8_t num = 24;
+    printf("'%"PRIu8"' should be '24'\n", num);
+
     return 0;
 }

Expected results

'24' should be '24'

Actual results

'hu' should be '24'

Versions

BUILD_IN_DOCKER=1

@aabadie aabadie added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jan 5, 2022
@maribu
Copy link
Member

maribu commented May 18, 2023

duplicate of #1891

@maribu maribu closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

3 participants