https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79062
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- All of warn_format, warn_format_overflow, and warn_format_trunc are, in fact, zero in gimple-ssa-sprintf.c when -flto is set. At least one problem is the dependency of -Wformat-{overflow,truncation} in c-common/c.opt on -Wformat, which in turn depends on -Wall. I.e., -Wformat-overflow is LangEnabledBy(C ObjC C++ ObjC++, Wformat=, warn_format >= 1, 0), and doesn't mention LTO. -Wformat depends on -Wall, neither of which mentions LTO. Adding LTO helps somewhat, in that explicitly specifying -Wformat-overflow (or -truncation) enables the warning, but specifying -Wformat or -Wall doesn't have the same effect. To set flags based on dependencies among options the C front end calls the generated C_handle_option_auto() function in $objdir/gcc/options.c which initializes its set of options. There is an LTO_handle_option_auto() in $objdir/gcc/options.c as well but nothing seems to call it. So it looks like some basic pieces aren't hooked up quite right for LTO.