https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77831
Bug ID: 77831
Summary: add fixit hints to -Wformat-length
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
Bug 77743 (resolved as invalid) complains about -Wformat-length warning for a
safe call to sprintf(d, "%o", x & 0xff). Bug 77690 (also resolved as invalid)
complains about a warning in a similarly safe sprintf(d, "%s", s) call where
the %s argument is guaranteed to fit in the destination. Neither of these
false positives can be fixed in the gimple-ssa-sprintf pass that implements the
warning and so both of the warnings need to be suppressed in user code. The
solution (using a length modifier in the first case and precision in the
second), although documented in the manual, is not obvious. It would help if
GCC suggested the solution via a fixit hint.