Hi,
the libgomp.c/../libgomp.c-c++-common/task-detach-6.c introduced by my
release_body refactoring turns out to be relatively funny interaction
between free_leang_data and openmp clones production.  Openmp creates
special functions with declare_variant_alt which eventualy becomes real
functions, but for time being they do not have gimple body set.  This is
done by setting cgraph_node flags declare_variant_alt=1 and defintion=0.
This is not completely systematic since cgraph code assumes that
non-definitions are external symbols and do not have any references/call
edges while declare_variant_alt has references.

It would be more systematic to make this also a definition. I plan
to clean this up next stage1 and also add a verifier that
non-definitions do not have references. 

Honza

gcc/ChangeLog:

2021-04-10  Jan Hubicka  <hubi...@ucw.cz>

        PR lto/99857
        * tree.c (free_lang_data_in_decl): Do not release body of
        declare_variant_alt.

diff --git a/gcc/tree.c b/gcc/tree.c
index 7c44c226a33..e4e74ac8afc 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5849,7 +5849,7 @@ free_lang_data_in_decl (tree decl, class free_lang_data_d 
*fld)
       if (!(node = cgraph_node::get (decl))
          || (!node->definition && !node->clones))
        {
-         if (node)
+         if (node && !node->declare_variant_alt)
            node->release_body ();
          else
            {

Reply via email to