From bf124017a23ca4092178e58f86c31de02644efe3 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 10 Jun 2020 10:38:39 -0700 Subject: [PATCH] [NFC] Rename variable to workaround old gcc bug Summary: gcc 5.1 is still supported according to https://releases.llvm.org/10.0.0/docs/GettingStarted.html We're hitting the following bug due to a variable created in the loop header being the same as a variable used in the loop header: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54430 Reviewers: hctim, pcc Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D81594 --- compiler-rt/lib/hwasan/hwasan_report.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp index 4608adf..206aa60 100644 --- a/compiler-rt/lib/hwasan/hwasan_report.cpp +++ b/compiler-rt/lib/hwasan/hwasan_report.cpp @@ -256,7 +256,7 @@ static uptr GetGlobalSizeFromDescriptor(uptr ptr) { Dl_info info; dladdr(reinterpret_cast(ptr), &info); auto *ehdr = reinterpret_cast(info.dli_fbase); - auto *phdr = reinterpret_cast( + auto *phdr_begin = reinterpret_cast( reinterpret_cast(ehdr) + ehdr->e_phoff); // Get the load bias. This is normally the same as the dli_fbase address on @@ -265,7 +265,7 @@ static uptr GetGlobalSizeFromDescriptor(uptr ptr) { // linker script. ElfW(Addr) load_bias = 0; for (const auto &phdr : - ArrayRef(phdr, phdr + ehdr->e_phnum)) { + ArrayRef(phdr_begin, phdr_begin + ehdr->e_phnum)) { if (phdr.p_type != PT_LOAD || phdr.p_offset != 0) continue; load_bias = reinterpret_cast(ehdr) - phdr.p_vaddr; @@ -276,7 +276,7 @@ static uptr GetGlobalSizeFromDescriptor(uptr ptr) { // in. Once we find it, we can stop iterating and return the size of the // global we're interested in. for (const hwasan_global &global : - HwasanGlobalsFor(load_bias, phdr, ehdr->e_phnum)) + HwasanGlobalsFor(load_bias, phdr_begin, ehdr->e_phnum)) if (global.addr() <= ptr && ptr < global.addr() + global.size()) return global.size(); -- 2.7.4