mal
mal copied to clipboard
zig: deallocate a varargs function after applying it
This fixes an occasional segmentation fault.
@asarhaddon sorry for the really slow response on this. I had to make the following change to get things to build (the /mal
directory gets mounted over when running in docker mode):
diff --git a/impls/zig/Dockerfile b/impls/zig/Dockerfile
index 0c6a79eb..024c91d4 100644
--- a/impls/zig/Dockerfile
+++ b/impls/zig/Dockerfile
@@ -20,7 +20,7 @@ WORKDIR /mal
RUN apt-get -y install ca-certificates curl gcc libc-dev libpcre3-dev libreadline-dev xz-utils
-RUN curl https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz | tar -xJC/mal
-RUN ln -fst/usr/local/bin /mal/zig-linux-x86_64-0.8.1/zig
+RUN curl https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz | tar -xJC/opt
+RUN ln -fst /usr/local/bin /opt/zig-linux-x86_64-0.8.1/zig
ENV HOME /mal
Then I started getting a segfault in step6:
$ make "docker-build^zig"
$ make DOCKERIZE=1 "test^zig^step6"
...
TEST: '(f)' -> ['',9] -> SUCCESS
Testing whether closures can retain atoms
TEST: '(def! g (let* (atm (atom 0)) (fn* () (deref atm))))' -> ['',]
Exception: IOError(5, 'Input/output error')
Output before exception:
(def! g (let* (atm (atom 0)) (fn* () (deref atm))))
Segmentation fault at address 0x0
/opt/zig-linux-x86_64-0.8.1/lib/std/hash_map.zig:863:33: 0x20e638 in std.hash_map.HashMap([]const u8,*types.MalType,std.hash_map.StringContext,80).get (step6_file)
return self.header().capacity;
^
make: *** [Makefile:238: test^zig^step6] Error 1