https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114574

--- Comment #30 from Martin Uecker <muecker at gwdg dot de> ---
Am Donnerstag, dem 18.04.2024 um 11:57 +0000 schrieb jakub at gcc dot gnu.org:
> 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.

The problem I was referring to is the ICE, not that we get from
assertions in the middle end, not that some pointers constructed
from the incomplete type without the attribute may not have thisĀ 
property, cf. PR114493

For C++, the example does not ICE. I haven't looked at
what the C++ FE does differently, I simply observed that setting
TYPE_STRUCTURAL_EQUALITY as the patch does for C23 also seems to
fix (?) this ICE (but only for C23 if guarded by flag_iso_c23).

I haven't had time to look more into this. 

Martin

Reply via email to