Commit 88d719f8 authored by Than McIntosh's avatar Than McIntosh

go/internal/gccgoimporter: test case for issue 30628

Test case for a panic/crash in gccgoimporter caused by incorrect gccgo
export data emission. Note that the *.gox file checked in contains the
correct export data; the main intent of the test is to make sure that
gccgo produces the right export data when run on the Go source.

Updates #30628

Change-Id: I29c0c17b81a43f92ff64fbfcdc58fdb46a5be370
Reviewed-on: https://go-review.googlesource.com/c/go/+/165739
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 05b3db24
...@@ -91,6 +91,7 @@ var importerTests = [...]importerTest{ ...@@ -91,6 +91,7 @@ var importerTests = [...]importerTest{
{pkgpath: "v1reflect", name: "Type", want: "type Type interface{Align() int; AssignableTo(u Type) bool; Bits() int; ChanDir() ChanDir; Elem() Type; Field(i int) StructField; FieldAlign() int; FieldByIndex(index []int) StructField; FieldByName(name string) (StructField, bool); FieldByNameFunc(match func(string) bool) (StructField, bool); Implements(u Type) bool; In(i int) Type; IsVariadic() bool; Key() Type; Kind() Kind; Len() int; Method(int) Method; MethodByName(string) (Method, bool); Name() string; NumField() int; NumIn() int; NumMethod() int; NumOut() int; Out(i int) Type; PkgPath() string; Size() uintptr; String() string; common() *commonType; rawString() string; runtimeType() *runtimeType; uncommon() *uncommonType}"}, {pkgpath: "v1reflect", name: "Type", want: "type Type interface{Align() int; AssignableTo(u Type) bool; Bits() int; ChanDir() ChanDir; Elem() Type; Field(i int) StructField; FieldAlign() int; FieldByIndex(index []int) StructField; FieldByName(name string) (StructField, bool); FieldByNameFunc(match func(string) bool) (StructField, bool); Implements(u Type) bool; In(i int) Type; IsVariadic() bool; Key() Type; Kind() Kind; Len() int; Method(int) Method; MethodByName(string) (Method, bool); Name() string; NumField() int; NumIn() int; NumMethod() int; NumOut() int; Out(i int) Type; PkgPath() string; Size() uintptr; String() string; common() *commonType; rawString() string; runtimeType() *runtimeType; uncommon() *uncommonType}"},
{pkgpath: "nointerface", name: "I", want: "type I int"}, {pkgpath: "nointerface", name: "I", want: "type I int"},
{pkgpath: "issue29198", name: "FooServer", want: "type FooServer struct{FooServer *FooServer; user string; ctx context.Context}"}, {pkgpath: "issue29198", name: "FooServer", want: "type FooServer struct{FooServer *FooServer; user string; ctx context.Context}"},
{pkgpath: "issue30628", name: "Apple", want: "type Apple struct{hey sync.RWMutex; x int; RQ [517]struct{Count uintptr; NumBytes uintptr; Last uintptr}}"},
} }
func TestGoxImporter(t *testing.T) { func TestGoxImporter(t *testing.T) {
......
package issue30628
import (
"os"
"sync"
)
const numR = int32(os.O_TRUNC + 5)
type Apple struct {
hey sync.RWMutex
x int
RQ [numR]struct {
Count uintptr
NumBytes uintptr
Last uintptr
}
}
v3;
package issue30628
pkgpath issue30628
import os os "os"
import sync sync "sync"
init cpu internal..z2fcpu..import poll internal..z2fpoll..import testlog internal..z2ftestlog..import io io..import os os..import runtime runtime..import sys runtime..z2finternal..z2fsys..import sync sync..import syscall syscall..import time time..import
init_graph 1 0 1 3 1 5 1 6 1 7 1 8 1 9 3 0 3 5 3 6 3 7 4 0 4 1 4 2 4 3 4 5 4 6 4 7 4 8 4 9 5 0 5 6 7 0 7 5 7 6 8 0 8 5 8 6 8 7 9 0 9 5 9 6 9 7 9 8
types 13 2 24 84 208 17 30 41 147 86 17 64 25 75
type 1 "Apple" <type 2>
type 2 struct { .issue30628.hey <type 3>; .issue30628.x <type -11>; RQ <type 11>; }
type 3 "sync.RWMutex" <type 7>
func (rw <type 4>) Lock ()
func (rw <esc:0x12> <type 4>) RLocker () ($ret8 <type 5>)
func (rw <type 4>) RUnlock ()
func (rw <type 4>) Unlock ()
func (rw <type 4>) RLock ()
type 4 *<type 3>
type 5 "sync.Locker" <type 6>
type 6 interface { Lock (); Unlock (); }
type 7 struct { .sync.w <type 8>; .sync.writerSem <type -7>; .sync.readerSem <type -7>; .sync.readerCount <type -3>; .sync.readerWait <type -3>; }
type 8 "sync.Mutex" <type 10>
func (m <type 9>) Unlock ()
func (m <type 9>) Lock ()
type 9 *<type 8>
type 10 struct { .sync.state <type -3>; .sync.sema <type -7>; }
type 11 [517 ] <type 12>
type 12 struct { Count <type -13>; NumBytes <type -13>; Last <type -13>; }
checksum 199DCF6D3EE2FCF39F715B4E42B5F87F5B15D3AF
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment