public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-10036] d: Fix ICE in build_deref, at d/d-codegen.cc:1650 [PR111650] Date: Fri, 19 Apr 2024 08:57:17 +0000 (GMT) [thread overview] Message-ID: <20240419085717.31ABA384AB48@sourceware.org> (raw) https://gcc.gnu.org/g:4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac commit r14-10036-g4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Fri Apr 19 10:51:12 2024 +0200 d: Fix ICE in build_deref, at d/d-codegen.cc:1650 [PR111650] PR d/111650 gcc/d/ChangeLog: * decl.cc (get_fndecl_arguments): Move generation of frame type to ... (DeclVisitor::visit (FuncDeclaration *)): ... here, after the call to build_closure. gcc/testsuite/ChangeLog: * gdc.dg/pr111650.d: New test. Diff: --- gcc/d/decl.cc | 20 ++++++++++---------- gcc/testsuite/gdc.dg/pr111650.d | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 3b7627d3dfa..0a87c85ae2e 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -163,16 +163,6 @@ get_fndecl_arguments (FuncDeclaration *decl) tree parm_decl = get_symbol_decl (decl->vthis); DECL_ARTIFICIAL (parm_decl) = 1; TREE_READONLY (parm_decl) = 1; - - if (decl->vthis->type == Type::tvoidptr) - { - /* Replace generic pointer with back-end closure type - (this wins for gdb). */ - tree frame_type = FRAMEINFO_TYPE (get_frameinfo (decl)); - gcc_assert (frame_type != NULL_TREE); - TREE_TYPE (parm_decl) = build_pointer_type (frame_type); - } - param_list = chainon (param_list, parm_decl); } @@ -1072,6 +1062,16 @@ public: /* May change cfun->static_chain. */ build_closure (d); + /* Replace generic pointer with back-end closure type + (this wins for gdb). */ + if (d->vthis && d->vthis->type == Type::tvoidptr) + { + tree frame_type = FRAMEINFO_TYPE (get_frameinfo (d)); + gcc_assert (frame_type != NULL_TREE); + tree parm_decl = get_symbol_decl (d->vthis); + TREE_TYPE (parm_decl) = build_pointer_type (frame_type); + } + if (d->vresult) declare_local_var (d->vresult); diff --git a/gcc/testsuite/gdc.dg/pr111650.d b/gcc/testsuite/gdc.dg/pr111650.d new file mode 100644 index 00000000000..4298a76d38f --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr111650.d @@ -0,0 +1,21 @@ +// { dg-do compile } +ref V require(K, V)(ref V[K] aa, K key, lazy V value); + +struct Root +{ + ulong[3] f; +} + +Root[ulong] roots; + +Root getRoot(int fd, ulong rootID) +{ + return roots.require(rootID, + { + Root result; + inoLookup(fd, () => result); + return result; + }()); +} + +void inoLookup(int, scope Root delegate()) { }
reply other threads:[~2024-04-19 8:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240419085717.31ABA384AB48@sourceware.org \ --to=ibuclaw@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).