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

    <tr>
        <th>Summary</th>
        <td>
            Failed to dereference sythetic value using llvm
        </td>
    </tr>

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

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

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

<pre>
    code:
```
#include <vector>
#include <memory>

using namespace std;

struct A{
  vector<int> val;
};

int main()
{
  
  shared_ptr<A> x = make_shared<A>();
  x->val.resize(3);
  return 0;
}
```

Here's the error:

```
(lldb) p x->val[0]
error: expression failed to parse:
error: Couldn't lookup symbols:
  std::vector<int, std::allocator<int>>::operator[](unsigned long)
(lldb) v x->val[0]
error: Failed to dereference sythetic value
```

```
cmake -G Ninja -S llvm -B build \
 -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
 -DCMAKE_ASM_COMPILER=/usr/local/bin/clang \
 -DCMAKE_C_COMPILER=/usr/local/bin/clang \
 -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ \
 -DLLVM_PARALLEL_COMPILE_JOBS=5 \
  -DLLVM_PARALLEL_LINK_JOBS=1 \
 -DLLVM_BUILD_EXAMPLES=ON \
  -DLLVM_TARGETS_TO_BUILD="X86" \
 -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_CCACHE_BUILD=ON \
 -DLLVM_ENABLE_LLD=on \
 -DLLVM_ENABLE_PROJECTS='clang;lldb;lld;mlir;clang-tools-extra;compiler-rt;openmp;libclc;libc;' \
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"
```
I use ubuntu 22.04. I compile the code with:
`clang++ -o main main.cpp -g -O0`

The result of clang -v:

```
clang version 16.0.3
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
```

The result of ldd ./main:

```
linux-vdso.so.1 (0x00007ffd555ee000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4e0e800000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007f4e0eaa5000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4e0ea85000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007f4e0e400000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4e0eb95000)

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vl1z2jgX_jXiRmPGyNjABRfGmDYtCRlC38l7xcjWCaiVJY8kE7K_fke2-QzNtrPdGcYyPs_znA8dH4sawzcSYIzCCQqnHVrZrdLjwtps38kUexvnigEKYuRPkR-jyG9_zV8ScJmLigFGQbKD3CqNgvSWsYBC6beTsb5WhssNlrQAU9IcsLEMBZNzhLG6yi2O0aB9jPHBTcKlRUGKd1ScSIPplQCXFheUS0SGiIwOqKPYYTVbqoGtS-uEYye7xyiY4oL-gHVjbA2tUHCU2HsoSHdUdDUY_hcgMgwuARpspSX2L6K8Wc76-hk0IDIw2G4Bg9Yu1_gc8G4ThkKwDJERLo_BoHDio7B1cxDBsC81GMOVxC-UC2DYKlxSbU47fMQmqhJMIjKwWCj1oyqxeSsyJcwRipv9ilEQX-wJSU4GKoTK6fl-1T9nUiXo2lJ3HiLDSta9yLBQcnParFN6u39Ib3bMiYGGF9AgXVO92S1YnrtGqeCDwl89zN3eY-8TfuDyO8XeExZiV2BvgrOKC4ZRmLR18KbJffw1XU--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