http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktietz at gcc dot gnu.org --- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> --- This testcase seems to be invalid ... The function quantum_gate_counter is visible out-side of the current TU. So nobody can predict that return-type isn't used by external users. So optimization can be done. By adding static to the prototype of quantum_gate_counter for making it visible only to local TU, things getting optimized as desired.