[compiler-rt] bf12401 - [NFC] Rename variable to workaround old gcc bug

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 12:15:19 PDT 2020


Author: Arthur Eubanks
Date: 2020-06-10T12:14:53-07:00
New Revision: bf124017a23ca4092178e58f86c31de02644efe3

URL: https://github.com/llvm/llvm-project/commit/bf124017a23ca4092178e58f86c31de02644efe3
DIFF: https://github.com/llvm/llvm-project/commit/bf124017a23ca4092178e58f86c31de02644efe3.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 4608adfe546c..206aa601903e 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<void *>(ptr), &info);
   auto *ehdr = reinterpret_cast<const ElfW(Ehdr) *>(info.dli_fbase);
-  auto *phdr = reinterpret_cast<const ElfW(Phdr) *>(
+  auto *phdr_begin = reinterpret_cast<const ElfW(Phdr) *>(
       reinterpret_cast<const u8 *>(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<const ElfW(Phdr)>(phdr, phdr + ehdr->e_phnum)) {
+       ArrayRef<const ElfW(Phdr)>(phdr_begin, phdr_begin + ehdr->e_phnum)) {
     if (phdr.p_type != PT_LOAD || phdr.p_offset != 0)
       continue;
     load_bias = reinterpret_cast<ElfW(Addr)>(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();
 


        


More information about the llvm-commits mailing list