<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 --- - gep problem when optimizer changes struct padding"
href="http://llvm.org/bugs/show_bug.cgi?id=15743">15743</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>gep problem when optimizer changes struct padding
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>robin@icir.org
</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>I'm seeing a problem with the optimizer changing padding inside a
struct, but seemingly not propagating that change to a gep inside an
array.
Here's code to reproduce it. I'm using LLVM/clang 3.2.
----- r.ll
target triple = "x86_64-unknown-linux-gnu"
%A = type { i64, i32, i64 }
@B = constant i16 ptrtoint (i64* getelementptr (%A* null, i32 0, i32 2) to i16)
@C = constant [1 x { i16 }] [{ i16 } { i16 ptrtoint (i64* getelementptr (%A*
null, i32 0, i32 2) to i16) }]
----- r.c
#include <stdint.h>
#include <stdio.h>
extern const int16_t B;
extern const int16_t C[];
int main()
{
printf("%d\n", B);
printf("%d\n", C[0]);
}
-----
Without optimization, the offset of %A's 3rd element is 16:
# clang r.ll r.c -o a.out && ./a.out
16
16
With optimization enabled the offset changes to 12, however only B reflects
that:
# clang r.ll r.c -o a.out -O && ./a.out
12
16
Am I missing something, or is this bug?</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>