Howard Chu <[EMAIL PROTECTED]> writes: > Daniel Berlin wrote: > > > > We ask the TBAA analyzer "can a store to a short * touch i. > > In this case, it says "no", because it's not legal. > > > If you know the code is not legal, why don't you abort the compilation > with an error code?
It's not actually that easy to detect the undefined cases. Sometimes it's easy, sure. But most times it is not. The compiler does not normally do the sort of analysis which is required. That said, one of my co-workers has developed a patch which detects most aliasing violations, based on the compiler's existing alias analysis. It is able to give warnings for a wide range of cases which the compiler does not currently detect, for a relatively small increase in compilation time. If everything works out right, we'll propose it for gcc 4.3. Ian