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

    <tr>
        <th>Summary</th>
        <td>
            MemorySanitizer:DEADLYSIGNAL (MemorySanitizer: stack-overflow) on a simple code in release/18.x branch
        </td>
    </tr>

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

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

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

<pre>
    The following code
```
        try {
                printf("throwing std::bad_alloc\n"); fflush(stdout);
                throw std::bad_alloc();
        }
        catch (std::exception &ex) {
                printf("caught std::exception\n"); fflush(stdout);
        }
```
crashes with the following output:
```
throwing std::bad_alloc
MemorySanitizer:DEADLYSIGNAL
==[12](https://github.com/SChernykh/p2pool/actions/runs/7670887762/job/20908044478#step:10:13)790==ERROR: MemorySanitizer: stack-overflow on address 0x7fff5a337f98 (pc 0x7fc37e9a22ee bp 0x7fff5a338090 sp 0x7fff5a337fa0 T12790)
MemorySanitizer:DEADLYSIGNAL
```
When trying to use MemorySanitizer from `release/18.x` branch.

This is a minimzed code from my project that reproduces this issue. The same code works fine with `release/17.x` branch MemorySanitizer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1v3DYQ_TWjC-EFNdQXDzqss1FRIG0B20DRU0FJoxVjShRIKvbm1xdcbVxvEjgwIJAiMe_x8c0Mlff6OBPVkN9CfkjUGkbr6vsPI7n59Dgmre1P9cNIbLDG2Cc9H1lnewJ-AL6Hgl--bcllcCcG5e3LGrhcnJ7DAFgBYhjdxuFDD2IPYt-q_l9ljO0g_zADIqAEccuGwax-BKx86O0att3XrGemn9HEc66Dy8PLf6dCN7KNdgPSc0dL0HZmgAU9A8q39HdqPY6B_Yh-l_oXQdf2dU75kTx70mFk4cpyu4ZlDfHMnwHfcvUc8AdN1p3u1ayD_koOxP7wcX_49M_977_9uf904RSH-OW3KUJ-AKzGEBYf6bABbI46jGu76-wE2LyUB2Cz4GKtAWxUF43wgI1bz1NZlLyqyrJAwOazbQEb5JJXPMuysgIUPtACYp_yOAhAWUq-yfh4d_fXHYg9-1E580F1jzf2C7nB2CdmZ6b63pH3jD-XwzDkSohykFVM89KdNztRklSIRKxdXoVVXHLmlyug4uwhxagE5Tvcu87I3yPNLLhTTEqwbPX0_U3Y4OzEoOCODClPgE1a7Z6h4Kx1au7G3bd6iePDqD3Tnik26VlPX6k_d-FGMp3Y4uxn6gILowrM0eJsv3bkWdhwfqUdi03s1UQb8sm6R88GPdNWb9dKytdKvpe-S_pa9FJIlVCdlrzAquJYJWNd9rKVYsiJq2EQqcplKpWSxaB6URZqSHSNHDOeYpEWuciyXdEravuWD1nb9TIXkHGalDY7Y75MO-uOyVl9XcoCeWJUS8Z_e6tcHYNu2vXoIeNG--D_hwUdDNVvpy5WyC8LLL4IscaY19NiLu7pmV3n7WJVsjpTv9E4Ud5lurnkDLA5X_HcMfGW_wUAAP__pDC0uQ">