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

           Summary: Insuficent allignment on call on ARM
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


The code
-----------------------
#include <stdio.h>

typedef struct QuadWordS_struct { int i; double d; } QuadWordS;

void test(int a, QuadWordS qw);

int main() {
  QuadWordS qw = { 19, 0.0 };
  test(0, qw);
  return 0;
}
-----------------------

gets compiled to

------------------------
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32"
target triple = "armv5-none-linux-gnueabi"

%struct.QuadWordS = type { i32, double }

define arm_aapcscc i32 @main() nounwind optsize {
entry:
  tail call arm_aapcscc  void @test(i32 0, i32 19, i32 0, i32 0, i32 0)
nounwind
  ret i32 0
}

declare arm_aapcscc void @test(i32, i32, i32, i32, i32)
------------------------

The problem is that the struct requires 64 bit alignment. The correct lowering
of the call is

tail call arm_aapcscc  void @test(i32 0, i32 0, i32 19, i32 0, i32 0, i32 0)
nounwind

and "test" should be declared as

declare arm_aapcscc void @test(i32, i32, i32, i32, i32, i32)


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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