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

casting unsafe.Pointer to *foo #492

Closed
gopherbot opened this issue Jan 3, 2010 · 6 comments
Closed

casting unsafe.Pointer to *foo #492

gopherbot opened this issue Jan 3, 2010 · 6 comments

Comments

@gopherbot
Copy link
Contributor

by kai.backman2:

repro on both 6g/darwin and 5g:

package main

import (
    "unsafe"
)

func main() {

    // works
    addr := uintptr(0xfffff400)
    _ = (*int)(unsafe.Pointer(addr))

    // fails
    _ = (*int)(unsafe.Pointer(uintptr(0xfffff400)))
}
@rsc
Copy link
Contributor

rsc commented Jan 19, 2010

Comment 1:

added test/bugs/bug246.go

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jan 19, 2010

Comment 2:

I think we agree that (*int)(unsafe.Pointer(uintptr(0xfffff400))) should work.
It's not clear to me whether making it work is a bug fix or a language change.

Labels changed: added languagechange.

@robpike
Copy link
Contributor

robpike commented Jan 19, 2010

Comment 3:

the spec says
Any pointer or value of type uintptr can be converted into a Pointer and vice versa.
that says to me: not a language change but a bug.

@gopherbot
Copy link
Contributor Author

Comment 4 by kai.backman2:

fixed labels

Labels changed: removed languagechange.

@gopherbot
Copy link
Contributor Author

Comment 5 by kai.backman2:

Owner changed to ---.

@rsc
Copy link
Contributor

rsc commented Feb 2, 2010

Comment 6:

Owner changed to r...@golang.org.

Status changed to Fixed.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants