Skip to content
Snippets Groups Projects
Unverified Commit e98ad6a0 authored by Martin Jambor's avatar Martin Jambor Committed by Martin Jambor
Browse files

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  <mjambor@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  <mjambor@suse.cz>

	PR ipa/115815
	* gcc.dg/lto/pr115815_0.c: New test.
parent ea9d4bf4
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment