From: Marvin Liu <yong.liu@intel.com>
To: maxime.coquelin@redhat.com, ferruh.yigit@intel.com
Cc: dev@dpdk.org, tiwei.bie@intel.com, Marvin Liu <yong.liu@intel.com>
Subject: [dpdk-dev] [PATCH] net/virtio: fix build with gcc optimization on
Date: Wed, 4 Jul 2018 18:56:25 +0800 [thread overview]
Message-ID: <20180704105625.39462-1-yong.liu@intel.com> (raw)
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
next reply other threads:[~2018-07-04 3:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 10:56 Marvin Liu [this message]
2018-07-04 9:52 ` Ferruh Yigit
2018-07-06 2:00 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180704105625.39462-1-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=tiwei.bie@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).