ludovic.cour...@inria.fr (Ludovic Courtès) writes: > "Joseph S. Myers" <jos...@codesourcery.com> skribis: > >> On Fri, 2 Dec 2011, Ludovic Courtès wrote: >> >>> Is there a way array dimension info could be preserved? >> >> Perhaps you could explain the actual problem you are trying to solve? > > I’m just thinking that, if that information were preserved, GCC could do > static bound checking and/or generate bound checking code.
The ABI for a C function does not provide any way to pass down the dimensions of an array. Any such change would mean that you would have to recompiled the whole world, including the C library. In practice that is not going to happen. GCC can already generate bounds checking code via -fmudflap. It works by recording the bounds in the memory area, not in the function arguments. There is also Valgrind and AddresSanitizer. Ian