[Bug c++/70075] incorrect initialization of multidimensional VLAs
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 3 05:26:30 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70075
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #3)
> (In reply to Eric Gallager from comment #2)
> >
> > I get this output on i386-apple-darwin9.8.0 with gcc8:
> >
> > $ /usr/local/bin/g++ -Wall -Wextra -Wpedantic -o 70075.exe 70075.cc
> > 70075.cc: In function ‘void bar(int)’:
> > 70075.cc:4:13: warning: ISO C++ forbids variable length array ‘a’ [-Wvla]
> > char a[m][n] = { { 0, 1, 2 } };
> > ^
> > $ ./70075.exe
> > 0 1 2 0 0 0 -32 -113
> > $
> >
> > (i.e. no errors)
>
> Running the program on x86_64-apple-darwin10.8.0 with gcc9, it prints this
> instead:
> 0 1 2 0 9 0 0 0
> (still no errors though)
Update for gcc 11 on x86_64-apple-darwin19.6.0:
0 1 2 0 0 0 0 0
So, not only are there no errors now, but it also looks like everything after
the "0 1 2" is now properly zero-initialized? FIXED?
More information about the Gcc-bugs
mailing list