Skip to content
Snippets Groups Projects
Commit fa6228d6 authored by Ted Kremenek's avatar Ted Kremenek
Browse files

Fix PR 3780: In one code path in BasicValueFactory::getValue() we would not

return an unsigned integer for a null pointer value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66630 91177308-0d34-0410-b5e6-96231b3b80d8
parent 0bed8a12
No related branches found
No related tags found
No related merge requests found
...@@ -92,7 +92,7 @@ const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth, ...@@ -92,7 +92,7 @@ const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) { const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) {
unsigned bits = Ctx.getTypeSize(T); unsigned bits = Ctx.getTypeSize(T);
llvm::APSInt V(bits, T->isUnsignedIntegerType()); llvm::APSInt V(bits, T->isUnsignedIntegerType() || Loc::IsLocType(T));
V = X; V = X;
return getValue(V); return getValue(V);
} }
......
...@@ -178,3 +178,18 @@ char pr3770(int x) { ...@@ -178,3 +178,18 @@ char pr3770(int x) {
return 'a'; 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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment