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

    <tr>
        <th>Summary</th>
        <td>
            clang 17/18: Adding UBSan makes ASan message disappear
        </td>
    </tr>

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

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

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

<pre>
    Compiling the program below with `clang++ -Wall -Wextra -g -fsanitize=address main.cpp` shows the expected memory leak.
```bash
==1548781==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
...
```

However if compiled with `clang++ -Wall -Wextra -g -fsanitize=address,undefined main.cpp` it no longer generates any output.
This happens with clang 17.0.6 and 18.1.1.
If the memory allocation is moved to function f() then the combination of ASan and UBSan works fine.

Is this the expected behavior?

The test program:
```c++
void r()
{
    int* iptr=new int(3);
}

void f()
{
    r();
}

int main()
{
 f();
    return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVF2vozYQ_TXmZRRkm0DIAw_J0qgrVap0d6t9NvYAboyNbJNs-usrPrKNbve-rIT4GGbOHJ85tghBdxaxIvmZ5HUiptg7X41XczwkjVOP6pMbRm207SD2CKN3nRcDNGjcHe469kAKKo2wHeFnws-w-yaMgd03_B69gF0HuzYIq6P-B0lWC6U8hgCD0DaV40gKCqF397Cg4_cRZUQFAw7OP8CguKaE1oSeSEHXqxGh30JZTbKa5fvyULL147e3tz_fSHaCP1Bcv2xt_RxQGP8HHTac5V5rjzIucXAt7KF5RCS8DIQfQVtg4Jq_UcZnSBjjpJgRW-8Gkm0wafqe8GuT390db-hBtyAXXVH9uoiEf5qswlbbeVkvguoI1oFxtkMPHVr0ImIAYR_gpjhOcaP4tdcBejGOaMNKY-EA7JDStABhFbAyZSnb8j-3y5Q2BTcBtLOgAwzuhgqig3aycgm2hJezULFHu9RJNzTarhWuhdMXYZcef53nt7vz1wDzYtJXxT7PztDv7NFgL27aeZJdXnO_9ggRQ3y69MdQfsxCrvqu0ZvTCvzKcss7bL8AALSNhJ9Aj9GTrLZ4XyNlNqdn52dF_cpggWw_hHw2-6Ba27jM8ef17bviBRDj5C3QnyA-l5yoKlPH7CgSrNiB5WVBOWdJXxVUIeallOxQ4jGTVLGcHikXTBSlbEWiK075nuasYCynnKUllag4P7J9ecj3yMme4iC0SY25DanzXaJDmLA68qwsEiMaNGE5WDjfzM3nM8ZXc_6umbpA9tToEMN_CFFHg9XTh4RfWDlv35NS8xG0WmUQVwyrfwYMQXQISofZx8InkzdVH-MY5unzC-GXTsd-alLpBsIvc6PtsRu9W3f0ZeEdCL8s1P8NAAD__2echM8">