public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com> To: rth@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/5504: Optimization breaks wei-ku-1 from blitz Date: Thu, 18 Apr 2002 06:46:00 -0000 [thread overview] Message-ID: <20020418134607.7188.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/5504; it has been noted by GNATS. From: Jason Merrill <jason@redhat.com> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/5504: Optimization breaks wei-ku-1 from blitz Date: Thu, 18 Apr 2002 14:39:37 +0100 Here's an unofficial patch which returns us to running destructor base cleanups by hand, breaking semantics for an exception thrown in the destructor body. I'm not applying this anywhere, but you might find it useful. 2002-04-18 Jason Merrill <jason@redhat.com> * init.c (push_base_cleanups): Rename to perform_base_cleanups. Expand base cleanups now rather than pushing them. * decl.c (begin_destructor_body): Don't call push_base_cleanups. (finish_destructor_body): Call perform_base_cleanups. * cp-tree.h: Adjust prototype. *** cp-tree.h.~1~ Fri Apr 12 12:43:31 2002 --- cp-tree.h Tue Apr 9 01:56:51 2002 *************** extern tree build_new PARAMS ((tree, *** 3907,3913 **** extern tree build_vec_init PARAMS ((tree, tree, int)); extern tree build_x_delete PARAMS ((tree, int, tree)); extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int)); ! extern void push_base_cleanups PARAMS ((void)); extern tree build_vbase_delete PARAMS ((tree, tree)); extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int)); extern tree create_temporary_var PARAMS ((tree)); --- 3907,3913 ---- extern tree build_vec_init PARAMS ((tree, tree, int)); extern tree build_x_delete PARAMS ((tree, int, tree)); extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int)); ! extern void perform_base_cleanups PARAMS ((void)); extern tree build_vbase_delete PARAMS ((tree, tree)); extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int)); extern tree create_temporary_var PARAMS ((tree)); *** decl.c.~1~ Fri Apr 12 12:43:31 2002 --- decl.c Fri Apr 12 11:59:12 2002 *************** begin_destructor_body () *** 14064,14073 **** finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); finish_then_clause (if_stmt); finish_if_stmt (); - - /* And insert cleanups for our bases and members so that they - will be properly destroyed if we throw. */ - push_base_cleanups (); } /* At the end of every destructor we generate code to delete the object if --- 14064,14069 ---- *************** finish_destructor_body () *** 14078,14083 **** --- 14074,14082 ---- { tree exprstmt; + /* And perform cleanups for our bases and members. */ + perform_base_cleanups (); + /* In a virtual destructor, we must call delete. */ if (DECL_VIRTUAL_P (current_function_decl)) { *** init.c.~1~ Fri Apr 12 12:43:31 2002 --- init.c Fri Apr 5 23:38:24 2002 *************** build_delete (type, addr, auto_delete, f *** 3218,3230 **** } } ! /* At the beginning of a destructor, push cleanups that will call the ! destructors for our base classes and members. ! Called from setup_vtbl_ptr. */ void ! push_base_cleanups () { tree binfos; int i, n_baseclasses; --- 3218,3230 ---- } } ! /* At the end of a destructor, call the destructors for our base classes ! and members. ! Called from finish_destructor_body. */ void ! perform_base_cleanups () { tree binfos; int i, n_baseclasses; *************** push_base_cleanups () *** 3268,3274 **** LOOKUP_NORMAL); expr = build (COND_EXPR, void_type_node, cond, expr, void_zero_node); ! finish_decl_cleanup (NULL_TREE, expr); } } } --- 3268,3274 ---- LOOKUP_NORMAL); expr = build (COND_EXPR, void_type_node, cond, expr, void_zero_node); ! finish_expr_stmt (expr); } } } *************** push_base_cleanups () *** 3288,3294 **** base_dtor_identifier, NULL_TREE); ! finish_decl_cleanup (NULL_TREE, expr); } for (member = TYPE_FIELDS (current_class_type); member; --- 3288,3294 ---- base_dtor_identifier, NULL_TREE); ! finish_expr_stmt (expr); } for (member = TYPE_FIELDS (current_class_type); member; *************** push_base_cleanups () *** 3306,3312 **** sfk_complete_destructor, LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0); ! finish_decl_cleanup (NULL_TREE, expr); } } } --- 3306,3312 ---- sfk_complete_destructor, LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0); ! finish_expr_stmt (expr); } } }
next reply other threads:[~2002-04-18 13:46 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-18 6:46 Jason Merrill [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-05-09 9:35 reichelt 2003-05-08 22:44 bangerth 2002-04-10 10:42 rth 2002-04-05 15:26 Jason Merrill 2002-04-05 15:16 Jason Merrill 2002-04-03 18:26 Diego Novillo 2002-04-03 18:08 jason 2002-03-26 6:46 Diego Novillo 2002-03-22 10:14 jakub 2002-03-22 10:10 jakub 2002-03-22 7:51 dnovillo 2002-03-21 7:12 jakub 2002-03-20 9:36 Peter Schmid 2002-03-18 7:02 jakub 2002-01-26 16:06 Peter Schmid
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020418134607.7188.qmail@sources.redhat.com \ --to=jason@redhat.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=rth@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).