aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/APIntTest.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-07 23:40:49 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-07 23:40:49 +0000
commit195464184e840965febb8eb55316c32995d37c8f (patch)
treeea4e0eea65ee434fe34155c18d40bdb6ea8ec567 /llvm/unittests/ADT/APIntTest.cpp
parent133a16871f4c71d833d9dd354052846dd90d3390 (diff)
downloadllvm-195464184e840965febb8eb55316c32995d37c8f.zip
llvm-195464184e840965febb8eb55316c32995d37c8f.tar.gz
llvm-195464184e840965febb8eb55316c32995d37c8f.tar.bz2
Fix APInt::operator*= so that it computes the correct result for large integers where there is unsigned overflow. Fix APFloat::toString so that it doesn't depend on the incorrect behavior in common cases (and computes the correct result in some rare cases). Fixes PR11086.
llvm-svn: 141441
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
-rw-r--r--llvm/unittests/ADT/APIntTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 11bb5e1..490811d 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -441,4 +441,13 @@ TEST(APIntTest, StringDeath) {
#endif
#endif
+TEST(APIntTest, mul_clear) {
+ APInt ValA(65, -1ULL);
+ APInt ValB(65, 4);
+ APInt ValC(65, 0);
+ ValC = ValA * ValB;
+ ValA *= ValB;
+ EXPECT_EQ(ValA.toString(10, false), ValC.toString(10, false));
+}
+
}