[PATCH] remove %p handling from gimple-ssa-sprintf (pr78512)
Martin Sebor
msebor@gmail.com
Tue Nov 29 02:57:00 GMT 2016
PR 78512 - r242674 miscompiles Linux kernel observes that the Linux
kernel fails to boot as a result of enabling the -fprintf-return-value
optimization in GCC. This is likely because the kernel has its own
sprintf with a large set of extensions to the %p directive that
conflict with the optimization. Ordinarily, programs that define
their own versions of C library functions that differ from what C
specifies are expected to disable GCC's built-ins (e.g., by
-fno-builtin, or for freestanding environments like the Linux kernel,
by -ffreestanding). But the Linux kernel doesn't do that and hence
the conflict.
After discussing a few possible options (handling the kernel extensions
in GCC, providing a new GCC option to disable the %p handling, and
disabling both the optimization and the warning for calls involving
the %p directive, the last was viewed as the best alternative). The
attached patch removes the %p handling from GCC.
Martin
The kernel extensions are documented below:
https://www.kernel.org/doc/Documentation/printk-formats.txt
and an implementation is here:
https://github.com/torvalds/linux/blob/master/lib/vsprintf.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-78512.diff
Type: text/x-patch
Size: 20041 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161129/06d8ba6f/attachment.bin>
More information about the Gcc-patches
mailing list