> > There was a brief thread on e.g. 'icmp[0] > 0' generating strange > code; I've looked into this a fair amount and want to share what I > have so far. I've committed a fix that's purely hackery, and only > works for the specific case of "foo > 0" (even "0 < foo" is still > broken). It fails to optimize away "sub #0", since the optimizer > needs to see the subtraction of the constant in order to put the > 0x80000000 back.
Thanks Bill for looking into this. Here are my comments : I think that we need to include a more complex handling of signed vs. unsigned arithmetics, like what is done in C. I dont know to what extent the bpf language will permit us to implement things like sign extentions though. We would need to have things like implicit castings, and default ways to handle certain evaluation (like signed == unsigned always evaluates unsigned...) Does anyone have a reference to the C standard on arithmetic evaluations? I thinks this would be a good start. I dont think there is an easy way of handling signed/unsigned expressions in a general way, after what I have read so far on the net. There a quite a couple of rules in the C standard regarding arithmetic evaluations. I'll try to dig out a clear descriptions of those and post them on the list this afternoon. I'm getting the feeling that this will require quite some work to change... Daniel Shane. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe
