Build problem with ToT GCC
Steve Ellcey
sellcey@imgtec.com
Fri Apr 17 20:46:00 GMT 2015
On Fri, 2015-04-17 at 13:02 -0700, Steve Ellcey wrote:
> On Fri, 2015-04-17 at 12:58 -0700, Roland McGrath wrote:
> > > This patch did fix the problem in dl-open.c but dl-close.c has the same
> > > issue and would need the same fix.
> >
> > Please show that error.
>
> dl-close.c: In function '_dl_close_worker':
> dl-close.c:136:42: error: array subscript is outside array bounds
> [-Werror=array-bounds]
> struct link_namespaces *ns = &GL(dl_ns)[nsid];
> ^
> cc1: all warnings being treated as errors
Weird, I assumed that the dl-close.c issue was the same as the dl-open.c
problem. But it looks different. After cutting it down with delta I
get the following small test case and error. I do not see how GCC can
know that nsid is not 0.
Steve Ellcey
sellcey@imgtec.com
extern void bad (const char *__assertion) __attribute__ ((__nothrow__ ))
__attribute__ ((__noreturn__));
struct link_map { long int l_ns; };
extern struct link_namespaces
{
unsigned int _ns_nloaded;
} _dl_ns[1];
void _dl_close_worker (struct link_map *map)
{
long int nsid = map->l_ns;
struct link_namespaces *ns = &_dl_ns[nsid];
(nsid != 0) ? (void) (0) : bad ("nsid != 0");
--ns->_ns_nloaded;
% inst*/bin/*-gcc -O2 -Wall -Werror x.c
x.c: In function '_dl_close_worker':
x.c:10:39: error: array subscript is outside array bounds [-Werror=array-bounds]
struct link_namespaces *ns = &_dl_ns[nsid];
^
x.c:10:39: error: array subscript is outside array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors
More information about the Libc-alpha
mailing list