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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to