summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-11 02:52:39 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-11 02:52:39 +0000
commit0fa538528e6b888ad07c79c4a4607874ce9eafbe (patch)
tree2cf9a88c965ba69951e5902153dcdaa75807c73f /clang
parent91076caabf04d3c4f0dda99c0387a6b661585e39 (diff)
downloadbcm5719-llvm-0fa538528e6b888ad07c79c4a4607874ce9eafbe.tar.gz
bcm5719-llvm-0fa538528e6b888ad07c79c4a4607874ce9eafbe.zip
Fix PR 3780: In one code path in BasicValueFactory::getValue() we would not
return an unsigned integer for a null pointer value. llvm-svn: 66630
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/BasicValueFactory.cpp2
-rw-r--r--clang/test/Analysis/misc-ps.m15
2 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Analysis/BasicValueFactory.cpp b/clang/lib/Analysis/BasicValueFactory.cpp
index 2c7d6a37c15..6ceab93b086 100644
--- a/clang/lib/Analysis/BasicValueFactory.cpp
+++ b/clang/lib/Analysis/BasicValueFactory.cpp
@@ -92,7 +92,7 @@ const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) {
unsigned bits = Ctx.getTypeSize(T);
- llvm::APSInt V(bits, T->isUnsignedIntegerType());
+ llvm::APSInt V(bits, T->isUnsignedIntegerType() || Loc::IsLocType(T));
V = X;
return getValue(V);
}
diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m
index 04e6555dd1b..50dda78cdb1 100644
--- a/clang/test/Analysis/misc-ps.m
+++ b/clang/test/Analysis/misc-ps.m
@@ -178,3 +178,18 @@ char pr3770(int x) {
return 'a';
}
+// PR 3780
+// - We just want to test that this doesn't crash the analyzer.
+typedef struct st ST;
+struct st { char *name; };
+extern ST *Cur_Pu;
+
+void pr3780(void)
+{
+ static ST *last_Cur_Pu;
+ if (last_Cur_Pu == Cur_Pu) {
+ return;
+ }
+}
+
+
OpenPOWER on IntegriCloud