public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52339] using delete ptr1->ptr2 where ptr2 destructor deletes a const ptr1 fails Date: Wed, 22 Feb 2012 13:07:00 -0000 [thread overview] Message-ID: <bug-52339-4-dnjMco0uqY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-52339-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-22 12:48:04 UTC --- b = b.0; a = b->a; D.2361 = a->b; if (D.2361 != 0B) goto <D.2362>; else goto <D.2363>; <D.2362>: D.2364 = a->b; B::~B (D.2364); D.2365 = a->b; operator delete (D.2365); which is indeed as if written like: a->b->~B(); operator delete(a->b); // a is already deleted if 'a' is not a pointer-to-const then instead you get b = b.0; a = b->a; D.2361 = a->b; if (D.2361 != 0B) goto <D.2362>; else goto <D.2363>; <D.2362>: B::~B (D.2361); operator delete (D.2361); calling the destructor and operator delete directly on the value of a->b
next prev parent reply other threads:[~2012-02-22 12:56 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-02-22 10:37 [Bug c++/52339] New: " rombust at hotmail dot co.uk 2012-02-22 11:22 ` [Bug c++/52339] " redi at gcc dot gnu.org 2012-02-22 13:07 ` redi at gcc dot gnu.org [this message] 2023-05-04 11:34 ` redi at gcc dot gnu.org 2023-05-04 11:35 ` redi at gcc dot gnu.org 2023-05-04 12:23 ` jakub at gcc dot gnu.org 2023-05-04 12:45 ` jakub at gcc dot gnu.org 2023-05-04 13:45 ` jakub at gcc dot gnu.org 2023-05-04 16:58 ` joseph at codesourcery dot com 2023-05-04 22:12 ` jason at gcc dot gnu.org 2023-11-09 6:35 ` pinskia at gcc dot gnu.org 2023-12-21 3:18 ` pinskia at gcc dot gnu.org
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=bug-52339-4-dnjMco0uqY@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).