On Thu, Dec 31, 2015 at 12:10:33PM +0700, Duy Nguyen wrote:

> On Tue, Dec 29, 2015 at 1:35 PM, Jeff King <p...@peff.net> wrote:
> > We sometimes use 32-bit unsigned integers as bit-fields.
> > It's fine to access the MSB, because it's unsigned. However,
> > doing so as "1 << 31" is wrong, because the constant "1" is
> > a signed int, and we shift into the sign bit, causing
> > undefined behavior.
> >
> > We can fix this by using "1U" as the constant.
> 
> We have this in cache.h, should it be fixed as well?
> 
> /* CE_EXTENDED2 is for future extension */
> #define CE_EXTENDED2         (1 << 31)

Sort of. We don't actually use it, and since it's a macro, that means it
never even hits the compiler proper itself. So it's not a bug, but it's
a bug waiting to happen. :)

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to