https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95359
Bug ID: 95359 Summary: Failure to optimize printfs with extraneous arguments Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- void f() { printf("", 2); } This can be optimized to doing nothing (the extraneous arguments should be ignored and just evaluated by themselves, it's not UB). This transformation is done by LLVM, but not by GCC.