aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2018-02-08libgo: update to Go1.10rc2Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/92736 From-SVN: r257493
2018-02-07runtime: don't call funcPC from a functionIan Lance Taylor1-1/+1
The escape analysis support is not yet good enough to avoid escaping the argument to funcPC. This causes unnecessary and often harmful memory allocation. E.g., (*cpuProfile).addExtra can be called from a signal handler, and it must not allocate memory. Move the calls to funcPC to use variables instead. This was done in the original migration to using funcPC, but was not done for newer code. In one case, in signal handling code, use getSigtramp. Reviewed-on: https://go-review.googlesource.com/92735 From-SVN: r257463
2018-02-07compiler: make single Btype for methods table of identical interface typeIan Lance Taylor3-5/+55
Normally we ensure to build a single Btype for identical types. We did not do this for methods table of identical interface types, however. If there are two identical interface type I, I2, they have the same Btype BI, but different Btypes for their methods tables, BM and BM2. From the backend's point of view only one of them is linked to BI. This can cause inconsitency in the backend's type system, like unresolved placeholder. This CL ensures we create a single Btype for methods table of identical interface type. Reviewed-on: https://go-review.googlesource.com/92436 From-SVN: r257436
2018-02-06compiler: avoid negative zero in float constantsIan Lance Taylor3-3/+64
Check for negative numbers with very small magnitudes that will round to negative zero, and force them to positive zero instead. This implements the spec clarification in https://golang.org/cl/14727. The test is in https://golang.org/cl/91895. Fixes golang/go#12621 Reviewed-on: https://go-review.googlesource.com/92175 From-SVN: r257415
2018-02-06runtime: correct runtime structfield type to match reflectIan Lance Taylor1-1/+1
The offset field in structfield has changed to offsetAnon, and now requires a shift to get the actual offset value. Fixes golang/go#23391 Reviewed-on: https://go-review.googlesource.com/92275 From-SVN: r257413
2018-02-05compiler: rollback "avoid negative zero in float constants"Ian Lance Taylor3-54/+3
It uses functions that are not available in MPFR 2.4.2, which is the current version supported by GCC. Original change description: compiler: avoid negative zero in float constants Check for negative numbers with very small magnitudes that will round to negative zero, and force them to positive zero instead. This implements the spec clarification in https://golang.org/cl/14727. The test is in https://golang.org/cl/91895. Fixes golang/go#12621 Updates golang/go#12621 Reviewed-on: https://go-review.googlesource.com/92055 From-SVN: r257393
2018-02-05compiler: avoid negative zero in float constantsIan Lance Taylor3-3/+54
Check for negative numbers with very small magnitudes that will round to negative zero, and force them to positive zero instead. This implements the spec clarification in https://golang.org/cl/14727. The test is in https://golang.org/cl/91895. Fixes golang/go#12621 Reviewed-on: https://go-review.googlesource.com/91915 From-SVN: r257390
2018-02-05compiler: update iota handling, fix using iota in array lengthIan Lance Taylor7-120/+227
CL 71750 changed the definition of how iota works. This patch updates gccgo for the new definition. We've been mishandling iota appearing in a type that appears in a const expression, as in `c = len([iota]int{})`. Correct that by copying type expressions when we copy an expression. For simplicity only copy when it can change the size of a type, as that is the only case where iota in a type can affect the value of a constant (I think). This is still a bunch of changes, but almost all boilerplate. Fixes golang/go#22341 Reviewed-on: https://go-review.googlesource.com/91475 From-SVN: r257379
2018-02-05compiler: permit empty statements after fallthroughIan Lance Taylor2-3/+18
The language spec permits empty statements after a fallthrough statement, so implement that. Also give a better error message when a fallthrough statement is in the wrong place. The test case for this is in the master repository, test/fixedbugs/issue14540.go, just not yet in the gccgo repository. Fixes golang/go#14538 Reviewed-on: https://go-review.googlesource.com/91855 From-SVN: r257378
2018-02-05compiler: in range, evaluate array if it has receives or callsIan Lance Taylor5-22/+37
The last change was incomplete, in that it did not evaluate the array argument in some cases where it had to be evaluated. This reuses the existing code for checking whether len/cap is constant. Also clean up the use of _ as the second variable in a for/range, which was previously inconsistent depending on whether the statement used = or :=. Updates golang/go#22313 Reviewed-on: https://go-review.googlesource.com/91715 From-SVN: r257377
2018-02-05compiler: give error for non-int arguments to makeIan Lance Taylor2-2/+19
This implements a requirement of the language spec. While we're here fix the value returned by the type method of a builtin call expression to make, although this doesn't seem to make any difference anywhere since we lower this to a runtime call before the determine_types pass anyhow. There is already a test for this error in the master repository: test/fixedbugs/issue16949.go. It just hasn't made it into the gccgo testsuite yet. Fixes golang/go#16949 Reviewed-on: https://go-review.googlesource.com/91697 From-SVN: r257376
2018-02-05compiler: don't error for goto over type or const declarationIan Lance Taylor2-4/+10
We should only issue an error for a goto over a var declaration. The test case for this is already in the master repository, at test/fixedbugs/issue8042.go. It just hasn't been copied into the gccgo repository yet. Fixes golang/go#19089 Reviewed-on: https://go-review.googlesource.com/91696 From-SVN: r257375
2018-02-05compiler: correct parse of parenthesized select caseIan Lance Taylor2-7/+21
We used to mishandle `select { case (<-c): }` and friends. The test case for this is https://golang.org/cl/91657. Fixes golang/go#20923 Reviewed-on: https://go-review.googlesource.com/91695 From-SVN: r257374
2018-02-05cmd/go: don't lose last flag from _cgo_flagsIan Lance Taylor1-1/+1
The quoting code that read _cgo_flags, currently only in the gccgo version of cmd/go, was losing the last flag read from the file. Fixes golang/go#23666 Reviewed-on: https://go-review.googlesource.com/91655 From-SVN: r257373
2018-02-03go-gcc.cc (Gcc_backend::fill_in_struct): Mark struct types as using ↵Ian Lance Taylor2-0/+12
structural equality. * go-gcc.cc (Gcc_backend::fill_in_struct): Mark struct types as using structural equality. From-SVN: r257357
2018-02-02go-gcc.cc (Gcc_backend::type_size): Return 0 for void_type_node.Ian Lance Taylor2-9/+43
* go-gcc.cc (Gcc_backend::type_size): Return 0 for void_type_node. (Gcc_backend::convert_expression): Don't convert if the type of expr_tree is void_type_node. (Gcc_backend::array_index_expression): Don't index if the type of the array expression is void_type_node. (Gcc_backend::init_statement): Don't initialize if the type of the initializer expression is void_type_node. (Gcc_backend::assignment_statement): Don't assign if the type of either the left or right hand side is void_type_node. (Gcc_backend::temporary_variable): Don't initialize if the type of the initializer expression is void_type_node. From-SVN: r257334
2018-02-02compiler: don't incorrectly evaluate range variableIan Lance Taylor2-13/+37
The language spec says that in `for i = range x`, in which there is no second iteration variable, if len(x) is constant, then x is not evaluated. This only matters when x is an expression that panics but whose type is an array type; in such a case, we should not evaluate x, since len of any array type is a constant. Fixes golang/go#22313 Reviewed-on: https://go-review.googlesource.com/91555 From-SVN: r257330
2018-02-02reflect: enable allocation testsIan Lance Taylor1-1/+1
They were disabled due to the lack of escape analysis. Now that we have escape analysis, unskip these tests. Reviewed-on: https://go-review.googlesource.com/86248 From-SVN: r257324
2018-02-02runtime: scan register backing store on ia64Ian Lance Taylor1-1/+1
On ia64, a separate stack is used for saving/restoring register frames, occupying the other end of the stack mapping. This must also be scanned for pointers into the heap. Reviewed-on: https://go-review.googlesource.com/85276 From-SVN: r257323
2018-02-02compiler: turn on escape analysis by defaultCherry Zhang9-20/+29
The escape analysis now runs by default. It can be disabled with the negative flag, -fno-go-optimize-allocs. Reviewed-on: https://go-review.googlesource.com/86247 * lang.opt (fgo-optimize): Remove RejectNegative. * go-c.h (go_enable_optimize): Update declaration to take value argument. * go-lang.c (go_langhook_handle_option): Pass value to go_enable_optimize. * gccgo.texi (Invoking gccgo): Update -fgo-optimize-allocs doc. From-SVN: r257319
2018-02-01compiler: omit field name for embedded fields in reflection stringIan Lance Taylor2-6/+6
This matches the gc compiler. The test case was sent for the master repo as https://golang.org/cl/91138. Fixes golang/go#23620 Reviewed-on: https://go-review.googlesource.com/91139 From-SVN: r257300
2018-02-01net: declare lib_getaddrinfo as returning int32Ian Lance Taylor1-1/+1
Otherwise on a 64-bit system we will read the 32-bit value as a 64-bit value. Since getaddrinfo returns negative numbers as error values, these will be interpreted as numbers like 0xfffffffe rather than -2, and the comparisons with values like syscall.EAI_NONAME will fail. Fixes golang/go#23645 Reviewed-on: https://go-review.googlesource.com/91296 From-SVN: r257299
2018-02-01compiler: check for nil receiver in value methodIan Lance Taylor2-2/+2
We already dereference the pointer to copy the value, but if the method does not use the value then the pointer dereference may be optimized away. Do an explicit nil check so that we get the panic that is required. Fixes golang/go#19806 Reviewed-on: https://go-review.googlesource.com/91275 * go.go-torture/execute/printnil.go: New test. From-SVN: r257280
2018-01-31compiler: lower expression types in lowering passIan Lance Taylor4-2/+34
Ensure that array types with complicated length expressions are handled correctly by lowering expression types in the lowering pass. This required some adjustment of constant expression types to not report too many errors for circular constant expressions. We now record error types in the Named_constant type. If we find the circularity due to lowering the Named_constant, we use that location for the error message; this retains the error location we used to use. Fixes golang/go#23545 Reviewed-on: https://go-review.googlesource.com/91035 From-SVN: r257250
2018-01-31runtime: fix type descriptor name in C codeIan Lance Taylor1-1/+1
I forgot to update the name of the map[string]bool type descriptor used in go-fieldtrack.c. This didn't cause any errors because it's a weak symbol, and the current testsuite has no field tracking tests. Reviewed-on: https://go-review.googlesource.com/91096 From-SVN: r257249
2018-01-31gotest: accept symbols with leading dotIan Lance Taylor1-1/+1
On AIX nm displays symbols with a leading dot; don't discard such symbols. While we're here stop doing fgrep -v '$', symbol names no longer contain '$' anyhow. Reviewed-on: https://go-review.googlesource.com/91095 From-SVN: r257247
2018-01-31net: rename TestAddr6 to avoid gotest confusionIan Lance Taylor1-1/+1
On ppc64 gotest treats data variables whose names begin with "Test" as tests to run. This is to support the function descriptors used for ppc64 ELF ABI v1. This causes gotest to think that TestAddr6 is a test, when it is actually a variable. For a simple fix until we can figure out how to write gotest properly, rename the variable. Fixes golang/go#23623 Reviewed-on: https://go-review.googlesource.com/90995 From-SVN: r257235
2018-01-31go-gcc.cc (Gcc_backend::convert_tree): New private method.Ian Lance Taylor2-27/+50
* go-gcc.cc (Gcc_backend::convert_tree): New private method. (Gcc_backend::constructor_expression): Call it. (Gcc_backend::assignment_statement): Likewise. (Gcc_backend::temporary_variable): Likewise. Fixes https://golang.org/issue/#23606 From-SVN: r257218
2018-01-31compiler: Function_type and Backend_function_type should not be identicalIan Lance Taylor3-1/+15
Function_type and Backend_function_type have different backend representations, so they should not be identical. Otherwise it confuses Type::type_btypes map. Reviewed-on: https://go-review.googlesource.com/90975 From-SVN: r257216
2018-01-30internal/syscall/unix: add randomTrap for sh/shbeIan Lance Taylor1-1/+1
CL 84555 added support for the SuperH architecture, but didn't add the randomTrap definition to be used for the getrandom syscall on Linux. Add it now. Reviewed-on: https://go-review.googlesource.com/90535 From-SVN: r257171
2018-01-29compiler: don't insert write barriers if we've seen errorsIan Lance Taylor2-1/+4
The compiler skips the escape analysis pass if it has seen any errors. The write barrier pass, especially the check-escapes portion, relies on escape analysis running. So don't run this pass if there have been any errors, as it may cause further unreliable error reports. Reviewed-on: https://go-review.googlesource.com/90575 From-SVN: r257163
2018-01-27libgo: update to Go1.10rc1Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/90295 From-SVN: r257126
2018-01-26compiler: show readable names in escape analysis messagesIan Lance Taylor4-5/+5
Call message_name when printing a variable for an escape analysis message. This implies changing the AST dumps, which is fine. Reviewed-on: https://go-review.googlesource.com/90296 From-SVN: r257113
2018-01-25compiler: look through aliases when looking for methodsIan Lance Taylor3-22/+49
Add a Type::is_alias method to remove some existing loops and avoid adding a new one. Test case is https://golang.org/cl/89935. Fixes golang/go#23489 Reviewed-on: https://go-review.googlesource.com/89975 From-SVN: r257069
2018-01-25compiler: deref receiver types in mangled namesIan Lance Taylor3-18/+22
This was the original intent, as reflected in the long comment at the start of names.cc, but I forgot to implement it. Also, remove a leading ".0" from the final name. That could occur for a method whose receiver type starts with 'u', as in that case we prepend a space to the mangled name, to avoid confusion with the Unicode mangling, and the space turns into ".0". Also, if the Unicode encoding would cause the final to start with "..u" or "..U", add a leading underscore. Patch gotest to not get fooled by some names. The result of these changes is that all symbols start with a letter or an underscore. Reviewed-on: https://go-review.googlesource.com/90015 From-SVN: r257068
2018-01-25runtime: fix lfstackUnpack on ia64Ian Lance Taylor1-1/+1
The top three region number bits must be masked out before right-shifting the address bits into place, otherwise they will be copied down into the lower always-zero address bits. Reviewed-on: https://go-review.googlesource.com/84535 From-SVN: r257061
2018-01-25compiler: don't write sink constants to C header fileIan Lance Taylor2-2/+4
Reviewed-on: https://go-review.googlesource.com/89815 From-SVN: r257049
2018-01-24compiler: rationalize external symbol namesIan Lance Taylor11-352/+700
Encode all external symbol names using only ASCII alphanumeric characters, underscore, and dot. Use a scheme that can be reliably demangled to a somewhat readable version as described in the long comment in names.cc. A minor cleanup discovered during this was that we were treating function types as different if one had a NULL parameters_ field and another has a non-NULL parameters_ field that has no parameters. This worked because we mangled them slightly differently. We now mangle them the same, so we treat them as equal, as we should anyhow. Reviewed-on: https://go-review.googlesource.com/89555 * go.go-torture/execute/names-1.go: New test. From-SVN: r257033
2018-01-23cmd/go: buildid support for AIX archives.Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/88935 From-SVN: r256971
2018-01-19mksysinfo: use rlimit64 if available when we use getrlimit64Ian Lance Taylor1-1/+1
This makes no difference on most systems, because <sys/resource.h> renames the type appropriately anyhow, but apparently it makes a difference on AIX. Reviewed-on: https://go-review.googlesource.com/88076 From-SVN: r256877
2018-01-19mksysinfo: force Passwd.Pw_[ug]id from int32 to uint32Ian Lance Taylor1-1/+1
Solaris 10 uses int32 for the Pw_uid and Pw_gid fields of Passwd, but most systems, including Solaris 11, use uint32. Force uint32 for consistency and to fix the build. Reviewed-on: https://go-review.googlesource.com/88195 From-SVN: r256875
2018-01-19runtime: no escape for some functions on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/88236 From-SVN: r256874
2018-01-19cmd/go: recognize AIX objects and archivesIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/88275 From-SVN: r256873
2018-01-19runtime: add go:noescape declaration for SolarisIan Lance Taylor1-1/+1
Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/88376 From-SVN: r256872
2018-01-18re PR go/83787 (Many 32-bit Solaris/SPARC Go tests FAIL after Go1.10beta1 ↵Ian Lance Taylor4-3/+11
update) PR go/83787 compiler: pass int to makechan, call makechan64 when appropriate The update to 1.10beta1 changed makechan to take int instead of int64, and added a makechan64 call for large values. Since the size is the last argument to makechan, the old compiler which always passed a 64-bit int worked fine on 64-bit systems and little-endian 32-bit systems, but broke on big-endian 32-bit systems. This CL fixes the compiler to use the appropriate types. This fixes GCC PR 83787. Reviewed-on: https://go-review.googlesource.com/88077 From-SVN: r256835
2018-01-17compiler: enable escape analysis for runtimeIan Lance Taylor5-88/+114
The runtime package was hard-coded non-escape, and the escape analysis was not run for the runtime package. This CL removes the hard-code, and lets the escape analysis decide. It is not allowed for local variables and closures in the runtime to be heap allocated. This CL adds the check that make sure that they indeed do not escape. The escape analysis is always run when compiling the runtime now. Fixes golang/go#17431 Reviewed-on: https://go-review.googlesource.com/86246 From-SVN: r256820
2018-01-17archive/tar: support stat and device numbers on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/87198 From-SVN: r256810
2018-01-17libgo: update to Go1.10beta2 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/87897 From-SVN: r256794
2018-01-15compiler: reclaim memory of escape analysis NodesIan Lance Taylor5-1/+67
Reclaim the memory of escape analysis Nodes before kicking off the backend, as they are not needed in get_backend. Reviewed-on: https://go-review.googlesource.com/86243 From-SVN: r256707
2018-01-15compiler: make sure variables captured by defer closure liveIan Lance Taylor2-6/+31
Local variables captured by the deferred closure need to be live until the function finishes, especially when the deferred function runs. In Function::build, for function that has a defer, we wrap the function body in a try block. So the backend sees the local variables only live in the try block, without knowing that they are needed also in the finally block where we invoke the deferred function. Fix this by creating top-level declarations for non-escaping address-taken locals when there is a defer. An example of miscompilation without this CL: func F(fn func()) { didPanic := true defer func() { println(didPanic) }() fn() didPanic = false } With escape analysis turned on, at optimization level -O1 or -O2, the store "didPanic = false" is elided by the backend's optimizer, presumably because it thinks "didPanic" is not live after the store, so the store is useless. Reviewed-on: https://go-review.googlesource.com/86241 From-SVN: r256706