This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/8268] no compile time array index checking



------- Comment #27 from dcb314 at hotmail dot com  2006-02-18 14:33 -------
(In reply to comment #21)
> hmm, thanks. it should have looked like this:

I tried your second patch, and the compile of the compiler got as far
as the following

/home/dcb/gnu/42-20060211/working/./prev-gcc/xgcc
-B/home/dcb/gnu/42-20060211/working/./prev-gcc/
-B/home/dcb/gnu/42-20060211/results/x86_64-unknown-linux-gnu/bin/ -c   -g -O2
-DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
-Wold-style-definition -Wmissing-format-attribute -Werror -fno-common  
-DHAVE_CONFIG_H -I. -I. -I../../src/gcc-4.2-20060211/gcc
-I../../src/gcc-4.2-20060211/gcc/. -I../../src/gcc-4.2-20060211/gcc/../include
-I../../src/gcc-4.2-20060211/gcc/../libcpp/include 
-I../../src/gcc-4.2-20060211/gcc/../libdecnumber -I../libdecnumber   
../../src/gcc-4.2-20060211/gcc/real.c -o
real.o../../src/gcc-4.2-20060211/gcc/real.c: In function 'real_to_integer2':
../../src/gcc-4.2-20060211/gcc/real.c:1385: error: array reference -1 below
range min (0)
../../src/gcc-4.2-20060211/gcc/real.c: In function 'real_from_integer':
../../src/gcc-4.2-20060211/gcc/real.c:2050: error: array reference -1 below
range min (0)
../../src/gcc-4.2-20060211/gcc/real.c: In function 'encode_ieee_quad':
../../src/gcc-4.2-20060211/gcc/real.c:3564: error: array reference 3 above
range max (2)
../../src/gcc-4.2-20060211/gcc/real.c:3615: error: array reference 3 above
range max (2)
../../src/gcc-4.2-20060211/gcc/real.c: In function 'decode_ieee_quad':
../../src/gcc-4.2-20060211/gcc/real.c:3693: error: array reference 3 above
range max (2)
../../src/gcc-4.2-20060211/gcc/real.c:3719: error: array reference 3 above
range max (2)
../../src/gcc-4.2-20060211/gcc/real.c:3745: error: array reference 3 above
range max (2)

It seems that a combination of the new warning and the Werror flag prevents
compilation.

On the other point about using arrayName[ 4] for the "end of struct" hack,
I'd be entirely happy with false positives. 

Folks who want that hack can just say arrayName[ 1] to avoid the new warning
anyway.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8268


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]