[Bug c/119381] -ftrivial-auto-var-init=pattern vs VLA inside a struct

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 20 05:36:32 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119381

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So as I mentioned on IRC, clang implements a slightly different extension
compared to GCC. clang decides that size is a constant integer expression
handles it that way and gives a warning about it:
```
<source>:5:22: warning: variable length array folded to constant array as an
extension [-Wgnu-folding-constant]
    5 |                 char buffer[size];
      |                      ^`
```

Except that is NOT the GNU extension here. rather VLA inside a struct type is
the extension that allows it. clang implementing a different extension as GCC
but then saying it is a GNU extension. What a bad thing to do :).


More information about the Gcc-bugs mailing list