Skip to content

Commit

Permalink
Merge pull request #3651 from jangko/vm_'excl'
Browse files Browse the repository at this point in the history
fixed compile time `excl ` cause SIGSEGV #3639
  • Loading branch information
Araq committed Dec 20, 2015
2 parents 17a78f4 + 60a400e commit 86bb9d8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/vm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,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)
Expand Down
27 changes: 27 additions & 0 deletions tests/vm/texcl.nim
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 86bb9d8

Please sign in to comment.