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

--gc:arc SIGSEGV with ptr aliasing #13137

Closed
timotheecour opened this issue Jan 14, 2020 · 3 comments
Closed

--gc:arc SIGSEGV with ptr aliasing #13137

timotheecour opened this issue Jan 14, 2020 · 3 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Jan 14, 2020

--gc:arc gives SIGSEGV in snippet below; it works without --gc:arc

Example

when true:
  var x = "abc"
  let y: ptr char = addr x[0]
  echo y[]
  y[] = 'A'
  echo x

Current Output

a
Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t0919.nim(118) t0919
SIGBUS: Illegal storage access. (Attempt to read from nil?)

Expected Output

a
Abc

Additional Information

@Araq
Copy link
Member

Araq commented Jan 14, 2020

I'm afraid this cannot be supported with the new string implementation. You have to call ensureNoLiteral(x) first, an API we don't have yet (?)

The implementation for this is in nimPrepareStrMutationV2.

@cooldome
Copy link
Member

Closed as won't fix

@timotheecour
Copy link
Member Author

I think closing is premature; there are things that can be done to at least improve things here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants