--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: gcc-4.7: misleading warning in xserver-xorg-input-mouse (array subscript is above array bounds)
- From: Petr Salinger <Petr.Salinger@seznam.cz>
- Date: Sat, 14 Jul 2012 10:40:30 +0200 (CEST)
- Message-id: <alpine.LRH.2.02.1207141008230.19010@sci.felk.cvut.cz>
Package: gcc-4.7
Version: 4.7.1-2
User: debian-bsd@lists.debian.org
Usertags: kfreebsd
Hi,
current gcc produces (at least on kfreebsd-amd64) misleading warning
during compilation of xserver-xorg-input-mouse.
It together with -Werror leads to #665390.
Attached please find reduced testcase, it probably produces the same
warning also on (linux-)amd64.
gcc -Wall -O2 bsd_mouse-bounds.c -c
bsd_mouse-bounds.c: In function 'CheckProtocol':
bsd_mouse-bounds.c:35:30: warning: array subscript is above array bounds [-Warray-bounds]
Petr
extern int xf86NameCmp(const char *s1, const char *s2);
extern void *xcalloc(int, int);
typedef const char **(*BuiltinNamesProc)(void);
typedef int (*CheckProtocolProc)(const char *protocol);
typedef struct {
BuiltinNamesProc BuiltinNames;
CheckProtocolProc CheckProtocol;
} OSMouseInfoRec, *OSMouseInfoPtr;
static const char *internalNames[] = {
((void *)0)
};
static const char *miscNames[] = {
"SysMouse",
((void *)0)
};
static const char **
BuiltinNames(void)
{
return internalNames;
}
static int
CheckProtocol(const char *protocol)
{
int i;
for (i = 0; internalNames[i]; i++)
if (xf86NameCmp(protocol, internalNames[i]) == 0)
return 1;
for (i = 0; miscNames[i]; i++)
if (xf86NameCmp(protocol, miscNames[i]) == 0)
return 1;
return 0;
}
OSMouseInfoPtr
OSMouseInit(int flags)
{
OSMouseInfoPtr p;
p = xcalloc(sizeof(OSMouseInfoRec), 1);
if (!p)
return ((void *)0);
p->BuiltinNames = BuiltinNames;
p->CheckProtocol = CheckProtocol;
return p;
}
--- End Message ---
--- Begin Message ---
- To: Petr Salinger <Petr.Salinger@seznam.cz>, 681557-done@bugs.debian.org
- Subject: Re: Bug#681557: gcc-4.7: misleading warning in xserver-xorg-input-mouse (array subscript is above array bounds)
- From: Matthias Klose <doko@debian.org>
- Date: Wed, 08 May 2013 15:16:08 +0200
- Message-id: <518A5018.4030302@debian.org>
- In-reply-to: <alpine.LRH.2.02.1207141008230.19010@sci.felk.cvut.cz>
- References: <alpine.LRH.2.02.1207141008230.19010@sci.felk.cvut.cz>
tags 681557 + wontfix fixed-upstream
retitle 681557 [fixed in 4.8] misleading warning in xserver-xorg-input-mouse
(array subscript is above array bounds)
thanks
Am 14.07.2012 10:40, schrieb Petr Salinger:
> Package: gcc-4.7
> Version: 4.7.1-2
> User: debian-bsd@lists.debian.org
> Usertags: kfreebsd
>
> Hi,
>
> current gcc produces (at least on kfreebsd-amd64) misleading warning during
> compilation of xserver-xorg-input-mouse.
> It together with -Werror leads to #665390.
>
> Attached please find reduced testcase, it probably produces the same warning
> also on (linux-)amd64.
>
> gcc -Wall -O2 bsd_mouse-bounds.c -c
> bsd_mouse-bounds.c: In function 'CheckProtocol':
> bsd_mouse-bounds.c:35:30: warning: array subscript is above array bounds
> [-Warray-bounds]
>
> Petr
>
fixed in 4.8, won't fix in 4.7.
--- End Message ---