public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught
@ 2004-01-31 12:02 debian-gcc at lists dot debian dot org
  2004-02-02  2:10 ` [Bug c++/13944] [3.3/3.4/3.5] " giovannibajo at libero dot it
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2004-01-31 12:02 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/228099]

Running the following code compiled with 'g++ 3.3.3 testex.cc' results in a
SIGABRT. The bug submitter sees no reason why this should happen. With g++ 3.2.3
it works, i.e. the exception 1 in A() is caught by the try-block.


# 1 "testex.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "testex.cc"
class A
{
    public:
        A() {throw(1);}
};

int main(int argc, char *argv)
{
    try
    {
        throw A();
    }
    catch(...)
    {
    }
}

gcc-3.4 (CVS 20040113) and 3.5 (CVS 20040113 tree-ssa) are more verbose:

$ g++-3.4 bug-228099.cc && ./a.out 
terminate called after throwing an instance of 'i'
Aborted

$ g++-3.5 bug-228099.cc && ./a.out 
terminate called without an active exception
Aborted

-- 
           Summary: exception in constructor of a class to be thrown is not
                    caught
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
@ 2004-02-02  2:10 ` giovannibajo at libero dot it
  2004-02-02  7:43 ` pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-02  2:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-02 02:10 -------
I think I'll confirm it because EDG and MSVC71 have the same behaviour of GCC 
3.2.3, but I can't see wording in the standard which speaks about what should 
happen in this case.

Maybe this could be a defect report.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 3.4.0 3.5.0
      Known to work|                            |3.2.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-02 02:10:29
               date|                            |
            Summary|exception in constructor of |[3.3/3.4/3.5] exception in
                   |a class to be thrown is not |constructor of a class to be
                   |caught                      |thrown is not caught


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
  2004-02-02  2:10 ` [Bug c++/13944] [3.3/3.4/3.5] " giovannibajo at libero dot it
@ 2004-02-02  7:43 ` pinskia at gcc dot gnu dot org
  2004-02-02 23:18 ` bangerth at dealii dot org
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-02  7:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.3.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
  2004-02-02  2:10 ` [Bug c++/13944] [3.3/3.4/3.5] " giovannibajo at libero dot it
  2004-02-02  7:43 ` pinskia at gcc dot gnu dot org
@ 2004-02-02 23:18 ` bangerth at dealii dot org
  2004-02-15 12:43 ` gdr at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: bangerth at dealii dot org @ 2004-02-02 23:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-02 23:18 -------
I think I remember that there is a duplicate of this and that it 
was stated that it is up to the implementation what it does in 
this case: the problem is throwing while generating the argument 
to a throw-statement. It may have been something in the ABI 
document, rather than the standard that said this. I think 
the result of that PR was that this is conforming with the standards. 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2004-02-02 23:18 ` bangerth at dealii dot org
@ 2004-02-15 12:43 ` gdr at gcc dot gnu dot org
  2004-02-16  3:07 ` mmitchel at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-02-15 12:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-02-15 12:43 -------
Adjust milestone

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.3.3                       |3.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2004-02-15 12:43 ` gdr at gcc dot gnu dot org
@ 2004-02-16  3:07 ` mmitchel at gcc dot gnu dot org
  2004-02-16  4:09 ` [Bug c++/13944] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-16  3:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-16 03:07 -------
I do not believe there is any ambiguity in the standard here.

This program should clearly through an exception of type "int" with the value
"1", and that exception should be caught in "main".

The problem here is that we have gotten too clever in build_throw; we try to
construct the object of type "A" directly into the exception object that will be
thrown.  That eliminates the separation between the evaluation of the operand
and the construction of the temporary that is required by the standard.  The
standard allows us to eliminate the temporary only if that does not change the
meaning of the program other than by changing what constructors/destructors are
called; in this case, it changes whether or not "terminate" is called.

The changes in build_throw are an attempt at an optimization, but that
optimization is not valid unless we can prove that no exceptions will be thrown.
 Optimizing this case doesn't seem very important to me, given that exceptions
are already assumed to be off the fast path.

Jason, you seem to have been the one who introduced the optimization.  

Would you please revert your changes, or, alternatively rebut my claims above?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com
         AssignedTo|unassigned at gcc dot gnu   |jason at redhat dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2004-02-16  3:07 ` mmitchel at gcc dot gnu dot org
@ 2004-02-16  4:09 ` pinskia at gcc dot gnu dot org
  2004-02-16 18:22 ` jason at redhat dot com
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-16  4:09 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal
            Summary|[3.3/3.4/3.5] exception in  |[3.3/3.4/3.5 Regression]
                   |constructor of a class to be|exception in constructor of
                   |thrown is not caught        |a class to be thrown is not
                   |                            |caught


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (5 preceding siblings ...)
  2004-02-16  4:09 ` [Bug c++/13944] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-16 18:22 ` jason at redhat dot com
  2004-02-16 18:27 ` jason at redhat dot com
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jason at redhat dot com @ 2004-02-16 18:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-02-16 18:22 -------
Subject: Re:  [3.3/3.4/3.5] exception in constructor of a
 class to be thrown is not caught

EDG performs this same optimization, but they seem to have made a different
choice as to whether or not the call which creates the object should be
allowed to throw; it seems impossible to construct a testcase which will
terminate due to a throw during the initialization of the exception object.
Their choice, which the submitter of this bug also expects, seems
reasonable to me.

Jason


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (6 preceding siblings ...)
  2004-02-16 18:22 ` jason at redhat dot com
@ 2004-02-16 18:27 ` jason at redhat dot com
  2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jason at redhat dot com @ 2004-02-16 18:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-02-16 18:27 -------
Subject: Re:  [3.3/3.4/3.5] exception in constructor of a
 class to be thrown is not caught

Actually, this testcase does terminate under EDG:

  struct A
  {
    A() { }
    A(const A&) { throw 1; }
  };

  int main()
  {
    A a;

    try
     {
       throw a;
     }
    catch(...)
     {
     }
  }

To match this behavior, we need to treat cases where we elide the copy
constructor differently, as discussed in my comment in build_throw.

Jason


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (8 preceding siblings ...)
  2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
  2004-02-24 19:57 ` gdr at integrable-solutions dot net
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-24 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-24 18:30 -------
Subject: Bug 13944

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	jason@gcc.gnu.org	2004-02-24 18:30:20

Modified files:
	gcc/cp         : ChangeLog.tree-ssa except.c tree.c 

Log message:
	PR c++/13944
	* except.c (do_free_exception): Remove #if 0 wrapper.
	(build_throw): Use it if we elide a copy into the exception object.
	
	* tree.c (stabilize_call): Fix thinko.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.72&r2=1.1.2.73
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/except.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.142.2.18&r2=1.142.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.286.2.43&r2=1.286.2.44



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (7 preceding siblings ...)
  2004-02-16 18:27 ` jason at redhat dot com
@ 2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
  2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-24 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-24 18:30 -------
Subject: Bug 13944

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jason@gcc.gnu.org	2004-02-24 18:30:47

Added files:
	gcc/testsuite/g++.dg/eh: elide1.C elide2.C 

Log message:
	PR c++/13944
	* except.c (do_free_exception): Remove #if 0 wrapper.
	(build_throw): Use it if we elide a copy into the exception object.

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



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (9 preceding siblings ...)
  2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-24 19:57 ` gdr at integrable-solutions dot net
  2004-03-02 11:10 ` [Bug c++/13944] [3.3/3.4 " steven at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-02-24 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-02-24 19:57 -------
Subject: Re:  [3.3/3.4/3.5 Regression] exception in constructor of a class to be thrown is not caught

"jason at redhat dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| To match this behavior, we need to treat cases where we elide the copy
| constructor differently, as discussed in my comment in build_throw.

Jason,

  Can we have this patch on gcc-3_3-branch too?

Thanks,

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (10 preceding siblings ...)
  2004-02-24 19:57 ` gdr at integrable-solutions dot net
@ 2004-03-02 11:10 ` steven at gcc dot gnu dot org
  2004-03-02 17:17 ` jason at redhat dot com
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-02 11:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-03-02 11:10 -------
Jason, what about gcc 3.4, can the patch be applied there, too? 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (11 preceding siblings ...)
  2004-03-02 11:10 ` [Bug c++/13944] [3.3/3.4 " steven at gcc dot gnu dot org
@ 2004-03-02 17:17 ` jason at redhat dot com
  2004-03-02 19:57 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jason at redhat dot com @ 2004-03-02 17:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-03-02 17:17 -------
Subject: Re:  [3.3/3.4 Regression] exception in constructor
 of a class to be thrown is not caught

On 2 Mar 2004 11:10:38 -0000, "steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> ------- Additional Comments From steven at gcc dot gnu dot org  2004-03-02 11:10 -------
> Jason, what about gcc 3.4, can the patch be applied there, too? 

I'm working on a patch for 3.4.

Jason


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3/3.4 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (12 preceding siblings ...)
  2004-03-02 17:17 ` jason at redhat dot com
@ 2004-03-02 19:57 ` cvs-commit at gcc dot gnu dot org
  2004-03-02 20:30 ` [Bug c++/13944] [3.3 " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-02 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-02 19:57 -------
Subject: Bug 13944

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jason@gcc.gnu.org	2004-03-02 19:57:10

Modified files:
	gcc/cp         : ChangeLog call.c cp-tree.h except.c init.c 
	                 tree.c typeck.c 
	gcc/testsuite/g++.old-deja/g++.ext: arrnew2.C 
	gcc/testsuite/g++.old-deja/g++.martin: new1.C 
	gcc/testsuite/g++.old-deja/g++.robertl: eb58.C eb63.C 

Log message:
	PR c++/13944
	* except.c (do_free_exception): Remove #if 0 wrapper.
	(build_throw): Use it if we elide a copy into the
	exception object.
	
	* tree.c (stabilize_call): Fix thinko.
	
	* init.c (build_new_1): Preevaluate initializer.  Simplify EH code.
	(build_init): Call a constructor rather than call build_aggr_init
	for classes.
	* except.c (stabilize_throw_expr): Remove.
	(build_throw): Use stabilize_init instead of stabilize_throw_expr.
	* tree.c (stabilize_call, stabilize_init): New fns.
	* call.c (build_over_call): A constructor no longer returns the
	address of the object.

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.69&r2=1.3892.2.70
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.8&r2=1.452.2.9
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.6&r2=1.946.4.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.164.4.2&r2=1.164.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.356.2.5&r2=1.356.2.6
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.2&r2=1.360.4.3
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.8&r2=1.519.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.4&r2=1.4.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.martin/new1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.4&r2=1.4.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb58.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.6&r2=1.6.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb63.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.6&r2=1.6.16.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (13 preceding siblings ...)
  2004-03-02 19:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-02 20:30 ` pinskia at gcc dot gnu dot org
  2004-03-02 20:44 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-02 20:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-02 20:30 -------
Only a 3.3 regression now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.2.3 3.5.0                 |3.2.3 3.5.0 3.4.0
            Summary|[3.3/3.4 Regression]        |[3.3 Regression] exception
                   |exception in constructor of |in constructor of a class to
                   |a class to be thrown is not |be thrown is not caught
                   |caught                      |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (14 preceding siblings ...)
  2004-03-02 20:30 ` [Bug c++/13944] [3.3 " pinskia at gcc dot gnu dot org
@ 2004-03-02 20:44 ` gdr at integrable-solutions dot net
  2004-03-02 20:54 ` jason at redhat dot com
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-03-02 20:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-03-02 20:44 -------
Subject: Re:  [3.3 Regression] exception in constructor of a class to be thrown is not caught

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Only a 3.3 regression now.

Jason,

  Do you think, the patch can be backported to gcc-3_3-branch?  It
seems to be a  patch chasing party...  

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (15 preceding siblings ...)
  2004-03-02 20:44 ` gdr at integrable-solutions dot net
@ 2004-03-02 20:54 ` jason at redhat dot com
  2004-03-02 21:06 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jason at redhat dot com @ 2004-03-02 20:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-03-02 20:54 -------
Subject: Re:  [3.3 Regression] exception in constructor of a
 class to be thrown is not caught

On 2 Mar 2004 20:44:22 -0000, "gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org> wrote:

>   Do you think, the patch can be backported to gcc-3_3-branch?  It
> seems to be a  patch chasing party...  

Here's the backport; I'm testing it now.

*** except.c.~1~	2004-03-01 16:25:03.000000000 -0500
--- except.c	2004-03-02 14:57:22.000000000 -0500
*************** do_allocate_exception (type)
*** 511,519 ****
  					     NULL_TREE));
  }
  
! #if 0
! /* Call __cxa_free_exception from a cleanup.  This is never invoked
!    directly, but see the comment for stabilize_throw_expr.  */
  
  static tree
  do_free_exception (ptr)
--- 511,517 ----
  					     NULL_TREE));
  }
  
! /* Call __cxa_free_exception from a cleanup.  */
  
  static tree
  do_free_exception (ptr)
*************** do_free_exception (ptr)
*** 533,539 ****
  
    return build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE));
  }
- #endif
  
  /* Wrap all cleanups for TARGET_EXPRs in MUST_NOT_THROW_EXPR.
     Called from build_throw via walk_tree_without_duplicates.  */
--- 531,536 ----
*************** build_throw (exp)
*** 669,674 ****
--- 666,672 ----
        tree object, ptr;
        tree tmp;
        tree temp_expr, allocate_expr;
+       bool elided;
  
        fn = get_identifier ("__cxa_throw");
        if (IDENTIFIER_GLOBAL_VALUE (fn))
*************** build_throw (exp)
*** 723,728 ****
--- 721,728 ----
        object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr);
        object = build_indirect_ref (object, NULL);
  
+       elided = (TREE_CODE (exp) == TARGET_EXPR);
+ 
        /* And initialize the exception object.  */
        exp = build_init (object, exp, LOOKUP_ONLYCONVERTING);
        if (exp == error_mark_node)
*************** build_throw (exp)
*** 731,737 ****
  	  return error_mark_node;
  	}
  
!       exp = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (exp), exp);
        /* Prepend the allocation.  */
        exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
        if (temp_expr != void_zero_node)
--- 731,741 ----
  	  return error_mark_node;
  	}
  
!       if (elided)
! 	exp = build (TRY_CATCH_EXPR, void_type_node, exp,
! 		     do_free_exception (ptr));
!       else
! 	exp = build1 (MUST_NOT_THROW_EXPR, void_type_node, exp);
        /* Prepend the allocation.  */
        exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
        if (temp_expr != void_zero_node)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (16 preceding siblings ...)
  2004-03-02 20:54 ` jason at redhat dot com
@ 2004-03-02 21:06 ` gdr at integrable-solutions dot net
  2004-03-03  7:40 ` cvs-commit at gcc dot gnu dot org
  2004-03-03 16:28 ` pinskia at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-03-02 21:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-03-02 21:06 -------
Subject: Re:  [3.3 Regression] exception in constructor of a class to be thrown is not caught

"jason at redhat dot com" <gcc-bugzilla@gcc.gnu.org> writes:


| Subject: Re:  [3.3 Regression] exception in constructor of a
|  class to be thrown is not caught
| 
| On 2 Mar 2004 20:44:22 -0000, "gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org> wrote:
| 
| >   Do you think, the patch can be backported to gcc-3_3-branch?  It
| > seems to be a  patch chasing party...  
| 
| Here's the backport; I'm testing it now.


ah so, it is that easy?  Thanks!

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (17 preceding siblings ...)
  2004-03-02 21:06 ` gdr at integrable-solutions dot net
@ 2004-03-03  7:40 ` cvs-commit at gcc dot gnu dot org
  2004-03-03 16:28 ` pinskia at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-03  7:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-03 07:40 -------
Subject: Bug 13944

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	jason@gcc.gnu.org	2004-03-03 07:40:31

Modified files:
	gcc/cp         : ChangeLog except.c 

Log message:
	PR c++/13944
	* except.c (do_free_exception): Remove #if 0 wrapper.
	(build_throw): Use it if we elide a copy into the exception object.

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.256&r2=1.3076.2.257
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.149&r2=1.149.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught
  2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
                   ` (18 preceding siblings ...)
  2004-03-03  7:40 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-03 16:28 ` pinskia at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-03 16:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-03 16:28 -------
Fixed now so closing.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-03-03 16:28 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-31 12:02 [Bug c++/13944] New: exception in constructor of a class to be thrown is not caught debian-gcc at lists dot debian dot org
2004-02-02  2:10 ` [Bug c++/13944] [3.3/3.4/3.5] " giovannibajo at libero dot it
2004-02-02  7:43 ` pinskia at gcc dot gnu dot org
2004-02-02 23:18 ` bangerth at dealii dot org
2004-02-15 12:43 ` gdr at gcc dot gnu dot org
2004-02-16  3:07 ` mmitchel at gcc dot gnu dot org
2004-02-16  4:09 ` [Bug c++/13944] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-16 18:22 ` jason at redhat dot com
2004-02-16 18:27 ` jason at redhat dot com
2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
2004-02-24 18:30 ` cvs-commit at gcc dot gnu dot org
2004-02-24 19:57 ` gdr at integrable-solutions dot net
2004-03-02 11:10 ` [Bug c++/13944] [3.3/3.4 " steven at gcc dot gnu dot org
2004-03-02 17:17 ` jason at redhat dot com
2004-03-02 19:57 ` cvs-commit at gcc dot gnu dot org
2004-03-02 20:30 ` [Bug c++/13944] [3.3 " pinskia at gcc dot gnu dot org
2004-03-02 20:44 ` gdr at integrable-solutions dot net
2004-03-02 20:54 ` jason at redhat dot com
2004-03-02 21:06 ` gdr at integrable-solutions dot net
2004-03-03  7:40 ` cvs-commit at gcc dot gnu dot org
2004-03-03 16:28 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).