<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/150536>150536</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] clang 21.1.0_rc1 hangs while compiling GTK 3.24.49 with -Wmissing-noreturn
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vimproved
</td>
</tr>
</table>
<pre>
While compiling GTK 3.24.49, clang 21.1.0_rc1 hangs indefinitely while building two files: `gtktoolbar.c` and `inspector/object-tree.c`. While reducing, I figured out that this is due to the `-Wmissing-noreturn` diagnostic (which is enabled by default by the GTK build system). This does not happen with clang 20.1.8. I have not tested HEAD (however I will do so if it is requested). The reductions of the two files are functionally the same but I've put them both here to be exhaustive.
## Reduction of `gtktoolbar.c`
```c
typedef void (*GtkCallback)();
int gtk_toolbar_forall_list;
void gtk_toolbar_forall() {
GtkCallback callback;
while (gtk_toolbar_forall_list)
;
callback();
}
```
<details>
<summary>Reduction script (gtktoolbar-reduce.c is preprocessed gtktoolbar.c)</summary>
```python
#!/usr/bin/env python3
import subprocess
try:
subprocess.run("clang -Wmissing-noreturn -o gtktoolbar-reduce.c.o -c gtktoolbar-reduce.c", shell=True, timeout=1)
except subprocess.TimeoutExpired:
subprocess.run("clang-20 -Wmissing-noreturn -o gtktoolbar-reduce.c.o -c gtktoolbar-reduce.c", shell=True)
else:
exit(1)
```
Tweak the timeout value as needed.
</details>
## Reduction of `inspector/object-tree.c`
```c
typedef void (*ObjectTreeForallFunc)();
int object_tree_widget_forall_i;
void object_tree_widget_forall() {
ObjectTreeForallFunc forall_func;
for (; object_tree_widget_forall_i;)
;
forall_func();
}
```
<details>
<summary>Reduction script (object-tree-reduce.c is preprocessed inspector/object-tree.c)</summary>
```python
#!/usr/bin/env python3
import subprocess
try:
subprocess.run("clang -Wmissing-noreturn -o object-tree-reduce.c.o -c object-tree-reduce.c", shell=True, timeout=1)
except subprocess.TimeoutExpired:
subprocess.run("clang-20 -Wmissing-noreturn -o object-tree-reduce.c.o -c object-tree-reduce.c", shell=True)
else:
exit(1)
```
Tweak the timeout value as needed.
</details>
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVk1v6zYQ_DX0ZWFBpvx58MGJo9eghwKFgXc0KHElsaFIlR9y_O8LUnLsh9jtQ5ECBYwkFpczs7MchcxaUSvELVk8kcV-wrxrtNn2ou2M7pFPCs3P2--NkAilbjshharh2-FXyBI6T-YbQp-hlEzVQGfJLEmPppxBw1RtQSiOlVDCoTzDKUIUXkgeENxJQyUkWpLtgCzT2r05rWXBTFKSZQpM8fBYKNth6bQhNNfFH1i6qTOIsSaBQZZB7kuh6qDkFSpRe4MctHfgGhZ-CAvCAvcIToNrMABPv7fCWqHqqdIGnTcqsHLBaqWtEyUQuj41omzCVlSskMihOAPHinnpwp8BKRgRewJ7tg5bQjcJHAIj12hBaQcN6zpUcBKuuRiVJrNkncArNKzHWOTQOuTwy8tuH5gbfcIeDbzCSUgJXIPVICoQLsgx-KeP9SPbaIETWlnQVRT24S8wg1B5FZeZlINuy9owDAevhK56hC66hS0U2jXQoIleFQj43jBvnegxIekufGhGaAa_XxgD4ef5hcJlOnxKku7cuUOOFfRa8NAgobtv7u2ZSVmw8o3QTXy2IdkTSXdCOajd23EEPFbaMCmPUlg3FESUzxUDBpBVqAG4IYDywpQNa8NpJHT9iIduYh3AuOMD4EYnWe1v-xz9yZ45OiakJdnL8N36tmXmTLKXq2u2NKJzo4JRwDSOEZMyDLkz2BldorUYe726G-ifCc2vsCPzRUh3do1Wl1nNCM29DQEqhCI0R9XDUJEFr9tOGwfWFyPbgOUC7m604LqYGK-iA3Q4yZ9TBFMNdzpKNEzLewuE0pBb26CUJNsfjMfw3YkWtXck28-GUeB7id2tzuQwlLy8d8Ig_wm1U5r-V4KjQmnxqgLfhSN0Paq_PSOHE7K3IaNDB9Az6RGYBYXIkSfD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