Bug 27384 - [4.0/4.1/4.2 regression] ICE with invalid array size
Summary: [4.0/4.1/4.2 regression] ICE with invalid array size
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.0.4
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-05-02 11:53 UTC by Volker Reichelt
Modified: 2006-05-11 15:17 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-02 11:53:02 UTC
The following invalid code snippet causes an ICE since GCC 4.0.3:

===================================
struct A
{
    static const int i = j;
    int x[i];
};
===================================

bug.cc:3: error: 'j' was not declared in this scope
bug.cc:4: internal compiler error: in size_binop, at fold-const.c:1736
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-05-02 15:31:24 UTC
Confirmed.
Comment 2 Volker Reichelt 2006-05-10 16:55:48 UTC
Testing a patch.
Comment 3 patchapp@dberlin.org 2006-05-11 07:15:07 UTC
Subject: Bug number PR27384

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00443.html
Comment 4 Volker Reichelt 2006-05-11 15:08:01 UTC
Subject: Bug 27384

Author: reichelt
Date: Thu May 11 15:07:45 2006
New Revision: 113701

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113701
Log:
	PR middle-end/27384
	* fold-const.c (size_binop): Move sanity check for arguments to
	the beginning of the function.

	* g++.dg/other/fold1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/other/fold1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Volker Reichelt 2006-05-11 15:12:00 UTC
Subject: Bug 27384

Author: reichelt
Date: Thu May 11 15:11:50 2006
New Revision: 113702

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113702
Log:
	PR middle-end/27384
	* fold-const.c (size_binop): Move sanity check for arguments to
	the beginning of the function.

	* g++.dg/other/fold1.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/fold1.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/fold-const.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 6 Volker Reichelt 2006-05-11 15:17:18 UTC
Subject: Bug 27384

Author: reichelt
Date: Thu May 11 15:16:49 2006
New Revision: 113703

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113703
Log:
	PR middle-end/27384
	* fold-const.c (size_binop): Move sanity check for arguments to
	the beginning of the function.

	* g++.dg/other/fold1.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/fold1.C
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/fold-const.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 7 Volker Reichelt 2006-05-11 15:17:56 UTC
Fixed on mainline, 4.1 branch, and 4.0 branch.
Comment 8 patchapp@dberlin.org 2006-05-15 19:40:03 UTC
Subject: Bug number PR27384

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00443.html