This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/77720] -Wformat-length= wit -O3 emit warning twice with incorrect linenumbers
- From: "dimhen at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 26 Sep 2016 08:20:35 +0000
- Subject: [Bug middle-end/77720] -Wformat-length= wit -O3 emit warning twice with incorrect linenumbers
- Auto-submitted: auto-generated
- References: <bug-77720-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77720
Dmitry G. Dyachenko <dimhen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #2 from Dmitry G. Dyachenko <dimhen at gmail dot com> ---
r240462 PASS : print diagnostique one time
$ gcc -Wall -c -O3 x.c
x.c: In function ‘bar’:
x.c:15:21: warning: ‘%3u’ directive output may be truncated writing between 3
and 10 bytes into a region of size 4 [-Wformat-length=]
snprintf(p, 4, "%3u", k);
^~~
x.c:15:20: note: directive argument in the range [0u, 4294967295u]
snprintf(p, 4, "%3u", k);
^~~~~
x.c:15:5: note: format output between 4 and 11 bytes into a destination of size
4
snprintf(p, 4, "%3u", k);
^~~~~~~~~~~~~~~~~~~~~~~~