public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110848] Consider enabling -Wvla by default in non-GNU C++ modes Date: Mon, 23 Oct 2023 10:50:30 +0000 [thread overview] Message-ID: <bug-110848-4-hmox1eeBL9@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110848-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848 --- Comment #24 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Martin Uecker from comment #22) > There may be many good reasons to prefer std::vector over VLAs in C++ but > security and safety is not one of them. There are plenty of CVEs caused by > std::vector out-of-bounds accesses. There are plenty of CVEs caused by those for arrays too, static and variable length ones. The point is that vector carries its length with it properly, in a way that actually works with the type system (e.g. works with std::span and std::end etc.) A VLA has a length that the compiler knows in a limited scope, but you can't pass that to a function without passing the length explicitly as a separate argument. The length information is easily lost. > The question is whether in GNU mode one > should warn about a GNU extension. People who want to avoid VLAs for reasons > of standard compliance would also not use a GNU mode. Yes, I know, and the lack of integration with the type system should show they are simply inappropriate for general purpose use in idiomatic C++ code.
next prev parent reply other threads:[~2023-10-23 10:50 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-28 20:02 [Bug c++/110848] New: Consider enabling -Wvla by default in " aaron at aaronballman dot com 2023-07-28 20:10 ` [Bug c++/110848] " pinskia at gcc dot gnu.org 2023-07-28 20:18 ` pinskia at gcc dot gnu.org 2023-07-28 20:25 ` aaron at aaronballman dot com 2023-07-28 20:35 ` pinskia at gcc dot gnu.org 2023-07-28 22:34 ` muecker at gwdg dot de 2023-07-29 11:19 ` aaron at aaronballman dot com 2023-07-31 8:18 ` [Bug c++/110848] Consider enabling -Wvla by default in non-GNU " rguenth at gcc dot gnu.org 2023-07-31 12:40 ` aaron at aaronballman dot com 2023-08-01 12:33 ` redi at gcc dot gnu.org 2023-08-01 13:01 ` aaron at aaronballman dot com 2023-08-04 5:49 ` egallager at gcc dot gnu.org 2023-08-04 12:22 ` aaron at aaronballman dot com 2023-10-21 14:45 ` aaron at aaronballman dot com 2023-10-22 4:45 ` egallager at gcc dot gnu.org 2023-10-22 4:57 ` egallager at gcc dot gnu.org 2023-10-22 9:03 ` muecker at gwdg dot de 2023-10-22 13:20 ` aaron at aaronballman dot com 2023-10-22 16:14 ` pinskia at gcc dot gnu.org 2023-10-22 16:56 ` aaron at aaronballman dot com 2023-10-22 17:45 ` muecker at gwdg dot de 2023-10-23 8:23 ` redi at gcc dot gnu.org 2023-10-23 10:30 ` muecker at gwdg dot de 2023-10-23 10:46 ` redi at gcc dot gnu.org 2023-10-23 10:50 ` redi at gcc dot gnu.org [this message] 2023-10-23 11:58 ` muecker at gwdg dot de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110848-4-hmox1eeBL9@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).