Received: from eggs.gnu.org ([2001:4830:134:3::10]:33348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAY9-00040u-L9 for qemu-devel@nongnu.org; Fri, 15 May 2015 04:00:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtAY5-0003T7-Po for qemu-devel@nongnu.org; Fri, 15 May 2015 04:00:53 -0400 From: Markus Armbruster References: <1431635892-31996-1-git-send-email-sw@weilnetz.de> Date: Fri, 15 May 2015 10:00:45 +0200 In-Reply-To: <1431635892-31996-1-git-send-email-sw@weilnetz.de> (Stefan Weil's message of "Thu, 14 May 2015 22:38:12 +0200") Message-ID: <87y4kqnuc2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] pci: Fix compiler warning (MinGW-w64 gcc 4.9) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Trivial , QEMU Developer Stefan Weil writes: > i686-w64-mingw32-gcc 4.9.1 from Debian Jessie complains: > > hw/pci/pci.c:938:29: warning: > array subscript is above array bounds [-Warray-bounds] > > Using g_assert instead of assert fixes this warning. > > Signed-off-by: Stefan Weil > --- > hw/pci/pci.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 48f19a3..34f71dc 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -927,8 +927,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, > uint64_t wmask; > pcibus_t size = memory_region_size(memory); > > - assert(region_num >= 0); > - assert(region_num < PCI_NUM_REGIONS); > + g_assert(region_num >= 0); > + g_assert(region_num < PCI_NUM_REGIONS); > if (size & (size-1)) { > fprintf(stderr, "ERROR: PCI region size must be pow2 " > "type=0x%x, size=0x%"FMT_PCIBUS"\n", type, size); This is obviously a bug in that version of MinGW. Have you reported it? Do we really want to work around it?