On Sat, 16 Nov 2024, Martin Uecker wrote:
> c: fix incorrect TBAA for tagged types across translation units [PR117490]
>
> Two different declarations of tagged types in the same translation unit
> are incompatible in C before C23 and without tag also in C23. Still,
> two such types can be compatible to the same tagged type in a different
> translation unit, but this means that pointers can alias.
>
> typedef struct { int i; } s1;
> typedef struct { int i; } s2;
>
> int f(s1 *p1, s2 *p2)
> {
> p1->i = 2;
> p2->i = 3; // p2->i can alias p1->i
> return p1->i;
> }
>
> We need to assign the same TYPE_CANONICAL to both types. This patch fixes
> this for C23 and types without tag by also forming equivalence classes for
> such types based on their structure as already done for types with tag.
> Because this change exposes checking errors related to flexible array
> members (cf. PR113688), one test is restricted to C17 for now.
OK.
>
> PR c/PR117490
I think this needs to be formatted as
PR c/117490
without the second "PR".
--
Joseph S. Myers
[email protected]