diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index e2e033517448d6d5d1030f639a45b7cd7f49360f..eff99002fbb9292c943f911292e02767824eb03b 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -1475,7 +1475,7 @@ comp_type_attributes (const_tree type1, const_tree type2)
       const struct attribute_spec *as;
       const_tree attr;
 
-      as = lookup_attribute_spec (get_attribute_name (a));
+      as = lookup_attribute_spec (TREE_PURPOSE (a));
       if (!as || as->affects_type_identity == false)
 	continue;
 
@@ -1489,7 +1489,7 @@ comp_type_attributes (const_tree type1, const_tree type2)
 	{
 	  const struct attribute_spec *as;
 
-	  as = lookup_attribute_spec (get_attribute_name (a));
+	  as = lookup_attribute_spec (TREE_PURPOSE (a));
 	  if (!as || as->affects_type_identity == false)
 	    continue;
 
@@ -1531,8 +1531,7 @@ remove_attributes_matching (tree attrs, Predicate predicate)
   const_tree start = attrs;
   for (const_tree attr = attrs; attr; attr = TREE_CHAIN (attr))
     {
-      tree name = get_attribute_name (attr);
-      const attribute_spec *as = lookup_attribute_spec (name);
+      const attribute_spec *as = lookup_attribute_spec (TREE_PURPOSE (attr));
       const_tree end;
       if (!predicate (attr, as))
 	end = attr;