Bug 11878 - [3.3/3.4 regression] ICE in cp_expr_size
Summary: [3.3/3.4 regression] ICE in cp_expr_size
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P1 normal
Target Milestone: 3.3.2
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2003-08-11 08:01 UTC by Ivan Godard
Modified: 2004-01-17 04:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-08-15 16:50:40


Attachments
Compiler output (-v -save-temps) (809 bytes, text/plain)
2003-08-11 08:04 UTC, Ivan Godard
Details
Source code (95.11 KB, application/x-gzip-compressed)
2003-08-11 08:05 UTC, Ivan Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2003-08-11 08:01:14 UTC
 
Comment 1 Ivan Godard 2003-08-11 08:04:47 UTC
Created attachment 4588 [details]
Compiler output (-v -save-temps)
Comment 2 Ivan Godard 2003-08-11 08:05:19 UTC
Created attachment 4589 [details]
Source code
Comment 3 Andrew Pinski 2003-08-11 11:48:53 UTC
The ICE does not happen on the mainline.
Comment 4 Volker Reichelt 2003-08-15 16:50:39 UTC
Reduced testcase:

============================================
struct A
{
    virtual ~A();
};

template<typename T> struct B
{
    T t;
};

void foo() { throw B<A>().t; }
============================================

It crashes 3.3 branch and mainline:

PR11878.cc: In function `void foo()':
PR11878.cc:11: internal compiler error: in cp_expr_size, at cp/cp-lang.c:330
Please submit a full bug report,

but compiles fine with gcc 2.95.x - 3.2.3. Thus, we have a regression.

Phils' regression tester says:
Search converges between 2002-07-28-trunk (#83) and 2002-08-04-trunk (#84).
Comment 5 Andrew Pinski 2003-08-17 03:11:38 UTC
Most likely caused by:
revision 1.38
date: 2002/08/02 11:57:21;  author: jason;  state: Exp;  lines: +28 -0
        * langhooks-def.h (LANG_HOOKS_EXPR_SIZE): New macro.
        * langhooks.c (lhd_expr_size): Define default.
        * langhooks.h (struct lang_hooks): Add expr_size.
        * explow.c (expr_size): Call it.
        * expr.c (store_expr): Don't copy an expression of size zero.
        (expand_expr) [CONSTRUCTOR]: Use expr_size to calculate how much
        to store.
        * Makefile.in (builtins.o): Depend on langhooks.h.

        * cp-lang.c (LANG_HOOKS_EXPR_SIZE): Define.
        (cp_expr_size): New fn.
        * call.c (build_over_call): Lose empty class hackery.
        (convert_arg_to_ellipsis): Promote non-POD warning to error.
        * typeck.c (build_modify_expr): Don't use save_expr on an lvalue.
Comment 6 janis187 2003-08-29 00:14:24 UTC
I can confirm that the patch listed in comment #5 introduced or exposed
the regression in PR 11878.  The testing of compilers just before and          
just after the patch was added was done on i686-pc-linux-gnu using             
Wolfgang's reduced test case from comment #4.
Comment 7 CVS Commits 2003-10-14 20:45:49 UTC
Subject: Bug 11878

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	jason@gcc.gnu.org	2003-10-14 20:45:42

Modified files:
	gcc/cp         : ChangeLog tree.c typeck.c 

Log message:
	PR c++/11878
	* tree.c (build_target_expr_with_type): Call force_rvalue for
	classes with non-trivial copy ctors.
	
	PR c++/11063
	* typeck.c (build_modify_expr): Call convert rather than abort.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.214&r2=1.3076.2.215
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.307.2.4&r2=1.307.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.436.2.17&r2=1.436.2.18

Comment 8 CVS Commits 2003-10-14 20:46:31 UTC
Subject: Bug 11878

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2003-10-14 20:46:27

Modified files:
	gcc/cp         : ChangeLog tree.c typeck.c 

Log message:
	PR c++/11878
	* tree.c (build_target_expr_with_type): Call force_rvalue for
	classes with non-trivial copy ctors.
	
	PR c++/11063
	* typeck.c (build_modify_expr): Call convert rather than abort.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3729&r2=1.3730
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.350&r2=1.351
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.506&r2=1.507

Comment 9 CVS Commits 2003-10-14 20:47:11 UTC
Subject: Bug 11878

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2003-10-14 20:47:07

Added files:
	gcc/testsuite/g++.dg/init: copy6.C 

Log message:
	PR c++/11878
	* tree.c (build_target_expr_with_type): Call force_rvalue for
	classes with non-trivial copy ctors.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/copy6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 10 Andrew Pinski 2003-10-14 20:50:21 UTC
Fixed for 3.3.2 and 3.4.