[llvm-bugs] [Bug 39869] New: Wrong value for array element in the debugger (with -O1)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 3 07:57:56 PST 2018


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

            Bug ID: 39869
           Summary: Wrong value for array element in the debugger (with
                    -O1)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

$ cat a.c

short a, c;
long b;
short fun1() { return c; }
char d() {
  short l_30[4] = {1};
  a = fun1();
  l_30[3]++;
  return b; // break here
}
int main() { d(); }

Process 24627 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f93 a.out`d at a.c:8:10 [opt]
   5      short l_30[4] = {1};
   6      a = fun1();
   7      l_30[3]++;
-> 8      return b;
   9    }
   10   int main() { d(); }
(lldb) frame var l_30
(short [4]) l_30 = ([0] = 0, [1] = 0, [2] = 0, [3] = 1)


The first element should be 1, i.e. the array should look like:
(short [4]) l_30 = ([0] = 1, [1] = 0, [2] = 0, [3] = 1)

-- 
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/20181203/421d7092/attachment.html>


More information about the llvm-bugs mailing list