------- Additional Comments From rth at gcc dot gnu dot org 2005-03-17 11:49 ------- Subject: Re: [PR c++/20103] failure to gimplify constructors for addressable types
On Thu, Mar 17, 2005 at 05:11:08AM -0300, Alexandre Oliva wrote: > * gimplify.c (gimplify_decl_expr): Add temp variable to binding > before gimplifying its initializer. Ok. > +cp_gimplify_compound_literal_expr (tree *expr_p, tree *pre_p, tree *post_p) > +{ > + tree decl_s = COMPOUND_LITERAL_EXPR_DECL_STMT (*expr_p); > + tree decl = DECL_EXPR_DECL (decl_s); > + tree init = DECL_INITIAL (decl); > + tree cleanup = cxx_maybe_build_cleanup (decl); > + > + if (cleanup) > + { > + DECL_INITIAL (decl) = NULL_TREE; > + *expr_p = build4 (TARGET_EXPR, TREE_TYPE (decl), decl, > + init, cleanup, NULL_TREE); > + return gimplify_expr (expr_p, pre_p, post_p, is_gimple_val, fb_rvalue); You don't need to recurse here. Just return GS_OK. > + /* If no cleanups are needed, we can do things in a simpler way. */ > + gimplify_and_add (decl_s, pre_p); > + *expr_p = decl; > + return GS_OK; If you've simplified to a decl, you can return GS_ALL_DONE. > + case COMPOUND_LITERAL_EXPR: > + cp_gimplify_compound_literal_expr (expr_p, pre_p, post_p); > + ret = GS_OK; Should be "ret = cp_gimplify_compound_literal_expr (...)". > +// { dg-final { scan-assembler "_ZN1sD1Ev.*_ZN1sD1Ev.*_ZN1sD1Ev" } } > + > +// Make sure we issue 3 dtor calls: one for the t::x, one for the s > +// temporary in normal execution flow and one for the same s temporary > +// in the EH cleanup should the dtor of t::x throw. Wouldn't it be a lot safer to make this a run test instead? r~ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20103