[PATCH v21 18/27] test: remove use of VLAs for Windows built code in bitset tests
David Marchand
david.marchand at redhat.com
Wed Feb 5 17:35:26 CET 2025
Hello André,
On Tue, Feb 4, 2025 at 9:57 PM Andre Muezerie
<andremue at linux.microsoft.com> wrote:
> @@ -168,10 +169,20 @@ test_flip_size(test_fun test_fun, assign_fun assign_fun, flip_fun flip_fun, size
> rand_bitset(bitset, size);
>
> for (i = 0; i < size; i++) {
> - RTE_BITSET_DECLARE(reference, size);
> + RTE_BITSET_DECLARE(reference, RAND_SET_MAX_SIZE);
> +
> +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 110000)
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Warray-bounds"
> +#endif
>
> + /* gcc is giving false positives here when code is optimized */
Why not simply alloca(te the right size)?
I tested with my gcc 14 (for which I could reproduce the array bound warning).
By replacing with uint64_t *reference = alloca(RTE_BITSET_SIZE(size)),
gcc seems to be less smart and won't inspect 'reference' and 'bitset'
arrays boundaries.
> rte_bitset_copy(reference, bitset, size);
>
> +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 110000)
> +#pragma GCC diagnostic pop
> +#endif
> +
> bool value = test_fun(bitset, i);
>
> flip_fun(bitset, i);
The rest of the series lgtm and the plan is to merge it for rc1.
Just beware that, if you send a new revision, new drivers (net/xsc and
net/zxdh) landed in main.
Both use VLA, so both require cflags += no_wvla_cflag in their meson.build.
--
David Marchand
More information about the dev
mailing list