[llvm-bugs] [Bug 36016] New: GlobalOpt emits debug fragments with wrong offsets for padded fields
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 19 07:38:14 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36016
Bug ID: 36016
Summary: GlobalOpt emits debug fragments with wrong offsets for
padded fields
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: david.stenberg at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19712
--> https://bugs.llvm.org/attachment.cgi?id=19712&action=edit
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180119/b31e1913/attachment.html>
More information about the llvm-bugs
mailing list