Issue 91439
Summary Segmentation fault on format
Labels new issue
Assignees
Reporter deponovo
    OS: windows

```commandline
$ clang-format.exe --version
clang-format version 15.0.7
```

Using a .clang-format file with the llvm style

Minimal example:
```c++
// test.cpp
#include <array>
using std::array;
struct params_t
{
    array<int, 4> param1;
 array<int, 4> param2;
    const int param3;
    const int param4;
};

array<params_t, 3> array_of_params{ {
    {array<int, 4> {1, -1, -1, 1}, array<int, 4>{8, 15, 11, 9}, 1, 10},
    // comment
 {array<int, 4> {1, -1, 1, 1}, array<int, 4>{0, 7, 3, 5}, 1, 6},
    // comment
    {array<int, 4> {-1, 1, -1, 0}, array<int,4 >{0, 8, 12, 10}, 1, 10},
    // comment
} };
```

Running:
```commandline
$ clang-format.exe --style=file -i test.cpp 
```

The above leads to a segmentation fault.

Further investigation details: the comment lines are fundamental to obtain the error. The error only occurs for `array_of_params` having 3 or more elements.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to