[PATCH] D20755: [MC] Check the upper bound in truncate assertion

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 21:09:03 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL271773: [MC] Check the upper bound in truncate assertion (authored by phosek).

Changed prior to commit:
  http://reviews.llvm.org/D20755?vs=58845&id=59643#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20755

Files:
  llvm/trunk/lib/MC/MCAsmStreamer.cpp

Index: llvm/trunk/lib/MC/MCAsmStreamer.cpp
===================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp
@@ -314,7 +314,7 @@
 }
 
 static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
-  assert(Bytes && "Invalid size!");
+  assert(Bytes > 0 && Bytes <= 8 && "Invalid size!");
   return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20755.59643.patch
Type: text/x-patch
Size: 449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160604/36d3c9f4/attachment.bin>


More information about the llvm-commits mailing list