aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-11-09 20:02:30 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2025-11-09 20:02:30 +0100
commit18f901125ad1b97ee3f79cb2f5d87704b52191ee (patch)
tree11c63485cabd1e81b82041aaa117120d69be0050
parent8d4b751036ffc03a4c7d1ded58b3995757cb984a (diff)
call_import.c: Always set ci->pc
Otherwise, imports without parameters would jump to `call` directly without assigning ci->pc first, so that nwp_interp_resume would read incorrectly from offset 0.
-rw-r--r--src/routines/call_import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/routines/call_import.c b/src/routines/call_import.c
index 63a736e..6a94ff0 100644
--- a/src/routines/call_import.c
+++ b/src/routines/call_import.c
@@ -403,7 +403,7 @@ static enum nw_state tell(struct nw_interp *const i)
if (n)
return n;
- i->next = seek_param_types;
+ i->next = ci->fn.param_count ? seek_param_types : call;
return NW_AGAIN;
}
@@ -465,7 +465,7 @@ static enum nw_state prepare(struct nw_interp *const i)
*pci = ci;
pci->fn = fn;
pci->imp = imp;
- i->next = pci->fn.param_count ? tell : call;
+ i->next = tell;
}
return NW_AGAIN;