Which part of the generated code do you think is not correct? Could you be more specific?<br><br>I compiled this program with clang and ran it on a mips board. It returns the expected result (21).<br><br><div class="gmail_quote">
On Tue, Feb 19, 2013 at 4:15 AM, Jonathan <span dir="ltr"><<a href="mailto:gamma_chen@yahoo.com.tw" target="_blank">gamma_chen@yahoo.com.tw</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I check the Mips backend for the following C code fragment compile result. It seems not correct. Is it my misunderstand or it's a bug.<br>
<br>
//ch8_3.cpp<br>
#include <stdarg.h><br>
<br>
int sum_i(int amount, ...)<br>
{<br>
int i = 0;<br>
int val = 0;<br>
int sum = 0;<br>
<br>
va_list vl;<br>
va_start(vl, amount);<br>
for (i = 0; i < amount; i++)<br>
{<br>
val = va_arg(vl, int);<br>
sum += val;<br>
}<br>
va_end(vl);<br>
<br>
return sum;<br>
}<br>
<br>
int main()<br>
{<br>
int a = sum_i(6, 1, 2, 3, 4, 5, 6);<br>
<br>
return a;<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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>