public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98819] New: -Wall -Wformat-signedness  suggests %u for %u
@ 2021-01-25 10:22 jg at jguk dot org
  2021-01-25 10:37 ` [Bug c++/98819] Wall Wformat-signedness " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jg at jguk dot org @ 2021-01-25 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98819
           Summary: -Wall -Wformat-signedness  suggests %u for %u
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Reproduced in latest Godbolt trunk

%u is suggested for %u


#1 with x86-64 gcc (trunk)
<source>: In function 'int main()':
<source>:6:19: warning: format '%u' expects argument of type 'unsigned int',
but argument 2 has type 'int' [-Wformat=]
    6 |     std::printf("%u", CURRENT_YEAR);
      |                  ~^
      |                   |
      |                   unsigned int
      |                  %u
Compiler returned: 0





#include <cstdio>
#define CURRENT_YEAR 2021

int main()
{
    std::printf("%u", CURRENT_YEAR);
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-06-21 22:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 10:22 [Bug c++/98819] New: -Wall -Wformat-signedness suggests %u for %u jg at jguk dot org
2021-01-25 10:37 ` [Bug c++/98819] Wall Wformat-signedness " pinskia at gcc dot gnu.org
2021-01-25 10:42 ` jg at jguk dot org
2021-01-25 16:43 ` [Bug c/98819] " msebor at gcc dot gnu.org
2021-01-25 17:51 ` dmalcolm at gcc dot gnu.org
2021-01-26 12:46 ` jg at jguk dot org
2021-01-26 12:59 ` jg at jguk dot org
2021-02-03 13:06 ` jg at jguk dot org
2024-06-21 22:51 ` egallager at gcc dot gnu.org

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).