https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89139
--- Comment #5 from Marc Nieper-Wißkirchen <m...@nieper-wisskirchen.de> --- Here is a much simpler example, which exhibits the same behavior: static void c (void (*w) (void)) { w (); } static void f () { } static void *x = &f; void g () { c (x); } The compiler optimizes g to an empty procedure and removes that static variable x from the output. However, it outputs the unused, static function f.