|
From: Bart V. A. <bar...@gm...> - 2006-08-16 15:37:25
|
Hello Karai,
What would such a compiler do more than the -fmudflap feature of gcc 4 ?
See also
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html#Optimize-Options
On 8/16/06, Karai Csaba <cs...@fr...> wrote:
>
> Hi!
>
> If you, developers are interested, I would write a new component for
> valgrind, a precompiler.
>
> The precompiler would modify the C/C++ code to detect more memory
> errors in the program.
>
> How it would work?
>
> - one should compile with valgrind-cc instead of gcc
> - valgrind-cc calls the gcc -E for getting a clean code
> without macros and includes
> - after that it modifies the code for further checks
> - compiles the modified code
>
>
> My precompiler could detect array bound errors, such as:
>
>
> static int array [ 5 ];
> void error()
> {
> array[ 10 ] = 10;
> }
>
>
> After the modifications:
>
> static int array [ 5 ];
> void error()
> {
> indexcheck(10,5);array[ 10 ] = 10;
> }
>
> void indexcheck( int i1, int i2 )
> {
> if( i1 < 0 || i1 >= i2 )
> ...
> }
>
>
>
> This could work for primitive types, where no operator[] is defined.
>
> Do you think it worths to write such a component?
>
|