You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An output of "11 2" indicates that m[0] was evaluated twice: once indexing into the old slice/map to read the value 1, and then once into the new to store the value 11.
Notably, gccgo outputs "12 2" for slices, but cmd/compile outputs "11 2" for slices, and both output "11 2" for maps.
The Go spec says "An assignment operation x op= y where op is a binary arithmetic operator is equivalent to x = x op (y) but evaluates x only once."
I think for both of these sample programs the only valid outputs are "2 2" and "12 2":
An output of "11 2" indicates that m[0] was evaluated twice: once indexing into the old slice/map to read the value 1, and then once into the new to store the value 11.
Notably, gccgo outputs "12 2" for slices, but cmd/compile outputs "11 2" for slices, and both output "11 2" for maps.
/cc @griesemer @ianlancetaylor
The text was updated successfully, but these errors were encountered: