Is there any way to do array bounds checking in C++ compiled using g++?
- Valgrind's Memcheck can't detect overflows on arrays allocated on the stack. 
- The GCC extension enabled by - -fbounds-checkingis only implemented for the C front end.
Ideally, the source code shouldn't be modified in any way. Using std::vector, std::tr1::array or boost::array is not an option because the codebase is large and such shift would be infeasible.
 
     
     
     
    