From: mpolacek Date: Fri, 10 Mar 2017 15:36:00 +0000 (+0000) Subject: PR c++/79967 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91158b2e13f7db2719e54229f39f0f97b5515ede;p=thirdparty%2Fgcc.git PR c++/79967 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it. * g++.dg/cpp0x/gen-attrs-63.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246039 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d3871aada43a..69b49e60b36e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-03-10 Marek Polacek + + PR c++/79967 + * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it. + 2017-03-10 Jakub Jelinek PR c++/79899 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2a97ffc6582d..bf6f0eb56bea 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11402,7 +11402,8 @@ grokdeclarator (const cp_declarator *declarator, if (declarator && declarator->kind == cdk_id - && declarator->std_attributes) + && declarator->std_attributes + && attrlist != NULL) /* [dcl.meaning]/1: The optional attribute-specifier-seq following a declarator-id appertains to the entity that is declared. */ *attrlist = chainon (*attrlist, declarator->std_attributes); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7dae3d232cd..bd5919f96498 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-10 Marek Polacek + + PR c++/79967 + * g++.dg/cpp0x/gen-attrs-63.C: New test. + 2017-03-10 Jakub Jelinek PR c++/79899 diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-63.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-63.C new file mode 100644 index 000000000000..05f53e306c1d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-63.C @@ -0,0 +1,12 @@ +// PR c++/79967 +// { dg-do compile { target c++11 } } + +template +struct A +{ + int g () { f (); return 0; } +}; + +void f (); + +void g (A a) { a.g (); }