[llvm-commits] [PATCH] Fixing faulty memsets

Aaron Ballman aaron at aaronballman.com
Sun Mar 11 09:04:09 PDT 2012


On Sat, Mar 10, 2012 at 10:16 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Aaron,
>
> +      ConstantInt *Length = cast<ConstantInt>(MSI->getLength());
> +      unsigned NumBytes = Length->getZExtValue();
> +      if (NumBytes != 0 && !Length->isNegative()) {
>
> instead you could do:
>
>   int NumBytes = Length->getSExtValue();
>   if (NumBytes > 0) {

Good catch -- I've attached an updated patch.

Thanks!

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FaultyMemset.patch
Type: application/octet-stream
Size: 2420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120311/86dc19f1/attachment.obj>


More information about the llvm-commits mailing list