From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uosv8-00023c-8C for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:13:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uosv6-0007YV-RU for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:13:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uosv6-0007YP-KL for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:13:48 -0400 Message-ID: <51C032D2.80405@redhat.com> Date: Tue, 18 Jun 2013 12:13:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1370599329-16682-1-git-send-email-xiawenc@linux.vnet.ibm.com> <87ehcedsi7.fsf@blackfin.pond.sub.org> In-Reply-To: <87ehcedsi7.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] build: remove compile warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org, Robert Relyea , alevy@redhat.com, stefanha@redhat.com, mlureau@redhat.com, Wenchao Xia Il 07/06/2013 14:17, Markus Armbruster ha scritto: >> diff --git a/util/iov.c b/util/iov.c >> index cc6e837..b91cfb9 100644 >> --- a/util/iov.c >> +++ b/util/iov.c >> @@ -146,7 +146,7 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, >> { >> ssize_t total = 0; >> ssize_t ret; >> - size_t orig_len, tail; >> + size_t orig_len = 0, tail; >> unsigned niov; >> >> while (bytes > 0) { > > Here are the uses of orig_len: > > if (tail) { > /* second, fixup the last element, and remember the original > * length */ > assert(niov < iov_cnt); > assert(iov[niov].iov_len > tail); > orig_len = iov[niov].iov_len; > iov[niov++].iov_len = tail; > } > > ret = do_send_recv(sockfd, iov, niov, do_send); > > /* Undo the changes above before checking for errors */ > if (tail) { > iov[niov-1].iov_len = orig_len; > } > > > gcc is too stupid to understand the control flow. The initialization > shuts it up. Looks like most people's GCC is not that stupid, or I would have broken build for everyone, right? Paolo