Hi.

Noticed during building of libbackend.a with the LTO partial linking.

The function release_body is called even if clone_of is a clone
of a another function and thus it shares tree declaration. We should
preserve it in that situation.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

        PR ipa/107944

gcc/ChangeLog:

        * cgraph.cc (cgraph_node::remove): Do not release body
        if a node is clone of another node.
---
 gcc/cgraph.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index f15cb47c8b8..2e7d77ffd6c 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1893,7 +1893,7 @@ cgraph_node::remove (void)
   else if (clone_of)
     {
       clone_of->clones = next_sibling_clone;
-      if (!clone_of->analyzed && !clone_of->clones && !clones)
+      if (!clone_of->analyzed && !clone_of->clones && !clones && 
!clone_of->clone_of)
        clone_of->release_body ();
     }
   if (next_sibling_clone)
-- 
2.38.1

Reply via email to