|
From: Gisle V. <gv...@br...> - 2012-12-18 14:37:20
|
I'm sorry if issues with MingW64-gcc is off-topic here. But I'm having
trouble understanding the following warning when using '-O2'. This minimal
program:
#include <stdlib.h>
#define MAX_PROTO_ALIASES 0
struct _protoent {
char *p_name;
char *p_aliases [MAX_PROTO_ALIASES+1];
int p_proto;
struct _protoent *p_next;
};
extern struct _protoent *proto0;
void endprotoent (void)
{
struct _protoent *p, *next;
for (p = proto0; p; p = next)
{
int i;
for (i = 0; p->p_aliases[i]; i++) < < line 20
free (p->p_aliases[i]);
next = p->p_next;
free (p->p_name);
free (p);
}
}
produces this warning:
x86_64-w64-mingw32-gcc -O2 -c -m64 -Wall array-bounds.c
array-bounds.c: In function 'endprotoent':
array-bounds.c:20:29: warning: array subscript is above array bounds [-Warray-bounds]
What is this all about? How does gcc believe 'i' can get above 1' ?
This warning isn't produced with the "normal" mingw gcc 4.7.2.
---------
x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=g:/mingw32/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /home/ruben/mingw-w64/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --ta
rget=x86_64-w64-mingw32 --with-sysroot=/home/ruben/mingw-w64/mingw32mingw64/mingw64 --prefix=/home/ruben/mingw
-w64/mingw32mingw64/mingw64 --with-gmp=/home/ruben/mingw-w64/prereq/i686-w64-mingw32/install --with-mpfr=/home
/ruben/mingw-w64/prereq/i686-w64-mingw32/install --with-mpc=/home/ruben/mingw-w64/prereq/i686-w64-mingw32/inst
all --with-ppl=/home/ruben/mingw-w64/prereq/i686-w64-mingw32/install --with-cloog=/home/ruben/mingw-w64/prereq
/i686-w64-mingw32/install --disable-ppl-version-check --disable-cloog-version-check --enable-cloog-backend=isl
--with-host-libstdcxx='-static -lstdc++ -lm' --enable-shared --enable-static --enable-threads=win32 --enable-
plugins --disable-multilib --enable-languages=c,lto,c++,objc,obj-c++,fortran,java --enable-libgomp --enable-fu
lly-dynamic-string --enable-libstdcxx-time --disable-nls --disable-werror --enable-checking=release --with-gnu
-as --with-gnu-ld --disable-win32-registry --disable-rpath --disable-werror --with-libiconv-prefix=/home/ruben
/mingw-w64/prereq/i686-w64-mingw32/install --with-pkgversion=rubenvb-4.7.2-release --with-bugurl=mingw-w64-pub
li...@li... CC= CFLAGS='-O2 -march=nocona -mtune=core2 -fomit-frame-pointer -momit-leaf-frame-po
inter' LDFLAGS=' -Wl,--large-address-aware'
Thread model: win32
gcc version 4.7.2 (rubenvb-4.7.2-release)
--gv
|