forked from OSchip/llvm-project
PR2347: Fix crash iterating over VLAs; this started triggering because
we now iterate over the whole AST when we destroy it. llvm-svn: 51363
This commit is contained in:
parent
14b2993484
commit
0883bfb541
|
@ -36,16 +36,16 @@ void StmtIteratorBase::NextVA() {
|
|||
p = FindVA(p->getElementType().getTypePtr());
|
||||
setVAPtr(p);
|
||||
|
||||
if (!p && decl) {
|
||||
if (!p && inDecl()) {
|
||||
if (VarDecl* VD = dyn_cast<VarDecl>(decl))
|
||||
if (VD->Init)
|
||||
return;
|
||||
|
||||
NextDecl();
|
||||
}
|
||||
else {
|
||||
} else if (inSizeOfTypeVA()) {
|
||||
assert(!decl);
|
||||
RawVAPtr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
|
||||
|
@ -101,7 +101,6 @@ StmtIteratorBase::StmtIteratorBase(VariableArrayType* t)
|
|||
RawVAPtr |= reinterpret_cast<uintptr_t>(t);
|
||||
}
|
||||
|
||||
|
||||
Stmt*& StmtIteratorBase::GetDeclExpr() const {
|
||||
if (VariableArrayType* VAPtr = getVAPtr()) {
|
||||
assert (VAPtr->SizeExpr);
|
||||
|
|
|
@ -5,3 +5,11 @@ int test1() {
|
|||
static int y = sizeof(x); // expected-error {{not constant}}
|
||||
}
|
||||
|
||||
// PR2347
|
||||
void f (unsigned int m)
|
||||
{
|
||||
extern int e[2][m];
|
||||
|
||||
e[0][0] = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue