https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2016-11-24 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- I have yet to look into the details of this issue but just a quick clarifying comment: -fprintf-return-value is almost entirely based on the C requirements, with the exception of %p where it does make use of its knowledge of the underlying implementation. The option cannot match a non-conforming implementation without a corresponding target hook that describes it so when one is being targeted the options should not be used The option should be disabled automatically when either -fno-builtin-sprintf or its equivalent such -ffreestanding is specified (if it isn't it's a bug). That said, I don't think the Linux kernel uses either of these options. That suggests that the Linux printf should be conforming and the miscompilation may be a bug. Otherwise, it the Linux printf isn't conforming and we want it to benefit from the option (as I would expect us to since the request for the related -Wformat-length warning came from someone either contributing to or building the kernel) GCC might want to add a target hook describing the Linux printf specifics and a new option and to let the kernel enable it.