Merge branches/gcc-6-branch rev 245201.
authorYvan Roux <yvan.roux@linaro.org>
Mon, 6 Feb 2017 12:25:57 +0000 (13:25 +0100)
committerYvan Roux <yvan.roux@linaro.org>
Mon, 6 Feb 2017 12:25:57 +0000 (13:25 +0100)
Change-Id: Ibc46d8742ef080683f302f5623b4907e9622ac4c

148 files changed:
ChangeLog
config/ChangeLog
config/ax_check_define.m4 [new file with mode: 0644]
configure
configure.ac
fixincludes/ChangeLog
fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/iso/stdio_iso.h
fixincludes/tests/base/iso/stdlib_c99.h [new file with mode: 0644]
fixincludes/tests/base/stdio.h
gcc/ChangeLog
gcc/DATESTAMP
gcc/asan.c
gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/cgraphunit.c
gcc/config/aarch64/aarch64-freebsd.h
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/aarch64.md
gcc/config/aarch64/t-aarch64-freebsd
gcc/config/i386/i386.c
gcc/config/i386/rtemself.h
gcc/config/nds32/nds32.md
gcc/config/nvptx/nvptx.c
gcc/config/rs6000/altivec.h
gcc/config/rs6000/rs6000-c.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/config/tilegx/tilegx.c
gcc/config/tilepro/tilepro.c
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/decl2.c
gcc/cp/name-lookup.c
gcc/cp/parser.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/doc/extend.texi
gcc/doc/generic.texi
gcc/doc/passes.texi
gcc/dwarf2out.c
gcc/expr.c
gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/fortran/resolve.c
gcc/fortran/trans-decl.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-openmp.c
gcc/function.c
gcc/function.h
gcc/gcc.c
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/types.cc
gcc/ipa-inline-transform.c
gcc/ipa-polymorphic-call.c
gcc/lra-remat.c
gcc/lto-cgraph.c
gcc/lto-streamer.h
gcc/lto/ChangeLog
gcc/lto/lto-lang.c
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wunused-var-16.c [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr71182.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr78341.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr78693.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/range-for32.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/range-for33.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ipa/pr71207.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/call2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/call3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/declone3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pr77812.C [new file with mode: 0644]
gcc/testsuite/g++.dg/torture/pr79034.C [new file with mode: 0644]
gcc/testsuite/g++.dg/vect/pr36648.cc
gcc/testsuite/g++.old-deja/g++.abi/vtable2.C
gcc/testsuite/gcc.c-torture/execute/pr78617.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr79043.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/goacc/loop-processing-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr50199_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr69188_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr69188_1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr78742.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/eh_return.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr79268.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/vsx-elemrev-1.c [deleted file]
gcc/testsuite/gcc.target/powerpc/vsx-elemrev-2.c [deleted file]
gcc/testsuite/gcc.target/powerpc/vsx-elemrev-3.c [deleted file]
gcc/testsuite/gcc.target/powerpc/vsx-elemrev-4.c [deleted file]
gcc/testsuite/gfortran.dg/coarray/event_3.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray/event_4.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray_43.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray_event_1.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/map-1.f90
gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90 [new file with mode: 0644]
gcc/testsuite/gnat.dg/array26.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array26_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array26_pkg.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/array27.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array27_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array27_pkg.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/array28.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array28_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array28_pkg.ads [new file with mode: 0644]
gcc/tree-call-cdce.c
gcc/tree-data-ref.c
gcc/tree-profile.c
gcc/tree-ssa-sccvn.c
gcc/tree-vrp.c
gcc/tree.c
gcc/ubsan.c
libgcc/ChangeLog
libgfortran/ChangeLog
libgfortran/acinclude.m4
libgfortran/c99_protos.h
libgfortran/caf/single.c
libgfortran/configure
libgfortran/configure.ac
libgfortran/configure.host
libgfortran/intrinsics/c99_functions.c
libgo/runtime/go-unsafe-pointer.c
libgo/runtime/parfor.c
libgo/runtime/runtime.h
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c-c++-common/crash-1.c [new file with mode: 0644]
libstdc++-v3/ChangeLog
libstdc++-v3/doc/xml/faq.xml
libstdc++-v3/doc/xml/manual/abi.xml
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/list.tcc
libstdc++-v3/include/bits/predefined_ops.h
libstdc++-v3/include/experimental/array
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/tuple/cons/allocator_with_any.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
libstdc++-v3/testsuite/23_containers/list/operations/78389.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/search/78346.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/array/make_array.cc
libstdc++-v3/testsuite/util/testsuite_allocator.h

index 8a887b0..02e1282 100644 (file)
--- 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.
index a446126..e2360c8 100644 (file)
@@ -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 (file)
index 0000000..4bc6948
--- /dev/null
@@ -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
index 89095e3..b29a724 100755 (executable)
--- 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}"
index e411736..f23463a 100644 (file)
@@ -820,7 +820,7 @@ case "${target}" in
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
   aarch64*-*-freebsd*)
-    noconfigdirs="$noconfigdirs target-libffi"
+    noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
   alpha*-*-*vms*)
     noconfigdirs="$noconfigdirs ${libgcj}"
index 73d229c..15e3c3b 100644 (file)
@@ -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.
index 0e76b09..15467f2 100644 (file)
@@ -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,
index 2ba12f0..ef23e48 100644 (file)
@@ -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 = {
index d476752..e2d70b4 100644 (file)
 #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 (file)
index 0000000..0c500de
--- /dev/null
@@ -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 */
index 4ca4faf..491c75d 100644 (file)
@@ -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 */
index 1a4859e..ac448c3 100644 (file)
@@ -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
index 197d842..ee1e9c3 100644 (file)
@@ -1 +1 @@
-20170109
+20170206
index 398a508..0f55dc0 100644 (file)
@@ -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;
index fb1e99d..bdd4e9e 100644 (file)
@@ -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.
index 0d6776c..434f35a 100644 (file)
@@ -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 = "";
index 4351ae4..71e88be 100644 (file)
@@ -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;
index 6b2a908..b9c1bfd 100644 (file)
@@ -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.
 
index 9de726c..f270138 100644 (file)
@@ -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);
index 354207d..f0970f2 100644 (file)
@@ -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
index 19caf9f..c5a952c 100644 (file)
@@ -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
index d5403a3..6fc7979 100644 (file)
   [(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))
index 84b4a75..9740118 100644 (file)
@@ -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.
 #
index a8e6da7..6cb5dec 100644 (file)
@@ -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
index 8b7dc5e..be711c8 100644 (file)
@@ -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
index 5cdd8b2..494a78d 100644 (file)
@@ -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;
 })
 
index a6c90b6..2262005 100644 (file)
@@ -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;
index f77d446..762264e 100644 (file)
 #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>  */
index 9eb6d54..474b48c 100644 (file)
@@ -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 },
index 391a9ee..b0b1b3a 100644 (file)
@@ -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;
        }
index acc70a7..a73c4a2 100644 (file)
 (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 "")])
 
 (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"
   "#"
   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
 ;; 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"
index 78f6857..4fe53f9 100644 (file)
@@ -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)
     {
index 628cd04..b645647 100644 (file)
@@ -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)
     {
index 8f01f83..a7f94b3 100644 (file)
@@ -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.
index 52cc3f0..a6ac3c1 100644 (file)
@@ -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;
 
index 34eb1e0..c4a0e85 100644 (file)
@@ -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;
     }
index 7c0394e..a4a8af2 100644 (file)
@@ -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);
index 6893848..390f7d0 100644 (file)
@@ -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
index 5b15e9c..5e8bb74 100644 (file)
@@ -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;
 
index 9367e0e..029d0ab 100644 (file)
@@ -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:
index 0fa3d8a..04b9393 100644 (file)
@@ -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
index ca63984..5af329c 100644 (file)
@@ -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
 
index ef5548b..2c5e957 100644 (file)
@@ -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
index d9747e0..995ae7f 100644 (file)
@@ -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);
+        }
     }
 }
 
index aad7ff5..6260f5e 100644 (file)
@@ -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.  */
index 83960b3..18b2d3c 100644 (file)
@@ -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
index 4a03506..bd8e66c 100644 (file)
@@ -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)
index 8064d44..7cf2ca2 100644 (file)
@@ -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);
+    }
 }
 
 
index ba9cf06..272ac57 100644 (file)
@@ -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);
     }
index 6b61b16..26cd439 100644 (file)
@@ -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)
index ecc6ee8..d68f99b 100644 (file)
@@ -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)))
     {
index 401f8f9..4f27912 100644 (file)
@@ -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);
index 501ef68..3badf9f 100644 (file)
@@ -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);
 
index 2c333b8..c6a6fe0 100644 (file)
--- 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;
index 09ab5bf..cf60254 100644 (file)
@@ -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)
     {
index c33e636..b69443a 100644 (file)
@@ -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
index 0443281..805a9cf 100644 (file)
@@ -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_;
 
index 1925bf1..30caf4e 100644 (file)
@@ -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)
index f7ef6aa..bc1fab7 100644 (file)
@@ -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);
index 187ee3e..79504d4 100644 (file)
@@ -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
index 95c446d..b2490b9 100644 (file)
@@ -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)
index 7374b4e..c964c6e 100644 (file)
@@ -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;
 
index 2f3032c..55f1617 100644 (file)
@@ -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.
index b5efe3a..ebe908a 100644 (file)
@@ -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;
 }
index 15ecb44..57a03df 100644 (file)
@@ -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;
 }
index 391941f..63e81e8 100644 (file)
@@ -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 (file)
index 0000000..98e66a7
--- /dev/null
@@ -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 (file)
index 0000000..c5c0c54
--- /dev/null
@@ -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 (file)
index 0000000..af90638
--- /dev/null
@@ -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 (file)
index 0000000..c937567
--- /dev/null
@@ -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 (file)
index 0000000..375a707
--- /dev/null
@@ -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 (file)
index 0000000..206f36e
--- /dev/null
@@ -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 (file)
index 0000000..19a0399
--- /dev/null
@@ -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 (file)
index 0000000..1b4d4b3
--- /dev/null
@@ -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 (file)
index 0000000..9aac7e2
--- /dev/null
@@ -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 (file)
index 0000000..d8c2492
--- /dev/null
@@ -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 (file)
index 0000000..94f1740
--- /dev/null
@@ -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 (file)
index 0000000..802c0aa
--- /dev/null
@@ -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;
+         }
+      }
+  }
+}
index e2347d2..84b4efb 100644 (file)
@@ -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 } } } } } */
 
 
index b64f0fc..3022875 100644 (file)
@@ -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 (file)
index 0000000..89c4f6d
--- /dev/null
@@ -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 (file)
index 0000000..b7fcc82
--- /dev/null
@@ -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 (file)
index 0000000..2064bcd
--- /dev/null
@@ -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 (file)
index 0000000..61d0012
--- /dev/null
@@ -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 (file)
index 0000000..2e53d49
--- /dev/null
@@ -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 (file)
index 0000000..3ed9d55
--- /dev/null
@@ -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 (file)
index 0000000..c83ecbc
--- /dev/null
@@ -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 (file)
index 0000000..3217948
--- /dev/null
@@ -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 (file)
index 0000000..2c06ea7
--- /dev/null
@@ -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 (file)
index 0000000..4624736
--- /dev/null
@@ -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 (file)
index 0000000..d01d86b
--- /dev/null
@@ -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 (file)
index 0000000..832f0c7
--- /dev/null
@@ -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 (file)
index 7ab6d44..0000000
+++ /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 (file)
index eb4a130..0000000
+++ /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 (file)
index 2888c17..0000000
+++ /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 (file)
index a116316..0000000
+++ /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 (file)
index 0000000..f6e28b7
--- /dev/null
@@ -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 (file)
index 0000000..de901c0
--- /dev/null
@@ -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 (file)
index 0000000..d5ee4e1
--- /dev/null
@@ -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 (file)
index 0000000..51fc54c
--- /dev/null
@@ -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 
index e4b8b86..e78b56c 100644 (file)
@@ -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 (file)
index 0000000..63a0be7
--- /dev/null
@@ -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 (file)
index 0000000..033479e
--- /dev/null
@@ -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 (file)
index 0000000..659d596
--- /dev/null
@@ -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 (file)
index 0000000..f324bd2
--- /dev/null
@@ -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 (file)
index 0000000..ae84a74
--- /dev/null
@@ -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 (file)
index 0000000..db821c5
--- /dev/null
@@ -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 (file)
index 0000000..92c61b9
--- /dev/null
@@ -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 (file)
index 0000000..1473fbb
--- /dev/null
@@ -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 (file)
index 0000000..aa31445
--- /dev/null
@@ -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 (file)
index 0000000..726810b
--- /dev/null
@@ -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 (file)
index 0000000..6189010
--- /dev/null
@@ -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;
index 6bbe0c3..a7fa3cd 100644 (file)
@@ -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
     {
index f321fdd..0bb01f1 100644 (file)
@@ -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);
 
index 1f3a726..25db648 100644 (file)
@@ -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.  */
index b4b63a9..2e5b154 100644 (file)
@@ -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;
     }
index 4033c9c..8ce43d0 100644 (file)
@@ -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;
 }
index 5c9f6f4..7ce14c9 100644 (file)
@@ -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.  */
index 56637d8..1093824 100644 (file)
@@ -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;
 
index 8e5e308..48568ef 100644 (file)
@@ -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.
index 66cef90..518210d 100644 (file)
@@ -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.
 
        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
        (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>
 
index 7280bc3..1b20d10 100644 (file)
@@ -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], [
index e28d421..396c20e 100644 (file)
@@ -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
index f726537..b4b655e 100644 (file)
@@ -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));
index f746f6f..db607eb 100755 (executable)
@@ -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.
index 8f377bb..5a26494 100644 (file)
@@ -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.
index 0a12a32..5824f25 100644 (file)
@@ -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
index daafda9..410bb67 100644 (file)
@@ -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);
 
index ce82fcd..21ff63f 100644 (file)
@@ -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 =
 {
index ede921b..1e67f3a 100644 (file)
@@ -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;
index 73c46e9..1cca43a 100644 (file)
@@ -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;
index 8841636..2e5f73b 100644 (file)
@@ -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 (file)
index 0000000..dcf1485
--- /dev/null
@@ -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;
+}
index 61aea40..8785436 100644 (file)
@@ -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
index b24ee22..57d9f52 100644 (file)
     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
index aa5aa5b..8636124 100644 (file)
@@ -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>
index f8f3f88..0352bf4 100644 (file)
@@ -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());
          }
index 8b3fe00..81b8be2 100644 (file)
@@ -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;
+             }
          }
       }
 
index d254795..7f4bfe6 100644 (file)
@@ -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>
index 31a066b..c01f0f9 100644 (file)
@@ -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>{});
   }
index 7522e43..ec269c1 100644 (file)
@@ -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 (file)
index 0000000..9f86c93
--- /dev/null
@@ -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();
+}
index 3c8e440..645e3cb 100644 (file)
@@ -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
index 3ac15bb..01cdba4 100644 (file)
@@ -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 (file)
index 0000000..ac36f9c
--- /dev/null
@@ -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 (file)
index 0000000..6f003bd
--- /dev/null
@@ -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();
+}
index 0ae188b..75f5333 100644 (file)
@@ -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, "");
+}
index 4884600..f597a38 100644 (file)
@@ -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