mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: fix inappropriate array copy
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. Fixed #32579 Change-Id: I3cb78becff4f8035d66fc5536e5b52857eacaa3d Reviewed-on: https://go-review.googlesource.com/c/go/+/183458 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
4ae3835aa2
commit
38fc0afca6
3 changed files with 15 additions and 0 deletions
|
|
@ -1256,6 +1256,8 @@ func (p *Package) isVariable(x ast.Expr) bool {
|
|||
return true
|
||||
case *ast.SelectorExpr:
|
||||
return p.isVariable(x.X)
|
||||
case *ast.IndexExpr:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue