fixes #576
This commit is contained in:
parent
51672aef72
commit
f1e789bfc2
3 changed files with 6 additions and 3 deletions
|
|
@ -231,7 +231,8 @@ type
|
||||||
sfVolatile, # variable is volatile
|
sfVolatile, # variable is volatile
|
||||||
sfRegister, # variable should be placed in a register
|
sfRegister, # variable should be placed in a register
|
||||||
sfPure, # object is "pure" that means it has no type-information
|
sfPure, # object is "pure" that means it has no type-information
|
||||||
|
# enum is "pure", its values need qualified access
|
||||||
|
# variable is "pure"; it's an explicit "global"
|
||||||
sfNoSideEffect, # proc has no side effects
|
sfNoSideEffect, # proc has no side effects
|
||||||
sfSideEffect, # proc may have side effects; cannot prove it has none
|
sfSideEffect, # proc may have side effects; cannot prove it has none
|
||||||
sfMainModule, # module is the main module
|
sfMainModule, # module is the main module
|
||||||
|
|
|
||||||
|
|
@ -151,8 +151,9 @@ proc genSingleVar(p: BProc, a: PNode) =
|
||||||
var targetProc = p
|
var targetProc = p
|
||||||
var immediateAsgn = a.sons[2].kind != nkEmpty
|
var immediateAsgn = a.sons[2].kind != nkEmpty
|
||||||
if sfGlobal in v.flags:
|
if sfGlobal in v.flags:
|
||||||
if v.owner.kind != skModule:
|
if sfPure in v.flags:
|
||||||
targetProc = p.module.postInitProc
|
# v.owner.kind != skModule:
|
||||||
|
targetProc = p.module.preInitProc
|
||||||
assignGlobalVar(targetProc, v)
|
assignGlobalVar(targetProc, v)
|
||||||
# XXX: be careful here.
|
# XXX: be careful here.
|
||||||
# Global variables should not be zeromem-ed within loops
|
# Global variables should not be zeromem-ed within loops
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
of wGlobal:
|
of wGlobal:
|
||||||
noVal(it)
|
noVal(it)
|
||||||
incl(sym.flags, sfGlobal)
|
incl(sym.flags, sfGlobal)
|
||||||
|
incl(sym.flags, sfPure)
|
||||||
of wMerge:
|
of wMerge:
|
||||||
noval(it)
|
noval(it)
|
||||||
incl(sym.flags, sfMerge)
|
incl(sym.flags, sfMerge)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue