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

    <tr>
        <th>Summary</th>
        <td>
            WRAPPER_ESCAPE
        </td>
    </tr>

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

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

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

<pre>
    ```
class TestClass {
public:
 TestClass(unsigned int width, unsigned int height)
        : _width(width), _height(height) {
        _rowPtrs.resize(1, std::vector<const char*>(height, nullptr));
    }

    void process() {
        int tmpHalfBufferElements = _width * _height;
 std::vector<unsigned short> tmpHalfBuffer(tmpHalfBufferElements);

 char* tmpHalfBufferPtr = (char*)&tmpHalfBuffer[0];

        for (int y = 0; y < _height; ++y) {
            _rowPtrs[0][y] = (const char*)tmpHalfBufferPtr;
            tmpHalfBufferPtr += _width * sizeof(unsigned short);
        }
    }

    void printRowPtrs() const {
        for (const auto& ptr : _rowPtrs[0]) {
 std::cout << (void*)ptr << " ";
        }
        std::cout << std::endl;
    }

private:
    unsigned int _width;
 unsigned int _height;
    std::vector<std::vector<const char*>> _rowPtrs;
};

int main() {
    unsigned int width = 2;
 unsigned int height = 2;

    TestClass test(width, height);
 test.process();
    test.printRowPtrs();

    
    std::cout << "After process function exits:" << std::endl;
 test.printRowPtrs();

    return 0;

```   
ANALYZED BY GDB
```   
Breakpoint 1, TestClass::process (this=0x7fffffffcc00) at test1-o.cpp:12
12              int tmpHalfBufferElements = _width * _height;
(gdb) next
13              std::vector<unsigned short> tmpHalfBuffer(tmpHalfBufferElements);
(gdb) next
15              char* tmpHalfBufferPtr = (char*)&tmpHalfBuffer[0];
(gdb) n
17 for (int y = 0; y < _height; ++y) {
(gdb) n
18 _rowPtrs[0][y] = (const char*)tmpHalfBufferPtr;
(gdb) n
19 tmpHalfBufferPtr += _width * sizeof(unsigned short);
(gdb) n
17 for (int y = 0; y < _height; ++y) {
(gdb) n
18 _rowPtrs[0][y] = (const char*)tmpHalfBufferPtr;
(gdb) n
19 tmpHalfBufferPtr += _width * sizeof(unsigned short);
(gdb) n
17 for (int y = 0; y < _height; ++y) {
(gdb) n
13 std::vector<unsigned short> tmpHalfBuffer(tmpHalfBufferElements);
(gdb) n
21          }
(gdb) n
main () at test1-o.cpp:42
42 test.printRowPtrs();
(gdb) n
0x41beb0 0x41beb4 
45 std::cout << "After process function exits:" << std::endl;
(gdb) n
After process function exits:
46 test.printRowPtrs();
(gdb) n
0x41beb0 0x41beb4 
48          return 0;
(gdb) n
40          TestClass test(width, height);
(gdb) n
49 }
(gdb) n
0x00007ffff74bdd85 in __libc_start_main () from /lib64/libc.so.6
(gdb) n
Single stepping until exit from function __libc_start_main,
which has no line number information.  
``` 
>From the debugging session, it can be seen that _rowPtrs is correctly set to the address of tmpHalfBuffer during the execution of the process function. However, after the process function exits, tmpHalfBuffer is destroyed, causing _rowPtrs to still reference the memory area that has been destroyed.

In the main function, the first time printRowPtrs is called, the content of _rowPtrs is a valid address (for example, 0x41beb0 and 0x41beb4). But after the process function exits, tmpHalfBuffer is destroyed, causing _rowPtrs to still reference the memory area that has been destroyed. However, the WRAPPER_ESCAPE issue is not reported. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWFuP4jYU_jXm5WiR4yQQHnjgNt1KVTXarVRtX5CTHIhbY0e2w8D--spJSAiws9t2tupDrRmRi893vvP5XIbh1oq9QpyTeEni9YhXrtBm_vl0_nw6B0EQjFKdn-dkQtsfuiZ0kUluLfyC1q3qKzJdNi_KKpUiI-Giue23EJZUqnaVg1AOXkTuCsJWMHhaoNgXjrBZa94uEi5g21ok7efMG28vBkln2XO5WG-Nfnl2xo4NWvEZCUsCb2td7nmGiyNmThsSrjKtrIOs4IawBQk3V7ArUJWUpTO14xkJr3yQ6bq56R8dtcihNDrDOvKHtHy87lC-53K3rHY7NBuJ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