• Ian Lance Taylor's avatar
    [release-branch.go1.12] cmd/cgo: fix inappropriate array copy · 77c14d29
    Ian Lance Taylor authored
    Ensure that during rewriting of expressions that take the address of
    an array, that we properly recognize *ast.IndexExpr as an operation
    to create a pointer variable and thus assign the proper addressOf
    and deference operators as "&" and "*" respectively.
    
    This fixes a regression from CL 142884.
    
    This is a backport of CLs 183458 and 183778 to the 1.12 release branch.
    It is not a cherry pick because the code in misc/cgo/test has changed.
    
    Updates #32579
    Fixes #32756
    
    Change-Id: I0daa75ec62cccbe82ab658cb2947f51423e0c235
    Reviewed-on: https://go-review.googlesource.com/c/go/+/183627
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
    77c14d29
cgo_test.go 5.79 KB