<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - struct members not left-justified in function arguments on MIPS64"
href="http://llvm.org/bugs/show_bug.cgi?id=20286">20286</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>struct members not left-justified in function arguments on MIPS64
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>SGI
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>msebor@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The MIPS64 ABI specifies in section n32 and Native 64-Bit (n64) Subprogram
Interface for MIPS Architectures that struct arguments are left justified. The
test case below shows that while GCC follows the ABI requirement (note the dsll
and dsra instructions in bar and foo, respectively, Clang does not.
$ cat t.c && clang -O2 -S --target=mips64 -mabi=n32 t.c && cat t.s &&
gcc.c4.7.0-p1.mips64-linux -O2 -S -mabi=n32 t.c && cat t.s
struct S { int i; };
__attribute__ ((noinline)) int foo (struct S s) { return s.i; }
int bar (void) { return foo ((struct S){ 1234 }); }
.text
.abicalls
.option pic0
.section .mdebug.abiN32,"",@progbits
.nan legacy
.file "t.c"
.text
.globl foo
.align 3
.type foo,@function
.set nomicromips
.set nomips16
.ent foo
foo:
.frame $fp,16,$ra
.mask 0x00000000,0
.fmask 0x40000000,-4
.set noreorder
.set nomacro
.set noat
addiu $sp, $sp, -16
sd $fp, 8($sp)
move $fp, $sp
move $2, $4
move $sp, $fp
ld $fp, 8($sp)
jr $ra
addiu $sp, $sp, 16
.set at
.set macro
.set reorder
.end foo
$tmp0:
.size foo, ($tmp0)-foo
.globl bar
.align 3
.type bar,@function
.set nomicromips
.set nomips16
.ent bar
bar:
.frame $fp,16,$ra
.mask 0x00000000,0
.fmask 0xc0000000,-4
.set noreorder
.set nomacro
.set noat
addiu $sp, $sp, -16
sd $ra, 8($sp)
sd $fp, 0($sp)
move $fp, $sp
jal foo
addiu $4, $zero, 1234
move $sp, $fp
ld $fp, 0($sp)
ld $ra, 8($sp)
jr $ra
addiu $sp, $sp, 16
.set at
.set macro
.set reorder
.end bar
$tmp1:
.size bar, ($tmp1)-bar
.ident "clang version 3.5.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
90a108e0ebda1f9a61be251e693bf8b28d9b5dba) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
013321a0f9e9f784ebb9a78ebf19e5f5099d5b16)"
.file 1 "t.c"
.section .mdebug.abiN32
.previous
.gnu_attribute 4, 3
.abicalls
.text
.align 2
.align 3
.globl foo
.set nomips16
.ent foo
.type foo, @function
foo:
.frame $sp,16,$31 # vars= 16, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
.set noreorder
.set nomacro
addiu $sp,$sp,-16
dsra $2,$4,32
j $31
addiu $sp,$sp,16
.set macro
.set reorder
.end foo
.size foo, .-foo
.align 2
.align 3
.globl bar
.set nomips16
.ent bar
.type bar, @function
bar:
.frame $sp,16,$31 # vars= 0, regs= 1/0, args= 0, gp= 0
.mask 0x80000000,-8
.fmask 0x00000000,0
.set noreorder
.set nomacro
li $4,1234 # 0x4d2
addiu $sp,$sp,-16
sd $31,8($sp)
.option pic0
jal foo
.option pic2
dsll $4,$4,32
ld $31,8($sp)
j $31
addiu $sp,$sp,16
.set macro
.set reorder
.end bar
.size bar, .-bar</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>