public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115319] New: ICE when mutating a captured parameter in an explicit-this lambda if a capture is not trivially copyable
@ 2024-06-01 23:45 blubban at gmail dot com
  2024-06-03 20:44 ` [Bug c++/115319] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: blubban at gmail dot com @ 2024-06-01 23:45 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/115319] ICE when mutating a captured parameter in an explicit-this lambda if a capture is not trivially copyable
  2024-06-01 23:45 [Bug c++/115319] New: ICE when mutating a captured parameter in an explicit-this lambda if a capture is not trivially copyable blubban at gmail dot com
@ 2024-06-03 20:44 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-03 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2024-06-03
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

> Said friend claims to encounter like billions of ICEs every day

Highly unlikely.  But good bug reports are always welcome.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-03 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-01 23:45 [Bug c++/115319] New: ICE when mutating a captured parameter in an explicit-this lambda if a capture is not trivially copyable blubban at gmail dot com
2024-06-03 20:44 ` [Bug c++/115319] " mpolacek at gcc dot gnu.org

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).