From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoHKp-0001Ow-UY for qemu-devel@nongnu.org; Mon, 09 Jul 2012 13:01:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoHKo-0008Db-2K for qemu-devel@nongnu.org; Mon, 09 Jul 2012 13:01:19 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:62519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoHKn-0008DN-U9 for qemu-devel@nongnu.org; Mon, 09 Jul 2012 13:01:17 -0400 Received: by yenl1 with SMTP id l1so11150579yen.4 for ; Mon, 09 Jul 2012 10:01:16 -0700 (PDT) Message-ID: <4FFB0E56.9070806@codemonkey.ws> Date: Mon, 09 Jul 2012 12:01:10 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1341843388-5663-1-git-send-email-kwolf@redhat.com> <1341843388-5663-24-git-send-email-kwolf@redhat.com> <4FFAF261.5010804@codemonkey.ws> <4FFAF7A9.8070506@redhat.com> <4FFB0AF8.30906@redhat.com> In-Reply-To: <4FFB0AF8.30906@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 23/25] fdc: Move floppy geometry guessing back from block.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org On 07/09/2012 11:46 AM, Eric Blake wrote: > On 07/09/2012 10:07 AM, Markus Armbruster wrote: > >>>> This is an unconditional use of fd_type[0]. If floppy == NULL, this is >>>> dereferencing an uninitialized value. >>>> >>>> I'm not sure why the explicit initialization was removed... >> >> Brain fart on my part, sorry. The old loop assigns only if the drive >> exists. The new loop assigns unconditionally. Except the whole loop is >> still conditional. >> >> Testing can't flag this, because floppy is never null. >> >>> Looks broken indeed. I just wonder why my gcc (or the buildbots) didn't >>> complain. >> >> Me too. Looks like I should upgrade to a more recent gcc. > > It's probably not the version of the gcc you used, but whether or not > your CFLAGS include -O2. Gcc has the (IMO very annoying) limitation > that uninitialized-use analysis can only be performed if you are also > doing optimization. You have to use a tool like clang or Coverity if > you want more reliable uninitialized-use analysis even while building > -O0 debug images. > Specifically, without -O, GCC doesn't do data flow analysis so any warning that requires DFA won't get triggered. So in general, if you are normally building with -O0, make sure to also build with -O in order to get full warnings. Regards, Anthony Liguori