[llvm-bugs] [Bug 46121] New: Wrong line information at O3

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 28 06:06:24 PDT 2020


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

            Bug ID: 46121
           Summary: Wrong line information at O3
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: massarelli at diag.uniroma1.it
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Line 23 is hit twice. The second time that it is hit it seems to be wrong,
actually the execution seems to be in function p.

$ cat -n a.c
     1  char a, b, c;
     2  int d, e, g, h;
     3  short f;
     4  short j[8];
     5  int *k = &d;
     6  int(l)(m, n) {
     7    return m && n && -1 / m || m && n > 1 / n || m <= 0 && n <= 0 && m &&
7 / m
     8               ? 0
     9               : m;
    10  }
    11  int o() { f = 0; }
    12  void p(int *m) {
    13    int ui1 = 4, ui2 = c = 4 * l(*m, c);
    14    b = g;
    15    h = b;
    16  }
    17  int main() {
    18    int i = 0;
    19    for (; i < 8; i++)
    20      j[i] = 2;
    21    a = 0;
    22    for (; a <= 7; a++) {
    23      j[a] || o();
    24      p(k);
    25      *k = e;
    26    }
    27  }


$ cat a.c
char a, b, c;
int d, e, g, h;
short f;
short j[8];
int *k = &d;
int(l)(m, n) {
  return m && n && -1 / m || m && n > 1 / n || m <= 0 && n <= 0 && m && 7 / m
             ? 0
             : m;
}
int o() { f = 0; }
void p(int *m) {
  int ui1 = 4, ui2 = c = 4 * l(*m, c);
  b = g;
  h = b;
}
int main() {
  int i = 0;
  for (; i < 8; i++)
    j[i] = 2;
  a = 0;
  for (; a <= 7; a++) {
    j[a] || o();
    p(k);
    *k = e;
  }
}

$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
da52aa2c3340d91025c0188175012c476967dc74)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 11.0.0
clang revision da52aa2c3340d91025c0188175012c476967dc74
llvm revision da52aa2c3340d91025c0188175012c476967dc74

$ clang -O3 -g -o opt a.c

lldb opt 
(lldb) target create "opt"
Current executable set to '/opt' (x86_64).
(lldb) b -l 23
Breakpoint 1: where = opt`main + 46 at test.c:23:5, address =
0x000000000040058e
(lldb) r
Process 228 launched: 'opt' (x86_64)
Process 228 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x000000000040058e opt`main at test.c:23:5
   20       j[i] = 2;
   21     a = 0;
   22     for (; a <= 7; a++) {
-> 23       j[a] || o();
   24       p(k);
   25       *k = e;
   26     }
(lldb) p a
(char) $0 = '\0'
(lldb) a
error: 'apropos' must be called with exactly one argument.

(lldb) s
Process 228 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400593 opt`main [inlined] p(m=0x0000000000601040) at
test.c:23:10
   20       j[i] = 2;
   21     a = 0;
   22     for (; a <= 7; a++) {
-> 23       j[a] || o();
   24       p(k);
   25       *k = e;
   26     }

-- 
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/20200528/4ae18e8c/attachment.html>


More information about the llvm-bugs mailing list