[PATCH] D156565: Diagnose use of VLAs in C++ by default

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 11:34:38 PDT 2023


aaron.ballman added a comment.

In D156565#4580716 <https://reviews.llvm.org/D156565#4580716>, @Endill wrote:

> In D156565#4547909 <https://reviews.llvm.org/D156565#4547909>, @aaron.ballman wrote:
>
>> In D156565#4543503 <https://reviews.llvm.org/D156565#4543503>, @aaron.ballman wrote:
>>
>>> In D156565#4543414 <https://reviews.llvm.org/D156565#4543414>, @jrtc27 wrote:
>>>
>>>> Given GCC defines GNU C++ and regards this as a feature (unless you use things like -pedantic to ask for ISO C++), does it make sense to enable this for GNU C++?
>>>
>>> I think GCC should enable -Wvla by default in GNU C++ as well, for the same reasons I'm proposing it for Clang. I've filed an issue for it at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848
>>
>> The GCC conversation is leaning towards only diagnosing by default in C++ mode but not in GNU++ mode. I'm still trying to persuade them to diagnose in both modes one last time, but if it looks like they're firm about not diagnosing in GNU++ mode, I can live with that (for now). It at least improves our security posture a bit, so it's definitely a win.
>
> I think that we should warn by default in GNU mode regardless of GCC decision. As for the porting concern, I think it falls into "comprehensive diagnostics" selling point you mentioned earlier, which I totally agree with.

The current discussion on the GCC issue is to diagnose by default in C++ mode and add `-Wvla` to `-Wall` in GNU++ mode, which perhaps is a nice compromise. I'm waiting to see if any further discussion happens on that issue, but if folks have opinions on that approach, I'd love to hear them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156565/new/

https://reviews.llvm.org/D156565



More information about the cfe-commits mailing list