Bug 28593 - [4.0/4.1/4.2 regression] ICE on invalid operator new
Summary: [4.0/4.1/4.2 regression] ICE on invalid operator new
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P4 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, patch
Depends on:
Blocks: 29291
  Show dependency treegraph
 
Reported: 2006-08-04 00:39 UTC by Volker Reichelt
Modified: 2006-08-16 21:47 UTC (History)
1 user (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-08-04 00:39:45 UTC
The following invalid code snippet triggers an ICE since GCC 4.0.0:

=========================
void *p = new (::X;
=========================

bug.cc:1: error: '::X' has not been declared
bug.cc:1: error: expected type-specifier before ';' token
bug.cc:1: internal compiler error: tree check: expected tree_list, have error_mark in resolve_args, at cp/call.c:2710
Please submit a full bug report, [etc.]

Testing a patch.
Comment 1 patchapp@dberlin.org 2006-08-04 08:20:17 UTC
Subject: Bug number PR c++/28593

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-08/msg00087.html
Comment 2 Volker Reichelt 2006-08-16 21:35:25 UTC
Subject: Bug 28593

Author: reichelt
Date: Wed Aug 16 21:35:18 2006
New Revision: 116191

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116191
Log:
	PR c++/28593
	* init.c (build_new): Return early on invalid placement.

	* g++.dg/parse/new3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/new3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Volker Reichelt 2006-08-16 21:42:00 UTC
Subject: Bug 28593

Author: reichelt
Date: Wed Aug 16 21:41:52 2006
New Revision: 116192

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116192
Log:
	PR c++/28593
	* init.c (build_new): Return early on invalid placement.

	* g++.dg/parse/new3.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/new3.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/init.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 4 Volker Reichelt 2006-08-16 21:46:09 UTC
Subject: Bug 28593

Author: reichelt
Date: Wed Aug 16 21:46:01 2006
New Revision: 116193

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116193
Log:
	PR c++/28593
	* init.c (build_new): Return early on invalid placement.

	* g++.dg/parse/new3.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/parse/new3.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/init.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 5 Volker Reichelt 2006-08-16 21:47:35 UTC
Fixed on mainline, 4.1 branch, and 4.0 branch.