public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mital at mitalashok dot co.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/115187] [14/15 Regression] ICE when deleting temporary array
Date: Thu, 23 May 2024 06:52:18 +0000	[thread overview]
Message-ID: <bug-115187-4-NLOps5b7eu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115187-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Mital Ashok <mital at mitalashok dot co.uk> ---
PR94264 prevented the first version from being an issue in GCC13, but the
second version

    struct X { int x[2]; };
    void f() {
      delete X{}.x;
    }

still crashed in older GCC versions. This isn't technically invalid code since
`f()` should just be like `std::unreachable()`. Or it also crashes when it
appears in `if (false) delete X{}.x;` or `false ? delete X{}.x : (void) 0;`

A "valid" array delete (like `delete[]
*__builtin_launder(reinterpret_cast<int(*)[2]>(new int[2]))`) doesn't involve
an array temporary (since the array must have been `new`d), so this does seem
to only happen in code that can't be executed.

  parent reply	other threads:[~2024-05-23  6:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 11:09 [Bug c++/115187] New: " mital at mitalashok dot co.uk
2024-05-22 13:37 ` [Bug c++/115187] " rguenth at gcc dot gnu.org
2024-05-22 13:38 ` [Bug c++/115187] [14/15 Regression] " rguenth at gcc dot gnu.org
2024-05-22 20:49 ` pinskia at gcc dot gnu.org
2024-05-22 20:51 ` pinskia at gcc dot gnu.org
2024-05-22 22:33 ` jason at gcc dot gnu.org
2024-05-23  6:52 ` mital at mitalashok dot co.uk [this message]
2024-05-23 20:24 ` cvs-commit at gcc dot gnu.org
2024-05-24 15:15 ` [Bug c++/115187] [14 " cvs-commit at gcc dot gnu.org
2024-05-24 15:25 ` jason 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-115187-4-NLOps5b7eu@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).