https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99857
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #6) > 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 > { Or - || (!node->definition && !node->clones)) + || (!node->definition && !node->clones && !node->declare_variant_alt)) ?