aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2017-09-20syscall: enable ParseDirent for AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/64990 From-SVN: r253022
2017-09-20syscall: workaround for getsockname bug in AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/64552 From-SVN: r253021
2017-09-20internal,net,os,runtime,syscall: fixes for AIX following update to go1.9Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/64551 From-SVN: r253016
2017-09-20runtime: restore "goroutine in C code" messageIan Lance Taylor1-1/+1
In the 1.9 upgrade I took out the word "goroutine" from a traceback showing a goroutine running in C code, to let TestCgoNumGoroutine pass. However, it turns out that some code is actually checking for that string; for example, https://github.com/grpc/grpc-go/blob/master/test/leakcheck/leakcheck.go#L44 So keep the message the same, and change the test. Reviewed-on: https://go-review.googlesource.com/64850 From-SVN: r252991
2017-09-18runtime: always initialize str field in __go_string_slice resultIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/64110 From-SVN: r252953
2017-09-15syscall: fixes for SolarisIan Lance Taylor1-1/+1
Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/64170 From-SVN: r252866
2017-09-15compiler: call error_statement for fallthrough in last caseIan Lance Taylor2-1/+7
It is possible to do this check in backend, by walking the block and check whether the last statement is a goto. But it seems easier to do it in the frontend, where it can simply use is_fallthrough. Reviewed-on: https://go-review.googlesource.com/63690 From-SVN: r252851
2017-09-15compiler: check error expression in Array_type::get_backend_lengthIan Lance Taylor2-1/+6
Otherwise, a zero length is created in the backend and the backend doesn't know there is an error. Reviewed-on: https://go-review.googlesource.com/61610 From-SVN: r252849
2017-09-14libgo: update to go1.9Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/63753 From-SVN: r252767
2017-09-14compiler, runtime: simplify select and channel operationsIan Lance Taylor5-75/+44
In preparation for upgrading libgo to the 1.9 release, this approximately incorporates https://golang.org/cl/37661 and https://golang.org/cl/38351. CL 37661 changed the gc compiler such that the select statement simply returns an integer which is then used as the argument for a switch. Since gccgo already worked that way, this just adjusts the switch code to look like the gc switch code by removing the explicit case index expression and calculating it from the order of calls to selectsend, selectrecv, and selectdefault. CL 38351 simplifies the channel code by not passing the unused channel type descriptor pointer. Reviewed-on: https://go-review.googlesource.com/62730 From-SVN: r252749
2017-09-14compiler: avoid compiler crash on invalid programIan Lance Taylor2-2/+6
I encountered this crash while working on upgrading libgo to the 1.9 release. I no longer have the cause of the crash, but it doesn't much matter, as the policy for crash-on-invalid errors is to fix the crash but not bother to commit the invalid test case. Reviewed-on: https://go-review.googlesource.com/62750 From-SVN: r252748
2017-09-14compiler: emit type specific functions for aliasesIan Lance Taylor2-1/+3
If we have an alias for a struct or array that requires a type-specific function, don't emit the function with the alias name. Emit it with the struct/array as usual. Test case is https://golang.org/cl/62531. Reviewed-on: https://go-review.googlesource.com/62412 From-SVN: r252747
2017-09-14compiler, reflect: fix struct field names for embedded aliasesIan Lance Taylor3-38/+51
This adds much of https://golang.org/cl/35731 and https://golang.org/cl/35732 to the gofrontend code. This is a step toward updating libgo to the 1.9 release. The gofrontend already supports type aliases, and this is required for correct support of type aliases when used as embedded fields. The change to expressions.cc is to handle the << 1, used for the newly renamed offsetAnon field, in the constant context used for type descriptor initialization. Reviewed-on: https://go-review.googlesource.com/62710 From-SVN: r252746
2017-09-14compiler: fix check for notinheap conversionIan Lance Taylor2-6/+6
A normal pointer may not be converted to a notinheap pointer. We were erroneously permitting a conversion from a normal pointer to a notinheap unsafe.Pointer, which is useless since unsafe.Pointer is not marked notinheap. Correct the test to permit a conversion from unsafe.Pointer to a notinheap pointer, which is the same test that the gc compiler uses. The test case for this is in the 1.9 runtime package. Reviewed-on: https://go-review.googlesource.com/62731 From-SVN: r252745
2017-09-09compiler: guard against implicit double pointer indirectionIan Lance Taylor2-1/+7
The code that lowers field references can sometimes introduce a double pointer indirection in cases where it is not/safe appropriate. For example, in var p **struct { f int } p.f = 0 the assignment LHS was being incorrectly lowered to (*(*p)).f. Detect this situation and issue an error. Fixes golang/go#21770 Reviewed-on: https://go-review.googlesource.com/62330 From-SVN: r251918
2017-08-31mksysinfo: fix in6_addr in mld_hdr_t for SolarisIan Lance Taylor1-1/+1
Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/60732 From-SVN: r251574
2017-08-30[77/77] Add a complex_mode classRichard Sandiford2-4/+10
This patch adds another machine_mode wrapper for modes that are known to be COMPLEX_MODE_P. There aren't yet many places that make use of it, but that might change in future. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (complex_mode): New type. * gdbhooks.py (build_pretty_printer): Handle it. * machmode.h (complex_mode): New class. (complex_mode::includes_p): New function. (is_complex_int_mode): Likewise. (is_complex_float_mode): Likewise. * genmodes.c (get_mode_class): Handle complex mode classes. * function.c (expand_function_end): Use is_complex_int_mode. gcc/go/ * go-lang.c (go_langhook_type_for_mode): Use is_complex_float_mode. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251527
2017-08-30[20/77] Replace MODE_INT checks with is_int_modeRichard Sandiford2-2/+9
Replace checks of "GET_MODE_CLASS (...) == MODE_INT" with "is_int_mode (..., &var)", in cases where it becomes useful to refer to the mode as a scalar_int_mode. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (is_int_mode): New fuction. * combine.c (find_split_point): Use it. (combine_simplify_rtx): Likewise. (simplify_if_then_else): Likewise. (simplify_set): Likewise. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64.c (aarch64_rtx_costs): Likewise. * cse.c (notreg_cost): Likewise. (cse_insn): Likewise. * cselib.c (cselib_lookup_1): Likewise. * dojump.c (do_jump_1): Likewise. (do_compare_rtx_and_jump): Likewise. * dse.c (get_call_args): Likewise. * dwarf2out.c (rtl_for_decl_init): Likewise. (native_encode_initializer): Likewise. * expmed.c (emit_store_flag_1): Likewise. (emit_store_flag): Likewise. * expr.c (convert_modes): Likewise. (store_field): Likewise. (expand_expr_real_1): Likewise. * fold-const.c (fold_read_from_constant_string): Likewise. * gimple-ssa-sprintf.c (get_format_string): Likewise. * optabs-libfuncs.c (gen_int_libfunc): Likewise. * optabs.c (expand_binop): Likewise. (expand_unop): Likewise. (expand_abs_nojump): Likewise. (expand_one_cmpl_abs_nojump): Likewise. * simplify-rtx.c (mode_signbit_p): Likewise. (val_signbit_p): Likewise. (val_signbit_known_set_p): Likewise. (val_signbit_known_clear_p): Likewise. (simplify_relational_operation_1): Likewise. * tree.c (vector_type_mode): Likewise. gcc/go/ * go-lang.c (go_langhook_type_for_mode): Use is_int_mode. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251472
2017-08-30[7/77] Add scalar_float_modeRichard Sandiford2-3/+10
This patch adds a scalar_float_mode class, which wraps a mode enum that is known to satisfy SCALAR_FLOAT_MODE_P. Things like "SFmode" now give a scalar_float_mode object instead of a machine_mode. This in turn needs a change to the real.h format_helper, so that it can accept both machine_modes and scalar_float_modes. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (scalar_float_mode): New type. * machmode.h (mode_traits::from_int): Use machine_mode if USE_ENUM_MODES is defined. (is_a): New function. (as_a): Likewise. (dyn_cast): Likewise. (scalar_float_mode): New class. (scalar_float_mode::includes_p): New function. (is_float_mode): Likewise. * gdbhooks.py (MachineModePrinter): New class. (build_pretty_printer): Use it for scalar_float_mode. * real.h (FLOAT_MODE_FORMAT): Use as_a <scalar_float_mode>. (format_helper::format_helper): Turn into a template. * genmodes.c (get_mode_class): New function. (emit_insn_modes_h): Give modes the class returned by get_mode_class, or machine_mode if none. * config/aarch64/aarch64.c (aarch64_simd_valid_immediate): Use as_a <scalar_float_mode>. * dwarf2out.c (mem_loc_descriptor): Likewise. (insert_float): Likewise. (add_const_value_attribute): Likewise. * simplify-rtx.c (simplify_immed_subreg): Likewise. * optabs.c (expand_absneg_bit): Take a scalar_float_mode. (expand_unop): Update accordingly. (expand_abs_nojump): Likewise. (expand_copysign_absneg): Take a scalar_float_mode. (expand_copysign_bit): Likewise. (expand_copysign): Update accordingly. gcc/ada/ * gcc-interface/utils.c (gnat_type_for_mode): Use is_a <scalar_float_mode> instead of SCALAR_FLOAT_MODE_P. gcc/go/ * go-lang.c (go_langhook_type_for_mode): Use is_float_mode. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251458
2017-08-29net/internal/socktest: build sys_unix.go on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/59913 From-SVN: r251440
2017-08-29libgo: netinet/icmp6.h require netinet/in.h on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/59912 From-SVN: r251439
2017-08-29libgo: fix Stat_t on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/59911 From-SVN: r251436
2017-08-29runtime: make go-nosys.c compile with !HAVE_SYSCALLIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/59910 From-SVN: r251435
2017-08-29runtime: fix lfstack for 64-bit AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/57550 From-SVN: r251420
2017-08-18re PR go/81893 (compilation error in libgo starting with r251127)Ian Lance Taylor1-1/+1
PR go/81893 runtime: only use PPC GNU/Linux register code on little endian Reportedly the current code builds on little endian but not big endian. Fixes https://gcc.gnu.org/PR81893. Reviewed-on: https://go-review.googlesource.com/57110 From-SVN: r251188
2017-08-18misc/cgo/test: make cgo tests run on AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/56910 From-SVN: r251182
2017-08-18cmd/go: pass -funwind-tables when compiling C codeIan Lance Taylor1-1/+1
Using -funwind-tables is necessary to permit Go code to correctly throw a panic through C code. This hasn't been necessary in the past as -funwind-tables is the default on x86. However, it is not the default for PPC AIX. Reviewed-on: https://go-review.googlesource.com/56650 From-SVN: r251179
2017-08-16runtime: better implementation of netpoll for AIXIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/54170 From-SVN: r251133
2017-08-16runtime: improvements for signal registersIan Lance Taylor1-1/+1
Fix dumpregs on i386, implement dumpregs for PPC Linux/AIX, get PC on AIX. Reviewed-on: https://go-review.googlesource.com/56170 From-SVN: r251127
2017-08-09compiler: fix buglet in lshift type determinationIan Lance Taylor2-2/+2
It's possible to construct an lshift expression using unsafe.Sizeof that is technically a compile-time constant but can't be evaluated without going through backend methods. In this case, insure that Type::make_non_abstract_type is called on the numeric operand of the shift (as opposed to leaving as abstract), to avoid an assert later on in the compiler flow. Fixes golang/go#21372. Reviewed-on: https://go-review.googlesource.com/54370 From-SVN: r251006
2017-08-09compiler: handle >32bit exponent in LdexpIan Lance Taylor1-1/+1
Libgo's implementation of math.Ldexp declared the libc "ldexp" as taking an 'int' exponent argument, which is not quite right for 64-bit platforms (exp arg is always int32); this could yield incorrect results for exponent values outside the range of Minint32/Maxint32. Fix by upating the type for the libc version of ldexp, and adding guards to screen for out-of-range exponents. Fixes #21323. Reviewed-on: https://go-review.googlesource.com/54250 From-SVN: r250992
2017-08-07Canonicalize names of attributes.Martin Liska2-1/+6
2017-08-07 Martin Liska <mliska@suse.cz> * attribs.h (canonicalize_attr_name): New function. (cmp_attribs): Move from c-format.c and adjusted. (is_attribute_p): Moved from tree.h. * tree-inline.c: Add new includes. * tree.c (cmp_attrib_identifiers): Use cmp_attribs. (private_is_attribute_p): Remove. (private_lookup_attribute): Likewise. (private_lookup_attribute_by_prefix): Simplify. (remove_attribute): Use is_attribute_p. * tree.h: Remove removed declarations. 2017-08-07 Martin Liska <mliska@suse.cz> * array-notation-common.c: Add new includes. * c-format.c( handle_format_attribute): Canonicalize a format function name. * c-lex.c (c_common_has_attribute): Canonicalize name of an attribute. * c-pretty-print.c: Add new include. 2017-08-07 Martin Liska <mliska@suse.cz> * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an attribute. (cp_parser_std_attribute): Likewise. * tree.c: Add new include. 2017-08-07 Martin Liska <mliska@suse.cz> * c-parser.c (c_parser_attributes): Canonicalize name of an attribute. 2017-08-07 Martin Liska <mliska@suse.cz> * go-gcc.cc (Gcc_backend::function): Look up for no_split_stack and not __no_split_stack__. 2017-08-07 Martin Liska <mliska@suse.cz> * g++.dg/cpp0x/pr65558.C: Update scanned pattern. * gcc.dg/parm-impl-decl-1.c: Likewise. * gcc.dg/parm-impl-decl-3.c: Likewise. * gcc.dg/Wattributes-5.c: New test. From-SVN: r250911
2017-08-04runtime: dump registers for AlphaIan Lance Taylor1-1/+1
Patch from Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/53350 From-SVN: r250873
2017-08-03re PR go/81617 (mksigtab.sh fails to resolve NSIG with glibc 2.26)Ian Lance Taylor1-1/+1
PR go/81617 libgo: change mksigtab to recognize glibc 2.26 NSIG expression Fixes golang/go#21147 Fixes GCC PR 81617 Reviewed-on: https://go-review.googlesource.com/52611 From-SVN: r250858
2017-08-02compiler: only finalize embedded fields before finalizing methodsIan Lance Taylor2-8/+35
When finalizing the methods of a named struct type, we used to finalize all the field types first. That can fail if the field types refer indirectly to the named type. Change it to just finalize the embedded field types first, and the rest of the fields later. Fixes golang/go#21253 Reviewed-on: https://go-review.googlesource.com/52570 From-SVN: r250832
2017-07-28compiler: add backend type conversionIan Lance Taylor2-2/+5
Tweak Interface_field_reference_expression::do_get_backend to apply an additional backend type conversion to the returned result. This is needed due to the fact that the top level type of the expression is a function descriptor, however the value being manufactured is a pointer to <thunk-descriptor, value> struct. Reviewed-on: https://go-review.googlesource.com/51712 From-SVN: r250686
2017-07-28compiler: track placeholder pointer types for conversionIan Lance Taylor3-5/+15
We recently started walking through the hash table of pointer types to finalize them. Unfortunately it is possible to create a new pointer type while finalizing an existing one (test case: test/fixedbugs/issue5291) and that breaks the iteration. So, instead, keep a list of placeholder pointer types, and iterate through them while permitting the list to be extended as we go. Reviewed-on: https://go-review.googlesource.com/51771 From-SVN: r250683
2017-07-28compiler: use a single temporary for calls with multiple resultsIan Lance Taylor3-135/+60
For calls that return multiple results we used to create a temporary of struct type to hold the results, and also create a separate temporary for each result. Then the call expression would copy each result out of the struct to the temporary, and Call_result_expression would refer to the desired temporary. Simplify this to just use a single temporary of struct type, and change Call_result_expression to fetch a field of the struct. This may reduce some incorrect tree sharing in the backend code. Reviewed-on: https://go-review.googlesource.com/51770 From-SVN: r250682
2017-07-28go-backend.c (go_write_export_data): Use EXCLUDE section for AIX.Tony Reix2-1/+12
* go-backend.c (go_write_export_data): Use EXCLUDE section for AIX. From-SVN: r250648
2017-07-26runtime: handle Alpha GNU/Linux in getSiginfoIan Lance Taylor1-1/+1
Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/51370 From-SVN: r250588
2017-07-25compiler: clean up unresolved placeholders for pointer typesIan Lance Taylor4-4/+49
Add a new helper routine Type::finish_pointer_types that walks through the pointer type cache and looks for placeholder types that may have been created at some point before conversion of named types, and invokes Type::finish_backend() on said placeholders. This is needed to handle cases where the compiler manufactures a pointer type as part of lowering, then a placeholder is created for it due to a call to Type::backend_type_size(), but there is no explicit reference to the type in user code. Reviewed-on: https://go-review.googlesource.com/51131 From-SVN: r250548
2017-07-21syscall: call f?statfs64 on GNU/LinuxIan Lance Taylor1-1/+1
We unconditionally set _FILE_OFFSET_BITS to 64 in configure.ac, so we should unconditionally call the statfs64 and fstatfs64 functions. These functions should be available on all versions of GNU/Linux since 2.6. On 64-bit systems they are aliased to statfs/fstatfs, and on 32-bit systems they use the 64-bit data structures. Fixes golang/go#20922 Reviewed-on: https://go-review.googlesource.com/50635 From-SVN: r250443
2017-07-21runtime: don't use runtime_lock in __go_get_backtrace_stateIan Lance Taylor1-1/+1
If getSiginfo does not know how to determine the PC, it will call runtime_callers. That can happen in a thread that was started by non-Go code, in which case the TLS variable g will not be set, in which case runtime_lock will crash. Avoid the problem by using atomic operations for the lock. This is OK since creating a backtrace state is fast and never blocks. The test case is TestCgoExternalThreadSIGPROF in the runtime package on a system that getSiginfo doesn't handle specially. Updates golang/go#20931 Reviewed-on: https://go-review.googlesource.com/50650 From-SVN: r250439
2017-07-21runtime: handle PPC/PPC64 GNU/Linux in getSiginfoIan Lance Taylor1-1/+1
Updates golang/go#20931 Reviewed-on: https://go-review.googlesource.com/50631 From-SVN: r250436
2017-07-21runtime: allocate more stack space in CgoCallbackGC testIan Lance Taylor1-1/+1
Allocate enough stack space so that the test will work on a system that does not support split stacks. This test is actually not very meaningful for gccgo at present, but it doesn't hurt to keep running it. Updates golang/go#20931 Reviewed-on: https://go-review.googlesource.com/50630 From-SVN: r250433
2017-07-20compiler: add explicit convert in Type_guard_expression::do_get_backendIan Lance Taylor2-2/+5
The current recipe in Type_guard_expression for creating a Bexpression performs a type conversion at the Type level, but doesn't invoke Backend::convert_expression to capture the conversion for the back end. Add code to create a BE type conversion operation. Reviewed-on: https://go-review.googlesource.com/50373 From-SVN: r250400
2017-07-18compiler: insert backend type conversion for closure func ptrIan Lance Taylor2-2/+9
In Func_expression::do_get_backend when creating the backend representation for a closure, create a backend type conversion to account for potential differences between the closure struct type (where the number of fields is dependent on the number of values referenced in the closure) and the generic function descriptor type (struct with single function pointer field). Reviewed-on: https://go-review.googlesource.com/49255 From-SVN: r250327
2017-07-18re PR go/81451 (missing futex check - libgo/runtime/thread-linux.c:12:0 ↵Ian Lance Taylor1-1/+1
futex.h:13:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘long’) PR go/81451 runtime: inline runtime_osinit We had two identical copies of runtime_osinit. They set runtime_ncpu, a variable that is no longer used. Removing that leaves us with two lines. Inline those two lines in the two places the function was called. This fixes GCC PR 81451. Reviewed-on: https://go-review.googlesource.com/48862 From-SVN: r250326
2017-07-18compiler: pass correct 'function' flag to circular_pointer_typeIan Lance Taylor2-3/+3
The code in Named_type::do_get_backend was not passing the correct flag value for circular function types to Backend::circular_pointer_type (it was always setting this flag to false). Pass a true value if the type being converted is a function type. Reviewed-on: https://go-review.googlesource.com/49330 From-SVN: r250325
2017-07-18re PR go/81324 (libgo does not build with glibc 2.18)Ian Lance Taylor1-1/+1
PR go/81324 sysinfo.c: ignore ptrace_peeksiginfo_args from <linux/ptrace.h> With some versions of glibc and GNU/Linux ptrace_pseeksiginfo_args is defined in both <sys/ptrace.h> and <linux/ptrace.h>. We don't actually care about the struct, so use a #define to avoid a redefinition error. This fixes https://gcc.gnu.org/PR81324. Reviewed-on: https://go-review.googlesource.com/49290 From-SVN: r250324