http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55319
--- Comment #2 from m101010a at gmail dot com 2012-11-18 22:13:23 UTC --- Actually, it does depend on IO; the optimizations aren't performed in either case if I declare but don't define putchar, and if do something simple like assigning to a volatile int in putchar then the optimizations are performed in both cases. If I assert(false) in putchar, gcc optimizes the fwhole-program version to a failed assert, but doesn't without fwhole-program, which is the opposite of what it does with IO.