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

    <tr>
        <th>Summary</th>
        <td>
            [clang][sanitizer] Address sanitizer behaves unpredictably
        </td>
    </tr>

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

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

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

<pre>
    When running with -fsanitize=address enabled on a code a with memory-leak changing the comments/white-spaces or swapping around the flags can cause the sanitizer to notice the leak or not.
godbolt example: https://godbolt.org/z/s4e57KqGP
Here clang 17 doesn't notice the leak but clang trunk does.
If I delete line 7 the clang 17.0.1 notices the leak and the clang trunk not.

The code:

```cpp
#include<memory>

struct up:std::unique_ptr<up>{
    up():std::unique_ptr<up>(){};
    up(up* p):std::unique_ptr<up>(p){};

    //up(T&& ...p):std::unique_ptr<up>(std::move(p)...){}
};

void leak2(){
 up x(new up);
    x.swap(*x);
}

int main(){
 leak2();
}
```
Flags: 
-O0 -std=c++17  -fsanitize=address
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEvP2zYQ_DWry8KCTOphH3Sw47j50EN7CNBjQYlriw1FKnx8j_z6gpISu58LJIBBQ8vZGQ4fI7xXV0PUQnWE6pSJGAbr2k_2aJ981ln51v41kEEXjVHmii8qDLi5eGFUUN8I-ElI6ch7JCM6TRKtQYG9lYRiQY80Wve20SS-YD8Ic008YSDs7TiSCR7Y-WVQgTZ-Ej15tA79i5imhBPORiNn-EWLq8deGOxF9DTXvq_DYbBobFD9Up_FrEulHIoTFIerlZ3VAelVjJMm4AccQpg88AOwM7DzCsituwI7fwN29iVVze9ff_tzYfhEjrDXwlxx26C05A2wJjzIdjGssOCi-TIj10U8XfAJJWkKhFoZwmbZiJU0L_LtSudvfGL1f89587WMn-ftlMnWfRnqYvn107RWGFem1zFBPywnA_zjfY8PLvYB4wT84INMjPwQjfoa6e8pOOAf0tRHaI4LHhETmO2A7X_SsmCaIzQn4O_b03DA6VdYpkeaG9lymjPlZ2A1sBrzPP8l3h-zo32mVSfP85vaIvUg-2yVnM-K3Swu64kTvgLbGXqZTe7_Y_s1T9d8bjm83k_epOZRmYCjUOY9-b3iY-v3o18-z-nxpEu_fG7-KHAz2z31wI7AjtsG__ddZ7Llcs_3IqN22xT1ds92dZ0NbcVYUfVNKXldC8YLvrsUl8uuKrlkRVNUmWpZwcpiy6ptyZqyzkW9k6wqm0tRbvd7zqEsaBRK51o_j-ndZcr7SG2zLyueadGR9nMuMTbffWAsRZRrE37TxauHstDKB39jCCroOcyWjuoE1fFHSEB1wsMaV7fk6GgQz-QxmsmRVH0QnX7LotPtu4BQYYhd3tsR2DkJrn-bydl_qA_AzvP6U57NFv4NAAD__3w_md4">