Bug 27270 - [4.1 Regression] ICE in process_init_constructor_array, at cp/typeck2.c:788
Summary: [4.1 Regression] ICE in process_init_constructor_array, at cp/typeck2.c:788
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.2.0
Assignee: Mark Mitchell
URL:
Keywords: ice-on-invalid-code, monitored
: 28248 (view as bug list)
Depends on:
Blocks: 28255
  Show dependency treegraph
 
Reported: 2006-04-23 14:49 UTC by Tim Janik
Modified: 2008-07-04 15:28 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.3 4.2.0
Known to fail: 4.1.0 4.1.3
Last reconfirmed: 2006-10-15 05:33:42


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Janik 2006-04-23 14:49:26 UTC
with a recent gcc snapshot on i386:
  c++ (GCC) 4.2.0 20060325 (experimental)
the following tst program program:

template<typename Entry>                                                                                                                                      
struct Array {                                                                                                                                                
  Entry *array[32];                                                                                                                                           
  Array () :                                                                                                                                                  
    array ( (Entry*[1]) { 0, 0 } )                                                                                                                            
  {}                                                                                                                                                          
};                                                                                                                                                            
Array<void*> a;

compiled with:
  c++ -Wall arrayinit.cc
produces:
arrayinit.cc: In constructor 'Array<Entry>::Array() [with Entry = void*]':
arrayinit.cc:8:   instantiated from here
arrayinit.cc:5: internal compiler error: in process_init_constructor_array, at cp/typeck2.c:788
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Richard Biener 2006-04-23 15:47:41 UTC
Confirmed.  We hit

#1  0x080b0ffc in digest_init (type=<value optimized out>, init=0xb7da6ed0)
    at /space/rguenther/src/svn/gcc/gcc/cp/typeck2.c:788
788         gcc_assert (VEC_length (constructor_elt, v) <= len);

Also happens on the 4.1 branch.  4.0.3 tells us

y.c: In constructor 'Array<Entry>::Array() [with Entry = void*]':
y.c:8:   instantiated from here
y.c:5: error: excess elements in aggregate initializer
y.c:5: error: conversion from 'void** [1]' to non-scalar type 'void** [32]' requested
Comment 2 Mark Mitchell 2006-05-25 02:34:38 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 3 Janis Johnson 2006-08-12 21:36:02 UTC
A regression hunt on powerpc-linux identified the following patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=102182

    r102182 | giovannibajo | 2005-07-20 01:19:59 +0000 (Wed, 20 Jul 2005)
Comment 4 Mark Mitchell 2006-10-17 02:01:43 UTC
Subject: Bug 27270

Author: mmitchel
Date: Tue Oct 17 02:01:27 2006
New Revision: 117814

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117814
Log:
	PR c++/27270
	* typeck2.c (process_init_constructor_array): Reword comment.
	* pt.c (tsubst_copy_and_built): Call reshape_init before calling
	digest_init.
	PR c++/27270
	* g++.dg/ext/complit8.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/complit8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Mark Mitchell 2006-10-17 02:04:51 UTC
Fixed in 4.2.0.
Comment 6 Mark Shinwell 2006-10-17 17:30:00 UTC
*** Bug 28248 has been marked as a duplicate of this bug. ***
Comment 7 Mark Mitchell 2006-10-17 22:25:45 UTC
Subject: Bug 27270

Author: mmitchel
Date: Tue Oct 17 22:25:35 2006
New Revision: 117832

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117832
Log:
	PR c++/27270
	* decl.c (reshape_init_class): Move check for designated
	to ...
	* parser.c (cp_parser_initializer_list): ... here.
	* pt.c (tsubst_copy_and_build): Use finish_compound_literal.
	PR c++/27270
	* g++.dg/ext/complit8.C: Tweak error markers.
	* g++.dg/template/complit1.C: Add error marker.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/complit8.C
    trunk/gcc/testsuite/g++.dg/template/complit1.C

Comment 8 Joseph S. Myers 2008-07-04 15:28:43 UTC
Closing 4.1 branch.