Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug?] Assertion triggered by seemingly-correct code


Confirmed, and fix pushed.

The bug was that when we're loading imports from
hip.use, it was trying to put the transitive
imports into the wrong symbol table. This made
the namespaces mismatch.

On Thu, 9 Mar 2017 20:02:42 +0200
Adrian Perez de Castro <aperez@xxxxxxxxxx> wrote:

> Hello list!
> 
> I have been playing with Myrddin for the last days (I have a thing for exotic
> minimalistic programmin languages :P), now that 0.1.1 has been released. While
> trying to build a parser for the HiPack [0] serialization format at some point
> I started getting the following output from "mbld":
> 
>   % mbld
>   project base /home/aperez/devel/hipack-myr:
>   hipack...
>         6m      hip.myr
>         6m      main.myr
>   6m: node.c:485: setns: Assertion `!ns || !n->name.ns || !strcmp(n->name.ns, ns)' failed.
>   CRASH: "6m main.myr"
>   %
> 
> But the code I am writing should be (AFAIU) correct. I have been able to
> reduce the size of the input source files so hopefully they are small enough
> to help track down the bug. If there is a bug, because it could be as well
> that my code is wrong :-P
> 
> File "hip.myr" (removing the usage of "bio.ioerr" does not trigger the
> assertion):
> 
> 	use bio
> 	pkg hip =
> 		 type status(@t) = union
> 			 `Ok @t
> 			 `IoErr bio.ioerr  // <--- This.
> 		 ;;
> 		 const load : (f : bio.file# -> status(void))
> 	;;
> 	const load = { f
> 		-> `Ok void
> 	}
> 
> File "main.myr" (this just creates a "bio.file" and calls "hip.load"):
> 
> 	use bio
> 	use std
> 	use "hip"
> 	const main = {
> 		var f = bio.mkfile(0, bio.Rd)
> 		std.put("{}\n", hip.load(f))
> 		bio.free(f)
> 	}
> 
> FWIW, the assertion gets triggered both with 0.1.1 and building from the
> current top of the Git "master" branch.
> 
> Cheers, and thanks for working on Myrddin, it has been fun to use so far :)
> 
> ---
> [0] http://hipack.org


-- 
Ori Bernstein <ori@xxxxxxxxxxxxxx>

Follow-Ups:
Re: [Bug?] Assertion triggered by seemingly-correct codeAdrian Perez de Castro <aperez@xxxxxxxxxx>
References:
[Bug?] Assertion triggered by seemingly-correct codeAdrian Perez de Castro <aperez@xxxxxxxxxx>