Bug 27385 - [4.1/4.2 regression] ICE with invalid array initializer
Summary: [4.1/4.2 regression] ICE with invalid array initializer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.1.2
Assignee: Mark Mitchell
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-05-02 12:07 UTC by Volker Reichelt
Modified: 2006-05-31 20:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-02 15:26:17


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-02 12:07:36 UTC
The following invalid code snippet causes an ICE since GCC 4.1.0
(and in GCC 3.3, 3.3.1, 3.3.2):

========================
struct A {};

A a[] = { 0 };
========================

The compiler loops forever until it runs out of memory:
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
bug.cc:3: error: initializer for 'A' must be brace-enclosed
[etc.]
Comment 1 Andrew Pinski 2006-05-02 15:26:16 UTC
Confirmed.
Comment 2 Mark Mitchell 2006-05-25 02:34:44 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 3 Mark Mitchell 2006-05-31 20:03:24 UTC
Subject: Bug 27385

Author: mmitchel
Date: Wed May 31 20:03:12 2006
New Revision: 114278

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114278
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/init/array20.C
    trunk/gcc/testsuite/g++.dg/template/cond6.C
    trunk/gcc/testsuite/g++.dg/template/crash51.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.old-deja/g++.mike/net36.C

Comment 4 Mark Mitchell 2006-05-31 20:03:45 UTC
Subject: Bug 27385

Author: mmitchel
Date: Wed May 31 20:03:27 2006
New Revision: 114279

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114279
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/init/array20.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/cond6.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash51.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/call.c
    branches/gcc-4_1-branch/gcc/cp/decl.c
    branches/gcc-4_1-branch/gcc/cp/init.c
    branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.mike/net36.C

Comment 5 Mark Mitchell 2006-05-31 20:08:46 UTC
Subject: Bug 27385

Author: mmitchel
Date: Wed May 31 20:07:35 2006
New Revision: 114280

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114280
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 6 Mark Mitchell 2006-05-31 20:12:49 UTC
Fixed in 4.1.2, 4.2.0.