Eigenstate: myrddin-dev mailing list

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

[Bug?] Assertion triggered by seemingly-correct code


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

Attachment: pgpZQTWoP_ERu.pgp
Description: PGP signature


Follow-Ups:
Re: [Bug?] Assertion triggered by seemingly-correct codeOri Bernstein <ori@xxxxxxxxxxxxxx>