aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/decl.cc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2024-04-19 10:51:12 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2024-04-19 10:53:57 +0200
commit4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac (patch)
tree9a3e9a7b6df28130708cc5d3460c450357bd694f /gcc/d/decl.cc
parent9f295847a9c32081bdd0fe908ffba58e830a24fb (diff)
downloadgcc-4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac.zip
gcc-4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac.tar.gz
gcc-4d4929fe0654d51b52a2bf6e6188d7aad0bf17ac.tar.bz2
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.
Diffstat (limited to 'gcc/d/decl.cc')
-rw-r--r--gcc/d/decl.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 3b7627d..0a87c85 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);