• Matthew Dempsky's avatar
    cmd/compile: handle unsafe.Pointer(f()) correctly · c65647d6
    Matthew Dempsky authored
    Previously statements like
    
        f(unsafe.Pointer(g()), int(h()))
    
    would be reordered into a sequence of statements like
    
        autotmp_g := g()
        autotmp_h := h()
        f(unsafe.Pointer(autotmp_g), int(autotmp_h))
    
    which can leave g's temporary value on the stack as a uintptr, rather
    than an unsafe.Pointer. Instead, recognize uintptr-to-unsafe.Pointer
    conversions when reordering function calls to instead produce:
    
        autotmp_g := unsafe.Pointer(g())
        autotmp_h := h()
        f(autotmp_g, int(autotmp_h))
    
    Fixes #15329.
    
    Change-Id: I2cdbd89d233d0d5c94791513a9fd5fd958d11ed5
    Reviewed-on: https://go-review.googlesource.com/22273
    Run-TryBot: Matthew Dempsky <mdempsky@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    c65647d6
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...
yacc Loading commit data...