Issue 87224
Summary Clang seemingly stuck in an infinite loop
Labels clang
Assignees
Reporter nicola-gigante
    The attached file makes clang 17 take several minutes to compile, and I've never seen it terminate yet (on fast hardware), so I suspect an infinite loop is happening. I did not manage to reduce it because the "problem" is that it takes a lot of time, so `creduce` is not helpful here, unless setting a high timeout and waiting hours.

The culprit is around line 131447. 

```
131442 | map_t(class consumer *next, type_mapping_t ty_map, term_mapping_t te_map);
131443 |
131444 | template<typename ...Fs>
131445 | map_t(class consumer *next, Fs ...fs) : map_t(
131446 | next,
131447 |    ast::mapping(fs...), ast::mapping(fs...)
131448 | ) { }
```

The second constructor of this class should call the first but the two calls to `act::mapping` produce something that can also match the second constructor arguments and I think this causes an infinite loop. Indeed if I change that line as follows:

```
131447 | type_mapping_t(ast::mapping(fs...)), term_mapping_t(ast::mapping(fs...))
```

then the compilation goes smooth in a few seconds.

This is `clang --version`:
```
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
```

The command line I use is:
```
clang++ -std=c++20 -fsyntax-only -x c++ report.cpp.txt
```

[report.cpp.txt](https://github.com/llvm/llvm-project/files/14822090/report.cpp.txt)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to