re PR c++/42038 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p)

/cp
2010-01-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42038
	* except.c (expand_start_catch_block): Deal correctly with
	do_begin_catch returning error_mark_node.

/testsuite
2010-01-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42038
	* g++.dg/parse/crash55.C: New.

From-SVN: r156094
This commit is contained in:
Paolo Carlini 2010-01-20 23:12:25 +00:00 committed by Paolo Carlini
parent 4a4d4c08ed
commit 4227d4a1a5
4 changed files with 26 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2010-01-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42038
* except.c (expand_start_catch_block): Deal correctly with
do_begin_catch returning error_mark_node.
2010-01-20 Jason Merrill <jason@redhat.com>
PR c++/41788

View File

@ -1,6 +1,6 @@
/* Handle exceptional things in C++.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
@ -417,7 +417,7 @@ tree
expand_start_catch_block (tree decl)
{
tree exp;
tree type;
tree type, init;
if (! doing_eh (1))
return NULL_TREE;
@ -450,10 +450,12 @@ expand_start_catch_block (tree decl)
/* Call __cxa_end_catch at the end of processing the exception. */
push_eh_cleanup (type);
init = do_begin_catch ();
/* If there's no decl at all, then all we need to do is make sure
to tell the runtime that we've begun handling the exception. */
if (decl == NULL || decl == error_mark_node)
finish_expr_stmt (do_begin_catch ());
if (decl == NULL || decl == error_mark_node || init == error_mark_node)
finish_expr_stmt (init);
/* If the C++ object needs constructing, we need to do that before
calling __cxa_begin_catch, so that std::uncaught_exception gets
@ -463,7 +465,7 @@ expand_start_catch_block (tree decl)
{
exp = do_get_exception_ptr ();
initialize_handler_parm (decl, exp);
finish_expr_stmt (do_begin_catch ());
finish_expr_stmt (init);
}
/* Otherwise the type uses a bitwise copy, and we don't have to worry
@ -471,7 +473,6 @@ expand_start_catch_block (tree decl)
copy with the return value of __cxa_end_catch instead. */
else
{
tree init = do_begin_catch ();
tree init_type = type;
/* Pointers are passed by values, everything else by reference. */

View File

@ -1,3 +1,8 @@
2010-01-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42038
* g++.dg/parse/crash55.C: New.
2010-01-20 Alexandre Oliva <aoliva@redhat.com>
PR debug/42782

View File

@ -0,0 +1,8 @@
// PR c++/42038
extern int __cxa_begin_catch;
void f(void)
{
try { } catch (int) { } // { dg-error "cannot be used" }
}