1
0
mirror of https://github.com/golang/go synced 2024-11-11 19:51:37 -07:00

test: add fixed GoSmith bugs reported on the gcc Bugzilla

Change-Id: I36b57f3e299a4f96b8b5aa55c9c224d888229684
Reviewed-on: https://go-review.googlesource.com/1790
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Chris Manghane 2014-12-18 09:54:32 -08:00
parent c85a2bf9c2
commit edf7258416
11 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61204: Making temporaries for zero-sized types caused an ICE in gccgo.
// This is a reduction of a program reported by GoSmith.
package main
func main() {
type t [0]int
var v t
v, _ = [0]int{}, 0
_ = v
}

View File

@ -0,0 +1,19 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61244: Type descriptors expressions were not traversed, causing an ICE
// in gccgo when producing the backend representation.
// This is a reduction of a program reported by GoSmith.
package main
const a = 0
func main() {
switch i := (interface{})(a); i.(type) {
case [0]string:
}
}

View File

@ -0,0 +1,17 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61246: Switch conditions could be untyped, causing an ICE when the
// conditions were lowered into temporaries.
// This is a reduction of a program reported by GoSmith.
package main
func main() {
switch 1 != 1 {
default:
}
}

View File

@ -0,0 +1,14 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61248: Transformations to recover calls made them fail typechecking in gccgo.
package main
func main() {
var f func(int, interface{})
go f(0, recover())
}

View File

@ -0,0 +1,20 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61253: gccgo incorrectly parsed the
// `RecvStmt = ExpressionList "=" RecvExpr` production.
package main
func main() {
c := make(chan int)
v := new(int)
b := new(bool)
select {
case (*v), (*b) = <-c:
}
}

View File

@ -0,0 +1,13 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61254: gccgo failed to compile a slice expression with missing indices.
package main
func main() {
[][]int{}[:][0][0]++
}

View File

@ -0,0 +1,13 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61255: gccgo failed to compile IncDec statements on variadic functions.
package main
func main() {
append([]byte{}, 0)[0]++
}

View File

@ -0,0 +1,13 @@
// run
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61258: gccgo crashed when deleting a zero-sized key from a map.
package main
func main() {
delete(make(map[[0]bool]int), [0]bool{})
}

View File

@ -0,0 +1,13 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61264: IncDec statements involving composite literals caused in ICE in gccgo.
package main
func main() {
map[int]int{}[0]++
}

View File

@ -0,0 +1,16 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61265: The gccgo middle-end failed to represent array composite literals
// where the elements are zero-sized values.
// This is a reduction of a program reported by GoSmith.
package p
var a = [1][0]int{B}[0]
var B = [0]int{}
var c = [1]struct{}{D}[0]
var D = struct{}{}

View File

@ -0,0 +1,16 @@
// compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// PR61273: gccgo failed to compile a SendStmt in the PostStmt of a ForClause
// that involved predefined constants.
package main
func main() {
c := make(chan bool, 1)
for ; false; c <- false {
}
}