Am Freitag, dem 27.02.2026 um 12:42 -0500 schrieb Yair Lenga via Gcc:
> Greetings!
>
> I'm happy to see discussion (including opposing/disagreeing opinions
> !) on my proposal.
>
> Wanted to cover one of the side-item in separate email - specifically
> keeping -Wvla-larger-than not impacted by the proposed [[gnu::vla]]
>
> In my projects, we use -Wvla and -Wvla-larger-than=512000 (~1MB, given
> each of our threads is configured for 5MB thread. This is the same
> setting we for frame-larger-than.
>
> Common scenario we have is:
>
> // In header.h
> #define MAX_POINTS 25000
>
> // In code
> int foo(void)
> {
> int n = MAX_POINTS ;
> ALLOW_VLA(int v[n+1] ) ; // ALLOW_VLA uses Pragma to ignore -Wvla
> }
>
> The "ALLOW_VLA" indicate that the usage was reviewed - and approved.
Out of curiosity, what would are the criteria for this being allowed
or not? Or in other words, what is the actual use case you are
trying to address?
BTW: this code would always cause a warning with -Wvla-larger-than=, so
I assume it actually looks a bit different.
Martin
> Common issue that we have is that the header.h is modified -> #define
> MAX_POINTS 250000. The compiler does not warn on the VLA use - because
> we tagged it safe. Keeping -Wvla-larger-than=500KB allow us to be
> notified when of places where VLA usage is valid, but exceeds the
> threshold.
>
> Hope this use case is clean - and explain why I believe
> -Wvla-larger-than should NOT be impacted with the proposed [[gnu::lva]
>
> Regards,
> Yair