[PATCH] D113238: [llvm-profgen] Fix index out of bounds error while using ip.advance

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 22:17:24 PDT 2021


wlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:358
       for (auto &R : FuncI.second.Ranges) {
-        Ranges[{R.first, R.second}] += 0;
+        Ranges[{R.first, R.second - 1}] += 0;
       }
----------------
wenlei wrote:
> So this is fixing a separate bug? And ranges end is actually `endOffset` + 1? If that's the case, some comments for `RangesTy Ranges` would be helpful.
Yeah, a separate bug. Remembering that RangesTy's end is exclusive.

Still kind of related with this patch, because the extra one byte only can cause the out bounds issue.

Will add some comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113238/new/

https://reviews.llvm.org/D113238



More information about the llvm-commits mailing list