<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 --- - Arrays on stack are misaligned."
href="http://llvm.org/bugs/show_bug.cgi?id=18069">18069</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Arrays on stack are misaligned.
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>llc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kavon.farvardin@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>Created <span class=""><a href="attachment.cgi?id=11615" name="attach_11615" title="main returns 0 if aligned correctly, 1 if not.">attachment 11615</a> <a href="attachment.cgi?id=11615&action=edit" title="main returns 0 if aligned correctly, 1 if not.">[details]</a></span>
main returns 0 if aligned correctly, 1 if not.
I am seeing an issue with an alloca on the stack that is requesting an
alignment, but the alignment is not being guaranteed when I compile with
-mtriple=i686-pc-linux and x86_64-pc-linux. If anything, it could be
misaligned:
main: # @main
# BB#0:
subl $44, %esp
movl $16, %eax
leal 16(%esp), %ecx
I tried i686-pc-windows and do not see an issue because the stack pointer is
realigned before calculating the array's address:
main: # @main
# BB#0:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $48, %esp
movl $16, %eax
leal 16(%esp), %ecx
I am compiling the .ll file attached with llc -O0, however, the code I found
this problem in was compiled with -O2. I had two arrays on the stack and the
calculations for element positions relied on the alignment, thus there was data
corruption.</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>