<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Stack parameter push order incorrect"
href="https://bugs.llvm.org/show_bug.cgi?id=39446">39446</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Stack parameter push order incorrect
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Backend: AVR
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tetsuya.ooka@dsn.rohm.co.jp
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21037" name="attach_21037" title="test code for reproduction">attachment 21037</a> <a href="attachment.cgi?id=21037&action=edit" title="test code for reproduction">[details]</a></span>
test code for reproduction
If optimize level is -O1, the order of pushing the last parameter and the
second parameter from last into stack is reversed. It leads incorrect result.
Reproduction procedure is to run the command below, where test.c is the
attached file.
clang --target=avr -O1 test.c -S -o test.S
In test.c, the main function calls function f with parameters
0,1,2,3,4,5,6,7,8,9,10 and 11.
But in test.S, the parameter pushing sequence is like below.
ldi r24, 10
push r24
ldi r24, 11
ldi r25, 0
push r25
push r24
ldi r24, 9
ldi r25, 0
I think it supposed to push 11, 10 then 9. But it pushes 10, 11 then 9.
Can anyone fix this problem?
Thank you.</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>