From: Rafael Auler Date: Wed, 25 Jan 2023 19:38:07 +0000 (-0800) Subject: [BOLT][NFC] Remove C-style out of bounds array ref X-Git-Tag: upstream/17.0.6~19584 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7768f63e5b7adc8a92b8f8041e9c1d298b011128;p=platform%2Fupstream%2Fllvm.git [BOLT][NFC] Remove C-style out of bounds array ref Old code breaks build with libstdc++ with assertions. Fix it. --- diff --git a/bolt/lib/Core/JumpTable.cpp b/bolt/lib/Core/JumpTable.cpp index 2b1035d..65e1032 100644 --- a/bolt/lib/Core/JumpTable.cpp +++ b/bolt/lib/Core/JumpTable.cpp @@ -70,12 +70,10 @@ bool bolt::JumpTable::replaceDestination(uint64_t JTAddress, MCSymbol *NewDest) { bool Patched = false; const std::pair Range = getEntriesForAddress(JTAddress); - for (auto I = &Entries[Range.first], E = &Entries[Range.second]; I != E; - ++I) { - MCSymbol *&Entry = *I; - if (Entry == OldDest) { + for (auto I = Range.first; I != Range.second; ++I) { + if (Entries[I] == OldDest) { Patched = true; - Entry = NewDest; + Entries[I] = NewDest; } } return Patched;