http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58005
Bug ID: 58005 Summary: missed optimization printf constant string Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dushistov at mail dot ru Simple code: #include <cstdio> int main() { printf("%s: test1\n", __PRETTY_FUNCTION__);//1 printf("test2\n");//2 return 0; } compiled to: callq 4005a0 <__printf_chk@plt> (1) and to callq 400590 <puts@plt> for (2) I think that, because of __PRETTY_FUNCTION__ is known during compile time, it is also possible converting (1) to "puts" call. This optimization can help speedup loging functionality.