summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-11-03 14:04:04 +0000
committerDuncan Sands <baldrick@free.fr>2012-11-03 14:04:04 +0000
commit2578c123f090821a84586d405e87012b4f32868f (patch)
tree26c1249dc57ebab85d7eae4feef6f0fabaac19e4
parentc5b969a0194aa3e3d8170ddd38ab3cb8c9f3113c (diff)
downloadllvm-2578c123f090821a84586d405e87012b4f32868f.tar.gz
llvm-2578c123f090821a84586d405e87012b4f32868f.tar.bz2
llvm-2578c123f090821a84586d405e87012b4f32868f.tar.xz
Fix the IntegersSubsetTest unit test when compiled with gcc-4.7. The issue here
is that the unit test doesn't have IntTy equal to APInt, instead it uses a class derived from APInt. When, as in these lines, an IntTy& reference is returned but is assigned to an APInt&, the compiler destroys the temporary the IntTy& was referring to, leaving the APInt& referring to garbage. This causes the unittest to fail systematically on my machine; it can also be caught by running the test under valgrind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167356 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/IntegersSubset.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/llvm/Support/IntegersSubset.h b/include/llvm/Support/IntegersSubset.h
index bb9e76925e..03039fd645 100644
--- a/include/llvm/Support/IntegersSubset.h
+++ b/include/llvm/Support/IntegersSubset.h
@@ -411,8 +411,8 @@ public:
unsigned getSize() const {
APInt sz(((const APInt&)getItem(0).getLow()).getBitWidth(), 0);
for (unsigned i = 0, e = getNumItems(); i != e; ++i) {
- const APInt &Low = getItem(i).getLow();
- const APInt &High = getItem(i).getHigh();
+ const APInt Low = getItem(i).getLow();
+ const APInt High = getItem(i).getHigh();
APInt S = High - Low + 1;
sz += S;
}
@@ -426,8 +426,8 @@ public:
APInt getSingleValue(unsigned idx) const {
APInt sz(((const APInt&)getItem(0).getLow()).getBitWidth(), 0);
for (unsigned i = 0, e = getNumItems(); i != e; ++i) {
- const APInt &Low = getItem(i).getLow();
- const APInt &High = getItem(i).getHigh();
+ const APInt Low = getItem(i).getLow();
+ const APInt High = getItem(i).getHigh();
APInt S = High - Low + 1;
APInt oldSz = sz;
sz += S;