Hi, Ian Lance Taylor <i...@google.com> skribis:
> 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. I understand. However, I’m concerned about keeping the information at compile-time. For example: extern void foo (int a, int x[a]); static void bar (void) { int x[123]; foo (456, x); } Here the compiler could emit a diagnostic in ‘bar’. IOW, ABI restrictions ABI imply that nothing can be done in the body of ‘foo’; however, the information could still used at call sites. WDYT? Thanks, Ludo’.