<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135347>135347</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Illegal instruction compiling a stress test built on tuple
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AlisdairM
</td>
</tr>
</table>
<pre>
I wrote a simple stress test to build a deeply nested tuple type:
```
auto x0 = make_tuple();
auto x1 = make_tuple(x0);
auto x2 = make_tuple(x1);
auto x3 = make_tuple(x2);
...
auto x255 = make_tuple(x254);
```
where each iteration embeds a tuple that nests one deeper as `tuple<tuple<tuple<tuple<...>>>>`.
The attached crash files are from attempting to instantiate up to `x255`, although I have not narrowed the exact iteration of the failure as the test builds take a few minutes before crashing. Builds up to `x194` build fine, and the fail appears to be building the `x195`.
Monitoring the system I can see that it is not simple memory exhaustion, as the compilation fails using no more than around 12.8Gb on my system with 128Gb physical RAM. Builds (to failure) take around 200seconds on my MacBook M4.
Note that the test should be built using the libc++ tuple. libstdc++ uses a recursive tuple that recycles more of its template instantiations when building these types, so stresses the template machinery less. This is the rare case where a recursive tuple is a win.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0VE1vpDgQ_TXuS2mQMfTXgUN6slnlkD2s5r4qTNH2xtjIZdLpf78y0OnMTFayhCg_quq9ehQy27MnasT2JLaPG5ySCbF5cJY7tPFl04bu2jzDJYZEgMB2GB0Bp0jMkIgTpADtZF0HCB3R6K7giRN1kKYMTdeRRPUg5Hx2cj3yAacU4F2CqB5hwFf6Z8YLdRDqKKrTB6L8HfEuf8GoLzDlL5jqC4z6wBRFcc-23X6F3dYf6M88hHy4GIoEhNqATRQx2eCBhpY6BrzpYDDNyjAET7NUFAEZxE4uNarv__fMzVV_3M9OFkvhH4YAU0JtqAMdkQ301hEDRoI-hiHf0jAm6895UNZzQp8sJoJpzBG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