This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ patch ping
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Nathan Sidwell <nathan at acm dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Jan 2016 00:52:58 +0100
- Subject: Re: C++ patch ping
- Authentication-results: sourceware.org; auth=none
- References: <20160109074122 dot GP18720 at tucnak dot redhat dot com> <56940A23 dot 4040501 at acm dot org> <5694224E dot 9090707 at redhat dot com> <20160111215217 dot GA3017 at tucnak dot redhat dot com> <569426E0 dot 2050301 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jan 11, 2016 at 05:04:16PM -0500, Jason Merrill wrote:
> >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.
That version regressed:
+FAIL: g++.dg/cpp1y/var-templ16.C -std=c++14 (internal compiler error)
+FAIL: g++.dg/cpp1y/var-templ16.C -std=c++14 (test for excess errors)
+FAIL: g++.dg/cpp1y/var-templ18.C -std=c++14 (internal compiler error)
+FAIL: g++.dg/cpp1y/var-templ18.C -std=c++14 (test for excess errors)
+FAIL: g++.dg/cpp1y/var-templ27.C -std=c++14 (internal compiler error)
+FAIL: g++.dg/cpp1y/var-templ27.C -std=c++14 (test for excess errors)
> >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?
>
> Yes, like that. You don't need to check VAR_P, since TYPE_DECL also has
> DECL_TEMPLATE_INFO.
But following patch passed bootstrap on x86_64-linux and bootstrap + regtest
on i686-linux, ok for trunk if it also passes regtest on x86_64-linux?
2016-01-12 Jakub Jelinek <jakub@redhat.com>
PR c++/66808
PR c++/69000
* pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO.
* g++.dg/tls/pr66808.C: New test.
* g++.dg/tls/pr69000.C: New test.
--- gcc/cp/pt.c.jj 2016-01-05 16:46:02.891896607 +0100
+++ gcc/cp/pt.c 2016-01-11 23:22:54.742344987 +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 (DECL_LANG_SPECIFIC (r))
+ DECL_TEMPLATE_INFO (r) = NULL_TREE;
+ if (!cp_unevaluated_operand)
+ register_local_specialization (r, t);
+ }
DECL_CHAIN (r) = NULL_TREE;
--- gcc/testsuite/g++.dg/tls/pr69000.C.jj 2015-12-21 14:03:38.362847547 +0100
+++ gcc/testsuite/g++.dg/tls/pr69000.C 2015-12-21 14:04:17.839291295 +0100
@@ -0,0 +1,19 @@
+// PR c++/69000
+// { dg-do compile }
+// { dg-require-effective-target tls }
+
+class A {};
+
+template <typename T>
+struct B
+{
+ static int *& foo () { static __thread int *c = 0; return c; }
+};
+
+B<A> d;
+
+void
+bar ()
+{
+ d.foo ();
+}
--- gcc/testsuite/g++.dg/tls/pr66808.C.jj 2015-12-21 14:06:06.791756074 +0100
+++ gcc/testsuite/g++.dg/tls/pr66808.C 2015-12-21 14:06:02.651814409 +0100
@@ -0,0 +1,10 @@
+// PR c++/66808
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+
+template <typename>
+class A {
+ int *b = foo ();
+ int *foo () { static __thread int a; return &a; }
+};
+A<int> b;
Jakub