mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-03 00:34:21 +08:00
14818f987a
In r268428 I changed reshape_init_r in such a way that when it sees a nested { } in a CONSTRUCTOR with missing braces, it just returns the initializer: + else if (COMPOUND_LITERAL_P (stripped_init) ... + ++d->cur; + gcc_assert (!BRACE_ENCLOSED_INITIALIZER_P (stripped_init)); + return init; But as this test shows, that's incorrect: if TYPE is an array, we need to proceed to reshape_init_array_1 which will iterate over the array initializers: 6006 /* Loop until there are no more initializers. */ 6007 for (index = 0; 6008 d->cur != d->end && (!sized_array_p || index <= max_index_cst); 6009 ++index) 6010 { and update d.cur accordingly. In other words, when reshape_init gets {{col[0][0], col[1][0], col[2][0], col[3][0]}, {col[0][1], col[1][1], col[2][1], col[3][1]}, {col[0][2], col[1][2], col[2][2], col[3][2]}, {col[0][3], col[1][3], col[2][3], col[3][3]}} we recurse on the first element: {col[0][0], col[1][0], col[2][0], col[3][0]} and we can't just move d.cur to point to {col[0][1], col[1][1], col[2][1], col[3][1]} and return; we need to iterate, so that d.cur ends up being properly updated, and after all initializers have been seen, points to d.end. Currently we skip the loop, wherefore we hit this: 6502 /* Make sure all the element of the constructor were used. Otherwise, 6503 issue an error about exceeding initializers. */ 6504 if (d.cur != d.end) 6505 { 6506 if (complain & tf_error) 6507 error ("too many initializers for %qT", type); 6508 return error_mark_node; 6509 } * decl.c (reshape_init_r): For a nested compound literal, do call reshape_init_{class,array,vector}. * g++.dg/cpp0x/initlist118.C: New test. From-SVN: r279686 |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.