cmd/cgo: spurious pointer check for pointer to int
struct field
#30245
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I understand the rule Go code may pass a Go pointer to C provided the Go memory to which it points does not contain any Go pointers. But something wired happened while I pass parameters to C functions.
Code example 1 & 2 are sample codes for the problem.
In the code example 1 I passed
&f.a
to the C function and go runtime capturedcgo argument has Go pointer to Go pointer
error. I think no go pointers is inf.a
.And in code example 2 I changed attribute a to a point and the code could run peacefully.
I didn't see any big differences between example 1 and 2. Why code exapmle 1 panic?
What did you expect to see?
example 1 and example 2 have the same result
What did you see instead?
output of code example 1:
example 2 is ok.
The text was updated successfully, but these errors were encountered: