DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on
  2018-07-04 10:56 [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on Marvin Liu
@ 2018-07-04  9:52 ` Ferruh Yigit
  2018-07-06  2:00   ` Liu, Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2018-07-04  9:52 UTC (permalink / raw)
  To: Marvin Liu, maxime.coquelin; +Cc: dev, tiwei.bie

On 7/4/2018 11:56 AM, Marvin Liu wrote:
> build error on gcc version 8.1.1 20180502 (Red Hat 8.1.1-1),
> with optimization level >= O2
> 
> .../drivers/net/virtio/virtio_rxtx.c:
>    In function ‘virtio_xmit_cleanup_inorder’:
> .../drivers/net/virtio/virtio_rxtx.c:195:24:
>    error: ‘desc_idx’ may be used uninitialized in this function
>    [-Werror=maybe-uninitialized]
>   uint16_t i, used_idx, desc_idx, last_idx;
>                         ^~~~~~~~
> Optimization option fcode-hoisting will cause error on gcc 8.x.x.
> Initialize desc_idx before using can fix build error.
> 
> Fixes: e3851816e63c ("net/virtio: support in-order Rx and Tx")
> 
> Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>

Hi Marvin,

Sorry if this was not clear, I already did the update while merging the patch in
next-net [1]. Can you please check the latest code in next-net?

[1]
...
     193 virtio_xmit_cleanup_inorder(struct virtqueue *vq, uint16_t num)
     194 {
     195         uint16_t i, used_idx, desc_idx = 0, last_idx;
...

> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 6394071b8..19beb4bf4 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -192,7 +192,8 @@ virtio_xmit_cleanup(struct virtqueue *vq, uint16_t num)
>  static void
>  virtio_xmit_cleanup_inorder(struct virtqueue *vq, uint16_t num)
>  {
> -	uint16_t i, used_idx, desc_idx, last_idx;
> +	uint16_t i, used_idx, last_idx;
> +	uint16_t desc_idx = 0;
>  	int16_t free_cnt = 0;
>  	struct vq_desc_extra *dxp = NULL;
>  
> 

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

* [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on
@ 2018-07-04 10:56 Marvin Liu
  2018-07-04  9:52 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Marvin Liu @ 2018-07-04 10:56 UTC (permalink / raw)
  To: maxime.coquelin, ferruh.yigit; +Cc: dev, tiwei.bie, Marvin Liu

build error on gcc version 8.1.1 20180502 (Red Hat 8.1.1-1),
with optimization level >= O2

.../drivers/net/virtio/virtio_rxtx.c:
   In function ‘virtio_xmit_cleanup_inorder’:
.../drivers/net/virtio/virtio_rxtx.c:195:24:
   error: ‘desc_idx’ may be used uninitialized in this function
   [-Werror=maybe-uninitialized]
  uint16_t i, used_idx, desc_idx, last_idx;
                        ^~~~~~~~
Optimization option fcode-hoisting will cause error on gcc 8.x.x.
Initialize desc_idx before using can fix build error.

Fixes: e3851816e63c ("net/virtio: support in-order Rx and Tx")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 6394071b8..19beb4bf4 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -192,7 +192,8 @@ virtio_xmit_cleanup(struct virtqueue *vq, uint16_t num)
 static void
 virtio_xmit_cleanup_inorder(struct virtqueue *vq, uint16_t num)
 {
-	uint16_t i, used_idx, desc_idx, last_idx;
+	uint16_t i, used_idx, last_idx;
+	uint16_t desc_idx = 0;
 	int16_t free_cnt = 0;
 	struct vq_desc_extra *dxp = NULL;
 
-- 
2.17.0

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

* Re: [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on
  2018-07-04  9:52 ` Ferruh Yigit
@ 2018-07-06  2:00   ` Liu, Yong
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2018-07-06  2:00 UTC (permalink / raw)
  To: Yigit, Ferruh, maxime.coquelin; +Cc: dev, Bie, Tiwei



> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, July 04, 2018 5:52 PM
> To: Liu, Yong <yong.liu@intel.com>; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; Bie, Tiwei <tiwei.bie@intel.com>
> Subject: Re: [PATCH] net/virtio: fix build with gcc optimization on
> 
> On 7/4/2018 11:56 AM, Marvin Liu wrote:
> > build error on gcc version 8.1.1 20180502 (Red Hat 8.1.1-1),
> > with optimization level >= O2
> >
> > .../drivers/net/virtio/virtio_rxtx.c:
> >    In function ‘virtio_xmit_cleanup_inorder’:
> > .../drivers/net/virtio/virtio_rxtx.c:195:24:
> >    error: ‘desc_idx’ may be used uninitialized in this function
> >    [-Werror=maybe-uninitialized]
> >   uint16_t i, used_idx, desc_idx, last_idx;
> >                         ^~~~~~~~
> > Optimization option fcode-hoisting will cause error on gcc 8.x.x.
> > Initialize desc_idx before using can fix build error.
> >
> > Fixes: e3851816e63c ("net/virtio: support in-order Rx and Tx")
> >
> > Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> 
> Hi Marvin,
> 
> Sorry if this was not clear, I already did the update while merging the
> patch in
> next-net [1]. Can you please check the latest code in next-net?
> 
> [1]
> ...
>      193 virtio_xmit_cleanup_inorder(struct virtqueue *vq, uint16_t num)
>      194 {
>      195         uint16_t i, used_idx, desc_idx = 0, last_idx;
> ...
> 

Ferruh, the latest code in next-net can build pass. You can ignore this patch. 

> >
> > diff --git a/drivers/net/virtio/virtio_rxtx.c
> b/drivers/net/virtio/virtio_rxtx.c
> > index 6394071b8..19beb4bf4 100644
> > --- a/drivers/net/virtio/virtio_rxtx.c
> > +++ b/drivers/net/virtio/virtio_rxtx.c
> > @@ -192,7 +192,8 @@ virtio_xmit_cleanup(struct virtqueue *vq, uint16_t
> num)
> >  static void
> >  virtio_xmit_cleanup_inorder(struct virtqueue *vq, uint16_t num)
> >  {
> > -	uint16_t i, used_idx, desc_idx, last_idx;
> > +	uint16_t i, used_idx, last_idx;
> > +	uint16_t desc_idx = 0;
> >  	int16_t free_cnt = 0;
> >  	struct vq_desc_extra *dxp = NULL;
> >
> >


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

end of thread, other threads:[~2018-07-06  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 10:56 [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on Marvin Liu
2018-07-04  9:52 ` Ferruh Yigit
2018-07-06  2:00   ` Liu, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).