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] New: ICE when deleting temporary array
Date: Wed, 22 May 2024 11:09:35 +0000	[thread overview]
Message-ID: <bug-115187-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115187
           Summary: ICE when deleting temporary array
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mital at mitalashok dot co.uk
  Target Milestone: ---

A delete-expression where the operand comes from a temporary array causes an
internal compiler error

https://godbolt.org/z/7a9sM9KqT

    void f() {
      using T = int[2];
      delete T{};
    }


test.cpp: In function ‘void f()’:
test.cpp:3:10: warning: deleting array ‘T()’
    3 |   delete T{};
      |          ^~~
test.cpp:1:6: internal compiler error: in verify_gimple_stmt, at
tree-cfg.cc:5169
    1 | void f() {
      |      ^
0x9069f1 verify_gimple_stmt
        ./gcc/gcc/tree-cfg.cc:5169
0x13ed54f verify_gimple_in_seq_2
        ./gcc/gcc/tree-cfg.cc:5288
0x13ed518 verify_gimple_in_seq_2
        ./gcc/gcc/tree-cfg.cc:5257
0x13ed588 verify_gimple_in_seq_2
        ./gcc/gcc/tree-cfg.cc:5252
0x13ed5ed verify_gimple_in_seq(gimple*, bool)
        ./gcc/gcc/tree-cfg.cc:5327
0x107426b gimplify_body(tree_node*, bool)
        ./gcc/gcc/gimplify.cc:19237
0x10743f9 gimplify_function_tree(tree_node*)
        ./gcc/gcc/gimplify.cc:19355
0xe873c7 cgraph_node::analyze()
        ./gcc/gcc/cgraphunit.cc:687
0xe899d7 analyze_functions
        ./gcc/gcc/cgraphunit.cc:1251
0xe8a721 symbol_table::finalize_compilation_unit()
        ./gcc/gcc/cgraphunit.cc:2560
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

This also happens when the array is a subobject of a temporary:

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

This also happens if the operand is a pointer derived from that array, `delete
+T{};`, `delete (T{} + 1);`, `delete +X{}.x;`, `delete (X{}.x + 1)`

             reply	other threads:[~2024-05-22 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 11:09 mital at mitalashok dot co.uk [this message]
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
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@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).