On Fri, Apr 29, 2011 at 1:33 PM, John Regehr <regehr@cs.utah.edu> wrote:
By the way, I've been wondering about your original motivation for
printing only a final checksum,
Basically two reasons.
First, we wanted to give the compiler maximum freedom to mess with the
program without being constrained by the optimization-squashing restrictions
of an external function call.
Optimization-squashing, you say? :) One man's squash is another man's enable.
http://www.ciselant.de/projects/gcc_printf/gcc_printf.html
Of course, in fairness, it wouldn't be very likely that a randomly
generated format string would happen to match one of the triggers
listed in that article; I don't really expect that GCC would do
anything weird with printf("%d %s %x",...). But you never know.
Derek Jones was talking just last week on this list about a
hypothetical buggy compiler that would misoptimize printf("%d", (myint
= 42L)).