https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113886

            Bug ID: 113886
           Summary: new C23 length specifier with confusing diagnostic
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.gustedt at inria dot fr
  Target Milestone: ---

I am currently implementing the new %wN length specifiers for C23 in musl, and
the compiler support in gcc already works well for those N that actually exist,
it seems. Unfortunately the diagnostic for those where it doesn't are confusing

```
#include <stdio.h>
#include <stdint.h>

int main() {
    uint32_t x = 2;
    printf("%w31x\n", x);  // works for 32 instead of 31
}
```

Here gcc (as of trunk on godbolt with '-std=c2x -Wall') tells me

<source>:6:14: warning: unknown conversion type character 'w' in format
[-Wformat=]
    6 |     printf("%w31x\n", x);

which is quite confusing because it is not the 'w' which wrong, but the number
following it.

Reply via email to