1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:41:28 -06:00
Commit Graph

2145 Commits

Author SHA1 Message Date
Carl Shapiro
14cb1a1da9 test: raise the allocation threshold for chan/select2.go failure
Updates #5282

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8718045
2013-04-12 15:58:34 -07:00
Volker Dobler
a9f1569e7b gc: escape unicode BOM in exported string literals
Fixes #5260.

R=golang-dev, minux.ma, 0xjnml, r
CC=golang-dev
https://golang.org/cl/8658043
2013-04-11 11:45:18 -07:00
Brad Fitzpatrick
1d729b7f59 test: fix mapnan.go build tag
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8491044
2013-04-08 00:09:35 -07:00
Rémy Oudompheng
20e05303fe cmd/gc: properly set variadic flag on method values.
Fixes #5231.

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/8275044
2013-04-08 08:59:33 +02:00
Brad Fitzpatrick
5e21cb7865 test: fix flaky NaN-key map complexity test
Don't measure wall time in map.go. Keep it portable
and only test NaN, but not time.

Move time tests to mapnan.go and only measure user CPU time,
not wall time. It builds on Darwin and Linux, the primary
platforms where people hack on the runtime & in particular
maps. The runtime is shared, though, so we don't need it to
run on all of the platforms.

Fixes flaky build failures like:
http://build.golang.org/log/ba67eceefdeaa1142cb6c990a62fa3ffd8fd73f8

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8479043
2013-04-07 11:56:15 -07:00
Rémy Oudompheng
2d3216f4a8 cmd/gc: fix Offsetof computation.
The offset of an embedded field s.X must be relative to s
and not to the implicit s.Field of which X is a direct field.
Moreover, no indirections may happen on the path.

Fixes #4909.

R=nigeltao, ality, daniel.morsing, iant, gri, r
CC=golang-dev
https://golang.org/cl/8287043
2013-04-05 21:24:07 +02:00
Rémy Oudompheng
4b6ca21271 cmd/gc: be more tolerant with recursive types when checking map types.
A nested TFORW type would push algtype1 into an impossible case.

Fixes #5125.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8213043
2013-04-03 08:18:30 +02:00
Rémy Oudompheng
df9f4f14b9 cmd/gc: do not reuse bool temporaries for composite equality.
Reusing it when multiple comparisons occurred in the same
function call led to bad overwriting.

Fixes #5162.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8174047
2013-04-01 21:01:50 +02:00
Rémy Oudompheng
d815a14718 cmd/5l, cmd/6l, cmd/8l: fix segfault on reading LOCALS for a duplicate definition.
Fixes #5105.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7965043
2013-03-25 22:09:55 +01:00
Russ Cox
ba0dd1f139 cmd/gc: fix line number for 'missing return' in closure
R=ken2
CC=golang-dev
https://golang.org/cl/7838048
2013-03-22 17:50:29 -04:00
Russ Cox
b5cfbda212 cmd/vet: add assembly checker
Fixes #5036.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7531045
2013-03-22 15:14:40 -04:00
Robert Griesemer
f8ff6893a5 test: more systematic shift tests
To be submitted once gc agrees.

R=rsc, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/7861045
2013-03-21 16:56:59 -07:00
Rémy Oudompheng
88b98ff791 cmd/gc: accept ideal float as indices.
Fixes #4813.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7625050
2013-03-22 00:38:23 +01:00
Russ Cox
38e9b0773d cmd/gc: fix escape analysis of method values
R=ken2
CC=golang-dev
https://golang.org/cl/7518050
2013-03-20 23:53:27 -04:00
Daniel Morsing
7c3694c4de cmd/gc: reject methods on non-locals, even if symbol exists
Fixes #5089.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7767044
2013-03-20 22:18:20 +01:00
Russ Cox
d3c758d7d2 cmd/gc: implement method values
R=ken2, ken
CC=golang-dev
https://golang.org/cl/7546052
2013-03-20 17:11:09 -04:00
Daniel Morsing
2667dcd113 cmd/gc: steal escape analysis info when inlining
Usually, there is no esc info when inlining, but there will be when generating inlined wrapper functions.

If we don't use this information, we get invalid addresses on the stack.

Fixes #5056.

R=golang-dev, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7850045
2013-03-18 22:22:35 +01:00
Rémy Oudompheng
861aa4698a cmd/gc: missing type inference for untyped complex() calls.
Fixes #5014.

R=golang-dev, r, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7664043
2013-03-16 00:37:28 +01:00
Russ Cox
615f289209 cmd/gc: ensure unique parameter and result names in function types
In addition to fixing the bug, the check is now linear instead of quadratic.

Fixes #4469.

R=ken2
CC=golang-dev
https://golang.org/cl/7773047
2013-03-15 15:24:13 -04:00
Rémy Oudompheng
20c7e41555 cmd/gc: fix escape analysis bug.
It used to not mark parameters as escaping if only one of the
fields it points to leaks out of the function. This causes
problems when importing from another package.

Fixes #4964.

R=rsc, lvd, dvyukov, daniel.morsing
CC=golang-dev
https://golang.org/cl/7648045
2013-03-15 09:03:45 +01:00
Tyler Bunnell
f6a952599e cmd/gc: disallow fallthrough in final case of switch
Small change to cmd/gc to catch a "fallthrough" in the final case of a switch.

R=golang-dev, rsc, mtj
CC=golang-dev
https://golang.org/cl/7841043
2013-03-15 00:35:09 -04:00
Rob Pike
d526e5e79c go/test/bench/go1: add regexp test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7480047
2013-03-12 16:50:10 -07:00
Brad Fitzpatrick
ba6ea4a95c test/bench/go1: add http test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7529048
2013-03-12 16:46:38 -07:00
Jan Ziak
4e6e9f9b28 test/bench/garbage: fix parser benchmark
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7762046
2013-03-12 22:25:15 +01:00
Rob Pike
05403fa8fb go/test/bench/go1: add printf and time format tests
Also rename the go parser test to GoParse so it doesn't grab the globally useful Parse name.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7732044
2013-03-11 17:17:25 -07:00
Rémy Oudompheng
401e0fea3a cmd/gc: reject complex calls with mismatched argument types.
The specification says "the two arguments must be of the same
floating-point type."

R=rsc, gri
CC=golang-dev
https://golang.org/cl/7671045
2013-03-11 22:55:14 +01:00
Rémy Oudompheng
4c203172a2 cmd/8g: fix code generation of int64(0) == int64(0).
The code would violate the contract of cmp64.

Fixes #5002.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/7593043
2013-03-07 21:47:45 +01:00
Russ Cox
ecab408c42 cmd/gc: implement new return requirements
Fixes #65.

R=ken2
CC=golang-dev
https://golang.org/cl/7441049
2013-03-04 17:02:04 -05:00
Shenghou Ma
13075ed416 test/bench/go1: use raw string instead of string addition
to reduce compile time memory/stack usage.
Update #4970
$ go test -c ../test/bench/go1
before:
0.36user 0.07system 0:00.44elapsed 100%CPU
(0avgtext+0avgdata 540720maxresident)k
0inputs+19840outputs (0major+56451minor)pagefaults 0swaps
after:
0.33user 0.05system 0:00.39elapsed 100%CPU
(0avgtext+0avgdata 289936maxresident)k
0inputs+19864outputs (0major+29615minor)pagefaults 0swaps

And stack usage is reduced to below 1MiB.

R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/7436050
2013-03-05 04:23:37 +08:00
Daniel Morsing
b65acaeab2 cmd/gc: disallow selectors to the blank identifier
Fixes #4941.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7415051
2013-03-04 17:01:42 +01:00
Rémy Oudompheng
a85fce282e cmd/gc: simplify and fix defaultlit.
Fixes #4882.
Fixes #4936.
Fixes #4937.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7432044
2013-03-04 16:51:42 +01:00
Jan Ziak
66a9372976 test/bench/garbage: fix parser benchmark
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/7435053
2013-03-04 16:46:04 +01:00
Rémy Oudompheng
b0bb6f8cee cmd/gc: unbreak exporting of composite literals.
Fixes #4932.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7437043
2013-03-04 16:42:03 +01:00
Rémy Oudompheng
71b3b46073 cmd/gc: accept cases with same value but different types in switch.
Fixes #4781.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7365056
2013-02-26 00:45:43 +01:00
Rémy Oudompheng
9e66ee4562 cmd/gc: fix corruption in export of &T{} literals.
Composite literals using the &T{} form were incorrectly
exported, leading to weird errors at import time.

Fixes #4879.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7395054
2013-02-26 00:43:31 +01:00
Alan Donovan
aa5aaabb0d exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.
The interpreter's os.Exit now triggers a special panic rather
than kill the test process.  (It's semantically dubious, since
it will run deferred routines.)  Interpret now returns its
exit code rather than calling os.Exit.

Also:
- disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP").
- remove unnecessary 'slots' param to external functions; they
  are never closures.

Most of the tests are disabled until go/types supports shifts.
They can be reenabled if you patch this workaround:
https://golang.org/cl/7312068

R=iant, bradfitz
CC=golang-dev, gri
https://golang.org/cl/7313062
2013-02-21 12:48:38 -05:00
Russ Cox
ac1015e7f3 cmd/8g: fix sse2 compare code gen
Fixes #4785.

R=ken2
CC=golang-dev
https://golang.org/cl/7300109
2013-02-14 14:49:04 -05:00
Russ Cox
551f3f27aa test/run: use correct $PWD to make os.Getwd less expensive
The commands being run are 'go tool this' and 'go tool that',
and the go command will call Getwd during its init.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7336045
2013-02-14 14:21:26 -05:00
Alan Donovan
052c942e20 test: ensure all failing tests exit nonzero.
Previously merely printing an error would cause the golden
file comparison (in 'bash run') to fail, but that is no longer
the case with the new run.go driver.

R=iant
CC=golang-dev
https://golang.org/cl/7310087
2013-02-12 13:17:49 -05:00
Alan Donovan
1c1096ea31 test: a number of fixes.
Details:
- reorder.go: delete p8.
  (Once expectation is changed per b/4627 it is identical to p1.)
- switch.go: added some more (degenerate) switches.
- range.go: improved error messages in a few cases.
- method.go: added tests of calls to promoted methods.

R=iant
CC=golang-dev
https://golang.org/cl/7306087
2013-02-11 18:20:52 -05:00
Russ Cox
7594440ef1 cmd/8g: add a few missing splitclean
Fixes #887.

R=ken2
CC=golang-dev
https://golang.org/cl/7303061
2013-02-07 17:55:25 -05:00
Russ Cox
fd178d6a7e cmd/gc: add way to specify 'noescape' for extern funcs
A new comment directive //go:noescape instructs the compiler
that the following external (no body) func declaration should be
treated as if none of its arguments escape to the heap.

Fixes #4099.

R=golang-dev, dave, minux.ma, daniel.morsing, remyoudompheng, adg, agl, iant
CC=golang-dev
https://golang.org/cl/7289048
2013-02-05 07:00:38 -05:00
Russ Cox
572d984eaa cmd/gc: fix escape analysis
If the analysis reached a node twice, then the analysis was cut off.
However, if the second arrival is at a lower depth (closer to escaping)
then it is important to repeat the traversal.

The repeating must be cut off at some point to avoid the occasional
infinite recursion. This CL cuts it off as soon as possible while still
passing all tests.

Fixes #4751.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/7303043
2013-02-04 22:48:31 -05:00
Russ Cox
399dcc75a8 cmd/gc: fix &^ code generation bug
Was not re-walking the new AND node, so that its ullman
count was wrong, so that the code generator attempted to
store values in registers across the call.

Fixes #4752.

R=ken2
CC=golang-dev
https://golang.org/cl/7288054
2013-02-04 00:21:44 -05:00
Russ Cox
f02067a99a cmd/gc: implement latest rules for checking make sizes
Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047
2013-02-03 14:28:44 -05:00
Russ Cox
09a17ca1f1 cmd/gc: make inlined labels distinct
Fixes #4748.

R=ken2
CC=golang-dev
https://golang.org/cl/7261044
2013-02-03 11:19:22 -05:00
Russ Cox
d82dcadb57 cmd/gc: clean up string index errors
Unify with array/slice errors, which were already good.

Fixes #4232.

R=ken2
CC=golang-dev
https://golang.org/cl/7271046
2013-02-03 02:01:05 -05:00
Russ Cox
4ad505d102 cmd/gc: update ideal bool rules to match latest spec
Fixes #3915.
Fixes #3923.

R=ken2
CC=golang-dev
https://golang.org/cl/7281044
2013-02-03 01:44:03 -05:00
Russ Cox
ffc742b658 cmd/gc: allow new conversion syntax
For consistency with conversions that look like function calls,
conversions that don't look like function calls now allow an
optional trailing comma.

That is, int(x,) has always been syntactically valid.
Now []int(x,) is valid too.

Fixes #4162.

R=ken2
CC=golang-dev
https://golang.org/cl/7288045
2013-02-03 00:03:10 -05:00
Russ Cox
2af3cbe308 cmd/gc: treat &T{} like new(T): allocate on stack if possible
Fixes #4618.

R=ken2
CC=golang-dev
https://golang.org/cl/7278048
2013-02-02 23:54:21 -05:00
Russ Cox
a72f9f46a2 cmd/gc: avoid duplicate allocation during inlining
Fixes #4667.

R=ken2
CC=golang-dev
https://golang.org/cl/7275046
2013-02-02 23:17:25 -05:00
Daniel Morsing
5ea52a4d91 cmg/gc: Fix evaluation order of map indexing during multiple assignments
Fixes #4620.

R=rsc
CC=golang-dev
https://golang.org/cl/7241051
2013-02-02 12:39:04 +01:00
Russ Cox
8931306389 cmd/gc: reject non-Go constants
Expressions involving nil, even if they can be evaluated
at compile time, do not count as Go constants and cannot
be used in const initializers.

Fixes #4673.
Fixes #4680.

R=ken2
CC=golang-dev
https://golang.org/cl/7278043
2013-02-01 23:10:02 -05:00
Russ Cox
f607c479ea cmd/gc: silence redundant error prints for misuse of [...]int
Fixes #4452.

R=ken2
CC=golang-dev
https://golang.org/cl/7241065
2013-02-01 21:21:27 -05:00
Russ Cox
e2711cb202 cmd/gc: put 'not used' message on correct line
Fixes #4663.

R=ken2
CC=golang-dev
https://golang.org/cl/7235081
2013-02-01 21:13:41 -05:00
Russ Cox
79a16a3b70 cmd/gc: clearer error for defer/go of conversion or invalid function call
Fixes #4654.

R=ken2
CC=golang-dev
https://golang.org/cl/7229072
2013-02-01 21:02:15 -05:00
Ian Lance Taylor
193ff39ac9 test: add test that caused a gccgo compilation failure
Updates #4734.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7228079
2013-01-31 15:59:30 -08:00
Daniel Morsing
ba05a43608 cmd/gc: Error out on division by constant zero.
Fixes #4264.

R=cldorian, rsc
CC=golang-dev
https://golang.org/cl/6845113
2013-01-30 20:21:08 +01:00
Ian Lance Taylor
e38339e3d8 test: add test case miscompiled by gccgo
R=golang-dev, bradfitz, rsc, iant
CC=golang-dev
https://golang.org/cl/7240043
2013-01-28 16:17:06 -08:00
Rémy Oudompheng
4f6a2b9840 test: add support for build tags.
This enables a few tests that were only executed
unconditionnally.

R=rsc, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7103051
2013-01-28 21:29:45 +01:00
Rémy Oudompheng
09cb91eddc test: re-enable issue4348.go.
The test array is too large to fit a stack frame
but can be a global.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7127059
2013-01-18 22:54:27 +01:00
Daniel Morsing
c0d9bf5650 cmd/gc: more robust checking of OIND nodes.
Fixes #4610.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev, nigeltao
https://golang.org/cl/7058057
2013-01-18 22:46:10 +01:00
Rémy Oudompheng
1d6eb2e9fa cmd/gc: fix handling of struct padding in hash/eq.
The test case of issue 4585 was not passing due to
miscalculation of memequal args, and the previous fix
does not handle padding at the end of a struct.

Handling of padding at end of structs also fixes the case
of [n]T where T is such a padded struct.

Fixes #4585.
(again)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7133059
2013-01-18 22:40:32 +01:00
Rémy Oudompheng
d127ed5378 cmd/gc, cmd/6g: fix error on large stacks.
Fixes #4666.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7141047
2013-01-18 22:36:43 +01:00
Rémy Oudompheng
2ad57b4583 cmd/gc: don't hash nor compare struct padding or blank fields.
Fixes #4585.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/7142052
2013-01-18 18:26:43 +01:00
Dave Cheney
dc75670ae2 test: limit runoutput tests on arm platforms
runoutput styles tests generally consume a lot of memory. On arm platforms rotate?.go consume around 200mb each to compile, and as tests are sorted alphabetically, they all tend to run at once.

This change limits the number of runoutput jobs to 2 on arm platforms.

R=minux.ma, remyoudompheng, bradfitz, lucio.dere
CC=golang-dev
https://golang.org/cl/7099047
2013-01-12 17:52:52 +11:00
Rémy Oudompheng
578f24d532 test: add rotate.go and fixedbugs/bug313
Update #4139.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7094047
2013-01-11 22:42:55 +01:00
Rémy Oudompheng
ab1385ec95 test: adapt old-style tests to new flag parsing.
The -I. syntax now needs a space to be recognized in the
compiler.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7098046
2013-01-11 22:05:46 +01:00
Rémy Oudompheng
c3836ed06e test: make rundir match compiledir/errorcheckdir.
This allows test/dwarf to be supported by run.go.

Update #4139.

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/7064067
2013-01-11 22:00:48 +01:00
Rémy Oudompheng
8fff2525cb cmd/gc: add space to export data to match linker expectations
The linker split PKGDEF into (prefix, name, def) pairs,
and defines def to begin after a space following the identifier.
This is totally wrong for the following export data:

        func "".FunctionName()
        var SomethingCompletelyUnrelated int

The linker would parse
    name=`"".FunctionName()\n\tvar`
    def=`SomethingCompletelyUnrelated int`
since there is no space after FunctionName.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7068051
2013-01-09 22:02:53 +01:00
Rémy Oudompheng
fba96e915d cmd/gc: fix uintptr(nil) issues.
A constant node of type uintptr with a nil literal could
happen in two cases: []int(nil)[1:] and
uintptr(unsafe.Pointer(nil)).

Fixes #4614.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7059043
2013-01-08 00:23:02 +01:00
Daniel Morsing
f1e4ee3f49 cmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.
Fixes #4066.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7040044
2013-01-04 17:07:21 +01:00
Rémy Oudompheng
20c76f7f3f cmd/gc: mark wrapper methods for unnamed types as DUPOK.
Unnamed types like structs with embedded fields can have methods.
These methods are generated on-the-fly by the compiler and
it may happen for identical types in different packages.
The linker must accept these multiple definitions.

Fixes #4590.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/7030051
2013-01-02 21:42:26 +01:00
Russ Cox
ae2131ab3b cmd/gc: make redeclaration between import and func less confusing
Fixes #4510.

R=ken2
CC=golang-dev
https://golang.org/cl/7001054
2013-01-02 15:34:28 -05:00
Russ Cox
8850d14fe9 test/run: handle compiledir and errorcheckdir with multi-file packages
Multiple files with the same package all get compiled together.

R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/7005053
2013-01-02 15:31:49 -05:00
Russ Cox
6592456feb cmd/gc: do not generate code for var _ = ... unless necessary
Fixes #2443.

R=ken2
CC=golang-dev
https://golang.org/cl/6997048
2012-12-30 12:01:53 -05:00
Russ Cox
3aed92f811 cmd/gc: add diagnostic for var, type, const named init
Before this CL, defining the variable worked fine, but then when
the implicit package-level init func was created, that caused a
name collision and a confusing error about the redeclaration.

Also add a test for issue 3705 (func init() needs body).

Fixes #4517.

R=ken2
CC=golang-dev
https://golang.org/cl/7008045
2012-12-22 17:23:33 -05:00
Russ Cox
1b3244e0db cmd/gc: fix eval order in select
Ordinary variable load was assumed to be not worth saving,
but not if one of the function calls later might change
its value.

Fixes #4313.

R=ken2
CC=golang-dev
https://golang.org/cl/6997047
2012-12-22 16:46:01 -05:00
Rémy Oudompheng
9aef20e823 cmd/gc: fix wrong interaction between inlining and embedded builtins.
The patch makes the compile user an ordinary package-local
symbol for the name of embedded fields of builtin type.

This is incompatible with the fix delivered for issue 2687
(revision 3c060add43fb) but fixes it in a different way, because
the explicit symbol on the field makes the typechecker able to
find it in lookdot.

Fixes #3552.

R=lvd, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/6866047
2012-12-22 19:16:31 +01:00
Rémy Oudompheng
ced8004a00 cmd/gc: do not accept (**T).Method expressions.
The typechecking code was doing an extra, unnecessary
indirection.

Fixes #4458.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6998051
2012-12-22 19:13:45 +01:00
Daniel Morsing
c956dcdc54 cmd/gc: Reject parenthesised .(type) expressions.
Fixes #4470.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6949073
2012-12-22 17:36:10 +01:00
Russ Cox
407d0c5ab7 cmd/gc: fix error line in switch expr eval
Fixes #4562.

R=ken2
CC=golang-dev
https://golang.org/cl/7008044
2012-12-22 10:01:15 -05:00
Rémy Oudompheng
4d3cbfdefa cmd/8g: introduce temporaries in byte multiplication.
Also restore the smallintconst case for binary ops.

Fixes #3835.

R=daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6999043
2012-12-21 23:46:16 +01:00
Rémy Oudompheng
1dcf658f6d cmd/gc: remove an incorrect assertion in escape analysis.
A fatal error used to happen when escassign-ing a multiple
function return to a single node. However, the situation
naturally appears when using "go f(g())" or "defer f(g())",
because g() is escassign-ed to sink.

Fixes #4529.

R=golang-dev, lvd, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6920060
2012-12-20 23:27:28 +01:00
Rémy Oudompheng
81b46f1bcd cmd/6g: fix componentgen for funarg structs.
Fixes #4518.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6932045
2012-12-17 22:29:43 +01:00
Russ Cox
94430937ac test: add "duplicate" struct map key test
Update #4555.

R=gri, iant
CC=golang-dev
https://golang.org/cl/6944059
2012-12-17 11:05:58 -05:00
Rémy Oudompheng
1947960a6f cmd/gc: fix defaultlit of shifts used in interface context.
Fixes #4545.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6937058
2012-12-15 19:37:59 +01:00
Ian Lance Taylor
cc5682dcc5 test: s/float/float32/
I just committed a patch to gccgo that notices that float was
never defined, causing an additional unmatched error message.
Rename the type to avoid that message.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6947049
2012-12-13 15:11:31 -08:00
Ian Lance Taylor
9509cbf203 test: move map delete test to nil.go
No need for a separate test for this.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6941045
2012-12-13 12:11:24 -08:00
Shenghou Ma
0df58a4b50 test/nil.go: delete on nil maps no longer panics
Fix the build.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6946044
2012-12-14 02:19:33 +08:00
Shenghou Ma
28a50c7f51 runtime: deletion on nil maps is a no-op now
Fixes #4535.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6942044
2012-12-13 23:48:48 +08:00
Daniel Morsing
bf59aafddc cmd/gc: Give better line numbers for errors in composite literals.
Credit to Russ for suggesting this fix.

Fixes #3925.

R=golang-dev, franciscossouza, rsc
CC=golang-dev
https://golang.org/cl/6920051
2012-12-12 16:43:54 +01:00
Daniel Morsing
0d22573f6e cmd/gc: remove bad check for BADWIDTH
This check for BADWIDTH might happen while in defercheckwidth, making it raise errors for non-erroneous situations.

Fixes #4495.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6927043
2012-12-11 17:36:10 +01:00
Rémy Oudompheng
561edbd63c cmd/gc: do not export useless private symbols.
Fixes #4252.

R=rsc, golang-dev, mirtchovski, daniel.morsing, dave, lvd
CC=golang-dev
https://golang.org/cl/6856126
2012-12-08 14:43:00 +01:00
Rémy Oudompheng
9146ac14ee cmd/gc: do not overflow parser stack on a long chain of else if.
Fixes #2615.

R=dave, minux.ma, iant, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6847078
2012-12-06 08:09:17 +01:00
Ian Lance Taylor
b46d56ae72 test: add some tests where go/defer arg starts with parenthesis
R=gri
CC=golang-dev
https://golang.org/cl/6890047
2012-12-05 20:32:12 -08:00
Ian Lance Taylor
08918ba438 gc: avoid meaningless constant overflow error for inverted slice range
Used to say:

issue4251.go:12: inverted slice range
issue4251.go:12: constant -1 overflows uint64
issue4251.go:16: inverted slice range
issue4251.go:16: constant -1 overflows uint64
issue4251.go:20: inverted slice range
issue4251.go:20: constant -1 overflows uint64

With this patch, only gives the "inverted slice range" errors.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/6871058
2012-12-05 15:46:45 -08:00
Dave Cheney
54e8d504e8 cmd/5g: use MOVB for fixed array nil check
Fixes #4396.

For fixed arrays larger than the unmapped page, agenr would general a nil check by loading the first word of the array. However there is no requirement for the first element of a byte array to be word aligned, so this check causes a trap on ARMv5 hardware (ARMv6 since relaxed that restriction, but it probably still comes at a cost).

Switching the check to MOVB ensures alignment is not an issue. This check is only invoked in a few places in the code where large fixed arrays are embedded into structs, compress/lzw is the biggest offender, and switching to MOVB has no observable performance penalty.

Thanks to Rémy and Daniel Morsing for helping me debug this on IRC last night.

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6854063
2012-12-06 08:01:33 +11:00
Ian Lance Taylor
feb95a802e test: tweak bug273.go to not have constant len < cap when calling make
The current spec says that when calling make, if both len and
cap are constant, it is an error if len > cap.  The gc
compiler does not yet implement that, but when it does this
will need to change.  Changing it now for the benefit of
gccgo.

R=gri
CC=golang-dev
https://golang.org/cl/6867064
2012-12-04 16:51:51 -08:00
Ian Lance Taylor
76937156ae test: add test for invalid nil == nil
R=gri
CC=golang-dev
https://golang.org/cl/6868059
2012-12-04 11:30:46 -08:00
Ian Lance Taylor
dfe2979801 test: add test for unused calls to builtin functions
R=gri
CC=golang-dev
https://golang.org/cl/6871054
2012-12-03 18:49:47 -08:00
Ian Lance Taylor
8990dc8ca0 test: add test for issue 4468 (go/defer expr may not be parenthesized)
R=gri
CC=golang-dev
https://golang.org/cl/6870053
2012-12-03 18:49:14 -08:00
Rémy Oudompheng
bcea0dd1d0 cmd/gc: fix inlining internal error with T.Method calls.
The compiler was confused when inlining a T.Method(f()) call
where f returns multiple values: support for this was marked
as TODO.

Variadic calls are not supported but are not inlined either.
Add a test preventively for that case.

Fixes #4167.

R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6871043
2012-12-03 13:39:40 +01:00
Ian Lance Taylor
0304a48595 test: add a test that caused gccgo to crash
R=golang-dev
CC=golang-dev
https://golang.org/cl/6849129
2012-11-30 14:14:51 -08:00
Rémy Oudompheng
f134742f24 cmd/5g, cmd/8g: fix internal error on 64-bit indices statically bounded
Fixes #4448.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6855100
2012-11-27 21:37:38 +01:00
Daniel Morsing
5188c0b59c cmd/gc: Make sure bools lose idealness when used with logical operators.
Bools from comparisons can be assigned to all bool types, but this idealness would propagate through logical operators when the result should have been lowered to a non-ideal form.

Fixes #3924.

R=golang-dev, remyoudompheng, r, rsc, mtj
CC=golang-dev
https://golang.org/cl/6855061
2012-11-26 22:23:13 +01:00
Rémy Oudompheng
2e73453aca cmd/6l, cmd/8l: emit no-ops to separate zero-stack funcs from nosplits.
The stack overflow checker in the linker uses the spadj field
to determine whether stack space will be large enough or not.
When spadj=0, the checker treats the function as a nosplit
and emits an error although the program is correct.

Also enable the stack checker in 8l.

Fixes #4316.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6855088
2012-11-26 21:51:48 +01:00
Shenghou Ma
7c295f3f0c cmd/gc: fix invalid indirect error at statement level
Fixes #4429.

R=golang-dev, remyoudompheng, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6850097
2012-11-27 01:46:54 +08:00
Ian Lance Taylor
76fa4f430a test: add test for floating point rounding of constants
Failed with gccgo.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6855053
2012-11-26 08:31:15 -08:00
Ian Lance Taylor
be5c445909 test: add bug469, a case where gccgo gaves an incorrect error
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6856084
2012-11-24 16:53:08 -08:00
Rémy Oudompheng
1bd4a7dbcb cmd/8g: fix erroneous LEAL nil.
Fixes #4399.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6845053
2012-11-21 08:39:45 +01:00
Robert Griesemer
8f3b703323 cmd/gc: complain about invalid whitespace chars
Fixes #4405.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6855060
2012-11-19 09:09:04 -08:00
Rémy Oudompheng
eb4f4d16ae cmd/5g, cmd/6g: pass the full torture test.
The patch adds more cases to agenr to allocate registers later,
and makes 6g generate addresses for sgen in something else than
SI and DI. It avoids a complex save/restore sequence that
amounts to allocate a register before descending in subtrees.

Fixes #4207.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6817080
2012-11-12 23:56:11 +01:00
Ian Lance Taylor
3e50372f1f test: change index.go to test size of int, not GOARCH == "amd64"
Fixes the test to work correctly on other platforms with
64-bit ints, like Alpha.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6822099
2012-11-08 15:43:28 -08:00
Russ Cox
761830f481 cmd/gc: fix export of inlined function body with type guard
When exporting a body containing
        x, ok := v.(Type)

the definition for Type was not being included, so when the body
was actually used, it would cause an "unknown type" compiler error.

Fixes #4370.

R=ken2
CC=golang-dev
https://golang.org/cl/6827064
2012-11-08 16:07:05 -05:00
Ian Lance Taylor
6694f14b67 test: run some more tests by default
R=golang-dev, remyoudompheng, iant, rsc
CC=golang-dev
https://golang.org/cl/6833043
2012-11-08 09:04:27 -08:00
Rémy Oudompheng
c208a3a263 cmd/gc: fix internal compiler error with broken structs.
Fixes #4359.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6834043
2012-11-07 23:09:01 +01:00
Rémy Oudompheng
7c0cbbfa18 cmd/6g, cmd/8g: mark used registers in indirect addressing.
Fixes #4094.
Fixes #4353.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6810090
2012-11-07 21:36:15 +01:00
Ian Lance Taylor
e08008e8c5 test: run index test by default
Running this test via "bash run" uncovered three different
bugs (4344, 4348, 4353).  We need to run it by default.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6832043
2012-11-07 12:33:54 -08:00
Russ Cox
71282131a1 cmd/gc: fix escape analysis bug
The code assumed that the only choices were EscNone, EscScope, and EscHeap,
so that it makes sense to set EscScope only if the current setting is EscNone.
Now that we have the many variants of EscReturn, this logic is false, and it was
causing important EscScopes to be ignored in favor of EscReturn.

Fixes #4360.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6816103
2012-11-07 15:15:21 -05:00
Ian Lance Taylor
f8614a6645 reflect: fix test of whether structs are identical
The old code worked with gc, I assume because the linker
unified identical strings, but it failed with gccgo.

R=rsc
CC=gobot, golang-dev
https://golang.org/cl/6826063
2012-11-07 11:55:35 -08:00
Russ Cox
cb856adea9 cmd/gc: annotate local variables with unique ids for inlining
Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:

        int := "hello"
        j := 2

would normally turn into

        var int string = "hello"
        var j int = 2

but the int variable shadows the int type in the second line.

This CL marks all local variables with a per-function sequence number,
so that this would instead be:

        var int·1 string = "hello"
        var j·2 int = 2

Fixes #4326.

R=ken2
CC=golang-dev
https://golang.org/cl/6816100
2012-11-07 09:59:19 -05:00
Rémy Oudompheng
1e233ad075 cmd/6g: fix use of large integers as indexes or array sizes.
A check for smallintconst was missing before generating the
comparisons.

Fixes #4348.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6815088
2012-11-06 22:53:57 +01:00
Ian Lance Taylor
433b2f17ee test: fix index.go to pass with recent index checks
The compiler now gives an error for out of bounds constant
indexes for arrays, and for negative constant indexes for both
arrays and slices.

With this change the index.go test passes if CLs 6815085,
6815088, and 6812089 are committed.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6810085
2012-11-06 11:38:16 -08:00
Rémy Oudompheng
0b2353edcb cmd/5g, cmd/6g: fix out of registers with array indexing.
Compiling expressions like:
    s[s[s[s[s[s[s[s[s[s[s[s[i]]]]]]]]]]]]
make 5g and 6g run out of registers. Such expressions can arise
if a slice is used to represent a permutation and the user wants
to iterate it.

This is due to the usual problem of allocating registers before
going down the expression tree, instead of allocating them in a
postfix way.

The functions cgenr and agenr (that generate a value to a newly
allocated register instead of an existing location), are either
introduced or modified when they already existed to allocate
the new register as late as possible, and sudoaddable is disabled
for OINDEX nodes so that igen/agenr is used instead.

Update #4207.

R=dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6733055
2012-11-02 07:50:59 +01:00
Rémy Oudompheng
8d95245d0d cmd/gc: fix incomplete export data when inlining with local variables.
When local declarations needed unexported types, these could
be missing in the export data.

Fixes build with -gcflags -lll, except for exp/gotype.

R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6813067
2012-11-01 19:06:52 +01:00
Rémy Oudompheng
76500b14a1 cmd/gc: fix inlining bug with local variables.
Fixes #4323.

R=rsc, lvd, golang-dev
CC=golang-dev
https://golang.org/cl/6815061
2012-11-01 18:59:32 +01:00
Ian Lance Taylor
7dc1182c27 test: match gccgo error messages for bug358.go
I fixed a bug in gccgo that was causing it to only give an
error for the first package that was imported and not used.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6813058
2012-10-30 20:56:32 -07:00
Luuk van Dijk
507fcf37d2 cmd/gc: escape analysis to track flow of in to out parameters.
includes step 0: synthesize outparams, from 6600044
includes step 1,2: give outparams loopdepth 0 and verify unchanged results
         generate esc:$mask tags, but still tie to sink if a param has mask != 0
from 6610054

adds final steps:
- have esccall generate n->escretval, a list of nodes the function results flow to
- use these in esccall and ORETURN/OAS2FUNC/and f(g())
- only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval

R=rsc, bradfitz
CC=dave, gobot, golang-dev, iant, rsc
https://golang.org/cl/6741044
2012-10-29 13:38:21 +01:00
Rémy Oudompheng
335eef85c3 cmd/6g: fix crash in cgen_bmul.
Used to print:
../test/torture.go:116: internal compiler error: bad width: 0463 (../test/torture.go:116) MOVB    ,BX (0, 8)

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6736068
2012-10-26 00:29:44 +02:00
Daniel Morsing
48af64b295 cmd/gc: Mark use of builtin functions as calls.
Fixes #4097.

R=rsc
CC=golang-dev, gri
https://golang.org/cl/6749059
2012-10-22 19:14:30 +02:00
Rémy Oudompheng
319131f295 cmd/gc: fix inlining bug for composite literals in if statements.
Fixes #4230.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6640056
2012-10-22 08:38:23 +02:00
Daniel Morsing
d7a3407e3d cmd/gc: fix confusing error when using variable as type.
Fixes #3783.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6737053
2012-10-21 20:50:31 +02:00
Daniel Morsing
a7a3fe7238 cmd/gc: Friendlier errors on oversized arrays.
Someone new to the language may not know the connection between ints and arrays, which was the only thing that the previous error told you anything about.

Fixes #4256.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6739048
2012-10-21 19:22:51 +02:00
Rémy Oudompheng
a4682348c2 cmd/gc: don't squash complex literals when inlining.
Since this patch changes the way complex literals are written
in export data, there are a few other glitches.

Fixes #4159.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6674047
2012-10-17 20:33:44 +02:00
Rémy Oudompheng
7e144bcab0 cmd/5g, cmd/6g, cmd/8g: fix out of registers.
This patch is enough to fix compilation of
exp/types tests but only passes a stripped down
version of the appripriate torture test.

Update #4207.

R=dave, nigeltao, rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6621061
2012-10-16 07:22:33 +02:00
Rémy Oudompheng
dda1b560ec test: convert tests to run.go whenever possible.
The other tests either need a complex procedure
or are architecture- or OS-dependent.

Update #4139.

R=golang-dev, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/6618062
2012-10-10 22:35:27 +02:00
David Symonds
f8b5838123 testing: change -test.benchtime to a flag.Duration.
Fixes #3902.

R=golang-dev, minux.ma, rsc, r
CC=golang-dev
https://golang.org/cl/6611059
2012-10-09 08:57:29 +11:00
Daniel Morsing
c81293ada7 test: Make run.go's errorcheck behave like testlib.
testlib will complain about any unmatched errors left in errorchecks while run.go will not.

Fixes #4141.

R=golang-dev, minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6614060
2012-10-08 16:36:45 +02:00
Rémy Oudompheng
46bce2ac27 test: convert more tests to rundir/compiledir conventions
Update #4139.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6609051
2012-10-07 23:22:01 +02:00
Rémy Oudompheng
5497787d35 test/testlib: don't forget stderr for rundircmpout.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6620071
2012-10-07 23:14:20 +02:00
Rémy Oudompheng
9844e4cd7c test: correct type in declbad.go
The test is not about type mismatches and it causes
an extra error to appear.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6614062
2012-10-07 21:52:57 +02:00
Russ Cox
c4c4b3b467 test/bench/shootout: match gcc architecture to GOARCH
If we're benchmarking 8g, use gcc -m32.
If we're benchmarking 6g, use gcc -m64.

R=golang-dev, bradfitz, minux.ma, remyoudompheng
CC=golang-dev
https://golang.org/cl/6625061
2012-10-07 15:49:56 -04:00
Shenghou Ma
e824656907 test/run.go: use correct executable filename on Windows, fix build
R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/6624060
2012-10-08 01:54:56 +08:00
Rémy Oudompheng
d9953c9dde test: use rundir and errorcheckdir for a few more tests.
Update #4139.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6620070
2012-10-07 18:37:05 +02:00
Rémy Oudompheng
892fa3ae6c cmd/gc: replace "typechecking loop" by nicer errors in some cases.
For issue 3757:
BEFORE:  test/fixedbugs/bug463.go:12: typechecking loop involving a
             test/fixedbugs/bug463.go:12 a
             test/fixedbugs/bug463.go:12 <node DCLCONST>
AFTER:   test/fixedbugs/bug463.go:12: constant definition loop
             test/fixedbugs/bug463.go:12: a uses a

For issue 3937:
BEFORE: test/fixedbugs/bug464.go:12: typechecking loop involving foo
            test/fixedbugs/bug464.go:12 <T>
            test/fixedbugs/bug464.go:12 foo
            test/fixedbugs/bug464.go:12 <node DCLFUNC>
AFTER:  test/fixedbugs/bug464.go:12: foo is not a type

Fixes #3757.
Fixes #3937.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6614058
2012-10-07 17:35:21 +02:00
Daniel Morsing
87c35d8df1 cmd/gc: Don't accept qualified names as literal keys
Fixes #4067.

R=golang-dev, minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/6622056
2012-10-07 16:47:53 +02:00
Akshat Kumar
51e8fe5b1b cmd/gc: don't dereference a nil Type pointer in widstruct
The nil dereference in the next few lines doesn't seem
to cause a segmentation fault on Unix, but does seem
to halt the Go compiler.

The following is a test case:

>>>
package main

func mine(int b) int {
        return b + 2
}

func main() {
        mine()

        c = mine()
}
<<<

Without this change only the following is caught:

typecheck.go:3: undefined: b
typecheck.go:4: undefined: b

with it, we catch all the errors:

typecheck.go:3: undefined: b
typecheck.go:4: undefined: b
typecheck.go:10: undefined: c
typecheck.go:10: cannot assign to c .

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6542060
2012-10-07 14:11:59 +08:00
Daniel Morsing
a45777fe99 cmd/gc: Don't export embedded builtins
Fixes #4124.

R=golang-dev, dave, minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6543057
2012-10-07 06:53:57 +02:00
Rémy Oudompheng
0b2ca9e62f cmd/gc: avoid clobbering the AST in cgen_callmeth.
It confused the detection of init loops when involving
method calls.

Fixes #3890.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6620067
2012-10-07 00:52:40 +02:00
Rémy Oudompheng
46fcfdaa7d cmd/6g: fix out of registers when chaining integer divisions.
Fixes #4201.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6622055
2012-10-07 00:30:29 +02:00
Rémy Oudompheng
94acfde22e cmd/gc: make rnd() more 64-bit-friendly.
Fixes #4200.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6619057
2012-10-07 00:29:55 +02:00
Rémy Oudompheng
782464aea5 runtime: fix a panic when growing zero-width-element slices.
Fixes #4197.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6611056
2012-10-06 12:05:52 +02:00
Daniel Morsing
ebb0e5db75 test: Add rundir, rundircmpout and errorcheckdir commands to testlib and run.go
rundir will compile each file in the directory in lexicographic order, link the last file as the main package and run the resulting program. rundircmpout is an related command, that will compare the output of the program to an corresponding .out file

errorcheckdir will compile each file in a directory in lexicographic order, running errorcheck on each file as it compiles. All compilations are assumed to be successful except for the last file. However, If a -0 flag is present on the command, the last compilation will also be assumed successful

This CL also includes a small refactoring of run.go. It was getting unwieldy and the meaning of the run commands was hidden behind argument line formatting.

Fixes #4058.

R=rsc, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/6554071
2012-10-06 09:23:31 +02:00
Rémy Oudompheng
3a4e156ae1 cmd/5g: fix out of registers in nested calls, add compiler torture test.
R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev, remy
https://golang.org/cl/6586072
2012-10-05 23:30:49 +02:00
Rémy Oudompheng
4bb75cd9ad test/fixedbugs: forgotten test cases for issues 3907 and 4156.
Update #3907.
Update #4156.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6595044
2012-09-30 10:35:09 +02:00
Shenghou Ma
9a3bc51c81 test/fixedbugs/bug454.go: add a test for CL 6564052
Also mention that ignoring second blank identifier of range is required by the spec in the code.

   Fixes #4173.

R=daniel.morsing, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6594043
2012-09-29 23:23:56 +08:00
Ian Lance Taylor
6ed800c01d test: match gccgo error messages
const1.go:31:12: error: integer constant overflow
const1.go:31:12: error: integer constant overflow
const1.go:33:12: error: integer constant overflow
const1.go:33:12: error: integer constant overflow
const1.go:34:14: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:35:17: error: integer constant overflow
const1.go:36:19: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:24: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:37:24: error: integer constant overflow
const1.go:37:15: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:38:12: error: integer constant overflow
const1.go:41:20: error: integer constant overflow
const1.go:41:20: error: integer constant overflow
const1.go:42:20: error: integer constant overflow
const1.go:42:20: error: integer constant overflow
const1.go:44:28: error: integer constant overflow
const1.go:44:28: error: integer constant overflow
const1.go:45:14: error: integer constant overflow
const1.go:49:14: error: integer constant overflow
const1.go:50:14: error: integer constant overflow
const1.go:51:14: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:54:23: error: integer constant overflow
const1.go:56:14: error: integer constant overflow
const1.go:57:24: error: integer constant overflow
const1.go:57:24: error: integer constant overflow
const1.go:58:24: error: integer constant overflow
const1.go:58:24: error: integer constant overflow
const1.go:59:22: error: integer constant overflow
const1.go:59:22: error: integer constant overflow
const1.go:61:24: error: integer constant overflow
const1.go:62:20: error: division by zero
const1.go:65:19: error: floating point constant overflow
const1.go:65:19: error: floating point constant overflow
const1.go:66:28: error: floating point constant overflow
const1.go:66:28: error: floating point constant overflow
const1.go:67:19: error: floating point constant overflow
const1.go:67:19: error: floating point constant overflow
const1.go:68:19: error: division by zero
const1.go:33:14: error: integer constant overflow
const1.go:35:19: error: integer constant overflow
const1.go:42:22: error: integer constant overflow
const1.go:53:17: error: integer constant overflow
const1.go:55:14: error: integer constant overflow
const1.go:59:24: error: integer constant overflow
const1.go:69:20: error: expected integer type
const1.go:75:4: error: argument 1 has incompatible type (cannot use type int8 as type int)
const1.go:76:4: error: argument 1 has incompatible type (cannot use type int8 as type int)
const1.go:77:4: error: argument 1 has incompatible type (cannot use type uint8 as type int)
const1.go:79:4: error: argument 1 has incompatible type (cannot use type float32 as type int)
const1.go:80:4: error: argument 1 has incompatible type (cannot use type float64 as type int)
const1.go:81:4: error: floating point constant truncated to integer
const1.go:83:4: error: argument 1 has incompatible type (cannot use type float64 as type int)
const1.go:84:4: error: argument 1 has incompatible type (cannot use type string as type int)
const1.go:85:4: error: argument 1 has incompatible type (cannot use type bool as type int)
const1.go:88:7: error: const initializer cannot be nil

const2.go:14:8: error: expected ‘=’

const5.go:27:7: error: expression is not constant
const5.go:28:7: error: expression is not constant
const5.go:30:7: error: expression is not constant
const5.go:31:7: error: expression is not constant

ddd1.go:57:23: error: invalid use of ‘...’ in type conversion
ddd1.go:59:6: error: invalid use of ‘...’ in type conversion
ddd1.go:60:12: error: use of ‘[...]’ outside of array literal
ddd1.go:21:15: error: argument 1 has incompatible type
ddd1.go:22:10: error: argument 1 has incompatible type
ddd1.go:30:6: error: invalid use of ‘...’ with non-slice
ddd1.go:30:6: error: invalid use of ‘...’ with non-slice
ddd1.go:46:2: error: invalid use of %<...%> with builtin function
ddd1.go:47:2: error: invalid use of %<...%> with builtin function
ddd1.go:49:2: error: invalid use of %<...%> with builtin function
ddd1.go:50:6: error: invalid use of %<...%> with builtin function
ddd1.go:51:6: error: invalid use of %<...%> with builtin function
ddd1.go:53:6: error: invalid use of %<...%> with builtin function
ddd1.go:58:13: error: invalid use of %<...%> with builtin function
ddd1.go:20:10: error: floating point constant truncated to integer
ddd1.go:32:6: error: invalid use of ‘...’ calling non-variadic function

declbad.go:20:3: error: variables redeclared but no variable is new
declbad.go:38:3: error: variables redeclared but no variable is new
declbad.go:44:3: error: variables redeclared but no variable is new
declbad.go:51:3: error: variables redeclared but no variable is new
declbad.go:57:3: error: variables redeclared but no variable is new
declbad.go:63:3: error: variables redeclared but no variable is new
declbad.go:26:3: error: incompatible types in assignment (cannot use type float32 as type int)
declbad.go:32:3: error: incompatible types in assignment (cannot use type int as type float32)
declbad.go:44:3: error: incompatible types in assignment (different number of results)

fixedbugs/bug223.go:21:5: error: initialization expression for ‘m’ depends upon itself

fixedbugs/bug412.go:10:2: error: duplicate field name ‘x’

fixedbugs/bug413.go:11:5: error: initialization expression for ‘i’ depends upon itself

fixedbugs/bug416.go:13:1: error: method ‘X’ redeclares struct field name

fixedbugs/bug435.go:15:49: error: missing ‘)’
fixedbugs/bug435.go:15:2: error: reference to undefined name ‘bar’

fixedbugs/bug451.go:9:9: error: expected package

typeswitch3.go:39:9: error: no new variables on left side of ‘:=’
typeswitch3.go:24:2: error: impossible type switch case (type has no methods)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6560063
2012-09-28 08:30:30 -07:00
Rob Pike
4391abfb1d test/bench/shootout: new data after 64-bit ints for amd64
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6564046
2012-09-25 14:14:26 +10:00
Russ Cox
10ea6519e4 build: make int 64 bits on amd64
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.

Fixes #2188.

R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
2012-09-24 20:57:01 -04:00
Russ Cox
54af752865 cmd/gc: fix escape analysis bug
Was not handling &x.y[0] and &x.y.z correctly where
y is an array or struct-valued field (not a pointer).

R=ken2
CC=golang-dev
https://golang.org/cl/6551059
2012-09-24 15:53:12 -04:00
Russ Cox
0d82e69811 test: prepare for 64-bit ints
Minor tweaks to avoid assuming that int is always 32 bits.

Update #2188.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6553062
2012-09-24 00:06:41 -04:00
Russ Cox
3cd890dd5a test: minor fixes in run and testlib
Can tell this doesn't get run very often, but it is still important
for when you've broken everything else.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6547065
2012-09-24 00:06:31 -04:00
Russ Cox
cd22afa07b test: expand run.go's errorcheck, make clear which bugs run
Today, if run.go doesn't understand a test header line it just ignores
the test, making it too easy to write or edit tests that are not actually
being run.

- expand errorcheck to accept flags, so that bounds.go and escape*.go can run.
- create a whitelist of skippable tests in run.go; skipping others is an error.
- mark all skipped tests at top of file.

Update #4139.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6549054
2012-09-23 13:16:14 -04:00
Rémy Oudompheng
36df358a30 cmd/6g: fix internal error with SSE registers.
Revision 63f7abcae015 introduced a bug caused by
code assuming registers started at X5, not X0.

Fixes #4138.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6558043
2012-09-23 18:22:03 +02:00
Russ Cox
05ac300830 cmd/gc: fix use of nil interface, slice
Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6542058
2012-09-22 20:42:11 -04:00
Shenghou Ma
674bbafce6 misc/cgo/stdio: make it work on Windows and also test it
use a function to get stdout and stderr, instead of depending
on a specific libc implementation.
also make test/run.go replace \r\n by \n before comparing
output.

        Fixes #2121.
        Part of issue 1741.

R=alex.brainman, rsc, r, remyoudompheng
CC=golang-dev
https://golang.org/cl/5847068
2012-09-20 00:27:23 +08:00
Daniel Morsing
551e263823 cmd/gc: add missing conversion from bool to interface in switches.
In switches without an expression, the compiler would not convert the implicit true to an interface, causing codegen errors.

Fixes #3980.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6497147
2012-09-17 21:29:10 +02:00
Rob Pike
6ce4930365 gc: initial BOM is legal.
Fixes #4040.

R=rsc
CC=golang-dev
https://golang.org/cl/6497098
2012-09-10 13:03:07 -07:00
Adam Langley
2c5b53866c undo CL 6498092 / 4ff71bc1a199
Broke tests on 386.

««« original CL description
6l/8l: emit correct opcodes to F(SUB|DIV)R?D.

When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/6492100
2012-09-10 15:52:36 -04:00
Adam Langley
72fa142fc5 6l/8l: emit correct opcodes to F(SUB|DIV)R?D.
When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
2012-09-10 15:35:39 -04:00
Daniel Morsing
1c2021ca14 cmd/gc: Suggest *T in error for x.(T) if it would work.
Accomplished by synchronizing the formatting of conversion errors between typecheck.c and subr.c

Fixes #3984.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6500064
2012-09-01 13:52:55 -04:00
Rémy Oudompheng
8f3c2055bd cmd/6g, cmd/8g: eliminate short integer arithmetic when possible.
Fixes #3909.
Fixes #3910.

R=rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6442114
2012-09-01 16:40:54 +02:00
Rémy Oudompheng
ba97d52b85 cmd/gc: fix escape analysis bug with variable capture in loops.
Fixes #3975.

R=rsc, lvd
CC=golang-dev, remy
https://golang.org/cl/6475061
2012-08-31 22:23:37 +02:00
Russ Cox
6d0e3242eb test: restore nigel's bug451 as bug452.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6497066
2012-08-31 15:43:27 -04:00
Daniel Morsing
85ce3c7241 cmd/gc: mark broken type declarations as broken.
This fixes a spurious 'invalid recursive type' error, and stops the compiler from emitting errors on uses of the invalid type.

Fixes #3766.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6443100
2012-08-31 13:02:29 -04:00
Rob Pike
363ec80dec cmd/gc: string conversion for surrogates
This is required by the spec to produce the replacement char.
The fix lies in lib9's rune code.

R=golang-dev, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6443109
2012-08-30 11:16:55 -07:00
Rob Pike
d199c34cf0 test/bench/shootout: pidigits is much faster
Also fix a bug in the script (s/runonly/run/)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6501051
2012-08-28 15:33:05 -07:00
Rémy Oudompheng
a85fa33ece test: use run.go for more tests.
R=golang-dev, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/6443110
2012-08-25 10:16:02 +02:00
Shenghou Ma
e80f6a4de1 cmd/6g: fix float32/64->uint64 conversion
CVTSS2SQ's rounding mode is controlled by the RC field of MXCSR;
as we specifically need truncate semantic, we should use CVTTSS2SQ.

    Fixes #3804.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6352079
2012-08-23 14:35:26 +08:00
Nigel Tao
251199c430 cmd/8g: roll back the small integer constant optimizations introduced
in 13416:67c0b8c8fb29 "faster code, mainly for rotate" [1]. The codegen
can run out of registers if there are too many small-int arithmetic ops.

An alternative approach is to copy 6g's sbop/abop codegen to 8g, but
this change is less risky.

Fixes #3835.

[1] http://code.google.com/p/go/source/diff?spec=svn67c0b8c8fb29b1b7b6221977af6b89cae787b941&name=67c0b8c8fb29&r=67c0b8c8fb29b1b7b6221977af6b89cae787b941&format=side&path=/src/cmd/8g/cgen.c

R=rsc, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6450163
2012-08-23 16:17:22 +10:00
Alex Brainman
42534cbc29 test: change run.go to ignore \r in compiler output (fixes windows build)
R=golang-dev, dave, minux.ma, remyoudompheng
CC=golang-dev
https://golang.org/cl/6460093
2012-08-16 16:46:59 +10:00
Daniel Morsing
b04c890a89 cmd/gc: Don't claim type assertion would help when it wont.
Fixes #3465.

R=golang-dev, rsc, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/6448097
2012-08-15 16:53:06 -07:00
Rob Pike
c48b77b1b5 all: make Unicode surrogate halves illegal as UTF-8
Surrogate halves are part of UTF-16 and should never appear in UTF-8.
(The rune that two combined halves represent in UTF-16 should
be encoded directly.)

Encoding: encode as RuneError.
Decoding: convert to RuneError, consume one byte.

This requires changing:
        package unicode/utf8
        runtime for range over string
Also added utf8.ValidRune and fixed bug in utf.RuneLen.

Fixes #3927.

R=golang-dev, rsc, bsiegert
CC=golang-dev
https://golang.org/cl/6458099
2012-08-08 14:01:23 -07:00
Shenghou Ma
1e95429c3f misc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo tests
Enhances test/run.go to support testing other directories
   Will enable stdio tests on Windows in a follow-up CL.

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6220049
2012-08-07 09:38:35 +08:00
Alex Brainman
1df9ee0322 test/run: ignore all but .go file during compiledir action
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6454091
2012-08-06 14:56:39 +10:00
Rémy Oudompheng
823962c521 cmd/8g: fix miscompilation due to BADWIDTH.
Fixes #3899.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6453084
2012-08-03 22:05:51 +02:00
Rémy Oudompheng
f4f1ba2b1e cmd/gc: accept switches on comparable arrays.
The compiler is incorrectly rejecting switches on arrays of
comparable types. It also doesn't catch incomparable structs
when typechecking the switch, leading to unreadable errors
during typechecking of the generated code.

Fixes #3894.

R=rsc
CC=gobot, golang-dev, r, remy
https://golang.org/cl/6442074
2012-08-03 21:47:26 +02:00
Shenghou Ma
8dbeb0ad07 test/run.go: fix compiledir test on windows
we can't import "./bug0" on windows, as it will trigger
"import path contains invalid character ':'" error.
    instead, we pass "-D." and "-I." to gc to override this
behavior. this idea is due to remyoudompheng.

R=golang-dev, r, alex.brainman, remyoudompheng
CC=golang-dev
https://golang.org/cl/6441074
2012-07-31 23:26:33 -04:00
Shenghou Ma
e07958f7df runtime: round return value address in runtime.equal
Fixes #3866.

R=rsc, r, nigeltao
CC=golang-dev
https://golang.org/cl/6452046
2012-07-31 23:02:46 -04:00
Rémy Oudompheng
b6ea905ed9 cmd/gc: fix inlining bug with receive operator.
The receive operator was given incorrect precedence
resulting in incorrect deletion of parentheses.

Fixes #3843.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6442049
2012-08-01 00:45:26 +02:00
Rémy Oudompheng
adc9337262 test: add a compiledir pattern in run.go
The compiledir pattern compiles all files xxx.dir/*.go
in lexicographic order (which is assumed to coincide with
the topological order of dependencies).

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6440048
2012-07-30 21:12:05 +02:00
Rémy Oudompheng
6cbf35c172 cmd/gc: fix initialization order involving method calls.
They were previously ignored when deciding order and
detecting dependency loops.
Fixes #3824.

R=rsc, golang-dev
CC=golang-dev, remy
https://golang.org/cl/6455055
2012-07-30 09:14:49 +02:00
Daniel Morsing
dd166b9437 cmd/gc: point "no new variables" error at right line number.
Fixes #3856.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6455056
2012-07-29 22:24:19 -04:00
Rémy Oudompheng
656b192c16 cmd/gc: reject use of ... with multiple-valued expressions.
Fixes #3334.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6350103
2012-07-13 08:05:41 +02:00
Nigel Tao
18e86644a3 cmd/gc: cache itab lookup in convT2I.
There may be further savings if convT2I can avoid the function call
if the cache is good and T is uintptr-shaped, a la convT2E, but that
will be a follow-up CL.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ISmall             43           15  -64.01%
BenchmarkConvT2IUintptr           45           14  -67.48%
BenchmarkConvT2ILarge            130          101  -22.31%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    8588997000   8499058000   -1.05%
BenchmarkFannkuch11      5300392000   5358093000   +1.09%
BenchmarkGobDecode         30295580     31040190   +2.46%
BenchmarkGobEncode         18102070     17675650   -2.36%
BenchmarkGzip             774191400    771591400   -0.34%
BenchmarkGunzip           245915100    247464100   +0.63%
BenchmarkJSONEncode       123577000    121423050   -1.74%
BenchmarkJSONDecode       451969800    596256200  +31.92%
BenchmarkMandelbrot200     10060050     10072880   +0.13%
BenchmarkParse             10989840     11037710   +0.44%
BenchmarkRevcomp         1782666000   1716864000   -3.69%
BenchmarkTemplate         798286600    723234400   -9.40%

R=rsc, bradfitz, go.peter.90, daniel.morsing, dave, uriel
CC=golang-dev
https://golang.org/cl/6337058
2012-07-03 09:09:05 +10:00
Shenghou Ma
a732cbb593 cmd/gc: add missing case for OCOM in defaultlit()
Fixes #3765.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6349064
2012-07-02 09:33:22 +08:00
Dmitriy Vyukov
91e56e6486 test: enforce 1 proc in the test
otherwise it fails spuriously with "newfunc allocated unexpectedly" message
when run with GOMAXPROCS>1 (other goroutine allocates).

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6347056
2012-07-01 21:59:50 +04:00
Jan Ziak
13802f5654 test/bench/shootout: remove dependency on C libraries in test mode
Fixes #3732.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6335053
2012-06-24 19:23:09 -04:00
Nigel Tao
8f84328fdc cmd/gc: inline convT2E when T is uintptr-shaped.
GOARCH=amd64 benchmarks

src/pkg/runtime
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ESmall             10           10   +1.00%
BenchmarkConvT2EUintptr            9            0  -92.07%
BenchmarkConvT2EBig               74           74   -0.27%
BenchmarkConvT2I                  27           26   -3.62%
BenchmarkConvI2E                   4            4   -7.05%
BenchmarkConvI2I                  20           19   -2.99%

test/bench/go1
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5930908000   5937260000   +0.11%
BenchmarkFannkuch11      3927057000   3933556000   +0.17%
BenchmarkGobDecode         21998090     21870620   -0.58%
BenchmarkGobEncode         12725310     12734480   +0.07%
BenchmarkGzip             567617600    567892800   +0.05%
BenchmarkGunzip           178284100    178706900   +0.24%
BenchmarkJSONEncode        87693550     86794300   -1.03%
BenchmarkJSONDecode       314212600    324115000   +3.15%
BenchmarkMandelbrot200      7016640      7073766   +0.81%
BenchmarkParse              7852100      7892085   +0.51%
BenchmarkRevcomp         1285663000   1286147000   +0.04%
BenchmarkTemplate         566823800    567606200   +0.14%

I'm not entirely sure why the JSON* numbers have changed, but
eyeballing the profile suggests that it could be spending less
and more time in runtime.{new,old}stack, so it could simply be
stack-split boundary noise.

R=rsc, dave, bsiegert, dsymonds
CC=golang-dev
https://golang.org/cl/6280049
2012-06-14 10:43:20 +10:00
Shenghou Ma
97300640ca test/bench/shoutout: fix compliation
-lm must come after the source file, versions of gcc insist this strict order.
On standard compliant systems, we no longer need malloc.h for malloc.
Use pkg-config(1) to get correct glib cflags and libs.
Fix compiler warning in threadring.c and k-nucleotide.c.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6198076
2012-06-08 02:56:23 +08:00
Russ Cox
2a9410c19c cmd/gc: fix LEAQ $0, SI bug
Cannot take effective address of constant.

Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6299055
2012-06-07 11:59:18 -04:00
Russ Cox
6363fc5aa6 cmd/gc: fix type checking loop
CL 4313064 fixed its test case but did not address a
general enough problem:

type T1 struct { F *T2 }
type T2 T1
type T3 T2

could still end up copying the definition of T1 for T2
before T1 was done being evaluated, or T3 before T2
was done.

In order to propagate the updates correctly,
record a copy of an incomplete type for re-execution
once the type is completed. Roll back CL 4313064.

Fixes #3709.

R=ken2
CC=golang-dev, lstoakes
https://golang.org/cl/6301059
2012-06-07 03:06:40 -04:00
Russ Cox
744b23fe48 cmd/gc: do not crash on struct with _ field
Fixes #3607.

R=ken2
CC=golang-dev
https://golang.org/cl/6296052
2012-06-07 02:05:08 -04:00
Russ Cox
ee5f59ab4f cmd/gc: preserve side effects during inlining of function with _ argument
Fixes #3593.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6305061
2012-06-07 01:54:07 -04:00
Dave Cheney
6423682019 test/bench/go1: add go/parser benchmark
As discussed in

https://groups.google.com/d/msg/golang-dev/Na9XE6mcQyY/zbeBI7R-vnoJ

Here is a static copy of the go/parser benchmark. I ended up using
fancy encodings because the original parser.go had a number of `s
scattered throughout which made it hard to embed the source directly.

Curiously on my laptop this benchmark always scores roughly 10% higher
than the standalone benchmark. This may be down to the generation of
the fasta data set triggering the cpu governor to raise the cpu speed.
However the benchmark is consistent with itself across multiple runs.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6305055
2012-06-07 10:23:45 +10:00
Dave Cheney
166dab6993 test/bench/go1: reduce fasta data size for linux/arm
As discussed on golang-dev, reduce the size of the fasta
dataset to make it possible to run the go1 benchmarks on
small ARM systems.

Also, remove the 25m suffix from fasta data and Revcomp.

linux/arm: pandaboard OMAP4

BenchmarkBinaryTree17          1        70892426000 ns/op
BenchmarkFannkuch11            1        35712066000 ns/op
BenchmarkGobDecode            10         137146000 ns/op           5.60 MB/s
BenchmarkGobEncode            50          64953000 ns/op          11.82 MB/s
BenchmarkGzip          1        5675690000 ns/op           3.42 MB/s
BenchmarkGunzip        1        1207001000 ns/op          16.08 MB/s
BenchmarkJSONEncode            5         860424800 ns/op           2.26 MB/s
BenchmarkJSONDecode            1        3321839000 ns/op           0.58 MB/s
BenchmarkMandelbrot200        50          45893560 ns/op
BenchmarkRevcomp              10         135220300 ns/op          18.80 MB/s
BenchmarkTemplate              1        6385681000 ns/op           0.30 MB/s

R=rsc, minux.ma, dsymonds
CC=golang-dev
https://golang.org/cl/6278048
2012-06-06 07:49:58 +10:00
Rémy Oudompheng
7ab62b0bac test: avoid interface conversion in rotate.go
It is not necessary for the test to be effective and uses a
lot of resources in the compiler. Memory usage is halved and
compilation around 8x faster.

R=golang-dev, r, rsc, r
CC=golang-dev
https://golang.org/cl/6290044
2012-06-04 23:31:31 +02:00
Shenghou Ma
6b4ae1d28e test/bench/go1: fix gzip test
We can't depend on init() order, and certainly we don't want to
register all future benchmarks that use jsonbytes or jsondata to init()
in json_test.go, so we use a more general solution: make generation of
jsonbytes and jsondata their own function so that the compiler will take
care of the order.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6282046
2012-06-05 00:14:39 +08:00
Nigel Tao
947a3ddf87 cmd/gc: recognize u<<1 op u>>31 as a rotate when op is ^, not just |.
R=rsc
CC=golang-dev
https://golang.org/cl/6249071
2012-06-04 20:53:32 +10:00
Rob Pike
6f3ffd4d79 test/bench/shootout: more speedups
Most significant in mandelbrot, from avoiding MOVSD between registers,
but there are others.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6258063
2012-05-30 12:31:28 -07:00
Russ Cox
eb056dbea7 shootout: make mandelbrot.go more like mandelbrot.c
Surprise! The C code is using floating point values for its counters.
Its off the critical path, but the Go code and C code are supposed to
be as similar as possible to make comparisons meaningful.

It doesn't have a significant effect.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6260058
2012-05-30 14:40:59 -04:00
Rob Pike
ec4d213594 test/bench/shootout/timing.log: mandelbrot is restored
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6259054
2012-05-30 10:35:47 -07:00
Russ Cox
cb9759d067 test/bench/go1: add mandelbrot for floating point
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6244063
2012-05-30 10:26:59 -04:00
Rob Pike
90d59c5861 test/bench/shootout/timing.log: update after recent compiler changes
Moving panic out of line speeds up fannkuch almost a factor of two.
Changes to bitwhacking code affect mandelbrot badly.

R=golang-dev, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/6258056
2012-05-29 11:01:50 -07:00
Russ Cox
51072eb1fb cmd/gc: fix parallel assignment in range
for expr1, expr2 = range slice
was assigning to expr1 and expr2 in sequence
instead of in parallel.  Now it assigns in parallel,
as it should.  This matters for things like
for i, x[i] = range slice.

Fixes #3464.

R=ken2
CC=golang-dev
https://golang.org/cl/6252048
2012-05-24 23:05:36 -04:00
Russ Cox
bf18d57d4a runtime: handle and test large map values
This is from CL 5451105 but was dropped from that CL.
See also CL 6137051.

The only change compared to 5451105 is to check for
h != nil in reflect·mapiterinit; allowing use of nil maps
must have happened after that original CL.

Fixes #3573.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6215078
2012-05-24 22:41:07 -04:00
Russ Cox
c6ce44822c cmd/gc: faster code, mainly for rotate
* Eliminate bounds check on known small shifts.
* Rewrite x<<s | x>>(32-s) as a rotate (constant s).
* More aggressive (but still minimal) range analysis.

R=ken, dave, iant
CC=golang-dev
https://golang.org/cl/6209077
2012-05-24 17:20:07 -04:00
Russ Cox
ce69666273 exp/locale/collate: avoid 16-bit math
There's no need for the 16-bit arithmetic here,
and it tickles a long-standing compiler bug.
Fix the exp code not to use 16-bit math and
create an explicit test for the compiler bug.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6256048
2012-05-24 14:50:36 -04:00
Russ Cox
c44768cb1c cmd/gc: fix small integer bounds check bug
R=ken2
CC=golang-dev
https://golang.org/cl/6254046
2012-05-24 14:01:39 -04:00
Ian Lance Taylor
6f6bbdf9b7 test: add bug439, valid code that caused a gccgo crash
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6198075
2012-05-15 13:29:46 -07:00
Ian Lance Taylor
dc6ec74f07 test/bench/shootout: fix gccgo binary-list-freelist test
R=r
CC=golang-dev
https://golang.org/cl/6202046
2012-05-07 10:14:50 -07:00
Ian Lance Taylor
6c8447d429 test: add bug438, a valid test case that gccgo used to fail to compile
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6196047
2012-05-04 13:14:09 -07:00
Ian Lance Taylor
890be5ced0 test: add bug437, a test that used to fail with gccgo at link time
Updates #3391.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6177045
2012-05-03 14:25:11 -07:00
Ian Lance Taylor
df64448932 test: add bug436, valid code that crashed gccgo
R=golang-dev, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6158046
2012-05-03 10:33:10 -07:00
Luuk van Dijk
81d9621534 cmd/gc: test for issue 3552
R=rsc
CC=golang-dev
https://golang.org/cl/6128051
2012-05-02 16:56:26 +02:00
Anthony Martin
42aa9abae9 gc: use correct line number for EOF syntax error
I also added some debugging code that's turned
on with -xx.

Fixes #3392.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5909058
2012-04-26 02:57:23 -07:00
Ian Lance Taylor
76490cffaf test: add test for order of evaluation of map index on left of =
Gccgo used to get this wrong.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6121044
2012-04-24 10:17:26 -07:00
Ian Lance Taylor
f14a5347e6 test: test handling of negative float constants
This used to panic when compiled by gccgo.

Updates #2876.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6100055
2012-04-23 15:47:34 -07:00
Luuk van Dijk
5583060c4c cmd/gc: fix addresses escaping through closures called in-place.
Fixes #3545.

R=rsc
CC=golang-dev
https://golang.org/cl/6061043
2012-04-23 15:39:01 -04:00
Shenghou Ma
dda6d6aa70 test: use testlib in a few more cases (part 2)
Introduced "runoutput" cmd for running generated program

R=golang-dev, iant, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/5869049
2012-04-20 23:45:43 +08:00
Rob Pike
caedc603d4 test/bench/shootout: update timing.log to Go 1
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5989063
2012-04-10 16:46:06 +10:00
Dmitriy Vyukov
77e1227a02 test/bench/garbage: fix parser benchmark
+add standard bench output to tree2
+print GOMAXPROCS as go test does

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5992044
2012-04-05 20:35:54 +04:00
Ryan Hitchman
8a686792e0 gc: improve error message for composite literals with unexpected newlines
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5857045
2012-04-02 11:00:55 -04:00
Ian Lance Taylor
373f1a95b0 test: add some tests of valid code that failed with gccgo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5971044
2012-03-30 08:42:21 -07:00
Russ Cox
5eb007dede runtime: work around false negative in deadlock detection
Not a complete fix for issue 3342, but fixes the trivial case.
There may still be a race in the instants before and after
a scavenger-induced garbage collection.

Intended to be "obviously safe": a call to runtime·gosched
before main.main is no different than a call to runtime.Gosched
at the beginning of main.main, and it is (or had better be)
safe to call runtime.Gosched at any point during main.

Update #3342.

R=iant
CC=golang-dev
https://golang.org/cl/5919052
2012-03-27 12:22:19 -04:00
Mikio Hara
4c2614c57c undo CL 5844051 / 5d0322034aa8
Breaks closure test when GOMAXPROCS=2 or more.

««« original CL description
runtime: restore deadlock detection in the simplest case.

Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051

»»»

R=rsc
CC=golang-dev
https://golang.org/cl/5924045
2012-03-27 13:05:17 +09:00
Rémy Oudompheng
84bb2547fb runtime: restore deadlock detection in the simplest case.
Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051
2012-03-26 23:06:20 -04:00
Ian Lance Taylor
d12f1ff7ad test: fix run.bash by spelling out the commands to use for bug424.go
R=golang-dev, gri, iant
CC=golang-dev
https://golang.org/cl/5882046
2012-03-22 12:48:41 -07:00
Ian Lance Taylor
47b6197a01 cmd/gc: when expanding append inline, preserve arguments
Fixes #3369.

R=golang-dev, gri, lvd, r
CC=golang-dev
https://golang.org/cl/5876044
2012-03-22 09:44:31 -07:00
Shenghou Ma
e2662835b8 test: use testlib in a few more cases
Introduce a new skip cmd.

R=golang-dev, bradfitz, iant, iant
CC=golang-dev
https://golang.org/cl/5868048
2012-03-22 02:14:44 +08:00
Anthony Martin
e1f22bdcc5 gc: fix struct and array comparisons for new bool rules
The two optimizations for small structs and arrays
were missing the implicit cast from ideal bool.

Fixes #3351.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5848062
2012-03-19 15:57:28 -07:00
Russ Cox
c978a5a3a9 test: skip . files in directory
Xcode generates ._foo.go files.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5786055
2012-03-08 14:03:40 -05:00
Russ Cox
d4fb568e04 cmd/gc: implement len(array) / cap(array) rule
The spec is looser than the current implementation.
The spec edit was made in CL 4444050 (May 2011)
but I never implemented it.

Fixes #3244.

R=ken2
CC=golang-dev
https://golang.org/cl/5785049
2012-03-07 22:43:28 -05:00
Shenghou Ma
90010f8f63 build: re-enable some broken tests in run.bash
Updates #2982.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5759064
2012-03-08 06:23:56 +08:00
Ian Lance Taylor
b514f0b906 test: enable method expression tests in ddd.go
R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5769044
2012-03-07 11:17:26 -08:00
Ian Lance Taylor
72faa0303e test: fix testlib to not pass an empty argument to 6g
This change is necessary to make the run shell script work
again, but it is not sufficient as bug424.go's execution line
does not name the package that it imports.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5771043
2012-03-07 11:16:58 -08:00
Ian Lance Taylor
e54ad64ff3 test: add inherited interface test to ddd.go
The gccgo compiler incorrectly gave an error for this code.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5767043
2012-03-07 08:24:10 -08:00
Russ Cox
08854b022f test: fix typo
R=ken2
CC=golang-dev
https://golang.org/cl/5752073
2012-03-07 10:21:56 -05:00
Russ Cox
4267974c0b cmd/gc: unnamed struct types can have methods
Fixes #3143.

R=ken2
CC=golang-dev
https://golang.org/cl/5752070
2012-03-07 02:27:15 -05:00
Russ Cox
712473612f test/run: fix builders
Let the outer environment filter down to the commands being run.

TBR=r
CC=golang-dev
https://golang.org/cl/5758066
2012-03-07 02:22:08 -05:00
Russ Cox
987a580b9f cmd/gc: do not confuse unexported methods of same name
Fixes #3146.

R=ken2
CC=golang-dev
https://golang.org/cl/5756074
2012-03-07 01:55:17 -05:00
Russ Cox
105c5fa666 test: invoke go command in run.go
Lets us run multifile tests and tests with arguments.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5753068
2012-03-07 01:54:39 -05:00
Shenghou Ma
47ee98253e test/run: use all available cores on ARM system
R=rsc
CC=golang-dev
https://golang.org/cl/5753054
2012-03-07 12:43:25 +08:00
Rob Pike
905cb4881b all: remove some references to Make.inc etc.
There are a few more but these are the easiest ones.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5756067
2012-03-07 13:51:49 +11:00
Russ Cox
5e41fe0e45 build: use run.go for running tests
Also, tweak run.go to use no more than 2x the
number of CPUs, and only one on ARM.

53.85u 13.33s 53.69r 	 ./run
50.68u 12.13s 18.85r 	 go run run.go

Fixes #2833.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754047
2012-03-05 22:47:23 -05:00
Ian Lance Taylor
06b7024462 test: match gccgo error messages for bug388.go
As runtime.UintType is no longer defined, the gccgo error
messages have changed.

bug388.go:12:10: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:12:10: error: invalid named/anonymous mix
bug388.go:13:21: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:17:10: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:18:18: error: reference to undefined identifier ‘runtime.UintType’
bug388.go:22:9: error: non-name on left side of ‘:=’
bug388.go:27:10: error: expected type
bug388.go:32:9: error: expected type
bug388.go:23:14: error: reference to field ‘i’ in object which has no fields or methods

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5755044
2012-03-05 16:21:46 -08:00
Russ Cox
6e3a7930eb cmd/gc: if $GOROOT_FINAL is set, rewrite file names in object files
GOROOT_FINAL is a build parameter that means "eventually
the Go tree will be installed here".  Make the file name information
match that eventual location.

Fixes #3180.

R=ken, ken
CC=golang-dev
https://golang.org/cl/5742043
2012-03-05 16:13:33 -05:00
Shenghou Ma
eb5af840d5 test/run.go: fix build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5727068
2012-03-06 03:34:53 +08:00
Russ Cox
cae604f734 cmd/gc: must not inline panic, recover
R=lvd, gri
CC=golang-dev
https://golang.org/cl/5731061
2012-03-05 13:51:44 -05:00
Ian Lance Taylor
b14a6643dc test: add test of calling recover in a varargs function
gccgo did not handle this correctly.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5714050
2012-03-01 08:24:03 -08:00
Ian Lance Taylor
532c1b451b test: add bug426.go: a gccgo crash on valid code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5715044
2012-02-29 21:51:21 -08:00
Ian Lance Taylor
f0886ab7e2 test: add a couple of cases to const1.go that crashed gccgo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5713045
2012-02-29 17:39:02 -08:00
Anthony Martin
564a1f3358 gc: fix string comparisons for new bool rules
The two string comparison optimizations were
missing the implicit cast from ideal bool.

Fixes #3119.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696071
2012-02-29 13:55:50 -08:00
Russ Cox
d0d251f858 gc: disallow absolute import paths
They are broken and hard to make work.

They have never worked: if you import "/tmp/x"
from "/home/rsc/p.c" then the compiler rewrites
this into import "/home/rsc/tmp/x", which is
clearly wrong.

Also we just disallowed the : character in import
paths, so import "c:/foo" is already not allowed.

Finally, in order to support absolute paths well in
a build tool we'd have to provide a mechanism to
instruct the compiler to resolve absolute imports
by looking in some other tree (where the binaries live)
and provide a mapping from absolute path to location
in that tree.  This CL avoids adding that complexity.

This is not part of the language spec (and should not be),
so no spec change is needed.

If we need to make them work later, we can.

R=ken2
CC=golang-dev
https://golang.org/cl/5712043
2012-02-29 15:28:36 -05:00
Robert Griesemer
69015b6fc4 test: bug424: wrong embedded method called
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5695083
2012-02-27 18:52:40 -08:00
Rob Pike
e303eeb75b go/test/chan1.go: fix typo
Found by Lucio De Re

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5694071
2012-02-25 08:47:04 +11:00
Anthony Martin
dc38756ce1 gc: reject import paths containing special characters
Also allow multiple invalid import statements in a
single file.

Fixes #3021. The changes to go/parser and the
language specifcation have already been committed.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5672084
2012-02-24 14:48:36 -05:00
Rob Pike
832dcecc99 test/bench/shootout: update post-Makefile
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696054
2012-02-24 16:59:09 +11:00
Rob Pike
eb37b5b744 test: document ken/*.go
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694065
2012-02-24 16:24:24 +11:00
Russ Cox
075eef4018 gc: fix escape analysis + inlining + closure bug
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/5693056
2012-02-23 23:09:53 -05:00
Rob Pike
d45ee4cb5f test: fix the fix of the rename tests.
Now they actually test again instead of just setting iota to zero.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5700058
2012-02-24 15:06:32 +11:00
Brad Fitzpatrick
e014cf0e54 test: add cmpout to testlib
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5699060
2012-02-24 13:17:26 +11:00
Brad Fitzpatrick
a55a5c8df3 test: add temporary show_skips flag.
To find test files with legacy headers.

We can remove this flag once everything is converted.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5694060
2012-02-24 12:52:15 +11:00
Rob Pike
80a9783f84 test/[n-z]*.go: add documentation
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5700056
2012-02-24 11:48:19 +11:00
Rob Pike
19bab1dc78 test/[n-r]*.go: add documentation
The rename ones needed redoing.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5698054
2012-02-24 10:30:39 +11:00
Rob Pike
501f0b578f test: commentary for [h-m]*.go
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5674112
2012-02-23 18:47:26 +11:00
Russ Cox
e29d3dfc49 gc: new, less strict bool rules
R=ken2
CC=golang-dev
https://golang.org/cl/5688064
2012-02-22 00:29:37 -05:00
Russ Cox
a457fa500d gc: return of ideal bool
This is a manual undo of CL 5674098.
It does not implement the even less strict spec
that we just agreed on, but it gets us back where
we were at the last weekly.

R=ken2
CC=golang-dev
https://golang.org/cl/5683069
2012-02-21 22:54:07 -05:00
Rémy Oudompheng
fc3797a491 test: use testlib in a few more cases.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5688057
2012-02-22 00:19:59 +01:00
Rémy Oudompheng
9666a959cf test: fix bug423.go to actually fail with older releases.
The supposedly overflowing variable was registerized.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5687061
2012-02-21 07:50:10 +01:00
Rob Pike
b888671f4c test: fix broken test
TBR=bradfitz

R=golang-dev
CC=golang-dev
https://golang.org/cl/5684050
2012-02-21 16:47:42 +11:00
Rémy Oudompheng
f2ad374ae6 cmd/gc: don't believe that variables mentioned 256 times are unused.
Such variables would be put at 0(SP), leading to serious
corruptions at zero initialization.
Fixes #3084.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5683052
2012-02-21 16:38:01 +11:00
Brad Fitzpatrick
ce837b308f test: rewrite test/run shell script + errchk (perl) in Go
This doesn't run all ~750 of the tests, but most.

Progress on issue 2833

R=golang-dev, ality, rsc, r, r
CC=golang-dev
https://golang.org/cl/5625044
2012-02-21 14:28:49 +11:00
Rob Pike
f03a5796e3 test/initsyscall.go: delete
It's testing an old property of the language and is no longer relevant.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5676104
2012-02-20 07:44:41 +11:00
Rob Pike
c9b36a87eb test/initcomma.go: restore what it's supposed to be testing
which is trailing commas in literals. They were gofmted away at some point.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5673103
2012-02-20 07:44:24 +11:00
Rob Pike
f5ff5b4fcb test/hashmap.go: delete
It's in an odd style and it's unclear what true purpose it serves as
a test other than to be another Go program.

R=gri
CC=golang-dev
https://golang.org/cl/5674111
2012-02-20 07:43:16 +11:00
Rob Pike
3fb5f329b9 test/chan: document tests
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5677094
2012-02-19 17:44:02 +11:00
Rob Pike
13514d4e0b test/interface: document tests
Most already had comments (yay); adjusted for consistency.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5676102
2012-02-19 17:33:41 +11:00
Brad Fitzpatrick
efacb2a1b4 os: remove Getenverror
Fixes #3065

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5675094
2012-02-18 21:18:13 -08:00
Russ Cox
83feedf7bf gc: fix error for floating-point constant %
R=ken2
CC=golang-dev
https://golang.org/cl/5674108
2012-02-19 00:12:31 -05:00
Russ Cox
03f2289f7e runtime: API
Delete Alloc, Free, Lookup, Semacquire, Semrelease

Fixes #2955.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5675093
2012-02-19 00:11:44 -05:00
Rob Pike
83976e3ac8 test: explanatory comments [c-g]*
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656103
2012-02-19 14:28:53 +11:00
Rob Pike
fc0dc04095 test: [a-c]: add introductory comments to tests
Very few of the compiler regression tests include a comment
saying waht they do. Many are obvious, some are anything but.
I've started with a-c in the top directory. More will follow once
we agree on the approach, correctness, and thoroughness here.
zerodivide.go sneaked in too.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5656100
2012-02-19 13:19:43 +11:00
Russ Cox
126d475a43 gc: drop ideal bool
R=golang-dev, ken2
CC=golang-dev
https://golang.org/cl/5674098
2012-02-18 21:07:08 -05:00
Rémy Oudompheng
2ece2f58ee test: use testlib (another bunch).
Apply sed with:

1s,^// $G $D/$F.go && $L $F.$A && ./$A.out || echo.*,// run,
1s,^// $G $D/$F.go || echo.*,// compile,

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5656099
2012-02-18 22:15:42 +01:00
Shenghou Ma
6154f146af test/run: honor $TMPDIR
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5676094
2012-02-18 16:15:12 -05:00
Ian Lance Taylor
292bd04a43 test: change bug040 to use errorcheck
Because bug040.go was ignoring all error messages, the fact
that it got an error about fuction main was being ignored.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5675085
2012-02-17 20:35:40 -08:00
Ian Lance Taylor
f228ed1a90 test: remove a couple of bad tests that duplicate declbad.go
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673089
2012-02-17 20:35:18 -08:00
Ian Lance Taylor
7737e19b15 test: add some tests that gccgo failed to handle correctly
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671090
2012-02-17 17:52:05 -08:00
Russ Cox
c4c92ebeb6 cmd/gc: fix comparison of struct with _ field
Fixes #2989.

R=ken2
CC=golang-dev
https://golang.org/cl/5674091
2012-02-17 14:45:29 -05:00
Russ Cox
57eb06fe93 test: use testlib (final 61)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5671080
2012-02-16 23:51:04 -05:00
Russ Cox
d2cc988429 test: use testlib (fourth 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5673079
2012-02-16 23:50:37 -05:00
Russ Cox
8080384a68 test: use testlib (third 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656083
2012-02-16 23:49:59 -05:00
Russ Cox
2b1c9b4be2 test: use testlib (second 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev
CC=golang-dev
https://golang.org/cl/5673078
2012-02-16 23:49:30 -05:00
Russ Cox
0b477ef17e test: use testlib (first 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656082
2012-02-16 23:48:57 -05:00
Russ Cox
a0c13b9d49 test: add testlib
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5676077
2012-02-16 23:48:24 -05:00
Rob Pike
56069f0333 os: delete os.EINVAL and so on
The set of errors forwarded by the os package varied with system and
was therefore non-portable.
Three helpers added for portable error checking: IsExist, IsNotExist, and IsPermission.
One or two more may need to come, but let's keep the set very small to discourage
thinking about errors that way.

R=mikioh.mikioh, gustavo, r, rsc
CC=golang-dev
https://golang.org/cl/5672047
2012-02-17 10:04:29 +11:00
Rémy Oudompheng
1d3ca9236e cmd/gc: correctly typecheck expression lists in returns.
Invalid return statements were accidentally compiling or
triggering internal errors.
Fixes #3044.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5673074
2012-02-16 23:42:19 +01:00
Rob Pike
21be71a419 all: errors caught by go vet
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5674069
2012-02-16 17:21:21 +11:00
Rémy Oudompheng
79db6ada48 cmd/gc: error on constant shift overflows.
Fixes #3019.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5674044
2012-02-16 00:19:42 +01:00
Ian Lance Taylor
aef23cc49e test: add new test of indirect type references
Similar to bug190, but without recursive reference.  Crashed
gccgo.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672053
2012-02-15 07:39:46 -08:00
Russ Cox
7b848c6964 cmd/dist: cross-compiling fixes
This CL makes it possible to run make.bash with
GOOS and GOARCH set to something other than
the native host GOOS and GOARCH.

As part of the CL, the tool directory moves from bin/tool/
to pkg/tool/goos_goarch where goos and goarch are
the values for the host system (running the build), not
the target.  pkg/ is not technically appropriate, but C objects
are there now tool (pkg/obj/) so this puts all the generated
binaries in one place (rm -rf $GOROOT/pkg cleans everything).
Including goos_goarch in the name allows different systems
to share a single $GOROOT on a shared file system.

Fixes #2920.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5645093
2012-02-13 22:31:51 -05:00
Russ Cox
7dd90621f8 gc: diagnose field+method of same name
Fixes #2828.

R=ken2
CC=golang-dev
https://golang.org/cl/5653065
2012-02-11 01:21:12 -05:00
Russ Cox
337547d1c9 gc: make constant arith errors a little more friendly
Fixes #2804.

R=ken2
CC=golang-dev
https://golang.org/cl/5652067
2012-02-11 00:50:56 -05:00
Russ Cox
77aaa3555d gc: fix import of struct type in struct literal
Fixes #2716.

R=ken2
CC=golang-dev
https://golang.org/cl/5652065
2012-02-11 00:34:01 -05:00
Russ Cox
12fab9d122 gc: add test case for issue 1743
Fixes #1743.
(Actually was fixed earlier, but now we have proof.)

R=ken2
CC=golang-dev
https://golang.org/cl/5649064
2012-02-10 23:20:00 -05:00
Russ Cox
896f0c61c8 gc: diagnose init loop involving func
Fixes #2295.

R=ken2
CC=golang-dev
https://golang.org/cl/5655057
2012-02-10 23:10:45 -05:00
Russ Cox
7ae1fe420e gc: eliminate duplicate ambiguous selector message
Also show actual expression in message when possible.

Fixes #2599.

R=ken2
CC=golang-dev
https://golang.org/cl/5654059
2012-02-10 22:46:56 -05:00
Russ Cox
5340510203 8g: fix opt bug
Was trying to optimize a duplicate float64 move
by registerizing an int64.

Fixes #2588.

R=ken2
CC=golang-dev
https://golang.org/cl/5645086
2012-02-10 22:32:02 -05:00
Russ Cox
ca5da31f83 6g: fix out of registers bug
Fix it twice: reuse registers more aggressively in cgen abop,
and also release R14 and R15, which are no longer m and g.

Fixes #2669.

R=ken2
CC=golang-dev
https://golang.org/cl/5655056
2012-02-10 22:19:34 -05:00
Luuk van Dijk
e0b2ce3401 cmd/gc: suspend safemode during typecheck of inlined bodies.
Should be obviously correct.  Includes minimal test case.
A future CL should clear up the logic around typecheckok and importpkg != nil someday.

R=rsc, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5652057
2012-02-10 22:50:55 +01:00
Russ Cox
5c52404aca gc: implicit type bug fix in export data
TBR=lvd
CC=golang-dev
https://golang.org/cl/5644064
2012-02-09 00:26:08 -05:00
Jamie Gennis
fff732ea2c 6g,8g: make constant propagation inlining-friendly.
This changes makes constant propagation compare 'from' values using node
pointers rather than symbol names when checking to see whether a set
operation is redundant. When a function is inlined multiple times in a
calling function its arguments will share symbol names even though the values
are different. Prior to this fix the bug409 test would hit a case with 6g
where an LEAQ instruction was incorrectly eliminated from the second inlined
function call. 8g appears to have had the same bug, but the test did not fail
there.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5646044
2012-02-08 10:25:13 -05:00
Rob Pike
c5de9b773f bug408: delete
It's disabled and unreproducible.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642053
2012-02-08 10:52:54 +11:00
Russ Cox
e3755434b8 5l, 6l, 8l: implement -X flag
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5643050
2012-02-07 16:46:33 -05:00
Russ Cox
2cc58e93d6 test: disable bug408
Fixes #2902.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5641047
2012-02-07 15:50:26 -05:00
Rémy Oudompheng
0d07600de3 cgo: print line numbers in fatal errors when relevant.
Signatures of fatalf and error_ helpers have been matched for
consistency.
Fixes #1800.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5593049
2012-02-06 20:38:54 +01:00
Rémy Oudompheng
842c906e2e runtime: delete UpdateMemStats, replace with ReadMemStats(&stats).
Unexports runtime.MemStats and rename MemStatsType to MemStats.
The new accessor requires passing a pointer to a user-allocated
MemStats structure.

Fixes #2572.

R=bradfitz, rsc, bradfitz, gustavo
CC=golang-dev, remy
https://golang.org/cl/5616072
2012-02-06 19:16:26 +01:00
Russ Cox
74ee51ee92 cmd/gc: disallow switch _ := v.(type)
Fixes #2827.

R=ken2
CC=golang-dev
https://golang.org/cl/5638045
2012-02-06 12:35:29 -05:00
Luuk van Dijk
0b9f090861 cmd/gc: another special (%hhS) case for method names.
Fixes #2877

R=rsc
CC=golang-dev
https://golang.org/cl/5637047
2012-02-06 16:38:59 +01:00
Luuk van Dijk
5efd5624cc cmd/gc: fix codegen reordering for expressions involving && and ||
Fixes #2821.

R=rsc
CC=golang-dev
https://golang.org/cl/5606061
2012-02-06 15:41:01 +01:00
Luuk van Dijk
419c53af30 gc: don't print implicit type on struct literal in export
As pointed out in the discussion around 2678.

R=rsc
CC=golang-dev
https://golang.org/cl/5534077
2012-02-06 12:19:59 +01:00
Russ Cox
8290536864 build: use cmd/dist
R=bradfitz, ality, r, r, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5615058
2012-02-04 00:54:08 -05:00
Ian Lance Taylor
f25a3873b7 test: fix copyright year in new test case
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5631044
2012-02-03 17:36:48 -08:00
Ian Lance Taylor
59e7a0295a test: test method expressions with parameters, and with import
The gccgo compiler had two different bugs triggered by this
test case.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5606052
2012-02-03 16:38:59 -08:00
Russ Cox
3fe3ae7476 test: fix bug headers
The letter is $A, not $O.
($O is set accidentally, but not for long.)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5629045
2012-02-03 15:22:19 -05:00
Brad Fitzpatrick
040fe32119 test: don't use package main for files without a main function
Part of issue 2833, but works fine with current test runner.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5606056
2012-02-03 11:43:24 -08:00
Ian Lance Taylor
1493bf58f3 test: add test for receiver named _
Was miscompiled by gccgo.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5622054
2012-02-03 07:19:25 -08:00
Ian Lance Taylor
450c955bd9 test: test slice beyond len
When slicing a slice, the bounds may be > len as long as they
are <= cap.  Interestingly, gccgo got that wrong and still
passed the testsuite and all the library tests.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/5622053
2012-02-03 06:29:30 -08:00
Russ Cox
b3750ff52d build: rename $GOROOT/bin/go-tool to $GOROOT/bin/tool.
The go- is redundant now that the directory is required
to be inside $GOROOT.  Rob LGTMed the idea.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5618044
2012-02-02 23:32:41 -05:00
Brad Fitzpatrick
69a5b23dc5 test: make map nan timing test more robust
take 2

R=rsc
CC=golang-dev
https://golang.org/cl/5617045
2012-02-02 11:49:28 -08:00
Ian Lance Taylor
cdabb3d315 test: add import test that caused an incorrect gccgo error
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5622048
2012-02-02 11:04:09 -08:00
Ian Lance Taylor
3692726f32 test: test append with two different named types with same element type
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5615045
2012-02-01 15:24:15 -08:00
Ian Lance Taylor
4e77e0f294 test: test that x := <-c accepts a general expression
The gccgo compiler used to fail to parse this.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5610051
2012-02-01 07:31:00 -08:00
Ian Lance Taylor
f6f83e4938 test: add test which crashed gccgo compiler
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5605046
2012-01-31 16:19:25 -08:00
Russ Cox
33f3afa7af gc: diagnose \ in import path
R=ken2
CC=golang-dev
https://golang.org/cl/5609044
2012-01-31 17:29:59 -05:00
Ian Lance Taylor
2d7495d287 test: float to integer test case
gccgo currently fails this test:

fixedbugs/bug402.go:12:9: error: floating point constant truncated to integer
fixedbugs/bug402.go:13:8: error: floating point constant truncated to integer

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5600050
2012-01-30 21:39:38 -08:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Brad Fitzpatrick
0eb647e71c test: attempt at making a test more robust
A current theory is that this test is too fast for the
time resolution on the VMs where our builders run.

R=rsc
CC=golang-dev
https://golang.org/cl/5581056
2012-01-30 20:17:34 -08:00
Rob Pike
91cb3489ab go: move compilers into the go-tool directory
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.

Fixes #284.

R=rsc
CC=golang-dev
https://golang.org/cl/5598049
2012-01-30 14:46:31 -08:00
Russ Cox
6ebf8a6400 test: add test of NaN in map
R=iant, r
CC=golang-dev
https://golang.org/cl/5576071
2012-01-30 13:41:38 -05:00
Rob Pike
ff8133d42e gopack: rename pack, move to go-tool directory
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5598045
2012-01-30 10:30:46 -08:00
Rémy Oudompheng
21f1769519 gc: use original constant expression in error messages.
Fixes #2768.

R=golang-dev, lvd, iant
CC=golang-dev, remy
https://golang.org/cl/5572081
2012-01-29 10:35:11 +01:00
Ian Lance Taylor
d5b7c5157e test: match gccgo error messages
complit1.go:37:34: error: may only omit types within composite literals of slice, array, or map type
complit1.go:38:19: error: may only omit types within composite literals of slice, array, or map type
complit1.go:18:21: error: slice of unaddressable value
complit1.go:19:10: error: slice of unaddressable value
complit1.go:20:9: error: slice of unaddressable value

convert1.go:28:13: error: invalid type conversion
convert1.go:32:12: error: invalid type conversion (cannot use type string as type Tint64)
convert1.go:36:12: error: invalid type conversion
convert1.go:37:13: error: invalid type conversion
convert1.go:40:11: error: invalid type conversion
convert1.go:41:12: error: invalid type conversion
convert1.go:44:12: error: invalid type conversion
convert1.go:46:13: error: invalid type conversion
convert1.go:48:11: error: invalid type conversion
convert1.go:50:12: error: invalid type conversion
convert1.go:52:6: error: invalid type conversion
convert1.go:53:12: error: invalid type conversion
convert1.go:54:12: error: invalid type conversion
convert1.go:56:13: error: invalid type conversion
convert1.go:57:11: error: invalid type conversion
convert1.go:58:11: error: invalid type conversion
convert1.go:64:13: error: invalid type conversion
convert1.go:68:12: error: invalid type conversion (cannot use type Tstring as type Tint64)
convert1.go:72:12: error: invalid type conversion
convert1.go:73:13: error: invalid type conversion
convert1.go:76:11: error: invalid type conversion (cannot use type Tbyte as type Trune)
convert1.go:77:12: error: invalid type conversion (cannot use type Tbyte as type Tint64)
convert1.go:80:12: error: invalid type conversion
convert1.go:82:13: error: invalid type conversion
convert1.go:84:11: error: invalid type conversion (cannot use type Trune as type Tbyte)
convert1.go:86:12: error: invalid type conversion (cannot use type Trune as type Tint64)
convert1.go:88:6: error: invalid type conversion (cannot use type Tint64 as type string)
convert1.go:89:12: error: invalid type conversion
convert1.go:90:12: error: invalid type conversion
convert1.go:92:13: error: invalid type conversion (cannot use type Tint64 as type Tstring)
convert1.go:93:11: error: invalid type conversion (cannot use type Tint64 as type Tbyte)
convert1.go:94:11: error: invalid type conversion (cannot use type Tint64 as type Trune)

fixedbugs/bug195.go:9:21: error: interface contains embedded non-interface
fixedbugs/bug195.go:12:21: error: interface contains embedded non-interface
fixedbugs/bug195.go:15:15: error: interface contains embedded non-interface
fixedbugs/bug195.go:18:2: error: invalid recursive interface
fixedbugs/bug195.go:26:2: error: invalid recursive interface
fixedbugs/bug195.go:22:2: error: invalid recursive interface

fixedbugs/bug251.go:15:2: error: invalid recursive interface
fixedbugs/bug251.go:11:2: error: invalid recursive interface

fixedbugs/bug374.go:18:34: error: use of undefined type ‘xxxx’
fixedbugs/bug374.go:16:5: error: incompatible type in initialization (incompatible type for method ‘m’ (different number of parameters))

fixedbugs/bug383.go:11:2: error: expected boolean expression
fixedbugs/bug383.go:12:2: error: expected boolean expression

fixedbugs/bug386.go:10:25: error: incompatible type for return value 1 (type has no methods)
fixedbugs/bug386.go:12:25: error: incompatible type for return value 1 (type has no methods)

fixedbugs/bug388.go:12:10: error: invalid named/anonymous mix
fixedbugs/bug388.go:17:19: error: non-name on left side of ‘:=’
fixedbugs/bug388.go:22:9: error: non-name on left side of ‘:=’
fixedbugs/bug388.go:27:10: error: expected type
fixedbugs/bug388.go:32:9: error: expected type
fixedbugs/bug388.go:23:14: error: reference to field ‘i’ in object which has no fields or methods
fixedbugs/bug388.go:18:18: error: invalid use of type

fixedbugs/bug389.go:12:5: error: incompatible type in initialization (different parameter types)

fixedbugs/bug390.go:15:24: error: expected integer, floating, or complex type

fixedbugs/bug394.go:10:1: error: expected declaration

fixedbugs/bug397.go:12:2: error: incompatible type for element 2 key in map construction

switch3.go:18:2: error: incompatible types in binary expression
switch3.go:22:2: error: incompatible types in binary expression
switch3.go:28:2: error: map can only be compared to nil
switch3.go:35:2: error: slice can only be compared to nil
switch3.go:42:2: error: func can only be compared to nil

syntax/else.go:11:9: error: expected ‘if’ or ‘{’

typeswitch2.go:15:2: error: duplicate type in switch
typeswitch2.go:19:2: error: duplicate type in switch
typeswitch2.go:26:2: error: duplicate type in switch
typeswitch2.go:40:9: error: ‘t’ declared and not used

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5573073
2012-01-26 23:06:47 -08:00
Russ Cox
408f0b1f74 gc, runtime: handle floating point map keys
Fixes #2609.

R=ken2
CC=golang-dev
https://golang.org/cl/5572069
2012-01-26 16:25:07 -05:00
Russ Cox
ee9bfb023a gc: fix order of evaluation
Pulling function calls out to happen before the
expression being evaluated was causing illegal
reorderings even without inlining; with inlining
it got worse.  This CL adds a separate ordering pass
to move things with a fixed order out of expressions
and into the statement sequence, where they will
not be reordered by walk.

Replaces lvd's CL 5534079.

Fixes #2740.

R=lvd
CC=golang-dev
https://golang.org/cl/5569062
2012-01-25 17:53:50 -05:00
Olivier Duperray
0da89b3964 test: Add the usual Copyright notice.
Fixes #2759.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570053
2012-01-24 14:48:15 -05:00
Luuk van Dijk
0e919ff2c9 gc: static implements check on typeswitches only applies to concrete case types.
Fixes #2700.

R=rsc
CC=golang-dev
https://golang.org/cl/5574046
2012-01-24 13:53:00 +01:00
Luuk van Dijk
93c4e29605 gc: missed typecheck in subscripting a const string.
Fixes #2674.

R=rsc
CC=golang-dev
https://golang.org/cl/5574045
2012-01-23 16:57:12 +01:00
Luuk van Dijk
5ad9e2db28 gc: handle function calls in arguments to builtin complex operations.
Fixes #2582

R=rsc
CC=golang-dev
https://golang.org/cl/5574044
2012-01-23 16:56:57 +01:00
Russ Cox
427b5bddcd gc: fix recursion loop in interface comparison
iant's idea.

Fixes #2745.

R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/5536085
2012-01-23 09:19:02 -05:00
Ian Lance Taylor
387e7c2742 test: explicitly use variables to avoid gccgo "not used" error
I haven't looked at the source, but the gc compiler appears to
omit "not used" errors when there is an error in the
initializer.  This is harder to do in gccgo, and frankly I
think the "not used" error is still useful even if the
initializer has a problem.  This CL tweaks some tests to avoid
the error, which is not the point of these tests in any case.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5561059
2012-01-22 11:50:45 -08:00
David Symonds
c3eddc4503 gc: test case for recursive interface bug.
R=rsc
CC=golang-dev
https://golang.org/cl/5555066
2012-01-21 17:02:54 +11:00
Russ Cox
290e68b983 gc: undo most of 'fix infinite recursion for embedded interfaces'
Preserve test.

changeset:   11593:f1deaf35e1d1
user:        Luuk van Dijk <lvd@golang.org>
date:        Tue Jan 17 10:00:57 2012 +0100
summary:     gc: fix infinite recursion for embedded interfaces

This is causing 'interface type loop' errors during compilation
of a complex program.  I don't understand what's happening
well enough to boil it down to a simple test case, but undoing
this change fixes the problem.

The change being undone is fixing a corner case (uses of
pointer to interface in an interface definition) that basically
only comes up in erroneous Go programs.  Let's not try to
fix this again until after Go 1.

Unfixes issue 1909.

TBR=lvd
CC=golang-dev
https://golang.org/cl/5555063
2012-01-20 17:14:09 -05:00
Jeff R. Allen
46e7cb57c9 gc: do not try to add a key with incorrect type to a hash
Fixes #2623.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5533043
2012-01-20 13:34:38 -05:00
Ian Lance Taylor
5e77b009d0 test: split golden.out into expected output per test
This will permit gccgo to check test output.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554056
2012-01-18 16:12:24 -08:00
Ian Lance Taylor
f203093852 test: change several tests to not print
This will make these tests more meaningful for gccgo, which
runs tests in parallel and has no equivalent to golden.out.

Remove ken/simpprint.go since it duplicates helloworld.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5536058
2012-01-18 14:31:31 -08:00
Ian Lance Taylor
6b3462820f test: gofmt a few tests
I'm planning to change these tests, but the gofmt changes are
fairly extensive, so I'm separating the gofmt changes from the
substantive changes.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5557052
2012-01-18 13:20:55 -08:00
Luuk van Dijk
6ff01f01f4 gc: fieldnames in structliterals in exported inlines should not be qualified if they're embedded builtin types.
Trust me.
Fixes #2687.

R=rsc
CC=golang-dev
https://golang.org/cl/5545047
2012-01-18 17:51:28 +01:00
Ian Lance Taylor
6a5db20d14 test: match gccgo error messages for bug345
bug345.dir/main.go:25:18: error: argument 1 has incompatible type (need explicit conversion; missing method ‘Write’)
bug345.dir/main.go:27:8: error: argument 1 has incompatible type

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5556043
2012-01-17 18:00:34 -08:00
Ian Lance Taylor
24c76f68ed test: fix bug364 to actually run
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5536044
2012-01-17 18:00:11 -08:00
Rob Pike
7585aa6ae5 utf8.String: move to exp/utf8string.String
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5528115
2012-01-17 14:21:50 -08:00
Luuk van Dijk
9523b4d59c gc: fix infinite recursion for embedded interfaces
Fixes #1909

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5523047
2012-01-17 10:00:57 +01:00
Scott Lawrence
b16f3a2d50 gc: don't fault on return outside function
Fixes #2598.

R=golang-dev, ality, minux.ma, mpimenov, rsc
CC=golang-dev
https://golang.org/cl/5510043
2012-01-16 18:12:25 -05:00
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01:00
Rémy Oudompheng
94ff311d1b gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.

R=lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5489128
2012-01-12 12:08:40 +01:00
Russ Cox
524fb81c41 gc: inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5533078
2012-01-11 20:32:02 -05:00
Russ Cox
81728cf06d gc: fix inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5532077
2012-01-11 17:25:09 -05:00
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Russ Cox
4a6b07f235 gc: enable inlining by default
R=lvd, r
CC=golang-dev
https://golang.org/cl/5531058
2012-01-10 20:08:53 -08:00
Russ Cox
a6d8b483b6 runtime: make garbage collector faster by deleting code
Suggested by Sanjay Ghemawat.  5-20% faster depending
on the benchmark.

Add tree2 garbage benchmark.
Update other garbage benchmarks to build again.

R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5530074
2012-01-10 19:49:11 -08:00
Luuk van Dijk
25cf9bdea6 gc: test that asserts closures are not wrapped when they don't have closure vars.
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5529060
2012-01-10 21:47:22 +01:00
Luuk van Dijk
a6c49098bc gc: Nicer errors before miscompiling.
This fixes issue 2444.

A big cleanup of all 31/32bit size boundaries i'll leave for another cl though.  (see also issue 1700).

R=rsc
CC=golang-dev
https://golang.org/cl/5484058
2012-01-10 11:19:22 +01:00
Luuk van Dijk
4bcc9c6b5e gc: disallow declaration of variables outside package.
Fixes #2231.

Declaring main.i in package main in the same way already triggers syntax errors.

R=rsc
CC=golang-dev
https://golang.org/cl/5483078
2012-01-10 11:18:56 +01:00
Luuk van Dijk
41806ec26d gc: remove now redundant typecheck of ->ninit on switches.
Fixes #2576.

R=rsc
CC=golang-dev
https://golang.org/cl/5498105
2012-01-09 21:42:24 +01:00
Ryan Hitchman
a15448d65e gc: improve unsafe.Pointer type-check error messages
Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
2012-01-06 14:34:16 -08:00
Rob Pike
c50e4f5e2f testing: allow benchmarks to print and fail
Refactors the benchmarks and test code.
Now benchmarks can call Errorf, Fail, etc.,
and the runner will act accordingly.

Because functionality has been folded into an
embedded type, a number of methods' docs
no longer appear in godoc output. A fix is
underway; if it doesn't happen fast enough,
I'll add wrapper methods to restore the
documentation.

R=bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5492060
2011-12-20 09:51:39 -08:00
Maxim Pimenov
bf6dd2db04 various: use $GCFLAGS and $GCIMPORTS like Make does
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5489065
2011-12-16 11:31:39 -05:00
Russ Cox
6e8875551a test/bench/go1: first draft of Go 1 benchmark suite
I have included a few important microbenchmarks,
but the overall intent is to have mostly end-to-end
benchmarks timing real world operations.

The jsondata.go file is a summary of agl's
activity in various open source repositories.
It gets used as test data for many of the benchmarks.

Everything links into one binary (even the test data)
so that it is easy to run the benchmarks on many
computers: there is just one file to copy around.

R=golang-dev, r, bradfitz, adg, r
CC=golang-dev
https://golang.org/cl/5484071
2011-12-15 12:32:59 -05:00
Luuk van Dijk
7e6890a670 gc: inlining, allow empty bodies, fix _ arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/5487077
2011-12-15 17:50:59 +01:00
Luuk van Dijk
5b2f8d96ce gc: omit argument names from function types in error messages
Fixes #2563

R=rsc
CC=golang-dev
https://golang.org/cl/5495047
2011-12-15 17:38:47 +01:00
Luuk van Dijk
9bf3478658 gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels
emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case.

R=rsc
CC=golang-dev
https://golang.org/cl/5483071
2011-12-15 17:35:59 +01:00
Russ Cox
17264df112 gc: implement and test \r in raw strings
For issue 680.

R=ken2
CC=golang-dev
https://golang.org/cl/5492046
2011-12-15 10:47:09 -05:00
Luuk van Dijk
e14d1d7e41 gc: use inferred type rather than original one when reporting non-assignability.
Fixes #2451

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5372105
2011-12-14 17:34:35 +01:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Russ Cox
5fe96c640a test/garbage: move to test/bench/garbage
(These are benchmarks for the garbage collector, not tests.)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5484070
2011-12-13 18:02:49 -05:00
Russ Cox
1161e1172b fix build, sorry
TBR=r
CC=golang-dev
https://golang.org/cl/5488066
2011-12-13 17:53:00 -05:00
Russ Cox
bcbb2f93ee test/bench: move to test/bench/shootout
R=golang-dev, r, gri, bradfitz
CC=golang-dev
https://golang.org/cl/5487067
2011-12-13 17:46:54 -05:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
Russ Cox
1cb7f85d74 gc: 0 expected bugs
Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
2011-12-09 14:58:28 -05:00
Russ Cox
8c0b699ca4 gc: fix another blank bug
R=ken2
CC=golang-dev
https://golang.org/cl/5478051
2011-12-09 11:59:21 -05:00
Russ Cox
012798a325 gc: rune is now an alias for int32
R=ken2
CC=golang-dev
https://golang.org/cl/5467049
2011-12-09 00:12:07 -05:00
Russ Cox
be0ffbfd02 gc: implement character constant type rules
R=ken2
CC=golang-dev
https://golang.org/cl/5444054
2011-12-08 22:07:43 -05:00
Rémy Oudompheng
4349effb15 gc: keep pointer to original node in constant rewrites.
This allows printing meaningful expressions in error messages
instead of evaluated constants.
Fixes #2276.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5432082
2011-12-07 16:18:50 -05:00
Russ Cox
5e98505ba7 gc: fix spurious typecheck loop in &composite literal
Fixes #2538.

R=ken2
CC=golang-dev
https://golang.org/cl/5449114
2011-12-07 15:48:55 -05:00
Russ Cox
3c56a7b17e test: make array smaller in nilptr test
Fixes #2314.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5437154
2011-12-07 15:00:44 -05:00
Russ Cox
46deaa297b gc: disallow map/func equality via interface comparison
Missed when I removed direct map/func equality.

R=ken2
CC=golang-dev
https://golang.org/cl/5452052
2011-12-06 10:48:17 -05:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
5cb1c82d96 gc: remove type elision in struct literals
R=ken2
CC=golang-dev
https://golang.org/cl/5437136
2011-12-05 14:22:41 -05:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
7dc9d8c72b gc: composite literals as per Go 1
R=ken2
CC=golang-dev
https://golang.org/cl/5450067
2011-12-02 14:13:12 -05:00
Russ Cox
7d15eda95d gc: do not allow slice of array literal
R=ken2
CC=golang-dev
https://golang.org/cl/5440083
2011-12-02 12:30:56 -05:00
Adam Langley
bac7bc55a6 Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Russ Cox
8e515485e2 gc: remove funarg special case in structfield
This should make CL 5431046 a little simpler.

R=ken2
CC=golang-dev
https://golang.org/cl/5444048
2011-11-28 16:40:39 -05:00
Rémy Oudompheng
60e4a61d30 gc: don't inherit orig from subnodes in constant expression nodes.
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes #2452.

R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
2011-11-28 12:22:15 -05:00
Maxim Pimenov
ffa6b383f5 gc: fix copying of types
reset xmethod during copytype

Fixes #2497

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5441045
2011-11-28 11:52:16 -05:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Russ Cox
4d27f64863 gofmt: do not stop test.sh after 1 error
Fix bug377.go to be gofmt-compliant.

R=gri, r, r
CC=golang-dev
https://golang.org/cl/5400045
2011-11-16 18:44:21 -05:00
Russ Cox
d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
Russ Cox
5bb54b8e9c gc: remove func, map compare
R=ken, ken
CC=golang-dev
https://golang.org/cl/5373079
2011-11-13 22:58:08 -05:00
Russ Cox
5fc3771b3a gc: remove m[k] = x, false
R=ken2
CC=golang-dev
https://golang.org/cl/5376076
2011-11-11 16:48:25 -05:00
Luuk van Dijk
924ea515cf gc: better error for non-calling use of unsafe builtins.
Fixes #1951

R=rsc
CC=golang-dev
https://golang.org/cl/5372041
2011-11-09 18:30:54 +01:00
Luuk van Dijk
d5a5855ba1 gc: Preserve original blank name for .anon substitution on out params.
Fixes #1802.

R=rsc
CC=golang-dev
https://golang.org/cl/5364043
2011-11-09 11:27:27 +01:00
Luuk van Dijk
151b2f1509 gc: Fail on implicit assigment to non-exported fields in copy and append.
Fixes #1387.

R=rsc
CC=golang-dev
https://golang.org/cl/5348046
2011-11-09 11:17:06 +01:00
Luuk van Dijk
13e92e4d75 gc: Better typechecks and errors in switches.
Allow any type in switch on interface value.
Statically check typeswitch early.

Fixes #2423.
Fixes #2424.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
2011-11-09 10:58:53 +01:00
Rob Pike
f9489bed72 renaming_4: gofix -r everything/but/src/pkg
R=rsc
CC=golang-dev
https://golang.org/cl/5338043
2011-11-08 15:43:02 -08:00
Rob Pike
6ab6c49fce renaming_1: hand-edited files for go 1 renaming
This contains the files that required handiwork, mostly
Makefiles with updated TARGs, plus the two packages
with modified package names.
html/template/doc.go needs a separate edit pass.
test/fixedbugs/bug358.go is not legal go so gofix fails on it.

R=rsc
CC=golang-dev
https://golang.org/cl/5340050
2011-11-08 15:38:47 -08:00
Luuk van Dijk
087bec3dcd gc: Clean up dostruct/stotype, detect broken fields and propagate up to structs and functions to supress spurious errors.
Fixes #1556.

R=rsc
CC=golang-dev
https://golang.org/cl/5351042
2011-11-07 21:35:13 +01:00
Luuk van Dijk
ea9e93862d gc: Better error message for range over non-receive channel.
Fixes #2354

R=rsc
CC=golang-dev
https://golang.org/cl/5346044
2011-11-06 22:14:15 +01:00
Luuk van Dijk
0d6f857c3f gc: Switch related errors should use plain format.
Fixes #2422.

R=rsc
CC=golang-dev
https://golang.org/cl/5353046
2011-11-06 22:13:54 +01:00
Ian Lance Taylor
7f0622e66d test: make closedchan.go exit with failure if something fails
R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/5356042
2011-11-04 14:12:35 -07:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Luuk van Dijk
11075ed893 gc: Don't pollute the xmethod list with non-methods.
Fixes #2355.

I have a test, but not sure if it's worth adding.  Instead i've made
the patching-over in reflect.c methods more fatal and more descriptive.

R=rsc
CC=golang-dev
https://golang.org/cl/5302082
2011-11-03 17:51:15 +01:00
Mikio Hara
bc440f1bfe test: clear execute bit from source file
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5330068
2011-11-03 10:26:33 +09:00
Luuk van Dijk
7df9ff5594 gc: helpful message instead of internal error on method call on pointer to pointer.
Fixes #2343.

R=rsc
CC=golang-dev
https://golang.org/cl/5332048
2011-11-02 17:18:53 +01:00
Luuk van Dijk
29a5ae657f gc: small fixes for printing.
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice

fixes #2414

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
2011-11-02 15:36:33 +01:00
Russ Cox
44526cdbe0 non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
https://golang.org/cl/5307066
2011-11-01 22:06:05 -04:00
Russ Cox
b4df33a6ea gc: test + fix escape analysis bug
R=lvd
CC=golang-dev
https://golang.org/cl/5333049
2011-11-01 11:02:43 -04:00
Russ Cox
a07841e21e test: make bug107 os.Error-proof
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5306087
2011-10-31 17:50:38 -04:00
Luuk van Dijk
50110c9f83 gc: clean up printing.
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.

fixes #2361

R=rsc
CC=golang-dev
https://golang.org/cl/5316043
2011-10-31 18:09:40 +01:00
Russ Cox
64f78c918a test: error-related fixes
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5328051
2011-10-27 19:41:39 -07:00
Russ Cox
8658b36ba2 test/alias.go: additional tests
R=ken2
CC=golang-dev
https://golang.org/cl/5327045
2011-10-26 15:27:47 -07:00
Russ Cox
db33959797 cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here.

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5300043
2011-10-25 22:20:02 -07:00
Russ Cox
862179b0f5 gc: preserve uint8 and byte distinction in errors, import data
There is no semantic change here, just better errors.
If a function says it takes a byte, and you pass it an int,
the compiler error now says that you need a byte, not
that you need a uint8.

Groundwork for rune.

R=ken2
CC=golang-dev
https://golang.org/cl/5300042
2011-10-18 14:55:50 -04:00