From: Marek Polacek Date: Wed, 8 Jul 2015 10:36:26 +0000 (+0000) Subject: re PR c++/66748 (Crash with abi_tag attribute) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b3bc1f3bdc39883d1d3575341b280a762731a5b;p=gcc.git re PR c++/66748 (Crash with abi_tag attribute) PR c++/66748 * tree.c (handle_abi_tag_attribute): Check for CLASS_TYPE_P before accessing TYPE_LANG_SPECIFIC node. * g++.dg/abi/abi-tag15.C: New test. From-SVN: r225541 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c345f83d9e6..e469156c8ff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-07-08 Marek Polacek + + PR c++/66748 + * tree.c (handle_abi_tag_attribute): Check for CLASS_TYPE_P before + accessing TYPE_LANG_SPECIFIC node. + 2015-07-07 Andrew MacLeod * call.c: Adjust includes. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 4fcdb6c52a6..149c37da908 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3653,13 +3653,15 @@ handle_abi_tag_attribute (tree* node, tree name, tree args, name, *node); goto fail; } - else if (CLASSTYPE_TEMPLATE_INSTANTIATION (*node)) + else if (CLASS_TYPE_P (*node) + && CLASSTYPE_TEMPLATE_INSTANTIATION (*node)) { warning (OPT_Wattributes, "ignoring %qE attribute applied to " "template instantiation %qT", name, *node); goto fail; } - else if (CLASSTYPE_TEMPLATE_SPECIALIZATION (*node)) + else if (CLASS_TYPE_P (*node) + && CLASSTYPE_TEMPLATE_SPECIALIZATION (*node)) { warning (OPT_Wattributes, "ignoring %qE attribute applied to " "template specialization %qT", name, *node); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f02d3e5f167..7370e8fe3db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-08 Marek Polacek + + PR c++/66748 + * g++.dg/abi/abi-tag15.C: New test. + 2015-07-08 Andrew Bennett * gcc.target/mips/branch-2.c: Change NOMIPS16 to NOCOMPRESSION. diff --git a/gcc/testsuite/g++.dg/abi/abi-tag15.C b/gcc/testsuite/g++.dg/abi/abi-tag15.C new file mode 100644 index 00000000000..bfda3a279ef --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag15.C @@ -0,0 +1,3 @@ +// PR c++/66748 + +enum __attribute__((abi_tag("foo"))) E {}; // { dg-error "redeclaration of" }