https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114574
--- Comment #29 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to uecker from comment #28) > I do not fully understand yet what happens for may_alias, but it if we later > complete the struct with the may_alias attribute it seems we would also need > to update the previously created pointer so that it has > TYPE_REF_CAN_ALIAS_ALL. Setting TYPE_STRUCTURAL_EQUALITY for incomplete > structs also for pre-C23 seems to fix the assertion failure, but I am not > sure if this fixes the underlying bug. Certainly that may_alias case isn't specific to just C, C++ behaves the same, and I'd just say don't do that, you can always put the may_alias attribute on the forward declaration of the struct if all pointers to it are supposed to alias.