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.
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)
{