Nim Version
Nim Compiler Version 2.2.10 [Linux: amd64]
Compiled at 2026-05-27
Copyright (c) 2006-2026 by Andreas Rumpf
active boot switches: -d:release
Nim Compiler Version 2.2.11 [Linux: amd64]
Compiled at 2026-07-27
Copyright (c) 2006-2026 by Andreas Rumpf
git hash: a0d09f01c511b40800d93e8ad23cfcf8939fffed
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2026-07-27
Copyright (c) 2006-2026 by Andreas Rumpf
git hash: 2d8114929450ad621a2ef0108bbf1267c45145fc
active boot switches: -d:release
Description
var b: string
proc p(): string {.gcsafe.} =
when nimvm:
doAssert false
result = b
discard p()
The GC safety should only be an issue in the compiletime/VM environment. Outside of that, it doesn't access globals/violate GC safety. If one removes {.gcsafe.}, it runs and does not assert at runtime, i.e. that result = b effect has not fired.
Current Output
/tmp/w.nim(2, 6) Error: 'p' is not GC-safe as it accesses 'b' which is a global using GC'ed memory
Expected Output
Not tracking VM-only effects in runtime-only codepaths
Known Workarounds
No response
Additional Information
No response
Nim Version
Description
The GC safety should only be an issue in the compiletime/VM environment. Outside of that, it doesn't access globals/violate GC safety. If one removes
{.gcsafe.}, it runs and does not assert at runtime, i.e. thatresult = beffect has not fired.Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response