All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] service: fix build error "ids uninitialized in rte_service_map_lcore_set"
@ 2017-09-21  1:50 Yi Yang
  2017-09-21 11:55 ` Van Haaren, Harry
  0 siblings, 1 reply; 3+ messages in thread
From: Yi Yang @ 2017-09-21  1:50 UTC (permalink / raw)
  To: dev; +Cc: harry.van.haaren, Yi Yang

v1->v2
  - Change title to more descriptive one
  - Add issue reproduce information to git log body

On current master tree, normal DPDK make will result in
the below error:

    error: ‘ids[0]’ may be used uninitialized in this
    function [-Werror=maybe-uninitialized]
    ret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);

It can be reproduced very easily on Fedora 21 with
gcc-4.9.2-6.fc21.x86_64.

It is fixed after applied this patch.

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 43716bb..e598e16 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -431,7 +431,7 @@ rte_service_start_with_defaults(void)
 	uint32_t count = rte_service_get_count();
 
 	int32_t lcore_iter = 0;
-	uint32_t ids[RTE_MAX_LCORE];
+	uint32_t ids[RTE_MAX_LCORE] = {0};
 	int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE);
 
 	if (lcore_count == 0)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] service: fix build error "ids uninitialized in rte_service_map_lcore_set"
  2017-09-21  1:50 [PATCH v2] service: fix build error "ids uninitialized in rte_service_map_lcore_set" Yi Yang
@ 2017-09-21 11:55 ` Van Haaren, Harry
  2017-09-21 12:41   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Van Haaren, Harry @ 2017-09-21 11:55 UTC (permalink / raw)
  To: Yang, Yi Y, dev; +Cc: thomas

> From: Yang, Yi Y
> Sent: Thursday, September 21, 2017 2:51 AM
> To: dev@dpdk.org
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Yang, Yi Y
> <yi.y.yang@intel.com>
> Subject: [PATCH v2] service: fix build error "ids uninitialized in
> rte_service_map_lcore_set"
> 
> v1->v2
>   - Change title to more descriptive one
>   - Add issue reproduce information to git log body
> 
> On current master tree, normal DPDK make will result in
> the below error:
> 
>     error: ‘ids[0]’ may be used uninitialized in this
>     function [-Werror=maybe-uninitialized]
>     ret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);
> 
> It can be reproduced very easily on Fedora 21 with
> gcc-4.9.2-6.fc21.x86_64.
> 
> It is fixed after applied this patch.
> 
> Signed-off-by: Yi Yang <yi.y.yang@intel.com>


+CC Thomas, please pull this asap, as it causes build issues on various GCC/OS versions.

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>


> ---
>  lib/librte_eal/common/rte_service.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/rte_service.c
> b/lib/librte_eal/common/rte_service.c
> index 43716bb..e598e16 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -431,7 +431,7 @@ rte_service_start_with_defaults(void)
>  	uint32_t count = rte_service_get_count();
> 
>  	int32_t lcore_iter = 0;
> -	uint32_t ids[RTE_MAX_LCORE];
> +	uint32_t ids[RTE_MAX_LCORE] = {0};
>  	int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE);
> 
>  	if (lcore_count == 0)
> --
> 2.1.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] service: fix build error "ids uninitialized in rte_service_map_lcore_set"
  2017-09-21 11:55 ` Van Haaren, Harry
@ 2017-09-21 12:41   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-09-21 12:41 UTC (permalink / raw)
  To: Yang, Yi Y; +Cc: dev, Van Haaren, Harry, nelio.laranjeiro

21/09/2017 13:55, Van Haaren, Harry:
> > From: Yang, Yi Y
> > Sent: Thursday, September 21, 2017 2:51 AM
> > To: dev@dpdk.org
> > Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Yang, Yi Y
> > <yi.y.yang@intel.com>
> > Subject: [PATCH v2] service: fix build error "ids uninitialized in
> > rte_service_map_lcore_set"
> > 
> > v1->v2
> >   - Change title to more descriptive one
> >   - Add issue reproduce information to git log body
> > 
> > On current master tree, normal DPDK make will result in
> > the below error:
> > 
> >     error: ‘ids[0]’ may be used uninitialized in this
> >     function [-Werror=maybe-uninitialized]
> >     ret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);
> > 
> > It can be reproduced very easily on Fedora 21 with
> > gcc-4.9.2-6.fc21.x86_64.

Fixes: 21698354c832 ("service: introduce service cores concept")
Cc: stable@dpdk.org

> > It is fixed after applied this patch.
> > 
> > Signed-off-by: Yi Yang <yi.y.yang@intel.com>
> 
> +CC Thomas, please pull this asap, as it causes build issues on various GCC/OS versions.

Most of compilers do not raise an error.
It seems specific to gcc 4.9.
Nelio reported the same error with gcc 4.9.
Changing the title to "service: fix build with gcc 4.9"

> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-21 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21  1:50 [PATCH v2] service: fix build error "ids uninitialized in rte_service_map_lcore_set" Yi Yang
2017-09-21 11:55 ` Van Haaren, Harry
2017-09-21 12:41   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.