Re: [PATCH] -Wshift-overflow: Warn for shifting sign bit out of a negative number

2015-12-02 Thread Jeff Law
On 11/26/2015 04:52 AM, Paolo Bonzini wrote: maybe_warn_shift_overflow is checking for patterns such as (1 << 31) and not warning for them. However, if the shifted value is negative, a shift by a non-zero amount will always shift *out* of the sign bit rather than into it. Thus it should be warne

[PATCH] -Wshift-overflow: Warn for shifting sign bit out of a negative number

2015-11-26 Thread Paolo Bonzini
maybe_warn_shift_overflow is checking for patterns such as (1 << 31) and not warning for them. However, if the shifted value is negative, a shift by a non-zero amount will always shift *out* of the sign bit rather than into it. Thus it should be warned about, even if the value only requires one bi