fixed compile time excl cause SIGSEGV #3639

This commit is contained in:
jangko
2015-12-17 10:14:48 +07:00
parent a3c8bb9376
commit 60a400eeb0
2 changed files with 28 additions and 1 deletions

View File

@@ -611,7 +611,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
addSon(regs[ra].node, r.copyTree)
of opcExcl:
decodeB(rkNode)
var b = newNodeIT(nkCurly, regs[rb].node.info, regs[rb].node.typ)
var b = newNodeIT(nkCurly, regs[ra].node.info, regs[ra].node.typ)
addSon(b, regs[rb].regToNode)
var r = diffSets(regs[ra].node, b)
discardSons(regs[ra].node)

27
tests/vm/texcl.nim Normal file
View File

@@ -0,0 +1,27 @@
discard """
output: '''false'''
"""
import macros
type
nlOptions = enum
nloNone
nloDebug
var nlOpts {.compileTime.} = {nloDebug}
proc initOpts(): set[nlOptions] =
result.incl nloDebug
result.incl nloNone
result.excl nloDebug
const cOpts = initOpts()
macro nlo(): stmt =
nlOpts.incl(nloNone)
nlOpts.excl(nloDebug)
result = newEmptyNode()
nlo()
echo nloDebug in cOpts