aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-02-06 13:25:57 +0100
committerYvan Roux <yvan.roux@linaro.org>2017-02-06 13:25:57 +0100
commitaad858c02179d21167c43b18b31b3e8008dae1ed (patch)
tree78f5e2544647f1c1c644c0b5e999d8b97467acfb
parentb300ea83b9875ebfafb5f2d652d6eb7c3a57c497 (diff)
Merge branches/gcc-6-branch rev 245201.
Change-Id: Ibc46d8742ef080683f302f5623b4907e9622ac4c
-rw-r--r--ChangeLog8
-rw-r--r--config/ChangeLog5
-rw-r--r--config/ax_check_define.m492
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--fixincludes/ChangeLog13
-rw-r--r--fixincludes/fixincl.x188
-rw-r--r--fixincludes/inclhack.def67
-rw-r--r--fixincludes/tests/base/iso/stdio_iso.h13
-rw-r--r--fixincludes/tests/base/iso/stdlib_c99.h14
-rw-r--r--fixincludes/tests/base/stdio.h7
-rw-r--r--gcc/ChangeLog313
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/asan.c6
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-opts.c7
-rw-r--r--gcc/cgraphunit.c12
-rw-r--r--gcc/config/aarch64/aarch64-freebsd.h2
-rw-r--r--gcc/config/aarch64/aarch64-protos.h2
-rw-r--r--gcc/config/aarch64/aarch64.c77
-rw-r--r--gcc/config/aarch64/aarch64.h6
-rw-r--r--gcc/config/aarch64/aarch64.md19
-rw-r--r--gcc/config/aarch64/t-aarch64-freebsd2
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/config/i386/rtemself.h3
-rw-r--r--gcc/config/nds32/nds32.md8
-rw-r--r--gcc/config/nvptx/nvptx.c12
-rw-r--r--gcc/config/rs6000/altivec.h4
-rw-r--r--gcc/config/rs6000/rs6000-c.c13
-rw-r--r--gcc/config/rs6000/rs6000.c43
-rw-r--r--gcc/config/rs6000/rs6000.md26
-rw-r--r--gcc/config/tilegx/tilegx.c7
-rw-r--r--gcc/config/tilepro/tilepro.c7
-rw-r--r--gcc/cp/ChangeLog44
-rw-r--r--gcc/cp/constexpr.c1
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/cp/name-lookup.c7
-rw-r--r--gcc/cp/parser.c14
-rw-r--r--gcc/cp/tree.c8
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/doc/extend.texi2
-rw-r--r--gcc/doc/generic.texi2
-rw-r--r--gcc/doc/passes.texi2
-rw-r--r--gcc/dwarf2out.c56
-rw-r--r--gcc/expr.c87
-rw-r--r--gcc/fortran/ChangeLog32
-rw-r--r--gcc/fortran/openmp.c5
-rw-r--r--gcc/fortran/resolve.c11
-rw-r--r--gcc/fortran/trans-decl.c4
-rw-r--r--gcc/fortran/trans-expr.c7
-rw-r--r--gcc/fortran/trans-openmp.c20
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/function.h2
-rw-r--r--gcc/gcc.c19
-rw-r--r--gcc/go/gofrontend/expressions.cc59
-rw-r--r--gcc/go/gofrontend/expressions.h9
-rw-r--r--gcc/go/gofrontend/types.cc17
-rw-r--r--gcc/ipa-inline-transform.c7
-rw-r--r--gcc/ipa-polymorphic-call.c12
-rw-r--r--gcc/lra-remat.c12
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto-streamer.h2
-rw-r--r--gcc/lto/ChangeLog9
-rw-r--r--gcc/lto/lto-lang.c6
-rw-r--r--gcc/omp-low.c9
-rw-r--r--gcc/testsuite/ChangeLog209
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-16.c15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr71182.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr78341.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr78693.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for32.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for33.C14
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr71207.C42
-rw-r--r--gcc/testsuite/g++.dg/opt/call2.C34
-rw-r--r--gcc/testsuite/g++.dg/opt/call3.C33
-rw-r--r--gcc/testsuite/g++.dg/opt/declone3.C16
-rw-r--r--gcc/testsuite/g++.dg/pr77812.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr79034.C52
-rw-r--r--gcc/testsuite/g++.dg/vect/pr36648.cc9
-rw-r--r--gcc/testsuite/g++.old-deja/g++.abi/vtable2.C16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr78617.c25
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr79043.c21
-rw-r--r--gcc/testsuite/gcc.dg/goacc/loop-processing-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr50199_0.c17
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr69188_0.c8
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr69188_1.c10
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr78742.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/eh_return.c82
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c26
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79268.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c21
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-elemrev-1.c143
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-elemrev-2.c236
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-elemrev-3.c142
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-elemrev-4.c230
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/event_3.f0820
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/event_4.f0812
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_43.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_event_1.f0815
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr78866-1.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr78866-2.f909
-rw-r--r--gcc/testsuite/gnat.dg/array26.adb22
-rw-r--r--gcc/testsuite/gnat.dg/array26_pkg.adb8
-rw-r--r--gcc/testsuite/gnat.dg/array26_pkg.ads8
-rw-r--r--gcc/testsuite/gnat.dg/array27.adb22
-rw-r--r--gcc/testsuite/gnat.dg/array27_pkg.adb8
-rw-r--r--gcc/testsuite/gnat.dg/array27_pkg.ads8
-rw-r--r--gcc/testsuite/gnat.dg/array28.adb22
-rw-r--r--gcc/testsuite/gnat.dg/array28_pkg.adb8
-rw-r--r--gcc/testsuite/gnat.dg/array28_pkg.ads8
-rw-r--r--gcc/tree-call-cdce.c13
-rw-r--r--gcc/tree-data-ref.c2
-rw-r--r--gcc/tree-profile.c4
-rw-r--r--gcc/tree-ssa-sccvn.c1
-rw-r--r--gcc/tree-vrp.c6
-rw-r--r--gcc/tree.c9
-rw-r--r--gcc/ubsan.c2
-rw-r--r--libgcc/ChangeLog7
-rw-r--r--libgfortran/ChangeLog26
-rw-r--r--libgfortran/acinclude.m41
-rw-r--r--libgfortran/c99_protos.h2
-rw-r--r--libgfortran/caf/single.c9
-rwxr-xr-xlibgfortran/configure41
-rw-r--r--libgfortran/configure.ac3
-rw-r--r--libgfortran/configure.host6
-rw-r--r--libgfortran/intrinsics/c99_functions.c2
-rw-r--r--libgo/runtime/go-unsafe-pointer.c3
-rw-r--r--libgo/runtime/parfor.c2
-rw-r--r--libgo/runtime/runtime.h6
-rw-r--r--libgomp/ChangeLog13
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/crash-1.c27
-rw-r--r--libstdc++-v3/ChangeLog68
-rw-r--r--libstdc++-v3/doc/xml/faq.xml2
-rw-r--r--libstdc++-v3/doc/xml/manual/abi.xml6
-rw-r--r--libstdc++-v3/include/bits/basic_string.h23
-rw-r--r--libstdc++-v3/include/bits/list.tcc77
-rw-r--r--libstdc++-v3/include/bits/predefined_ops.h14
-rw-r--r--libstdc++-v3/include/experimental/array12
-rw-r--r--libstdc++-v3/include/std/tuple8
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/allocator_with_any.cc42
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc37
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc37
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/78389.cc74
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/search/78346.cc118
-rw-r--r--libstdc++-v3/testsuite/experimental/array/make_array.cc18
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_allocator.h2
148 files changed, 2881 insertions, 1094 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a887b043f2..02e1282205d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-01-09 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backport from mainline
+ 2016-10-10 Andreas Tobler <andreast@gcc.gnu.org>
+
+ * configure.ac: Add aarch64-*-freebsd*.
+ * configure: Regenerate.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/config/ChangeLog b/config/ChangeLog
index a446126d3d4..e2360c80ad8 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-24 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/78478
+ * ax_check_define.m4: New file.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/config/ax_check_define.m4 b/config/ax_check_define.m4
new file mode 100644
index 00000000000..4bc694861c0
--- /dev/null
+++ b/config/ax_check_define.m4
@@ -0,0 +1,92 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_check_define.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
+# AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
+#
+# DESCRIPTION
+#
+# Complements AC_CHECK_FUNC but it does not check for a function but for a
+# define to exist. Consider a usage like:
+#
+# AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500")
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 8
+
+AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
+AC_DEFUN([AC_CHECK_DEFINE],[
+AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl
+AC_CACHE_CHECK([for $1 defined], ac_var,
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ #ifdef $1
+ int ok;
+ #else
+ choke me
+ #endif
+]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
+AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl
+AS_VAR_POPDEF([ac_var])dnl
+])
+
+AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE])
+AC_DEFUN([AX_CHECK_DEFINE],[
+AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl
+AC_CACHE_CHECK([for $2 defined in $1], ac_var,
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
+ #ifdef $2
+ int ok;
+ #else
+ choke me
+ #endif
+]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
+AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl
+AS_VAR_POPDEF([ac_var])dnl
+])
+
+AC_DEFUN([AX_CHECK_FUNC],
+[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl
+AC_CACHE_CHECK([for $2], ac_var,
+dnl AC_LANG_FUNC_LINK_TRY
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([$1
+ #undef $2
+ char $2 ();],[
+ char (*f) () = $2;
+ return f != $2; ])],
+ [AS_VAR_SET(ac_var, yes)],
+ [AS_VAR_SET(ac_var, no)])])
+AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
+AS_VAR_POPDEF([ac_var])dnl
+])# AC_CHECK_FUNC
diff --git a/configure b/configure
index 89095e3e949..b29a7247b96 100755
--- a/configure
+++ b/configure
@@ -3484,7 +3484,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ${libgcj}"
;;
aarch64*-*-freebsd*)
- noconfigdirs="$noconfigdirs target-libffi"
+ noconfigdirs="$noconfigdirs ${libgcj}"
;;
alpha*-*-*vms*)
noconfigdirs="$noconfigdirs ${libgcj}"
diff --git a/configure.ac b/configure.ac
index e4117360d8a..f23463a2852 100644
--- a/configure.ac
+++ b/configure.ac
@@ -820,7 +820,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ${libgcj}"
;;
aarch64*-*-freebsd*)
- noconfigdirs="$noconfigdirs target-libffi"
+ noconfigdirs="$noconfigdirs ${libgcj}"
;;
alpha*-*-*vms*)
noconfigdirs="$noconfigdirs ${libgcj}"
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 73d229c16c4..15e3c3b811e 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,16 @@
+2017-01-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-01-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR libstdc++/78979
+ * inclhack.def (solaris_gets_c11, solaris_gets_cxx14)
+ (solaris_std_gets_cxx14, solaris_stdlib_noreturn): New fixes.
+ * fixincl.x: Regenerate.
+ * tests/base/iso/stdio_iso.h [SOLARIS_GETS_C11_CHECK,
+ SOLARIS_GETS_CXX14_CHECK, SOLARIS_STD_GETS_CXX14_CHECK,
+ SOLARIS_STDLIB_NORETURN_CHECK]: New tests.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 0e76b094e6b..15467f2a3d2 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed November 18, 2016 at 12:35:01 PM by AutoGen 5.16.2
+ * It has been AutoGen-ed January 5, 2017 at 06:03:22 PM by AutoGen 5.16.2
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Nov 18 12:35:01 2016
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan 5 18:03:22 CET 2017
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 236 fixup descriptions.
+ * This file contains 240 fixup descriptions.
*
* See README for more information.
*
@@ -6824,6 +6824,84 @@ static const char* apzSolaris_Getc_Strict_StdcPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Gets_C11 fix
+ */
+tSCC zSolaris_Gets_C11Name[] =
+ "solaris_gets_c11";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Gets_C11List[] =
+ "iso/stdio_iso.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Gets_C11Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Gets_C11Select0[] =
+ "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
+#define SOLARIS_GETS_C11_TEST_CT 1
+static tTestDesc aSolaris_Gets_C11Tests[] = {
+ { TT_EGREP, zSolaris_Gets_C11Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Gets_C11
+ */
+static const char* apzSolaris_Gets_C11Patch[] = {
+ "format",
+ "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n\
+%1 __attribute__((__deprecated__));\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Solaris_Gets_Cxx14 fix
+ */
+tSCC zSolaris_Gets_Cxx14Name[] =
+ "solaris_gets_cxx14";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Gets_Cxx14List[] =
+ "iso/stdio_iso.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Gets_Cxx14Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Gets_Cxx14Select0[] =
+ "(#if __STDC_VERSION__ < 201112L)\n\
+(extern char\t\\*gets\\(char \\*\\) __ATTR_DEPRECATED;)";
+
+#define SOLARIS_GETS_CXX14_TEST_CT 1
+static tTestDesc aSolaris_Gets_Cxx14Tests[] = {
+ { TT_EGREP, zSolaris_Gets_Cxx14Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Gets_Cxx14
+ */
+static const char* apzSolaris_Gets_Cxx14Patch[] = {
+ "format",
+ "%1 && __cplusplus < 201402L\n\
+%2",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Int_Const fix
*/
tSCC zSolaris_Int_ConstName[] =
@@ -7576,6 +7654,45 @@ using std::__flsbuf;\n\
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Std_Gets_Cxx14 fix
+ */
+tSCC zSolaris_Std_Gets_Cxx14Name[] =
+ "solaris_std_gets_cxx14";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Std_Gets_Cxx14List[] =
+ "stdio.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Std_Gets_Cxx14Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Std_Gets_Cxx14Select0[] =
+ "using std::gets;";
+
+#define SOLARIS_STD_GETS_CXX14_TEST_CT 1
+static tTestDesc aSolaris_Std_Gets_Cxx14Tests[] = {
+ { TT_EGREP, zSolaris_Std_Gets_Cxx14Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Std_Gets_Cxx14
+ */
+static const char* apzSolaris_Std_Gets_Cxx14Patch[] = {
+ "format",
+ "#if __cplusplus < 201402L\n\
+%0\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Stdio_Tag fix
*/
tSCC zSolaris_Stdio_TagName[] =
@@ -7617,6 +7734,43 @@ static const char* apzSolaris_Stdio_TagPatch[] = { sed_cmd_z,
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Stdlib_Noreturn fix
+ */
+tSCC zSolaris_Stdlib_NoreturnName[] =
+ "solaris_stdlib_noreturn";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Stdlib_NoreturnList[] =
+ "iso/stdlib_c99.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Stdlib_NoreturnMachs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Stdlib_NoreturnSelect0[] =
+ "(extern) _Noreturn (void quick_exit\\(int\\));";
+
+#define SOLARIS_STDLIB_NORETURN_TEST_CT 1
+static tTestDesc aSolaris_Stdlib_NoreturnTests[] = {
+ { TT_EGREP, zSolaris_Stdlib_NoreturnSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Stdlib_Noreturn
+ */
+static const char* apzSolaris_Stdlib_NoreturnPatch[] = {
+ "format",
+ "%1 %2 __attribute__((__noreturn__));",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Statsswtch fix
*/
tSCC zStatsswtchName[] =
@@ -9664,9 +9818,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 272
+#define REGEX_COUNT 276
#define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT 236
+#define FIX_COUNT 240
/*
* Enumerate the fixes
@@ -9837,6 +9991,8 @@ typedef enum {
SOLARIS_COMPLEX_CXX_FIXIDX,
SOLARIS_CXX_LINKAGE_FIXIDX,
SOLARIS_GETC_STRICT_STDC_FIXIDX,
+ SOLARIS_GETS_C11_FIXIDX,
+ SOLARIS_GETS_CXX14_FIXIDX,
SOLARIS_INT_CONST_FIXIDX,
SOLARIS_INT_LIMITS_1_FIXIDX,
SOLARIS_INT_LIMITS_2_FIXIDX,
@@ -9855,7 +10011,9 @@ typedef enum {
SOLARIS_POW_INT_OVERLOAD_FIXIDX,
SOLARIS_RWLOCK_INIT_1_FIXIDX,
SOLARIS_STD___FILBUF_FIXIDX,
+ SOLARIS_STD_GETS_CXX14_FIXIDX,
SOLARIS_STDIO_TAG_FIXIDX,
+ SOLARIS_STDLIB_NORETURN_FIXIDX,
STATSSWTCH_FIXIDX,
STDIO_STDARG_H_FIXIDX,
STDIO_VA_LIST_FIXIDX,
@@ -10736,6 +10894,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SOLARIS_GETC_STRICT_STDC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSolaris_Getc_Strict_StdcTests, apzSolaris_Getc_Strict_StdcPatch, 0 },
+ { zSolaris_Gets_C11Name, zSolaris_Gets_C11List,
+ apzSolaris_Gets_C11Machs,
+ SOLARIS_GETS_C11_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Gets_C11Tests, apzSolaris_Gets_C11Patch, 0 },
+
+ { zSolaris_Gets_Cxx14Name, zSolaris_Gets_Cxx14List,
+ apzSolaris_Gets_Cxx14Machs,
+ SOLARIS_GETS_CXX14_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Gets_Cxx14Tests, apzSolaris_Gets_Cxx14Patch, 0 },
+
{ zSolaris_Int_ConstName, zSolaris_Int_ConstList,
apzSolaris_Int_ConstMachs,
SOLARIS_INT_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -10826,11 +10994,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SOLARIS_STD___FILBUF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSolaris_Std___FilbufTests, apzSolaris_Std___FilbufPatch, 0 },
+ { zSolaris_Std_Gets_Cxx14Name, zSolaris_Std_Gets_Cxx14List,
+ apzSolaris_Std_Gets_Cxx14Machs,
+ SOLARIS_STD_GETS_CXX14_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Std_Gets_Cxx14Tests, apzSolaris_Std_Gets_Cxx14Patch, 0 },
+
{ zSolaris_Stdio_TagName, zSolaris_Stdio_TagList,
apzSolaris_Stdio_TagMachs,
SOLARIS_STDIO_TAG_TEST_CT, FD_MACH_ONLY,
aSolaris_Stdio_TagTests, apzSolaris_Stdio_TagPatch, 0 },
+ { zSolaris_Stdlib_NoreturnName, zSolaris_Stdlib_NoreturnList,
+ apzSolaris_Stdlib_NoreturnMachs,
+ SOLARIS_STDLIB_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Stdlib_NoreturnTests, apzSolaris_Stdlib_NoreturnPatch, 0 },
+
{ zStatsswtchName, zStatsswtchList,
apzStatsswtchMachs,
STATSSWTCH_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 2ba12f09cbc..ef23e489e39 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -3482,6 +3482,43 @@ fix = {
};
/*
+ * Solaris <iso/stdio_iso.h> should deprecate gets before C11.
+ */
+fix = {
+ hackname = solaris_gets_c11;
+ mach = "*-*-solaris2*";
+ files = "iso/stdio_iso.h";
+ select = "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
+ c_fix = format;
+ c_fix_arg = "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
+ "%1 __attribute__((__deprecated__));\n"
+ "#endif";
+
+ test_text = "extern char *gets(char *);";
+};
+
+/*
+ * Solaris <iso/stdio_iso.h> shouldn't declare gets for C++14.
+ */
+fix = {
+ hackname = solaris_gets_cxx14;
+ mach = "*-*-solaris2*";
+ files = "iso/stdio_iso.h";
+ select = <<- _EOSelect_
+(#if __STDC_VERSION__ < 201112L)
+(extern char \*gets\(char \*\) __ATTR_DEPRECATED;)
+_EOSelect_;
+ c_fix = format;
+ c_fix_arg = "%1 && __cplusplus < 201402L\n%2";
+
+ test_text = <<- _EOText_
+#if __STDC_VERSION__ < 201112L
+extern char *gets(char *) __ATTR_DEPRECATED;
+_EOText_;
+};
+
+/*
* Sun Solaris 2 has a version of sys/int_const.h that defines
* UINT8_C and UINT16_C to unsigned constants.
*/
@@ -3871,6 +3908,21 @@ fix = {
};
/*
+ * Solaris <stdio.h> shouldn't use std::gets for C++14.
+ */
+fix = {
+ hackname = solaris_std_gets_cxx14;
+ mach = "*-*-solaris2*";
+ files = "stdio.h";
+ select = "using std::gets;";
+
+ c_fix = format;
+ c_fix_arg = "#if __cplusplus < 201402L\n%0\n#endif";
+
+ test_text = "using std::gets;";
+};
+
+/*
* Sun Solaris 8 has what appears to be some gross workaround for
* some old version of their c++ compiler. G++ doesn't want it
* either, but doesn't want to be tied to SunPRO version numbers.
@@ -3889,6 +3941,21 @@ fix = {
};
/*
+ * Solaris <stdlib.h> shouldn't use _Noreturn, breaks with C++.
+ */
+fix = {
+ hackname = solaris_stdlib_noreturn;
+ mach = "*-*-solaris2*";
+ files = "iso/stdlib_c99.h";
+ select = "(extern) _Noreturn (void quick_exit\\(int\\));";
+
+ c_fix = format;
+ c_fix_arg = "%1 %2 __attribute__((__noreturn__));";
+
+ test_text = "extern _Noreturn void quick_exit(int);";
+};
+
+/*
* a missing semi-colon at the end of the statsswtch structure definition.
*/
fix = {
diff --git a/fixincludes/tests/base/iso/stdio_iso.h b/fixincludes/tests/base/iso/stdio_iso.h
index d476752f092..e2d70b4c62e 100644
--- a/fixincludes/tests/base/iso/stdio_iso.h
+++ b/fixincludes/tests/base/iso/stdio_iso.h
@@ -12,3 +12,16 @@
#if defined( SOLARIS_GETC_STRICT_STDC_CHECK )
#if !defined(_REENTRANT) && !defined(_LP64) && (!defined(_STRICT_STDC) || (__cplusplus >= 199711L))
#endif /* SOLARIS_GETC_STRICT_STDC_CHECK */
+
+
+#if defined( SOLARIS_GETS_C11_CHECK )
+#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
+extern char *gets(char *) __attribute__((__deprecated__));
+#endif
+#endif /* SOLARIS_GETS_C11_CHECK */
+
+
+#if defined( SOLARIS_GETS_CXX14_CHECK )
+#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
+extern char *gets(char *) __ATTR_DEPRECATED;
+#endif /* SOLARIS_GETS_CXX14_CHECK */
diff --git a/fixincludes/tests/base/iso/stdlib_c99.h b/fixincludes/tests/base/iso/stdlib_c99.h
new file mode 100644
index 00000000000..0c500dea086
--- /dev/null
+++ b/fixincludes/tests/base/iso/stdlib_c99.h
@@ -0,0 +1,14 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/iso/stdlib_c99.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( SOLARIS_STDLIB_NORETURN_CHECK )
+extern void quick_exit(int) __attribute__((__noreturn__));
+#endif /* SOLARIS_STDLIB_NORETURN_CHECK */
diff --git a/fixincludes/tests/base/stdio.h b/fixincludes/tests/base/stdio.h
index 4ca4fafeb95..491c75da6e5 100644
--- a/fixincludes/tests/base/stdio.h
+++ b/fixincludes/tests/base/stdio.h
@@ -90,6 +90,13 @@ using std::__flsbuf;
#endif /* SOLARIS_STD___FILBUF_CHECK */
+#if defined( SOLARIS_STD_GETS_CXX14_CHECK )
+#if __cplusplus < 201402L
+using std::gets;
+#endif
+#endif /* SOLARIS_STD_GETS_CXX14_CHECK */
+
+
#if defined( STDIO_STDARG_H_CHECK )
#endif /* STDIO_STDARG_H_CHECK */
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1a4859e8023..ac448c35c0f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,316 @@
+2017-02-03 Carl Love <cel@us.ibm.com>
+
+ Backport of two commits from mainline, r244943 and r244904,
+ dated 017-01-26 and 2017-01-25 respectively
+
+ * config/rs6000/rs6000-c (altivec_overloaded_builtins): Fix order
+ of entries for ALTIVEC_BUILTIN_VEC_PACKS. Remove bogus entries
+ for P8V_BUILTIN_VEC_VGBBD.
+
+2017-02-03 Walter Lee <walt@tilera.com>
+
+ Backport from mainline
+ 2017-02-03 Walter Lee <walt@tilera.com>
+
+ PR target/78862
+ * config/tilegx/tilegx.md (tilegx_expand_prologue): Add blockage
+ after initial stackframe link reg save.
+ * config/tilepro/tilepro.md (tilepro_expand_prologue): Likewise.
+
+2017-02-03 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR lto/79061
+ * asan.c (asan_add_global): Force has_dynamic_init to zero in LTO mode.
+
+2017-01-31 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79268
+ * config/rs6000/altivec.h (vec_xl): Revise #define.
+ (vec_xst): Likewise.
+
+2017-01-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ Backport from mainline
+ 2017-01-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (store_field): In the bitfield case, fetch the return value
+ from the registers before applying a single big-endian adjustment.
+ Always do a final load for a BLKmode value not larger than a word.
+
+ 2017-01-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (store_field): In the bitfield case, if the value comes from
+ a function call and is of an aggregate type returned in registers, do
+ not modify the field mode; extract the value in all cases if the mode
+ is BLKmode and the size is not larger than a word.
+
+2017-01-26 Richard Biener <rguenther@suse.de>
+
+ * tree-vrp.c (vrp_visit_assignment_or_call): Use set_defs_to_varying.
+
+ Backport from mainline
+ 2016-01-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/79034
+ * tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
+ Propagate out degenerate PHIs in the joiner.
+
+ 2016-12-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78742
+ * tree.c (cst_and_fits_in_hwi): Look if the actual value fits.
+ * tree-object-size.c (compute_builtin_object_size): Use
+ tree_fits_shwi_p.
+ * tree-data-ref.c (initialize_matrix_A): Remove excess assert.
+
+2017-01-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-09-03 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * ubsan.c (ubsan_use_new_style_p): Fix check for empty string.
+
+2017-01-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/77439
+ * config/arm/arm.c (arm_function_ok_for_sibcall): Add back restriction
+ for long calls with APCS frame and VFP.
+
+2017-01-24 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/78478
+ Revert:
+ 2013-11-05 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/rtemself.h (LONG_DOUBLE_TYPE_SIZE): New define.
+
+2017-01-23 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-20 Martin Liska <mliska@suse.cz>
+
+ PR lto/69188
+ * tree-profile.c (init_ic_make_global_vars): Do not call
+ finalize_decl.
+ (gimple_init_gcov_profiler): Likewise.
+
+2017-01-21 Gerald Pfeifer <gerald@pfeifer.com>
+
+ Backport from mainline
+ 2016-12-29 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * doc/extend.texi (Cilk Plus Builtins): cilkplus.org now uses
+ https by default.
+ * doc/passes.texi (Cilk Plus Transformation): Ditto.
+ * doc/generic.texi (Statements for C++): Ditto, and use @uref.
+
+2017-01-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rtx_is_swappable_p): Change
+ UNSPEC_VSX__XXSPLTD to require special splat handling.
+
+2017-01-20 Wilco Dijkstra <wdijkstr@arm.com>
+
+ Backport from mainline
+ PR target/77455
+ * config/aarch64/aarch64.md (eh_return): Remove pattern and splitter.
+ * config/aarch64/aarch64.h (AARCH64_EH_STACKADJ_REGNUM): Remove.
+ (EH_RETURN_HANDLER_RTX): New define.
+ * config/aarch64/aarch64.c (aarch64_frame_pointer_required):
+ Force frame pointer in EH return functions.
+ (aarch64_expand_epilogue): Add barrier for eh_return.
+ (aarch64_final_eh_return_addr): Remove.
+ (aarch64_eh_return_handler_rtx): New function.
+ * config/aarch64/aarch64-protos.h (aarch64_final_eh_return_addr):
+ Remove.
+ (aarch64_eh_return_handler_rtx): New prototype.
+
+2017-01-20 Richard Earnshaw <rearnsha@arm.com>
+
+ Backported from mainline
+ 2017-01-19 Richard Earnshaw <rearnsha@arm.com>
+
+ PR rtl-optimization/79121
+ * expr.c (expand_expr_real_2, case LSHIFT_EXPR): Look at the signedness
+ of the inner type when shifting an extended value.
+
+2017-01-20 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-13 Martin Liska <mliska@suse.cz>
+
+ PR ipa/79043
+ * function.c (set_cfun): Add new argument force.
+ * function.h (set_cfun): Likewise.
+ * ipa-inline-transform.c (inline_call): Use the function when
+ strict alising from is dropped for function we inline to.
+
+2017-01-20 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-17 Martin Liska <mliska@suse.cz>
+
+ PR ipa/71207
+ * ipa-polymorphic-call.c (contains_type_p): Fix wrong
+ assumption and add comment.
+
+2017-01-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/72488
+ * tree-ssa-sccvn.c (run_scc_vn): When we abort the VN make
+ sure to restore SSA info.
+
+2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/78839
+ * dwarf2out.c (field_byte_offset): Restore the
+ PCC_BITFIELD_TYPE_MATTERS behavior for INTEGER_CST DECL_FIELD_OFFSET
+ and DECL_FIELD_BIT_OFFSET. Use fold_build2 instead of build2 + fold.
+ (analyze_variants_discr, gen_variant_part): Use fold_build2 instead
+ of build2 + fold.
+
+2017-01-17 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR rtl-optimization/78617
+ * lra-remat.c (do_remat): Initialize live_hard_regs from live in
+ registers, also setting hard registers mapped to pseudo registers.
+
+2017-01-13 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from mainline r244320.
+ 2017-01-11 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/78253
+ * config/arm/arm.c (legitimize_pic_address): Handle reference to
+ weak symbol.
+ (arm_assemble_integer): Likewise.
+
+2017-01-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79044
+ * config/rs6000/rs6000.c (insn_is_swappable_p): Mark
+ element-reversing loads and stores as not swappable.
+
+2017-01-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (memory_address_length): Increase len
+ only when rip_relative_addr_p returns false.
+
+2017-01-11 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ Backport from mainline
+ 2017-01-11 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR lto/79042
+ * lto-cgraph.c (lto_output_varpool_node): Pack dynamically_initialized
+ bit.
+ (input_varpool_node): Unpack dynamically_initialized bit.
+ * lto-streamer.h (LTO_minor_version): Bump version.
+
+2017-01-10 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2016-12-30 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/78900
+ * config/rs6000/rs6000.c (rs6000_split_signbit): Change some
+ assertions. Add support for doing the signbit if the IEEE 128-bit
+ floating point value is in a GPR.
+ * config/rs6000/rs6000.md (Fsignbit): Delete.
+ (signbit<mode>2_dm): Delete using <Fsignbit> and just use "wa".
+ Update the length attribute if the value is in a GPR.
+ (signbit<mode>2_dm_<su>ext): Add combiner pattern to eliminate
+ the sign or zero extension instruction, since the value is always
+ 0/1.
+ (signbit<mode>2_dm2): Delete using <Fsignbit>.
+
+2017-01-10 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-09 Martin Liska <mliska@suse.cz>
+
+ PR pch/78970
+ * gcc.c (driver_handle_option): Handle OPT_E and set
+ have_E.
+ (lookup_compiler): Do not show error message with have_E.
+
+2017-01-10 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-05 Martin Liska <mliska@suse.cz>
+
+ PR pch/78970
+ * gcc.c (lookup_compiler): Reject '-' filename for a precompiled
+ header.
+
+2017-01-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR tree-optimization/78024
+ * omp-low.c (oacc_loop_discovery): Call clear_bb_flags.
+
+ Backport trunk r239086:
+ 2016-08-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/nvptx/nvptx.c (nvptx_declare_function_name): Round frame
+ size to DImode boundary.
+ (nvptx_propagate): Likewise.
+
+2017-01-10 Chung-Ju Wu <jasonwucj@gmail.com>
+
+ Backport from mainline
+ 2016-04-28 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/70668
+ * config/nds32/nds32.md (casesi): Don't access the operands array
+ out of bounds.
+
+2017-01-09 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backport from mainline
+ 2016-10-10 Andreas Tobler <andreast@gcc.gnu.org>
+
+ * config.gcc: Add aarch64-*-freebsd* support.
+ * config.host: Likewise.
+ * config/aarch64/aarch64-freebsd.h: New file.
+ * config/aarch64/t-aarch64-freebsd: Ditto.
+
+2017-01-09 Bill Seurer <seurer@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2016-12-21 Bill Seurer <seurer@linux.vnet.ibm.com>
+
+ PR sanitizer/65479
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Add
+ -fasynchronous-unwind-tables option when -fsanitize=address is
+ specified.
+
+2017-01-09 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backport from mainline
+ 2016-09-19 Richard Biener <rguenther@suse.de>
+
+ * dwarf2out.c (dwarf2out_late_global_decl): When being during the
+ early debug phase do not add locations but only const value
+ attributes.
+
+ Backport from mainline
+ 2016-10-20 Richard Biener <rguenther@suse.de>
+
+ * cgraphunit.c (analyze_functions): Set node->definition to
+ false to signal symbol removal to debug_hooks->late_global_decl.
+
2017-01-09 Andre Vieira <andre.simoesdiasvieira@arm.com>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 197d842523f..ee1e9c32829 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20170109
+20170206
diff --git a/gcc/asan.c b/gcc/asan.c
index 398a50859d7..0f55dc03e9c 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2275,7 +2275,11 @@ asan_add_global (tree decl, tree type, vec<constructor_elt, va_gc> *v)
CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE,
fold_convert (const_ptr_type_node, module_name_cst));
varpool_node *vnode = varpool_node::get (decl);
- int has_dynamic_init = vnode ? vnode->dynamically_initialized : 0;
+ int has_dynamic_init = 0;
+ /* FIXME: Enable initialization order fiasco detection in LTO mode once
+ proper fix for PR 79061 will be applied. */
+ if (!in_lto_p)
+ has_dynamic_init = vnode ? vnode->dynamically_initialized : 0;
CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE,
build_int_cst (uptr, has_dynamic_init));
tree locptr = NULL_TREE;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index fb1e99da559..bdd4e9e273c 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-10 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-05 Martin Liska <mliska@suse.cz>
+
+ PR pch/78970
+ * c-opts.c (c_common_post_options): Reject '-' filename for a precompiled
+ header.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 0d6776ce63a..434f35a1cb6 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -742,7 +742,12 @@ c_common_post_options (const char **pfilename)
in_fnames[0] = "";
}
else if (strcmp (in_fnames[0], "-") == 0)
- in_fnames[0] = "";
+ {
+ if (pch_file)
+ error ("cannot use %<-%> as input filename for a precompiled header");
+
+ in_fnames[0] = "";
+ }
if (out_fname == NULL || !strcmp (out_fname, "-"))
out_fname = "";
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4351ae49952..71e88be753a 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1193,8 +1193,16 @@ analyze_functions (bool first_time)
at looking at optimized away DECLs, since
late_global_decl will subsequently be called from the
contents of the now pruned symbol table. */
- if (!decl_function_context (node->decl))
- (*debug_hooks->late_global_decl) (node->decl);
+ if (VAR_P (node->decl)
+ && !decl_function_context (node->decl))
+ {
+ /* We are reclaiming totally unreachable code and variables
+ so they effectively appear as readonly. Show that to
+ the debug machinery. */
+ TREE_READONLY (node->decl) = 1;
+ node->definition = false;
+ (*debug_hooks->late_global_decl) (node->decl);
+ }
node->remove ();
continue;
diff --git a/gcc/config/aarch64/aarch64-freebsd.h b/gcc/config/aarch64/aarch64-freebsd.h
index 6b2a908b64e..b9c1bfdc95f 100644
--- a/gcc/config/aarch64/aarch64-freebsd.h
+++ b/gcc/config/aarch64/aarch64-freebsd.h
@@ -1,5 +1,5 @@
/* Definitions for AArch64 running FreeBSD
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 9de726cd9a3..f27013889b8 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -358,7 +358,7 @@ int aarch64_hard_regno_mode_ok (unsigned, machine_mode);
int aarch64_hard_regno_nregs (unsigned, machine_mode);
int aarch64_uxt_size (int, HOST_WIDE_INT);
int aarch64_vec_fpconst_pow_of_2 (rtx);
-rtx aarch64_final_eh_return_addr (void);
+rtx aarch64_eh_return_handler_rtx (void);
rtx aarch64_mask_from_zextract_ops (rtx, rtx);
const char *aarch64_output_move_struct (rtx *operands);
rtx aarch64_return_addr (int, rtx);
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 354207dd790..f0970f29c41 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2755,6 +2755,10 @@ aarch64_frame_pointer_required (void)
&& (!crtl->is_leaf || df_regs_ever_live_p (LR_REGNUM)))
return true;
+ /* Force a frame pointer for EH returns so the return address is at FP+8. */
+ if (crtl->calls_eh_return)
+ return true;
+
return false;
}
@@ -3366,7 +3370,8 @@ aarch64_expand_epilogue (bool for_sibcall)
+ cfun->machine->frame.saved_varargs_size) != 0;
/* Emit a barrier to prevent loads from a deallocated stack. */
- if (final_adjust > crtl->outgoing_args_size || cfun->calls_alloca)
+ if (final_adjust > crtl->outgoing_args_size || cfun->calls_alloca
+ || crtl->calls_eh_return)
{
emit_insn (gen_stack_tie (stack_pointer_rtx, stack_pointer_rtx));
need_barrier_p = false;
@@ -3434,52 +3439,40 @@ aarch64_expand_epilogue (bool for_sibcall)
emit_jump_insn (ret_rtx);
}
-/* Return the place to copy the exception unwinding return address to.
- This will probably be a stack slot, but could (in theory be the
- return register). */
-rtx
-aarch64_final_eh_return_addr (void)
-{
- HOST_WIDE_INT fp_offset;
-
- aarch64_layout_frame ();
+/* Implement EH_RETURN_HANDLER_RTX. EH returns need to either return
+ normally or return to a previous frame after unwinding.
- fp_offset = cfun->machine->frame.frame_size
- - cfun->machine->frame.hard_fp_offset;
+ An EH return uses a single shared return sequence. The epilogue is
+ exactly like a normal epilogue except that it has an extra input
+ register (EH_RETURN_STACKADJ_RTX) which contains the stack adjustment
+ that must be applied after the frame has been destroyed. An extra label
+ is inserted before the epilogue which initializes this register to zero,
+ and this is the entry point for a normal return.
- if (cfun->machine->frame.reg_offset[LR_REGNUM] < 0)
- return gen_rtx_REG (DImode, LR_REGNUM);
+ An actual EH return updates the return address, initializes the stack
+ adjustment and jumps directly into the epilogue (bypassing the zeroing
+ of the adjustment). Since the return address is typically saved on the
+ stack when a function makes a call, the saved LR must be updated outside
+ the epilogue.
- /* DSE and CSELIB do not detect an alias between sp+k1 and fp+k2. This can
- result in a store to save LR introduced by builtin_eh_return () being
- incorrectly deleted because the alias is not detected.
- So in the calculation of the address to copy the exception unwinding
- return address to, we note 2 cases.
- If FP is needed and the fp_offset is 0, it means that SP = FP and hence
- we return a SP-relative location since all the addresses are SP-relative
- in this case. This prevents the store from being optimized away.
- If the fp_offset is not 0, then the addresses will be FP-relative and
- therefore we return a FP-relative location. */
+ This poses problems as the store is generated well before the epilogue,
+ so the offset of LR is not known yet. Also optimizations will remove the
+ store as it appears dead, even after the epilogue is generated (as the
+ base or offset for loading LR is different in many cases).
- if (frame_pointer_needed)
- {
- if (fp_offset)
- return gen_frame_mem (DImode,
- plus_constant (Pmode, hard_frame_pointer_rtx, UNITS_PER_WORD));
- else
- return gen_frame_mem (DImode,
- plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD));
- }
-
- /* If FP is not needed, we calculate the location of LR, which would be
- at the top of the saved registers block. */
+ To avoid these problems this implementation forces the frame pointer
+ in eh_return functions so that the location of LR is fixed and known early.
+ It also marks the store volatile, so no optimization is permitted to
+ remove the store. */
+rtx
+aarch64_eh_return_handler_rtx (void)
+{
+ rtx tmp = gen_frame_mem (Pmode,
+ plus_constant (Pmode, hard_frame_pointer_rtx, UNITS_PER_WORD));
- return gen_frame_mem (DImode,
- plus_constant (Pmode,
- stack_pointer_rtx,
- fp_offset
- + cfun->machine->frame.saved_regs_size
- - 2 * UNITS_PER_WORD));
+ /* Mark the store volatile, so no optimization is permitted to remove it. */
+ MEM_VOLATILE_P (tmp) = true;
+ return tmp;
}
/* Output code to add DELTA to the first argument, and then jump
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 19caf9f2979..c5a952cab21 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -400,9 +400,9 @@ extern unsigned aarch64_architecture_version;
#define ASM_DECLARE_FUNCTION_NAME(STR, NAME, DECL) \
aarch64_declare_function_name (STR, NAME, DECL)
-/* The register that holds the return address in exception handlers. */
-#define AARCH64_EH_STACKADJ_REGNUM (R0_REGNUM + 4)
-#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, AARCH64_EH_STACKADJ_REGNUM)
+/* For EH returns X4 contains the stack adjustment. */
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, R4_REGNUM)
+#define EH_RETURN_HANDLER_RTX aarch64_eh_return_handler_rtx ()
/* Don't use __builtin_setjmp until we've defined it. */
#undef DONT_USE_BUILTIN_SETJMP
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index d5403a3cef8..6fc797920e6 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -591,25 +591,6 @@
[(set_attr "type" "branch")]
)
-(define_insn "eh_return"
- [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
- UNSPECV_EH_RETURN)]
- ""
- "#"
- [(set_attr "type" "branch")]
-
-)
-
-(define_split
- [(unspec_volatile [(match_operand:DI 0 "register_operand" "")]
- UNSPECV_EH_RETURN)]
- "reload_completed"
- [(set (match_dup 1) (match_dup 0))]
- {
- operands[1] = aarch64_final_eh_return_addr ();
- }
-)
-
(define_insn "*cb<optab><mode>1"
[(set (pc) (if_then_else (EQL (match_operand:GPI 0 "register_operand" "r")
(const_int 0))
diff --git a/gcc/config/aarch64/t-aarch64-freebsd b/gcc/config/aarch64/t-aarch64-freebsd
index 84b4a750beb..9740118a531 100644
--- a/gcc/config/aarch64/t-aarch64-freebsd
+++ b/gcc/config/aarch64/t-aarch64-freebsd
@@ -1,5 +1,5 @@
# Machine description for AArch64 architecture.
-# Copyright (C) 2016 Free Software Foundation, Inc.
+# Copyright (C) 2016-2017 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a8e6da7bacd..6cb5decdadd 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -27722,7 +27722,7 @@ memory_address_length (rtx addr, bool lea)
else if (disp && !base && !index)
{
len += 4;
- if (rip_relative_addr_p (&parts))
+ if (!rip_relative_addr_p (&parts))
len++;
}
else
diff --git a/gcc/config/i386/rtemself.h b/gcc/config/i386/rtemself.h
index 8b7dc5e5d17..be711c80197 100644
--- a/gcc/config/i386/rtemself.h
+++ b/gcc/config/i386/rtemself.h
@@ -29,7 +29,4 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_80387 ? 80 : 64)
-
#define IX86_NO_LIBGCC_TFMODE
diff --git a/gcc/config/nds32/nds32.md b/gcc/config/nds32/nds32.md
index 5cdd8b24aae..494a78d91e5 100644
--- a/gcc/config/nds32/nds32.md
+++ b/gcc/config/nds32/nds32.md
@@ -2288,11 +2288,9 @@ create_template:
emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2],
operands[4]));
- operands[5] = gen_reg_rtx (SImode);
- /* Step C, D, E, and F, using another temporary register operands[5]. */
- emit_jump_insn (gen_casesi_internal (operands[0],
- operands[3],
- operands[5]));
+ /* Step C, D, E, and F, using another temporary register. */
+ rtx tmp = gen_reg_rtx (SImode);
+ emit_jump_insn (gen_casesi_internal (operands[0], operands[3], tmp));
DONE;
})
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index a6c90b633f9..2262005ae7a 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -989,11 +989,14 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl)
init_frame (file, STACK_POINTER_REGNUM,
UNITS_PER_WORD, crtl->outgoing_args_size);
- /* Declare a local variable for the frame. */
+ /* Declare a local variable for the frame. Force its size to be
+ DImode-compatible. */
HOST_WIDE_INT sz = get_frame_size ();
if (sz || cfun->machine->has_chain)
init_frame (file, FRAME_POINTER_REGNUM,
- crtl->stack_alignment_needed / BITS_PER_UNIT, sz);
+ crtl->stack_alignment_needed / BITS_PER_UNIT,
+ (sz + GET_MODE_SIZE (DImode) - 1)
+ & ~(HOST_WIDE_INT)(GET_MODE_SIZE (DImode) - 1));
/* Declare the pseudos we have as ptx registers. */
int maxregs = max_reg_num ();
@@ -3212,8 +3215,9 @@ nvptx_propagate (basic_block block, rtx_insn *insn, propagate_mask rw,
rtx pred = NULL_RTX;
rtx_code_label *label = NULL;
- gcc_assert (!(fs & (GET_MODE_SIZE (DImode) - 1)));
- fs /= GET_MODE_SIZE (DImode);
+ /* The frame size might not be DImode compatible, but the frame
+ array's declaration will be. So it's ok to round up here. */
+ fs = (fs + GET_MODE_SIZE (DImode) - 1) / GET_MODE_SIZE (DImode);
/* Detect single iteration loop. */
if (fs == 1)
fs = 0;
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index f77d4466469..762264e1d31 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -327,8 +327,8 @@
#define vec_sqrt __builtin_vec_sqrt
#define vec_vsx_ld __builtin_vec_vsx_ld
#define vec_vsx_st __builtin_vec_vsx_st
-#define vec_xl __builtin_vec_xl
-#define vec_xst __builtin_vec_xst
+#define vec_xl __builtin_vec_vsx_ld
+#define vec_xst __builtin_vec_vsx_st
/* Note, xxsldi and xxpermdi were added as __builtin_vsx_<xxx> functions
instead of __builtin_vec_<xxx> */
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 9eb6d545c5c..474b48cc41d 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2133,14 +2133,14 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, ALTIVEC_BUILTIN_VPKSWSS,
RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
- { ALTIVEC_BUILTIN_VEC_VPKSWSS, ALTIVEC_BUILTIN_VPKSWSS,
- RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
- { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
- RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKUDUS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKSDSS,
RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
+ { ALTIVEC_BUILTIN_VEC_VPKSWSS, ALTIVEC_BUILTIN_VPKSWSS,
+ RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
+ { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKSHSS, ALTIVEC_BUILTIN_VPKSHSS,
RS6000_BTI_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKUHUS, ALTIVEC_BUILTIN_VPKUHUS,
@@ -4550,11 +4550,6 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
- { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
- RS6000_BTI_V16QI, 0, 0, 0 },
- { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
- RS6000_BTI_unsigned_V16QI, 0, 0, 0 },
-
{ P9V_BUILTIN_VEC_VSLV, P9V_BUILTIN_VSLV,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
RS6000_BTI_unsigned_V16QI, 0 },
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 391a9ee4c60..b0b1b3a245d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3751,6 +3751,13 @@ rs6000_option_override_internal (bool global_init_p)
&& !global_options_set.x_flag_ira_loop_pressure)
flag_ira_loop_pressure = 1;
+ /* -fsanitize=address needs to turn on -fasynchronous-unwind-tables in order
+ for tracebacks to be complete but not if any -fasynchronous-unwind-tables
+ options were already specified. */
+ if (flag_sanitize & SANITIZE_USER_ADDRESS
+ && !global_options_set.x_flag_asynchronous_unwind_tables)
+ flag_asynchronous_unwind_tables = 1;
+
/* Set the pointer size. */
if (TARGET_64BIT)
{
@@ -23101,9 +23108,7 @@ rs6000_split_signbit (rtx dest, rtx src)
rtx dest_di = (d_mode == DImode) ? dest : gen_lowpart (DImode, dest);
rtx shift_reg = dest_di;
- gcc_assert (REG_P (dest));
- gcc_assert (REG_P (src) || MEM_P (src));
- gcc_assert (s_mode == KFmode || s_mode == TFmode);
+ gcc_assert (FLOAT128_IEEE_P (s_mode) && TARGET_POWERPC64);
if (MEM_P (src))
{
@@ -23115,17 +23120,20 @@ rs6000_split_signbit (rtx dest, rtx src)
else
{
- unsigned int r = REGNO (src);
+ unsigned int r = reg_or_subregno (src);
- /* If this is a VSX register, generate the special mfvsrd instruction
- to get it in a GPR. Until we support SF and DF modes, that will
- always be true. */
- gcc_assert (VSX_REGNO_P (r));
+ if (INT_REGNO_P (r))
+ shift_reg = gen_rtx_REG (DImode, r + (BYTES_BIG_ENDIAN == 0));
- if (s_mode == KFmode)
- emit_insn (gen_signbitkf2_dm2 (dest_di, src));
else
- emit_insn (gen_signbittf2_dm2 (dest_di, src));
+ {
+ /* Generate the special mfvsrd instruction to get it in a GPR. */
+ gcc_assert (VSX_REGNO_P (r));
+ if (s_mode == KFmode)
+ emit_insn (gen_signbitkf2_dm2 (dest_di, src));
+ else
+ emit_insn (gen_signbittf2_dm2 (dest_di, src));
+ }
}
emit_insn (gen_lshrdi3 (dest_di, shift_reg, GEN_INT (63)));
@@ -38581,6 +38589,7 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
case UNSPEC_VSX_CVSPDPN:
return 0;
case UNSPEC_VSPLT_DIRECT:
+ case UNSPEC_VSX_XXSPLTD:
*special = SH_SPLAT;
return 1;
case UNSPEC_REDUC_PLUS:
@@ -38651,6 +38660,12 @@ insn_is_swappable_p (swap_web_entry *insn_entry, rtx insn,
{
if (GET_CODE (body) == SET)
{
+ rtx rhs = SET_SRC (body);
+ /* Even without a swap, the RHS might be a vec_select for, say,
+ a byte-reversing load. */
+ if (GET_CODE (rhs) != MEM)
+ return 0;
+
*special = SH_NOSWAP_LD;
return 1;
}
@@ -38662,6 +38677,12 @@ insn_is_swappable_p (swap_web_entry *insn_entry, rtx insn,
{
if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) != UNSPEC)
{
+ rtx lhs = SET_DEST (body);
+ /* Even without a swap, the LHS might be a vec_select for, say,
+ a byte-reversing store. */
+ if (GET_CODE (lhs) != MEM)
+ return 0;
+
*special = SH_NOSWAP_ST;
return 1;
}
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index acc70a704e9..a73c4a2ff1e 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -514,9 +514,6 @@
(define_mode_iterator SIGNBIT [(KF "FLOAT128_VECTOR_P (KFmode)")
(TF "FLOAT128_VECTOR_P (TFmode)")])
-(define_mode_attr Fsignbit [(KF "wa")
- (TF "wa")])
-
; SF/DF suffix for traditional floating instructions
(define_mode_attr Ftrad [(SF "s") (DF "")])
@@ -4616,7 +4613,7 @@
(define_insn_and_split "signbit<mode>2_dm"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
(unspec:SI
- [(match_operand:SIGNBIT 1 "input_operand" "<Fsignbit>,m,r")]
+ [(match_operand:SIGNBIT 1 "input_operand" "wa,m,r")]
UNSPEC_SIGNBIT))]
"TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
"#"
@@ -4626,7 +4623,24 @@
rs6000_split_signbit (operands[0], operands[1]);
DONE;
}
- [(set_attr "length" "8,8,12")
+ [(set_attr "length" "8,8,4")
+ (set_attr "type" "mftgpr,load,integer")])
+
+(define_insn_and_split "*signbit<mode>2_dm_<su>ext"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
+ (any_extend:DI
+ (unspec:SI
+ [(match_operand:SIGNBIT 1 "input_operand" "wa,m,r")]
+ UNSPEC_SIGNBIT)))]
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rs6000_split_signbit (operands[0], operands[1]);
+ DONE;
+}
+ [(set_attr "length" "8,8,4")
(set_attr "type" "mftgpr,load,integer")])
;; MODES_TIEABLE_P doesn't allow DImode to be tied with the various floating
@@ -4634,7 +4648,7 @@
;; special pattern to avoid using a normal movdi.
(define_insn "signbit<mode>2_dm2"
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (unspec:DI [(match_operand:SIGNBIT 1 "gpc_reg_operand" "<Fsignbit>")
+ (unspec:DI [(match_operand:SIGNBIT 1 "gpc_reg_operand" "wa")
(const_int 0)]
UNSPEC_SIGNBIT))]
"TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index 78f68577db1..4fe53f929ff 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -3996,8 +3996,11 @@ tilegx_expand_prologue (void)
/* Save lr first in its special location because code after this
might use the link register as a scratch register. */
if (df_regs_ever_live_p (TILEGX_LINK_REGNUM) || crtl->calls_eh_return)
- FRP (frame_emit_store (TILEGX_LINK_REGNUM, TILEGX_LINK_REGNUM,
- stack_pointer_rtx, stack_pointer_rtx, 0));
+ {
+ FRP (frame_emit_store (TILEGX_LINK_REGNUM, TILEGX_LINK_REGNUM,
+ stack_pointer_rtx, stack_pointer_rtx, 0));
+ emit_insn (gen_blockage ());
+ }
if (total_size == 0)
{
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 628cd041384..b64564766a6 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -3534,8 +3534,11 @@ tilepro_expand_prologue (void)
/* Save lr first in its special location because code after this
might use the link register as a scratch register. */
if (df_regs_ever_live_p (TILEPRO_LINK_REGNUM) || crtl->calls_eh_return)
- FRP (frame_emit_store (TILEPRO_LINK_REGNUM, TILEPRO_LINK_REGNUM,
- stack_pointer_rtx, stack_pointer_rtx, 0));
+ {
+ FRP (frame_emit_store (TILEPRO_LINK_REGNUM, TILEPRO_LINK_REGNUM,
+ stack_pointer_rtx, stack_pointer_rtx, 0));
+ emit_insn (gen_blockage ());
+ }
if (total_size == 0)
{
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8f01f83cc56..a7f94b35a29 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,47 @@
+2017-01-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/79176 - lambda ICE with -flto -Os
+ * decl2.c (vague_linkage_p): Handle decloned 'tors.
+ * tree.c (decl_linkage): Likewise.
+
+2017-01-20 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 2017-01-04 Marek Polacek <polacek@redhat.com>
+
+ PR c++/77545
+ PR c++/77284
+ * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
+
+2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-01-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78341
+ * parser.c (cp_parser_std_attribute_spec): Remove over-eager
+ assertion. Formatting fix.
+
+ 2017-01-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78949
+ * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
+ vector type.
+
+ PR c++/78693
+ * parser.c (cp_parser_simple_declaration): Only complain about
+ inconsistent auto deduction if auto_result doesn't use auto.
+
+ PR c++/71182
+ * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
+ assertion, as lexer->buffer may be NULL.
+
+2017-01-11 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/77812
+ * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
+ is a new overload.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 52cc3f017d4..a6ac3c1468d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -5295,6 +5295,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
/* We can see these in statement-expressions. */
return true;
+ case CLEANUP_STMT:
case EMPTY_CLASS_EXPR:
return false;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 34eb1e01821..c4a0e854228 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1875,6 +1875,14 @@ vague_linkage_p (tree decl)
{
if (!TREE_PUBLIC (decl))
{
+ /* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor
+ variants, check one of the "clones" for the real linkage. */
+ if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
+ || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ && DECL_CHAIN (decl)
+ && DECL_CLONED_FUNCTION (DECL_CHAIN (decl)))
+ return vague_linkage_p (DECL_CHAIN (decl));
+
gcc_checking_assert (!DECL_COMDAT (decl));
return false;
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 7c0394e731e..a4a8af22db6 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3470,7 +3470,12 @@ set_namespace_binding_1 (tree name, tree scope, tree val)
if (scope == NULL_TREE)
scope = global_namespace;
b = binding_for_name (NAMESPACE_LEVEL (scope), name);
- if (!b->value || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
+ if (!b->value
+ /* For templates and using we create a single element OVERLOAD.
+ Look for the chain to know whether this is really augmenting
+ an existing overload. */
+ || (TREE_CODE (val) == OVERLOAD && OVL_CHAIN (val))
+ || val == error_mark_node)
b->value = val;
else
supplement_binding (b, val);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 68938485bbc..390f7d0d16f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -762,7 +762,7 @@ cp_lexer_previous_token (cp_lexer *lexer)
/* Skip past purged tokens. */
while (tp->purged_p)
{
- gcc_assert (tp != lexer->buffer->address ());
+ gcc_assert (tp != vec_safe_address (lexer->buffer));
tp--;
}
@@ -12406,9 +12406,11 @@ cp_parser_simple_declaration (cp_parser* parser,
if (cp_parser_error_occurred (parser))
goto done;
- if (auto_result)
+ if (auto_result
+ && (!processing_template_decl || !type_uses_auto (auto_result)))
{
- if (last_type && last_type != error_mark_node
+ if (last_type
+ && last_type != error_mark_node
&& !same_type_p (auto_result, last_type))
{
/* If the list of declarators contains more than one declarator,
@@ -24140,11 +24142,7 @@ cp_parser_std_attribute_spec (cp_parser *parser)
if (!cp_parser_parse_definitely (parser))
{
- gcc_assert (alignas_expr == error_mark_node
- || alignas_expr == NULL_TREE);
-
- alignas_expr =
- cp_parser_assignment_expression (parser);
+ alignas_expr = cp_parser_assignment_expression (parser);
if (alignas_expr == error_mark_node)
cp_parser_skip_to_end_of_statement (parser);
if (alignas_expr == NULL_TREE
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5b15e9ce520..5e8bb742bf4 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -4146,6 +4146,14 @@ decl_linkage (tree decl)
if (TREE_PUBLIC (decl))
return lk_external;
+ /* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor variants,
+ check one of the "clones" for the real linkage. */
+ if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
+ || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ && DECL_CHAIN (decl)
+ && DECL_CLONED_FUNCTION (DECL_CHAIN (decl)))
+ return decl_linkage (DECL_CHAIN (decl));
+
if (TREE_CODE (decl) == NAMESPACE_DECL)
return lk_external;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9367e0e7688..029d0abfe4b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5848,6 +5848,8 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
errstring = _("wrong type argument to bit-complement");
else if (!noconvert && CP_INTEGRAL_TYPE_P (TREE_TYPE (arg)))
arg = cp_perform_integral_promotions (arg, complain);
+ else if (!noconvert && VECTOR_TYPE_P (TREE_TYPE (arg)))
+ arg = mark_rvalue_use (arg);
break;
case ABS_EXPR:
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 0fa3d8a8b12..04b93934e25 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -10157,7 +10157,7 @@ is enabled. Cilk Plus can be enabled using the @option{-fcilkplus} flag.
Further details and examples about these built-in functions are described
in the Cilk Plus language manual which can be found at
-@uref{http://www.cilkplus.org}.
+@uref{https://www.cilkplus.org}.
@node Other Builtins
@section Other Built-in Functions Provided by GCC
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index ca6398467ea..5af329cae91 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -3241,7 +3241,7 @@ This tree has one field that holds the name of the spawning function.
@end smallexample
Detailed description for usage and functionality of @code{_Cilk_spawn} can be
-found at http://www.cilkplus.org
+found at @uref{https://www.cilkplus.org}.
@item CILK_SYNC_STMT
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index ef5548b2aa6..2c5e957df62 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -163,7 +163,7 @@ done by @code{builtin_expand_cilk_pop_frame} in @file{cilk-common.c}.
@end itemize
Documentation about Cilk Plus and language specification is provided under the
-"Learn" section in @w{@uref{http://www.cilkplus.org/}}. It is worth mentioning
+"Learn" section in @w{@uref{https://www.cilkplus.org}}. It is worth mentioning
that the current implementation follows ABI 1.1.
@node Gimplification pass
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d9747e0bf1c..995ae7f1875 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -16615,10 +16615,6 @@ static dw_loc_descr_ref
field_byte_offset (const_tree decl, struct vlr_context *ctx,
HOST_WIDE_INT *cst_offset)
{
- offset_int object_offset_in_bits;
- offset_int object_offset_in_bytes;
- offset_int bitpos_int;
- bool is_byte_offset_cst, is_bit_offset_cst;
tree tree_result;
dw_loc_list_ref loc_result;
@@ -16629,20 +16625,21 @@ field_byte_offset (const_tree decl, struct vlr_context *ctx,
else
gcc_assert (TREE_CODE (decl) == FIELD_DECL);
- is_bit_offset_cst = TREE_CODE (DECL_FIELD_BIT_OFFSET (decl)) != INTEGER_CST;
- is_byte_offset_cst = TREE_CODE (DECL_FIELD_OFFSET (decl)) != INTEGER_CST;
-
/* We cannot handle variable bit offsets at the moment, so abort if it's the
case. */
- if (is_bit_offset_cst)
+ if (TREE_CODE (DECL_FIELD_BIT_OFFSET (decl)) != INTEGER_CST)
return NULL;
#ifdef PCC_BITFIELD_TYPE_MATTERS
/* We used to handle only constant offsets in all cases. Now, we handle
properly dynamic byte offsets only when PCC bitfield type doesn't
matter. */
- if (PCC_BITFIELD_TYPE_MATTERS && is_byte_offset_cst && is_bit_offset_cst)
+ if (PCC_BITFIELD_TYPE_MATTERS
+ && TREE_CODE (DECL_FIELD_OFFSET (decl)) == INTEGER_CST)
{
+ offset_int object_offset_in_bits;
+ offset_int object_offset_in_bytes;
+ offset_int bitpos_int;
tree type;
tree field_size_tree;
offset_int deepest_bitpos;
@@ -16737,13 +16734,23 @@ field_byte_offset (const_tree decl, struct vlr_context *ctx,
object_offset_in_bits
= round_up_to_align (object_offset_in_bits, decl_align_in_bits);
}
+
+ object_offset_in_bytes
+ = wi::lrshift (object_offset_in_bits, LOG2_BITS_PER_UNIT);
+ if (ctx->variant_part_offset == NULL_TREE)
+ {
+ *cst_offset = object_offset_in_bytes.to_shwi ();
+ return NULL;
+ }
+ tree_result = wide_int_to_tree (sizetype, object_offset_in_bytes);
}
+ else
#endif /* PCC_BITFIELD_TYPE_MATTERS */
+ tree_result = byte_position (decl);
- tree_result = byte_position (decl);
if (ctx->variant_part_offset != NULL_TREE)
- tree_result = fold (build2 (PLUS_EXPR, TREE_TYPE (tree_result),
- ctx->variant_part_offset, tree_result));
+ tree_result = fold_build2 (PLUS_EXPR, TREE_TYPE (tree_result),
+ ctx->variant_part_offset, tree_result);
/* If the byte offset is a constant, it's simplier to handle a native
constant rather than a DWARF expression. */
@@ -22221,14 +22228,12 @@ analyze_variants_discr (tree variant_part_decl,
if (!lower_cst_included)
lower_cst
- = fold (build2 (PLUS_EXPR, TREE_TYPE (lower_cst),
- lower_cst,
- build_int_cst (TREE_TYPE (lower_cst), 1)));
+ = fold_build2 (PLUS_EXPR, TREE_TYPE (lower_cst), lower_cst,
+ build_int_cst (TREE_TYPE (lower_cst), 1));
if (!upper_cst_included)
upper_cst
- = fold (build2 (MINUS_EXPR, TREE_TYPE (upper_cst),
- upper_cst,
- build_int_cst (TREE_TYPE (upper_cst), 1)));
+ = fold_build2 (MINUS_EXPR, TREE_TYPE (upper_cst), upper_cst,
+ build_int_cst (TREE_TYPE (upper_cst), 1));
if (!get_discr_value (lower_cst,
&new_node->dw_discr_lower_bound)
@@ -22397,8 +22402,8 @@ gen_variant_part (tree variant_part_decl, struct vlr_context *vlr_ctx,
we recurse. */
vlr_sub_ctx.variant_part_offset
- = fold (build2 (PLUS_EXPR, TREE_TYPE (variant_part_offset),
- variant_part_offset, byte_position (member)));
+ = fold_build2 (PLUS_EXPR, TREE_TYPE (variant_part_offset),
+ variant_part_offset, byte_position (member));
gen_variant_part (member, &vlr_sub_ctx, variant_die);
}
else
@@ -23752,7 +23757,16 @@ dwarf2out_late_global_decl (tree decl)
{
dw_die_ref die = lookup_decl_die (decl);
if (die)
- add_location_or_const_value_attribute (die, decl, false);
+ {
+ /* We get called via the symtab code invoking late_global_decl
+ for symbols that are optimized out. Do not add locations
+ for those. */
+ varpool_node *node = varpool_node::get (decl);
+ if (! node || ! node->definition)
+ tree_add_const_value_attribute_for_decl (die, decl);
+ else
+ add_location_or_const_value_attribute (die, decl, false);
+ }
}
}
diff --git a/gcc/expr.c b/gcc/expr.c
index aad7ff5ef7f..6260f5ed7ed 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6688,13 +6688,36 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
temp = expand_normal (exp);
- /* If the value has a record type and an integral mode then, if BITSIZE
- is narrower than this mode and this is for big-endian data, we must
- first put the value into the low-order bits. Moreover, the field may
- be not aligned on a byte boundary; in this case, if it has reverse
- storage order, it needs to be accessed as a scalar field with reverse
- storage order and we must first put the value into target order. */
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
+ /* Handle calls that return values in multiple non-contiguous locations.
+ The Irix 6 ABI has examples of this. */
+ if (GET_CODE (temp) == PARALLEL)
+ {
+ HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
+ machine_mode temp_mode
+ = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
+ rtx temp_target = gen_reg_rtx (temp_mode);
+ emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
+ temp = temp_target;
+ }
+
+ /* Handle calls that return BLKmode values in registers. */
+ else if (mode == BLKmode && REG_P (temp) && TREE_CODE (exp) == CALL_EXPR)
+ {
+ rtx temp_target = gen_reg_rtx (GET_MODE (temp));
+ copy_blkmode_from_reg (temp_target, temp, TREE_TYPE (exp));
+ temp = temp_target;
+ }
+
+ /* If the value has aggregate type and an integral mode then, if BITSIZE
+ is narrower than this mode and this is for big-endian data, we first
+ need to put the value into the low-order bits for store_bit_field,
+ except when MODE is BLKmode and BITSIZE larger than the word size
+ (see the handling of fields larger than a word in store_bit_field).
+ Moreover, the field may be not aligned on a byte boundary; in this
+ case, if it has reverse storage order, it needs to be accessed as a
+ scalar field with reverse storage order and we must first put the
+ value into target order. */
+ if (AGGREGATE_TYPE_P (TREE_TYPE (exp))
&& GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT)
{
HOST_WIDE_INT size = GET_MODE_BITSIZE (GET_MODE (temp));
@@ -6705,7 +6728,8 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
temp = flip_storage_order (GET_MODE (temp), temp);
if (bitsize < size
- && reverse ? !BYTES_BIG_ENDIAN : BYTES_BIG_ENDIAN)
+ && reverse ? !BYTES_BIG_ENDIAN : BYTES_BIG_ENDIAN
+ && !(mode == BLKmode && bitsize > BITS_PER_WORD))
temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
size - bitsize, NULL_RTX, 1);
}
@@ -6715,12 +6739,10 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
&& mode != TYPE_MODE (TREE_TYPE (exp)))
temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1);
- /* If TEMP is not a PARALLEL (see below) and its mode and that of TARGET
- are both BLKmode, both must be in memory and BITPOS must be aligned
- on a byte boundary. If so, we simply do a block copy. Likewise for
- a BLKmode-like TARGET. */
- if (GET_CODE (temp) != PARALLEL
- && GET_MODE (temp) == BLKmode
+ /* If the mode of TEMP and TARGET is BLKmode, both must be in memory
+ and BITPOS must be aligned on a byte boundary. If so, we simply do
+ a block copy. Likewise for a BLKmode-like TARGET. */
+ if (GET_MODE (temp) == BLKmode
&& (GET_MODE (target) == BLKmode
|| (MEM_P (target)
&& GET_MODE_CLASS (GET_MODE (target)) == MODE_INT
@@ -6739,38 +6761,13 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
return const0_rtx;
}
- /* Handle calls that return values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- if (GET_CODE (temp) == PARALLEL)
- {
- HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
- rtx temp_target;
- if (mode == BLKmode || mode == VOIDmode)
- mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
- temp_target = gen_reg_rtx (mode);
- emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
- temp = temp_target;
- }
- else if (mode == BLKmode)
+ /* If the mode of TEMP is still BLKmode and BITSIZE not larger than the
+ word size, we need to load the value (see again store_bit_field). */
+ if (GET_MODE (temp) == BLKmode && bitsize <= BITS_PER_WORD)
{
- /* Handle calls that return BLKmode values in registers. */
- if (REG_P (temp) && TREE_CODE (exp) == CALL_EXPR)
- {
- rtx temp_target = gen_reg_rtx (GET_MODE (temp));
- copy_blkmode_from_reg (temp_target, temp, TREE_TYPE (exp));
- temp = temp_target;
- }
- else
- {
- HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
- rtx temp_target;
- mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
- temp_target = gen_reg_rtx (mode);
- temp_target
- = extract_bit_field (temp, size * BITS_PER_UNIT, 0, 1,
- temp_target, mode, mode, false);
- temp = temp_target;
- }
+ machine_mode temp_mode = smallest_mode_for_size (bitsize, MODE_INT);
+ temp = extract_bit_field (temp, bitsize, 0, 1, NULL_RTX, temp_mode,
+ temp_mode, false);
}
/* Store the value in the bitfield. */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 83960b34bc9..18b2d3c219f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,35 @@
+2017-01-29 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backported from trunk
+ 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/70697
+ * resolve.c (resolve_lock_unlock_event): Resolve the expression for
+ event's until_count.
+
+2017-01-29 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/70696
+ * trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl
+ is valid before accessing it. Remove unnecessary assert.
+ * trans-decl.c (gfc_build_qualified_array): Add static tokens to the
+ parent function's scope only, when the decl-context is not the
+ translation unit.
+
+2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/78866
+ * openmp.c (resolve_omp_clauses): Diagnose assumed size arrays in
+ OpenMP map, to and from clauses.
+ * trans-openmp.c: Include diagnostic-core.h, temporarily redefining
+ GCC_DIAG_STYLE to __gcc_tdiag__.
+ (gfc_omp_finish_clause): Diagnose implicitly mapped assumed size
+ arrays.
+
2016-12-22 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 4a035063fa9..bd8e66c03da 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -3530,6 +3530,11 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
else
resolve_oacc_data_clauses (n->sym, n->where, name);
}
+ else if (list != OMP_CLAUSE_DEPEND
+ && n->sym->as
+ && n->sym->as->type == AS_ASSUMED_SIZE)
+ gfc_error ("Assumed size array %qs in %s clause at %L",
+ n->sym->name, name, &n->where);
}
if (list != OMP_LIST_DEPEND)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 8064d4462f1..7cf2ca24725 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8840,10 +8840,13 @@ resolve_lock_unlock_event (gfc_code *code)
return;
/* Check for EVENT WAIT the UNTIL_COUNT. */
- if (code->op == EXEC_EVENT_WAIT && code->expr4
- && (code->expr4->ts.type != BT_INTEGER || code->expr4->rank != 0))
- gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
- "expression", &code->expr4->where);
+ if (code->op == EXEC_EVENT_WAIT && code->expr4)
+ {
+ if (!gfc_resolve_expr (code->expr4) || code->expr4->ts.type != BT_INTEGER
+ || code->expr4->rank != 0)
+ gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
+ "expression", &code->expr4->where);
+ }
}
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index ba9cf06d4e4..272ac57dd58 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -887,6 +887,10 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
DECL_CONTEXT (token) = sym->ns->proc_name->backend_decl;
gfc_module_add_decl (cur_module, token);
}
+ else if (sym->attr.host_assoc
+ && TREE_CODE (DECL_CONTEXT (current_function_decl))
+ != TRANSLATION_UNIT_DECL)
+ gfc_add_decl_to_parent_function (token);
else
gfc_add_decl_to_function (token);
}
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 6b61b16f969..26cd4392151 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1898,8 +1898,11 @@ gfc_get_tree_for_caf_expr (gfc_expr *expr)
&expr->where);
}
- caf_decl = expr->symtree->n.sym->backend_decl;
- gcc_assert (caf_decl);
+ /* Make sure the backend_decl is present before accessing it. */
+ caf_decl = expr->symtree->n.sym->backend_decl == NULL_TREE
+ ? gfc_get_symbol_decl (expr->symtree->n.sym)
+ : expr->symtree->n.sym->backend_decl;
+
if (expr->symtree->n.sym->ts.type == BT_CLASS)
caf_decl = gfc_class_data_get (caf_decl);
if (expr->symtree->n.sym->attr.codimension)
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index ecc6ee87aa0..d68f99b7d70 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -37,6 +37,11 @@ along with GCC; see the file COPYING3. If not see
#include "arith.h"
#include "omp-low.h"
#include "gomp-constants.h"
+#undef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_tdiag__
+#include "diagnostic-core.h"
+#undef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_gfc__
int ompws_flags;
@@ -1028,6 +1033,21 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
return;
tree decl = OMP_CLAUSE_DECL (c);
+
+ /* Assumed-size arrays can't be mapped implicitly, they have to be
+ mapped explicitly using array sections. */
+ if (TREE_CODE (decl) == PARM_DECL
+ && GFC_ARRAY_TYPE_P (TREE_TYPE (decl))
+ && GFC_TYPE_ARRAY_AKIND (TREE_TYPE (decl)) == GFC_ARRAY_UNKNOWN
+ && GFC_TYPE_ARRAY_UBOUND (TREE_TYPE (decl),
+ GFC_TYPE_ARRAY_RANK (TREE_TYPE (decl)) - 1)
+ == NULL)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "implicit mapping of assumed size array %qD", decl);
+ return;
+ }
+
tree c2 = NULL_TREE, c3 = NULL_TREE, c4 = NULL_TREE;
if (POINTER_TYPE_P (TREE_TYPE (decl)))
{
diff --git a/gcc/function.c b/gcc/function.c
index 401f8f90160..4f2791254e5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4800,9 +4800,9 @@ invoke_set_current_function_hook (tree fndecl)
/* cfun should never be set directly; use this function. */
void
-set_cfun (struct function *new_cfun)
+set_cfun (struct function *new_cfun, bool force)
{
- if (cfun != new_cfun)
+ if (cfun != new_cfun || force)
{
cfun = new_cfun;
invoke_set_current_function_hook (new_cfun ? new_cfun->decl : NULL_TREE);
diff --git a/gcc/function.h b/gcc/function.h
index 501ef684840..3badf9f4cc5 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -606,7 +606,7 @@ extern tree block_chainon (tree, tree);
extern void number_blocks (tree);
/* cfun shouldn't be set directly; use one of these functions instead. */
-extern void set_cfun (struct function *new_cfun);
+extern void set_cfun (struct function *new_cfun, bool force = false);
extern void push_cfun (struct function *new_cfun);
extern void pop_cfun (void);
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 2c333b811d2..c6a6fe08448 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1919,6 +1919,9 @@ static int have_c = 0;
/* Was the option -o passed. */
static int have_o = 0;
+/* Was the option -E passed. */
+static int have_E = 0;
+
/* Pointer to output file name passed in with -o. */
static const char *output_file = 0;
@@ -4031,6 +4034,10 @@ driver_handle_option (struct gcc_options *opts,
validated = true;
break;
+ case OPT_E:
+ have_E = true;
+ break;
+
case OPT_x:
spec_lang = arg;
if (!strcmp (spec_lang, "none"))
@@ -8284,7 +8291,17 @@ lookup_compiler (const char *name, size_t length, const char *language)
{
for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
if (cp->suffix[0] == '@' && !strcmp (cp->suffix + 1, language))
- return cp;
+ {
+ if (name != NULL && strcmp (name, "-") == 0
+ && (strcmp (cp->suffix, "@c-header") == 0
+ || strcmp (cp->suffix, "@c++-header") == 0)
+ && !have_E)
+ fatal_error (input_location,
+ "cannot use %<-%> as input filename for a "
+ "precompiled header");
+
+ return cp;
+ }
error ("language %s not recognized", language);
return 0;
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 09ab5bf8f7e..cf602548242 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -3639,8 +3639,12 @@ Unary_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
if (expr->numeric_constant_value(&nc))
{
Numeric_constant result;
- if (Unary_expression::eval_constant(op, &nc, loc, &result))
+ bool issued_error;
+ if (Unary_expression::eval_constant(op, &nc, loc, &result,
+ &issued_error))
return result.expression(loc);
+ else if (issued_error)
+ return Expression::make_error(this->location());
}
}
@@ -3747,12 +3751,15 @@ Unary_expression::do_is_constant() const
}
// Apply unary opcode OP to UNC, setting NC. Return true if this
-// could be done, false if not. Issue errors for overflow.
+// could be done, false if not. On overflow, issues an error and sets
+// *ISSUED_ERROR.
bool
Unary_expression::eval_constant(Operator op, const Numeric_constant* unc,
- Location location, Numeric_constant* nc)
+ Location location, Numeric_constant* nc,
+ bool* issued_error)
{
+ *issued_error = false;
switch (op)
{
case OPERATOR_PLUS:
@@ -3897,7 +3904,12 @@ Unary_expression::eval_constant(Operator op, const Numeric_constant* unc,
mpz_clear(uval);
mpz_clear(val);
- return nc->set_type(unc->type(), true, location);
+ if (!nc->set_type(unc->type(), true, location))
+ {
+ *issued_error = true;
+ return false;
+ }
+ return true;
}
// Return the integral constant value of a unary expression, if it has one.
@@ -3908,8 +3920,9 @@ Unary_expression::do_numeric_constant_value(Numeric_constant* nc) const
Numeric_constant unc;
if (!this->expr_->numeric_constant_value(&unc))
return false;
+ bool issued_error;
return Unary_expression::eval_constant(this->op_, &unc, this->location(),
- nc);
+ nc, &issued_error);
}
// Return the type of a unary expression.
@@ -4539,13 +4552,15 @@ Binary_expression::compare_complex(const Numeric_constant* left_nc,
// Apply binary opcode OP to LEFT_NC and RIGHT_NC, setting NC. Return
// true if this could be done, false if not. Issue errors at LOCATION
-// as appropriate.
+// as appropriate, and sets *ISSUED_ERROR if it did.
bool
Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
Numeric_constant* right_nc,
- Location location, Numeric_constant* nc)
+ Location location, Numeric_constant* nc,
+ bool* issued_error)
{
+ *issued_error = false;
switch (op)
{
case OPERATOR_OROR:
@@ -4594,7 +4609,11 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
r = Binary_expression::eval_integer(op, left_nc, right_nc, location, nc);
if (r)
- r = nc->set_type(type, true, location);
+ {
+ r = nc->set_type(type, true, location);
+ if (!r)
+ *issued_error = true;
+ }
return r;
}
@@ -4917,9 +4936,15 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
else
{
Numeric_constant nc;
+ bool issued_error;
if (!Binary_expression::eval_constant(op, &left_nc, &right_nc,
- location, &nc))
+ location, &nc,
+ &issued_error))
+ {
+ if (issued_error)
+ return Expression::make_error(location);
return this;
+ }
return nc.expression(location);
}
}
@@ -5254,8 +5279,9 @@ Binary_expression::do_numeric_constant_value(Numeric_constant* nc) const
Numeric_constant right_nc;
if (!this->right_->numeric_constant_value(&right_nc))
return false;
+ bool issued_error;
return Binary_expression::eval_constant(this->op_, &left_nc, &right_nc,
- this->location(), nc);
+ this->location(), nc, &issued_error);
}
// Note that the value is being discarded.
@@ -5354,7 +5380,12 @@ Binary_expression::do_determine_type(const Type_context* context)
Type_context subcontext(*context);
- if (is_comparison)
+ if (is_constant_expr)
+ {
+ subcontext.type = NULL;
+ subcontext.may_be_abstract = true;
+ }
+ else if (is_comparison)
{
// In a comparison, the context does not determine the types of
// the operands.
@@ -5396,8 +5427,7 @@ Binary_expression::do_determine_type(const Type_context* context)
subcontext.type = subcontext.type->make_non_abstract_type();
}
- if (!is_constant_expr)
- this->left_->determine_type(&subcontext);
+ this->left_->determine_type(&subcontext);
if (is_shift_op)
{
@@ -5417,8 +5447,7 @@ Binary_expression::do_determine_type(const Type_context* context)
subcontext.may_be_abstract = false;
}
- if (!is_constant_expr)
- this->right_->determine_type(&subcontext);
+ this->right_->determine_type(&subcontext);
if (is_comparison)
{
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index c33e63653e6..b69443af7c8 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1633,10 +1633,11 @@ class Unary_expression : public Expression
}
// Apply unary opcode OP to UNC, setting NC. Return true if this
- // could be done, false if not. Issue errors for overflow.
+ // could be done, false if not. On overflow, issues an error and
+ // sets *ISSUED_ERROR.
static bool
eval_constant(Operator op, const Numeric_constant* unc,
- Location, Numeric_constant* nc);
+ Location, Numeric_constant* nc, bool *issued_error);
static Expression*
do_import(Import*);
@@ -1755,11 +1756,11 @@ class Binary_expression : public Expression
// Apply binary opcode OP to LEFT_NC and RIGHT_NC, setting NC.
// Return true if this could be done, false if not. Issue errors at
- // LOCATION as appropriate.
+ // LOCATION as appropriate, and sets *ISSUED_ERROR if it did.
static bool
eval_constant(Operator op, Numeric_constant* left_nc,
Numeric_constant* right_nc, Location location,
- Numeric_constant* nc);
+ Numeric_constant* nc, bool* issued_error);
// Compare constants LEFT_NC and RIGHT_NC according to OP, setting
// *RESULT. Return true if this could be done, false if not. Issue
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 0443281dd81..805a9cff69f 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -2175,11 +2175,26 @@ Type::make_gc_symbol_var(Gogo* gogo)
is_common = true;
}
+ // The current garbage collector requires that the GC symbol be
+ // aligned to at least a four byte boundary. See the use of PRECISE
+ // and LOOP in libgo/runtime/mgc0.c.
+ int64_t align;
+ if (!sym_init->type()->backend_type_align(gogo, &align))
+ go_assert(saw_errors());
+ if (align < 4)
+ align = 4;
+ else
+ {
+ // Use default alignment.
+ align = 0;
+ }
+
// Since we are building the GC symbol in this package, we must create the
// variable before converting the initializer to its backend representation
// because the initializer may refer to the GC symbol for this type.
this->gc_symbol_var_ =
- gogo->backend()->implicit_variable(sym_name, sym_btype, false, true, is_common, 0);
+ gogo->backend()->implicit_variable(sym_name, sym_btype, false, true,
+ is_common, align);
if (phash != NULL)
*phash = this->gc_symbol_var_;
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 1925bf14416..30caf4ec14a 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -324,6 +324,8 @@ inline_call (struct cgraph_edge *e, bool update_original,
if (DECL_FUNCTION_PERSONALITY (callee->decl))
DECL_FUNCTION_PERSONALITY (to->decl)
= DECL_FUNCTION_PERSONALITY (callee->decl);
+
+ bool reload_optimization_node = false;
if (!opt_for_fn (callee->decl, flag_strict_aliasing)
&& opt_for_fn (to->decl, flag_strict_aliasing))
{
@@ -336,8 +338,13 @@ inline_call (struct cgraph_edge *e, bool update_original,
to->name (), to->order);
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (to->decl)
= build_optimization_node (&opts);
+ reload_optimization_node = true;
}
+ /* Reload global optimization flags. */
+ if (reload_optimization_node && DECL_STRUCT_FUNCTION (to->decl) == cfun)
+ set_cfun (cfun, true);
+
/* If aliases are involved, redirect edge to the actual destination and
possibly remove the aliases. */
if (e->callee != callee)
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index f7ef6aa94fd..bc1fab73b7c 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -463,12 +463,12 @@ contains_type_p (tree outer_type, HOST_WIDE_INT offset,
/* Check that type is within range. */
if (offset < 0)
return false;
- if (TYPE_SIZE (outer_type) && TYPE_SIZE (otr_type)
- && TREE_CODE (TYPE_SIZE (outer_type)) == INTEGER_CST
- && TREE_CODE (TYPE_SIZE (otr_type)) == INTEGER_CST
- && wi::ltu_p (wi::to_offset (TYPE_SIZE (outer_type)),
- (wi::to_offset (TYPE_SIZE (otr_type)) + offset)))
- return false;
+
+ /* PR ipa/71207
+ As OUTER_TYPE can be a type which has a diamond virtual inheritance,
+ it's not necessary that INNER_TYPE will fit within OUTER_TYPE with
+ a given offset. It can happen that INNER_TYPE also contains a base object,
+ however it would point to the same instance in the OUTER_TYPE. */
context.offset = offset;
context.outer_type = TYPE_MAIN_VARIANT (outer_type);
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 187ee3e7752..79504d4eb1a 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -1116,6 +1116,7 @@ update_scratch_ops (rtx_insn *remat_insn)
static bool
do_remat (void)
{
+ unsigned regno;
rtx_insn *insn;
basic_block bb;
bitmap_head avail_cands;
@@ -1123,12 +1124,21 @@ do_remat (void)
bool changed_p = false;
/* Living hard regs and hard registers of living pseudos. */
HARD_REG_SET live_hard_regs;
+ bitmap_iterator bi;
bitmap_initialize (&avail_cands, &reg_obstack);
bitmap_initialize (&active_cands, &reg_obstack);
FOR_EACH_BB_FN (bb, cfun)
{
- REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_out (bb));
+ CLEAR_HARD_REG_SET (live_hard_regs);
+ EXECUTE_IF_SET_IN_BITMAP (df_get_live_in (bb), 0, regno, bi)
+ {
+ int hard_regno = regno < FIRST_PSEUDO_REGISTER
+ ? regno
+ : reg_renumber[regno];
+ if (hard_regno >= 0)
+ SET_HARD_REG_BIT (live_hard_regs, hard_regno);
+ }
bitmap_and (&avail_cands, &get_remat_bb_data (bb)->avin_cands,
&get_remat_bb_data (bb)->livein_cands);
/* Activating insns are always in the same block as their corresponding
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 95c446d0696..b2490b99188 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -623,6 +623,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
}
bp_pack_value (&bp, node->tls_model, 3);
bp_pack_value (&bp, node->used_by_single_function, 1);
+ bp_pack_value (&bp, node->dynamically_initialized, 1);
bp_pack_value (&bp, node->need_bounds_init, 1);
streamer_write_bitpack (&bp);
@@ -1397,6 +1398,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
node->alias_target = get_alias_symbol (node->decl);
node->tls_model = (enum tls_model)bp_unpack_value (&bp, 3);
node->used_by_single_function = (enum tls_model)bp_unpack_value (&bp, 1);
+ node->dynamically_initialized = bp_unpack_value (&bp, 1);
node->need_bounds_init = bp_unpack_value (&bp, 1);
group = read_identifier (ib);
if (group)
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 7374b4e9ad9..c964c6e470a 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -129,7 +129,7 @@ along with GCC; see the file COPYING3. If not see
form followed by the data for the string. */
#define LTO_major_version 5
-#define LTO_minor_version 1
+#define LTO_minor_version 2
typedef unsigned char lto_decl_flags_t;
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 2f3032cf550..55f1617df7b 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-01-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/50199
+ * lto-lang.c (lto_post_options): Force flag_merge_constants = 1
+ if it was 0.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index b5efe3aab7e..ebe908a3e17 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -852,6 +852,12 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
support. */
flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
+ /* When partitioning, we can tear appart STRING_CSTs uses from the same
+ TU into multiple partitions. Without constant merging the constants
+ might not be equal at runtime. See PR50199. */
+ if (!flag_merge_constants)
+ flag_merge_constants = 1;
+
/* Initialize the compiler back end. */
return false;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 15ecb44b328..57a03df8355 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -19225,7 +19225,9 @@ oacc_loop_sibling_nreverse (oacc_loop *loop)
static oacc_loop *
oacc_loop_discovery ()
{
- basic_block bb;
+ /* Clear basic block flags, in particular BB_VISITED which we're going to use
+ in the following. */
+ clear_bb_flags ();
oacc_loop *top = new_oacc_loop_outer (current_function_decl);
oacc_loop_discover_walk (top, ENTRY_BLOCK_PTR_FOR_FN (cfun));
@@ -19234,9 +19236,8 @@ oacc_loop_discovery ()
that diagnostics come out in an unsurprising order. */
top = oacc_loop_sibling_nreverse (top);
- /* Reset the visited flags. */
- FOR_ALL_BB_FN (bb, cfun)
- bb->flags &= ~BB_VISITED;
+ /* Clear basic block flags again. */
+ clear_bb_flags ();
return top;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 391941f99b3..63e81e8608c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,212 @@
+2017-02-03 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/builtins-3-p8.c: Add new testfile for missing
+ vec_packs built-in tests.
+
+2017-02-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/65484
+ * g++.dg/vect/pr36648.cc: Modify to reflect that the loop is not
+ vectorized on POWER unless hardware misaligned loads are
+ available.
+
+2017-01-31 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79268
+ * gcc.target/powerpc/pr79268.c: New file.
+ * gcc.target/powerpc/vsx-elemrev-1.c: Delete file.
+ * gcc.target/powerpc/vsx-elemrev-2.c: Likewise.
+ * gcc.target/powerpc/vsx-elemrev-3.c: Likewise.
+ * gcc.target/powerpc/vsx-elemrev-4.c: Likewise.
+
+2017-01-29 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backport from trunk
+ 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/70697
+ * gfortran.dg/coarray/event_4.f08: New test.
+
+2017-01-29 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backport from trunk
+ 2017-01-19 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/70696
+ * gfortran.dg/coarray_43.f90: New test.
+
+ 2017-01-18 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/70696
+ * gfortran.dg/coarray_event_1.f08: New test.
+
+ 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/70696
+ * gfortran.dg/coarray/event_3.f08: New test.
+
+2017-01-28 John David Anglin <danglin@gcc.gnu.org>
+
+ PR testsuite/70583
+ * g++.old-deja/g++.abi/vtable2.C: Adjust CMP_VPTR define on hppa.
+
+2017-01-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ 2017-01-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/opt/call2.C: New test.
+ * g++.dg/opt/call3.C: Likewise.
+ * gnat.dg/array26.adb: New test.
+ * gnat.dg/array26_pkg.ad[sb]: New helper.
+ * gnat.dg/array27.adb: New test.
+ * gnat.dg/array27_pkg.ad[sb]: New helper.
+ * gnat.dg/array28.adb: New test.
+ * gnat.dg/array28_pkg.ad[sb]: New helper.
+
+2017-01-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-01-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/79034
+ * g++.dg/torture/pr79034.C: New testcase.
+
+ 2016-12-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78742
+ * gcc.dg/torture/pr78742.c: New testcase.
+
+2017-01-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/arm/vfp-longcall-apcs.c: New test.
+
+2017-01-23 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2016-01-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.
+
+2017-01-23 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-20 Martin Liska <mliska@suse.cz>
+
+ PR lto/69188
+ * gcc.dg/lto/pr69188_0.c: New test.
+ * gcc.dg/lto/pr69188_1.c: New test.
+
+2017-01-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/swaps-p8-27.c: New.
+
+2017-01-20 Wilco Dijkstra <wdijkstr@arm.com>
+
+ Backport from mainline
+ PR target/77455
+ * gcc.target/aarch64/eh_return.c: New test.
+
+2017-01-20 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 2017-01-04 Marek Polacek <polacek@redhat.com>
+
+ PR c++/77545
+ PR c++/77284
+ * g++.dg/cpp0x/range-for32.C: New test.
+ * g++.dg/cpp0x/range-for33.C: New test.
+
+2017-01-20 Richard Earnshaw <rearnsha@arm.com>
+
+ Backported from mainline
+ 2017-01-19 Richard Earnshaw <rearnsha@arm.com>
+
+ PR rtl-optimization/79121
+ * gcc.c-torture/execute/pr79121.c: New test.
+
+2017-01-20 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-13 Martin Liska <mliska@suse.cz>
+
+ PR ipa/79043
+ * gcc.c-torture/execute/pr79043.c: New test.
+
+2017-01-20 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-01-17 Martin Liska <mliska@suse.cz>
+
+ PR ipa/71207
+ * g++.dg/ipa/pr71207.C: New test.
+
+2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-01-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78341
+ * g++.dg/cpp0x/pr78341.C: New test.
+
+ PR middle-end/50199
+ * gcc.dg/lto/pr50199_0.c: New test.
+
+ 2017-01-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/78949
+ * c-c++-common/Wunused-var-16.c: New test.
+
+ PR c++/78693
+ * g++.dg/cpp0x/pr78693.C: New test.
+
+ PR c++/71182
+ * g++.dg/cpp0x/pr71182.C: New test.
+
+ 2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/78866
+ * gfortran.dg/gomp/map-1.f90: Add expected error.
+ * gfortran.dg/gomp/pr78866-1.f90: New test.
+ * gfortran.dg/gomp/pr78866-2.f90: New test.
+
+2017-01-17 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR rtl-optimization/78617
+ * gcc.c-torture/execute/pr78617.c: New test.
+
+2017-01-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-01-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79044
+ * gcc.target/powerpc/swaps-p8-26.c: New.
+
+2017-01-11 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/77812
+ * g++.dg/pr77812.C: New.
+
+2017-01-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r241334:
+ 2016-10-19 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR tree-optimization/78024
+ * gcc.dg/goacc/loop-processing-1.c: New file.
+
2017-01-09 Andre Vieira <andre.simoesdiasvieira@arm.com>
Backport from mainline
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-16.c b/gcc/testsuite/c-c++-common/Wunused-var-16.c
new file mode 100644
index 00000000000..98e66a72380
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-16.c
@@ -0,0 +1,15 @@
+/* PR c++/78949 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+typedef unsigned char V __attribute__((vector_size(16)));
+V v;
+
+void
+foo ()
+{
+ V y = {};
+ V x = {}; // { dg-bogus "set but not used" }
+ y &= ~x;
+ v = y;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71182.C b/gcc/testsuite/g++.dg/cpp0x/pr71182.C
new file mode 100644
index 00000000000..c5c0c543bca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr71182.C
@@ -0,0 +1,12 @@
+// PR c++/71182
+// { dg-do compile { target c++11 } }
+
+class A {
+ template <typename> void As();
+};
+template <typename T> class B : A {
+ void f() {
+ A *g ;
+ g ? g->As<T>() : nullptr;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78341.C b/gcc/testsuite/g++.dg/cpp0x/pr78341.C
new file mode 100644
index 00000000000..af906384098
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr78341.C
@@ -0,0 +1,4 @@
+// PR c++/78341
+// { dg-do compile { target c++11 } }
+
+alignas (alignas double // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78693.C b/gcc/testsuite/g++.dg/cpp0x/pr78693.C
new file mode 100644
index 00000000000..c937567e3f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr78693.C
@@ -0,0 +1,31 @@
+// PR c++/78693
+// { dg-do compile { target c++11 } }
+
+template <class T>
+void
+foo (T t)
+{
+ auto i = t, j = 1; // { dg-bogus "inconsistent deduction" }
+}
+
+template <class T>
+void
+bar (T t)
+{
+ auto i = 1, j = t, k = 2; // { dg-bogus "inconsistent deduction" }
+}
+
+template <class T, class U>
+void
+foo (T t, U u)
+{
+ auto i = t, j = u; // { dg-bogus "inconsistent deduction" }
+}
+
+void
+foo ()
+{
+ foo (0);
+ bar (0);
+ foo (1, 2);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for32.C b/gcc/testsuite/g++.dg/cpp0x/range-for32.C
new file mode 100644
index 00000000000..375a7073a41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for32.C
@@ -0,0 +1,16 @@
+// PR c++/77545
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-pedantic" }
+
+template < typename T > struct A
+{
+ A ();
+ ~A ();
+ T t;
+};
+
+void f (A < int > a)
+{
+ for (auto x : (A<int>[]) { a })
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for33.C b/gcc/testsuite/g++.dg/cpp0x/range-for33.C
new file mode 100644
index 00000000000..206f36e481e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for33.C
@@ -0,0 +1,14 @@
+// PR c++/77284
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+struct A
+{
+ ~A () {}
+};
+
+void foo (A & v)
+{
+ for (A a : { v }) {};
+}
diff --git a/gcc/testsuite/g++.dg/ipa/pr71207.C b/gcc/testsuite/g++.dg/ipa/pr71207.C
new file mode 100644
index 00000000000..19a03998460
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr71207.C
@@ -0,0 +1,42 @@
+/* PR ipa/71207 */
+/* { dg-do run } */
+
+class Class1
+{
+public:
+ Class1() {};
+ virtual ~Class1() {};
+
+protected:
+ unsigned Field1;
+};
+
+class Class2 : public virtual Class1
+{
+};
+
+class Class3 : public virtual Class1
+{
+public:
+ virtual void Method1() = 0;
+
+ void Method2()
+ {
+ Method1();
+ }
+};
+
+class Class4 : public Class2, public virtual Class3
+{
+public:
+ Class4() {};
+ virtual void Method1() {};
+};
+
+int main()
+{
+ Class4 var1;
+ var1.Method2();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/call2.C b/gcc/testsuite/g++.dg/opt/call2.C
new file mode 100644
index 00000000000..1b4d4b3fc6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/call2.C
@@ -0,0 +1,34 @@
+// { dg-do run }
+// { dg-options "-O" }
+
+struct Foo
+{
+ Foo() : a(1), b(1), c('a') {}
+ int a;
+ int b;
+ char c;
+};
+
+static Foo copy_foo(Foo) __attribute__((noinline, noclone));
+
+static Foo copy_foo(Foo A)
+{
+ return A;
+}
+
+struct Bar : Foo
+{
+ Bar(Foo t) : Foo(copy_foo(t)) {}
+};
+
+Foo F;
+
+int main (void)
+{
+ Bar B (F);
+
+ if (B.a != 1 || B.b != 1 || B.c != 'a')
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/call3.C b/gcc/testsuite/g++.dg/opt/call3.C
new file mode 100644
index 00000000000..9aac7e2c050
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/call3.C
@@ -0,0 +1,33 @@
+// { dg-do run }
+// { dg-options "-O" }
+
+struct Foo
+{
+ Foo() : a(1), c('a') {}
+ short int a;
+ char c;
+};
+
+static Foo copy_foo(Foo) __attribute__((noinline, noclone));
+
+static Foo copy_foo(Foo A)
+{
+ return A;
+}
+
+struct Bar : Foo
+{
+ Bar(Foo t) : Foo(copy_foo(t)) {}
+};
+
+Foo F;
+
+int main (void)
+{
+ Bar B (F);
+
+ if (B.a != 1 || B.c != 'a')
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/declone3.C b/gcc/testsuite/g++.dg/opt/declone3.C
new file mode 100644
index 00000000000..d8c24921116
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/declone3.C
@@ -0,0 +1,16 @@
+// PR c++/79176
+// { dg-do compile { target c++11 } }
+// { dg-options "-flto -Os" }
+
+struct A {};
+struct Object {
+ virtual bool m_fn1();
+ virtual ~Object();
+};
+struct Item : Object, virtual A {
+ ~Item() {
+ [] {};
+ }
+ bool m_fn1();
+};
+bool Item::m_fn1() {}
diff --git a/gcc/testsuite/g++.dg/pr77812.C b/gcc/testsuite/g++.dg/pr77812.C
new file mode 100644
index 00000000000..94f17402a4e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr77812.C
@@ -0,0 +1,18 @@
+// PR77812
+// struct-stat hack failure when first overload is a template
+
+enum f {};
+
+template <typename>
+void f ()
+{
+}
+enum f F;
+
+struct g {};
+
+template <typename>
+void g ()
+{
+}
+struct g G;
diff --git a/gcc/testsuite/g++.dg/torture/pr79034.C b/gcc/testsuite/g++.dg/torture/pr79034.C
new file mode 100644
index 00000000000..802c0aa5584
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr79034.C
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+
+extern "C" {
+ float sqrtf(float);
+}
+
+class T {
+public:
+ float floats[1];
+
+ inline float length() const {
+ return sqrtf(floats[0]);
+ }
+};
+
+void destruct(void *);
+
+class Container {
+
+ T Ts[1];
+
+public:
+ ~Container() {
+ destruct((void *)Ts);
+ }
+
+ T& operator[](int n) {
+ return Ts[0];
+ }
+};
+
+void fill(Container&);
+
+void doit()
+{
+ Container data;
+ float max = 10;
+
+ int i, j, k;
+
+ for (i = 0; i < 10; i++) {
+ for (j = 1; j < 10; j++) {
+ if (max < 5)
+ break;
+ fill( data);
+ max = data[0].length();
+ for (k = 1; k < j; k++) {
+ max = 5;
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr36648.cc b/gcc/testsuite/g++.dg/vect/pr36648.cc
index e2347d29012..84b4efbff8f 100644
--- a/gcc/testsuite/g++.dg/vect/pr36648.cc
+++ b/gcc/testsuite/g++.dg/vect/pr36648.cc
@@ -17,7 +17,12 @@ Foo foo;
int main() { }
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect_no_align } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect_no_align } } } } */
+/* On older powerpc hardware (POWER7 and earlier), the default flag
+ -mno-allow-movmisalign prevents vectorization. On POWER8 and later,
+ when vect_hw_misalign is true, vectorization occurs. For other
+ targets, ! vect_no_align is a sufficient test. */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { { { ! vect_no_align } && { ! powerpc*-*-* } } || { powerpc*-*-* && vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { { ! vect_no_align } && { ! powerpc*-*-* } } || { powerpc*-*-* && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C
index b64f0fc257a..30228756f12 100644
--- a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C
+++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C
@@ -142,10 +142,24 @@ extern "C" {
#define INC_VDATA(A,N) ((A) += 2*(N))
#endif
#else
+// HPPA uses function pointers but they point to function descriptors.
+#if defined __hppa__
+#ifdef __hpux__
+#ifdef _LP64
+#define CMP_VPTR(A, B) (*(unsigned long *)(*(A)+16) == *(unsigned long *)((unsigned long)(B)+16))
+#else
+#define CMP_VPTR(A, B) (*(A) == (ptrdiff_t)(B))
+#endif /* _LP64 */
+#else
+extern "C" { unsigned int __canonicalize_funcptr_for_compare (void*); }
+#define CMP_VPTR(A, B) (__canonicalize_funcptr_for_compare(*(void **)A) == __canonicalize_funcptr_for_compare((void *)B))
+#endif /* __hpux__ */
+#else
#define CMP_VPTR(A, B) (*(A) == (ptrdiff_t)(B))
+#endif /* __hppa__ */
#define INC_VPTR(A) ((A) += 1)
#define INC_VDATA(A,N) ((A) += (N))
-#endif
+#endif /* __ia64__ */
int main ()
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78617.c b/gcc/testsuite/gcc.c-torture/execute/pr78617.c
new file mode 100644
index 00000000000..89c4f6dea8c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78617.c
@@ -0,0 +1,25 @@
+int a = 0;
+int d = 1;
+int f = 1;
+
+int fn1() {
+ return a || 1 >> a;
+}
+
+int fn2(int p1, int p2) {
+ return p2 >= 2 ? p1 : p1 >> 1;
+}
+
+int fn3(int p1) {
+ return d ^ p1;
+}
+
+int fn4(int p1, int p2) {
+ return fn3(!d > fn2((f = fn1() - 1000) || p2, p1));
+}
+
+int main() {
+ if (fn4(0, 0) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr79043.c b/gcc/testsuite/gcc.c-torture/execute/pr79043.c
new file mode 100644
index 00000000000..b7fcc8260dc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr79043.c
@@ -0,0 +1,21 @@
+/* PR ipa/78791 */
+
+int val;
+
+int *ptr = &val;
+float *ptr2 = &val;
+
+static
+__attribute__((always_inline, optimize ("-fno-strict-aliasing")))
+typepun ()
+{
+ *ptr2=0;
+}
+
+main()
+{
+ *ptr=1;
+ typepun ();
+ if (*ptr)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c b/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c
new file mode 100644
index 00000000000..2064bcd6f29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/goacc/loop-processing-1.c
@@ -0,0 +1,18 @@
+/* Make sure that OpenACC loop processing happens. */
+/* { dg-additional-options "-O2 -fdump-tree-oaccdevlow" } */
+
+extern int place ();
+
+void vector_1 (int *ary, int size)
+{
+#pragma acc parallel num_workers (32) vector_length(32) copy(ary[0:size]) firstprivate (size)
+ {
+#pragma acc loop gang
+ for (int jx = 0; jx < 1; jx++)
+#pragma acc loop auto
+ for (int ix = 0; ix < size; ix++)
+ ary[ix] = place ();
+ }
+}
+
+/* { dg-final { scan-tree-dump "OpenACC loops.*Loop 0\\\(0\\\).*Loop 14\\\(1\\\).*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, 0, 1, 20\\\);.*Head-0:.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, 0, 1, 20\\\);.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 0\\\);.*Tail-0:.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 1\\\);.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 0\\\);.*Loop 6\\\(4\\\).*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, 0, 1, 6\\\);.*Head-0:.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, 0, 1, 6\\\);.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 2\\\);.*Tail-0:.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 1\\\);.*\\\.data_dep\\\.\[0-9_\]+ = UNIQUE \\\(\[0-9\]+, \\\.data_dep\\\.\[0-9_\]+, 2\\\);" "oaccdevlow" } } */
diff --git a/gcc/testsuite/gcc.dg/lto/pr50199_0.c b/gcc/testsuite/gcc.dg/lto/pr50199_0.c
new file mode 100644
index 00000000000..61d0012be92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr50199_0.c
@@ -0,0 +1,17 @@
+/* PR middle-end/50199 */
+/* { dg-lto-options {{-O2 -flto -fno-merge-constants --param=lto-min-partition=1}} } */
+
+__attribute__ ((noinline)) const char *
+foo (const char *x)
+{
+ return x;
+}
+
+int
+main ()
+{
+ const char *a = "ab";
+ if (a != foo (a))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
new file mode 100644
index 00000000000..2e53d4970a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
@@ -0,0 +1,8 @@
+/* PR ipa/69188 */
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+void fn1(void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_1.c b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
new file mode 100644
index 00000000000..3ed9d5560c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
@@ -0,0 +1,10 @@
+/* PR ipa/69188 */
+/* { dg-options "-flto -O1 -fprofile-generate" } */
+
+extern void fn1(void);
+
+int main() {
+ fn1();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr78742.c b/gcc/testsuite/gcc.dg/torture/pr78742.c
new file mode 100644
index 00000000000..c83ecbcb7d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr78742.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+
+void foo();
+
+void func()
+{
+ int m;
+
+ int tab[m];
+
+ __int128 j;
+ for(; j; j++)
+ {
+ tab[j] = 0;
+ tab[j+1] = 0;
+ }
+
+ foo();
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return.c b/gcc/testsuite/gcc.target/aarch64/eh_return.c
new file mode 100644
index 00000000000..32179488085
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/eh_return.c
@@ -0,0 +1,82 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int val, test, failed;
+
+int main (void);
+
+void
+eh0 (void *p)
+{
+ val = (int)(long)p & 7;
+ if (val)
+ abort ();
+}
+
+void
+eh1 (void *p, int x)
+{
+ void *q = __builtin_alloca (x);
+ eh0 (q);
+ __builtin_eh_return (0, p);
+}
+
+void
+eh2a (int a,int b,int c,int d,int e,int f,int g,int h, void *p)
+{
+ val = a + b + c + d + e + f + g + h + (int)(long)p & 7;
+}
+
+void
+eh2 (void *p)
+{
+ eh2a (val, val, val, val, val, val, val, val, p);
+ __builtin_eh_return (0, p);
+}
+
+
+void
+continuation (void)
+{
+ test++;
+ main ();
+}
+
+void
+fail (void)
+{
+ failed = 1;
+ printf ("failed\n");
+ continuation ();
+}
+
+void
+do_test1 (void)
+{
+ if (!val)
+ eh1 (continuation, 100);
+ fail ();
+}
+
+void
+do_test2 (void)
+{
+ if (!val)
+ eh2 (continuation);
+ fail ();
+}
+
+int
+main (void)
+{
+ if (test == 0)
+ do_test1 ();
+ if (test == 1)
+ do_test2 ();
+ if (failed || test != 2)
+ exit (1);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
new file mode 100644
index 00000000000..2c06ea7106a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8" } */
+
+#include <altivec.h>
+
+vector signed int
+test_vsi_packs_vsll_vsll (vector signed long long x,
+ vector signed long long y)
+{
+ return vec_packs (x, y);
+}
+
+vector unsigned int
+test_vui_packs_vull_vull (vector unsigned long long x,
+ vector unsigned long long y)
+{
+ return vec_packs (x, y);
+}
+
+/* Expected test results:
+ test_vsi_packs_vsll_vsll 1 vpksdss
+ test_vui_packs_vull_vull 1 vpkudus */
+
+/* { dg-final { scan-assembler-times "vpksdss" 1 } } */
+/* { dg-final { scan-assembler-times "vpkudus" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79268.c b/gcc/testsuite/gcc.target/powerpc/pr79268.c
new file mode 100644
index 00000000000..4624736422c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79268.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3 " } */
+
+/* Verify that vec_xl and vec_xst accept vector pixel parameters. */
+
+/* Test case to resolve PR79268. */
+
+#include <altivec.h>
+
+vector pixel a;
+
+vector pixel
+pr79268 (vector pixel *x)
+{
+ vec_xst (a, 0, x);
+ return vec_xl (0, x);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c
new file mode 100644
index 00000000000..d01d86b94eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3 " } */
+/* { dg-final { scan-assembler-times "lxvw4x" 2 } } */
+/* { dg-final { scan-assembler "stxvw4x" } } */
+/* { dg-final { scan-assembler-not "xxpermdi" } } */
+
+/* Verify that swap optimization does not interfere with element-reversing
+ loads and stores. */
+
+/* Test case to resolve PR79044. */
+
+#include <altivec.h>
+
+void pr79044 (float *x, float *y, float *z)
+{
+ vector float a = __builtin_vec_xl (0, x);
+ vector float b = __builtin_vec_xl (0, y);
+ vector float c = __builtin_vec_mul (a, b);
+ __builtin_vec_xst (c, 0, z);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
new file mode 100644
index 00000000000..832f0c7d122
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
@@ -0,0 +1,36 @@
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3 " } */
+/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
+/* { dg-final { scan-assembler-times "stxvd2x" 1 } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 3 } } */
+
+/* Verify that swap optimization works correctly for a VSX direct splat.
+ The three xxpermdi's that are generated correspond to two splats
+ and the __builtin_vsx_xxpermdi. */
+
+int printf (const char *__restrict __format, ...);
+typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
+
+double s1[] = {2134.3343, 6678.346};
+double s2[] = {41124.234, 6678.346};
+long long dd[] = {1, 2}, d[2];
+union{long long l[2]; double d[2];} e;
+
+void
+foo ()
+{
+ __m128d source1, source2, dest;
+ __m128d a, b, c;
+
+ e.d[1] = s1[1];
+ e.l[0] = !__builtin_isunordered(s1[0], s2[0])
+ && s1[0] == s2[0] ? -1 : 0;
+ source1 = __builtin_vec_vsx_ld (0, s1);
+ source2 = __builtin_vec_vsx_ld (0, s2);
+ a = __builtin_vec_splat (source1, 0);
+ b = __builtin_vec_splat (source2, 0);
+ c = (__m128d)__builtin_vec_cmpeq (a, b);
+ dest = __builtin_vsx_xxpermdi (source1, c, 1);
+ *(__m128d *)d = dest;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-1.c b/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-1.c
deleted file mode 100644
index 7ab6d446a23..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-1.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* { dg-do compile { target { powerpc64le*-*-* } } } */
-/* { dg-skip-if "do not override mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
-/* { dg-options "-mcpu=power8 -O0" } */
-/* { dg-final { scan-assembler-times "lxvd2x" 18 } } */
-/* { dg-final { scan-assembler-times "lxvw4x" 6 } } */
-/* { dg-final { scan-assembler-times "stxvd2x" 18 } } */
-/* { dg-final { scan-assembler-times "stxvw4x" 6 } } */
-/* { dg-final { scan-assembler-times "xxpermdi" 24 } } */
-
-#include <altivec.h>
-
-extern vector double vd, *vdp;
-extern vector signed long long vsll, *vsllp;
-extern vector unsigned long long vull, *vullp;
-extern vector float vf, *vfp;
-extern vector signed int vsi, *vsip;
-extern vector unsigned int vui, *vuip;
-extern double *dp;
-extern signed long long *sllp;
-extern unsigned long long *ullp;
-extern float *fp;
-extern signed int *sip;
-extern unsigned int *uip;
-
-void foo0 (void)
-{
- vd = vec_xl (0, vdp);
-}
-
-void foo1 (void)
-{
- vsll = vec_xl (0, vsllp);
-}
-
-void foo2 (void)
-{
- vull = vec_xl (0, vullp);
-}
-
-void foo3 (void)
-{
- vf = vec_xl (0, vfp);
-}
-
-void foo4 (void)
-{
- vsi = vec_xl (0, vsip);
-}
-
-void foo5 (void)
-{
- vui = vec_xl (0, vuip);
-}
-
-void foo6 (void)
-{
- vec_xst (vd, 0, vdp);
-}
-
-void foo7 (void)
-{
- vec_xst (vsll, 0, vsllp);
-}
-
-void foo8 (void)
-{
- vec_xst (vull, 0, vullp);
-}
-
-void foo9 (void)
-{
- vec_xst (vf, 0, vfp);
-}
-
-void foo10 (void)
-{
- vec_xst (vsi, 0, vsip);
-}
-
-void foo11 (void)
-{
- vec_xst (vui, 0, vuip);
-}
-
-void foo20 (void)
-{
- vd = vec_xl (0, dp);
-}
-
-void foo21 (void)
-{
- vsll = vec_xl (0, sllp);
-}
-
-void foo22 (void)
-{
- vull = vec_xl (0, ullp);
-}
-
-void foo23 (void)
-{
- vf = vec_xl (0, fp);
-}
-
-void foo24 (void)
-{
- vsi = vec_xl (0, sip);
-}
-
-void foo25 (void)
-{
- vui = vec_xl (0, uip);
-}
-
-void foo26 (void)
-{
- vec_xst (vd, 0, dp);
-}
-
-void foo27 (void)
-{
- vec_xst (vsll, 0, sllp);
-}
-
-void foo28 (void)
-{
- vec_xst (vull, 0, ullp);
-}
-
-void foo29 (void)
-{
- vec_xst (vf, 0, fp);
-}
-
-void foo30 (void)
-{
- vec_xst (vsi, 0, sip);
-}
-
-void foo31 (void)
-{
- vec_xst (vui, 0, uip);
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-2.c b/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-2.c
deleted file mode 100644
index eb4a13081a2..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-2.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* { dg-do compile { target { powerpc64le*-*-* } } } */
-/* { dg-skip-if "do not override mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
-/* { dg-options "-mcpu=power9 -O0" } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } { "*" } { "" } } */
-/* { dg-final { scan-assembler-times "lxvd2x" 6 } } */
-/* { dg-final { scan-assembler-times "lxvw4x" 6 } } */
-/* { dg-final { scan-assembler-times "lxvh8x" 4 } } */
-/* { dg-final { scan-assembler-times "lxvb16x" 4 } } */
-/* { dg-final { scan-assembler-times "stxvd2x" 6 } } */
-/* { dg-final { scan-assembler-times "stxvw4x" 6 } } */
-/* { dg-final { scan-assembler-times "stxvh8x" 4 } } */
-/* { dg-final { scan-assembler-times "stxvb16x" 4 } } */
-
-#include <altivec.h>
-
-extern vector double vd, *vdp;
-extern vector signed long long vsll, *vsllp;
-extern vector unsigned long long vull, *vullp;
-extern vector float vf, *vfp;
-extern vector signed int vsi, *vsip;
-extern vector unsigned int vui, *vuip;
-extern vector signed short vss, *vssp;
-extern vector unsigned short vus, *vusp;
-extern vector signed char vsc, *vscp;
-extern vector unsigned char vuc, *vucp;
-extern double *dp;
-extern signed long long *sllp;
-extern unsigned long long *ullp;
-extern float *fp;
-extern signed int *sip;
-extern unsigned int *uip;
-extern signed short *ssp;
-extern unsigned short *usp;
-extern signed char *scp;
-extern unsigned char *ucp;
-
-void foo0 (void)
-{
- vd = vec_xl (0, vdp);
-}
-
-void foo1 (void)
-{
- vsll = vec_xl (0, vsllp);
-}
-
-void foo2 (void)
-{
- vull = vec_xl (0, vullp);
-}
-
-void foo3 (void)
-{
- vf = vec_xl (0, vfp);
-}
-
-void foo4 (void)
-{
- vsi = vec_xl (0, vsip);
-}
-
-void foo5 (void)
-{
- vui = vec_xl (0, vuip);
-}
-
-void foo6 (void)
-{
- vss = vec_xl (0, vssp);
-}
-
-void foo7 (void)
-{
- vus = vec_xl (0, vusp);
-}
-
-void foo8 (void)
-{
- vsc = vec_xl (0, vscp);
-}
-
-void foo9 (void)
-{
- vuc = vec_xl (0, vucp);
-}
-
-void foo10 (void)
-{
- vec_xst (vd, 0, vdp);
-}
-
-void foo11 (void)
-{
- vec_xst (vsll, 0, vsllp);
-}
-
-void foo12 (void)
-{
- vec_xst (vull, 0, vullp);
-}
-
-void foo13 (void)
-{
- vec_xst (vf, 0, vfp);
-}
-
-void foo14 (void)
-{
- vec_xst (vsi, 0, vsip);
-}
-
-void foo15 (void)
-{
- vec_xst (vui, 0, vuip);
-}
-
-void foo16 (void)
-{
- vec_xst (vss, 0, vssp);
-}
-
-void foo17 (void)
-{
- vec_xst (vus, 0, vusp);
-}
-
-void foo18 (void)
-{
- vec_xst (vsc, 0, vscp);
-}
-
-void foo19 (void)
-{
- vec_xst (vuc, 0, vucp);
-}
-
-void foo20 (void)
-{
- vd = vec_xl (0, dp);
-}
-
-void foo21 (void)
-{
- vsll = vec_xl (0, sllp);
-}
-
-void foo22 (void)
-{
- vull = vec_xl (0, ullp);
-}
-
-void foo23 (void)
-{
- vf = vec_xl (0, fp);
-}
-
-void foo24 (void)
-{
- vsi = vec_xl (0, sip);
-}
-
-void foo25 (void)
-{
- vui = vec_xl (0, uip);
-}
-
-void foo26 (void)
-{
- vss = vec_xl (0, ssp);
-}
-
-void foo27 (void)
-{
- vus = vec_xl (0, usp);
-}
-
-void foo28 (void)
-{
- vsc = vec_xl (0, scp);
-}
-
-void foo29 (void)
-{
- vuc = vec_xl (0, ucp);
-}
-
-void foo30 (void)
-{
- vec_xst (vd, 0, dp);
-}
-
-void foo31 (void)
-{
- vec_xst (vsll, 0, sllp);
-}
-
-void foo32 (void)
-{
- vec_xst (vull, 0, ullp);
-}
-
-void foo33 (void)
-{
- vec_xst (vf, 0, fp);
-}
-
-void foo34 (void)
-{
- vec_xst (vsi, 0, sip);
-}
-
-void foo35 (void)
-{
- vec_xst (vui, 0, uip);
-}
-
-void foo36 (void)
-{
- vec_xst (vss, 0, ssp);
-}
-
-void foo37 (void)
-{
- vec_xst (vus, 0, usp);
-}
-
-void foo38 (void)
-{
- vec_xst (vsc, 0, scp);
-}
-
-void foo39 (void)
-{
- vec_xst (vuc, 0, ucp);
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-3.c
deleted file mode 100644
index 2888c171c4f..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-3.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* { dg-do compile { target { powerpc64-*-* } } } */
-/* { dg-skip-if "do not override mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
-/* { dg-options "-mcpu=power8 -O0" } */
-/* { dg-final { scan-assembler-times "lxvd2x" 16 } } */
-/* { dg-final { scan-assembler-times "lxvw4x" 8 } } */
-/* { dg-final { scan-assembler-times "stxvd2x" 16 } } */
-/* { dg-final { scan-assembler-times "stxvw4x" 8 } } */
-
-#include <altivec.h>
-
-extern vector double vd, *vdp;
-extern vector signed long long vsll, *vsllp;
-extern vector unsigned long long vull, *vullp;
-extern vector float vf, *vfp;
-extern vector signed int vsi, *vsip;
-extern vector unsigned int vui, *vuip;
-extern double *dp;
-extern signed long long *sllp;
-extern unsigned long long *ullp;
-extern float *fp;
-extern signed int *sip;
-extern unsigned int *uip;
-
-void foo0 (void)
-{
- vd = vec_xl (0, vdp);
-}
-
-void foo1 (void)
-{
- vsll = vec_xl (0, vsllp);
-}
-
-void foo2 (void)
-{
- vull = vec_xl (0, vullp);
-}
-
-void foo3 (void)
-{
- vf = vec_xl (0, vfp);
-}
-
-void foo4 (void)
-{
- vsi = vec_xl (0, vsip);
-}
-
-void foo5 (void)
-{
- vui = vec_xl (0, vuip);
-}
-
-void foo6 (void)
-{
- vec_xst (vd, 0, vdp);
-}
-
-void foo7 (void)
-{
- vec_xst (vsll, 0, vsllp);
-}
-
-void foo8 (void)
-{
- vec_xst (vull, 0, vullp);
-}
-
-void foo9 (void)
-{
- vec_xst (vf, 0, vfp);
-}
-
-void foo10 (void)
-{
- vec_xst (vsi, 0, vsip);
-}
-
-void foo11 (void)
-{
- vec_xst (vui, 0, vuip);
-}
-
-void foo20 (void)
-{
- vd = vec_xl (0, dp);
-}
-
-void foo21 (void)
-{
- vsll = vec_xl (0, sllp);
-}
-
-void foo22 (void)
-{
- vull = vec_xl (0, ullp);
-}
-
-void foo23 (void)
-{
- vf = vec_xl (0, fp);
-}
-
-void foo24 (void)
-{
- vsi = vec_xl (0, sip);
-}
-
-void foo25 (void)
-{
- vui = vec_xl (0, uip);
-}
-
-void foo26 (void)
-{
- vec_xst (vd, 0, dp);
-}
-
-void foo27 (void)
-{
- vec_xst (vsll, 0, sllp);
-}
-
-void foo28 (void)
-{
- vec_xst (vull, 0, ullp);
-}
-
-void foo29 (void)
-{
- vec_xst (vf, 0, fp);
-}
-
-void foo30 (void)
-{
- vec_xst (vsi, 0, sip);
-}
-
-void foo31 (void)
-{
- vec_xst (vui, 0, uip);
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-4.c b/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-4.c
deleted file mode 100644
index a116316c174..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/vsx-elemrev-4.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* { dg-do compile { target { powerpc64-*-* } } } */
-/* { dg-skip-if "do not override mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
-/* { dg-options "-mcpu=power9 -O0" } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } { "*" } { "" } } */
-/* { dg-final { scan-assembler-times "lxvx" 40 } } */
-/* { dg-final { scan-assembler-times "stxvx" 40 } } */
-
-#include <altivec.h>
-
-extern vector double vd, *vdp;
-extern vector signed long long vsll, *vsllp;
-extern vector unsigned long long vull, *vullp;
-extern vector float vf, *vfp;
-extern vector signed int vsi, *vsip;
-extern vector unsigned int vui, *vuip;
-extern vector signed short vss, *vssp;
-extern vector unsigned short vus, *vusp;
-extern vector signed char vsc, *vscp;
-extern vector unsigned char vuc, *vucp;
-extern double *dp;
-extern signed long long *sllp;
-extern unsigned long long *ullp;
-extern float *fp;
-extern signed int *sip;
-extern unsigned int *uip;
-extern signed short *ssp;
-extern unsigned short *usp;
-extern signed char *scp;
-extern unsigned char *ucp;
-
-void foo0 (void)
-{
- vd = vec_xl (0, vdp);
-}
-
-void foo1 (void)
-{
- vsll = vec_xl (0, vsllp);
-}
-
-void foo2 (void)
-{
- vull = vec_xl (0, vullp);
-}
-
-void foo3 (void)
-{
- vf = vec_xl (0, vfp);
-}
-
-void foo4 (void)
-{
- vsi = vec_xl (0, vsip);
-}
-
-void foo5 (void)
-{
- vui = vec_xl (0, vuip);
-}
-
-void foo6 (void)
-{
- vss = vec_xl (0, vssp);
-}
-
-void foo7 (void)
-{
- vus = vec_xl (0, vusp);
-}
-
-void foo8 (void)
-{
- vsc = vec_xl (0, vscp);
-}
-
-void foo9 (void)
-{
- vuc = vec_xl (0, vucp);
-}
-
-void foo10 (void)
-{
- vec_xst (vd, 0, vdp);
-}
-
-void foo11 (void)
-{
- vec_xst (vsll, 0, vsllp);
-}
-
-void foo12 (void)
-{
- vec_xst (vull, 0, vullp);
-}
-
-void foo13 (void)
-{
- vec_xst (vf, 0, vfp);
-}
-
-void foo14 (void)
-{
- vec_xst (vsi, 0, vsip);
-}
-
-void foo15 (void)
-{
- vec_xst (vui, 0, vuip);
-}
-
-void foo16 (void)
-{
- vec_xst (vss, 0, vssp);
-}
-
-void foo17 (void)
-{
- vec_xst (vus, 0, vusp);
-}
-
-void foo18 (void)
-{
- vec_xst (vsc, 0, vscp);
-}
-
-void foo19 (void)
-{
- vec_xst (vuc, 0, vucp);
-}
-
-void foo20 (void)
-{
- vd = vec_xl (0, dp);
-}
-
-void foo21 (void)
-{
- vsll = vec_xl (0, sllp);
-}
-
-void foo22 (void)
-{
- vull = vec_xl (0, ullp);
-}
-
-void foo23 (void)
-{
- vf = vec_xl (0, fp);
-}
-
-void foo24 (void)
-{
- vsi = vec_xl (0, sip);
-}
-
-void foo25 (void)
-{
- vui = vec_xl (0, uip);
-}
-
-void foo26 (void)
-{
- vss = vec_xl (0, ssp);
-}
-
-void foo27 (void)
-{
- vus = vec_xl (0, usp);
-}
-
-void foo28 (void)
-{
- vsc = vec_xl (0, scp);
-}
-
-void foo29 (void)
-{
- vuc = vec_xl (0, ucp);
-}
-
-void foo30 (void)
-{
- vec_xst (vd, 0, dp);
-}
-
-void foo31 (void)
-{
- vec_xst (vsll, 0, sllp);
-}
-
-void foo32 (void)
-{
- vec_xst (vull, 0, ullp);
-}
-
-void foo33 (void)
-{
- vec_xst (vf, 0, fp);
-}
-
-void foo34 (void)
-{
- vec_xst (vsi, 0, sip);
-}
-
-void foo35 (void)
-{
- vec_xst (vui, 0, uip);
-}
-
-void foo36 (void)
-{
- vec_xst (vss, 0, ssp);
-}
-
-void foo37 (void)
-{
- vec_xst (vus, 0, usp);
-}
-
-void foo38 (void)
-{
- vec_xst (vsc, 0, scp);
-}
-
-void foo39 (void)
-{
- vec_xst (vuc, 0, ucp);
-}
diff --git a/gcc/testsuite/gfortran.dg/coarray/event_3.f08 b/gcc/testsuite/gfortran.dg/coarray/event_3.f08
new file mode 100644
index 00000000000..f6e28b78c8d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/event_3.f08
@@ -0,0 +1,20 @@
+! { dg-do run }
+!
+! Check PR fortran/70696 is fixed.
+
+program global_event
+ use iso_fortran_env , only : event_type
+ implicit none
+ type(event_type) :: x[*]
+
+ call exchange
+ contains
+ subroutine exchange
+ integer :: cnt
+ event post(x[1])
+ event post(x[1])
+ call event_query(x, cnt)
+ if (cnt /= 2) error stop 1
+ event wait(x, until_count=2)
+ end subroutine
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray/event_4.f08 b/gcc/testsuite/gfortran.dg/coarray/event_4.f08
new file mode 100644
index 00000000000..de901c01aa4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/event_4.f08
@@ -0,0 +1,12 @@
+! { dg-do run }
+!
+! Check that pr 70697 is fixed.
+
+program event_4
+ use iso_fortran_env
+ integer :: nc(1)
+ type(event_type) done[*]
+ nc(1) = 1
+ event post(done[1])
+ event wait(done,until_count=nc(1))
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray_43.f90 b/gcc/testsuite/gfortran.dg/coarray_43.f90
new file mode 100644
index 00000000000..d5ee4e1a668
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_43.f90
@@ -0,0 +1,13 @@
+! { dg-do link }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+
+program coarray_43
+ implicit none
+ integer, parameter :: STR_LEN = 50
+ character(len=STR_LEN) :: str[*]
+ integer :: pos
+ write(str,"(2(a,i2))") "Greetings from image ",this_image()," of ",num_images()
+ block
+ pos = scan(str[5], set="123456789")
+ end block
+end program
diff --git a/gcc/testsuite/gfortran.dg/coarray_event_1.f08 b/gcc/testsuite/gfortran.dg/coarray_event_1.f08
new file mode 100644
index 00000000000..51fc54c162a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_event_1.f08
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+
+! Check that pr70696 is really fixed.
+
+ use iso_fortran_env
+ type(event_type) :: x[*]
+
+ ! exchange must not be called or the link problem before the patch
+ ! does not occur.
+contains
+ subroutine exchange
+ event post (x[1])
+ end subroutine
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-1.f90 b/gcc/testsuite/gfortran.dg/gomp/map-1.f90
index e4b8b862afd..e78b56c8f39 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-1.f90
@@ -70,7 +70,7 @@ subroutine test(aas)
! { dg-error "Rightmost upper bound of assumed size array section not specified" "" { target *-*-* } 68 }
! { dg-error "'aas' in MAP clause at \\\(1\\\) is not a proper array section" "" { target *-*-* } 68 }
- !$omp target map(aas) ! { dg-error "The upper bound in the last dimension must appear" "" { xfail *-*-* } }
+ !$omp target map(aas) ! { dg-error "Assumed size array" }
!$omp end target
!$omp target map(aas(5:7))
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90
new file mode 100644
index 00000000000..63a0be763cb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90
@@ -0,0 +1,19 @@
+! PR fortran/78866
+! { dg-do compile }
+
+subroutine pr78866(x)
+ integer :: x(*)
+!$omp target map(x) ! { dg-error "Assumed size array" }
+ x(1) = 1
+!$omp end target
+!$omp target data map(tofrom: x) ! { dg-error "Assumed size array" }
+!$omp target update to(x) ! { dg-error "Assumed size array" }
+!$omp target update from(x) ! { dg-error "Assumed size array" }
+!$omp end target data
+!$omp target map(x(:23)) ! { dg-bogus "Assumed size array" }
+ x(1) = 1
+!$omp end target
+!$omp target map(x(:)) ! { dg-error "upper bound of assumed size array section" }
+ x(1) = 1 ! { dg-error "not a proper array section" "" { target *-*-* } .-1 }
+!$omp end target
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90 b/gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90
new file mode 100644
index 00000000000..033479e5801
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90
@@ -0,0 +1,9 @@
+! PR fortran/78866
+! { dg-do compile }
+
+subroutine pr78866(x)
+ integer :: x(*)
+!$omp target ! { dg-error "implicit mapping of assumed size array" }
+ x(1) = 1
+!$omp end target
+end
diff --git a/gcc/testsuite/gnat.dg/array26.adb b/gcc/testsuite/gnat.dg/array26.adb
new file mode 100644
index 00000000000..659d596fc1e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array26.adb
@@ -0,0 +1,22 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Array26_Pkg; use Array26_Pkg;
+
+procedure Array26 is
+
+ function Get return Outer_type is
+ Ret : Outer_Type;
+ begin
+ Ret (Inner_Type'Range) := F;
+ return Ret;
+ end;
+
+ A : Outer_Type := Get;
+ B : Inner_Type := A (Inner_Type'Range);
+
+begin
+ if B /= "123" then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/array26_pkg.adb b/gcc/testsuite/gnat.dg/array26_pkg.adb
new file mode 100644
index 00000000000..f324bd2ce52
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array26_pkg.adb
@@ -0,0 +1,8 @@
+package body Array26_Pkg is
+
+ function F return Inner_Type is
+ begin
+ return "123";
+ end;
+
+end Array26_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array26_pkg.ads b/gcc/testsuite/gnat.dg/array26_pkg.ads
new file mode 100644
index 00000000000..ae84a74725c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array26_pkg.ads
@@ -0,0 +1,8 @@
+package Array26_Pkg is
+
+ subtype Outer_Type is String (1 .. 4);
+ subtype Inner_Type is String (1 .. 3);
+
+ function F return Inner_Type;
+
+end Array26_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array27.adb b/gcc/testsuite/gnat.dg/array27.adb
new file mode 100644
index 00000000000..db821c5f82d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array27.adb
@@ -0,0 +1,22 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Array27_Pkg; use Array27_Pkg;
+
+procedure Array27 is
+
+ function Get return Outer_type is
+ Ret : Outer_Type;
+ begin
+ Ret (Inner_Type'Range) := F;
+ return Ret;
+ end;
+
+ A : Outer_Type := Get;
+ B : Inner_Type := A (Inner_Type'Range);
+
+begin
+ if B /= "123" then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/array27_pkg.adb b/gcc/testsuite/gnat.dg/array27_pkg.adb
new file mode 100644
index 00000000000..92c61b94a32
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array27_pkg.adb
@@ -0,0 +1,8 @@
+package body Array27_Pkg is
+
+ function F return Inner_Type is
+ begin
+ return "123";
+ end;
+
+end Array27_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array27_pkg.ads b/gcc/testsuite/gnat.dg/array27_pkg.ads
new file mode 100644
index 00000000000..1473fbb4462
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array27_pkg.ads
@@ -0,0 +1,8 @@
+package Array27_Pkg is
+
+ subtype Outer_Type is String (1 .. 8);
+ subtype Inner_Type is String (1 .. 3);
+
+ function F return Inner_Type;
+
+end Array27_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array28.adb b/gcc/testsuite/gnat.dg/array28.adb
new file mode 100644
index 00000000000..aa31445d37d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array28.adb
@@ -0,0 +1,22 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Array28_Pkg; use Array28_Pkg;
+
+procedure Array28 is
+
+ function Get return Outer_type is
+ Ret : Outer_Type;
+ begin
+ Ret (Inner_Type'Range) := F;
+ return Ret;
+ end;
+
+ A : Outer_Type := Get;
+ B : Inner_Type := A (Inner_Type'Range);
+
+begin
+ if B /= "12345" then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/array28_pkg.adb b/gcc/testsuite/gnat.dg/array28_pkg.adb
new file mode 100644
index 00000000000..726810b80f7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array28_pkg.adb
@@ -0,0 +1,8 @@
+package body Array28_Pkg is
+
+ function F return Inner_Type is
+ begin
+ return "12345";
+ end;
+
+end Array28_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array28_pkg.ads b/gcc/testsuite/gnat.dg/array28_pkg.ads
new file mode 100644
index 00000000000..6189010baf9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array28_pkg.ads
@@ -0,0 +1,8 @@
+package Array28_Pkg is
+
+ subtype Outer_Type is String (1 .. 8);
+ subtype Inner_Type is String (1 .. 5);
+
+ function F return Inner_Type;
+
+end Array28_Pkg;
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 6bbe0c36611..a7fa3cdb908 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -805,7 +805,18 @@ shrink_wrap_one_built_in_call_with_conds (gcall *bi_call, vec <gimple *> conds,
if (EDGE_COUNT (join_tgt_in_edge_from_call->dest->preds) > 1)
join_tgt_bb = split_edge (join_tgt_in_edge_from_call);
else
- join_tgt_bb = join_tgt_in_edge_from_call->dest;
+ {
+ join_tgt_bb = join_tgt_in_edge_from_call->dest;
+ /* We may have degenerate PHIs in the destination. Propagate
+ those out. */
+ for (gphi_iterator i = gsi_start_phis (join_tgt_bb); !gsi_end_p (i);)
+ {
+ gphi *phi = i.phi ();
+ replace_uses_by (gimple_phi_result (phi),
+ gimple_phi_arg_def (phi, 0));
+ remove_phi_node (&i, true);
+ }
+ }
}
else
{
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index f321fdda53e..0bb01f16259 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2112,8 +2112,6 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult)
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
- gcc_assert (TREE_CODE (CHREC_RIGHT (chrec)) == INTEGER_CST);
-
A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 1f3a726988a..25db6489188 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -93,8 +93,6 @@ init_ic_make_global_vars (void)
if (targetm.have_tls)
set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var));
- varpool_node::finalize_decl (ic_void_ptr_var);
-
gcov_type_ptr = build_pointer_type (get_gcov_type ());
ic_gcov_type_ptr_var
@@ -111,8 +109,6 @@ init_ic_make_global_vars (void)
DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
if (targetm.have_tls)
set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var));
-
- varpool_node::finalize_decl (ic_gcov_type_ptr_var);
}
/* Create the type and function decls for the interface with gcov. */
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index b4b63a97d31..2e5b15432a0 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4755,6 +4755,7 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
walker.walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
if (walker.fail)
{
+ scc_vn_restore_ssa_info ();
free_scc_vn ();
return false;
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 4033c9c7e0e..8ce43d05842 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7076,8 +7076,7 @@ vrp_valueize_1 (tree name)
static enum ssa_prop_result
vrp_visit_assignment_or_call (gimple *stmt, tree *output_p)
{
- tree def, lhs;
- ssa_op_iter iter;
+ tree lhs;
enum gimple_code code = gimple_code (stmt);
lhs = gimple_get_lhs (stmt);
@@ -7194,8 +7193,7 @@ vrp_visit_assignment_or_call (gimple *stmt, tree *output_p)
}
/* Every other statement produces no useful ranges. */
- FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF)
- set_value_range_to_varying (get_value_range (def));
+ set_defs_to_varying (stmt);
return SSA_PROP_VARYING;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 5c9f6f42140..7ce14c93663 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1675,13 +1675,8 @@ build_low_bits_mask (tree type, unsigned bits)
bool
cst_and_fits_in_hwi (const_tree x)
{
- if (TREE_CODE (x) != INTEGER_CST)
- return false;
-
- if (TYPE_PRECISION (TREE_TYPE (x)) > HOST_BITS_PER_WIDE_INT)
- return false;
-
- return TREE_INT_CST_NUNITS (x) == 1;
+ return (TREE_CODE (x) == INTEGER_CST
+ && (tree_fits_shwi_p (x) || tree_fits_uhwi_p (x)));
}
/* Build a newly constructed VECTOR_CST node of length LEN. */
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 56637d8f0a9..109382498fd 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -1471,7 +1471,7 @@ ubsan_use_new_style_p (location_t loc)
expanded_location xloc = expand_location (loc);
if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
- || xloc.file == '\0' || xloc.file[0] == '\xff'
+ || xloc.file[0] == '\0' || xloc.file[0] == '\xff'
|| xloc.file[1] == '\xff')
return false;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 8e5e308c7dd..48568ef1ce3 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-09 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backport from mainline
+ 2016-10-10 Andreas Tobler <andreast@gcc.gnu.org>
+
+ * config.host: Add support for aarch64-*-freebsd*.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 66cef90d4b2..518210d0447 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,18 @@
+2017-01-31 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/79305
+ * c99_protos.h: Spell HAVE_EXPL correctly.
+ * intrinsics/c99_functions.c: Ditto.
+
+2017-01-24 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/78478
+ * acinclude.m4: Include ../config/ax_check_define.m4
+ * configure.ac: Check if _SOFT_FLOAT is defined.
+ * configure.host (i?86 | x86_64): Use fpu-generic when
+ have_soft_float is set.
+ * configure: Regenerate.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
@@ -13,14 +28,14 @@
Backport from trunk
PR libgfortran/77707
- io/transfer.c (next_record): Flush before calculating next_record.
+ * io/transfer.c (next_record): Flush before calculating next_record.
Correctly calculate.
2016-09-28 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from trunk
PR fortran/77507
- * ieee/ieee_arithmetic.F90 (IEEE_VALUE_4,IEEE_VALUE_8,IEEE_VALULE_10,
+ * ieee/ieee_arithmetic.F90 (IEEE_VALUE_4,IEEE_VALUE_8,IEEE_VALULE_10,
IEEE_VALUE_16): Use correct keyword.
2016-08-22 Release Manager
@@ -82,9 +97,10 @@
(read_logical): If '!' bang encountered when not in namelist mode got
bad_logical to give an error. (read_integer): Likewise reject '!'.
(read_character): Remove condition testing c = '!' which is now inside
- the is_separator macro. (parse_real): Reject '!' unless in namelist mode.
- (read_complex): Reject '!' unless in namelist mode. (read_real): Likewise
- reject '!'.
+ the is_separator macro. (parse_real): Reject '!' unless in
+ namelist mode.
+ (read_complex): Reject '!' unless in namelist mode.
+ (read_real): Likewise reject '!'.
2016-02-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index 7280bc37a0b..1b20d10c9f4 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -1,6 +1,7 @@
m4_include(../config/acx.m4)
m4_include(../config/no-executables.m4)
m4_include(../config/math.m4)
+m4_include(../config/ax_check_define.m4)
dnl Check that we have a working GNU Fortran compiler
AC_DEFUN([LIBGFOR_WORKING_GFORTRAN], [
diff --git a/libgfortran/c99_protos.h b/libgfortran/c99_protos.h
index e28d421c13c..396c20e08aa 100644
--- a/libgfortran/c99_protos.h
+++ b/libgfortran/c99_protos.h
@@ -332,7 +332,7 @@ extern float complex cexpf (float complex);
extern double complex cexp (double complex);
#endif
-#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) && defined(EXPL)
+#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) && defined(HAVE_EXPL)
#define HAVE_CEXPL 1
extern long double complex cexpl (long double complex);
#endif
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index f726537e788..b4b655eb7b6 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -101,9 +101,12 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
void *local;
if (type == CAF_REGTYPE_LOCK_STATIC || type == CAF_REGTYPE_LOCK_ALLOC
- || type == CAF_REGTYPE_CRITICAL || type == CAF_REGTYPE_EVENT_STATIC
- || type == CAF_REGTYPE_EVENT_ALLOC)
- local = calloc (size, sizeof (bool));
+ || type == CAF_REGTYPE_CRITICAL)
+ local = calloc (size, sizeof (bool));
+ else if (type == CAF_REGTYPE_EVENT_STATIC || type == CAF_REGTYPE_EVENT_ALLOC)
+ /* In the event_(wait|post) function the counter for events is a uint32,
+ so better allocate enough memory here. */
+ local = calloc (size, sizeof (uint32_t));
else
local = malloc (size);
*token = malloc (sizeof (single_token_t));
diff --git a/libgfortran/configure b/libgfortran/configure
index f746f6f5d1d..db607eb5954 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -10308,7 +10308,7 @@ _LT_EOF
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
@@ -14157,7 +14157,7 @@ _LT_EOF
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds_FC='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
- export_symbols_cmds_FC='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ export_symbols_cmds_FC='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
@@ -25762,6 +25762,43 @@ $as_echo "#define HAVE_FP_ENABLE 1" >>confdefs.h
fi
+# Check if _SOFT_FLOAT is defined
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SOFT_FLOAT defined" >&5
+$as_echo_n "checking for _SOFT_FLOAT defined... " >&6; }
+if test "${ac_cv_defined__SOFT_FLOAT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ #ifdef _SOFT_FLOAT
+ int ok;
+ #else
+ choke me
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_defined__SOFT_FLOAT=yes
+else
+ ac_cv_defined__SOFT_FLOAT=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_defined__SOFT_FLOAT" >&5
+$as_echo "$ac_cv_defined__SOFT_FLOAT" >&6; }
+if test $ac_cv_defined__SOFT_FLOAT != "no"; then :
+ have_soft_float=yes
+fi
+
# Runs configure.host to set up necessary host-dependent shell variables.
# We then display a message about it, and propagate them through the
# build chain.
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8f377bb4b50..5a264942b6d 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -551,6 +551,9 @@ AC_CHECK_FUNC([fpresetsticky],[have_fpresetsticky=yes AC_DEFINE([HAVE_FPRESETSTI
AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
+# Check if _SOFT_FLOAT is defined
+AC_CHECK_DEFINE([_SOFT_FLOAT],[have_soft_float=yes])
+
# Runs configure.host to set up necessary host-dependent shell variables.
# We then display a message about it, and propagate them through the
# build chain.
diff --git a/libgfortran/configure.host b/libgfortran/configure.host
index 0a12a32fc8a..5824f253e2f 100644
--- a/libgfortran/configure.host
+++ b/libgfortran/configure.host
@@ -40,7 +40,11 @@ fi
# the x86 denormal exception.
case "${host_cpu}" in
i?86 | x86_64)
- fpu_host='fpu-387'
+ if test "x${have_soft_float}" = "xyes"; then
+ fpu_host='fpu-generic'
+ else
+ fpu_host='fpu-387'
+ fi
ieee_support='yes'
;;
esac
diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c
index daafda9bd21..410bb67e5cb 100644
--- a/libgfortran/intrinsics/c99_functions.c
+++ b/libgfortran/intrinsics/c99_functions.c
@@ -913,7 +913,7 @@ cexp (double complex z)
}
#endif
-#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) && defined(EXPL)
+#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) && defined(HAVE_EXPL)
#define HAVE_CEXPL 1
long double complex cexpl (long double complex z);
diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c
index ce82fcd4070..21ff63f4f3a 100644
--- a/libgo/runtime/go-unsafe-pointer.c
+++ b/libgo/runtime/go-unsafe-pointer.c
@@ -36,7 +36,8 @@ static const String reflection_string =
sizeof REFLECTION - 1
};
-const uintptr unsafe_Pointer_gc[] = {sizeof(void*), GC_APTR, 0, GC_END};
+const uintptr unsafe_Pointer_gc[] __attribute__((aligned(4))) =
+ {sizeof(void*), GC_APTR, 0, GC_END};
const struct __go_type_descriptor unsafe_Pointer =
{
diff --git a/libgo/runtime/parfor.c b/libgo/runtime/parfor.c
index ede921b9aaa..1e67f3aaa87 100644
--- a/libgo/runtime/parfor.c
+++ b/libgo/runtime/parfor.c
@@ -10,7 +10,7 @@
struct ParForThread
{
// the thread's iteration space [32lsb, 32msb)
- uint64 pos;
+ uint64 pos __attribute__((aligned(8)));
// stats
uint64 nsteal;
uint64 nstealcnt;
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 73c46e9117f..1cca43a1f5c 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -154,14 +154,14 @@ struct Lock
// Futex-based impl treats it as uint32 key,
// while sema-based impl as M* waitm.
// Used to be a union, but unions break precise GC.
- uintptr key;
+ uintptr key __attribute__((aligned(4)));
};
struct Note
{
// Futex-based impl treats it as uint32 key,
// while sema-based impl as M* waitm.
// Used to be a union, but unions break precise GC.
- uintptr key;
+ uintptr key __attribute__((aligned(4)));
};
struct String
{
@@ -431,7 +431,7 @@ struct ParFor
// otherwise parfor may return while other threads are still working
ParForThread *thr; // array of thread descriptors
// stats
- uint64 nsteal;
+ uint64 nsteal __attribute__((aligned(8))); // force alignment for m68k
uint64 nstealcnt;
uint64 nprocyield;
uint64 nosyield;
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 8841636cb46..2e5f73b6355 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,16 @@
+2017-01-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport trunk r239125:
+ 2016-08-04 Thomas Schwinge <thomas@codesourcery.com>
+
+ * testsuite/libgomp.oacc-c-c++-common/crash-1.c: Make it a "link"
+ test, and don't hardcode -O0.
+
+ Backport trunk r239086:
+ 2016-08-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * testsuite/libgomp.oacc-c-c++-common/crash-1.c: New.
+
2016-12-21 Release Manager
* GCC 6.3.0 released.
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/crash-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/crash-1.c
new file mode 100644
index 00000000000..dcf1485e499
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/crash-1.c
@@ -0,0 +1,27 @@
+/* { dg-do link } */
+
+/* For -O0, ICEd in nvptx backend due to unexpected frame size. */
+#pragma acc routine worker
+void
+worker_matmul (int *c, int i)
+{
+ int j;
+
+#pragma acc loop
+ for (j = 0; j < 4; j++)
+ c[j] = j;
+}
+
+
+int
+main ()
+{
+ int c[4];
+
+#pragma acc parallel
+ {
+ worker_matmul (c, 0);
+ }
+
+ return 0;
+}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 61aea40ca75..8785436171c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,71 @@
+2017-02-01 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/78346
+ * include/bits/predefined_ops.h (_Iter_equals_iter): Store iterator
+ not its referent.
+ (_Iter_comp_to_iter): Likewise.
+ * testsuite/25_algorithms/search/78346.cc: New test.
+
+ PR libstdc++/79195
+ * include/experimental/array (make_array): Use common_type<_Dest>
+ and delay instantiation of common_type until after conditional_t.
+ Qualify std::forward call.
+ (to_array): Add exception specification.
+ * testsuite/experimental/array/make_array.cc: Test argument types
+ without a common type.
+
+ PR libstdc++/79254
+ * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
+ (basic_string::operator=(const basic_string&)): If source object is
+ small just deallocate, otherwise perform new allocation before
+ making any changes.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
+ Test exception-safety of copy assignment when allocator propagates.
+ * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
+ Likewise.
+ * testsuite/util/testsuite_allocator.h (uneq_allocator::swap): Make
+ std::swap visible.
+
+2017-01-22 Gerald Pfeifer <gerald@pfeifer.com>
+
+ Backport from mainline
+ 2017-01-01 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * doc/xml/faq.xml: Update address of C++ ABI link.
+ * doc/xml/manual/abi.xml: Ditto.
+
+2017-01-16 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2017-01-16 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/78389
+ * include/bits/list.tcc (merge(list&&)): Fix backwards size adjustments.
+ (merge(list&&, _StrictWeakOrdering)): Likewise.
+ * testsuite/23_containers/list/operations/78389.cc: Add
+ better test for the sizes.
+
+2017-01-15 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2017-01-13 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/78389
+ * include/bits/list.tcc (merge(list&&)):
+ Adjust list sizes if the comparator throws.
+ (merge(list&&, _StrictWeakOrdering)): Likewise.
+ * testsuite/23_containers/list/operations/78389.cc: New.
+
+2017-01-15 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2016-12-19 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Make the perfect-forwarding constructor of a two-element tuple
+ sfinae away when the first argument is an allocator_arg.
+ * include/std/tuple (tuple(_U1&&, _U2&&)): Constrain.
+ * testsuite/20_util/tuple/cons/allocator_with_any.cc: New.
+
2017-01-06 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
index b24ee228894..57d9f52c12a 100644
--- a/libstdc++-v3/doc/xml/faq.xml
+++ b/libstdc++-v3/doc/xml/faq.xml
@@ -1230,7 +1230,7 @@
details than for C, and most CPU designers (for good reasons elaborated
below) have not stepped up to publish C++ ABIs. Such an ABI has been
defined for the Itanium architecture (see
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.codesourcery.com/cxx-abi/">C++
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://mentorembedded.github.io/cxx-abi/">C++
ABI for Itanium</link>) and that is used by G++ and other compilers
as the de facto standard ABI on many common architectures (including x86).
G++ can also use the ARM architecture's EABI, for embedded
diff --git a/libstdc++-v3/doc/xml/manual/abi.xml b/libstdc++-v3/doc/xml/manual/abi.xml
index aa5aa5be07d..8636124cbb7 100644
--- a/libstdc++-v3/doc/xml/manual/abi.xml
+++ b/libstdc++-v3/doc/xml/manual/abi.xml
@@ -42,7 +42,7 @@
virtual functions, etc. These details are defined as the compiler
Application Binary Interface, or ABI. The GNU C++ compiler uses an
industry-standard C++ ABI starting with version 3. Details can be
- found in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://mentorembedded.github.com/cxx-abi/abi.html">ABI
+ found in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://mentorembedded.github.io/cxx-abi/abi.html">ABI
specification</link>.
</para>
@@ -736,7 +736,7 @@ class that would otherwise have implicit versions. This will change
the way the compiler deals with this class in by-value return
statements or parameters: instead of passing instances of this
class in registers, the compiler will be forced to use memory. See the
-section on <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://mentorembedded.github.com/cxx-abi/abi.html#calls">Function
+section on <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://mentorembedded.github.io/cxx-abi/abi.html#calls">Function
Calling Conventions and APIs</link>
of the C++ ABI documentation for further details.
</para></listitem>
@@ -1094,7 +1094,7 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.
<biblioentry xml:id="biblio.cxxabi">
<title>
<link xmlns:xlink="http://www.w3.org/1999/xlink"
- xlink:href="http://www.codesourcery.com/cxx-abi/">
+ xlink:href="http://mentorembedded.github.io/cxx-abi/">
C++ ABI Summary
</link>
</title>
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index f8f3f88cc56..0352bf49fdc 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -570,10 +570,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
&& _M_get_allocator() != __str._M_get_allocator())
{
- // replacement allocator cannot free existing storage
- _M_destroy(_M_allocated_capacity);
- _M_data(_M_local_data());
- _M_set_length(0);
+ // Propagating allocator cannot free existing storage so must
+ // deallocate it before replacing current allocator.
+ if (__str.size() <= _S_local_capacity)
+ {
+ _M_destroy(_M_allocated_capacity);
+ _M_data(_M_local_data());
+ _M_set_length(0);
+ }
+ else
+ {
+ const auto __len = __str.size();
+ auto __alloc = __str._M_get_allocator();
+ // If this allocation throws there are no effects:
+ auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
+ _M_destroy(_M_allocated_capacity);
+ _M_data(__ptr);
+ _M_capacity(__len);
+ _M_set_length(__len);
+ }
}
std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
}
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 8b3fe00cfcd..81b8be2a61e 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -380,26 +380,36 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// 300. list::merge() specification incomplete
if (this != std::__addressof(__x))
{
- _M_check_equal_allocators(__x);
+ _M_check_equal_allocators(__x);
iterator __first1 = begin();
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first2 < *__first1)
- {
- iterator __next = __first2;
- _M_transfer(__first1, __first2, ++__next);
- __first2 = __next;
- }
- else
- ++__first1;
- if (__first2 != __last2)
- _M_transfer(__last1, __first2, __last2);
+ size_t __orig_size = __x.size();
+ __try {
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first2 < *__first1)
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
- this->_M_inc_size(__x._M_get_size());
- __x._M_set_size(0);
+ this->_M_inc_size(__x._M_get_size());
+ __x._M_set_size(0);
+ }
+ __catch(...)
+ {
+ size_t __dist = distance(__first2, __last2);
+ this->_M_inc_size(__orig_size - __dist);
+ __x._M_set_size(__dist);
+ __throw_exception_again;
+ }
}
}
@@ -423,20 +433,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first2, *__first1))
- {
- iterator __next = __first2;
- _M_transfer(__first1, __first2, ++__next);
- __first2 = __next;
- }
- else
- ++__first1;
- if (__first2 != __last2)
- _M_transfer(__last1, __first2, __last2);
-
- this->_M_inc_size(__x._M_get_size());
- __x._M_set_size(0);
+ size_t __orig_size = __x.size();
+ __try
+ {
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1))
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
+
+ this->_M_inc_size(__x._M_get_size());
+ __x._M_set_size(0);
+ }
+ __catch(...)
+ {
+ size_t __dist = distance(__first2, __last2);
+ this->_M_inc_size(__orig_size - __dist);
+ __x._M_set_size(__dist);
+ __throw_exception_again;
+ }
}
}
diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
index d254795c1a5..7f4bfe65f31 100644
--- a/libstdc++-v3/include/bits/predefined_ops.h
+++ b/libstdc++-v3/include/bits/predefined_ops.h
@@ -24,7 +24,7 @@
/** @file predefined_ops.h
* This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
+ * You should not attempt to use it directly. @headername{algorithm}
*/
#ifndef _GLIBCXX_PREDEFINED_OPS_H
@@ -207,17 +207,17 @@ namespace __ops
template<typename _Iterator1>
struct _Iter_equals_iter
{
- typename std::iterator_traits<_Iterator1>::reference _M_ref;
+ _Iterator1 _M_it1;
explicit
_Iter_equals_iter(_Iterator1 __it1)
- : _M_ref(*__it1)
+ : _M_it1(__it1)
{ }
template<typename _Iterator2>
bool
operator()(_Iterator2 __it2)
- { return *__it2 == _M_ref; }
+ { return *__it2 == *_M_it1; }
};
template<typename _Iterator>
@@ -271,16 +271,16 @@ namespace __ops
struct _Iter_comp_to_iter
{
_Compare _M_comp;
- typename std::iterator_traits<_Iterator1>::reference _M_ref;
+ _Iterator1 _M_it1;
_Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
- : _M_comp(__comp), _M_ref(*__it1)
+ : _M_comp(__comp), _M_it1(__it1)
{ }
template<typename _Iterator2>
bool
operator()(_Iterator2 __it2)
- { return bool(_M_comp(*__it2, _M_ref)); }
+ { return bool(_M_comp(*__it2, *_M_it1)); }
};
template<typename _Compare, typename _Iterator>
diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array
index 31a066b3ce8..c01f0f96ab5 100644
--- a/libstdc++-v3/include/experimental/array
+++ b/libstdc++-v3/include/experimental/array
@@ -69,9 +69,9 @@ template <typename _Up>
template <typename _Dest = void, typename... _Types>
constexpr auto
make_array(_Types&&... __t)
- -> array<conditional_t<is_void_v<_Dest>,
- common_type_t<_Types...>,
- _Dest>,
+ -> array<typename conditional_t<is_void_v<_Dest>,
+ common_type<_Types...>,
+ common_type<_Dest>>::type,
sizeof...(_Types)>
{
static_assert(__or_<
@@ -80,13 +80,12 @@ template <typename _Dest = void, typename... _Types>
::value,
"make_array cannot be used without an explicit target type "
"if any of the types given is a reference_wrapper");
- return {{forward<_Types>(__t)...}};
+ return {{ std::forward<_Types>(__t)... }};
}
template <typename _Tp, size_t _Nm, size_t... _Idx>
constexpr array<remove_cv_t<_Tp>, _Nm>
- __to_array(_Tp (&__a)[_Nm],
- index_sequence<_Idx...>)
+ __to_array(_Tp (&__a)[_Nm], index_sequence<_Idx...>)
{
return {{__a[_Idx]...}};
}
@@ -94,6 +93,7 @@ template <typename _Tp, size_t _Nm, size_t... _Idx>
template <typename _Tp, size_t _Nm>
constexpr array<remove_cv_t<_Tp>, _Nm>
to_array(_Tp (&__a)[_Nm])
+ noexcept(is_nothrow_constructible<remove_cv_t<_Tp>, _Tp&>::value)
{
return __to_array(__a, make_index_sequence<_Nm>{});
}
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 7522e435184..ec269c1a8d7 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -923,7 +923,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
enable_if<_TMC::template
_MoveConstructibleTuple<_U1, _U2>()
&& _TMC::template
- _ImplicitlyMoveConvertibleTuple<_U1, _U2>(),
+ _ImplicitlyMoveConvertibleTuple<_U1, _U2>()
+ && !is_same<typename decay<_U1>::type,
+ allocator_arg_t>::value,
bool>::type = true>
constexpr tuple(_U1&& __a1, _U2&& __a2)
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
@@ -932,7 +934,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
enable_if<_TMC::template
_MoveConstructibleTuple<_U1, _U2>()
&& !_TMC::template
- _ImplicitlyMoveConvertibleTuple<_U1, _U2>(),
+ _ImplicitlyMoveConvertibleTuple<_U1, _U2>()
+ && !is_same<typename decay<_U1>::type,
+ allocator_arg_t>::value,
bool>::type = false>
explicit constexpr tuple(_U1&& __a1, _U2&& __a2)
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/allocator_with_any.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/allocator_with_any.cc
new file mode 100644
index 00000000000..9f86c93e378
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/allocator_with_any.cc
@@ -0,0 +1,42 @@
+// { dg-do run { target c++14 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on tuple. If the implementation changed
+// this test may begin to fail.
+
+#include <tuple>
+#include <experimental/any>
+#include <testsuite_hooks.h>
+
+using std::experimental::any;
+
+void test01()
+{
+ std::tuple<any, any> t(std::allocator_arg,
+ std::allocator<any>{});
+ VERIFY(std::get<0>(t).empty());
+ VERIFY(std::get<1>(t).empty());
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
index 3c8e440120e..645e3cb7bfe 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Free Software Foundation, Inc.
+// Copyright (C) 2015-2017 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,6 +20,7 @@
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <ext/throw_allocator.h>
#if _GLIBCXX_USE_CXX11_ABI
using C = char;
@@ -100,10 +101,44 @@ void test02()
VERIFY(1 == v5.get_allocator().get_personality());
}
+void test03()
+{
+ // PR libstdc++/79254
+ using throw_alloc = __gnu_cxx::throw_allocator_limit<C>;
+ typedef propagating_allocator<C, true, throw_alloc> alloc_type;
+ typedef std::basic_string<C, traits, alloc_type> test_type;
+ alloc_type a1(1), a2(2);
+ throw_alloc::set_limit(2); // Throw on third allocation (during assignment).
+ const C* s1 = "a string that is longer than a small string";
+ const C* s2 = "another string that is longer than a small string";
+ test_type v1(s1, a1);
+ test_type v2(s2, a2);
+ bool caught = false;
+ try {
+ v1 = v2;
+ } catch (__gnu_cxx::forced_error&) {
+ caught = true;
+ }
+ VERIFY( caught );
+ VERIFY( v1 == s1 );
+ VERIFY( v1.get_allocator() == a1 );
+
+ throw_alloc::set_limit(1); // Allow one more allocation (and no more).
+ test_type v3(s1, a1);
+ // No allocation when allocators are equal and capacity is sufficient:
+ VERIFY( v1.capacity() >= v3.size() );
+ v1 = v3;
+ // No allocation when the contents fit in the small-string buffer:
+ v2 = "sso";
+ v1 = v2;
+ VERIFY( v1.get_allocator() == a2 );
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
#else
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
index 3ac15bbf821..01cdba4eead 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Free Software Foundation, Inc.
+// Copyright (C) 2015-2017 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -20,6 +20,7 @@
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <ext/throw_allocator.h>
#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
@@ -100,10 +101,44 @@ void test02()
VERIFY(1 == v5.get_allocator().get_personality());
}
+void test03()
+{
+ // PR libstdc++/79254
+ using throw_alloc = __gnu_cxx::throw_allocator_limit<C>;
+ typedef propagating_allocator<C, true, throw_alloc> alloc_type;
+ typedef std::basic_string<C, traits, alloc_type> test_type;
+ alloc_type a1(1), a2(2);
+ throw_alloc::set_limit(2); // Throw on third allocation (during assignment).
+ const C* s1 = L"a string that is longer than a small string";
+ const C* s2 = L"another string that is longer than a small string";
+ test_type v1(s1, a1);
+ test_type v2(s2, a2);
+ bool caught = false;
+ try {
+ v1 = v2;
+ } catch (__gnu_cxx::forced_error&) {
+ caught = true;
+ }
+ VERIFY( caught );
+ VERIFY( v1 == s1 );
+ VERIFY( v1.get_allocator() == a1 );
+
+ throw_alloc::set_limit(1); // Allow one more allocation (and no more).
+ test_type v3(s1, a1);
+ // No allocation when allocators are equal and capacity is sufficient:
+ VERIFY( v1.capacity() >= v3.size() );
+ v1 = v3;
+ // No allocation when the contents fit in the small-string buffer:
+ v2 = L"sso";
+ v1 = v2;
+ VERIFY( v1.get_allocator() == a2 );
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
#else
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc b/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
new file mode 100644
index 00000000000..ac36f9c94d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/78389.cc
@@ -0,0 +1,74 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+#include <list>
+
+struct ThrowingComparator
+{
+ unsigned int throw_after = 0;
+ unsigned int count = 0;
+ bool operator()(int, int) {
+ if (++count >= throw_after) {
+ throw 666;
+ }
+ return true;
+ }
+};
+
+struct X
+{
+ X() = default;
+ X(int) {}
+};
+
+unsigned int throw_after_X = 0;
+unsigned int count_X = 0;
+
+bool operator<(const X&, const X&) {
+ if (++count_X >= throw_after_X) {
+ throw 666;
+ }
+ return true;
+}
+
+
+int main()
+{
+ std::list<int> a{1, 2, 3, 4};
+ std::list<int> b{5, 6, 7, 8, 9, 10, 11, 12};
+ try {
+ a.merge(b, ThrowingComparator{4});
+ } catch (...) {
+ }
+ VERIFY(a.size() == std::distance(a.begin(), a.end()) &&
+ b.size() == std::distance(b.begin(), b.end()));
+ std::list<X> ax{1, 2, 3, 4};
+ std::list<X> bx{5, 6, 7, 8, 9, 10, 11, 12};
+ throw_after_X = 4;
+ try {
+ ax.merge(bx);
+ } catch (...) {
+ }
+ VERIFY(ax.size() == std::distance(ax.begin(), ax.end()) &&
+ bx.size() == std::distance(bx.begin(), bx.end()));
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/search/78346.cc b/libstdc++-v3/testsuite/25_algorithms/search/78346.cc
new file mode 100644
index 00000000000..6f003bdb9e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/search/78346.cc
@@ -0,0 +1,118 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+bool values[100];
+
+unsigned next_id()
+{
+ static unsigned counter = 0;
+ VERIFY(counter < 100);
+ return counter++;
+}
+
+struct value
+{
+ int val;
+ const unsigned id;
+
+ value(int i = 0) : val(i), id(next_id()) { values[id] = true; }
+ value(const value& v) : val(v.val), id(next_id()) { values[id] = true; }
+ value& operator=(const value& v) { val = v.val; return *this; }
+ ~value() { values[id] = false; }
+};
+
+bool operator<(const value& lhs, const value& rhs)
+{
+ if (!values[lhs.id])
+ throw lhs.id;
+ if (!values[rhs.id])
+ throw rhs.id;
+ return lhs.val < rhs.val;
+}
+
+bool operator==(const value& lhs, const value& rhs)
+{
+ if (!values[lhs.id])
+ throw lhs.id;
+ if (!values[rhs.id])
+ throw rhs.id;
+ return lhs.val == rhs.val;
+}
+
+// A forward iterator that fails to meet the requirement that for any
+// two dereferenceable forward iterators, a == b implies &*a == &*b
+struct stashing_iterator
+{
+ typedef std::forward_iterator_tag iterator_category;
+ typedef value value_type;
+ typedef value_type const* pointer;
+ typedef value_type const& reference;
+ typedef std::ptrdiff_t difference_type;
+
+ stashing_iterator() : ptr(), stashed() { }
+ stashing_iterator(pointer p) : ptr(p), stashed() { stash(); }
+ stashing_iterator(const stashing_iterator&) = default;
+ stashing_iterator& operator=(const stashing_iterator&) = default;
+
+ stashing_iterator& operator++()
+ {
+ ++ptr;
+ stash();
+ return *this;
+ }
+
+ stashing_iterator operator++(int)
+ {
+ stashing_iterator i = *this;
+ ++*this;
+ return i;
+ }
+
+ reference operator*() const { return stashed; }
+ pointer operator->() const { return &**this; }
+
+ bool operator==(const stashing_iterator& i) const { return ptr == i.ptr; }
+ bool operator!=(const stashing_iterator& i) const { return !(*this == i); }
+
+private:
+ void stash()
+ {
+ if (ptr)
+ stashed = *ptr;
+ }
+
+ pointer ptr;
+ value_type stashed;
+};
+
+void
+test01()
+{
+ value s[] = { 0, 1, 2, 3, 4, 5 };
+ std::search(s, s+6, stashing_iterator(s), stashing_iterator(s+4));
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/experimental/array/make_array.cc b/libstdc++-v3/testsuite/experimental/array/make_array.cc
index 0ae188b0f8b..75f5333639c 100644
--- a/libstdc++-v3/testsuite/experimental/array/make_array.cc
+++ b/libstdc++-v3/testsuite/experimental/array/make_array.cc
@@ -1,7 +1,6 @@
-// { dg-options "-std=gnu++14" }
-// { dg-do compile }
+// { dg-do compile { target c++14 } }
-// Copyright (C) 2015-2016 Free Software Foundation, Inc.
+// Copyright (C) 2015-2017 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -19,6 +18,7 @@
// <http://www.gnu.org/licenses/>.
#include <experimental/array>
+#include <functional> // for std::ref and std::reference_wrapper
struct MoveOnly
{
@@ -27,7 +27,7 @@ struct MoveOnly
MoveOnly& operator=(MoveOnly&&) = default;
};
-int main()
+void test01()
{
char x[42];
std::array<char, 42> y = std::experimental::to_array(x);
@@ -45,3 +45,13 @@ int main()
= std::experimental::make_array(1,2L, 3);
constexpr std::array<MoveOnly, 1> zzz2 = std::experimental::make_array(MoveOnly{});
}
+
+void test02()
+{
+ // PR libstdc++/79195
+ struct A {};
+ struct B : A {};
+ struct C : A {};
+ auto arr = std::experimental::make_array<A>(B{}, C{});
+ static_assert(std::is_same<decltype(arr), std::array<A, 2>>::value, "");
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index 4884600bcb8..f597a3846ab 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -287,7 +287,7 @@ namespace __gnu_test
Alloc& base() { return *this; }
const Alloc& base() const { return *this; }
- void swap_base(Alloc& b) { swap(b, this->base()); }
+ void swap_base(Alloc& b) { using std::swap; swap(b, this->base()); }
public:
typedef typename check_consistent_alloc_value_type<Tp, Alloc>::value_type