https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113688
--- Comment #21 from uecker at gcc dot gnu.org ---
(In reply to uecker from comment #20)
> This was based on a discussion with Richard. TYPE_CANONICAL is used for
> aliasing decisions and the FE must set it to from equivalence classes for
> types that are
> compatible. In C, the types
>
> int[];
> int[3];
> int[n];
>
> are compatible, and this means that also the following types
> are compatible:
>
> struct foo { int a; int b[]; };
> struct foo { int a; int b[3]; };
> struct foo { int a; int b[n]; };
>
> Treating them as not compatible (by setting different TYPE_CANONICAL) causes
> subtle miscompilation issues in C. I wonder how this works in Ada?
The actual bug here was
struct foo { int a; int b[]; };
struct foo { int a; int b[0]; };
but it also applies to the variable case (the FAM case is not compatible to the
others according to ISO rules, but they all end up in the same class)