aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2017-03-28re PR go/80226 (ICE gimple-expr.c:474 on Go function returning multiple ↵Than McIntosh2-1/+8
empty struct/array values) PR go/80226 * go-gcc.cc (Gcc_backend::return_statement): Check for void_type_node when checking result size. From-SVN: r246553
2017-03-22compiler: initialize gogo fieldsIan Lance Taylor2-4/+7
A couple of the data members in the Gogo class were not being initialized properly. This was causing "uninitialized value" errors during Valgrind memcheck runs. This patch insures that all of the fields receive an initial value. Reviewed-on: https://go-review.googlesource.com/38470 From-SVN: r246407
2017-03-22re PR go/80128 (go1: internal compiler error: in ↵Ian Lance Taylor2-10/+47
write_specific_type_functions, at go/gofrontend/types.cc:2002) PR go/80128 compiler: check backend alignment for memequalNN functions The code was assuming the usual required alignment for the memequalNN functions (16 bits for int16, 32 for int32, etc.). However, on m68k the required alignment of int32 is only 16 bits. Assuming the memequalNN alignment caused the compiler to incorrectly decide that int32 required a specially generated function rather than calling memequal32. This then crashed if the type descriptor were generated after type-specific functions had been written. Fixes GCC PR 80128. Reviewed-on: https://go-review.googlesource.com/38433 From-SVN: r246382
2017-02-28mksigtab.sh: skip signals defined as other signalsIan Lance Taylor1-1/+1
Fixes Solaris build. Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/37587 From-SVN: r245794
2017-02-28runtime: fix sigfwd to not allocate memoryIan Lance Taylor1-1/+1
The use of &[1]uintptr{fn} was causing sigfwd to allocate memory, even though it is being compiled for the runtime package. That is a bad idea for this function, which is invoked by a signal handler. Rewrite it to use only constructs that do not allocate memory when compiled for the runtime package. The test for this is misc/cgo/testcarchive in the main repo, which we don't yet test. Reviewed-on: https://go-review.googlesource.com/37454 From-SVN: r245777
2017-02-28libgo: fix quoting in mksigtab.shIan Lance Taylor1-1/+1
The quoting was causing us to never add the system-specific signals. The test for this is misc/cgo/testcarchive in the master repo, which we don't yet run for gccgo. Reviewed-on: https://go-review.googlesource.com/37453 From-SVN: r245776
2017-02-21re PR go/79642 (space instead of tab in lang.opt)Ian Lance Taylor2-1/+6
PR go/79642 * lang.opt (-fgo-relative-import-path): Change space to tab. From-SVN: r245619
2017-02-17libgo: update to final Go 1.8 releaseIan Lance Taylor1-1/+1
Along with the update this fixes a problem that was always present but only showed up with the new reflect test. When a program used a **unsafe.Pointer and stored the value in an interface type, the generated type descriptor pointed to the GC data for *unsafe.Pointer. It did that by name, but we were not generating a variable with the right name. Reviewed-on: https://go-review.googlesource.com/37144 From-SVN: r245535
2017-02-13re PR go/79443 (libgo/math test fails on s390x (undefined symbols cosh, ↵Ian Lance Taylor1-1/+1
sinh, tanh, hasVX)) PR go/79443 libgo: fix some s390x tests Add `+build ignore` to ignore tests that rely on s390x assembly code not yet implemented for gccgo. Fixes GCC PR 79443. Reviewed-on: https://go-review.googlesource.com/36909 From-SVN: r245397
2017-02-07re PR tree-optimization/79256 (FAIL: gcc.dg/vect/pr25413a.c execution test)Richard Biener2-5/+7
2017-02-07 Richard Biener <rguenther@suse.de> PR tree-optimization/79256 PR middle-end/79278 * builtins.c (get_object_alignment_2): Use min_align_of_type to extract alignment for MEM_REFs to honor BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN. * doc/tm.texi.in (ADJUST_FIELD_ALIGN): Adjust to take additional type parameter. * doc/tm.texi: Regenerate. * stor-layout.c (layout_decl): Adjust. (update_alignment_for_field): Likewise. (place_field): Likewise. (min_align_of_type): Likewise. * config/arc/arc.h (ADJUST_FIELD_ALIGN): Adjust. * config/epiphany/epiphany.h (ADJUST_FIELD_ALIGN): Likewise. * config/epiphany/epiphany.c (epiphany_adjust_field_align): Likewise. * config/frv/frv.h (ADJUST_FIELD_ALIGN): Likewise. * config/frv/frv.c (frv_adjust_field_align): Likewise. * config/i386/i386.h (ADJUST_FIELD_ALIGN): Likewise. * config/i386/i386.c (x86_field_alignment): Likewise. * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): Likewise. go/ * go-backend.c (go_field_alignment): Adjust. libobjc/ * encoding.c (objc_layout_structure_next_member): Adjust ADJUST_FIELD_ALIGN usage. Revert 2017-01-30 Richard Biener <rguenther@suse.de> PR tree-optimization/79256 * targhooks.c (default_builtin_vector_alignment_reachable): Honor BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN to fix up bogus alignment on TYPE. From-SVN: r245245
2017-01-27compiler: let initializers hold addresses of fieldsIan Lance Taylor3-27/+85
The runtime.dbgvars initializer looks like var dbgvars = []dbgVar{ {"allocfreetrace", &debug.allocfreetrace}, } Because the field address was not recognized as valid for a static initializer, the variable was initialized at runtime. Normally that would be fine, but for the runtime package it meant that dbgvars was not initialized when it was read by parsedebugvars. That meant that the GODEBUG environment variable did nothing. Fixing that revealed that the static initializer checks had to be more careful about interface types, just like the existing is_constant methods. Reviewed-on: https://go-review.googlesource.com/35891 From-SVN: r244982
2017-01-26runtime: fix setting of isarchiveIan Lance Taylor1-1/+1
When I updated to Go 1.8, the initsig function moved from signal1_unix.go to signal_unix.go, and lost a gccgo-specific change in the move. Add it back. This would have been caught by the misc/cgo/testcarchive tests in the gc repository, but we don't run those in the gccgo repository. We should fix that, somehow. Reviewed-on: https://go-review.googlesource.com/35839 From-SVN: r244947
2017-01-26runtime: fix context used by getTracebackIan Lance Taylor1-1/+1
I typoed the argument passed to getcontext in getTraceback, and the error was hidden by ucontext_arg. This would have been caught by some of the runtime package tests, but we don't run most of them because they rely on `go build`, and the go tool is not available while running the libgo testsuite. We should fix the libgo testsuite, somehow, so that they run. Reviewed-on: https://go-review.googlesource.com/35837 From-SVN: r244946
2017-01-25compiler: improvements for type alias handlingIan Lance Taylor2-7/+22
Give an error for an attempt to define a method on an imported type. Give an error for each attempt to define a method on a builtin type. Adjust error messages to be closer to gc error messages. With these changes gccgo passes current tests on dev.typealias branch. This changes the errors printed for test/fixedbugs/issue5089.go, but the change is an improvement: Before: fixedbugs/issue5089.go:13:1: error: redefinition of ‘bufio.Buffered’: receiver name changed func (b *bufio.Reader) Buffered() int { // ERROR "non-local|redefinition" ^ fixedbugs/issue5089.go:11:13: note: previous definition of ‘bufio.Buffered’ was here import "bufio" // GCCGO_ERROR "previous" ^ Now: fixedbugs/issue5089.go:13:7: error: may not define methods on non-local type func (b *bufio.Reader) Buffered() int { // ERROR "non-local|redefinition" ^ Reviewed-on: https://go-review.googlesource.com/35642 From-SVN: r244889
2017-01-23libgo: update to go1.8rc2Ian Lance Taylor1-1/+1
Fix a bug in the generation of the hash value in reflect.FuncOf. The merge script missed a bunch of testdata files over the years. Copy them over. Reviewed-on: https://go-review.googlesource.com/35570 From-SVN: r244835
2017-01-23re PR go/79037 (gccgo: Binaries crash with parforsetup: pos is not aligned ↵Ian Lance Taylor2-2/+17
on m68k) PR go/79037 compiler, runtime: align gc data for m68k The current GC requires that the gc data be aligned to at least a 4 byte boundary, because it uses the lower two bits of the address for flags (see LOOP and PRECISE in runtime/mgc0.c). As the gc data is stored as a [...]uintptr, that is normally always true. However, on m68k, that only guarantees 2 byte alignment. Fix it by forcing the alignment. The parfor code used by the current GC requires that the parfor data be aligned to at least an 8 byte boundary. The code in parfor.c verifies this. This is normally true, as the data uses uint64_t values, but, again, this must be enforced explicitly on m68k. Fixes GCC PR 79037. Reviewed-on: https://go-review.googlesource.com/35478 From-SVN: r244824
2017-01-23libgo: bump library version to 11Ian Lance Taylor1-1/+1
As usual I forgot to bump the library version when I updated the library to 1.8rc1. Reviewed-on: https://go-review.googlesource.com/35568 From-SVN: r244823
2017-01-20runtime, testing/internal/testdeps: fixes for cgoIan Lance Taylor1-1/+1
Some fixes that permit misc/cgo/test in the master gc repository to pass using the current gccgo. Install testing/internal/testdeps.gox; it is needed by `go test`. Export runtime.lockedOSThread to enable calling via go:linkname; it is used by misc/cgo/test. Loop on EAGAIN when creating a new thread; this is what the gc code does, and misc/cgo/test tests that it works. Reviewed-on: https://go-review.googlesource.com/35479 From-SVN: r244733
2017-01-20re PR go/79146 (Bootstrapping go on s390x fails; redefined symbols)Ian Lance Taylor1-1/+1
PR go/79146 math/big: fix build on s390x Don't build arith_decl_s390x.go for gccgo; it is only for assembly code that has not yet been ported to gccgo. For GCC PR 79146. From-SVN: r244731
2017-01-20re PR go/79146 (Bootstrapping go on s390x fails; redefined symbols)Ian Lance Taylor1-1/+1
PR go/79146 crypto/elliptic: explicitly ignore p256_s390x.go The file only works if used in conjunction with assembly code not (yet) written for gccgo. Fixes GCC PR 79146. Reviewed-on: https://go-review.googlesource.com/35477 From-SVN: r244679
2017-01-18syscall, golang_org/x/net/lif: fixes for gccgo on SolarisIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/35390 From-SVN: r244563
2017-01-16runtime: rename siginfo to _siginfo_tIan Lance Taylor1-1/+1
Since the name siginfo winds up in runtime.inc, this avoids a name collision on systems that define "struct siginfo" in the system header files. Reviewed-on: https://go-review.googlesource.com/35239 From-SVN: r244484
2017-01-16libgo: correct golang_org Makefile variables not used on all systemsIan Lance Taylor1-1/+1
Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/35238 From-SVN: r244483
2017-01-14compiler: implement type aliasesIan Lance Taylor7-54/+406
This is a start of implementing type aliases (`type T1 = T2`) in the Go frontend. This is incomplete, in that the reflection information is not updated for an embedded type alias. It is also not well tested. Finally, the change to the language has not been approved. This should be regarded as preliminary work for experimental use. Update golang/go#18130. Reviewed-on: https://go-review.googlesource.com/35120 From-SVN: r244460
2017-01-14libgo: update to Go 1.8 release candidate 1Ian Lance Taylor7-102/+164
Compiler changes: * Change map assignment to use mapassign and assign value directly. * Change string iteration to use decoderune, faster for ASCII strings. * Change makeslice to take int, and use makeslice64 for larger values. * Add new noverflow field to hmap struct used for maps. Unresolved problems, to be fixed later: * Commented out test in go/types/sizes_test.go that doesn't compile. * Commented out reflect.TestStructOf test for padding after zero-sized field. Reviewed-on: https://go-review.googlesource.com/35231 gotools/: Updates for Go 1.8rc1. * Makefile.am (go_cmd_go_files): Add bug.go. (s-zdefaultcc): Write defaultPkgConfig. * Makefile.in: Rebuild. From-SVN: r244456
2017-01-11compiler: add containing Bfunction to conditional_expressionThan McIntosh6-24/+44
Add containing Bfunction to Backend::conditional_expression method signature, since the back end might need to create a temporary when generating IR for this construct. Reviewed-on: https://go-review.googlesource.com/35056 From-SVN: r244330
2017-01-11compiler: mark generated struct/array types as incomparableIan Lance Taylor5-17/+56
The recent change to generate type functions for more types with identity comparisons caused us to generate some unnecessary functions, and even caused a compiler crash on Solaris due to phase ordering. Avoid this by marking all generated and uncompared struct and array types as incomparable, so that we don't try to generate type functions for them. Reviewed-on: https://go-review.googlesource.com/35110 From-SVN: r244327
2017-01-10runtime: copy more scheduler code from Go 1.7 runtimeIan Lance Taylor1-1/+1
I looked at a diff of proc.go between Go 1.7 and gccgo, and copied over all the easy stuff. Reviewed-on: https://go-review.googlesource.com/35090 From-SVN: r244291
2017-01-10compiler, runtime: drop size arguments to hash/equal functionsIan Lance Taylor6-72/+298
Drop the size arguments for the hash/equal functions stored in type descriptors. Types know what size they are. To make this work, generate hash/equal functions for types that can use an identity comparison but are not a standard size and alignment. Drop the multiplications by 33 in the generated hash code and the reflect package hash code. They are not necessary since we started passing a seed value around, as the seed includes the hash of the earlier values. Copy the algorithms for standard types from the Go 1.7 runtime, replacing the C functions. Reviewed-on: https://go-review.googlesource.com/34983 From-SVN: r244256
2017-01-09runtime: copy more of scheduler from Go 1.7 runtimeIan Lance Taylor1-1/+1
This started by moving procresize from C to Go so that we can pass the right type to the memory allocator when allocating a p, which forced the gomaxprocs variable to move from C to Go, and everything else followed from that. Reviewed-on: https://go-review.googlesource.com/34916 From-SVN: r244236
2017-01-06re PR go/78978 (runtime/pprof FAILs on Solaris 2/x86)Ian Lance Taylor1-1/+1
PR go/78978 libgo: build with -Wa,-nH if possible on Solaris By default the Solaris assembler records the required hardware capability in the object file. This means that the AES hashing code breaks on systems that do not support AES, even though the code uses a runtime check to only actually invoke the AES instructions on systems that support it. An earlier fix for the problem only fixed the shared library, not the static libgo.a. Fix the problem for real by using an assembler option to not record the hardware capability. For GCC PR 78978. Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/34910 From-SVN: r244165
2017-01-03runtime: remove __go_alloc and __go_freeIan Lance Taylor1-1/+1
Move allocg and handling of allgs slice from C to Go. Reviewed-on: https://go-review.googlesource.com/34797 From-SVN: r244036
2017-01-03re PR go/78789 (Error: no such instruction: `aesenc %xmm0,%xmm2' when ↵Ian Lance Taylor1-1/+1
compiling libgo/runtime/aeshash.c) PR go/78789 runtime: don't build aeshash.c if the assembler doesn't support it This is for CentOS 5, whose assembler does not know the aesinc instruction. Fixes GCC PR 78789. Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/34796 From-SVN: r244031
2017-01-01Update copyright years.Jakub Jelinek14-13/+15
From-SVN: r243994
2017-01-01gcc.c (process_command): Update copyright notice dates.Jakub Jelinek2-2/+6
gcc/ * gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libitm/ * libitm.texi: Bump @copying's copyright year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year. From-SVN: r243992
2016-12-30compile: add type conversion in Type::gc_symbol_pointerIan Lance Taylor2-2/+5
Wrap the return from Type::gc_symbol_pointer with a type conversion to uintptr, since the values returned are stored into structure fields with that type. Reviewed-on: https://go-review.googlesource.com/34625 From-SVN: r243978
2016-12-30compiler: use more accurate array type in Gogo::register_gc_varsIan Lance Taylor2-4/+4
The length of the roots array in Gogo::register_gc_vars was being computed incorrectly, potentially leading to type clashes in the back end. Compute an accurate length for this array ahead of time. Reviewed-on: https://go-review.googlesource.com/34624 From-SVN: r243974
2016-12-22compiler: fix spurious redefinition error for anon structIan Lance Taylor3-26/+28
Change Struct_type::do_mangled_name to incorporate the field names even for hidden symbols. This is needed in cases where a package imports a type "S" that has an anonymous struct, e.g. // imported from some other package type S struct { X struct{ _ struct{} } } and then defines a local type that uses a structurally identical anonymous struct, e.g. // defined locally type T struct { U struct{ _ struct{} } } In the case above both types triggered the creation of hash/equal methods, but the method names were clashing (since both structs had the same mangled name). Fixes golang/go#18414 Reviewed-on: https://go-review.googlesource.com/34621 From-SVN: r243899
2016-12-19runtime: copy cgo support from Go 1.7 runtimeIan Lance Taylor1-1/+1
Remove support for _cgo_allocate. It was removed from the gc toolchain in Go 1.5, so it is unlikely that anybody is trying to use it. Reviewed-on: https://go-review.googlesource.com/34557 From-SVN: r243805
2016-12-16compiler: add containing Bfunction to some backend interfaces.Than McIntosh8-68/+135
Change the interfaces for backend methods that create statements to always pass in the enclosing Bfunction for the statement. Having the function available simplifies things if a temporary variable has to be created during the construction of a statement. This also includes a change to the Mark_lvalue_varexprs helper class to handle indirections on the left hand side of assignments (e.g. "*x.y = ..."). Reviewed-on: https://go-review.googlesource.com/34471 * go-gcc.cc (Gcc_backend::expression_statement): Add Bfunction* parameter. (Gcc_backend::init_statement): Likewise. (Gcc_backend::assignment_statement): Likewise. (Gcc_backend::if_statement): Likewise. From-SVN: r243766
2016-12-16compiler: fix comments + fieldnames to match libgo sourceIan Lance Taylor2-13/+13
A couple of the comments in the type descriptor code were out of date with respect to the names in libgo/go/runtime/type.go. Fix up the comments and field names to bring them into sync. Reviewed-on: https://go-review.googlesource.com/34472 From-SVN: r243735
2016-12-15compiler: fix off-by-1 array type len in Type::gc_symbol_constructorIan Lance Taylor2-2/+2
Array type being built to hold GC var initializer was being created with an extra/unneeded slot. Fix up the code to insure that the array length matches the length of the initializer list. Reviewed-on: https://go-review.googlesource.com/34413 From-SVN: r243731
2016-12-15re PR go/78763 (go1: internal compiler error: in do_get_backend, at ↵Ian Lance Taylor3-20/+50
go/gofrontend/expressions.cc:8352) PR go/78763 compiler: call determine_types even for constant expressions We need to call determine_types even for constant expressions, since a constant expression may include code like unsafe.Sizeof(0). Something needs to determine the type of the untyped 0, and that should be the determine_types pass. Implementing that triggered a compiler crash on test/const1.go because it permitted some erroneous constants to make it all the way to the backend. Catch that case by checking whether we get a constant overflow error, and marking the expression invalid if we do. This is a good change in any case, as previously we reported the same constant overflow error multiple times, and now we only report it once. Fixes GCC PR 78763. Reviewed-on: https://go-review.googlesource.com/34496 From-SVN: r243729
2016-12-15compiler: remove unneeded zero-length slice value initIan Lance Taylor2-7/+1
Prune away a bit of unnecessary code from the helper routine Slice_construction_expression::create_array_val() that was adding an extra NULL value to empty slices (no longer needed). Reviewed-on: https://go-review.googlesource.com/34410 From-SVN: r243682
2016-12-13libgo: fixes for Solaris buildIan Lance Taylor1-1/+1
Don't put m[0-4] in runtime.inc. Pass -mclear-hwcap to the linker if supported. From Rainer Orth. Reviewed-on: https://go-review.googlesource.com/34331 From-SVN: r243619
2016-12-08runtime: mark non-x86 aeshashbody parameters as unusedIan Lance Taylor1-1/+1
Avoids warnings during the build. Reviewed-on: https://go-review.googlesource.com/34142 From-SVN: r243459
2016-12-08runtime: copy memory hash code from Go 1.7Ian Lance Taylor2-2/+2
Rewrite the AES hashing code from gc assembler to C code using intrinsics. The resulting code generates the same hash code for the same input as the gc code--that doesn't matter as such, but testing it ensures that the C code does something useful. Also change mips64pe32le to mips64p32le in configure script--noticed during CL review. Reviewed-on: https://go-review.googlesource.com/34022 From-SVN: r243445
2016-12-08runtime: allocate _panic struct on heapIan Lance Taylor1-1/+1
The gc library allocates a _panic struct on the stack. This does not work for gccgo, because when a deferred function recovers the panic we unwind the stack up to that point so that returning from the function will work correctly. Allocating on the stack fine if the panic is not recovered, and it works fine if the panic is recovered by a function that returns. However, it fails if the panic is recovered by a function that itself panics, and if that second panic is then recovered by a function higher up on the stack. When we unwind the stack to that second panic, the g will wind up pointing at a panic farther down on the stack. Even then everything will often work fine, except when the deferred function catching the second panic makes a bunch of calls that use stack space before returning. In that case the code can overwrite the panic struct, which will then cause disaster when we remove the struct from the linked list, as the link field will be garbage. This case is rare enough that all the x86 tests were passing, but there was a failure on ppc64le. Before https://golang.org/cl/33414 we allocated the panic struct on the heap, so go back to doing that again. Fixes golang/go#18228. Reviewed-on: https://go-review.googlesource.com/34027 From-SVN: r243444
2016-12-08compiler: make Slice_construction_expression::do_flatten idempotentIan Lance Taylor2-3/+3
Because of the way we handle call expressions with multiple results, it's possible for expressions to be flattened more than once. In the case of Slice_construction_expression, allocating the slice storage multiple times caused a compiler crash as one of the Temporary_statement's wound up not getting a backend expression. Test case is https://golang.org/cl/34020. Reviewed-on: https://go-review.googlesource.com/34026 From-SVN: r243442
2016-12-08runtime: remove some unused variables/declarations from runtime.hIan Lance Taylor1-1/+1
Small patch from Eric Botcazou. Reviewed-on: https://go-review.googlesource.com/34029 From-SVN: r243424