<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 - GlobalOpt emits debug fragments with wrong offsets for padded fields"
href="https://bugs.llvm.org/show_bug.cgi?id=36016">36016</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GlobalOpt emits debug fragments with wrong offsets for padded fields
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.stenberg@ericsson.com
</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=19712" name="attach_19712" title="IR reproducer.">attachment 19712</a> <a href="attachment.cgi?id=19712&action=edit" title="IR reproducer.">[details]</a></span>
IR reproducer.
LLVM commit used: r322927.
When running:
opt -globalopt -S foo.ll -o -
on the attached reproducer, a fragment expression with an offset of 32 bits is
created for the second field in the struct:
!14 = !DIGlobalVariableExpression(var: !7, expr:
!DIExpression(DW_OP_LLVM_fragment, 32, 64))
However, as the field is padded up to 64 bits:
!12 = !DIDerivedType(tag: DW_TAG_member, name: "bar_p", scope: !8, file: !3,
line: 3, baseType: !13, size: 64, offset: 64)
that fragment offset is incorrect.
The reproducer was created by compiling the following program, foo.c:
struct {
int foo;
int *bar_p;
} static var;
int *ptr;
int main() {
if (var.foo == 0)
var.bar_p = ptr;
return 0;
}
using:
clang -march=x86-64 -O0 -g2 -S -emit-llvm foo.c -o foo.ll</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>