Le mercredi 5 décembre 2012 10:24:51, Somchai Smythe a écrit : > Hello, > > From the snapshot of tcc mob I downloaded today, I see this when I > compile: > > clang -o x86_64-gen.o -c x86_64-gen.c -DTCC_TARGET_X86_64 -O3 -m64 > -march=x86-64 -mtune=generic -pipe -fno-strict-aliasing > -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -m64 > tccasm.c:541:72: warning: data argument not used by format string > [-Wformat-extra-args] > sprintf(sname, (n?".%s%d":".%s"), get_tok_str(tok1, NULL), n); > ~~~~~ ^ > tccpp.c:918:22: warning: array index 2 is past the end of the array > (which contains 2 elements) [-Warray-bounds] > str[len++] = cv->tab[2]; > ^ ~ > ./tcc.h:284:5: note: array 'tab' declared here > int tab[2]; > ^ > tccpp.c:919:22: warning: array index 3 is past the end of the array > (which contains 2 elements) [-Warray-bounds] > str[len++] = cv->tab[3]; > ^ ~ > ./tcc.h:284:5: note: array 'tab' declared here > int tab[2]; > ^ > tccgen.c:740:17: warning: array index 2 is past the end of the array > (which contains 2 elements) [-Warray-bounds] > vtop->c.tab[2] &= 0xffff; > ^ ~ > ./tcc.h:284:5: note: array 'tab' declared here > int tab[2]; > ^ > tccgen.c:742:17: warning: array index 3 is past the end of the array > (which contains 2 elements) [-Warray-bounds] > vtop->c.tab[3] = 0; > ^ ~ > ./tcc.h:284:5: note: array 'tab' declared here > int tab[2]; > ^
It is fine because vtop->c is of type CValue and its size, as a union, is guaranteed to be the size of the biggest element. I am a bit worried that new optimization in future version of gcc could optimize out this kind of statement on the ground that we are accessing past the end of the array. > > Should I be worried, or is this expected? The self-tests passed anyway. No need to be worried for now, but we should fix this. > > Thanks! Best regards, Thomas
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
