fix container-overflow bugs detected by asan
MODIFY
ir/function.cpp
ir/function.cpp
@@ -483,9 +483,9 @@ void Function::unroll(unsigned k) {
// traverse each loop tree in post-order
while (!worklist.empty()) {
- auto &[header, height, flag] = worklist.back();
+ auto [header, height, flag] = worklist.back();
if (!flag) {
- flag = true;
+ get<2>(worklist.back()) = flag = true;
auto I = forest.find(header);
if (I != forest.end()) {
// process all non-leaf children first
@@ -964,8 +964,8 @@ void LoopAnalysis::getDepthFirstSpanningTree() {
while(!worklist.empty()) {
auto &[bb, flag] = worklist.back();
if (flag) {
- worklist.pop_back();
last[number[bb]] = current - 1;
+ worklist.pop_back();
} else {
node[current] = bb;
number[bb] = current++;

fix container-overflow bugs detected by asan (#657)