public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113886] New: new C23 length specifier with confusing diagnostic
@ 2024-02-12  8:55 jens.gustedt at inria dot fr
  0 siblings, 0 replies; only message in thread
From: jens.gustedt at inria dot fr @ 2024-02-12  8:55 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-12  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12  8:55 [Bug c/113886] New: new C23 length specifier with confusing diagnostic jens.gustedt at inria dot fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).