From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpBs4-0004Ff-JS for qemu-devel@nongnu.org; Wed, 19 Jun 2013 02:27:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpBs3-0001dt-7X for qemu-devel@nongnu.org; Wed, 19 Jun 2013 02:27:56 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:42712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpBs2-0001di-Gj for qemu-devel@nongnu.org; Wed, 19 Jun 2013 02:27:55 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Jun 2013 11:52:01 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 5C95D125804E for ; Wed, 19 Jun 2013 11:56:46 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5J6RiDP28901590 for ; Wed, 19 Jun 2013 11:57:44 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5J6Rln5013735 for ; Wed, 19 Jun 2013 06:27:47 GMT Message-ID: <51C14F3B.4090908@linux.vnet.ibm.com> Date: Wed, 19 Jun 2013 14:27:07 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1370599329-16682-1-git-send-email-xiawenc@linux.vnet.ibm.com> <87ehcedsi7.fsf@blackfin.pond.sub.org> <51C032D2.80405@redhat.com> In-Reply-To: <51C032D2.80405@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V2] build: remove compile warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, Markus Armbruster , qemu-devel@nongnu.org, alevy@redhat.com, stefanha@redhat.com, mlureau@redhat.com, Robert Relyea 于 2013-6-18 18:13, Paolo Bonzini 写道: > 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 > my gcc version: [xiawenc@RH63Wenchao ~]$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) By default configure, it seems qemu didn't set -Werror to break build. -- Best Regards Wenchao Xia