Bug 16338

Summary: [3.4/4.0 Regression] ICE when throwing a compound literal
Product: gcc Reporter: Mattias Hultgren <mattias_hultgren>
Component: c++Assignee: Jason Merrill <jason>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gcc-bugs, jason, reichelt
Priority: P2 Keywords: ice-on-valid-code, monitored
Version: 3.4.0   
Target Milestone: 3.4.4   
Host: Target:
Build: Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0 Last reconfirmed: 2004-12-05 03:43:11
Bug Depends on:    
Bug Blocks: 16851    
Attachments: The C++ file that causes the error

Description Mattias Hultgren 2004-07-02 22:54:19 UTC
I use Slackware 10.0.0 with gcc v3.4.0

This command line
 g++ buggy.cpp

gives this error message

buggy.cpp: In function `void hello()':
buggy.cpp:41: internal compiler error: in stabilize_call, at cp/tree.c:2464

And the code in buggy.cpp can be compiled with gcc 3.3.4
Comment 1 Mattias Hultgren 2004-07-02 22:56:26 UTC
Created attachment 6677 [details]
The C++ file that causes the error
Comment 2 Andrew Pinski 2004-07-02 23:02:51 UTC
Confirmed here is a reduced testcase:
struct err_obj
{
  int error_code;
};
void hello(void) throw(err_obj)
{
  throw (err_obj) { 3};
  return;
}
Comment 3 Mark Mitchell 2004-08-01 20:51:57 UTC
Jason, this is a crash in the use of stabilize_call from the EH machinery. 
Would you mind taking a look at this?   (It's probably the use of a compound
literal that's confusing things.)
Comment 4 Andrew Pinski 2004-08-02 00:11:02 UTC
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).
Comment 5 Andrew Pinski 2004-08-02 00:14:19 UTC
This one has nothing to do with COMPOUND_EXPR but instead of CONSTRUCTOR tree.
<constructor 0x41758c20
    type <record_type 0x41793200 err_obj type_1 type_5 SI
        size <integer_cst 0x415c7ae0 constant invariant 32>
        unit size <integer_cst 0x415c7b40 constant invariant 4>
        align 32 symtab 0 alias set -1
        fields <field_decl 0x41793580 error_code type <integer_type 0x415c9700 int>
            nonlocal decl_3 SI file t1.cc line 3
            size <integer_cst 0x415c7440 constant invariant 32>
            unit size <integer_cst 0x415c74e0 constant invariant 4>
            align 32 offset_align 128
            offset <integer_cst 0x415c7be0 constant invariant 0>
            bit offset <integer_cst 0x415c7cc0 constant invariant 0> context <record_type 0x41793200 
err_obj> arguments <integer_cst 0x415c7be0 0> chain <type_decl 0x41793400 err_obj>>
        X() X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown
        pointer_to_this <pointer_type 0x41793180> chain <type_decl 0x41793300 err_obj>>
    constant invariant static tree_4
    arg 0 <tree_list 0x41795498 purpose <field_decl 0x41793580 error_code>
        value <integer_cst 0x41758be0 constant invariant 3>>>
Comment 6 CVS Commits 2004-08-02 01:56:41 UTC
Subject: Bug 16338

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-08-02 01:56:33

Modified files:
	gcc/cp         : ChangeLog call.c cp-tree.h decl.c pt.c 
	                 semantics.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/inherit: ptrmem2.C 
	gcc/testsuite/g++.dg/init: null1.C 
	gcc/testsuite/g++.dg/parse: namespace10.C 

Log message:
	PR c++/16338
	* cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): New macro.
	* call.c (null_ptr_cst_p): Handle variables with constant
	initializers.
	* pt.c (convert_nontype_argument): Use
	DECL_INTEGRAL_CONSTANT_VAR_P.
	* semantics.c (finish_id_expression): Likewise.
	
	PR c++~/16489
	* decl.c (duplicate_decls): Reject duplicate namespace
	declarations.
	
	PR c++/16810
	* typeck.c (build_ptrmemfunc): Loosen assertion.
	
	PR c++/16338
	* g++.dg/init/null1.C: New test.
	* g++.dg/tc1/dr76.C: Adjust error marker.
	
	PR c++/16489
	* g++.dg/parse/namespace10.C: New test.
	
	PR c++/16810
	* g++.dg/inherit/ptrmem2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.136&r2=1.3892.2.137
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.19&r2=1.452.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.946.4.14&r2=1.946.4.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.21&r2=1.1174.2.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.34&r2=1.816.2.35
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.381.4.11&r2=1.381.4.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.21&r2=1.519.2.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.238&r2=1.3389.2.239
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/ptrmem2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/null1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/namespace10.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 7 CVS Commits 2004-08-02 01:58:56 UTC
Subject: Bug 16338

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-08-02 01:58:52

Modified files:
	gcc/cp         : ChangeLog call.c cp-tree.h decl.c pt.c 
	                 semantics.c typeck.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/tc1: dr76.C 
Added files:
	gcc/testsuite/g++.dg/inherit: ptrmem2.C 
	gcc/testsuite/g++.dg/init: null1.C 
	gcc/testsuite/g++.dg/parse: namespace10.C 

Log message:
	PR c++/16338
	* cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): New macro.
	* call.c (null_ptr_cst_p): Handle variables with constant
	initializers.
	* pt.c (convert_nontype_argument): Use
	DECL_INTEGRAL_CONSTANT_VAR_P.
	* semantics.c (finish_id_expression): Likewise.
	
	PR c++~/16489
	* decl.c (duplicate_decls): Reject duplicate namespace
	declarations.
	
	PR c++/16810
	* typeck.c (build_ptrmemfunc): Loosen assertion.
	
	PR c++/16338
	* g++.dg/init/null1.C: New test.
	* g++.dg/tc1/dr76.C: Adjust error marker.
	
	PR c++/16489
	* g++.dg/parse/namespace10.C: New test.
	
	PR c++/16810
	* g++.dg/inherit/ptrmem2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4254&r2=1.4255
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.496&r2=1.497
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1026&r2=1.1027
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1265&r2=1.1266
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.898&r2=1.899
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.420&r2=1.421
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.565&r2=1.566
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4079&r2=1.4080
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/ptrmem2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/null1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/namespace10.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tc1/dr76.C.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 8 Giovanni Bajo 2004-08-02 11:15:51 UTC
Notice the cvs-commit is bogus (typo in PR number)
Comment 9 Mark Mitchell 2004-08-17 21:09:49 UTC
Jason, this is another problem with stabilize_init and friends so I've assigned
this to you.
Comment 10 Mark Mitchell 2004-08-29 18:11:57 UTC
Postponed until GCC 3.4.3.
Comment 11 Mark Mitchell 2004-08-29 18:14:43 UTC
Postponed until GCC 3.4.3.
Comment 12 Mark Mitchell 2004-11-01 00:45:30 UTC
Postponed until GCC 3.4.4.
Comment 13 Volker Reichelt 2005-01-18 12:26:22 UTC
Marking this as a duplicate of PR19312, since
the audit trail here got a bit confusing.

*** This bug has been marked as a duplicate of 19312 ***