This is an archive of the discontinued LLVM Phabricator instance.

Don't do uint64_t(1) << 64 in maxUIntN.
ClosedPublic

Authored by jlebar on Jul 15 2016, 5:41 PM.

Details

Summary

This shift is undefined behavior (and, as compiled by clang, gives the
wrong answer for maxUIntN(64)).

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 64213.Jul 15 2016, 5:41 PM
jlebar retitled this revision from to Don't do uint64_t(1) << 64 in maxUIntN..
jlebar updated this object.
jlebar added a reviewer: mkuper.
jlebar added subscribers: rsmith, jroelofs, llvm-commits.
mkuper accepted this revision.Jul 15 2016, 6:00 PM
mkuper edited edge metadata.

LGTM.
I'm not sure there isn't a better way to do this ( :-) ), but let's get correctness right first.

This revision is now accepted and ready to land.Jul 15 2016, 6:00 PM

Yeah, I have a faster way, but I agree, correctness first.

This revision was automatically updated to reflect the committed changes.