This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70034] New: repetitive -Wvla warning for each non-constant dimension of a VLA


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];
       ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]