In the following code, with the error line marked with a "119", I get a 
SIGSEGV. Software distribution is arch linux on this machine.
    
    
    var envs, wavs, fms, macros: seq[tuple[name: string, values: string]]
    var name, artist: string = ""
    var tickrate: int16 = 0
    
    
    ...
    
    
    proc loadfile(filename: string): seq[tuple[blk: string, lin: string]] =
      var wavblock, envblock, mublockplay, mublockloop, fmblock: bool = false
      var metablock: bool = true
      var counter: int = 0
      block load:
        for line in lines(filename):
          counter.inc
          echo counter
          block read:
            if line.startsWith('#'):
              break read
            elif line.startsWith("END"):
              break load
            elif line.isNilOrEmpty():
              break read
            elif line.isNilOrWhitespace():
              break read
            elif line.startsWith("/env"):
              envblock = true
              metablock = false
              mublockplay = false
              mublockloop = false
              fmblock = false
              wavblock = false
              break read
            elif line.startsWith("/wav"):
              wavblock = true
              metablock = false
              mublockplay = false
              mublockloop = false
              fmblock = false
              envblock = false
              break read
            elif line.startsWith("/fm"):
              fmblock = true
              metablock = false
              mublockplay = false
              mublockloop = false
              envblock = false
              wavblock = false
              break read
            elif line.startsWith("/mu1"):
              mublockplay = true
              fmblock = false
              metablock = false
              mublockloop = false
              envblock = false
              wavblock = false
              break read
            elif line.startsWith("/mu2"):
              mublockloop = true
              fmblock = false
              metablock = false
              mublockplay = false
              envblock = false
              wavblock = false
              break read
            elif metablock and line.startsWith("name="):
              name = line
              name.removePrefix("name=")
              break read
            elif metablock and line.startsWith("artist="):
              artist = line
              name.removePrefix("artist=")
              break read
            elif metablock and line.endsWith("hz"):
              var templine = line
              templine.removeSuffix("hz")
              tickrate = templine.parseInt().int16
              break read
            elif mublockplay or mublockloop:
              if mublockplay:
                result.add(("mP", line))
                break read
              else:
                result.add(("mL", line))
                break read
            elif envblock and not line.isNilOrEmpty():
    119       result.add(("e", line))
              break read
            elif wavblock and not line.isNilOrEmpty():
              result.add(("w", line))
              break read
            elif fmblock and not line.isNilOrEmpty():
              result.add(("f", line))
              break read
            else:
              break read
      return
    

The code being read is in [this link 
](https://github.com/kinkinkijkin/kPMML/blob/master/examples/referenceexample4.txt)

File exists.

SIGSEGV happens after reading the first 6 lines (up to /env)

Possibly a bug?

Reply via email to