Commit graph

19466 commits

Author SHA1 Message Date
Russ Cox 9dd062b82e undo CL 102820043 / b0ce6dbafc18
Breaks 386 and arm builds.
The obvious reason is that this CL only edited 6g/gsubr.c
and failed to edit 5g/gsubr.c and 8g/gsubr.c.
However, the obvious CL applying the same edit to those
files (CL 101900043) causes mysterious build failures
in various of the standard package tests, usually involving
reflect. Something deep and subtle is broken but only on
the 32-bit systems.

Undo this CL for now.

««« original CL description
cmd/gc: fix x=x crash

The 'nodarg' function is used to obtain a Node*
representing a function argument or result.
It returned a brand new Node*, but that violates
the guarantee in most places in the compiler that
two Node*s refer to the same variable if and only if
they are the same Node* pointer. Reestablish that
invariant by making nodarg return a preexisting
named variable if present.

Having fixed that, avoid any copy during x=x in
componentgen, because the VARDEF we emit
before the copy marks the lhs x as dead incorrectly.

The change in walk.c avoids modifying the result
of nodarg. This was the only place in the compiler
that did so.

Fixes #8097.

LGTM=r, khr
R=golang-codereviews, r, khr
CC=golang-codereviews, iant
https://golang.org/cl/102820043
»»»

TBR=r
CC=golang-codereviews, khr
https://golang.org/cl/95660043
2014-05-28 21:46:20 -04:00
Russ Cox 948b2c722b cmd/gc: fix x=x crash
The 'nodarg' function is used to obtain a Node*
representing a function argument or result.
It returned a brand new Node*, but that violates
the guarantee in most places in the compiler that
two Node*s refer to the same variable if and only if
they are the same Node* pointer. Reestablish that
invariant by making nodarg return a preexisting
named variable if present.

Having fixed that, avoid any copy during x=x in
componentgen, because the VARDEF we emit
before the copy marks the lhs x as dead incorrectly.

The change in walk.c avoids modifying the result
of nodarg. This was the only place in the compiler
that did so.

Fixes #8097.

LGTM=r, khr
R=golang-codereviews, r, khr
CC=golang-codereviews, iant
https://golang.org/cl/102820043
2014-05-28 19:50:19 -04:00
Andrew Gerrand 0627fa84b7 misc/makerelease: upload files to Google Cloud Storage
LGTM=bradfitz
R=jasonhall, bradfitz
CC=golang-codereviews
https://golang.org/cl/91700047
2014-05-29 08:40:15 +10:00
Russ Cox c038c38ac1 doc/go1.3.html: math/big's Int and Rat implement TextMarshaler, TextUnmarshaler
Update #8112

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/95640043
2014-05-28 15:48:35 -04:00
Russ Cox 6c10e64a90 regexp: hide one-pass code from exported API
Update #8112

Hide one-pass regexp API.

This means moving the code from regexp/syntax to regexp,
but it avoids being locked into the specific API chosen for
the implementation.

It also removes a slice field from the syntax.Inst, which
should avoid bloating the memory footprint of a non-one-pass
regexp unnecessarily.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/98610046
2014-05-28 14:08:44 -04:00
Russ Cox 0782ee3ad5 cmd/cgo: given typedef struct S T, make C.T and C.struct_S interchangeable
For incomplete struct S, C.T and C.struct_S were interchangeable in Go 1.2
and earlier, because all incomplete types were interchangeable
(even C.struct_S1 and C.struct_S2).

CL 76450043, which fixed issue 7409, made different incomplete types
different from Go's point of view, so that they were no longer completely
interchangeable.

However, imprecision about C.T and C.struct_S - really the same
underlying C type - is the one behavior enabled by the bug that
is most likely to be depended on by existing cgo code.
Explicitly allow it, to keep that code working.

Fixes #7786.

LGTM=iant, r
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/98580046
2014-05-28 14:04:31 -04:00
Robert Griesemer 94849d5a78 spec: clarify that break/continue do not work across function boundaries
Also made it extra clear for goto statements (even though label scopes
are already limited to the function defining a label).

Fixes #8040.

LGTM=r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/99550043
2014-05-28 08:43:47 -07:00
Brad Fitzpatrick ef25861222 mime: sort attributes in FormatMediaType
Map iteration order issue. Go 1.2 and earlier had stable results
for small maps.

Fixes #8115

LGTM=r, rsc
R=golang-codereviews, r
CC=dsymonds, golang-codereviews, iant, rsc
https://golang.org/cl/98580047
2014-05-28 08:16:09 -07:00
Brad Fitzpatrick 9665ce19af api: update next.txt
LGTM=rsc
R=golang-codereviews, rsc
CC=adg, golang-codereviews
https://golang.org/cl/99530044
2014-05-27 22:10:57 -07:00
Russ Cox 4895f0dc5e test/run: limit parallelism to 1 for cross-exec builds
This matters for NaCl, which seems to swamp my 4-core MacBook Pro otherwise.
It's not a correctness problem, just a usability problem.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/98600046
2014-05-28 01:01:08 -04:00
Russ Cox d432238fad test: expand issue7863 test
This was sitting in my client but I forgot hg add.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/101800045
2014-05-27 21:53:39 -07:00
Dmitriy Vyukov b5caa02067 runtime: fix go of nil func value
Currently runtime derefences nil with m->locks>0,
which causes unrecoverable fatal error.
Panic instead.
Fixes #8045.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr
https://golang.org/cl/97620043
2014-05-28 00:00:01 -04:00
Russ Cox 8a2db409c4 cmd/gc: fix race compilation failure 'non-orig name'
CL 51010045 fixed the first one of these:

        cmd/gc: return canonical Node* from temp

        For historical reasons, temp was returning a copy
        of the created Node*, not the original Node*.
        This meant that if analysis recorded information in the
        returned node (for example, n->addrtaken = 1), the
        analysis would not show up on the original Node*, the
        one kept in fn->dcl and consulted during liveness
        bitmap creation.

        Correct this, and watch for it when setting addrtaken.

        Fixes #7083.

        R=khr, dave, minux.ma
        CC=golang-codereviews
        https://golang.org/cl/51010045

CL 53200043 fixed the second:

        cmd/gc: fix race build

        Missed this case in CL 51010045.

        TBR=khr
        CC=golang-codereviews
        https://golang.org/cl/53200043

This CL fixes the third. There are only three nod(OXXX, ...)
calls in sinit.c, so maybe we're done. Embarassing that it
took three CLs to find all three.

Fixes #8028.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, iant
https://golang.org/cl/100800046
2014-05-27 23:59:27 -04:00
Russ Cox ceb982e004 cmd/gc: fix defer copy(x, <-c)
In the first very rough draft of the reordering code
that was introduced in the Go 1.3 cycle, the pre-allocated
temporary for a ... argument was held in n->right.
It moved to n->alloc but the code avoiding n->right
was left behind in order.c. In copy(x, <-c), the receive
is in n->right and must be processed. Delete the special
case code, removing the bug.

Fixes #8039.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/100820044
2014-05-27 23:59:06 -04:00
Russ Cox daf9308066 cmd/gc: fix infinite loop in nil check removal
Fixes #8076.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/93610043
2014-05-27 23:58:49 -04:00
Russ Cox 6c0bcb1863 cmd/gc: fix method value closures on nacl amd64p32
The code was assuming that pointer alignment is the
maximum alignment, but on NaCl uint64 alignment is
even more strict.

Brad checked in the test earlier today; this fixes the build.

Fixes #7863.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/98630046
2014-05-27 23:58:36 -04:00
Jan Ziak eeb87c3660 cmd/go: do not miss an error if import path contains "cmd/something"
Fixes #7638

LGTM=rsc
R=rsc, adg, robert.hencke, bradfitz
CC=golang-codereviews
https://golang.org/cl/89280043
2014-05-27 23:58:03 -04:00
Russ Cox 74ce581b06 cmd/gc: fix conversion of runtime constant
The code cannot have worked before, because it was
trying to use the old value in a range check for the new
type, which might have a different representation
(hence the 'internal compiler error').

Fixes #8073.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/98630045
2014-05-27 21:38:19 -04:00
Keith Randall 3d1c3e1e26 runtime: stack copier should handle nil defers without faulting.
fixes #8047

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/101800043
2014-05-27 16:26:08 -07:00
Brad Fitzpatrick bd401baef2 test: add test for fixed issue 7863
Fixes #7863

LGTM=rsc
R=rsc, ruiu
CC=golang-codereviews
https://golang.org/cl/98610045
2014-05-27 16:01:43 -07:00
Rob Pike 7f638e9023 cmd/go: improve error message when import path contains http://
Common mistake (at least for me) because hg etc. require the prefix
while the go command forbids it.

Before:
% go get http://code.google.com/p/go.text/unicode/norm
package http:/code.google.com/p/go.text/unicode/norm: unrecognized import path "http:/code.google.com/p/go.text/unicode/norm"

After:
% go get http://code.google.com/p/go.text/unicode/norm
package http:/code.google.com/p/go.text/unicode/norm: "http://" not allowed in import path

LGTM=ruiu, rsc
R=rsc, ruiu
CC=golang-codereviews
https://golang.org/cl/97630046
2014-05-27 14:37:36 -07:00
Dmitriy Vyukov 0a8ce65c7a misc: properly spell Chrome in doc
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/99440046
2014-05-26 19:20:45 +04:00
Dave Cheney 8a2fb87b99 runtime: skip stack growth test on 32bit platforms
Update #8083

See discussion in https://groups.google.com/forum/#!topic/golang-dev/dh6Ra_xJomc

LGTM=khr
R=golang-codereviews, gobot, khr
CC=golang-codereviews
https://golang.org/cl/99440048
2014-05-25 08:38:59 +10:00
Keith Randall 4b3019b17c doc: mention that reflect.SetMapIndex no longer panics
when deleting from a nil map.  See issue 8051.

LGTM=r
R=golang-codereviews, r, khr
CC=golang-codereviews
https://golang.org/cl/96540051
2014-05-23 17:39:58 -07:00
Alex Brainman 05cc78d8d3 os: document that Interrupt might not work on every os
Fixes #6720.

LGTM=bradfitz
R=golang-codereviews, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/92340043
2014-05-23 12:29:29 +10:00
Robert Griesemer 2c83f1eaf9 spec: explicitly disallow blank methods in interface types
The spec was unclear about whether blank methods should be
permitted in interface types. gccgo permits at most one, gc
crashes if there are more than one, go/types permits at most
one.

Discussion:

Since method sets of non-interface types never contain methods
with blank names (blank methods are never declared), it is impossible
to satisfy an interface with a blank method.

It is possible to declare variables of assignable interface types
(but not necessarily identical types) containing blank methods, and
assign those variables to each other, but the values of those
variables can only be nil.

There appear to be two "reasonable" alternatives:

1) Permit at most one blank method (since method names must be unique),
and consider it part of the interface. This is what appears to happen
now, with corner-case bugs. Such interfaces can never be implemented.

2) Permit arbitrary many blank methods but ignore them. This appears
to be closer to the handling of blank identifiers in declarations.
However, an interface type literal is not a declaration (it's a type
literal). Also, for struct types, blank identifiers are not ignored;
so the analogy with declarations is flawed.

Both these alternatives don't seem to add any benefit and are likely
(if only slightly) more complicated to explain and implement than
disallowing blank methods in interfaces altogether.

Fixes #6604.

LGTM=r, rsc, iant
R=r, rsc, ken, iant
CC=golang-codereviews
https://golang.org/cl/99410046
2014-05-22 12:23:25 -07:00
Russ Cox 8d8dab34eb doc/go1.3.html: change uintptr to integer in unsafe.Pointer section
The key property here is what the bit pattern represents,
not what its type is. Storing 5 into a pointer is the problem.
Storing a uintptr that holds pointer bits back into a pointer
is not as much of a problem, and not what we are claiming
the runtime will detect.

Longer discussion at
https://groups.google.com/d/msg/golang-nuts/dIGISmr9hw0/0jO4ce85Eh0J

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/98370045
2014-05-22 11:45:03 -04:00
Pietro Gagliardi 5eb585f211 cmd/cgo: explicitly state that #cgo directives across multiple files are concatenated
This is a quick documentation change/clarification, as this
confused me before: in my own cgo-based projects, I currently have
identical #cgo directives in each relevant source file, and I notice
with go build -x that cgo is combining the directives, leading to
pkg-config invocations with the same package name (gtk+-3.0, in my
case) repeated several times, or on Mac OS X, LDFLAGS listing
-framework Foundation -framework AppKit multiple times. Since I am
about to add a CFLAGS as well, I checked the source to cmd/cgo and
go/build (where the work is actually done) to see if that still holds
true there. Hopefully other people who have made the same mistake I
have (I don't know if anyone has) can remove the excess declarations
now; this should make things slightly easier to manage as well.

LGTM=iant
R=golang-codereviews, gobot, iant
CC=golang-codereviews
https://golang.org/cl/91520046
2014-05-21 16:01:54 -07:00
Ian Lance Taylor 86e2a8edef A+C: Pietro Gagliardi (individual CLA)
Generated by addca.

R=gobot
CC=golang-codereviews
https://golang.org/cl/97660043
2014-05-21 16:01:41 -07:00
Emil Hessman 52abddb712 doc: fix typo in sharemem codewalk
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98460045
2014-05-21 14:34:20 -07:00
Keith Randall cee8bcabfa runtime: provide gc maps for the reflect.callXX frames.
Update #8030

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/100620045
2014-05-21 14:28:34 -07:00
Anthony Martin eb34288ad1 cmd/objdump: fix dissasembly of Plan 9 object files
Ignore symbols that aren't text, data, or bss since they cause
problems when dissassembling instructions with small immediate
values.

Before:
        build.go:142    0x10ee  83ec50      SUBL $text/template/parse.autotmp_1293(SB), SP

After:
        build.go:142    0x10ee  83ec50      SUBL $0x50, SP

Fixes #7947.

LGTM=rsc
R=rsc, 0intro
CC=golang-codereviews
https://golang.org/cl/93520045
2014-05-21 23:24:38 +02:00
Russ Cox cab54408da test: fix two typos in float_lit2.go
Noted by gri in CL 100660044 review but I missed them.

TBR=gri
CC=golang-codereviews
https://golang.org/cl/97570049
2014-05-21 17:19:12 -04:00
Russ Cox 2de449e7a0 test/float_lit2.go: rewrite to test values near boundaries
Add larger comment explaining testing methodology,
and derive tests arithmetically.

(These tests are checking rounding again; the derived
tests they replace were checking exact values.)

LGTM=r, gri
R=gri, r
CC=golang-codereviews
https://golang.org/cl/100660044
2014-05-21 17:12:06 -04:00
Russ Cox 1be479df92 cmd/gc: fix floating point rounding again
Passes the expanded test in CL 100660044,
which gives me some confidence that it
might be right.

(The old code failed by not considering all the
low bits.)

LGTM=r
R=golang-codereviews, r, bradfitz
CC=golang-codereviews, iant, khr
https://golang.org/cl/99410051
2014-05-21 17:11:52 -04:00
Rob Pike 4464ae280f fmt: fix floating-point padding once and for all
Rewrite formatFloat to be much simpler and clearer and
avoid the tricky interaction with padding.
The issue refers to complex but the problem is just floating-point.
The new tests added were incorrectly formatted before this fix.
Fixes #8064.

LGTM=jscrockett01, rsc
R=rsc, jscrockett01
CC=golang-codereviews
https://golang.org/cl/99420048
2014-05-21 12:30:43 -07:00
Russ Cox f9c6ad9b6b cmd/go: fix coverage for 'package foo_test' tests
Fixes #8062.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/91610046
2014-05-21 13:59:14 -04:00
Ian Lance Taylor 708304bea2 cmd/go: check for SWIG version that is too old to use
Fixes #7983.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews, rsc
https://golang.org/cl/96540044
2014-05-21 10:39:23 -07:00
Robert Griesemer e22705bf8b test/float_lit2.go: fix constants for 386 platforms (fix build)
LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/95480045
2014-05-21 09:15:07 -07:00
Robert Griesemer 765b4a3f86 test/float_lit2.go: compute test values from first principles
These constants pass go/types constant conversions as well.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/91590047
2014-05-21 08:53:47 -07:00
Ian Lance Taylor 7d4cb4d63f database/sql/driver: correct method name in comment
Fixes #8061.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/93520046
2014-05-21 06:48:41 -07:00
Benny Siegert 775719c600 cmd/ld: correctly compute note size on NetBSD.
Patch from http://gnats.NetBSD.org/48811.

LGTM=iant
R=golang-codereviews, minux.ma, iant
CC=golang-codereviews, tk
https://golang.org/cl/94670047
2014-05-21 06:18:45 -07:00
Ian Lance Taylor f85600859d cmd/ld: really import runtime/cgo for external link
Fixes #8032.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/95580043
2014-05-20 21:36:50 -07:00
Andrew Gerrand 80f0a7df26 tag go1.3beta1 and go1.3beta2
LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/100660043
2014-05-21 13:23:24 +10:00
Robert Griesemer c00043b5d8 spec: specify order of init() calls
The spec did not specify the order in which
init() functions are called. Specify that
they are called in source order since we have
now also specified the initialization order
of independent variables.

While technically a language change, no
existing code could have relied on this,
so this should not break anything.

Per suggestion from rsc.

LGTM=r, iant
R=rsc, iant, r, ken
CC=golang-codereviews
https://golang.org/cl/98420046
2014-05-20 17:46:08 -07:00
Keith Randall cb6cb42ede reflect: don't panic on delete from nil map.
Fixes #8051

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/95560046
2014-05-20 16:26:04 -07:00
Robert Griesemer a43669843b spec: clarify section on package initialization
- split description of package initialization and
  program execution
- better grouping of concerns in section on package
  initialization
- more explicit definition of what constitues a
  dependency
- removed language about constant dependencies -
  they are computed at compile-time and not
  initialized at run-time
- clarified that independent variables are initialized
  in declaration order (rather than reference order)

Note that the last clarification is what distinguishes
gc and gccgo at the moment: gc uses reference order
(i.e., order in which variables are referenced in
initialization expressions), while gccgo uses declaration
order for independent variables.

Not a language change. But adopting this CL will
clarify what constitutes a dependency.

Fixes #6703.

LGTM=adonovan, r, iant, rsc
R=r, rsc, iant, ken, adonovan
CC=golang-codereviews
https://golang.org/cl/99020043
2014-05-20 13:51:39 -07:00
Rob Pike 4d36ad7791 doc/go_spec.html: fix broken anchor tag
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/99420045
2014-05-20 11:57:58 -07:00
Rob Pike 87ef6e9156 doc/install.html: fix duplicate id= tag
LGTM=minux.ma
R=adg, minux.ma
CC=golang-codereviews
https://golang.org/cl/95540045
2014-05-20 11:57:21 -07:00
Shenghou Ma ca6be91cbc all: fix "the the" typos.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93470043
2014-05-20 14:42:07 -04:00