[llvm-bugs] [Bug 41664] New: RuntimeDyldImpl::emitSection - Accidental clearing of the most significant bits

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 29 15:18:20 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41664

            Bug ID: 41664
           Summary: RuntimeDyldImpl::emitSection - Accidental clearing of
                    the most significant bits
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Generic Execution Engine Support
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: 1101.debian at gmail.com, lhames at gmail.com,
                    llvm-bugs at lists.llvm.org

Reported in https://www.viva64.com/en/b/0629/

Expected<unsigned>
RuntimeDyldImpl::emitSection(const ObjectFile &Obj,
                             const SectionRef &Section,
                             bool IsCode) {
  ....
  uint64_t DataSize = Section.getSize();
  ....
  if (StubBufSize > 0)
    DataSize &= ~(getStubAlignment() - 1);
  ....
}

getStubAlignment returns an unsigned, meaning the mask won't extend to the full
uint64_t range, incorrectly aligning the datasize.

The article suggests it should be:

DataSize &= ~(static_cast<uint64_t>(getStubAlignment()) - 1);

or

DataSize &= ~(getStubAlignment() - 1ULL);


Last touched by @lhames at rL310517

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190429/9bad7237/attachment.html>


More information about the llvm-bugs mailing list