Summary: | [3.3] ICE on initializer with an array index | ||
---|---|---|---|
Product: | gcc | Reporter: | ban |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dig, gcc-bugs |
Priority: | P3 | ||
Version: | 3.3.2 | ||
Target Milestone: | 3.4.0 | ||
Host: | i486-pc-linux-gnu | Target: | i486-pc-linux-gnu |
Build: | i486-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: | 2003-10-14 16:33:31 |
Description
ban
2003-10-14 11:49:40 UTC
Fix: This patch avoids the ICE: --- gcc/cp/decl.c.old 2003-09-02 15:03:24.000000000 +0900 +++ gcc/cp/decl.c 2003-10-11 03:52:11.000000000 +0900 @@ -8364,7 +8364,10 @@ TREE_CHAIN (element_init) = CONSTRUCTOR_ELTS (new_init); CONSTRUCTOR_ELTS (new_init) = element_init; if (TREE_PURPOSE (element_init)) - index = TREE_PURPOSE (element_init); + { + /* index = TREE_PURPOSE (element_init); */ + sorry ("initializer with an array index"); + } } } else More constructive solution would be to port C's code (and parser) to C++. It handles a C-extention of designated initializers much better. The first testcase does not ICE on the mainline: tin:~/src/gnu/gcctest>gcc pr12613.cc pr12613.cc:1: error: expected primary-expression pr12613.cc:1: error: expected `}' pr12613.cc:1: error: expected `,' or `;' pr12613.cc:1: error: expected declaration The second and third one does ICE but the 2.95.3 produced a sorry for all three (so I do not know if this counts as a regression): tin:~/src/gnu/gcctest>~/ia32_linux_gcc2_95//bin/gcc pr12613.2.cc pr12613.2.cc:1: sorry, not implemented: non-trivial labeled initializers pr12613.2.cc:1: sorry, not implemented: non-trivial labeled initializers tin:~/src/gnu/gcctest>~/ia32_linux_gcc2_95//bin/gcc pr12613.1.cc pr12613.1.cc:2: sorry, not implemented: non-trivial labeled initializers pr12613.1.cc:2: sorry, not implemented: non-trivial labeled initializers tin:~/src/gnu/gcctest>~/ia32_linux_gcc2_95//bin/gcc pr12613.cc pr12613.cc:1: sorry, not implemented: non-trivial labeled initializers *** Bug 13151 has been marked as a duplicate of this bug. *** Subject: Bug 12613 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-12-29 02:42:17 Modified files: gcc/cp : ChangeLog decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: inline6.C gcc/testsuite/g++.dg/parse: error9.C Log message: PR c++/13081 * decl.c (duplicate_decls): Preserve inline-ness when redeclaring a function template. PR c++/12613 * decl.c (reshape_init): Reject GNU colon-style designated initializers in arrays. PR c++/13081 * g++.dg/opt/inline6.C: New test. PR c++/12613 * g++.dg/parse/error9.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3837&r2=1.3838 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1168&r2=1.1169 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3315&r2=1.3316 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/inline6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error9.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 Fixed in GCC 3.4. Was fixed for 3.4. |