fixes a critical GC safety inference bug (#10615)
* fixes a critical GC safety inference bug * make nimsuggest compile again * make Nimble compile again
This commit is contained in:
parent
aed8766e84
commit
c86b1fbcac
7 changed files with 65 additions and 34 deletions
21
tests/effects/tgcsafe3.nim
Normal file
21
tests/effects/tgcsafe3.nim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
discard """
|
||||
errormsg: "'myproc' is not GC-safe as it accesses 'global_proc' which is a global using GC'ed memory"
|
||||
line: 12
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
var useGcMem = "string here"
|
||||
|
||||
var global_proc: proc(a: string) {.nimcall.} = proc (a: string) =
|
||||
echo useGcMem
|
||||
|
||||
proc myproc(i: int) {.gcsafe.} =
|
||||
when false:
|
||||
if global_proc != nil:
|
||||
echo "a"
|
||||
if isNil(global_proc):
|
||||
return
|
||||
|
||||
global_proc("ho")
|
||||
|
||||
myproc(0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue