This is an archive of the discontinued LLVM Phabricator instance.

Add assertions checking SignExtend{32,64}'s bit width.
ClosedPublic

Authored by jlebar on Jul 16 2016, 3:19 PM.

Details

Summary

The bit width must be greater than zero, otherwise we shift by the
integer's width, which is UB. Also (more obviously) the width must be
less than or equal to the integer's width, otherwise we shift by a
negative number, which is also UB.

Diff Detail

Event Timeline

jlebar updated this revision to Diff 64234.Jul 16 2016, 3:19 PM
jlebar retitled this revision from to Add assertions checking SignExtend{32,64}'s bit width..
jlebar updated this object.
jlebar added a reviewer: rnk.
jlebar added subscribers: dylanmckay, llvm-commits.
compnerd accepted this revision.Jul 16 2016, 6:34 PM
compnerd added a reviewer: compnerd.
This revision is now accepted and ready to land.Jul 16 2016, 6:34 PM
This revision was automatically updated to reflect the committed changes.