diff options
author | Araq <rumpf_a@web.de> | 2017-10-14 22:12:23 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-10-14 22:35:20 +0200 |
commit | 9af94803404963ad7cb5969c8321ec0a526939d8 (patch) | |
tree | 9181b4cbf705c8eb5b20c8c6d88c592f1f70063f /compiler | |
parent | 5768eaa2fdc92ffbb1ba767a09da8bef3968c40e (diff) | |
download | Nim-9af94803404963ad7cb5969c8321ec0a526939d8.tar.gz |
fixes #5620
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sempass2.nim | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 9ce317f80..e9a1160e5 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -19,18 +19,6 @@ when defined(useDfa): # # * effect+exception tracking # * "usage before definition" checking -# * checks for invalid usages of compiletime magics (not implemented) -# * checks for invalid usages of NimNode (not implemented) -# * later: will do an escape analysis for closures at least - -# Predefined effects: -# io, time (time dependent), gc (performs GC'ed allocation), exceptions, -# side effect (accesses global), store (stores into *type*), -# store_unknown (performs some store) --> store(any)|store(x) -# load (loads from *type*), recursive (recursive call), unsafe, -# endless (has endless loops), --> user effects are defined over *patterns* -# --> a TR macro can annotate the proc with user defined annotations -# --> the effect system can access these # ------------------------ exception and tag tracking ------------------------- @@ -593,6 +581,9 @@ proc trackOperand(tracked: PEffects, n: PNode, paramType: PType) = if paramType != nil and paramType.kind == tyVar: if n.kind == nkSym and isLocalVar(tracked, n.sym): makeVolatile(tracked, n.sym) + if paramType != nil and paramType.kind == tyProc and tfGcSafe in paramType.flags: + if tfGcSafe notin a.typ.flags and not tracked.inEnforcedGcSafe: + localError(n.info, $n & " is not GC safe") notNilCheck(tracked, n, paramType) proc breaksBlock(n: PNode): bool = |