public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/100861] False positive -Wmismatched-new-delete with destroying operator delete
Date: Tue, 01 Jun 2021 22:08:00 +0000	[thread overview]
Message-ID: <bug-100861-4-EyxtsrrAbd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100861-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100861

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The virtual dtor forces an out-of-line call to the Grommet dtor which then
calls ::operator delete(), so the warning has nothing to complain about.  It
sees this code (compile with -fdump-tree-optimized=/dev/stdout):

int main ()
{
  void * _3;

  <bb 2> [local count: 1073741824]:
  _3 = operator new (16);
  MEM[(struct Widget *)_3].Kind = 0;
  MEM[(struct Grommet *)_3].D.2504._vptr.Widget = &MEM <int (*) ()[4]> [(void
*)&_ZTV7Grommet + 16B];
  Grommet::~Grommet (_3);
  return 0;

}

whereas with the original test case it sees:

int main ()
{
  struct destroying_delete_t D.2584;
  void * _3;

  <bb 2> [local count: 1073741824]:
  _3 = operator new (4);
  Widget::operator delete (_3, D.2584);   <<< warning here
  return 0;

}

  parent reply	other threads:[~2021-06-01 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 19:43 [Bug c++/100861] New: " josephcsible at gmail dot com
2021-06-01 21:36 ` [Bug middle-end/100861] " msebor at gcc dot gnu.org
2021-06-01 21:49 ` josephcsible at gmail dot com
2021-06-01 22:08 ` msebor at gcc dot gnu.org [this message]
2023-12-22 18:31 ` 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-100861-4-EyxtsrrAbd@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: link
Be 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).