https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99857

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Thanks for a testcase, it makes things easier to debug indeed :)
The problem is that openmp uses declare_vairant_alt on symbols to make them
special definitions, but the definition flag is not set.  That makes
free_lang_data to call release_body and since the code depends on references
things gets out of sync.

I am testing.

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
            {

For next stage1 I think we want to set definition bit for them and remove all
the special cases of declare_vairant_alt that makes them to behave as
definitions. We also want to add checking that !definition symbols are extenral
symbols which is missed in the verifier.

Reply via email to