On Sat, Mar 20, 2010 at 05:32:28PM +0200, Mateusz Kocielski wrote: > As a part of my work I would like to write a translator for C language and a > small library. Their goal would be to detect integer overflows, stack > overflows, > problems with static array indexing, etc (when such occur during the program > execution). It will enable me to uncover more bugs in the software. > > (Eg. > > int foo() { char d[10]; int i; i = 5; return d[i] } > > will be translate into: > > int foo() { char d[10]; int i; int _x; i = 5; _x = i; if ( _x < 0 || > _x > 9 ) ERROR(); > return d[_x]; } > )
I think gcc has support for something like this. Take a look at the -fmudflap option. eric