public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "blubban at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/115319] New: ICE when mutating a captured parameter in an explicit-this lambda if a capture is not trivially copyable
Date: Sat, 01 Jun 2024 23:45:33 +0000	[thread overview]
Message-ID: <bug-115319-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115319
           Summary: ICE when mutating a captured parameter in an
                    explicit-this lambda if a capture is not trivially
                    copyable
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blubban at gmail dot com
  Target Milestone: ---

struct S
{
    S() {}
    S(const S&) {}
};

void a()
{
    [i=0, x=S{}](this auto self) -> void
    {
        i++;
    }();
}


-std=c++23 (optional, it throws a c++23-extensions warning and the same ICE
without it)


<source>: In lambda function:
<source>:11:9: internal compiler error: in gimplify_compound_lval, at
gimplify.cc:3576
   11 |         i++;
      |         ^
0x202ef4c internal_error(char const*, ...)
        ???:0
0x778915 fancy_abort(char const*, int, char const*)
        ???:0
0xc4c739 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc55a00 gimplify_self_mod_expr(tree_node**, gimple**, gimple**, bool,
tree_node*)
        ???:0
0xc4cf52 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc4e8c4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc4ca8d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc4e8ae gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc50e8e gimplify_body(tree_node*, bool)
        ???:0
0xc51250 gimplify_function_tree(tree_node*)
        ???:0
0xaba647 cgraph_node::analyze()
        ???:0
0xabd9b1 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1


Online reproducer: https://godbolt.org/z/Go6YdPTME


It seems that the explicit this makes by-value captures mutable, so I think
this is an ice-on-valid, but that is a pretty odd-sounding rule, so I'm not
entirely sure.


(one of my friends just discovered that posting GCC ICEs where I see them gets
them reduced and reported. Said friend claims to encounter like billions of
ICEs every day, so I may end up submitting a lot of ICEs and other gcc bugs in
the near future. I'll make sure to reduce every testcase, validate that it is a
bug, and try to find existing reports, of course)

             reply	other threads:[~2024-06-01 23:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 23:45 blubban at gmail dot com [this message]
2024-06-03 20:44 ` [Bug c++/115319] " mpolacek 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-115319-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).