Bug 42059 - [4.4/4.5 Regression] [c++0x] ICE with initializer list for VLA
Summary: [4.4/4.5 Regression] [c++0x] ICE with initializer list for VLA
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.4.3
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks: C++VLA
  Show dependency treegraph
 
Reported: 2009-11-15 21:45 UTC by Volker Reichelt
Modified: 2016-03-04 04:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc45-pr42059.patch (581 bytes, patch)
2009-11-16 13:49 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2009-11-15 21:45:23 UTC
The following invalid testcase triggers an ICE since GCC 4.4.1:

==================
void foo(int i)
{
  int a[i];
  a = {};
}
==================

bug.cc: In function 'void foo(int)':
bug.cc:4:8: internal compiler error: tree check: expected integer_cst, have nop_expr in process_init_constructor_array, at cp/typeck2.c:912
Please submit a full bug report, [etc.]
Comment 1 Jakub Jelinek 2009-11-16 13:49:13 UTC
Created attachment 19020 [details]
gcc45-pr42059.patch

Caused by PR40689.  Here is an untested fix.
Comment 2 Jakub Jelinek 2009-11-17 06:59:30 UTC
Subject: Bug 42059

Author: jakub
Date: Tue Nov 17 06:59:13 2009
New Revision: 154237

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154237
Log:
	PR c++/42059
	* typeck.c (cp_build_modify_expr): For initializer list call
	check_array_initializer to make sure lhs isn't a VLA.

	* g++.dg/cpp0x/initlist26.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/initlist26.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Jakub Jelinek 2009-11-17 07:22:00 UTC
Subject: Bug 42059

Author: jakub
Date: Tue Nov 17 07:21:43 2009
New Revision: 154239

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154239
Log:
	PR c++/42059
	* typeck.c (cp_build_modify_expr): For initializer list call
	check_array_initializer to make sure lhs isn't a VLA.

	* g++.dg/cpp0x/initlist26.C: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/initlist26.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/typeck.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2009-11-17 07:39:50 UTC
Fixed.