[dpdk-dev] examples/ip_pipeline: fix build error for gcc 4.8

Message ID 1465472328-226671-1-git-send-email-danielx.t.mrzyglod@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Daniel Mrzyglod June 9, 2016, 11:38 a.m. UTC
  This patch fixes a maybe-uninitialized warning when compiling DPDK with GCC 4.8

examples/ip_pipeline/pipeline/pipeline_common_fe.c: In function 'app_pipeline_track_pktq_out_to_link':
examples/ip_pipeline/pipeline/pipeline_common_fe.c:66:31: error:
'reader' may be used uninitialized in this function [-Werror=maybe-uninitialized]

   struct app_pktq_out_params *pktq_out =

Fixes: 760064838ec0 ("examples/ip_pipeline: link routing output ports to devices")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 examples/ip_pipeline/app.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Cristian Dumitrescu June 9, 2016, 10:52 a.m. UTC | #1
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Thursday, June 9, 2016 12:39 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix build error for gcc 4.8
> 
> This patch fixes a maybe-uninitialized warning when compiling DPDK with
> GCC 4.8
> 

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  
Thomas Monjalon June 14, 2016, 7:04 p.m. UTC | #2
2016-06-09 13:38, Daniel Mrzyglod:
> This patch fixes a maybe-uninitialized warning when compiling DPDK with GCC 4.8
> 
> examples/ip_pipeline/pipeline/pipeline_common_fe.c: In function 'app_pipeline_track_pktq_out_to_link':
> examples/ip_pipeline/pipeline/pipeline_common_fe.c:66:31: error:
> 'reader' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
>    struct app_pktq_out_params *pktq_out =
> 
> Fixes: 760064838ec0 ("examples/ip_pipeline: link routing output ports to devices")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>

For a weird reason, this patch triggers a new error:

examples/ip_pipeline/pipeline/pipeline_common_fe.c:In function ‘app_pipeline_track_pktq_out_to_link’:
examples/ip_pipeline/pipeline/pipeline_common_fe.c:124:11:
error: ‘id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    status = ptype->fe_ops->f_track(&pp,
           ^
In file included from examples/ip_pipeline/pipeline/pipeline_common_fe.h:44:0,
                 from examples/ip_pipeline/pipeline/pipeline_common_fe.c:47:
examples/ip_pipeline/app.h:734:26: note: ‘id’ was declared here
  uint32_t n_readers = 0, id, i;
                          ^
examples/ip_pipeline/pipeline/pipeline_common_fe.c:97:11:
error: ‘id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    status = ptype->fe_ops->f_track(&pp,
           ^
In file included from examples/ip_pipeline/pipeline/pipeline_common_fe.h:44:0,
                 from examples/ip_pipeline/pipeline/pipeline_common_fe.c:47:
examples/ip_pipeline/app.h:674:26: note: ‘id’ was declared here
  uint32_t n_readers = 0, id, i;
                          ^
  
Michal Jastrzebski June 16, 2016, 1:35 p.m. UTC | #3
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon

> Sent: Tuesday, June 14, 2016 9:04 PM

> To: Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>

> Cc: dev@dpdk.org; Singh, Jasvinder <jasvinder.singh@intel.com>;

> Dumitrescu, Cristian <cristian.dumitrescu@intel.com>

> Subject: Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix build error for gcc

> 4.8

> 

> 2016-06-09 13:38, Daniel Mrzyglod:

> > This patch fixes a maybe-uninitialized warning when compiling DPDK with

> GCC 4.8

> >

> > examples/ip_pipeline/pipeline/pipeline_common_fe.c: In function

> 'app_pipeline_track_pktq_out_to_link':

> > examples/ip_pipeline/pipeline/pipeline_common_fe.c:66:31: error:

> > 'reader' may be used uninitialized in this function [-Werror=maybe-

> uninitialized]

> >

> >    struct app_pktq_out_params *pktq_out =

> >

> > Fixes: 760064838ec0 ("examples/ip_pipeline: link routing output ports to

> devices")

> >

> > Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>

> 

> For a weird reason, this patch triggers a new error:

> 

> examples/ip_pipeline/pipeline/pipeline_common_fe.c:In function

> ‘app_pipeline_track_pktq_out_to_link’:

> examples/ip_pipeline/pipeline/pipeline_common_fe.c:124:11:

> error: ‘id’ may be used uninitialized in this function [-Werror=maybe-

> uninitialized]

>     status = ptype->fe_ops->f_track(&pp,

>            ^

> In file included from

> examples/ip_pipeline/pipeline/pipeline_common_fe.h:44:0,

>                  from examples/ip_pipeline/pipeline/pipeline_common_fe.c:47:

> examples/ip_pipeline/app.h:734:26: note: ‘id’ was declared here

>   uint32_t n_readers = 0, id, i;

>                           ^

> examples/ip_pipeline/pipeline/pipeline_common_fe.c:97:11:

> error: ‘id’ may be used uninitialized in this function [-Werror=maybe-

> uninitialized]

>     status = ptype->fe_ops->f_track(&pp,

>            ^

> In file included from

> examples/ip_pipeline/pipeline/pipeline_common_fe.h:44:0,

>                  from examples/ip_pipeline/pipeline/pipeline_common_fe.c:47:

> examples/ip_pipeline/app.h:674:26: note: ‘id’ was declared here

>   uint32_t n_readers = 0, id, i;

>                           ^


Hi Thomas,
Do You have this error on the same environment?
  

Patch

diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
index 848244a..592c17c 100644
--- a/examples/ip_pipeline/app.h
+++ b/examples/ip_pipeline/app.h
@@ -667,7 +667,7 @@  app_swq_get_reader(struct app_params *app,
 	struct app_pktq_swq_params *swq,
 	uint32_t *pktq_in_id)
 {
-	struct app_pipeline_params *reader;
+	struct app_pipeline_params *reader = NULL;
 	uint32_t pos = swq - app->swq_params;
 	uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
 		RTE_DIM(app->pipeline_params));
@@ -727,7 +727,7 @@  app_tm_get_reader(struct app_params *app,
 	struct app_pktq_tm_params *tm,
 	uint32_t *pktq_in_id)
 {
-	struct app_pipeline_params *reader;
+	struct app_pipeline_params *reader = NULL;
 	uint32_t pos = tm - app->tm_params;
 	uint32_t n_pipelines = RTE_MIN(app->n_pipelines,
 		RTE_DIM(app->pipeline_params));