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

    <tr>
        <th>Summary</th>
        <td>
            [clang/lldb] wrong value of element in struct when the value is changed in noinline function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    
$ cat small.c
```
struct bm {
  unsigned a;
};

int __attribute__ ((noinline))
foo (struct bm *p)
{
  p->a = 1;
  return 1;
}

int main()
{
  struct bm v = {0};
  foo (&v);
  return 0;
}
```

$ clang -O1 -g small.c; lldb a.out
```
(lldb) target create "a.out"
Current executable set to '/root/DeVIL/a.out' (x86_64).
(lldb) b 16
Breakpoint 1: where = a.out`main at small.c:16:3, address = 0x0000000000000610
(lldb) r
Process 7305 launched: '/root/DeVIL/a.out' (x86_64)
Process 7305 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555554610 a.out`main at small.c:16:3
   13   {
   14     struct bm v = {0};
   15     foo (&v);
-> 16          return 0;
   17   }
(lldb) fr var
(bm) v = (a = 0)
(lldb)
```
We can found that the variable a in the struct v is `0`. However, the function foo is called, this element a is assigned to `1`. I was wondering that this should be a bug. 

$ 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

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVcmu4jgU_ZqwuUrkOBMsWEBRT_2klroXPSyRnRiS7mAjD8D7-752DC9VUOpCFgl3POcOhqvuY52QXUI2CS2hZRbMiY1j1kZhTeIJP43VrrXAT5A020kE4KQZjlJ0wJIiCpNm9_kevgdpYb9n1uqBOyv2e0joEo9UgxwHKRK68ifYHpTy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