From 7291b2edf6f87fba839b0d10c04b2562a5f6bd60 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 23 Apr 2020 14:38:58 -0400 Subject: [PATCH] c-family: Fix ICE on attribute with -fgnu-tm [PR94733] find_tm_attribute was using TREE_PURPOSE to get the attribute name, which is breaking now that we preserve the C++11-style attribute format past decl_attributes. So use get_attribute_name which can handle both formats of attributes. PR c++/94733 * c-attribs.c (find_tm_attribute): Use get_attribute_name instead of TREE_PURPOSE. * g++.dg/tm/attrib-5.C: New test. --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-attribs.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/tm/attrib-5.C | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/tm/attrib-5.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 66f4873c3c2..55e6eb8ae45 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2020-04-23 Marek Polacek + + PR c++/94733 + * c-attribs.c (find_tm_attribute): Use get_attribute_name instead of + TREE_PURPOSE. + 2020-04-14 Patrick Palka PR c++/85278 diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 1483b3540dc..ac936d5bbbb 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -3314,7 +3314,7 @@ find_tm_attribute (tree list) { for (; list ; list = TREE_CHAIN (list)) { - tree name = TREE_PURPOSE (list); + tree name = get_attribute_name (list); if (tm_attr_to_mask (name) != 0) return name; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6ae489c43d..b287e12588f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-23 Marek Polacek + + PR c++/94733 + * g++.dg/tm/attrib-5.C: New test. + 2020-04-23 Jakub Jelinek PR middle-end/94724 diff --git a/gcc/testsuite/g++.dg/tm/attrib-5.C b/gcc/testsuite/g++.dg/tm/attrib-5.C new file mode 100644 index 00000000000..0b7bc728f06 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/attrib-5.C @@ -0,0 +1,5 @@ +// PR c++/94733 +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +struct [[gnu::may_alias]] pe { }; -- 2.30.2