Re: array_type_nelts + 1 for VLAs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gabriel,

On Sun, Jul 28, 2024 at 09:42:56AM GMT, Gabriel Ravier wrote:
> On 7/28/24 3:09 AM, Alejandro Colomar via Gcc-help wrote:
> I think what you want is probably simply to generate a tree that evaluates
> the expression `array_type_nelts (type) + 1` yourself if there isn't a
> function that'll do it for you. You probably want to do something similar to
> `build2(PLUS_EXPR, TREE_TYPE (nelts_minus_one), nelts_minus_one,
> integer_one_node)` (I have 0 idea if this specific code will work but
> something like that seems like it should be appropriate)

Thanks!  That allowed me to understand array_type_nelts_top(), which is
indeed what I needed (and I had to move it to a different location to be
able to use it).

It now seems to work fine.  I have _Lengthof() now working for both
(normal) arrays and VLAs.  Now I need to make it work for array
parameters; but maybe that's not as easy.  :)

Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux