<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55660>55660</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang/lldb] lldb wrongly stopped inside a dead loop
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yangyibiao
      </td>
    </tr>
</table>

<pre>
    $ cat small.c
```
int main()
{
  int j = 0, d = 0;
  if (j>=0)
    for (; d; d++)
      return 0;
  return 0;
}
```

$ clang --version
```
Ubuntu clang version 15.0.0-++20220520091548+a61835b1e3f5-1~exp1~20220520091641.498
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

$ clang -O0 -g small.c; lldb a.out
```
(lldb) target create "a.out"
Current executable set to '/root/a.out' (x86_64).
(lldb) b 5
Breakpoint 1: where = a.out`main + 35 at small.c:5:5, address = 0x0000000000000623
(lldb) r
Process 20281 launched: '/root/a.out' (x86_64)
Process 20281 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555554623 a.out`main at small.c:5:5
   2    {
   3      int j = 0, d = 0;
   4      if (j>=0)
-> 5             for (; d; d++)
   6          return 0;
   7      return 0;
   8    }
(lldb) s
Process 20281 stopped
* thread #1, name = 'a.out', stop reason = step in
    frame #0: 0x000055555555463e a.out`main at small.c:6:14
   3      int j = 0, d = 0;
   4      if (j>=0)
   5        for (; d; d++)
-> 6               return 0;
   7      return 0;
   8    }
(lldb) 
```

lldb wrongly stopped at line 6. However, d is 0 and lldb should not stopped inside the for loop. 

I have report this bug  in https://bugs.llvm.org/show_bug.cgi?id=45603
However, I found this problem is stilll in the latest version of clang/lldb. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VUtzozgQ_jX40gUlJMD44EM8ntTmtHvYPU8JkEF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