mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Fixed a segfault in gccld.
The original code does not work because the value from WorkList.end() is invalidated once WorkList.erase() is called. To ensure proper functionality, we must ensure that WorkList.erase() is always called before WorkList.end(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7673 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec4f523178
commit
7d3c5795f9
@ -123,8 +123,10 @@ bool GlobalDCE::RemoveIfDead(GlobalValue *GV) {
|
|||||||
// If the global variable is still on the worklist, remove it now.
|
// If the global variable is still on the worklist, remove it now.
|
||||||
std::vector<GlobalValue*>::iterator I = std::find(WorkList.begin(),
|
std::vector<GlobalValue*>::iterator I = std::find(WorkList.begin(),
|
||||||
WorkList.end(), GV);
|
WorkList.end(), GV);
|
||||||
while (I != WorkList.end())
|
while (I != WorkList.end()) {
|
||||||
I = std::find(WorkList.erase(I), WorkList.end(), GV);
|
I = WorkList.erase(I);
|
||||||
|
I = std::find(I, WorkList.end(), GV);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user