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

    <tr>
        <th>Summary</th>
        <td>
            ASAN does not detect use-after-free for small strings
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            compiler-rt:asan
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/dj8K3xb17
```cpp
#include <string>
#include <iostream>
#include <string_view>

struct MyThing {
    std::string_view s;
};

MyThing makeThing(std::string s) { // Use after return after the function call.
 return MyThing{s};
}

std::string getS() { return std::string("abcdabcdabcdabc"); }

int main() {
    auto thing = makeThing(getS());
    std::cout << thing.s << std::endl;
    return 0;
}
```
Is this a known false negative ?
Works fine with strings with a length `>=16`.  https://godbolt.org/z/8cGT7b38n
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVEGPszYQ_TXDZZTI2BDgwCH5slRV1V52qx4rAwa8a-zIHrK7_fUVgTSbaKtPAuOx37yZeR4sQ9C9VaqE9ADpMZITDc6XU_go0qh27Wc5EJ0CiD3wCnjVu7Z2hrbO98Crf4BX7Wv-m_io4wzYEdgedmx5mtNpXeFC28ZMrUIQPwJ5bXsQT99tahfIKzn-z_bi-_dZq_cb4jIG8lND-Pvny6Btj5AdlnVExEDtnL7Yf3HHAGKFQHa8zS_jlWWUb-oyA54_kGAAXsxhcJEF_wwKZUfKo1c0ebsaNCjsJtuQdhYbacx2zWtFraEgO4S7PLLjfXX3wXtFz8Dzawor1wPqAuCybtovL3AOvABxwIcQ2hKOUtsb7U1AOZFDWoQVxztZbpkstN-o3riJ5sMD8WMh2Yar-R9G2dbcea8lsW8UufbXYv4aZtKAEt-se7fYSRMUWtVL0ue5aaoF95fzbwE7bRW-axpw0SgshkSjbE8DzrTiCcQx3sGObRF_1vx588tLVovcRm0p2kIUMlJlnHGepyJhLBrKOm5zxVrZxUXc5U0mCxFLkRVFWiddmxSRLjnjCctZGjMuONvyuM3jRrIdKxKe7BgkTI1Sm60x53GOHekQJlXGLC7SNDKyViZc_l_OGzeetFF-4wnEXgZp5xNPj5EvZ-9NPfUBEmZ0oHDjI01Glfvn_R_YOhXQOsJWkWoIp6A2l1bedF4p7JzHMEpjrgJGkzePV4SmYaq3jRuBV3OM9bM5efeqGgJeXQoIwKu1hnPJ_w0AAP__vC9ZMA">