summaryrefslogtreecommitdiff
path: root/tnslc/compile/function.tnsl
diff options
context:
space:
mode:
authorKai Gunger <kgunger12@gmail.com>2026-01-05 02:09:37 -0500
committerKai Gunger <kgunger12@gmail.com>2026-01-05 02:09:37 -0500
commit3b0dd26823b62e13bf38376f0a0211ce7861c150 (patch)
tree8b241fd16c58511330e980ce9a56020a47befe50 /tnslc/compile/function.tnsl
parent4289c90cc90a9798091a741c3e18861b47836402 (diff)
fix some improper memory accessesorigin
Diffstat (limited to 'tnslc/compile/function.tnsl')
-rw-r--r--tnslc/compile/function.tnsl7
1 files changed, 5 insertions, 2 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
index bd3438e..6f7fceb 100644
--- a/tnslc/compile/function.tnsl
+++ b/tnslc/compile/function.tnsl
@@ -289,7 +289,7 @@ struct Function {
tmp = s`.mk_tmp(out)
cmp = self._compile_value(s, val_node, out)
- tmp.set(s, ~cmp)
+ tmp.set(s`.cb, ~cmp)
cmp.end()
tmps.push(~tmp)
;/
@@ -299,7 +299,7 @@ struct Function {
/; loop (int i = 0; i < self.outputs.count) [i++]
out = self.outputs.get(i)
tt = tmps.get(i)
- out`.set(s`.cb, tmp)
+ out`.set(s`.cb, tt)
tt`.end()
;/
@@ -325,6 +325,7 @@ struct Function {
s`.cb`.add_c(" jmp \0")
s`.cb`.add_c(lab)
s`.cb`.add_c("\n\0")
+ _delete(lab)
;/
# Should handle break, continue, and return
@@ -342,6 +343,7 @@ struct Function {
s`.cb`.add_c(" jmp \0")
s`.cb`.add_c(lab)
s`.cb`.add_c("\n\0")
+ _delete(lab)
;; else if (utils.strcmp(n`.data, "break\0") == true)
~Scope br = s`.closest_break()
/; if (br == NULL)
@@ -352,6 +354,7 @@ struct Function {
s`.cb`.add_c(" jmp \0")
s`.cb`.add_c(lab)
s`.cb`.add_c("\n\0")
+ _delete(lab)
;; else
_printf("COMPILER ERROR: The following was detected as flow control, but we do not handle it: '\0")
_printf(n`.data)