------- Additional Comments From law at redhat dot com 2005-06-21 01:20 ------- Subject: Re: no compile time array index checking
On Tue, 2005-06-21 at 00:10 +0000, giovannibajo at libero dot it wrote: > ------- Additional Comments From giovannibajo at libero dot it 2005-06-21 > 00:10 ------- > Doesn't -fmudflap handle this? I would expect mudflap to issue a runtime warning. If we really wanted to tackle this better a compile-time, we'd run a pass to look at all the ARRAY_REFs for those which have an out-of-range index. It wouldn't be terribly hard to stick one in just before we leave SSA form. Doing it that way has a number of useful advantages -- we'll see a lot more ARRAY_REFs rather than pointer arithmetic (due to constant address propagation as well as ADDR_EXPR propagation). We'll also see more constant indices due to const propagation done by CCP, VRP and DOM. And (of course) it would "just work" for all the languages currently supported by GCC. I believe Jakub has done some work in this area that might be useful as a starting point. jeff -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8268