Coverity flags the pp_left_shift and pp_right_shift in pp.c. Either of them can shift by a negative amount, called (ta-dah!) shift. The result of shifting by negative amount is the infamous undefined behavior territory (of the nasal demons kind). (As is shifting by more than the number of bits in the integer, but Coverity doesn't flag that. Yet.) Now, the question is, what should we do? What should we return? (Yes, I'm asking should we define a semantics for this thing which is undefined in C.) undef? shift left by negative n == shift right by -n ? shift right by negative n == shift left by -n? shift by too many bits == shift by n modulo wordbits? (with a sane definition of modulo for negative -n...) for use integer we would need to think about signed behavior. warn? (of "portable" kind?) croak? At the very minimum, I would suggest undef for the negative shift case. (To get Coverity off our case.)Thread Next