]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
attribs: Use attribute_value_equal in decl_attributes
authorJakub Jelinek <jakub@redhat.com>
Sat, 6 Dec 2025 10:08:05 +0000 (11:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 6 Dec 2025 10:08:05 +0000 (11:08 +0100)
This is another thing discussed in the 1/9 Reflection thread,
also not dependent on reflection.

decl_attributes calls simple_cst_equal on TREE_VALUEs of the
current and preexisting attributes, but that is just a small
part of how attribute values should be compared.

The following patch fixes that.

2025-12-06  Jakub Jelinek  <jakub@redhat.com>

* attribs.cc (decl_attributes): Use attribute_value_equal to
compare attribute values instead of simple_cst_equal.

gcc/attribs.cc

index 7d7f8f36a7fc42fa4fb9a2f0620b770b7766dfbf..51c7f46a00f7aeba90ea21afb0bfd2caba9eb4ab 100644 (file)
@@ -967,10 +967,8 @@ decl_attributes (tree *node, tree attributes, int flags,
          for (a = find_same_attribute (attr, old_attrs);
               a != NULL_TREE;
               a = find_same_attribute (attr, TREE_CHAIN (a)))
-           {
-             if (simple_cst_equal (TREE_VALUE (a), args) == 1)
-               break;
-           }
+           if (attribute_value_equal (a, attr))
+             break;
 
          if (a == NULL_TREE)
            {