-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
This is an issue separated from #23188.
What version of Go are you using (go version
)?
go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
yes
Description
sorry, this issue is a little complex, so I don't use the issue report template.
First, the behaviors of gc and gccgo are different for the following program.
package main
import "fmt"
func f(p *int) int {
*p = 123
return *p
}
func main() {
var x int
y, z := x, f(&x)
fmt.Println(y, z) // gc: 123 123. gccgo: 0 123
}
But, the behaviors of the two compiler are the same for the following modified version.
I think here gccgo is inconsistent with itself.
package main
import "fmt"
func f(p *int) int {
*p = 123
return *p
}
func main() {
var x int
x, z := x, f(&x)
fmt.Println(x, z)// both: 123 123
}
There is certainly a bug in gccgo (may be also not, as spec really doesn't specify the order).
Whether or not it is a bug for gc is not specified in Go spec.
However, I think, it is best to specify the order in Go spec (if it is possible).
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.