On Mon, Jan 11, 2016 at 04:44:46PM -0500, Jason Merrill wrote: > On 01/11/2016 03:01 PM, Nathan Sidwell wrote: > >On 01/09/16 02:41, Jakub Jelinek wrote: > >>Hi! > >> > >>I'd like to ping the PR c++/66808, PR c++/69000 > >>http://gcc.gnu.org/ml/gcc-patches/2015-12/msg02019.html > >>patch, fixing ICE with GNU __thread vars in templates. > > > >Can't you unconditionally clear DECL_TEMPLATE_INFO regardless of local_p? > > > >if (DECL_LANG_SPECIFIC(r)) > > DECL_TEMPLATE_INFO(r) == NULL_TREE; > >?
You mean: --- gcc/cp/pt.c.jj 2016-01-05 16:46:02.891896607 +0100 +++ gcc/cp/pt.c 2016-01-11 21:33:09.065184178 +0100 @@ -12207,6 +12207,8 @@ tsubst_decl (tree t, tree args, tsubst_f DECL_TEMPLATE_INSTANTIATED (r) = 0; if (type == error_mark_node) RETURN (error_mark_node); + if (DECL_LANG_SPECIFIC (r)) + DECL_TEMPLATE_INFO (r) = NULL_TREE; if (TREE_CODE (type) == FUNCTION_TYPE) { /* It may seem that this case cannot occur, since: I'm almost through bootstrapping that, but regtesting will take some more time. > Or clear it for local_p down by where we're setting it for !local_p. Do you mean: --- gcc/cp/pt.c.jj 2016-01-05 16:46:02.891896607 +0100 +++ gcc/cp/pt.c 2016-01-11 22:49:12.303477700 +0100 @@ -12292,8 +12292,13 @@ tsubst_decl (tree t, tree args, tsubst_f SET_DECL_IMPLICIT_INSTANTIATION (r); register_specialization (r, gen_tmpl, argvec, false, hash); } - else if (!cp_unevaluated_operand) - register_local_specialization (r, t); + else + { + if (VAR_P (r) && DECL_LANG_SPECIFIC (r)) + DECL_TEMPLATE_INFO (r) = NULL_TREE; + if (!cp_unevaluated_operand) + register_local_specialization (r, t); + } DECL_CHAIN (r) = NULL_TREE; or something different? Or should it be cleared also for non-VAR_DECLs if they have DECL_LANG_SPECIFIC? Jakub