From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EC2E5382FAED; Sat, 1 Jun 2024 23:45:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC2E5382FAED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717285533; bh=nvl/vRAmq5M7ZT7sOh9TJuXWObKYQh8hG8OeU7IoCiI=; h=From:To:Subject:Date:From; b=wauRgqsC2jlHFWoqnDmezDJTSE6xfWoyf+krHDbglneoqWpu3qy8CrJLCO/CBm7KK wt/gg38xoTxItIz7wkeYdYirFSKY2b6/VJValt11sTetrOWozIpI5iOVCklEk01jbR wS5+A7XwjDC6UZoftfncBkD8q/XXSlKq+sRv2HYc= From: "blubban at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: blubban at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115319 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=3D0, x=3DS{}](this auto self) -> void { i++; }(); } -std=3Dc++23 (optional, it throws a c++23-extensions warning and the same I= CE without it) : In lambda function: :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 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 g= ets 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)=