https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62249
--- Comment #1 from Zack Weinberg <zackw at panix dot com> --- Created attachment 33389 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33389&action=edit Delta-minimized self-contained test case Requires no headers anymore. Delta-minimization revealed something interesting: int __poll_chk (struct pollfd *, unsigned, int, unsigned); int __poll_chk_warn (struct pollfd *, unsigned, int, unsigned) __asm__ ("__poll_chk") __attribute__ ((__warning__ ("poll called with fds buffer too small"))); The __asm__("__poll_chk") annotation is essential; if it's removed the bug goes away. I don't know anything about the guts of LTO, but to me that suggests a bug in its unification of function decls, rather than a bug in dead-code removal.