On Thu, Nov 19, 2026 at 09:46:23AM +0100, Richard Biener wrote:
> >    else if (TREE_CODE (TREE_TYPE (ctor)) == UNION_TYPE
> >        || TREE_CODE (TREE_TYPE (ctor)) == QUAL_UNION_TYPE)
> >      {
> > +      tree member = NULL_TREE;
> > +      if (num_fields)
> > +   {
> > +     member = CONSTRUCTOR_ELT (ctor, 0)->index;
> > +     if (!member)
> 
> Can this really happen?  Shouldn't we fixup frontends here...?

I don't know.  In the middle-end, we've generally tried to handle
both the case where indexes are present and when they are missing.
The usual case is certainly that they are present.
Speaking just for C++ FE, initially the indexes can be missing and later on
they should be filled in.  Though, some of these routines are also used
in the FEs.
For the union case if index is missing, it must be the first union
member.
I think some routines are even trying to handle some mixed cases which are
even more unlikely (except in the FEs), e.g. indexes on some array members
and missing on others.

> Otherwise LGTM.

        Jakub

Reply via email to