[llvm-bugs] [Bug 38779] New: [DebugInfo at O2][Dexter] Incorrect variable valuations reported from loop
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 30 09:12:28 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38779
Bug ID: 38779
Summary: [DebugInfo at O2][Dexter] Incorrect variable valuations
reported from loop
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Keywords: wrong-debug
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: jeremy.morse.llvm at gmail.com
CC: chackz0x12 at gmail.com, greg.bedwell at sony.com,
international.phantom at gmail.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
Blocks: 38768
Debuggers report the loop below as having a constant-valued iterator ("i") and
wildly-changing accumulator ("sum"). Testing environment is llvm/clang @
r340912 and options "-O2 -g -fno-inline -fno-unroll-loops" for x86_64. I've
used no-funroll-loops for conciseness, this replicates if one just uses a large
loop bound too. Both lldb and gdb report the same problems.
In the loop below, the iterator "i" is reported as optimised out when stopped
on the loop-header line, or as the value one when stopped on the line that
calls "lul" for every iteration of the loop.
The "sum" variable is more exciting: when stopped on the loop header the true
value of the variable is reported, but when stopped on the line calling "lul",
a constant value of zero is reported.
My feeling here is that the instruction-range for constant initialisation of
"sum" and "i" is encroaching on the loop; as for "i" being optimised-out,
that's likely because the indvars pass makes very little effort to preserve
debug data, for which I'll open a different ticket.
-------->8--------
int
lul(int i, int other)
{
volatile int foo = i;
return foo + other;
}
int
somearray[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int
main()
{
int sum = 0;
int *ptr = somearray;
for (int i = 1; i < 11; i++, ptr++) {
sum += lul(i, *ptr);
}
return sum;
}
--------8<--------
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=38768
[Bug 38768] [meta][DebugInfo] Umbrella bug for poor debug experiences
--
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/20180830/71aab0fc/attachment.html>
More information about the llvm-bugs
mailing list