Issue 150536
Summary [clang] clang 21.1.0_rc1 hangs while compiling GTK 3.24.49 with -Wmissing-noreturn
Labels clang
Assignees
Reporter vimproved
    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>
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to