aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-03-29 09:01:23 -0700
committerIan Lance Taylor <iant@golang.org>2023-03-29 09:01:23 -0700
commit6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (patch)
tree1deecdcfbf185c7044bc861d0ace51285c96cb62 /gcc/go
parent795cffe109e28b248a54b8ee583cbae48368c2a7 (diff)
parentaa8f4242efc99f24de73c59d53996f28db28c13f (diff)
downloadgcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.zip
gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.gz
gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.bz2
Merge from trunk revision aa8f4242efc99f24de73c59d53996f28db28c13f.
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/ChangeLog187
-rw-r--r--gcc/go/Make-lang.in2
-rw-r--r--gcc/go/config-lang.in2
-rw-r--r--gcc/go/gccgo.texi36
-rw-r--r--gcc/go/go-backend.cc2
-rw-r--r--gcc/go/go-c.h2
-rw-r--r--gcc/go/go-gcc-diagnostics.cc2
-rw-r--r--gcc/go/go-gcc.cc36
-rw-r--r--gcc/go/go-gcc.h2
-rw-r--r--gcc/go/go-lang.cc2
-rw-r--r--gcc/go/go-sha1.cc2
-rw-r--r--gcc/go/go-system.h2
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/escape.cc20
-rw-r--r--gcc/go/gofrontend/expressions.cc13
-rw-r--r--gcc/go/gofrontend/expressions.h4
-rw-r--r--gcc/go/gofrontend/gogo.h2
-rw-r--r--gcc/go/gofrontend/lex.h2
-rw-r--r--gcc/go/gofrontend/statements.cc34
-rw-r--r--gcc/go/gofrontend/statements.h5
-rw-r--r--gcc/go/gofrontend/types.cc13
-rw-r--r--gcc/go/gofrontend/types.h2
-rw-r--r--gcc/go/gofrontend/wb.cc10
-rw-r--r--gcc/go/gospec.cc2
-rw-r--r--gcc/go/lang-specs.h2
-rw-r--r--gcc/go/lang.opt2
26 files changed, 287 insertions, 103 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 43cc2e0..507e2d3 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,184 @@
+2023-03-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/109258
+ * go-gcc.cc (Gcc_backend): Add new static data members builtin_pure
+ and builtin_nothrow.
+ (Gcc_backend::Gcc_backend): Pass builtin_pure | builtin_nothrow for
+ BUILT_IN_MEMCMP.
+ (Gcc_backend::define_builtin): Handle builtin_pure and builtin_nothrow
+ in flags.
+
+2023-02-23 Arsen Arsenović <arsen@aarsen.me>
+
+ * gccgo.texi: Reorder index entries around @items.
+
+2023-01-17 Ian Lance Taylor <iant@golang.org>
+
+ PR go/108426
+ * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_ctzl and
+ __builtin_clzl. Patch by Andrew Pinski.
+
+2023-01-02 Jakub Jelinek <jakub@redhat.com>
+
+ * gccgo.texi: Bump @copyrights-go year.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * doc/c-interoperability.rst: New file.
+ * doc/c-type-interoperability.rst: New file.
+ * doc/compiler-directives.rst: New file.
+ * doc/conf.py: New file.
+ * doc/copyright.rst: New file.
+ * doc/function-names.rst: New file.
+ * doc/general-public-license-3.rst: New file.
+ * doc/gnu-free-documentation-license.rst: New file.
+ * doc/import-and-export.rst: New file.
+ * doc/index.rst: New file.
+ * doc/indices-and-tables.rst: New file.
+ * doc/introduction.rst: New file.
+ * doc/invoking-gccgo.rst: New file.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in: Support Sphinx based documentation.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * gccgo.texi: Removed.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in: Support --with-sphinx-build.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in:
+ Support installation if sphinx-build is missing.
+ Support installation if sphinx-build is missing.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * doc/c-interoperability.rst:
+ Add trailing newline.
+ * doc/c-type-interoperability.rst:
+ Add trailing newline.
+ * doc/compiler-directives.rst:
+ Add trailing newline.
+ * doc/copyright.rst:
+ Add trailing newline.
+ * doc/function-names.rst:
+ Add trailing newline.
+ * doc/general-public-license-3.rst:
+ Add trailing newline.
+ * doc/gnu-free-documentation-license.rst:
+ Add trailing newline.
+ * doc/import-and-export.rst:
+ Add trailing newline.
+ * doc/index.rst:
+ Add trailing newline.
+ * doc/indices-and-tables.rst:
+ Add trailing newline.
+ * doc/introduction.rst:
+ Add trailing newline.
+ * doc/invoking-gccgo.rst:
+ Add trailing newline.
+
+2022-11-14 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2022-11-14 Martin Liska <mliska@suse.cz>
+
+ * doc/conf.py: Add newline at last line.
+
+2022-11-10 Martin Liska <mliska@suse.cz>
+
+ * doc/conf.py: Add newline at last line.
+
+2022-11-10 Ian Lance Taylor <iant@golang.org>
+
+ PR target/107581
+ * go-gcc.cc (Gcc_backend::Gcc_backend): Define
+ __atomic_fetch_add_{4,8}.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * doc/c-interoperability.rst:
+ Add trailing newline.
+ * doc/c-type-interoperability.rst:
+ Add trailing newline.
+ * doc/compiler-directives.rst:
+ Add trailing newline.
+ * doc/copyright.rst:
+ Add trailing newline.
+ * doc/function-names.rst:
+ Add trailing newline.
+ * doc/general-public-license-3.rst:
+ Add trailing newline.
+ * doc/gnu-free-documentation-license.rst:
+ Add trailing newline.
+ * doc/import-and-export.rst:
+ Add trailing newline.
+ * doc/index.rst:
+ Add trailing newline.
+ * doc/indices-and-tables.rst:
+ Add trailing newline.
+ * doc/introduction.rst:
+ Add trailing newline.
+ * doc/invoking-gccgo.rst:
+ Add trailing newline.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in:
+ Support installation if sphinx-build is missing.
+ Support installation if sphinx-build is missing.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in: Support --with-sphinx-build.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * gccgo.texi: Removed.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * Make-lang.in: Support Sphinx based documentation.
+
+2022-11-09 Martin Liska <mliska@suse.cz>
+
+ * doc/c-interoperability.rst: New file.
+ * doc/c-type-interoperability.rst: New file.
+ * doc/compiler-directives.rst: New file.
+ * doc/conf.py: New file.
+ * doc/copyright.rst: New file.
+ * doc/function-names.rst: New file.
+ * doc/general-public-license-3.rst: New file.
+ * doc/gnu-free-documentation-license.rst: New file.
+ * doc/import-and-export.rst: New file.
+ * doc/index.rst: New file.
+ * doc/indices-and-tables.rst: New file.
+ * doc/introduction.rst: New file.
+ * doc/invoking-gccgo.rst: New file.
+
2022-09-15 Richard Biener <rguenther@suse.de>
* go-lang.cc (go_langhook_init): Do not initialize
@@ -6,7 +187,7 @@
2022-09-02 Martin Liska <mliska@suse.cz>
* go-lang.cc (go_langhook_pushdecl): Remove -gstabs option support, DBX-related
- macros and DBX debugging info support.
+ macros and DBX debugging info support.
* gospec.cc (lang_specific_driver): Likewise.
2022-07-16 Ian Lance Taylor <iant@golang.org>
@@ -79,7 +260,7 @@
2021-09-27 Martin Liska <mliska@suse.cz>
* go-lang.c (go_langhook_init_options_struct): Set also
- x_flag_default_complex_method.
+ x_flag_default_complex_method.
2021-06-29 Ian Lance Taylor <iant@golang.org>
@@ -1870,7 +2051,7 @@
Go frontend added to gcc repository.
-Copyright (C) 2010-2022 Free Software Foundation, Inc.
+Copyright (C) 2010-2023 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index 0e81268..a1f2977 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -1,6 +1,6 @@
# Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend.
-# Copyright (C) 2009-2022 Free Software Foundation, Inc.
+# Copyright (C) 2009-2023 Free Software Foundation, Inc.
# This file is part of GCC.
diff --git a/gcc/go/config-lang.in b/gcc/go/config-lang.in
index 19fdbc3..845a57a 100644
--- a/gcc/go/config-lang.in
+++ b/gcc/go/config-lang.in
@@ -1,6 +1,6 @@
# config-lang.in -- Top level configure fragment for gcc Go frontend.
-# Copyright (C) 2009-2022 Free Software Foundation, Inc.
+# Copyright (C) 2009-2023 Free Software Foundation, Inc.
# This file is part of GCC.
diff --git a/gcc/go/gccgo.texi b/gcc/go/gccgo.texi
index 66020aa7..4ab1a76 100644
--- a/gcc/go/gccgo.texi
+++ b/gcc/go/gccgo.texi
@@ -12,7 +12,7 @@
@include gcc-common.texi
@c Copyright years for this manual.
-@set copyrights-go 2010-2022
+@set copyrights-go 2010-2023
@copying
@c man begin COPYRIGHT
@@ -152,18 +152,18 @@ program will generally cause it to misbehave or fail.
@c man begin OPTIONS gccgo
@table @gcctabopt
-@item -I@var{dir}
@cindex @option{-I}
+@item -I@var{dir}
Specify a directory to use when searching for an import package at
compile time.
-@item -L@var{dir}
@cindex @option{-L}
+@item -L@var{dir}
When linking, specify a library search directory, as with
@command{gcc}.
-@item -fgo-pkgpath=@var{string}
@cindex @option{-fgo-pkgpath}
+@item -fgo-pkgpath=@var{string}
Set the package path to use. This sets the value returned by the
PkgPath method of reflect.Type objects. It is also used for the names
of globally visible symbols. The argument to this option should
@@ -171,8 +171,8 @@ normally be the string that will be used to import this package after
it has been installed; in other words, a pathname within the
directories specified by the @option{-I} option.
-@item -fgo-prefix=@var{string}
@cindex @option{-fgo-prefix}
+@item -fgo-prefix=@var{string}
An alternative to @option{-fgo-pkgpath}. The argument will be
combined with the package name from the source file to produce the
package path. If @option{-fgo-pkgpath} is used, @option{-fgo-prefix}
@@ -189,24 +189,24 @@ Using either @option{-fgo-pkgpath} or @option{-fgo-prefix} disables
the special treatment of the @code{main} package and permits that
package to be imported like any other.
-@item -fgo-relative-import-path=@var{dir}
@cindex @option{-fgo-relative-import-path}
+@item -fgo-relative-import-path=@var{dir}
A relative import is an import that starts with @file{./} or
@file{../}. If this option is used, @command{gccgo} will use
@var{dir} as a prefix for the relative import when searching for it.
-@item -frequire-return-statement
-@itemx -fno-require-return-statement
@cindex @option{-frequire-return-statement}
@cindex @option{-fno-require-return-statement}
+@item -frequire-return-statement
+@itemx -fno-require-return-statement
By default @command{gccgo} will warn about functions which have one or
more return parameters but lack an explicit @code{return} statement.
This warning may be disabled using
@option{-fno-require-return-statement}.
-@item -fgo-check-divide-zero
@cindex @option{-fgo-check-divide-zero}
@cindex @option{-fno-go-check-divide-zero}
+@item -fgo-check-divide-zero
Add explicit checks for division by zero. In Go a division (or
modulos) by zero causes a panic. On Unix systems this is detected in
the runtime by catching the @code{SIGFPE} signal. Some processors,
@@ -217,9 +217,9 @@ systems, this option may be used. Or the checks may be removed via
default, but in the future may be off by default on systems that do
not require it.
-@item -fgo-check-divide-overflow
@cindex @option{-fgo-check-divide-overflow}
@cindex @option{-fno-go-check-divide-overflow}
+@item -fgo-check-divide-overflow
Add explicit checks for division overflow. For example, division
overflow occurs when computing @code{INT_MIN / -1}. In Go this should
be wrapped, to produce @code{INT_MIN}. Some processors, such as x86,
@@ -229,41 +229,41 @@ may be used. Or the checks may be removed via
by default, but in the future may be off by default on systems that do
not require it.
-@item -fno-go-optimize-allocs
@cindex @option{-fno-go-optimize-allocs}
+@item -fno-go-optimize-allocs
Disable escape analysis, which tries to allocate objects on the stack
rather than the heap.
-@item -fgo-debug-escape@var{n}
@cindex @option{-fgo-debug-escape}
+@item -fgo-debug-escape@var{n}
Output escape analysis debugging information. Larger values of
@var{n} generate more information.
-@item -fgo-debug-escape-hash=@var{n}
@cindex @option{-fgo-debug-escape-hash}
+@item -fgo-debug-escape-hash=@var{n}
A hash value to debug escape analysis. @var{n} is a binary string.
This runs escape analysis only on functions whose names hash to values
that match the given suffix @var{n}. This can be used to binary
search across functions to uncover escape analysis bugs.
-@item -fgo-debug-optimization
@cindex @option{-fgo-debug-optimization}
@cindex @option{-fno-go-debug-optimization}
+@item -fgo-debug-optimization
Output optimization diagnostics.
-@item -fgo-c-header=@var{file}
@cindex @option{-fgo-c-header}
+@item -fgo-c-header=@var{file}
Write top-level named Go struct definitions to @var{file} as C code.
This is used when compiling the runtime package.
-@item -fgo-compiling-runtime
@cindex @option{-fgo-compiling-runtime}
+@item -fgo-compiling-runtime
Apply special rules for compiling the runtime package. Implicit
memory allocation is forbidden. Some additional compiler directives
are supported.
-@item -fgo-embedcfg=@var{file}
@cindex @option{-fgo-embedcfg}
+@item -fgo-embedcfg=@var{file}
Identify a JSON file used to map patterns used with special
@code{//go:embed} comments to the files named by the patterns. The
JSON file should have two components: @code{Patterns} maps each
@@ -271,8 +271,8 @@ pattern to a list of file names, and @code{Files} maps each file name
to a full path to the file. This option is intended for use by the
@command{go} command to implement @code{//go:embed}.
-@item -g
@cindex @option{-g for gccgo}
+@item -g
This is the standard @command{gcc} option (@pxref{Debugging Options, ,
Debugging Options, gcc, Using the GNU Compiler Collection (GCC)}). It
is mentioned here because by default @command{gccgo} turns on
diff --git a/gcc/go/go-backend.cc b/gcc/go/go-backend.cc
index 7eed943..c6a1a2b 100644
--- a/gcc/go/go-backend.cc
+++ b/gcc/go/go-backend.cc
@@ -1,5 +1,5 @@
/* go-backend.cc -- Go frontend interface to gcc backend.
- Copyright (C) 2010-2022 Free Software Foundation, Inc.
+ Copyright (C) 2010-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/go-c.h b/gcc/go/go-c.h
index d2de9e7..c605038 100644
--- a/gcc/go/go-c.h
+++ b/gcc/go/go-c.h
@@ -1,5 +1,5 @@
/* go-c.h -- Header file for go frontend gcc C interface.
- Copyright (C) 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2009-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/go-gcc-diagnostics.cc b/gcc/go/go-gcc-diagnostics.cc
index 23c3c07..f1933ca 100644
--- a/gcc/go/go-gcc-diagnostics.cc
+++ b/gcc/go/go-gcc-diagnostics.cc
@@ -1,5 +1,5 @@
// go-gcc-diagnostics.cc -- GCC implementation of go diagnostics interface.
-// Copyright (C) 2016-2022 Free Software Foundation, Inc.
+// Copyright (C) 2016-2023 Free Software Foundation, Inc.
// Contributed by Than McIntosh, Google.
// This file is part of GCC.
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 1ba7206..41ae9f8 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -1,5 +1,5 @@
// go-gcc.cc -- Go frontend to gcc IR.
-// Copyright (C) 2011-2022 Free Software Foundation, Inc.
+// Copyright (C) 2011-2023 Free Software Foundation, Inc.
// Contributed by Ian Lance Taylor, Google.
// This file is part of GCC.
@@ -543,6 +543,8 @@ private:
static const int builtin_const = 1 << 0;
static const int builtin_noreturn = 1 << 1;
static const int builtin_novops = 1 << 2;
+ static const int builtin_pure = 1 << 3;
+ static const int builtin_nothrow = 1 << 4;
void
define_builtin(built_in_function bcode, const char* name, const char* libname,
@@ -601,7 +603,7 @@ Gcc_backend::Gcc_backend()
const_ptr_type_node,
size_type_node,
NULL_TREE),
- 0);
+ builtin_pure | builtin_nothrow);
// We use __builtin_memmove for copying data.
this->define_builtin(BUILT_IN_MEMMOVE, "__builtin_memmove", "memmove",
@@ -627,6 +629,11 @@ Gcc_backend::Gcc_backend()
unsigned_type_node,
NULL_TREE),
builtin_const);
+ this->define_builtin(BUILT_IN_CTZL, "__builtin_ctzl", "ctzl",
+ build_function_type_list(integer_type_node,
+ long_unsigned_type_node,
+ NULL_TREE),
+ builtin_const);
this->define_builtin(BUILT_IN_CTZLL, "__builtin_ctzll", "ctzll",
build_function_type_list(integer_type_node,
long_long_unsigned_type_node,
@@ -637,6 +644,11 @@ Gcc_backend::Gcc_backend()
unsigned_type_node,
NULL_TREE),
builtin_const);
+ this->define_builtin(BUILT_IN_CLZL, "__builtin_clzl", "clzl",
+ build_function_type_list(integer_type_node,
+ long_unsigned_type_node,
+ NULL_TREE),
+ builtin_const);
this->define_builtin(BUILT_IN_CLZLL, "__builtin_clzll", "clzll",
build_function_type_list(integer_type_node,
long_long_unsigned_type_node,
@@ -886,16 +898,20 @@ Gcc_backend::Gcc_backend()
uint32_type_node,
integer_type_node,
NULL_TREE);
- this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4", NULL,
- t, 0);
+ this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4",
+ NULL, t, 0);
+ this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_4, "__atomic_fetch_add_4",
+ NULL, t, 0);
t = build_function_type_list(uint64_type_node,
ptr_type_node,
uint64_type_node,
integer_type_node,
NULL_TREE);
- this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8", NULL,
- t, 0);
+ this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8",
+ NULL, t, 0);
+ this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_8, "__atomic_fetch_add_8",
+ NULL, t, 0);
t = build_function_type_list(unsigned_char_type_node,
ptr_type_node,
@@ -3582,6 +3598,10 @@ Gcc_backend::define_builtin(built_in_function bcode, const char* name,
libname, NULL_TREE);
if ((flags & builtin_const) != 0)
TREE_READONLY(decl) = 1;
+ if ((flags & builtin_pure) != 0)
+ DECL_PURE_P(decl) = 1;
+ if ((flags & builtin_nothrow) != 0)
+ TREE_NOTHROW (decl) = 1;
if ((flags & builtin_noreturn) != 0)
TREE_THIS_VOLATILE(decl) = 1;
if ((flags & builtin_novops) != 0)
@@ -3594,6 +3614,10 @@ Gcc_backend::define_builtin(built_in_function bcode, const char* name,
NULL, NULL_TREE);
if ((flags & builtin_const) != 0)
TREE_READONLY(decl) = 1;
+ if ((flags & builtin_pure) != 0)
+ DECL_PURE_P(decl) = 1;
+ if ((flags & builtin_nothrow) != 0)
+ TREE_NOTHROW (decl) = 1;
if ((flags & builtin_noreturn) != 0)
TREE_THIS_VOLATILE(decl) = 1;
if ((flags & builtin_novops) != 0)
diff --git a/gcc/go/go-gcc.h b/gcc/go/go-gcc.h
index 86f027d..3b94d02 100644
--- a/gcc/go/go-gcc.h
+++ b/gcc/go/go-gcc.h
@@ -1,5 +1,5 @@
/* go-gcc.h -- Header file for go backend-specific interfaces.
- Copyright (C) 2016-2022 Free Software Foundation, Inc.
+ Copyright (C) 2016-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/go-lang.cc b/gcc/go/go-lang.cc
index 4743370..b6e8c37 100644
--- a/gcc/go/go-lang.cc
+++ b/gcc/go/go-lang.cc
@@ -1,5 +1,5 @@
/* go-lang.cc -- Go frontend gcc interface.
- Copyright (C) 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2009-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/go-sha1.cc b/gcc/go/go-sha1.cc
index ab74414..3ec8eef 100644
--- a/gcc/go/go-sha1.cc
+++ b/gcc/go/go-sha1.cc
@@ -1,5 +1,5 @@
/* go-sha1.cc -- Go frontend interface to gcc backend.
- Copyright (C) 2016-2022 Free Software Foundation, Inc.
+ Copyright (C) 2016-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/go-system.h b/gcc/go/go-system.h
index 7ea1057..d58829d 100644
--- a/gcc/go/go-system.h
+++ b/gcc/go/go-system.h
@@ -1,5 +1,5 @@
// go-system.h -- Go frontend inclusion of gcc header files -*- C++ -*-
-// Copyright (C) 2009-2022 Free Software Foundation, Inc.
+// Copyright (C) 2009-2023 Free Software Foundation, Inc.
// This file is part of GCC.
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index f7a7985..addef6f 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-42efec8c126cf3787bc7c89d9c7f224eff7c5a21
+63ba7dd52f2cc49dab4b70ac81309296a920d4dc
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/escape.cc b/gcc/go/gofrontend/escape.cc
index 6da29ed..89e6442 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -990,7 +990,7 @@ Gogo::analyze_escape()
for (std::vector<Named_object*>::iterator fn = stack.begin();
fn != stack.end();
++fn)
- this->tag_function(context, *fn);
+ this->tag_function(*fn);
if (this->debug_escape_level() != 0)
{
@@ -1246,10 +1246,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s)
class Escape_analysis_assign : public Traverse
{
public:
- Escape_analysis_assign(Escape_context* context, Named_object* fn)
+ Escape_analysis_assign(Escape_context* context)
: Traverse(traverse_statements
| traverse_expressions),
- context_(context), fn_(fn)
+ context_(context)
{ }
// Model statements within a function as assignments and flows between nodes.
@@ -1286,8 +1286,6 @@ public:
private:
// The escape context for this set of functions.
Escape_context* context_;
- // The current function being analyzed.
- Named_object* fn_;
};
// Helper function to detect self assignment like the following.
@@ -2899,7 +2897,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn)
int save_depth = context->loop_depth();
context->set_loop_depth(1);
- Escape_analysis_assign ea(context, fn);
+ Escape_analysis_assign ea(context);
Function::Results* res = fn->func_value()->result_variables();
if (res != NULL)
{
@@ -3465,17 +3463,13 @@ Gogo::propagate_escape(Escape_context* context, Node* dst)
class Escape_analysis_tag
{
public:
- Escape_analysis_tag(Escape_context* context)
- : context_(context)
+ Escape_analysis_tag()
{ }
// Add notes to the function's type about the escape information of its
// input parameters.
void
tag(Named_object* fn);
-
- private:
- Escape_context* context_;
};
void
@@ -3580,9 +3574,9 @@ Escape_analysis_tag::tag(Named_object* fn)
// retain analysis results across imports.
void
-Gogo::tag_function(Escape_context* context, Named_object* fn)
+Gogo::tag_function(Named_object* fn)
{
- Escape_analysis_tag eat(context);
+ Escape_analysis_tag eat;
eat.tag(fn);
}
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 2492d9f..4ac55af 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -4092,6 +4092,9 @@ Type_conversion_expression::do_numeric_constant_value(
bool
Type_conversion_expression::do_string_constant_value(std::string* val) const
{
+ if (this->type_->is_string_type() && this->expr_->type()->is_string_type())
+ return this->expr_->string_constant_value(val);
+
if (this->type_->is_string_type()
&& this->expr_->type()->integer_type() != NULL)
{
@@ -10316,7 +10319,12 @@ Builtin_call_expression::do_check_types(Gogo*)
case BUILTIN_PANIC:
case BUILTIN_SIZEOF:
case BUILTIN_ALIGNOF:
- this->check_one_arg();
+ if (this->check_one_arg())
+ {
+ Expression* arg = this->one_arg();
+ if (arg->type()->is_void_type())
+ this->report_error(_("argument to builtin has void type"));
+ }
break;
case BUILTIN_RECOVER:
@@ -11259,6 +11267,7 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function,
Struct_type* st = Type::make_struct_type(sfl, loc);
st->set_is_struct_incomparable();
+ st->set_is_results_struct();
this->call_temp_ = Statement::make_temporary(st, NULL, loc);
inserter->insert(this->call_temp_);
}
@@ -12492,7 +12501,7 @@ Call_expression::do_type()
else if (results->size() == 1)
ret = results->begin()->type();
else
- ret = Type::make_call_multiple_result_type(this);
+ ret = Type::make_call_multiple_result_type();
this->type_ = ret;
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index a1e3733..3d7e787 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -4410,6 +4410,10 @@ class Slice_info_expression : public Expression
{ return this->slice_info_; }
protected:
+ int
+ do_traverse(Traverse* traverse)
+ { return Expression::traverse(&this->slice_, traverse); }
+
Type*
do_type();
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 433fdae..c08a16b 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -879,7 +879,7 @@ class Gogo
// Add notes about the escape level of a function's input and output
// parameters for exporting and importing top level functions.
void
- tag_function(Escape_context*, Named_object*);
+ tag_function(Named_object*);
// Reclaim memory of escape analysis Nodes.
void
diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h
index 1c4cc5b..701e5d4 100644
--- a/gcc/go/gofrontend/lex.h
+++ b/gcc/go/gofrontend/lex.h
@@ -561,7 +561,7 @@ class Lex
gather_embed(const char*, const char*);
// The input file name.
- const char* input_file_name_;
+ const char* input_file_name_ ATTRIBUTE_UNUSED;
// The input file.
FILE* input_file_;
// The object used to keep track of file names and line numbers.
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index b442830..af8c7d1 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -2349,7 +2349,7 @@ Thunk_statement::Thunk_statement(Statement_classification classification,
Call_expression* call,
Location location)
: Statement(classification, location),
- call_(call), struct_type_(NULL)
+ call_(call)
{
}
@@ -2430,15 +2430,6 @@ void
Thunk_statement::do_determine_types()
{
this->call_->determine_type_no_context();
-
- // Now that we know the types of the call, build the struct used to
- // pass parameters.
- Call_expression* ce = this->call_->call_expression();
- if (ce == NULL)
- return;
- Function_type* fntype = ce->get_function_type();
- if (fntype != NULL && !this->is_simple(fntype))
- this->struct_type_ = this->build_struct(fntype);
}
// Check types in a thunk statement.
@@ -2581,6 +2572,8 @@ Thunk_statement::simplify_statement(Gogo* gogo, Named_object* function,
if (this->is_simple(fntype))
return false;
+ Struct_type* struct_type = this->build_struct(fntype);
+
Expression* fn = ce->fn();
Interface_field_reference_expression* interface_method =
fn->interface_field_reference_expression();
@@ -2600,7 +2593,7 @@ Thunk_statement::simplify_statement(Gogo* gogo, Named_object* function,
std::string thunk_name = gogo->thunk_name();
// Build the thunk.
- this->build_thunk(gogo, thunk_name);
+ this->build_thunk(gogo, thunk_name, struct_type);
// Generate code to call the thunk.
@@ -2630,8 +2623,7 @@ Thunk_statement::simplify_statement(Gogo* gogo, Named_object* function,
// Build the struct.
Expression* constructor =
- Expression::make_struct_composite_literal(this->struct_type_, vals,
- location);
+ Expression::make_struct_composite_literal(struct_type, vals, location);
// Allocate the initialized struct on the heap.
constructor = Expression::make_heap_expression(constructor, location);
@@ -2745,15 +2737,6 @@ Thunk_statement::build_struct(Function_type* fntype)
fields->push_back(Struct_field(tid));
}
- // The predeclared recover function has no argument. However, we
- // add an argument when building recover thunks. Handle that here.
- if (ce->is_recover_call())
- {
- fields->push_back(Struct_field(Typed_identifier("can_recover",
- Type::lookup_bool_type(),
- location)));
- }
-
const Expression_list* args = ce->args();
if (args != NULL)
{
@@ -2781,7 +2764,8 @@ Thunk_statement::build_struct(Function_type* fntype)
// artificial, function.
void
-Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
+Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name,
+ Struct_type* struct_type)
{
Location location = this->location();
@@ -2807,7 +2791,7 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
// which is a pointer to the special structure we build.
const char* const parameter_name = "__go_thunk_parameter";
Typed_identifier_list* thunk_parameters = new Typed_identifier_list();
- Type* pointer_to_struct_type = Type::make_pointer_type(this->struct_type_);
+ Type* pointer_to_struct_type = Type::make_pointer_type(struct_type);
thunk_parameters->push_back(Typed_identifier(parameter_name,
pointer_to_struct_type,
location));
@@ -2914,7 +2898,7 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
}
Expression_list* call_params = new Expression_list();
- const Struct_field_list* fields = this->struct_type_->fields();
+ const Struct_field_list* fields = struct_type->fields();
Struct_field_list::const_iterator p = fields->begin();
for (unsigned int i = 0; i < next_index; ++i)
++p;
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index c08b493..3d1ee33 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -1411,7 +1411,7 @@ class Thunk_statement : public Statement
// Build the thunk.
void
- build_thunk(Gogo*, const std::string&);
+ build_thunk(Gogo*, const std::string&, Struct_type*);
// Set the name to use for thunk field N.
void
@@ -1420,9 +1420,6 @@ class Thunk_statement : public Statement
// The function call to be executed in a separate thread (go) or
// later (defer).
Expression* call_;
- // The type used for a struct to pass to a thunk, if this is not a
- // simple call.
- Struct_type* struct_type_;
};
// A go statement.
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 9f34801..7f471ea 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -5747,9 +5747,8 @@ Type::make_nil_type()
class Call_multiple_result_type : public Type
{
public:
- Call_multiple_result_type(Call_expression* call)
- : Type(TYPE_CALL_MULTIPLE_RESULT),
- call_(call)
+ Call_multiple_result_type()
+ : Type(TYPE_CALL_MULTIPLE_RESULT)
{ }
protected:
@@ -5782,18 +5781,14 @@ class Call_multiple_result_type : public Type
void
do_mangled_name(Gogo*, std::string*, bool*) const
{ go_assert(saw_errors()); }
-
- private:
- // The expression being called.
- Call_expression* call_;
};
// Make a call result type.
Type*
-Type::make_call_multiple_result_type(Call_expression* call)
+Type::make_call_multiple_result_type()
{
- return new Call_multiple_result_type(call);
+ return new Call_multiple_result_type;
}
// Class Struct_field.
diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h
index 49404bd..057fa01 100644
--- a/gcc/go/gofrontend/types.h
+++ b/gcc/go/gofrontend/types.h
@@ -535,7 +535,7 @@ class Type
make_nil_type();
static Type*
- make_call_multiple_result_type(Call_expression*);
+ make_call_multiple_result_type();
static Struct_type*
make_struct_type(Struct_field_list* fields, Location);
diff --git a/gcc/go/gofrontend/wb.cc b/gcc/go/gofrontend/wb.cc
index 104c5db..e039c66 100644
--- a/gcc/go/gofrontend/wb.cc
+++ b/gcc/go/gofrontend/wb.cc
@@ -191,9 +191,8 @@ Mark_address_taken::expression(Expression** pexpr)
class Check_escape : public Traverse
{
public:
- Check_escape(Gogo* gogo)
- : Traverse(traverse_expressions | traverse_variables),
- gogo_(gogo)
+ Check_escape()
+ : Traverse(traverse_expressions | traverse_variables)
{ }
int
@@ -201,9 +200,6 @@ class Check_escape : public Traverse
int
variable(Named_object*);
-
- private:
- Gogo* gogo_;
};
int
@@ -664,7 +660,7 @@ Gogo::add_write_barriers()
{
this->propagate_writebarrierrec();
- Check_escape chk(this);
+ Check_escape chk;
this->traverse(&chk);
}
diff --git a/gcc/go/gospec.cc b/gcc/go/gospec.cc
index 1e51407..040e84d 100644
--- a/gcc/go/gospec.cc
+++ b/gcc/go/gospec.cc
@@ -1,5 +1,5 @@
/* gospec.cc -- Specific flags and argument handling of the gcc Go front end.
- Copyright (C) 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2009-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/lang-specs.h b/gcc/go/lang-specs.h
index 0c6005a..4fce64b 100644
--- a/gcc/go/lang-specs.h
+++ b/gcc/go/lang-specs.h
@@ -1,5 +1,5 @@
/* lang-specs.h -- gcc driver specs for Go frontend.
- Copyright (C) 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2009-2023 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/go/lang.opt b/gcc/go/lang.opt
index e487319..4ca989c 100644
--- a/gcc/go/lang.opt
+++ b/gcc/go/lang.opt
@@ -1,6 +1,6 @@
; lang.opt -- Options for the gcc Go front end.
-; Copyright (C) 2009-2022 Free Software Foundation, Inc.
+; Copyright (C) 2009-2023 Free Software Foundation, Inc.
;
; This file is part of GCC.
;