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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=67479

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Nick Desaulniers from comment #1)
> In https://bugs.llvm.org/show_bug.cgi?id=41467#c4, the code owner for Clang
> seems to indicate that we could move the warnings for narrowing prints (ie.
> printing an `int` with `%hh`) to a new warning flag within the -Wformat
> group (ie. -Wformat-pedantic).

The bug for adding -Wformat-pedantic is bug 67479

> 
> I'm mostly concerned with the case where the value being printed is either
> obviously or possibly too large for the print format specifier, ex.
> 
> ```
> #include <limits.h>
> #include <stdio.h>
> void foo(void) {
>     printf("%hd\n", INT_MAX);
> }
> ```
> built with -Wformat.
> 
> I'm curious if this is indeed something GCC should warn about, and if so,
> should it be part of -Wformat? (I suspect yes for both, or would prefer it
> to be yes for both, and then to fix all instances in the Linux kernel caught
> by this, but would prefer to collaborate on this).

I think there was a separate bug for the specific case of "%hhd"/"%hd" but I
can't find it right now...

Reply via email to