Commit 4227d4a1 by Paolo Carlini Committed by Paolo Carlini

re PR c++/42038 (ICE: tree check: expected class 'type', have 'exceptional'…

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
parent 4a4d4c08
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> 2010-01-20 Jason Merrill <jason@redhat.com>
PR c++/41788 PR c++/41788
......
/* Handle exceptional things in C++. /* Handle exceptional things in C++.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 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. Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com> Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
...@@ -417,7 +417,7 @@ tree ...@@ -417,7 +417,7 @@ tree
expand_start_catch_block (tree decl) expand_start_catch_block (tree decl)
{ {
tree exp; tree exp;
tree type; tree type, init;
if (! doing_eh (1)) if (! doing_eh (1))
return NULL_TREE; return NULL_TREE;
...@@ -450,10 +450,12 @@ expand_start_catch_block (tree decl) ...@@ -450,10 +450,12 @@ expand_start_catch_block (tree decl)
/* Call __cxa_end_catch at the end of processing the exception. */ /* Call __cxa_end_catch at the end of processing the exception. */
push_eh_cleanup (type); push_eh_cleanup (type);
init = do_begin_catch ();
/* If there's no decl at all, then all we need to do is make sure /* 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. */ to tell the runtime that we've begun handling the exception. */
if (decl == NULL || decl == error_mark_node) if (decl == NULL || decl == error_mark_node || init == error_mark_node)
finish_expr_stmt (do_begin_catch ()); finish_expr_stmt (init);
/* If the C++ object needs constructing, we need to do that before /* If the C++ object needs constructing, we need to do that before
calling __cxa_begin_catch, so that std::uncaught_exception gets calling __cxa_begin_catch, so that std::uncaught_exception gets
...@@ -463,7 +465,7 @@ expand_start_catch_block (tree decl) ...@@ -463,7 +465,7 @@ expand_start_catch_block (tree decl)
{ {
exp = do_get_exception_ptr (); exp = do_get_exception_ptr ();
initialize_handler_parm (decl, exp); 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 /* Otherwise the type uses a bitwise copy, and we don't have to worry
...@@ -471,7 +473,6 @@ expand_start_catch_block (tree decl) ...@@ -471,7 +473,6 @@ expand_start_catch_block (tree decl)
copy with the return value of __cxa_end_catch instead. */ copy with the return value of __cxa_end_catch instead. */
else else
{ {
tree init = do_begin_catch ();
tree init_type = type; tree init_type = type;
/* Pointers are passed by values, everything else by reference. */ /* Pointers are passed by values, everything else by reference. */
......
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> 2010-01-20 Alexandre Oliva <aoliva@redhat.com>
PR debug/42782 PR debug/42782
......
// PR c++/42038
extern int __cxa_begin_catch;
void f(void)
{
try { } catch (int) { } // { dg-error "cannot be used" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment