Bug 27804 - [4.2 regression] ICE with invalid const variable
Summary: [4.2 regression] ICE with invalid const variable
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: Volker Reichelt
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-05-29 20:52 UTC by Volker Reichelt
Modified: 2006-06-05 00:26 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-29 20:52:53 UTC
The following invalid code causes an ICE on mainline:

=====================
bool foo()
{
    const int i = X;
    return i > 0;
}
=====================

bug.cc: In function 'bool foo()':
bug.cc:3: error: 'X' was not declared in this scope
bug.cc:4: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in ocp_convert, at cp/cvt.c:630
Please submit a full bug report, [etc.]
Comment 1 Martin Michlmayr 2006-05-31 20:35:19 UTC
This is fairly new - didn't happen with 20060508.
Comment 2 Volker Reichelt 2006-06-01 12:40:14 UTC
Testing a patch.
Comment 3 patchapp@dberlin.org 2006-06-02 09:45:18 UTC
Subject: Bug number PR c++/27804

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-06/msg00060.html
Comment 4 Mark Mitchell 2006-06-04 19:39:15 UTC
This patch is OK.
Comment 5 Volker Reichelt 2006-06-05 00:24:48 UTC
Subject: Bug 27804

Author: reichelt
Date: Mon Jun  5 00:24:41 2006
New Revision: 114377

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114377
Log:
	PR c++/27804
	* init.c (constant_value_1): Return decl instead of error_mark_node
	for invalid initializers.

	PR c++/27804
	* g++.dg/init/const4.C: New test.
	* g++.dg/init/member1.C: Add error-marker.
	* g++.dg/other/fold1.C: Adjust error-marker.

Added:
    trunk/gcc/testsuite/g++.dg/init/const4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/init/member1.C
    trunk/gcc/testsuite/g++.dg/other/fold1.C

Comment 6 Volker Reichelt 2006-06-05 00:26:04 UTC
Fixed on mainline.
Comment 7 patchapp@dberlin.org 2006-06-29 21:40:13 UTC
Subject: Bug number PR c++/27804

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-06/msg00060.html