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

            Bug ID: 38997
           Summary: [DebugInfo@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: unassignedb...@nondot.org
          Reporter: chackz0...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to