Bug 19312 - [3.4 Regression] ICE in stabilize_call when throwing a copy
Summary: [3.4 Regression] ICE in stabilize_call when throwing a copy
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.4
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code, monitored
: 16338 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-07 14:23 UTC by Jakub Jelinek
Modified: 2005-04-07 20:58 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.2
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2005-02-26 18:42:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2005-01-07 14:23:07 UTC
template <class T, class A>
struct C
{
  static T *foo (A x) { return new T ((T) x); }
};

class A {};

A *bar ()
{
  A a;
  return C<A, A>::foo (a);
}

ICEs on gcc-3_4-branch and on HEAD, works with GCC 3.2.3.
Comment 1 Andrew Pinski 2005-01-07 14:27:55 UTC
Confirmed here is another testcase for the same ICE:
template <class T, class A>
T *foo (A x)
{
  throw ((T) x);
}
class A {};
A *bar ()
{
  A a;
  return foo<A,A> (a);
}
Comment 2 Andrew Pinski 2005-01-08 22:50:23 UTC
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).
: Search converges between 2004-03-01-3.4 (#2) and 2004-03-15-3.4 (#3).
Comment 3 Volker Reichelt 2005-01-18 12:24:47 UTC
Further reduced testcase.

===================
struct A {};

void foo(A a)
{
    throw (A)a;
}
===================

This is similar to the testcase from PR 16338:

===================
struct A
{
    int i;
};

void foo()
{
    throw (A){0};
}
===================
Comment 4 Volker Reichelt 2005-01-18 12:26:28 UTC
*** Bug 16338 has been marked as a duplicate of this bug. ***
Comment 5 Volker Reichelt 2005-01-18 12:29:54 UTC
Copy "assigned to" from PR16338.
Comment 6 CVS Commits 2005-04-06 04:57:46 UTC
Subject: Bug 19312

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2005-04-06 04:57:39

Modified files:
	gcc/cp         : ChangeLog tree.c 
Added files:
	gcc/testsuite/g++.dg/eh: throw3.C 

Log message:
	PR c++/19312
	* tree.c (stabilize_init): Don't bother trying to stabilize
	something with no side-effects.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4690&r2=1.4691
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.429&r2=1.430
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/eh/throw3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 7 CVS Commits 2005-04-06 04:57:57 UTC
Subject: Bug 19312

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jason@gcc.gnu.org	2005-04-06 04:57:52

Modified files:
	gcc/cp         : ChangeLog tree.c 

Log message:
	PR c++/19312
	* tree.c (stabilize_init): Don't bother trying to stabilize
	something with no side-effects.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.26&r2=1.4648.2.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.427&r2=1.427.2.1

Comment 8 CVS Commits 2005-04-06 15:35:51 UTC
Subject: Bug 19312

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jason@gcc.gnu.org	2005-04-06 15:35:33

Modified files:
	gcc/cp         : ChangeLog tree.c 

Log message:
	PR c++/19312
	* tree.c (stabilize_init): Don't bother trying to stabilize
	something with no side-effects.

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.210&r2=1.3892.2.211
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.360.4.10&r2=1.360.4.11

Comment 9 Andrew Pinski 2005-04-07 20:58:00 UTC
Fixed.