If %% is used in printf formats without any actual format requiring substitution being used, gcc still does not perform the optimization.
#include <stdio.h> int main (void) { printf ("hello %%%%!\n"); return 0; } This code is compiled to call printf even though it should lead to code calling puts with the string containing "hello %%!". -- Summary: printf->puts optimization prevented by %% Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: drepper at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30306