From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115861 invoked by alias); 16 Nov 2015 15:26:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115760 invoked by uid 89); 16 Nov 2015 15:26:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,KAM_MXURI,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mail.ud10.udmedia.de Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 16 Nov 2015 15:26:11 +0000 Received: (qmail 30820 invoked from network); 16 Nov 2015 16:26:07 +0100 Received: from ip5b41f88a.dynamic.kabel-deutschland.de (HELO x4) (ud10?360p3@91.65.248.138) by mail.ud10.udmedia.de with ESMTPSA (ECDHE-RSA-AES256-SHA encrypted, authenticated); 16 Nov 2015 16:26:07 +0100 Date: Mon, 16 Nov 2015 15:26:00 -0000 From: Markus Trippelsdorf To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: Re: ping [aPATCH] Fix c++/67337 (segfault in mangle.c) Message-ID: <20151116152606.GC317@x4> References: <20150824114438.GC401@x4> <20150831093105.GA1940@x4> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150831093105.GA1940@x4> X-SW-Source: 2015-11/txt/msg01965.txt.bz2 On 2015.08.31 at 11:31 +0200, Markus Trippelsdorf wrote: > On 2015.08.24 at 13:44 +0200, Markus Trippelsdorf wrote: another ping. > ping > > > decl_mangling_context() in mangle.c returns a NULL_TREE in case of > > template type parameters. write_template_prefix() needs to handle this > > situation. > > > > Tested on ppc64le. > > > > This is a regression from gcc=4.8. > > OK for trunk, gcc-5 and gcc-4.9? > > > > Thanks. > > > > PR c++/67337 > > * mangle.c (write_template_prefix): Guard against context==NULL. > > > > diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c > > index 342cb93e68b3..a9993f40b94d 100644 > > --- a/gcc/cp/mangle.c > > +++ b/gcc/cp/mangle.c > > @@ -1149,7 +1149,7 @@ write_template_prefix (const tree node) > > So, for the example above, `Outer::Inner' is represented as a > > substitution candidate by a TREE_LIST whose purpose is `Outer' > > and whose value is `Outer::Inner'. */ > > - if (TYPE_P (context)) > > + if (context && TYPE_P (context)) > > substitution = build_tree_list (context, templ); > > else > > substitution = templ; > > diff --git a/gcc/testsuite/g++.dg/template/pr67337.C b/gcc/testsuite/g++.dg/template/pr67337.C > > new file mode 100644 > > index 000000000000..df2651bc9a57 > > --- /dev/null > > +++ b/gcc/testsuite/g++.dg/template/pr67337.C > > @@ -0,0 +1,25 @@ > > +template class A > > +{ > > + void m_fn1 (int *, int); > > +}; > > + > > +template class B > > +{ > > +public: > > + typedef int Type; > > +}; > > + > > +template class C > > +{ > > +public: > > + C (int); > > + template