Could you file a bug?<br><br><div class="gmail_quote">On Wed, Feb 27, 2013 at 2:47 AM, Stavropoulos Nikos <span dir="ltr"><<a href="mailto:n.stavropoulos@think-silicon.com" target="_blank">n.stavropoulos@think-silicon.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">i have this code<br>
<br>
typedef long long L;<br>
typedef integer I;<br>
void test2(auto L p0, auto L p1, auto L p2, auto L p4, ...)<br>
{<br>
va_list select;<br>
<br>
va_start (select, p4);<br>
<br>
report( va_arg(select,L) );<br>
report( va_arg(select,I) );<br>
report( va_arg(select,L) );<br>
<br>
va_end (select);<br>
}<br>
<br>
int main(void)<br>
{<br>
test2(1, 2, 3, 4, 5LL, 6, 7LL);<br>
return 0;<br>
}<br>
<br>
report is just a function that prints the results.<br>
<br>
in main the assemply code seems to be ok but in test2 function does<br>
something that seems to be wrong<br>
<br>
<br>
i use "llc -march=mipsel -relocation-model=static -asm-verbose<br>
-mattr=+condmov,-muldivadd,+single-float,-fp64,+o32,-bitcount " command<br>
<br>
in function we report the values of a long long value then an integer value<br>
and then again a long long<br>
so the problem is that in the test2 function there is an addiu<br>
$3, $2, 4<br>
that causes the third long long value to be read from wrong address.<br>
mipsel.s <<a href="http://llvm.1065342.n5.nabble.com/file/n55498/mipsel.s" target="_blank">http://llvm.1065342.n5.nabble.com/file/n55498/mipsel.s</a>><br>
<br>
.set nomacro<br>
# BB#0: # %entry<br>
addiu $sp, $sp, -24<br>
sw $ra, 20($sp) # 4-byte Folded Spill<br>
addiu $2, $sp, 56<br>
sw $2, 16($sp)<br>
addiu $2, $2, 8<br>
sw $2, 16($sp)<br>
lw $5, 60($sp)<br>
lw $4, 56($sp)<br>
jal _Z6reportx<br>
nop<br>
<br>
lw $2, 16($sp)<br>
#problem starts here<br>
<br>
addiu $3, $2, 4<br>
<br>
#problem stops here<br>
sw $3, 16($sp)<br>
lw $4, 0($2)<br>
jal _Z6reporti<br>
nop<br>
lw $2, 16($sp)<br>
addiu $3, $2, 8<br>
sw $3, 16($sp)<br>
lw $5, 4($2)<br>
lw $4, 0($2)<br>
<br>
jal _Z6reportx<br>
nop<br>
lw $ra, 20($sp) # 4-byte Folded Reload<br>
addiu $sp, $sp, 24<br>
jr $ra<br>
nop<br>
.set macro<br>
.set reorder<br>
.end _Z5test2xxxxz<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/LLVMdev-Mips-backend-3-2-va-arg-possible-bug-tp55498.html" target="_blank">http://llvm.1065342.n5.nabble.com/LLVMdev-Mips-backend-3-2-va-arg-possible-bug-tp55498.html</a><br>
Sent from the LLVM - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>