Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.29 -> 1.30
---
Log message:

Fix countLeadingZeros in the case that the bitwidth evenly divides the
word size. This fixes all reads of uninitialized data (buffer over read)
and makes APInt.cpp memory clean, per valgrind. The only remaining
problem is division in a few cases.


---
Diffs of the changes:  (+4 -1)

 APInt.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.29 llvm/lib/Support/APInt.cpp:1.30
--- llvm/lib/Support/APInt.cpp:1.29     Wed Feb 21 02:21:52 2007
+++ llvm/lib/Support/APInt.cpp  Wed Feb 21 18:22:00 2007
@@ -726,7 +726,10 @@
       }
     }
   }
-  return Count - (APINT_BITS_PER_WORD - (BitWidth % APINT_BITS_PER_WORD));
+  uint32_t remainder = BitWidth % APINT_BITS_PER_WORD;
+  if (remainder)
+    Count -= APINT_BITS_PER_WORD - remainder;
+  return Count;
 }
 
 /// countTrailingZeros - This function is a APInt version corresponding to



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to