test/prefetch: fix build with GCC 11

Message ID 20210520110613.387358-1-ktraynor@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series test/prefetch: fix build with GCC 11 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-mellanox-Performance fail Performance Testing issues
ci/iol-mellanox-Functional fail Functional Testing issues
ci/iol-testing fail Testing issues

Commit Message

Kevin Traynor May 20, 2021, 11:06 a.m. UTC
  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>
---
 app/test/test_prefetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ali Alnubani May 20, 2021, 11:14 a.m. UTC | #1
> -----Original Message-----
> From: Kevin Traynor <ktraynor@redhat.com>
> Sent: Thursday, May 20, 2021 2:06 PM
> To: dev@dpdk.org
> Cc: ferruh.yigit@intel.com; Kevin Traynor <ktraynor@redhat.com>;
> stable@dpdk.org; Ali Alnubani <alialnu@nvidia.com>
> Subject: [PATCH] test/prefetch: fix build with GCC 11
> 
> 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>
> ---
>  app/test/test_prefetch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_prefetch.c b/app/test/test_prefetch.c index
> 5489885b51..7b4a8e4144 100644
> --- a/app/test/test_prefetch.c
> +++ b/app/test/test_prefetch.c
> @@ -21,5 +21,5 @@ static int
>  test_prefetch(void)
>  {
> -	int a;
> +	int a = 0;
> 
>  	rte_prefetch0(&a);
> --
> 2.31.1

Was about to send a fix 😊.
Thank you Kevin.

Build is now passing.
Tested-by: Ali Alnubani <alialnu@nvidia.com>

- Ali
  
David Marchand May 20, 2021, 2:31 p.m. UTC | #2
On Thu, May 20, 2021 at 1:07 PM Kevin Traynor <ktraynor@redhat.com> wrote:
>
> 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>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Thomas Monjalon May 20, 2021, 9:06 p.m. UTC | #3
20/05/2021 16:31, David Marchand:
> On Thu, May 20, 2021 at 1:07 PM Kevin Traynor <ktraynor@redhat.com> wrote:
> >
> > 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>
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks
  

Patch

diff --git a/app/test/test_prefetch.c b/app/test/test_prefetch.c
index 5489885b51..7b4a8e4144 100644
--- a/app/test/test_prefetch.c
+++ b/app/test/test_prefetch.c
@@ -21,5 +21,5 @@  static int
 test_prefetch(void)
 {
-	int a;
+	int a = 0;
 
 	rte_prefetch0(&a);