test: fix build with GCC 11
authorKevin Traynor <ktraynor@redhat.com>
Thu, 20 May 2021 11:06:12 +0000 (12:06 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 20 May 2021 21:10:22 +0000 (23:10 +0200)
GCC 11 complains that 'a' is uninitialized.

../dpdk/app/test/test_prefetch.c: In function 'test_prefetch':
../dpdk/app/test/test_prefetch.c:25:9:
error: 'a' may be used uninitialized [-Werror=maybe-uninitialized]
   25 |         rte_prefetch0(&a);
      |         ^~~~~~~~~~~~~~~~~

Fix by initializing 'a'.

Bugzilla ID: 714
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Reported-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Tested-by: Ali Alnubani <alialnu@nvidia.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
app/test/test_prefetch.c

index 5489885..7b4a8e4 100644 (file)
@@ -20,7 +20,7 @@
 static int
 test_prefetch(void)
 {
-       int a;
+       int a = 0;
 
        rte_prefetch0(&a);
        rte_prefetch1(&a);