Skip to content

Commit c2ef325

Browse files
rafaelaulertru
authored andcommitted
[BOLT][NFC] Remove C-style out of bounds array ref
Old code breaks build with libstdc++ with assertions. Fix it. (cherry picked from commit 7768f63)
1 parent 1c1ab11 commit c2ef325

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bolt/lib/Core/JumpTable.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ bool bolt::JumpTable::replaceDestination(uint64_t JTAddress,
7070
MCSymbol *NewDest) {
7171
bool Patched = false;
7272
const std::pair<size_t, size_t> Range = getEntriesForAddress(JTAddress);
73-
for (auto I = &Entries[Range.first], E = &Entries[Range.second]; I != E;
74-
++I) {
75-
MCSymbol *&Entry = *I;
76-
if (Entry == OldDest) {
73+
for (auto I = Range.first; I != Range.second; ++I) {
74+
if (Entries[I] == OldDest) {
7775
Patched = true;
78-
Entry = NewDest;
76+
Entries[I] = NewDest;
7977
}
8078
}
8179
return Patched;

0 commit comments

Comments
 (0)