diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2010-01-20 23:12:25 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-01-20 23:12:25 +0000 |
commit | 4227d4a1a58bbbff02ca7d6ea4321ad586ded9be (patch) | |
tree | 7ef1177de88817d855322a3464d821fd48a1013c | |
parent | 4a4d4c08ed9c1843d70c528024ca1cc36207bd63 (diff) | |
download | gcc-4227d4a1a58bbbff02ca7d6ea4321ad586ded9be.zip gcc-4227d4a1a58bbbff02ca7d6ea4321ad586ded9be.tar.gz gcc-4227d4a1a58bbbff02ca7d6ea4321ad586ded9be.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/except.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/crash55.C | 8 |
4 files changed, 26 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4cc1119..5f7190e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 83164c8..4f4f85b 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index faf0f05..76d2bc5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/parse/crash55.C b/gcc/testsuite/g++.dg/parse/crash55.C new file mode 100644 index 0000000..7676d49 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash55.C @@ -0,0 +1,8 @@ +// PR c++/42038 + +extern int __cxa_begin_catch; + +void f(void) +{ + try { } catch (int) { } // { dg-error "cannot be used" } +} |