Commit f71a5e3c authored by Tobias Quathamer's avatar Tobias Quathamer

New upstream version 1.13~rc1

parent d94ec360
This diff is collapsed.
go1.13beta1
\ No newline at end of file
go1.13rc1
\ No newline at end of file
......@@ -39,6 +39,8 @@ pkg debug/dwarf, method (*UnsupportedType) String() string
pkg debug/dwarf, type UnsupportedType struct
pkg debug/dwarf, type UnsupportedType struct, embedded CommonType
pkg debug/dwarf, type UnsupportedType struct, Tag Tag
pkg debug/elf, type Symbol struct, Library string
pkg debug/elf, type Symbol struct, Version string
pkg encoding/csv, method (*ParseError) Unwrap() error
pkg encoding/json, method (*MarshalerError) Unwrap() error
pkg errors, func As(error, interface{}) bool
......@@ -209,8 +211,6 @@ pkg net/http, type Transport struct, ForceAttemptHTTP2 bool
pkg net/http, type Transport struct, ReadBufferSize int
pkg net/http, type Transport struct, WriteBufferSize int
pkg net, method (*DNSConfigError) Unwrap() error
pkg net, method (*DNSError) Is(error) bool
pkg net, method (*OpError) Is(error) bool
pkg net, method (*OpError) Unwrap() error
pkg net, type DNSError struct, IsNotFound bool
pkg net, type ListenConfig struct, KeepAlive time.Duration
......@@ -237,8 +237,6 @@ pkg os (netbsd-arm64), const O_SYNC = 128
pkg os (netbsd-arm64), const O_TRUNC = 1024
pkg os (netbsd-arm64), const PathListSeparator = 58
pkg os (netbsd-arm64), const PathSeparator = 47
pkg os, var ErrTemporary error
pkg os, var ErrTimeout error
pkg path/filepath (netbsd-arm64-cgo), const ListSeparator = 58
pkg path/filepath (netbsd-arm64-cgo), const Separator = 47
pkg path/filepath (netbsd-arm64), const ListSeparator = 58
......@@ -8021,9 +8019,6 @@ pkg syscall (windows-amd64), type SysProcAttr struct, ThreadAttributes *Security
pkg testing, func Init()
pkg testing, method (*B) ReportMetric(float64, string)
pkg testing, type BenchmarkResult struct, Extra map[string]float64
pkg text/scanner, const AllowDigitSeparators = 1024
pkg text/scanner, const AllowDigitSeparators ideal-int
pkg text/scanner, const GoTokens = 2036
pkg text/template, method (ExecError) Unwrap() error
pkg time, method (Duration) Microseconds() int64
pkg time, method (Duration) Milliseconds() int64
......
......@@ -377,8 +377,11 @@ func (w *Watchdog) Start() {
<h2 id="Supported_Systems">Supported Systems</h2>
<p>
The race detector runs on <code>darwin/amd64</code>, <code>freebsd/amd64</code>,
<code>linux/amd64</code>, and <code>windows/amd64</code>.
The race detector runs on
<code>linux/amd64</code>, <code>linux/ppc64le</code>,
<code>linux/arm64</code>, <code>freebsd/amd64</code>,
<code>netbsd/amd64</code>, <code>darwin/amd64</code>,
and <code>windows/amd64</code>.
</p>
<h2 id="Runtime_Overheads">Runtime Overhead</h2>
......
......@@ -590,27 +590,37 @@ Here follow some descriptions of key Go-specific details for the supported archi
<p>
The runtime pointer to the <code>g</code> structure is maintained
through the value of an otherwise unused (as far as Go is concerned) register in the MMU.
A OS-dependent macro <code>get_tls</code> is defined for the assembler if the source includes
a special header, <code>go_asm.h</code>:
An OS-dependent macro <code>get_tls</code> is defined for the assembler if the source is
in the <code>runtime</code> package and includes a special header, <code>go_tls.h</code>:
</p>
<pre>
#include "go_asm.h"
#include "go_tls.h"
</pre>
<p>
Within the runtime, the <code>get_tls</code> macro loads its argument register
with a pointer to the <code>g</code> pointer, and the <code>g</code> struct
contains the <code>m</code> pointer.
There's another special header containing the offsets for each
element of <code>g</code>, called <code>go_asm.h</code>.
The sequence to load <code>g</code> and <code>m</code> using <code>CX</code> looks like this:
</p>
<pre>
#include "go_tls.h"
#include "go_asm.h"
...
get_tls(CX)
MOVL g(CX), AX // Move g into AX.
MOVL g_m(AX), BX // Move g.m into BX.
</pre>
<p>
Note: The code above works only in the <code>runtime</code> package, while <code>go_tls.h</code> also
applies to <a href="#arm">arm</a>, <a href="#amd64">amd64</a> and amd64p32, and <code>go_asm.h</code> applies to all architectures.
</p>
<p>
Addressing modes:
</p>
......
......@@ -238,14 +238,16 @@ $ git codereview help
</pre>
<p>
prints help text, not an error.
prints help text, not an error. If it prints an error, make sure that
<code>$GOPATH/bin</code> is in your <code>$PATH</code>.
</p>
<p>
On Windows, when using git-bash you must make sure that
<code>git-codereview.exe</code> is in your <code>git</code> exec-path.
Run <code>git --exec-path</code> to discover the right location then create a
symbolic link or just copy the executable from $GOPATH/bin to this directory.
symbolic link or just copy the executable from <code>$GOPATH/bin</code> to this
directory.
</p>
......
......@@ -77,6 +77,27 @@ the go command, and the <code>crypto/x509</code>, <code>net/http</code>, and
1.12.6 milestone</a> on our issue tracker for details.
</p>
<p>
go1.12.7 (released 2019/07/08) includes fixes to cgo, the compiler,
and the linker.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.7">Go
1.12.7 milestone</a> on our issue tracker for details.
</p>
<p>
go1.12.8 (released 2019/08/13) includes security fixes to the
<code>net/http</code> and <code>net/url</code> packages.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.8">Go
1.12.8 milestone</a> on our issue tracker for details.
</p>
<p>
go1.12.9 (released 2019/08/15) includes fixes to the linker,
and the <code>os</code> and <code>math/big</code> packages.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.9+label%3ACherryPickApproved">Go
1.12.9 milestone</a> on our issue tracker for details.
</p>
<h2 id="go1.11">go1.11 (released 2018/08/24)</h2>
<p>
......@@ -168,6 +189,19 @@ See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.11">Go
1.11.11 milestone</a> on our issue tracker for details.
</p>
<p>
go1.11.12 (released 2019/07/08) includes fixes to the compiler and the linker.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.12">Go
1.11.12 milestone</a> on our issue tracker for details.
</p>
<p>
go1.11.13 (released 2019/08/13) includes security fixes to the
<code>net/http</code> and <code>net/url</code> packages.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.13">Go
1.11.13 milestone</a> on our issue tracker for details.
</p>
<h2 id="go1.10">go1.10 (released 2018/02/16)</h2>
<p>
......
......@@ -2282,8 +2282,8 @@ The <code>crypto/cipher</code> interfaces look like this:
<pre>
type Block interface {
BlockSize() int
Encrypt(src, dst []byte)
Decrypt(src, dst []byte)
Encrypt(dst, src []byte)
Decrypt(dst, src []byte)
}
type Stream interface {
......
......@@ -80,6 +80,10 @@ Do not send CLs removing the interior tags from such phrases.
checks for private API usage. Since it is considered private,
<code>syscall.Getdirentries</code> now always fails with
<code>ENOSYS</code> on iOS.
Additionally, <a href="/pkg/syscall/#Setrlimit"><code>syscall.Setrlimit</code></a>
reports <code>invalid</code> <code>argument</code> in places where it historically
succeeded. These consequences are not specific to Go and users should expect
behavioral parity with <code>libSystem</code>'s implementation going forward.
</p>
<h2 id="tools">Tools</h2>
......
This diff is collapsed.
......@@ -373,7 +373,7 @@ which can be useful information when debugging deadlocks or performance issues.
<p>
A new package <a href="/pkg/debug/plan9obj/"><code>debug/plan9obj</code></a> was added to the standard library.
It implements access to Plan 9 <a href="http://plan9.bell-labs.com/magic/man2html/6/a.out">a.out</a> object files.
It implements access to Plan 9 <a href="https://9p.io/magic/man2html/6/a.out">a.out</a> object files.
</p>
<h3 id="major_library_changes">Major changes to the library</h3>
......
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of May 14, 2019",
"Subtitle": "Version of July 31, 2019",
"Path": "/ref/spec"
}-->
......@@ -1257,11 +1257,19 @@ non-<a href="#Blank_identifier">blank</a> name.
</p>
<pre>
// A simple File interface
// A simple File interface.
interface {
Read(b Buffer) bool
Write(b Buffer) bool
Close()
Read([]byte) (int, error)
Write([]byte) (int, error)
Close() error
}
</pre>
<pre>
interface {
String() string
String() string // illegal: String not unique
_(x int) // illegal: method must have non-blank name
}
</pre>
......@@ -1272,9 +1280,9 @@ have the method set
</p>
<pre>
func (p T) Read(b Buffer) bool { return … }
func (p T) Write(b Buffer) bool { return … }
func (p T) Close() { … }
func (p T) Read(p []byte) (n int, err error) { return … }
func (p T) Write(p []byte) (n int, err error) { return … }
func (p T) Close() error { return … }
</pre>
<p>
......
......@@ -33,7 +33,7 @@ compiler using the GCC back end, see
</p>
<p>
The Go compilers support eight instruction sets.
The Go compilers support nine instruction sets.
There are important differences in the quality of the compilers for the different
architectures.
</p>
......@@ -87,6 +87,12 @@ architectures.
<dd>
Supports Linux binaries. New in 1.7 and not as well exercised as other ports.
</dd>
<dt>
<code>wasm</code> (WebAssembly)
</dt>
<dd>
Targets the WebAssembly platform. New in 1.11 and not as well exercised as other ports.
</dd>
</dl>
<p>
......@@ -134,12 +140,16 @@ For example, <code>$GOROOT_BOOTSTRAP/bin/go</code> should be
the <code>go</code> command binary for the bootstrap toolchain.
</p>
<h3 id="bootstrapFromBinaryRelease">Bootstrap toolchain from binary release</h3>
<p>
To use a binary release as a bootstrap toolchain, see
<a href="/dl/">the downloads page</a> or use any other
packaged Go distribution.
</p>
<h3 id="bootstrapFromSource">Bootstrap toolchain from source</h3>
<p>
To build a bootstrap toolchain from source, use
either the git branch <code>release-branch.go1.4</code> or
......@@ -153,6 +163,17 @@ the environment, and run <code>make.bash</code> (or,
on Windows, <code>make.bat</code>).
</p>
<p>
Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory,
you must keep this git clone instance checked out to branch
<code>release-branch.go1.4</code>. Specifically, do not attempt to reuse
this git clone in the later step named "Fetch the repository." The go1.4
bootstrap toolchain <b>must be able</b> to properly traverse the go1.4 sources
that it assumes are present under this repository root.
</p>
<h3 id="bootstrapFromCrosscompiledSource">Bootstrap toolchain from cross-compiled source</h3>
<p>
To cross-compile a bootstrap toolchain from source, which is
necessary on systems Go 1.4 did not target (for
......@@ -175,6 +196,8 @@ That tree can be copied to a machine of the given target type
and used as <code>GOROOT_BOOTSTRAP</code> to bootstrap a local build.
</p>
<h3 id="bootstrapFromGccgo">Bootstrap toolchain using gccgo</h3>
<p>
To use gccgo as the bootstrap toolchain, you need to arrange
for <code>$GOROOT_BOOTSTRAP/bin/go</code> to be the go tool that comes
......@@ -240,6 +263,11 @@ that if Go is checked out in <code>$HOME/go</code>, it will conflict with
the default location of <code>$GOPATH</code>.
See <a href="#gopath"><code>GOPATH</code></a> below.</p>
Reminder: If you opted to also compile the bootstrap binaries from source (in an
earlier section), you still need to <code>git clone</code> again at this point
(to checkout the latest <code>&lt;tag&gt;</code>), because you must keep your
go1.4 repository distinct.
<h2 id="head">(Optional) Switch to the master branch</h2>
<p>If you intend to modify the go source code, and
......@@ -493,25 +521,45 @@ These default to the values of <code>$GOHOSTOS</code> and
<p>
Choices for <code>$GOOS</code> are
<code>darwin</code> (macOS 10.10 and above and iOS), <code>dragonfly</code>, <code>freebsd</code>,
<code>android</code>, <code>darwin</code> (macOS 10.11 and above and iOS),
<code>dragonfly</code>, <code>freebsd</code>, <code>illumos</code>, <code>js</code>,
<code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
<code>plan9</code>, <code>solaris</code> and <code>windows</code>.
</p>
<p>
Choices for <code>$GOARCH</code> are
<code>amd64</code> (64-bit x86, the most mature port),
<code>386</code> (32-bit x86), <code>arm</code> (32-bit ARM), <code>arm64</code> (64-bit ARM),
<code>ppc64le</code> (PowerPC 64-bit, little-endian), <code>ppc64</code> (PowerPC 64-bit, big-endian),
<code>mips64le</code> (MIPS 64-bit, little-endian), <code>mips64</code> (MIPS 64-bit, big-endian),
<code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian), and
<code>s390x</code> (IBM System z 64-bit, big-endian).
<code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian),
<code>s390x</code> (IBM System z 64-bit, big-endian), and
<code>wasm</code> (WebAssembly 32-bit).
</p>
<p>
The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
<table cellpadding="0">
<tr>
<th width="50"></th><th align="left" width="100"><code>$GOOS</code></th> <th align="left" width="100"><code>$GOARCH</code></th>
</tr>
<tr>
<td></td><td><code>aix</code></td> <td><code>ppc64</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>386</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>arm64</code></td>
</tr>
<tr>
<td></td><td><code>darwin</code></td> <td><code>386</code></td>
</tr>
<tr>
......@@ -536,6 +584,12 @@ The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
<td></td><td><code>freebsd</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>js</code></td> <td><code>wasm</code></td>
</tr>
<tr>
<td></td><td><code>linux</code></td> <td><code>386</code></td>
</tr>
<tr>
......@@ -587,12 +641,18 @@ The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
<td></td><td><code>openbsd</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>openbsd</code></td> <td><code>arm64</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>386</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>solaris</code></td> <td><code>amd64</code></td>
</tr>
<tr>
......
......@@ -8,8 +8,8 @@
# Consult https://www.iana.org/time-zones for the latest versions.
# Versions to use.
CODE=2018i
DATA=2018i
CODE=2019b
DATA=2019b
set -e
rm -rf work
......
No preview for this file type
......@@ -112,6 +112,7 @@ func TestReportsTypeErrors(t *testing.T) {
"issue18452.go",
"issue18889.go",
"issue28721.go",
"issue33061.go",
} {
check(t, file)
}
......
......@@ -156,8 +156,8 @@ var ptrTests = []ptrTest{
// Storing a Go pointer into C memory should fail.
name: "barrier",
c: `#include <stdlib.h>
char **f14a() { return malloc(sizeof(char*)); }
void f14b(char **p) {}`,
char **f14a() { return malloc(sizeof(char*)); }
void f14b(char **p) {}`,
body: `p := C.f14a(); *p = new(C.char); C.f14b(p)`,
fail: true,
expensive: true,
......@@ -167,9 +167,9 @@ var ptrTests = []ptrTest{
// large value should fail.
name: "barrierstruct",
c: `#include <stdlib.h>
struct s15 { char *a[10]; };
struct s15 *f15() { return malloc(sizeof(struct s15)); }
void f15b(struct s15 *p) {}`,
struct s15 { char *a[10]; };
struct s15 *f15() { return malloc(sizeof(struct s15)); }
void f15b(struct s15 *p) {}`,
body: `p := C.f15(); p.a = [10]*C.char{new(C.char)}; C.f15b(p)`,
fail: true,
expensive: true,
......@@ -179,9 +179,9 @@ var ptrTests = []ptrTest{
// copy should fail.
name: "barrierslice",
c: `#include <stdlib.h>
struct s16 { char *a[10]; };
struct s16 *f16() { return malloc(sizeof(struct s16)); }
void f16b(struct s16 *p) {}`,
struct s16 { char *a[10]; };
struct s16 *f16() { return malloc(sizeof(struct s16)); }
void f16b(struct s16 *p) {}`,
body: `p := C.f16(); copy(p.a[:], []*C.char{new(C.char)}); C.f16b(p)`,
fail: true,
expensive: true,
......@@ -191,9 +191,9 @@ var ptrTests = []ptrTest{
// different code path.
name: "barriergcprogarray",
c: `#include <stdlib.h>
struct s17 { char *a[32769]; };
struct s17 *f17() { return malloc(sizeof(struct s17)); }
void f17b(struct s17 *p) {}`,
struct s17 { char *a[32769]; };
struct s17 *f17() { return malloc(sizeof(struct s17)); }
void f17b(struct s17 *p) {}`,
body: `p := C.f17(); p.a = [32769]*C.char{new(C.char)}; C.f17b(p)`,
fail: true,
expensive: true,
......@@ -202,10 +202,10 @@ var ptrTests = []ptrTest{
// Similar case, with a source on the heap.
name: "barriergcprogarrayheap",
c: `#include <stdlib.h>
struct s18 { char *a[32769]; };
struct s18 *f18() { return malloc(sizeof(struct s18)); }
void f18b(struct s18 *p) {}
void f18c(void *p) {}`,
struct s18 { char *a[32769]; };
struct s18 *f18() { return malloc(sizeof(struct s18)); }
void f18b(struct s18 *p) {}
void f18c(void *p) {}`,
imports: []string{"unsafe"},
body: `p := C.f18(); n := &[32769]*C.char{new(C.char)}; p.a = *n; C.f18b(p); n[0] = nil; C.f18c(unsafe.Pointer(n))`,
fail: true,
......@@ -215,10 +215,10 @@ var ptrTests = []ptrTest{
// A GC program with a struct.
name: "barriergcprogstruct",
c: `#include <stdlib.h>
struct s19a { char *a[32769]; };
struct s19b { struct s19a f; };
struct s19b *f19() { return malloc(sizeof(struct s19b)); }
void f19b(struct s19b *p) {}`,
struct s19a { char *a[32769]; };
struct s19b { struct s19a f; };
struct s19b *f19() { return malloc(sizeof(struct s19b)); }
void f19b(struct s19b *p) {}`,
body: `p := C.f19(); p.f = C.struct_s19a{[32769]*C.char{new(C.char)}}; C.f19b(p)`,
fail: true,
expensive: true,
......@@ -227,11 +227,11 @@ var ptrTests = []ptrTest{
// Similar case, with a source on the heap.
name: "barriergcprogstructheap",
c: `#include <stdlib.h>
struct s20a { char *a[32769]; };
struct s20b { struct s20a f; };
struct s20b *f20() { return malloc(sizeof(struct s20b)); }
void f20b(struct s20b *p) {}
void f20c(void *p) {}`,
struct s20a { char *a[32769]; };
struct s20b { struct s20a f; };
struct s20b *f20() { return malloc(sizeof(struct s20b)); }
void f20b(struct s20b *p) {}
void f20c(void *p) {}`,
imports: []string{"unsafe"},
body: `p := C.f20(); n := &C.struct_s20a{[32769]*C.char{new(C.char)}}; p.f = *n; C.f20b(p); n.a[0] = nil; C.f20c(unsafe.Pointer(n))`,
fail: true,
......@@ -242,7 +242,7 @@ var ptrTests = []ptrTest{
name: "export1",
c: `extern unsigned char *GoFn21();`,
support: `//export GoFn21
func GoFn21() *byte { return new(byte) }`,
func GoFn21() *byte { return new(byte) }`,
body: `C.GoFn21()`,
fail: true,
},
......@@ -250,17 +250,17 @@ var ptrTests = []ptrTest{
// Returning a C pointer is fine.
name: "exportok",
c: `#include <stdlib.h>
extern unsigned char *GoFn22();`,
extern unsigned char *GoFn22();`,
support: `//export GoFn22
func GoFn22() *byte { return (*byte)(C.malloc(1)) }`,
func GoFn22() *byte { return (*byte)(C.malloc(1)) }`,
body: `C.GoFn22()`,
},
{
// Passing a Go string is fine.
name: "passstring",
c: `#include <stddef.h>
typedef struct { const char *p; ptrdiff_t n; } gostring23;
gostring23 f23(gostring23 s) { return s; }`,
typedef struct { const char *p; ptrdiff_t n; } gostring23;
gostring23 f23(gostring23 s) { return s; }`,
imports: []string{"unsafe"},
body: `s := "a"; r := C.f23(*(*C.gostring23)(unsafe.Pointer(&s))); if *(*string)(unsafe.Pointer(&r)) != s { panic(r) }`,
},
......@@ -279,12 +279,12 @@ var ptrTests = []ptrTest{
c: `extern void f25();`,
imports: []string{"strings"},
support: `//export GoStr25
func GoStr25() string { return strings.Repeat("a", 2) }`,
func GoStr25() string { return strings.Repeat("a", 2) }`,
body: `C.f25()`,
c1: `#include <stddef.h>
typedef struct { const char *p; ptrdiff_t n; } gostring25;
extern gostring25 GoStr25();
void f25() { GoStr25(); }`,
typedef struct { const char *p; ptrdiff_t n; } gostring25;
extern gostring25 GoStr25();
void f25() { GoStr25(); }`,
fail: true,
},
{
......@@ -295,7 +295,7 @@ var ptrTests = []ptrTest{
// that is, we are testing something that is not unsafe.
name: "ptrdata1",
c: `#include <stdlib.h>
void f26(void* p) {}`,
void f26(void* p) {}`,
imports: []string{"unsafe"},
support: `type S26 struct { p *int; a [8*8]byte; u uintptr }`,
body: `i := 0; p := &S26{u:uintptr(unsafe.Pointer(&i))}; q := (*S26)(C.malloc(C.size_t(unsafe.Sizeof(*p)))); *q = *p; C.f26(unsafe.Pointer(q))`,
......@@ -305,7 +305,7 @@ var ptrTests = []ptrTest{
// Like ptrdata1, but with a type that uses a GC program.
name: "ptrdata2",
c: `#include <stdlib.h>
void f27(void* p) {}`,
void f27(void* p) {}`,
imports: []string{"unsafe"},
support: `type S27 struct { p *int; a [32769*8]byte; q *int; u uintptr }`,
body: `i := 0; p := S27{u:uintptr(unsafe.Pointer(&i))}; q := (*S27)(C.malloc(C.size_t(unsafe.Sizeof(p)))); *q = p; C.f27(unsafe.Pointer(q))`,
......@@ -423,6 +423,15 @@ var ptrTests = []ptrTest{
body: `t := reflect.StructOf([]reflect.StructField{{Name: "MyInt38", Type: reflect.TypeOf(MyInt38(0)), Anonymous: true}}); v := reflect.New(t).Elem(); v.Interface().(Getter38).Get()`,
fail: false,
},
{
// Test that a converted address of a struct field results
// in a check for just that field and not the whole struct.
name: "structfieldcast",
c: `struct S40i { int i; int* p; }; void f40(struct S40i* p) {}`,
support: `type S40 struct { p *int; a C.struct_S40i }`,
body: `s := &S40{p: new(int)}; C.f40((*C.struct_S40i)(&s.a))`,
fail: false,
},
}
func TestPointerChecks(t *testing.T) {
......@@ -466,6 +475,9 @@ func buildPtrTests(t *testing.T) (dir, exe string) {
if err := os.MkdirAll(src, 0777); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(filepath.Join(src, "go.mod"), []byte("module ptrtest"), 0666); err != nil {
t.Fatal(err)
}
// Prepare two cgo inputs: one for standard cgo and one for //export cgo.
// (The latter cannot have C definitions, only declarations.)
......
// 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.
// cgo shouldn't crash if there is an extra argument with a C reference.
package main
// void F(void* p) {};
import "C"
import "unsafe"
func F() {
var i int
C.F(unsafe.Pointer(&i), C.int(0)) // ERROR HERE
}
......@@ -941,3 +941,10 @@ func TestTestInstalledShared(t *testing.T) {
func TestGeneratedMethod(t *testing.T) {
goCmd(t, "install", "-buildmode=shared", "-linkshared", "./issue25065")
}
// Test use of shared library struct with generated hash function.
// Issue 30768.
func TestGeneratedHash(t *testing.T) {
goCmd(nil, "install", "-buildmode=shared", "-linkshared", "./issue30768/issue30768lib")
goCmd(nil, "test", "-linkshared", "./issue30768")
}
// 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 issue30768lib
// S is a struct that requires a generated hash function.
type S struct {