Am Samstag, dem 09.11.2024 um 11:29 +0100 schrieb Alejandro Colomar via Gcc:
> On Sat, Nov 09, 2024 at 09:38:45AM GMT, Martin Uecker wrote:
> > Am Samstag, dem 09.11.2024 um 00:54 +0100 schrieb Alejandro Colomar via Gcc:
> > > Hi Martin,
> > > 
> > > I'm in the process of rebasing my __countof__ changes after your patch
> > > that fixes support for [*] and [0].
> > > 
> > > I should update the implementation of the following function:
> > > 
> > >   static bool
> > >   is_top_array_vla (tree type)
> > >   {
> > >     bool zero, star, var;
> > >     tree d;
> > > 
> > >     if (TREE_CODE (type) != ARRAY_TYPE)
> > >       return false;
> > >     if (!COMPLETE_TYPE_P (type))
> > >       return false;
> > > 
> > >     d = TYPE_DOMAIN (type);
> > >     zero = !TYPE_MAX_VALUE (d);
> > >     star = (zero && C_TYPE_VARIABLE_SIZE (type));
> > >     if (star)
> > >       return true;
> > >     if (zero)
> > >       return false;
> > > 
> > >     var = (TREE_CODE (TYPE_MIN_VALUE (d)) != INTEGER_CST
> > >           || TREE_CODE (TYPE_MAX_VALUE (d)) != INTEGER_CST);
> > >     return var;
> > >   }
> > > 
> > > The 'star' calculation should be updated.  Would you mind proposing an
> > > implementation of this function that works with your changes?  Thanks!
> > > 
> > You can just eliminate the code for the star as it would now
> > automatically end up as variable.
> 
> Thanks!
> 
> Have a lovely day!
> Alex

Just committed, so you could rebase on trunk now.

I also wanted to change zero representation to be the same as
in the C++ FE, but I need to rethink this.  Maybe this change
already solves most of our problems.

BTW: My main practical issue with zero-sized arrays is that the
UB sanitizers triggers for zero-sized variable arrays.

Martin


Reply via email to