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

    <tr>
        <th>Summary</th>
        <td>
            [RISC-V] Infinite loop when compiling w/ -fstack-clash-protection on RISC-V
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            backend:RISC-V,
            needs-reduction
      </td>
    </tr>

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

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

<pre>
    When compiling some Fuchsia code for RISC-V, we found that enabling -fstack-clash-protection started causing our builders to time out. When investigating locally, I found that the build would not complete, even after more than a full day. Typically these files compile on the order of seconds, so there seems to be something wrong in the RISC-V implementation of stack clash protection. Note: we don't see these issues on x86_64 or Aarch64.

I'm uploading a reproducer, but this I haven't had a chance to reduce it yet.

[clang-crashreports.zip](https://github.com/user-attachments/files/19688491/clang-crashreports.zip)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8k82u5CYQhZ8Gb0pt2fh_4UXPvbLUmyySKFlGGMo2GQwWFN3pPH2Eu6NJFjMrW1B1zuGDEiHo1SKOrPnCms9MRNqcH7Vxdzx0Njv1HH_f0IJ0-6GNtisEtyNMUW5BC5BOISzOw8-3Xz4uvzH-AY-0EK0C2gQBWjGfbZclkJBfL9KIsF0O7wglaWchkPCECqSIIRW66GGO2ij0AcgB6R3BRcrhDKLtHQPpVVAqNk4KY57J9_ZfW9rwJQIPF40C6-g8gkHCVIx3tCAWQg-785iaLAhYojGgxDOHX5-HPqWTVEBYtMHwpoDg7OngvEIPboGA0lkVknJwacsjBMT9PMCMJzPaUuCHd3YF_ep_QQOdcu1oSZxAkl5CBScq-IYqh58cIauuibFylvGOks07og4hYkjZ_urbP9oanIer8HJr65wVV1Zcb4x3O8TDOKFSGAEeD-9UlOhT9jkmcjrADTZxx5fBJhQIkJuwEtNxPKZ60ARPpLcwa75II-x6kV6EzePhPIX8b32w5pPxfiM6AquujE-MT6umLc65dDvjUwzoL4JIyC0RCIxPJ2rGp3Jo-74eSsan74jzIVNjpYZqEBmOZVfXVcGHts-2UdR8aTrV8kEUnCveq6LuVVeW1dKXFXaZHnnBm6Iui7Kt2qLPUTV8mBvR1UMnlrphdYG70CY35r7nzq_ZCXgsq4YXbWbEjCacc8P5HFfGOeMf6V_Ir2gVq67_zsR7wyKqcDnxpdtM681n5sekf5njGlhdGB0ofHMkTeaczbdU8wk3u2irCcE4d8Dj_7P5YHz6_qQ5-35xWfRm_MGlJP_3J_X_iZIYn17vK13Mi8B95P8EAAD__zkFbLQ">