-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
From chatting on Gitter, I been asked to post this as a bug from @dom96
toSeq(lookupTable.values) seems to be causing a SIGSEGV, here is my full code.
import
tables, deques, sequtils
const
lookupTable = {'(': ')', '{': '}', '[': ']'}.toTable
proc isPaired*(value: string): bool =
var stack = initDeque[char]()
for item in value:
echo "Looking at " & item
if item in lookupTable:
stack.addLast(item)
if item in toSeq(lookupTable.values):
if stack.len == 0:
return false
if lookupTable[stack.popLast()] != item:
return false
return stack.len == 0➜ bracket-push nimble build --verbose
Setting Nim stdlib prefix to
Setting Nim stdlib path to /Users/ascotti/.choosenim/toolchains/nim-0.18.0/lib
Verifying dependencies for bracket_push@0.1.0
Building bracket_push/bracket_push using c backend
Error: Build failed for package: bracket_push
... Details:
... Execution failed with exit code 1
... Command: "/Users/ascotti/.nimble/bin/nim" c --noBabelPath -o:"/Users/ascotti/Documents/code/nim/bracket-push/bracket_push" "/Users/ascotti/Documents/code/nim/bracket-push/src/bracket_push.nim"
... Output: Hint: used config file '/Users/ascotti/.choosenim/toolchains/nim-0.18.0/config/nim.cfg' [Conf]
... Hint: system [Processing]
... Hint: bracket_push [Processing]
... Hint: tables [Processing]
... Hint: hashes [Processing]
... Hint: strutils [Processing]
... Hint: parseutils [Processing]
... Hint: math [Processing]
... Hint: algorithm [Processing]
... Hint: deques [Processing]
... Hint: sequtils [Processing]
... Hint: macros [Processing]
... SIGSEGV: Illegal storage access. (Attempt to read from nil?)
This is using nim version 0.18.0,
nim --version
Nim Compiler Version 0.18.0 [MacOSX: amd64]
Copyright (c) 2006-2018 by Andreas Rumpf
git hash: 855956bf617f68ac0be3717329e9e1181e5dc0c6
active boot switches: -d:release