From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C9623858426; Tue, 24 Aug 2021 22:27:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C9623858426 From: "vlovich at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102051] New: [coroutines] ICE in gimplify_var_or_parm_decl, at gimplify.c:2848 Date: Tue, 24 Aug 2021 22:27:57 +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: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vlovich 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 attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 22:27:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102051 Bug ID: 102051 Summary: [coroutines] ICE in gimplify_var_or_parm_decl, at gimplify.c:2848 Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vlovich at gmail dot com Target Milestone: --- Created attachment 51353 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51353&action=3Dedit The preprocessed file that causes the ICE We're adding co-routine support to KJ futures (https://github.com/capnproto/capnproto/pull/1104). I tried enabling corout= ines on G++ by adjusting async-prelude.h: -#if __cpp_coroutines && __has_include() +#if __cpp_impl_coroutine && __has_include() +// Standardized coroutines detected. +#include +#define KJ_HAS_COROUTINE 1 +#define KJ_COROUTINE_STD_NAMESPACE std +#elif __cpp_coroutines && __has_include() This results in an ICE in our test case: # g++ -std=3Dc++20 -fcoroutines ./c++/src/kj/CMakeFiles/kj-heavy-tests.dir/async-coroutine-test.c++.ii c++/src/kj/async-coroutine-test.c++: In function =E2=80=98kj::Promise kj::{anonymous}::identity(const char*)=E2=80=99: c++/src/kj/async-coroutine-test.c++:40:1: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:2840 40 | } | ^ 0x1797368 internal_error(char const*, ...) ???:0 0x67f8f9 fancy_abort(char const*, int, char const*) ???:0 0xab710f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab7130 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab7a2c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab81dd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab7417 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab852d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab86ea gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab852d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab723e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab852d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xab86ea gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ???:0 0xabac7a gimplify_body(tree_node*, bool) ???:0 0xabb022 gimplify_function_tree(tree_node*) ???:0 0x949a87 cgraph_node::analyze() ???:0 0x94cc2d symbol_table::finalize_compilation_unit() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. I reduced the test case using cvise: https://godbolt.org/z/M5nfEPMKj. This = code works fine against clang's coroutines TS but interestingly clang complains = the reduced test case doesn't compile (https://godbolt.org/z/KjcW94oKM) so maybe there's just some subtle incompatibility between standard coroutines & the = TS version implemented in clang? I've attached the full preprocessed file that caused the ICE. Interestingly= if I build against libc++ the ICE doesn't appear so I suspect this may be some kind of bug in the frontend triggered by some subtlety in the implementatio= n in libstdc++ OR it's a compilation bug on our end that happens to trigger an I= CE. I don't know coroutines well enough to say.=