Skip to content

cmd/compile: for range loop reading past slice end #40367

@greyhu

Description

@greyhu

What version of Go are you using (go version)?

1.13.5,1.14.6

Does this issue reproduce with the latest release?

yes!

What operating system and processor architecture are you using (go env)?

linux,amd64

What did you do?

try this in playground

package main
import "fmt"
func main() {
        rates:=[]int32{1,2,3,4,5,6}
	for star, rate := range rates {
		if star+1 < 1 {
			panic("")
		}

		fmt.Println(star, rate)
	}
}

What did you expect to see?

0,1
1,2
2,3
3,4
4,5
5,6

What did you see instead?

timeout running program
0 1
1 2
2 3
3 4
4 5
5 6
6 180344
7 192
8 4846592
9 0
10 180424
11 192
12 4846720
13 0
14 5822560
15 192
16 438224
17 192
18 4396406
19 0
20 385024
.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions