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

            Bug ID: 38769
           Summary: [DebugInfo][Dexter] Speculated store leads to backward
                    steps and stale values
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: wrong-debug
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: jeremy.morse.l...@gmail.com
                CC: apra...@apple.com, chackz0...@gmail.com,
                    dblai...@gmail.com, greg.bedw...@sony.com,
                    international.phan...@gmail.com,
                    jdevliegh...@apple.com, llvm-bugs@lists.llvm.org,
                    paul_robin...@playstation.sony.com
            Blocks: 38768

The test below, when stepped through under a debugger, mostly steps backwards
through the "foo" function, and always presents the initial value of the "qux"
variable, never the modified value or "optimised out".

I've used llvm/clang @ r340912 and compiled with "-O0 -g -fno-inline" for
x86_64. (Inlining leads to the whole program being optimised to a return).
Stepping through the "foo" function with both gdb and lldb displays, in order,
the lines for:
 * The if-block body
 * the if-condition
 * qux *= 12
 * the if-condition
 * return 0

Which involves two backwards steps where the original program had none.
Additionally, on every instruction in "foo", "qux" has the value three (i.e.
it's initial value), the multiplication by 12 never becomes visible, which is
misleading. That multiply is folded into a few other operations; "qux" should
probably be marked as optimised out.

This test was originally supposed to stimulate SimplifyCFGs store speculation,
which merges the stores to *bar into one store.

Found using DExTer ( https://github.com/SNSystems/dexter ).

-------->8--------
int
foo(int *bar, int baz, int qux)
{
  qux *= 12;
  *bar = qux;
  if (baz) {
    *bar = baz + qux + 3;
  }
  return 0;
}

int
main()
{
  int quux = 1;
  foo(&quux, 1, 3);
  return quux;
}
--------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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to