aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/go.dg/arrayclear.go
blob: aa5ba0761d70106b2c5f4b75c63346dea70b0e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do compile }
// { dg-options "-fgo-debug-optimization" }
// This comment is necessary to work around a dejagnu bug. Otherwise, the
// column of the second error message would equal the row of the first one, and
// since the errors are also identical, dejagnu is not able to distinguish them.

package p

var a [10]int

func arrayClear() {
	for i := range a { // { dg-error "array range clear" }
		a[i] = 0
	}
}

var s []int

func sliceClear() {
	for i := range s { // { dg-error "array range clear" }
		s[i] = 0
	}
}