https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127115
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|error-recovery |
Ever confirmed|0 |1
Last reconfirmed| |2026-08-29
Status|UNCONFIRMED |NEW
--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. a2 is undeclared.
But we assert that the field is there.
/* Now both s1 and s2 have counted_by attributes, check
whether they are the same. */
tree counted_by_field1
= lookup_field (t1, TREE_VALUE (TREE_VALUE (counted_by1)));
tree counted_by_field2
= lookup_field (t2, TREE_VALUE (TREE_VALUE (counted_by2)));
gcc_assert (counted_by_field1 && counted_by_field2);
Another testcase:
```
struct t{
int a;
char b[] __attribute__((counted_by(a)));
};
struct t{
int a;
char b[] __attribute__((counted_by(a2)));
};
```
It looks like we are checking for compatibility before erroring out about the
invalid counted_by.