[LLVMbugs] [Bug 18069] New: Arrays on stack are misaligned.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 26 10:19:37 PST 2013


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

            Bug ID: 18069
           Summary: Arrays on stack are misaligned.
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: kavon.farvardin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11615
  --> http://llvm.org/bugs/attachment.cgi?id=11615&action=edit
main returns 0 if aligned correctly, 1 if not.

I am seeing an issue with an alloca on the stack that is requesting an
alignment, but the alignment is not being guaranteed when I compile with
-mtriple=i686-pc-linux and x86_64-pc-linux. If anything, it could be
misaligned:

main:                                   # @main
# BB#0:
    subl    $44, %esp
    movl    $16, %eax
    leal    16(%esp), %ecx

I tried i686-pc-windows and do not see an issue because the stack pointer is
realigned before calculating the array's address:

main:                                   # @main
# BB#0:
    pushl    %ebp
    movl    %esp, %ebp
    andl    $-16, %esp
    subl    $48, %esp
    movl    $16, %eax
    leal    16(%esp), %ecx

I am compiling the .ll file attached with llc -O0, however, the code I found
this problem in was compiled with -O2. I had two arrays on the stack and the
calculations for element positions relied on the alignment, thus there was data
corruption.

-- 
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/20131126/6a0fe3a2/attachment.html>


More information about the llvm-bugs mailing list