From 752e5a18f57dd765b47d46a552e5db389ca62b53 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 24 May 2025 01:28:51 +0200 Subject: Codegen: Fix bug with typecheck of return of function params --- examples/18.src | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'examples/18.src') diff --git a/examples/18.src b/examples/18.src index 29facd5..17c9fee 100644 --- a/examples/18.src +++ b/examples/18.src @@ -1,18 +1,18 @@ -extern malloc = (i64) => *i64; -extern free = (*i64) => void; +extern malloc = (i64) => *void; +extern free = (*void) => void; import "!stdlib.src"; let main = () => i64 { - let x = malloc(24); - (*(x+0)) = 10; - (*(x+1)) = 20; - (*(x+2)) = 40; + let x = cast(*i8, malloc(24)); + (*(x+cast(*i8, 0))) = 10; + (*(x+cast(*i8, 1))) = 20; + (*(x+cast(*i8, 2))) = 40; println("%p", x); - println("%d", *(x+0)); - println("%d", *(x+1)); - println("%d", *(x+2)); - free(x); + println("%d", *(x+cast(*i8, 0))); + println("%d", *(x+cast(*i8, 1))); + println("%d", *(x+cast(*i8, 2))); + free(cast(*void, x)); return 0; }; -- cgit 1.4.1