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

Dr. David Alan Gilbert <dgilbert at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dgilbert at redhat dot com

--- Comment #7 from Dr. David Alan Gilbert <dgilbert at redhat dot com> ---
A similar variant is:

#include <stdio.h>

int main(int argc, char *argv[])
{
  size_t s = 42;
  printf("%d\n", s);
}

t.c:7:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2
has type ‘size_t {aka long unsigned int}’ [-Wformat=]
   printf("%d\n", s);
           ~^
           %ld

I'd expect it to be suggesting %zd here.
The difference in this case is it's already generating a warning - just not the
one I'd expect (and it already knows it's size_t).

Reply via email to