Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparing function pointer with nil marks the proc as not gcsafe #6955

Closed
cooldome opened this issue Dec 20, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@cooldome
Copy link
Member

commented Dec 20, 2017

Comparing function pointer with nil in proc body marks this proc as not gcsafe, while calling the same function pointer does not have this problem.
The following is deduced as not gcsafe

var global_proc: proc(a: string): int {.nimcall.} = nil

proc myproc(i: int) {.gcsafe.} =
  if global_proc != nil:
    echo "a"

This is gcsafe:

var global_proc: proc(a: string): int {.nimcall.} = nil

proc myproc2(i: int) {.gcsafe.} =
  global_proc("a")

@cooldome cooldome changed the title Comparing function pointer with nil marks marks the proc as not gcsafe Comparing function pointer with nil marks the proc as not gcsafe Dec 20, 2017

@Araq Araq closed this in c6fdf93 Feb 9, 2019

Araq added a commit that referenced this issue Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.