aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2021-09-30compiler: avoid calling Expression::type before loweringIan Lance Taylor4-23/+69
This is a minor cleanup to ensure that the various Expression::do_type methods don't have to worry about the possibility that the Expression has not been lowered. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/353140
2021-09-28Daily bump.GCC Administrator1-0/+5
2021-09-27flag_complex_method: support optimize attributeMartin Liska1-0/+1
gcc/c-family/ChangeLog: * c-opts.c (c_common_init_options_struct): Set also x_flag_default_complex_method. gcc/ChangeLog: * common.opt: Add new variable flag_default_complex_method. * opts.c (finish_options): Handle flags related to x_flag_complex_method. * toplev.c (process_options): Remove option handling related to flag_complex_method. gcc/go/ChangeLog: * go-lang.c (go_langhook_init_options_struct): Set also x_flag_default_complex_method. gcc/lto/ChangeLog: * lto-lang.c (lto_init_options_struct): Set also x_flag_default_complex_method. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/attr-complex-method-2.c: New test. * gcc.c-torture/compile/attr-complex-method.c: New test.
2021-09-21runtime: set runtime.GOROOT value at build timeIan Lance Taylor1-1/+1
In Go 1.17 the gc toolchain changed to set runtime.GOROOT in cmd/link (previously it was runtime/internal/sys.GOROOT). Do the same in libgo. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/351313 gotools/: * Makefile.am (check-runtime): Add goroot.go to --extrafiles. * Makefile.in: Regenerate.
2021-09-16libgo: update to go1.17.1 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/350414
2021-09-11compiler: don't pad zero-sized trailing field in results structIan Lance Taylor3-3/+19
Nothing can take the address of that field anyhow. Fixes PR go/101994 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/343873
2021-09-10compiler: correct condition for calling memclrHasPointersIan Lance Taylor2-2/+2
When compiling append(s, make([]typ, ln)...), where typ has a pointer, and the append fits within the existing capacity of s, the condition used to clear out the new elements was reversed. Fixes golang/go#47771 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/344189
2021-09-07runtime: use hash32, not hash64, for amd64p32, mips64p32, mips64p32leIan Lance Taylor1-1/+1
Fixes PR go/102102 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/348015
2021-09-05libgo: update to final Go 1.17 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/343729
2021-08-14libgo: various fixes for Solaris supportIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342189
2021-08-13runtime: use C cast syntax in stack.cIan Lance Taylor1-1/+1
Didn't notice earlier because this code is only used on systems that do not support -fsplit-stack. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/342051
2021-08-12libgo: update to Go1.17rc2Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341629
2021-08-12compiler: store pointers to go:notinheap types indirectlyIan Lance Taylor4-18/+92
This is the gofrontend version of https://golang.org/cl/264480. For golang/go#42076 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340609
2021-08-10compiler: don't crash on a, b := int(0)Ian Lance Taylor2-3/+14
Fixes PR go/101851 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/341330
2021-08-07compiler: support export/import of unsafe.Add/SliceIan Lance Taylor8-29/+130
For golang/go#19367 For golang/go#40481 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340549
2021-08-06compiler: make escape analysis more strict about runtime callsCherry Mui2-2/+47
Following the previous CL, in the escape analysis list all the expected runtime calls, and fail if an unexpected one is seen. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/340397
2021-08-05runtime: extend internal atomics to comply with sync/atomicIan Lance Taylor2-26/+24
This is the gofrontend version of https://golang.org/cl/289152. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339690
2021-08-04compiler: make escape analysis more robust about builtin functionsCherry Mui2-3/+55
In the places where we handle builtin functions, list all supported ones, and fail if an unexpected one is seen. So if a new builtin function is added in the future we can detect it, instead of silently treating it as nonescaping. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339992
2021-08-03compiler: support new language constructs in escape analysisCherry Mui4-50/+134
Previous CLs add new language constructs in Go 1.17, specifically, unsafe.Add, unsafe.Slice, and conversion from a slice to a pointer to an array. This CL handles them in the escape analysis. At the point of the escape analysis, unsafe.Add and unsafe.Slice are still builtin calls, so just handle them in data flow. Conversion from a slice to a pointer to an array has already been lowered to a combination of compound expression, conditional expression and slice info expressions, so handle them in the escape analysis. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339671
2021-08-03compile, runtime: make selectnbrecv return two valuesIan Lance Taylor3-35/+34
The only different between selectnbrecv and selectnbrecv2 is the later set the input pointer value by second return value from chanrecv. So by making selectnbrecv return two values from chanrecv, we can get rid of selectnbrecv2, the compiler can now call only selectnbrecv and generate simpler code. This is the gofrontend version of https://golang.org/cl/292890. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339529
2021-08-03compiler: check slice to pointer-to-array conversion element typeIan Lance Taylor3-3/+8
When checking a slice to pointer-to-array conversion, I forgot to verify that the elements types are identical. For golang/go#395 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/339329
2021-08-02compiler, runtime: allow slice to array pointer conversionIan Lance Taylor4-3/+64
Panic if the slice is too short. For golang/go#395 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338630
2021-08-02compiler, runtime: support unsafe.Add and unsafe.SliceIan Lance Taylor5-2/+253
For golang/go#19367 For golang/go#40481 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/338949
2021-07-19compiler: avoid aliases in receiver typesIan Lance Taylor4-1/+100
If a package declares a method on an alias type, the alias would be used in the export data. This would then trigger a compiler assertion on import: we should not be adding methods to aliases. Fix the problem by ensuring that receiver types do not use alias types. This seems preferable to consistently avoiding aliases in export data, as aliases can cross packages. And it's painful to try to patch this while writing the export data, as at that point all the types are known. Test case is https://golang.org/cl/335172. Fixes golang/go#47131 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/335729
2021-07-09runtime: remove direct assignments to memory locationsIan Lance Taylor1-1/+1
PR bootstrap/101374 They cause a warning with the updated GCC -Warray-bounds option. Replace them with calls to abort, which for our purposes is fine. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/333409
2021-06-30Daily bump.GCC Administrator1-0/+7
2021-06-29compiler: don't generate temporaries for composite literalsIan Lance Taylor3-104/+7
We were generating temporaries for composite literals when a conversion to interface type was required. However, Cherry's https://golang.org/cl/176459 changed the compiler to insert explicit type conversions. And those explicit type conversions insert the required temporaries in Type_conversion_expression::do_flatten. So in practice the composite literal do_flatten methods would never insert temporaries, as the values they see would always be multi_eval_safe. So just remove the unnecessary do_flatten methods. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331691
2021-06-29go-gcc: set DECL_NAMELESS for temporary variablesIan Lance Taylor1-0/+3
* go-gcc.cc (Gcc_backend::static_chain_variable): Set DECL_NAMELESS on the new decl. (Gcc_backend::temporary_variable): Likewise. (Gcc_backend::function): Set DECL_NAMELESS on the result decl.
2021-06-29compiler: in composite literals use temps only for interfacesIan Lance Taylor2-5/+14
For a composite literal we only need to introduce a temporary variable if we may be converting to an interface type, so only do it then. This saves over 80% of compilation time when using gccgo to compile cmd/internal/obj/x86, as the GCC middle-end spends a lot of time pointlessly computing interactions between temporary variables. For PR debug/101064 For golang/go#46600 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331513
2021-06-10libgo: update to Go1.16.5 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/326772
2021-05-28Daily bump.GCC Administrator1-0/+4
2021-05-27gccgo.texi: remove HTML quotingIan Lance Taylor1-1/+1
* gccgo.texi (Function Names): Don't HTML quote ampersand.
2021-05-25Daily bump.GCC Administrator1-0/+6
2021-05-24compiler: mark global variables whose address is takenIan Lance Taylor7-184/+276
To implement this, change the backend to use flag bits for variables. Fixes https://gcc.gnu.org/PR100537 PR go/100537 * go-gcc.cc (class Gcc_backend): Update methods that create variables to take a flags parameter. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/322129
2021-05-18gcc/go/ChangeLog: remove entry for reverted changeIan Lance Taylor1-5/+0
2021-05-18gofrontend: revert startswith changeIan Lance Taylor1-1/+1
This file is copied from a different repo and should not be changed directly in the GCC repo.
2021-05-18libgo: update configure to current sourcesIan Lance Taylor1-1/+1
Change-Id: I12766baf02bfdf2233f1c5bde1a270f06b020aa7 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/321076 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-11Daily bump.GCC Administrator1-0/+5
2021-05-10Come up with startswith function.Martin Liska1-1/+1
gcc/ada/ChangeLog: * gcc-interface/utils.c (def_builtin_1): Use startswith function instead of strncmp. gcc/analyzer/ChangeLog: * sm-file.cc (is_file_using_fn_p): Use startswith function instead of strncmp. gcc/ChangeLog: * builtins.c (is_builtin_name): Use startswith function instead of strncmp. * collect2.c (main): Likewise. (has_lto_section): Likewise. (scan_libraries): Likewise. * coverage.c (coverage_checksum_string): Likewise. (coverage_init): Likewise. * dwarf2out.c (is_cxx): Likewise. (gen_compile_unit_die): Likewise. * gcc-ar.c (main): Likewise. * gcc.c (init_spec): Likewise. (read_specs): Likewise. (execute): Likewise. (check_live_switch): Likewise. * genattrtab.c (write_attr_case): Likewise. (IS_ATTR_GROUP): Likewise. * gencfn-macros.c (main): Likewise. * gengtype.c (type_for_name): Likewise. (gen_rtx_next): Likewise. (get_file_langdir): Likewise. (write_local): Likewise. * genmatch.c (get_operator): Likewise. (get_operand_type): Likewise. (expr::gen_transform): Likewise. * genoutput.c (validate_optab_operands): Likewise. * incpath.c (add_sysroot_to_chain): Likewise. * langhooks.c (lang_GNU_C): Likewise. (lang_GNU_CXX): Likewise. (lang_GNU_Fortran): Likewise. (lang_GNU_OBJC): Likewise. * lto-wrapper.c (run_gcc): Likewise. * omp-general.c (omp_max_simt_vf): Likewise. * omp-low.c (omp_runtime_api_call): Likewise. * opts-common.c (parse_options_from_collect_gcc_options): Likewise. * read-rtl-function.c (function_reader::read_rtx_operand_r): Likewise. * real.c (real_from_string): Likewise. * selftest.c (assert_str_startswith): Likewise. * timevar.c (timer::validate_phases): Likewise. * tree.c (get_file_function_name): Likewise. * ubsan.c (ubsan_use_new_style_p): Likewise. * varasm.c (default_function_rodata_section): Likewise. (incorporeal_function_p): Likewise. (default_section_type_flags): Likewise. * system.h (startswith): Define startswith. gcc/c-family/ChangeLog: * c-ada-spec.c (print_destructor): Use startswith function instead of strncmp. (dump_ada_declaration): Likewise. * c-common.c (disable_builtin_function): Likewise. (def_builtin_1): Likewise. * c-format.c (check_tokens): Likewise. (check_plain): Likewise. (convert_format_name_to_system_name): Likewise. gcc/c/ChangeLog: * c-aux-info.c (affix_data_type): Use startswith function instead of strncmp. * c-typeck.c (build_function_call_vec): Likewise. * gimple-parser.c (c_parser_gimple_parse_bb_spec): Likewise. gcc/cp/ChangeLog: * decl.c (duplicate_decls): Use startswith function instead of strncmp. (cxx_builtin_function): Likewise. (omp_declare_variant_finalize_one): Likewise. (grokfndecl): Likewise. * error.c (dump_decl_name): Likewise. * mangle.c (find_decomp_unqualified_name): Likewise. (write_guarded_var_name): Likewise. (decl_tls_wrapper_p): Likewise. * parser.c (cp_parser_simple_type_specifier): Likewise. (cp_parser_tx_qualifier_opt): Likewise. * pt.c (template_parm_object_p): Likewise. (dguide_name_p): Likewise. gcc/d/ChangeLog: * d-builtins.cc (do_build_builtin_fn): Use startswith function instead of strncmp. * dmd/dinterpret.c (evaluateIfBuiltin): Likewise. * dmd/dmangle.c: Likewise. * dmd/hdrgen.c: Likewise. * dmd/identifier.c (Identifier::toHChars2): Likewise. gcc/fortran/ChangeLog: * decl.c (variable_decl): Use startswith function instead of strncmp. (gfc_match_end): Likewise. * gfortran.h (gfc_str_startswith): Likewise. * module.c (load_omp_udrs): Likewise. (read_module): Likewise. * options.c (gfc_handle_runtime_check_option): Likewise. * primary.c (match_arg_list_function): Likewise. * trans-decl.c (gfc_get_symbol_decl): Likewise. * trans-expr.c (gfc_conv_procedure_call): Likewise. * trans-intrinsic.c (gfc_conv_ieee_arithmetic_function): Likewise. gcc/go/ChangeLog: * gofrontend/runtime.cc (Runtime::name_to_code): Use startswith function instead of strncmp. gcc/objc/ChangeLog: * objc-act.c (objc_string_ref_type_p): Use startswith function instead of strncmp. * objc-encoding.c (encode_type): Likewise. * objc-next-runtime-abi-02.c (has_load_impl): Likewise.
2021-04-12libgo: update to Go1.16.3 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
2021-03-17compiler: copy receiver argument for go/defer of method callIan Lance Taylor3-2/+29
Test case is https://golang.org/cl/302371. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/302270
2021-03-15libgo: update to Go 1.16.2 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301459
2021-03-12misc/cgo/testcarchive: don't use == for string equality in C codeIan Lance Taylor1-1/+1
Backport of https://golang.org/cl/300993. For PR go/99553 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301458
2021-03-11compiler: create temporaries for heap variablesIan Lance Taylor6-56/+99
The compiler generally doesn't create a temporary for an expression that is a variable, because it's normally valid to simply reload the value from the variable. However, if the variable is in the heap, then loading the value is a pointer indirection. The process of creating GCC IR can cause the variable load and the pointer indirection to be split, such that the second evaluation only does the pointer indirection. If there are conditionals in between the two uses, this can cause the second use to load the pointer from an uninitialized register. Avoid this by introducing a new Expression method that returns whether it is safe to evaluate an expression multiple times, and use it everywhere. The test case is https://golang.org/cl/300789. Fixes golang/go#44383 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/300809
2021-03-08runtime: cast SIGSTKSZ to uintptrIan Lance Taylor1-1/+1
In newer versions of glibc it is long, which causes a signed comparison warning. Fixes PR go/99458
2021-03-02compiler: allow //go:embed in files underscore-importing embedMichael Matloob5-21/+14
The embed spec allows for //go:embed to be used in files that underscore-import package "embed". This is useful for embeds to []byte and string vars because the embed.FS type may not be referenced if those are the only types of embeds in a file. Because the compiler previously checked whether there were any aliases to the embed package to decide if //go:embed could be used, it would reject files with only underscore imports of embed. Instead, record whether the embed import is encountered at all, similar to what is done with unsafe, to decide whether //go:embed is allowed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/297553
2021-02-25libgo: ensure memmove, memset 8 byte atomicity on ppc64xLynn Boger1-1/+1
Go requires that pointer moves are done 8 bytes at a time, but gccgo uses libc's memmove and memset which does not require that, and there are some cases where an 8 byte move might be done as 4+4. To enforce 8 byte moves for memmove and memset, this adds a C implementation in libgo/runtime for memmove and memset to be used on ppc64le and ppc64. Asm implementations were considered but discarded to avoid different implementations for different target ISAs. Fixes golang/go#41428 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/294931
2021-02-19libgo: update to Go1.16 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/293793
2021-02-16compiler: unalias receiver type in export dataIan Lance Taylor2-2/+2
Test case is https://golang.org/cl/292009. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291991
2021-02-12compiler: open byte slice and string embeds using the absolute pathMichael Matloob2-4/+3
The paths vector contains the names of the files that the embed_files_ map is keyed by. While the code processing embed.FS values looks up the paths in the embed_files_ map, the code processing string and byte slice embeds tries opening the files using their names directly. Look up the full paths in the embed_files_ map when opening them. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291429