[llvm-bugs] [Bug 38769] New: [DebugInfo][Dexter] Speculated store leads to backward steps and stale values

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 30 03:55:58 PDT 2018


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: unassignedbugs at nondot.org
          Reporter: jeremy.morse.llvm at gmail.com
                CC: aprantl at apple.com, chackz0x12 at gmail.com,
                    dblaikie at gmail.com, greg.bedwell at sony.com,
                    international.phantom at gmail.com,
                    jdevlieghere at apple.com, llvm-bugs at lists.llvm.org,
                    paul_robinson at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180830/bcb2c748/attachment.html>


More information about the llvm-bugs mailing list