[LLVMbugs] [Bug 17545] New: X86FrameLowering::getFrameIndexOffset generates wrong offsets

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 11 00:00:08 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17545

            Bug ID: 17545
           Summary: X86FrameLowering::getFrameIndexOffset generates wrong
                    offsets
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: manjian2006 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11360
  --> http://llvm.org/bugs/attachment.cgi?id=11360&action=edit
Source Of The Crash And Patch

int X86FrameLowering::getFrameIndexOffset(const MachineFunction &MF, int FI)
const {
  const X86RegisterInfo *RegInfo =
    static_cast<const X86RegisterInfo*>(MF.getTarget().getRegisterInfo());
  const MachineFrameInfo *MFI = MF.getFrameInfo();
-  int Offset = MFI->getObjectOffset(FI) - getOffsetOfLocalArea();
+  int Offset = MFI->getObjectOffset(FI);
The Offset have already been considered OffsetOfLocalArea once,in
PEI::calculateFrameObjectOffsets.So subtract it back here make the offset
smaller than expected.

The file uploaded is the ll source cause a crash and a patch fixing this bug.
Crash cause:
The SkMatrix object is in [SP-60],but [SP-64] is what we expecting.This stack
object is align to 16 bytes.

  %mat = alloca %class.SkMatrix, align 16

So the vmovaps inst will cause a gp exception when accessing unaligned stack
address.

the compile command is 
llc -O2 -o crashx86.s crashx86.ll

-- 
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/20131011/606c7aa9/attachment.html>


More information about the llvm-bugs mailing list