This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70034] New: repetitive -Wvla warning for each non-constant dimension of a VLA
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 01 Mar 2016 22:00:44 +0000
- Subject: [Bug c++/70034] New: repetitive -Wvla warning for each non-constant dimension of a VLA
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70034
Bug ID: 70034
Summary: repetitive -Wvla warning for each non-constant
dimension of a VLA
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
G++ issues -Wvla warning for each dimension of a VLA that is not a constant
expression. It seems that just one warning for the array object would be
sufficient. (Interestingly, Clang suffers from the same problem.)
$ cat z.c && /home/msebor/build/gcc-trunk-svn/gcc/xgcc
-B/home/msebor/build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic -o/dev/null
-xc++ z.cvoid foo (int n)
{
int a [n][n][n];
}
z.c: In function âvoid foo(int)â:
z.c:3:17: warning: ISO C++ forbids variable length array âaâ [-Wvla]
int a [n][n][n];
^
z.c:3:17: warning: ISO C++ forbids variable length array âaâ [-Wvla]
z.c:3:17: warning: ISO C++ forbids variable length array âaâ [-Wvla]
z.c:3:7: warning: unused variable âaâ [-Wunused-variable]
int a [n][n][n];
^