зеркало из https://github.com/microsoft/clang-1.git
PR2347: Fix crash iterating over VLAs; this started triggering because
we now iterate over the whole AST when we destroy it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
1108e7dec6
Коммит
b0c0554bd6
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче