https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115815
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Jambor <jamb...@gcc.gnu.org>: https://gcc.gnu.org/g:e98ad6a049c96c21cf641954584c2f5b7df0ce93 commit r15-3515-ge98ad6a049c96c21cf641954584c2f5b7df0ce93 Author: Martin Jambor <mjam...@suse.cz> Date: Fri Sep 6 14:12:53 2024 +0200 ipa: Treat static constructors and destructors as non-local (PR 115815) In PR 115815, IPA-SRA thought it had control over all invocations of a (recursive) static destructor but it did not see the implied invocation which led to the original being left behind and the clean-up code encountering uses of SSAs that definitely should have been dead. Fixed by teaching cgraph_node::can_be_local_p about static constructors and destructors. Similar test is missing in cgraph_node::local_p so I added the check there as well. gcc/ChangeLog: 2024-07-25 Martin Jambor <mjam...@suse.cz> PR ipa/115815 * cgraph.cc (cgraph_node_cannot_be_local_p_1): Also check DECL_STATIC_CONSTRUCTOR and DECL_STATIC_DESTRUCTOR. * ipa-visibility.cc (non_local_p): Likewise. (cgraph_node::local_p): Delete extraneous line of tabs. gcc/testsuite/ChangeLog: 2024-07-25 Martin Jambor <mjam...@suse.cz> PR ipa/115815 * gcc.dg/lto/pr115815_0.c: New test.