From: Jason Merrill Date: Tue, 7 Oct 2003 22:10:37 +0000 (-0400) Subject: re PR c++/12519 (ICE tree check: in genrtl_cleanup_stmt, at c-semantics.c:761) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b288fecdeb9929c72515dd2471e4c7bec264d2a;p=gcc.git re PR c++/12519 (ICE tree check: in genrtl_cleanup_stmt, at c-semantics.c:761) PR c++/12519 * c-semantics.c (genrtl_cleanup_stmt): Ignore the CLEANUP_DECL if it isn't a decl. From-SVN: r72206 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1170906812..9d8ee4132e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-10-07 Jason Merrill + + PR c++/12519 + * c-semantics.c (genrtl_cleanup_stmt): Ignore the CLEANUP_DECL if + it isn't a decl. + 2003-10-07 Alexandre Oliva * gcc.c (cpp_options): Only pass -fworking-directory for -g* if diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index a9825c87e68..a3e1b45343c 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -758,7 +758,8 @@ void genrtl_cleanup_stmt (tree t) { tree decl = CLEANUP_DECL (t); - if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node)) + if (!decl || !DECL_P (decl) + || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node)) expand_decl_cleanup_eh (decl, CLEANUP_EXPR (t), CLEANUP_EH_ONLY (t)); } diff --git a/gcc/testsuite/g++.dg/opt/inline5.C b/gcc/testsuite/g++.dg/opt/inline5.C new file mode 100644 index 00000000000..dd61ee6bc01 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/inline5.C @@ -0,0 +1,20 @@ +// PR c++/12519 + +// { dg-do compile } +// { dg-options "-O" } + +struct A +{ + ~A(); +}; + +inline const A foo() +{ + A a; + return a; +} + +A bar() +{ + return foo(); +}