Skip to content

Commit

Permalink
Update upstream source from tag 'upstream/1.12.1'
Browse files Browse the repository at this point in the history
Update to upstream version '1.12.1'
with Debian dir 5e50a41ac9aadf60300054353011999ebfd1dd51
  • Loading branch information
hnakamur committed Mar 15, 2019
2 parents 6f35746 + 5a06b2b commit d479d57
Show file tree
Hide file tree
Showing 38 changed files with 661 additions and 172 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
go1.12
go1.12.1
1 change: 1 addition & 0 deletions doc/contrib.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h3 id="release"><a href="/doc/devel/release.html">Release History</a></h3>
<p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>

<ul>
<li><a href="/doc/go1.12">Go 1.12</a> <small>(February 2019)</small></li>
<li><a href="/doc/go1.11">Go 1.11</a> <small>(August 2018)</small></li>
<li><a href="/doc/go1.10">Go 1.10</a> <small>(February 2018)</small></li>
<li><a href="/doc/go1.9">Go 1.9</a> <small>(August 2017)</small></li>
Expand Down
30 changes: 30 additions & 0 deletions doc/devel/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ <h2 id="go1.12">go1.12 (released 2019/02/25)</h2>
Read the <a href="/doc/go1.12">Go 1.12 Release Notes</a> for more information.
</p>

<p>
go1.12.1 (released 2019/03/14) includes fixes to cgo, the compiler, the go
command, and the <code>fmt</code>, <code>net/smtp</code>, <code>os</code>,
<code>path/filepath</code>, <code>sync</code>, and <code>text/template</code>
packages. See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.1">Go
1.12.1 milestone</a> on our issue tracker for details.
</p>

<h2 id="go1.11">go1.11 (released 2018/08/24)</h2>

<p>
Expand Down Expand Up @@ -73,6 +81,21 @@ <h3 id="go1.11.minor">Minor revisions</h3>
1.11.4 milestone</a> on our issue tracker for details.
</p>

<p>
go1.11.5 (released 2019/01/23) includes a security fix to the
<code>crypto/elliptic</code> package. See
the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.5">Go
1.11.5 milestone</a> on our issue tracker for details.
</p>

<p>
go1.11.6 (released 2019/03/14) includes fixes to cgo, the compiler, linker,
runtime, go command, and the <code>crypto/x509</code>, <code>encoding/json</code>,
<code>net</code>, and <code>net/url</code> packages. See the
<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.6">Go
1.11.6 milestone</a> on our issue tracker for details.
</p>

<h2 id="go1.10">go1.10 (released 2018/02/16)</h2>

<p>
Expand Down Expand Up @@ -138,6 +161,13 @@ <h3 id="go1.10.minor">Minor revisions</h3>
Go 1.10.7 milestone</a> on our issue tracker for details.
</p>

<p>
go1.10.8 (released 2019/01/23) includes a security fix to the
<code>crypto/elliptic</code> package. See
the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.8">Go
1.10.8 milestone</a> on our issue tracker for details.
</p>

<h2 id="go1.9">go1.9 (released 2017/08/24)</h2>

<p>
Expand Down
33 changes: 22 additions & 11 deletions doc/go1.12.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ <h3 id="modules">Modules</h3>
that build fails.
</p>

<p><!-- CL 147282, 147281 -->
This changed use of the <code>go</code> directive means that if you
use Go 1.12 to build a module, thus recording <code>go 1.12</code>
in the <code>go.mod</code> file, you will get an error when
attempting to build the same module with Go 1.11 through Go 1.11.3.
Go 1.11.4 or later will work fine, as will releases older than Go 1.11.
If you must use Go 1.11 through 1.11.3, you can avoid the problem by
setting the language version to 1.11, using the Go 1.12 go tool,
via <code>go mod edit -go=1.11</code>.
</p>

<p><!-- CL 152739 -->
When an import cannot be resolved using the active modules,
the <code>go</code> command will now try to use the modules mentioned in the
Expand Down Expand Up @@ -600,17 +611,6 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>

</dl><!-- io -->

<dl id="lib/time"><dt><a href="/pkg/lib/time/">lib/time</a></dt>
<dd>
<p><!-- CL 151299 -->
The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
has been updated to version 2018i. Note that this ZIP file is
only used if a time zone database is not provided by the operating
system.
</p>

</dl><!-- lib/time -->

<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
<dd>
<p><!-- CL 153059 -->
Expand Down Expand Up @@ -924,6 +924,17 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
</p>
</dl><!-- text/template -->

<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
<dd>
<p><!-- CL 151299 -->
The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
has been updated to version 2018i. Note that this ZIP file is
only used if a time zone database is not provided by the operating
system.
</p>

</dl><!-- time -->

<dl id="unsafe"><dt><a href="/pkg/unsafe/">unsafe</a></dt>
<dd>
<p><!-- CL 146058 -->
Expand Down
14 changes: 14 additions & 0 deletions misc/cgo/test/testdata/issue30527.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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 30527: function call rewriting casts untyped
// constants to int because of ":=" usage.

package cgotest

import "cgotest/issue30527"

func issue30527G() {
issue30527.G(nil)
}
19 changes: 19 additions & 0 deletions misc/cgo/test/testdata/issue30527/a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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 issue30527

import "math"

/*
#include <inttypes.h>
static void issue30527F(char **p, uint64_t mod, uint32_t unused) {}
*/
import "C"

func G(p **C.char) {
C.issue30527F(p, math.MaxUint64, 1)
C.issue30527F(p, 1<<64-1, Z)
}
11 changes: 11 additions & 0 deletions misc/cgo/test/testdata/issue30527/b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// 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 issue30527

const (
X = 1 << iota
Y
Z
)
12 changes: 12 additions & 0 deletions src/cmd/asm/internal/asm/testdata/arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
ORRW $0x1b000, R2, R3 // ORRW $110592, R2, R3 // 1b0096523b00a07243001b2a
TSTW $0x500000, R1 // TSTW $5242880, R1 // 1b0aa0523f001b6a
TSTW $0xff00ff, R1 // TSTW $16711935, R1 // 3f9c0072
TSTW $0x60060, R5 // TSTW $393312, R5 // 1b0c8052db00a072bf001b6a
TSTW $0x6006000060060, R5 // TSTW $1689262177517664, R5 // 1b0c8052db00a072bf001b6a
ANDW $0x6006000060060, R5 // ANDW $1689262177517664, R5 // 1b0c8052db00a072a5001b0a
ANDSW $0x6006000060060, R5 // ANDSW $1689262177517664, R5 // 1b0c8052db00a072a5001b6a
EORW $0x6006000060060, R5 // EORW $1689262177517664, R5 // 1b0c8052db00a072a5001b4a
ORRW $0x6006000060060, R5 // ORRW $1689262177517664, R5 // 1b0c8052db00a072a5001b2a
BICW $0x6006000060060, R5 // BICW $1689262177517664, R5 // 1b0c8052db00a072a5003b0a
EONW $0x6006000060060, R5 // EONW $1689262177517664, R5 // 1b0c8052db00a072a5003b4a
ORNW $0x6006000060060, R5 // ORNW $1689262177517664, R5 // 1b0c8052db00a072a5003b2a
BICSW $0x6006000060060, R5 // BICSW $1689262177517664, R5 // 1b0c8052db00a072a5003b6a
ADDW $0x60060, R2 // ADDW $393312, R2 // 4280011142804111
CMPW $0x60060, R2 // CMPW $393312, R2 // 1b0c8052db00a0725f001b6b

AND $8, R0, RSP // 1f007d92
ORR $8, R0, RSP // 1f007db2
Expand Down
12 changes: 0 additions & 12 deletions src/cmd/cgo/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,6 @@ func (f *File) saveExprs(x interface{}, context astContext) {
}
case *ast.CallExpr:
f.saveCall(x, context)
case *ast.GenDecl:
if x.Tok == token.CONST {
for _, spec := range x.Specs {
vs := spec.(*ast.ValueSpec)
if vs.Type == nil {
for _, name := range spec.(*ast.ValueSpec).Names {
consts[name.Name] = true
}
}
}
}

}
}

Expand Down
64 changes: 11 additions & 53 deletions src/cmd/cgo/gcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,21 +897,16 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
needsUnsafe = true
}

// Explicitly convert untyped constants to the
// parameter type, to avoid a type mismatch.
if p.isConst(f, arg) {
ptype := p.rewriteUnsafe(param.Go)
// Use "var x T = ..." syntax to explicitly convert untyped
// constants to the parameter type, to avoid a type mismatch.
ptype := p.rewriteUnsafe(param.Go)

if !p.needsPointerCheck(f, param.Go, args[i]) || param.BadPointer {
if ptype != param.Go {
needsUnsafe = true
}
arg = &ast.CallExpr{
Fun: ptype,
Args: []ast.Expr{arg},
}
}

if !p.needsPointerCheck(f, param.Go, args[i]) {
fmt.Fprintf(&sb, "_cgo%d := %s; ", i, gofmtPos(arg, origArg.Pos()))
fmt.Fprintf(&sb, "var _cgo%d %s = %s; ", i,
gofmtLine(ptype), gofmtPos(arg, origArg.Pos()))
continue
}

Expand Down Expand Up @@ -1254,47 +1249,6 @@ func (p *Package) isType(t ast.Expr) bool {
return false
}

// isConst reports whether x is an untyped constant expression.
func (p *Package) isConst(f *File, x ast.Expr) bool {
switch x := x.(type) {
case *ast.BasicLit:
return true
case *ast.SelectorExpr:
id, ok := x.X.(*ast.Ident)
if !ok || id.Name != "C" {
return false
}
name := f.Name[x.Sel.Name]
if name != nil {
return name.IsConst()
}
case *ast.Ident:
return x.Name == "nil" ||
strings.HasPrefix(x.Name, "_Ciconst_") ||
strings.HasPrefix(x.Name, "_Cfconst_") ||
strings.HasPrefix(x.Name, "_Csconst_") ||
consts[x.Name]
case *ast.UnaryExpr:
return p.isConst(f, x.X)
case *ast.BinaryExpr:
return p.isConst(f, x.X) && p.isConst(f, x.Y)
case *ast.ParenExpr:
return p.isConst(f, x.X)
case *ast.CallExpr:
// Calling the builtin function complex on two untyped
// constants returns an untyped constant.
// TODO: It's possible to construct a case that will
// erroneously succeed if there is a local function
// named "complex", shadowing the builtin, that returns
// a numeric type. I can't think of any cases that will
// erroneously fail.
if id, ok := x.Fun.(*ast.Ident); ok && id.Name == "complex" && len(x.Args) == 2 {
return p.isConst(f, x.Args[0]) && p.isConst(f, x.Args[1])
}
}
return false
}

// isVariable reports whether x is a variable, possibly with field references.
func (p *Package) isVariable(x ast.Expr) bool {
switch x := x.(type) {
Expand Down Expand Up @@ -2511,13 +2465,16 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
// Treat this typedef as a uintptr.
s := *sub
s.Go = c.uintptr
s.BadPointer = true
sub = &s
// Make sure we update any previously computed type.
if oldType := typedef[name.Name]; oldType != nil {
oldType.Go = sub.Go
oldType.BadPointer = true
}
}
t.Go = name
t.BadPointer = sub.BadPointer
if unionWithPointer[sub.Go] {
unionWithPointer[t.Go] = true
}
Expand All @@ -2527,6 +2484,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
if oldType == nil {
tt := *t
tt.Go = sub.Go
tt.BadPointer = sub.BadPointer
typedef[name.Name] = &tt
}

Expand Down
4 changes: 1 addition & 3 deletions src/cmd/cgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ type File struct {
Edit *edit.Buffer
}

// Untyped constants in the current package.
var consts = make(map[string]bool)

func (f *File) offset(p token.Pos) int {
return fset.Position(p).Offset
}
Expand Down Expand Up @@ -154,6 +151,7 @@ type Type struct {
Go ast.Expr
EnumValues map[string]int64
Typedef string
BadPointer bool
}

// A FuncType collects information about a function type in both the C and Go worlds.
Expand Down
40 changes: 33 additions & 7 deletions src/cmd/compile/internal/gc/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,14 +1130,40 @@ func (o *Order) expr(n, lhs *Node) *Node {
}

case OANDAND, OOROR:
mark := o.markTemp()
n.Left = o.expr(n.Left, nil)
// ... = LHS && RHS
//
// var r bool
// r = LHS
// if r { // or !r, for OROR
// r = RHS
// }
// ... = r

r := o.newTemp(n.Type, false)

// Evaluate left-hand side.
lhs := o.expr(n.Left, nil)
o.out = append(o.out, typecheck(nod(OAS, r, lhs), ctxStmt))

// Evaluate right-hand side, save generated code.
saveout := o.out
o.out = nil
t := o.markTemp()
rhs := o.expr(n.Right, nil)
o.out = append(o.out, typecheck(nod(OAS, r, rhs), ctxStmt))
o.cleanTemp(t)
gen := o.out
o.out = saveout

// Clean temporaries from first branch at beginning of second.
// Leave them on the stack so that they can be killed in the outer
// context in case the short circuit is taken.
n.Right = addinit(n.Right, o.cleanTempNoPop(mark))
n.Right = o.exprInPlace(n.Right)
// If left-hand side doesn't cause a short-circuit, issue right-hand side.
nif := nod(OIF, r, nil)
if n.Op == OANDAND {
nif.Nbody.Set(gen)
} else {
nif.Rlist.Set(gen)
}
o.out = append(o.out, nif)
n = r

case OCALLFUNC,
OCALLINTER,
Expand Down
Loading

0 comments on commit d479d57

Please sign in to comment.