On 2011-12-29 16:20:48 -0800, Ian Lance Taylor wrote: > To me this only proves that the compiler is not smart enough to see that > (s >> 1 == 0) implies that ((s & 0xffff) == 0xffff) can not be true. > > Are you suggesting that the compiler should never warn if there is a > conditional guarding the array access? Would that in practice be better > or worse than the current behaviour? I think there should be two different options: * one that would trigger the warning if the compiler can prove that there will always be an out-of-bound access when the function is executed (unless the compiler can prove that the function will never be executed); * one that would trigger the warning if there may be an out-of-bound access. BTW, can the user inform the compiler that some condition holds? i.e. some kind of assert() but specifically for the compiler. -- Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)