[LLVMbugs] [Bug 2806] New: assertion failure in DCE. cpp when executed in debug mode on win32
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Sep 18 15:45:52 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2806
Summary: assertion failure in DCE.cpp when executed in debug mode
on win32
Product: libraries
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: minor
Priority: P2
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: asitgoes at gmail.com
CC: llvmbugs at cs.uiuc.edu
Hi,
The following code in DCE.cpp(line 113 to 118) causes an assertion failure in
'std::vector' operator--().
for (std::vector<Instruction*>::iterator WI = WorkList.begin();
WI != WorkList.end(); ++WI)
if (*WI == I) {
WI = WorkList.erase(WI);
--WI;
}
When 'WorkList' becomes empty after WorkList.erase, 'WI' will point to the
beginning of the internal buffer of the std::vector. Thus, '--WI' will make
'WI' point to an invalid address. I believe that this will function correctly
since 'WI' will be then incremented by '++WI' of the for loop, however, the
'std::vector' implementation of the visual studio detects that 'WI' will points
to an invalid address after '--' operation, and raises an assertion failure.
I'd suggest to change this code into
for (std::vector<Instruction*>::iterator WI = WorkList.begin();
WI != WorkList.end(); )
if (*WI == I) {
WI = WorkList.erase(WI);
}
else {
++WI;
}
Please let me know if you don't think this need to be fixed.
Thanks.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list