-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add a test for gccgo bug golang#32901
This CL adds a test for gccgo bug golang#32901: not all the type descriptors are registered and thus deduplicated with types created by reflection. It needs a few levels of indirect imports to trigger this bug. Updates golang#32901. Change-Id: Idbd89bedd63fea746769f2687f3f31c9767e5ec0 Reviewed-on: https://go-review.googlesource.com/c/go/+/184718 Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019 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. | ||
|
||
package a | ||
|
||
type T struct { x int } | ||
|
||
func F() interface{} { | ||
return [2]T{} | ||
} | ||
|
||
func P() interface{} { | ||
return &[2]T{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019 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. | ||
|
||
package b | ||
|
||
import "./a" | ||
|
||
func F() interface{} { | ||
return a.F() | ||
} | ||
|
||
func P() interface{} { | ||
return a.P() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2019 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. | ||
|
||
package c | ||
|
||
import "./b" | ||
|
||
func F() interface{} { | ||
go func(){}() // make it non-inlineable | ||
return b.F() | ||
} | ||
|
||
func P() interface{} { | ||
go func(){}() // make it non-inlineable | ||
return b.P() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2019 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. | ||
|
||
package main | ||
|
||
import "./c" | ||
import "reflect" | ||
|
||
func main() { | ||
x := c.F() | ||
p := c.P() | ||
t := reflect.PtrTo(reflect.TypeOf(x)) | ||
tp := reflect.TypeOf(p) | ||
if t != tp { | ||
panic("FAIL") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// rundir | ||
|
||
// Copyright 2019 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. | ||
|
||
// Issue 32901: type descriptor equality bug in gccgo. | ||
|
||
package ignored |