Please don't take the following as a criticism of imcc - I'm sure I manage to write code with things like this all the time.
On Sat, Feb 22, 2003 at 08:13:59PM +0530, Gopal V wrote: > If memory serves me right, Leopold Toetsch wrote: > > r->score = r->use_count + (r->lhs_use_count << 2); > > > > r->score += 1 << (loop_depth * 3); > > Ok ... deeper the loop the more important the var is .. cool. until variables in 11 deep loops go undefined? (it appears to be a signed int) I'm not sure how to patch this specific instance - just trap loop depths over 10? Should score be unsigned? More importantly, how do we trap these sort of things in the general case? I wonder how hard it would be to make a --fsummon-nasal-demons flag for gcc that added trap code for all classes of undefined behaviour, and caused code to abort (or something more colourfully "undefined") if anything undefined gets executed. I realise that code would run very slowly, but it would be a very very useful debugging tool. Nicholas Clark