-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requestfalse-negativethe issue can create a false-negativethe issue can create a false-negativevet-botthe issue is part of VetBot's responsibilitythe issue is part of VetBot's responsibility
Milestone
Description
Pointer comparisons are another important way in which a reference to a range-loop variable can be misused. It's possible for Go code to compare two pointers using == or !=. Although this may not be a very commonly used feature, someone might be using it, so we should check -- it will be interesting to see what we find.
For instance, the below loop will have different semantics after the change. We need to report anywhere we find it.
func main() {
var y int
for _, x := range []int{1,2,3,4} {
bar(&x, &y)
}
}
func bar(x, y *int) {
if x == y {
fmt.Printf("memory address %p found before %p", x, y)
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfalse-negativethe issue can create a false-negativethe issue can create a false-negativevet-botthe issue is part of VetBot's responsibilitythe issue is part of VetBot's responsibility