Bug 28267 - [4.0/4.1/4.2 regression] ICE on invalid default variable in operator new
Summary: [4.0/4.1/4.2 regression] ICE on invalid default variable in operator new
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 normal
Target Milestone: 4.0.4
Assignee: Volker Reichelt
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-07-05 12:22 UTC by Volker Reichelt
Modified: 2006-08-03 12:06 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-07-05 12:22:36 UTC
The following invalid code snippet triggers a segfault since GCC 4.0.0:

============================================================
struct A
{
  void* operator new(__SIZE_TYPE__, int = X);
  void operator delete(void*, int);

  A();
};

void foo()
{
  new A;
}
============================================================

bug.cc:3: error: 'X' was not declared in this scope
bug.cc: In function 'void foo()':
bug.cc:11: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]

Maybe related to PR 28266.
Comment 1 Volker Reichelt 2006-08-01 23:45:31 UTC
Subject: Bug 28267

Author: reichelt
Date: Tue Aug  1 23:45:11 2006
New Revision: 115866

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115866
Log:
	PR c++/28250
	PR c++/28257
	PR c++/28259
	PR c++/28267
	* toplev.c (compile_file): Return early on errorcount or sorrycount.
	* cgraphunit.c (cgraph_finalize_compilation_unit): Likewise.
	(cgraph_optimize): Likewise.

	PR c++/28250
	* g++.dg/eh/catch4.C: New test.

	PR c++/28257
	* g++.dg/other/qual1.C: New test.

	PR c++/28259
	* g++.dg/inherit/error2.C: New test.

	PR c++/28267
	* g++.dg/other/new1.C: New test.

	* g++.dg/warn/pr23075.C: Remove obsolete test.
	* g++.old-deja/g++.brendan/crash52.C: Remove dg-warning marker.
	* g++.old-deja/g++.jason/report.C: Remove dg-warning marker.

Added:
    trunk/gcc/testsuite/g++.dg/eh/catch4.C
    trunk/gcc/testsuite/g++.dg/inherit/error2.C
    trunk/gcc/testsuite/g++.dg/other/new1.C
    trunk/gcc/testsuite/g++.dg/other/qual1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/warn/pr23075.C
    trunk/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
    trunk/gcc/testsuite/g++.old-deja/g++.jason/report.C
    trunk/gcc/toplev.c

Comment 2 Volker Reichelt 2006-08-01 23:51:24 UTC
Fixed on mainline.
Comment 3 Volker Reichelt 2006-08-03 11:34:08 UTC
Subject: Bug 28267

Author: reichelt
Date: Thu Aug  3 11:33:49 2006
New Revision: 115900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115900
Log:
	PR c++/28257
	PR c++/28259
	PR c++/28267
	* toplev.c (compile_file): Return early on errorcount or sorrycount.
	* cgraphunit.c (cgraph_finalize_compilation_unit): Likewise.
	(cgraph_optimize): Likewise.

	PR c++/28250
	* g++.dg/eh/catch4.C: New test.

	PR c++/28257
	* g++.dg/other/qual1.C: New test.

	PR c++/28259
	* g++.dg/inherit/error2.C: New test.

	PR c++/28267
	* g++.dg/other/new1.C: New test.

	* g++.dg/warn/pr23075.C: Remove obsolete test.
	* g++.old-deja/g++.brendan/crash52.C: Remove dg-warning marker.
	* g++.old-deja/g++.jason/report.C: Remove dg-warning marker.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/eh/catch4.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/inherit/error2.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/new1.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/qual1.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/cgraphunit.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/warn/pr23075.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.jason/report.C
    branches/gcc-4_1-branch/gcc/toplev.c

Comment 4 Volker Reichelt 2006-08-03 11:36:15 UTC
Subject: Bug 28267

Author: reichelt
Date: Thu Aug  3 11:35:52 2006
New Revision: 115901

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115901
Log:
	PR c++/28257
	PR c++/28259
	PR c++/28267
	* toplev.c (compile_file): Return early on errorcount or sorrycount.
	* cgraphunit.c (cgraph_finalize_compilation_unit): Likewise.
	(cgraph_optimize): Likewise.

	PR c++/28250
	* g++.dg/eh/catch4.C: New test.

	PR c++/28257
	* g++.dg/other/qual1.C: New test.

	PR c++/28259
	* g++.dg/inherit/error2.C: New test.

	PR c++/28267
	* g++.dg/other/new1.C: New test.

	* g++.dg/warn/pr23075.C: Remove obsolete test.
	* g++.old-deja/g++.brendan/crash52.C: Remove dg-warning marker.
	* g++.old-deja/g++.jason/report.C: Remove dg-warning marker.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/eh/catch4.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/error2.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/new1.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/qual1.C
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/cgraphunit.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/warn/pr23075.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.old-deja/g++.jason/report.C
    branches/gcc-4_0-branch/gcc/toplev.c

Comment 5 Volker Reichelt 2006-08-03 12:05:42 UTC
Now also fixed on 4.1 branch and 4.0 branch.