[Bug c/79691] -Wformat-truncation suppressed by (and only by) -Og
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79691 Martin Sebor changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #4 from Martin Sebor --- Fixed in r245782.
[Bug c/79691] -Wformat-truncation suppressed by (and only by) -Og
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79691 --- Comment #3 from Martin Sebor --- Author: msebor Date: Tue Feb 28 16:59:16 2017 New Revision: 245782 URL: https://gcc.gnu.org/viewcvs?rev=245782&root=gcc&view=rev Log: PR tree-optimization/79691 - -Wformat-truncation suppressed by (and only by) -Og gcc/ChangeLog: PR tree-optimization/79691 * passes.def (pass_all_optimizations_g): Enable pass_sprintf_length. gcc/testsuite/ChangeLog: PR tree-optimization/79691 * gcc.dg/tree-ssa/pr79691.c: New test. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr79691.c Modified: trunk/gcc/ChangeLog trunk/gcc/passes.def trunk/gcc/testsuite/ChangeLog
[Bug c/79691] -Wformat-truncation suppressed by (and only by) -Og
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79691 --- Comment #2 from Martin Sebor --- Patch posted for review: https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01480.html
[Bug c/79691] -Wformat-truncation suppressed by (and only by) -Og
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79691 Martin Sebor changed: What|Removed |Added Keywords||diagnostic, ||missed-optimization Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2017-02-23 CC||msebor at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor --- Confirmed for the missing diagnostic (https://gcc.gnu.org/ml/gcc/2017-02/msg00105.html). It's a also a missed optimization because, as can be seen in the test case below, the sprintf return value optimization isn't done: $ (set -x && cat t.c && for O in 1 g; do gcc -O$O -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout t.c; done) + cat t.c int f (void) { return __builtin_snprintf (0, 0, "%i", 123); } + for O in 1 g + gcc -O1 -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout t.c ;; Function f (f, funcdef_no=0, decl_uid=1795, cgraph_uid=0, symbol_order=0) f () { [100.00%]: return 3; } + for O in 1 g + gcc -Og -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout t.c ;; Function f (f, funcdef_no=0, decl_uid=1795, cgraph_uid=0, symbol_order=0) f () { int _3; [100.00%]: _3 = __builtin_snprintf (0B, 0, "%i", 123); return _3; }