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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] C2Y `_Countof` weird sub-array count with multidimensional VLA
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    This snippet:
```
#include <stdio.h>
int main(int i, char**) {
    int arr[11][++i][33][++i];

    printf("%lu\t", _Countof arr);
 printf("%lu\t", _Countof *arr);
    printf("%lu\t", _Countof **arr);
 printf("%lu\t", _Countof ***arr);
    printf("\n");
 printf("%lu\t",  sizeof arr / sizeof *arr);
    printf("%lu\t", sizeof *arr / sizeof **arr);
    printf("%lu\t",  sizeof **arr / sizeof ***arr);
    printf("%lu\t",  sizeof ***arr / sizeof ****arr);
 printf("\n\t^ here\n");
}
```
prints the following with current Godbolt trunk and clang-21 in LLVM Debian nightly:
```
11      198     33      3       
11      2       33      3       
        ^ here
```
The second output looks funny, if I understand _Countof correctly it should be `2` instead of `2*33*3`.
Godbolt: https://godbolt.org/z/o1c6bWosM
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVE1v4zYQ_TWjyyAGOZRs66CDYq-LAtnbYoueCkqkLHZp0uDHBt5fX1B2WsQpFkkLEDQ59Hsz73FEGaM5Oq07aB6h2Vcyp9mHbspzdK4avLp0X2YTMTpzPusEogfWw5rdBuuBhHGjzUojiF1MyvjVDOITsN64hCdpHNC2LA3QDsdZBqB-GS3C5hFYj4hY_iBDgOaRc2j2pRoqw1w3QrwJigK9oc_BuDQBbYEIqLEZml1a1jv8Y-ezS35a6Km94t6HAOpfgd6b6SrwP-X7F-h91mbnFuB7qDGaH_qqHYEOL9sPCnuFuuP5INUb5Fu6_8X4E9KfXkkxtXA2n3DWQd-bDJv9Xd8v6Ihp1jh5a_2zcUd8NmnGMYegXcJfvBq8TZhCdt9QOoWjle74QByNw6enr59xrwcjHTpznJO9vP24OAfW8nYLrBWiTMDalzDdBcv8Uv1rli-zxqhH7xT6nM45ofX-W8QpO3cpFpoJf8XslA4xlTr_bsjRh6DHZC9oEsbZZ6tw0AhrRrBmaFxMWiosLpcQ9UKUCdZsBay_GQCixzmlcyz66AB0OF4PVj4cgQ4_gA6ej-vhNx8_V6oTqhWtrHTHN_WWbzlf19XcNdOGT6NmkvF2qKfNsK0HzTbroVmTasepMh0xalhDDRcN1fVKtZMSk5rqzai1EBPUTJ-ksStrv59K7srEmHXHa16ztrJy0DYu7yDRclNLX-yr0BXAw5CPEWpmTUzxH4pkkl0ez92CaPa4o9-LGy8eFp-etQkKYx4eZAjygmM5ujbLKdtklDlpF4130uLXp77KwXZ3jpk052E1-hPQoSS__Tycg_9TjwnosIiJQIebnu8d_RUAAP__5Ymu9Q">