[llvm-bugs] [Bug 38997] New: [DebugInfo at O2][Dexter] For loop upper bound not tracked correctly by DWARF location list causing misleading watch window values.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 19 06:23:57 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38997

            Bug ID: 38997
           Summary: [DebugInfo at O2][Dexter] For loop upper bound not
                    tracked correctly by DWARF location list causing
                    misleading watch window values.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: chackz0x12 at gmail.com
                CC: llvm-bugs at lists.llvm.org

When run with a debugger the test below reports incorrect values for "count". 

The debug info incorrectly tracks count, which moves between 2 locations. The
first is described correctly, but after moving count said its original location
is over written, causing an incorrect value to be reported to the user.

The example was compiled with llvm/clang TOT @ r342534 with options "-O2 -g
-fno-inline" for x86_64 on Ubuntu. Stepping through seems fine, however after
calling simple(ix) things start to go awry.

I also tested this with clang 6.0 release and found the same results.

This test was created to exercise LoopRotate optimisations. I investigated
using the dexter tool at https://github.com/SNSystems/dexter. Using opt-bisect
and targeting before and after LoopRotate shows a decline in the quality of the
debugging experience after a loop rotation occurs.

I looked at the IR and didn't see anything major wrong with it, which leads me
to think this is an issue further down the pipeline.

---------------------------------------------------------------------
// test.cpp
#include "simple.h"

int start = 0;

int foo_for(int count) {
  int result = 0;
  for (unsigned long long ix = start; ix != count; ++ix)
    result += simple(ix);
  return result;
}

int main(int argc, const char ** argv) {
  int loopBy = argc + 3;
  return foo_for(loopBy);
}

---------------------------------------------------------------------
// simple.cpp
int simple(int arg) {
  return arg;
}

---------------------------------------------------------------------
// simple.h
int simple(int arg);

-- 
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/20180919/fedcbfee/attachment.html>


More information about the llvm-bugs mailing list