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

    <tr>
        <th>Summary</th>
        <td>
            Erroneous input makes Clang hang and consume all memory
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            crash-on-invalid
      </td>
    </tr>

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

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

<pre>
    When running `creduce` to pinpoint a misoptimization, I ran into many cases where Clang would essentially hang using 100% cpu, and eating up all the memory of the machine (essentially blocking the whole reduction).

The issue is reproducible with the attached 
[error-oom.zip](https://github.com/llvm/llvm-project/files/12213587/error-oom.zip), by running `clang -target x86_64-w64-mingw32 -std=c++2b -c error-oom.cpp`. First, it prints a bunch of warnings/errors, after which the process hangs consuming 100% cpu, and using more and more memory - usage rising by around 1 GB per second in my case, until killed by the system OOM killer or similar.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU02P4zYM_TXyhXCgyB8zPviwmTRFD8VeCvRYyBJjc0eWDFHaNPvrC9mz2C7QSy9KaIpP5HuPmplmjziK7iK6a6VzWkIcV04h8pdQTcE-xz8X9BCz9-RnEL00EW02KHoJKcBGfgvkE2hYicOWaKVvOlHwQr3BbxC1B_IpwKr9E4xmZHgsGBHenPYzPEJ2FpAZfSLt3BOW8jlzee0spVAdmC0XMO0toE4lkTfQzkFaEFZcQ3xCuB-RNgt5BKFe_405uWDeS2G581iCQ9inOPocTkJehfx0nH8sCMScywkRtxhsNjQ5hAelZUfQKWmzoIWPuu6CMYZYh7CevtEmuqtQr0tKG4vmk1A3oW4zpSVPJxNWoW7Off3-U28xfEGThLrdySELdTsrdW661xehbj_DqqHQMD1_UmNnsU46zpjg79f-r76tH31br-TnR6Og5mRFczVCXYS6qAlqAz9gzbaJXp7gRpFTQacEWySfGDRM2ZulMPvQsbzH3zviXY57wgiPhcxByhaDQeZdPwYTPOf1v0U8xF1DxD3c_3zIWENmPSNE2u9MT9AxZG_hDL9eYMMIjCZ4C-RhPfxUULNP5OCdnENbiko__OSEK3z-_PuRiBAiMK3kdPwQvLJjY4dm0BWO536QL0Mv-75axrZt-7ORrW37u-zuVut-6obO9nfTyrPuKhqVVI18ac5yaFrVn6Q192bomv6lHZp704pW4qrJnYrIpxDnavfU2LeqO1dOT-h4XzuldgmFUkK9lShqXurga_JftSNbEt21iuPulinPLFrpiBP_gE6UHI6_xBg8hsxAfssJVv2O_LFm-1IVsg9dcF-fg_MqRzf-b7Pu0xRD7AP9EwAA__8iTW1n">