<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/91439>91439</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Segmentation fault on format
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          deponovo
      </td>
    </tr>
</table>

<pre>
    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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEGPqzgM_jXhYhWFBEo5cJi2r7fVSvvenkcBDGQVkioJ7eu_XwWYDjPTHXUllJp-n-3PDrZwTnYasSTZnmTHSIy-N7Zs8Gy0uZioMs2t_PMn4S9wlboxV0fokdCX5dzS-anNMAjdKKlxQVgKtRK627TGDsLH-Bths7mgddLombPGYUEgyWIa55_Cr3P-7aTuQED8wb2VCuEqfQ--R1DqMoDzN4Vrzz-kloNQgL_FcFZI-JcqCNuHZ6ngRNgJPDof1-fz259c6lqNDQLhB2GtuBH-Y8bGSZjzTQjMXxZwiea8HWsPZ2HF4F79Ei1fUACAhX-Q2hN2gJTwHzM9uQf5bw575wBAbbTzIPWSj38HpneQ5Md3ezrf0t1VswPwkHMCXk37OiMk38OHWki-fySV5PskvGxWZxLSssOj0ki-302UbDonerHQZ186v60Sz5cWPkfUS5efU_OEGBrsfG4CO0C2lrJ9Ssm3rVnpmE36UE0KKzVzf9i6Gf-nNSQ_wodrfzRwf41aS909GJcnh34eRH6cZnQj7yMF3yT91SOIylwQFIrGgTcgwGEXtAsfFkUrRuXjtc9ptL5HC1Jf0HnZzbwGvZDKhQ0WVsNSPwTVDoRFaEfdiCmuCmlM5YXUExetNTaGX28mGK1uYOp6tA5aY4Fs6edR2FLoxSVsAg7GwmAsAioM8V0cNSVvCl6ICMskT7Ik43maRX3ZZgXnNM1qXqd0t6sqyusCKUvqhHG-KyJZMspSmtEdzXmWZnHLU4o7umMFVkI0SFKKg5AqDrsvNraLpHMjlkWS8iJSokLlpiXPmMYrTCBhLOx8WwafTTV2jqRUSefdexQvvcLy55fOQzCmW45Gq8re-3Po8fyVddL3YxXXZiDsFEItP5uzNf9g7Qk7TQIcYadJ4L8BAAD__6EM3jw">