fix a nasty off-by-one error.

llvm-svn: 51519
This commit is contained in:
Chris Lattner 2008-05-23 23:29:33 +00:00
parent 4188aadbb2
commit 10a7bd6341
2 changed files with 15 additions and 1 deletions

View File

@ -578,7 +578,7 @@ void RopePieceBTreeInterior::erase(unsigned Offset, unsigned NumBytes) {
NumBytes -= CurChild->size();
CurChild->Destroy();
--NumChildren;
if (i+1 != getNumChildren())
if (i != getNumChildren())
memmove(&Children[i], &Children[i+1],
(getNumChildren()-i)*sizeof(Children[0]));
}

View File

@ -0,0 +1,14 @@
// RUN: clang -rewrite-objc -o - %s
// rdar://5950938
@interface NSArray {}
+ (id)arrayWithObjects:(id)firstObj, ...;
@end
@interface NSConstantString {}
@end
int main() {
id foo = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", @"11", @"12", 0];
return 0;
}