aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-10-11 15:02:32 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-10-11 15:02:32 +0200
commita1b8ee536a7ab5c8d96ca98894009937a8c01608 (patch)
tree98e0c2b04cf3e352ea36c2290336f83f05b55b64
parentadbfebe68eb0f236026adb817435ee0a20906b04 (diff)
Merge branches/gcc-7-branch rev 253626.
Change-Id: If635aa7dbff0d433569bcb961bd02d8e16b894bf
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/gcc_update4
-rw-r--r--gcc/ChangeLog272
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/gcc-interface/trans.c2
-rw-r--r--gcc/ada/mingw32.h10
-rw-r--r--gcc/ada/sysdep.c8
-rw-r--r--gcc/c-family/ChangeLog31
-rw-r--r--gcc/c-family/c-attribs.c11
-rw-r--r--gcc/c-family/c-common.c14
-rw-r--r--gcc/c-family/c-pragma.c2
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-decl.c4
-rw-r--r--gcc/cfgbuild.c53
-rw-r--r--gcc/config.gcc9
-rw-r--r--gcc/config/aarch64/aarch64.c14
-rw-r--r--gcc/config/aarch64/aarch64.h8
-rw-r--r--gcc/config/i386/i386.c23
-rw-r--r--gcc/config/netbsd-protos.h20
-rw-r--r--gcc/config/netbsd.c54
-rw-r--r--gcc/config/netbsd.h13
-rw-r--r--gcc/config/rs6000/rs6000-c.c26
-rw-r--r--gcc/config/rs6000/rs6000.c25
-rw-r--r--gcc/config/t-netbsd21
-rw-r--r--gcc/cp/ChangeLog70
-rw-r--r--gcc/cp/call.c36
-rw-r--r--gcc/cp/cp-gimplify.c4
-rw-r--r--gcc/cp/cp-objcp-common.c10
-rw-r--r--gcc/cp/cp-objcp-common.h2
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl.c12
-rw-r--r--gcc/cp/parser.c9
-rw-r--r--gcc/cp/pt.c18
-rw-r--r--gcc/cp/semantics.c8
-rw-r--r--gcc/cp/tree.c28
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/doc/extend.texi5
-rw-r--r--gcc/fold-const.c27
-rw-r--r--gcc/fold-const.h1
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/expr.c6
-rw-r--r--gcc/gcc.c3
-rw-r--r--gcc/gimple-ssa-strength-reduction.c10
-rw-r--r--gcc/gimplify.c7
-rw-r--r--gcc/ipa-icf-gimple.c25
-rw-r--r--gcc/ipa-icf-gimple.h6
-rw-r--r--gcc/ipa-visibility.c3
-rw-r--r--gcc/is-a.h14
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h4
-rw-r--r--gcc/opts-common.c3
-rw-r--r--gcc/opts-global.c12
-rw-r--r--gcc/opts.c14
-rw-r--r--gcc/opts.h18
-rw-r--r--gcc/testsuite/ChangeLog182
-rw-r--r--gcc/testsuite/c-c++-common/pr82112.c13
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr39.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr81325.C84
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr82299.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-auto1.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1a.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda16.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/lambda-inherit1.C23
-rw-r--r--gcc/testsuite/g++.dg/ext/altivec-18.C14
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib54.C14
-rw-r--r--gcc/testsuite/g++.dg/ext/varargs2.C17
-rw-r--r--gcc/testsuite/g++.dg/lto/pr70029_0.C10
-rw-r--r--gcc/testsuite/g++.dg/opt/pr82159.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr82084.C9
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr81929.C14
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr82337.c25
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr81696.c26
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr82001.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr82112.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82244.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82264.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82276.c32
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82285.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82291.c37
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr82340.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr82108.c47
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr71727-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81128.c65
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr82112.c16
-rw-r--r--gcc/testsuite/gfortran.dg/zero_sized_7.f9018
-rw-r--r--gcc/testsuite/go.test/go-test.exp16
-rw-r--r--gcc/toplev.c3
-rw-r--r--gcc/tree-if-conv.c188
-rw-r--r--gcc/tree-ssa-sccvn.c17
-rw-r--r--gcc/tree-vect-patterns.c2
-rw-r--r--gcc/tree-vect-stmts.c10
-rw-r--r--gcc/tree-vrp.c7
-rw-r--r--gcc/tree.c11
-rw-r--r--libbacktrace/ChangeLog10
-rw-r--r--libbacktrace/elf.c6
-rw-r--r--libgcc/ChangeLog8
-rw-r--r--libgcc/config.host1
-rw-r--r--libgfortran/ChangeLog12
-rw-r--r--libgfortran/io/list_read.c5
-rw-r--r--libgfortran/io/transfer.c8
-rw-r--r--libgfortran/io/unit.c84
-rw-r--r--libgfortran/io/write.c5
-rw-r--r--libgo/MERGE2
-rw-r--r--libgo/VERSION2
-rw-r--r--libgo/config.h.in3
-rwxr-xr-xlibgo/configure28
-rw-r--r--libgo/configure.ac23
-rw-r--r--libgo/go/cmd/cgo/main.go80
-rw-r--r--libgo/go/cmd/go/build.go20
-rw-r--r--libgo/go/crypto/elliptic/elliptic_test.go36
-rw-r--r--libgo/go/database/sql/sql.go2
-rw-r--r--libgo/go/database/sql/sql_test.go5
-rw-r--r--libgo/go/go/build/syslist.go2
-rw-r--r--libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go (renamed from libgo/go/internal/syscall/unix/getrandom_linux_mipsn32.go)2
-rw-r--r--libgo/go/internal/syscall/unix/getrandom_linux_mips64x.go2
-rw-r--r--libgo/go/internal/syscall/unix/getrandom_linux_mipso32.go11
-rw-r--r--libgo/go/net/http/h2_bundle.go19
-rw-r--r--libgo/go/runtime/hash32.go2
-rw-r--r--libgo/go/runtime/hash64.go2
-rw-r--r--libgo/go/runtime/lfstack_32bit.go2
-rw-r--r--libgo/go/runtime/lfstack_64bit.go2
-rw-r--r--libgo/go/runtime/unaligned2.go2
-rw-r--r--libgo/go/syscall/endian_big.go2
-rw-r--r--libgo/go/syscall/syscall_linux_mips64x.go20
-rw-r--r--libgo/go/syscall/syscall_linux_mipsx.go20
-rwxr-xr-xlibgo/match.sh4
-rwxr-xr-xlibgo/mksysinfo.sh4
-rw-r--r--libgo/sysinfo.c3
-rwxr-xr-xlibgo/testsuite/gotest4
-rw-r--r--libgomp/ChangeLog8
-rw-r--r--libgomp/testsuite/libgomp.c++/pr81314.C38
-rw-r--r--libsanitizer/ChangeLog9
-rw-r--r--libsanitizer/configure.tgt2
-rw-r--r--libstdc++-v3/ChangeLog70
-rw-r--r--libstdc++-v3/include/bits/basic_string.h2
-rw-r--r--libstdc++-v3/include/std/optional12
-rw-r--r--libstdc++-v3/include/std/type_traits25
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc96
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/optional/hash.cc17
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc53
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc53
-rw-r--r--libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc4
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/clamp/1.cc12
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc26
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc18
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc18
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc18
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc12
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc12
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc17
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc16
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc32
163 files changed, 2653 insertions, 634 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index b030f6722fd..e5b4ee8eb97 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2017-10-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gcc_update (files_and_dependencies): Handle libbacktrace.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/contrib/gcc_update b/contrib/gcc_update
index fe643af68dc..47fff168ca4 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -172,6 +172,10 @@ liboffloadmic/configure: liboffloadmic/configure.ac
liboffloadmic/plugin/aclocal.m4: liboffloadmic/plugin/configure.ac
liboffloadmic/plugin/Makefile.in: liboffloadmic/plugin/Makefile.am
liboffloadmic/plugin/configure: liboffloadmic/plugin/configure.ac
+libbacktrace/aclocal.m4: libbacktrace/configure.ac
+libbacktrace/Makefile.in: libbacktrace/Makefile.am libbacktrace/aclocal.m4
+libbacktrace/configure: libbacktrace/configure.ac libbacktrace/aclocal.m4
+libbacktrace/config.h.in: libbacktrace/configure.ac libbacktrace/aclocal.m4
# Top level
Makefile.in: Makefile.tpl Makefile.def
configure: configure.ac config/acx.m4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c7b62274448..d4674df4403 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,275 @@
+2017-10-10 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backported from mainline r253602
+ 2017-10-10 Andreas Tobler <andreast@gcc.gnu.org>
+
+ * config.gcc: (armv7*-*-freebsd*): New target.
+ (armv6*-*-freebsd*): Remove obsolete TARGET_FREEBSD_ARMv6 define.
+
+2017-10-06 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from mainline r253242.
+ 2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/71727
+ * config/aarch64/aarch64.c
+ (aarch64_builtin_support_vector_misalignment): Always return false
+ when misalignment is unknown.
+
+2017-10-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/82406 - C++ error with noexcept function type
+ PR c++/70029 - ICE with ref-qualifier and -flto
+ * langhooks.h (struct lang_hooks_for_types): Add
+ copy_lang_qualifiers.
+ * attribs.c (build_type_attribute_qual_variant): Use it.
+ * langhooks-def.h (LANG_HOOKS_COPY_LANG_QUALIFIERS): Default to
+ NULL.
+ (LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
+ * tree.c (verify_type): Re-enable TYPE_CANONICAL main variant check.
+
+2017-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/82337
+ * gimple-ssa-strength-reduction.c (find_phi_def): Don't record a
+ phi definition if the PHI result appears in an abnormal PHI.
+ (find_basis_for_base_expr): Don't record a basis if the LHS of the
+ basis appears in an abnormal PHI.
+
+2017-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/i386.c (ix86_split_idivmod): Use mode instead of
+ always SImode for DIV and MOD in REG_EQUAL notes.
+
+ Backported from mainline
+ 2017-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82159
+ * gimplify.c (gimplify_modify_expr): Don't optimize away zero sized
+ lhs from calls if the lhs has addressable type.
+
+2017-09-29 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ Backport from mainline
+ 2017-06-29 Maya Rashish <coypu@sdf.org>
+
+ PR target/77480
+ * config/netbsd.h (NETBSD_LIB_SPEC): Add -lc when creating shared
+ objects.
+
+2017-09-29 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ Backport from mainline
+ 2017-09-26 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ PR target/39570
+ * gcc/config/netbsd-protos.h: New file.
+ * gcc/config/netbsd.c: New file.
+ * gcc/config/netbsd.h (SUBTARGET_INIT_BUILTINS): Define.
+ * gcc/config/t-netbsd: New file.
+ * gcc/config.gcc (tm_p_file): Add netbsd-protos.h.
+ (tmake_file) Add t-netbsd.
+ (extra_objs) Add netbsd.o.
+
+2017-09-28 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ Backport from mainline
+ 2017-05-14 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ PR target/80600
+ * config/netbsd.h (NETBSD_LIBGCC_SPEC): Always add -lgcc.
+
+2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from trunk r249639.
+ 2017-06-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * doc/sourcebuild.texi (ARM-specific attributes): Document new
+ arm_neon_ok_no_float_abi effective target.
+
+2017-09-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82244
+ * tree-vrp.c (remove_range_assertions): Do not propagate
+ a constant to abnormals but replace the assert with a copy.
+
+ 2017-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82276
+ PR tree-optimization/82244
+ * tree-vrp.c (build_assert_expr_for): Set
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI if the variable we assert on
+ has it set.
+ (remove_range_assertions): Revert earlier change.
+
+ 2017-09-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82264
+ * tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
+ for GIMPLE_CONDs.
+ (vn_phi_lookup): Likewise.
+ (vn_phi_insert): Likewise.
+ * is-a.h (safe_dyn_cast): New.
+
+ 2017-09-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82285
+ * tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
+ enumeral types.
+
+ 2017-09-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82291
+ * tree-if-conv.c (predicate_mem_writes): Make sure to
+ remove writes in blocks predicated with false.
+
+2017-09-21 Alan Modra <amodra@gmail.com>
+
+ PR target/81996
+ * gcc/config/rs6000/rs6000.c (rs6000_return_addr): Use
+ stack_pointer_rtx for count 0. Update comments. Break up
+ large rtl expression.
+
+2017-09-21 Wilco Dijkstra <wdijkstr@arm.com>
+
+ PR target/71951
+ * config/aarch64/aarch64.h (LIBGCC2_UNWIND_ATTRIBUTE): Define.
+
+2017-09-19 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (fold_builtin_cpu): Add M_AMDFAM17H
+ to processor_model and "amdfam17h" to arch_names_table.
+ * doc/extend.texi (__builtin_cpu_is): Document amdfam17h CPU name.
+
+2017-09-19 Martin Liska <mliska@suse.cz>
+
+ PR c++/81355
+ * config/i386/i386.c (sorted_attr_string): Skip empty strings.
+
+2017-09-19 Martin Liska <mliska@suse.cz>
+
+ Revert backport:
+ 2017-08-10 Martin Liska <mliska@suse.cz>
+
+ PR c++/81355
+ * c-attribs.c (handle_target_attribute):
+ Report warning for an empty string argument of target attribute.
+
+2017-09-18 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82084
+ * fold-const.h (can_native_encode_string_p): Declare.
+ * fold-const.c (can_native_encode_string_p): Factor out from ...
+ (native_encode_string): ... here.
+ * tree-vect-stmts.c (vectorizable_store): Call it to avoid
+ vectorizing stores from constants we later cannot handle.
+
+ 2017-09-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82108
+ * tree-vect-stmts.c (vectorizable_load): Fix pointer adjustment
+ for gap in the non-permutation SLP case.
+
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81325
+ * cfgbuild.c (find_bb_boundaries): Ignore debug insns in decisions
+ if and where to split a bb, except for splitting before debug insn
+ sequences followed by non-label real insn. Delete debug insns
+ in between basic blocks.
+
+ 2017-09-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/82112
+ * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
+ ALTIVEC_BUILTIN_VEC_LD if arg1 has array type call default_conversion
+ on it early, rather than manual conversion late. For
+ ALTIVEC_BUILTIN_VEC_ST if arg2 has array type call default_conversion
+ instead of performing manual conversion.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-09-14 Martin Liska <mliska@suse.cz>
+
+ * gimple-ssa-strength-reduction.c (create_add_on_incoming_edge):
+ Add proper printf format.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-30 Martin Liska <mliska@suse.cz>
+
+ PR inline-asm/82001
+ * ipa-icf-gimple.c (func_checker::compare_tree_list_operand):
+ Rename to ...
+ (func_checker::compare_asm_inputs_outputs): ... this function.
+ (func_checker::compare_gimple_asm): Use the function to compare
+ also ASM constrains.
+ * ipa-icf-gimple.h: Rename the function.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-29 Martin Liska <mliska@suse.cz>
+
+ PR other/39851
+ * gcc.c (driver_handle_option): Add new argument.
+ * opts-common.c (handle_option): Pass
+ target_option_override_hook.
+ * opts-global.c (lang_handle_option): Add new option.
+ (set_default_handlers): Add new argument.
+ (decode_options): Likewise.
+ * opts.c (target_handle_option): Likewise.
+ (common_handle_option): Call target_option_override_hook.
+ * opts.h (struct cl_option_handler_func): Add hook for
+ target option override.
+ (struct cl_option_handlers): Likewise.
+ (set_default_handlers): Add new argument.
+ (decode_options): Likewise.
+ (common_handle_option): Likewise.
+ (target_handle_option): Likewise.
+ * toplev.c (toplev::main): Pass targetm.target_option.override
+ hook.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-10 Martin Liska <mliska@suse.cz>
+
+ PR c++/81355
+ * c-attribs.c (handle_target_attribute):
+ Report warning for an empty string argument of target attribute.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-08 Martin Liska <mliska@suse.cz>
+
+ PR tree-opt/81696
+ * ipa-icf-gimple.c (func_checker::compare_cst_or_decl): Consider
+ LABEL_DECLs that can be from a different function.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-06-28 Martin Liska <mliska@suse.cz>
+
+ PR ipa/81128
+ * ipa-visibility.c (non_local_p): Handle visibility.
+
2017-09-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 8afc9469ac6..a7abaa82cbf 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20170913
+20171011
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8f296affdbb..56f27900054 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+2017-10-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/82393
+ * mingw32.h (_O_U8TEXT, _O_U16TEXT, _O_WTEXT): Delete.
+ * sysdep.c (__gnat_set_mode ): Use DJGPP version for Cygwin.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-29 Martin Liska <mliska@suse.cz>
+
+ PR other/39851
+ * gcc-interface/trans.c (Pragma_to_gnu): Set argument to NULL.
+
2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (promote_object_alignment): New function taken
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index d1d1b433667..ae35bf42bf3 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1477,7 +1477,7 @@ Pragma_to_gnu (Node_Id gnat_node)
else
option_index = 0;
- set_default_handlers (&handlers);
+ set_default_handlers (&handlers, NULL);
control_warning_option (option_index, (int) kind, arg, imply, location,
lang_mask, &handlers, &global_options,
&global_options_set, global_dc);
diff --git a/gcc/ada/mingw32.h b/gcc/ada/mingw32.h
index cf2d9de1715..91f85f80f93 100644
--- a/gcc/ada/mingw32.h
+++ b/gcc/ada/mingw32.h
@@ -59,16 +59,6 @@
#endif
#include <windows.h>
-#ifndef _O_U8TEXT
-#define _O_U8TEXT _O_TEXT
-#endif
-#ifndef _O_U16TEXT
-#define _O_U16TEXT _O_TEXT
-#endif
-#ifndef _O_WTEXT
-#define _O_WTEXT _O_TEXT
-#endif
-
/* After including this file it is possible to use the character t as prefix
to routines. If GNAT_UNICODE_SUPPORT is defined then the unicode enabled
versions will be used. */
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 679c70a77f7..11bd0dc67b8 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
*/
-#if defined (WINNT) || defined (__CYGWIN__) || defined(__DJGPP__)
+#if defined (WINNT) || defined (__CYGWIN__) || defined (__DJGPP__)
const char __gnat_text_translation_required = 1;
@@ -137,7 +137,7 @@ const char __gnat_text_translation_required = 1;
#define WIN_SETMODE _setmode
#endif
-#if defined(__DJGPP__)
+#if defined (__DJGPP__)
#include <io.h>
#define _setmode setmode
#endif /* __DJGPP__ */
@@ -154,7 +154,7 @@ __gnat_set_text_mode (int handle)
WIN_SETMODE (handle, O_TEXT);
}
-#ifdef __DJGPP__
+#if defined (__CYGWIN__) || defined (__DJGPP__)
void
__gnat_set_mode (int handle, int mode)
{
@@ -826,7 +826,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
|| defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
- || defined(__DJGPP__)
+ || defined (__DJGPP__)
{
localtime_r (timer, &tp);
*off = tp.tm_gmtoff;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 14482a53d3f..ac51bacebd8 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,34 @@
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/82112
+ * c-common.c (sync_resolve_size): Instead of c_dialect_cxx ()
+ assertion check that in the condition.
+ (get_atomic_generic_size): Likewise. Before testing if parameter
+ has pointer type, if it has array type, call for C++
+ default_conversion to perform array-to-pointer conversion.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-29 Martin Liska <mliska@suse.cz>
+
+ PR other/39851
+ * c-common.c (parse_optimize_options): Add argument to function
+ call.
+ * c-pragma.c (handle_pragma_diagnostic): Likewise.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-06-28 Martin Liska <mliska@suse.cz>
+
+ PR ipa/81128
+ * c-attribs.c (handle_alias_ifunc_attribute): Append ifunc alias
+ to a function declaration.
+
2017-09-10 Jonathan Wakely <jwakely@redhat.com>
PR c++/81852
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index f2a88e147ba..90b17bc00d2 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -1764,9 +1764,14 @@ handle_alias_ifunc_attribute (bool is_alias, tree *node, tree name, tree args,
TREE_STATIC (decl) = 1;
if (!is_alias)
- /* ifuncs are also aliases, so set that attribute too. */
- DECL_ATTRIBUTES (decl)
- = tree_cons (get_identifier ("alias"), args, DECL_ATTRIBUTES (decl));
+ {
+ /* ifuncs are also aliases, so set that attribute too. */
+ DECL_ATTRIBUTES (decl)
+ = tree_cons (get_identifier ("alias"), args,
+ DECL_ATTRIBUTES (decl));
+ DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("ifunc"),
+ NULL, DECL_ATTRIBUTES (decl));
+ }
}
else
{
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 0a7f673cbb1..bc8c051bedb 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5597,7 +5597,7 @@ parse_optimize_options (tree args, bool attr_p)
/* And apply them. */
decode_options (&global_options, &global_options_set,
decoded_options, decoded_options_count,
- input_location, global_dc);
+ input_location, global_dc, NULL);
targetm.override_options_after_change();
@@ -6576,10 +6576,9 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch)
}
argtype = type = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type) == ARRAY_TYPE)
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type = TREE_TYPE ((*params)[0]);
}
@@ -6741,10 +6740,9 @@ get_atomic_generic_size (location_t loc, tree function,
/* Get type of first parameter, and determine its size. */
type_0 = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type_0) == ARRAY_TYPE)
+ if (TREE_CODE (type_0) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type_0 = TREE_TYPE ((*params)[0]);
}
@@ -6783,6 +6781,12 @@ get_atomic_generic_size (location_t loc, tree function,
/* __atomic_compare_exchange has a bool in the 4th position, skip it. */
if (n_param == 6 && x == 3)
continue;
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ (*params)[x] = default_conversion ((*params)[x]);
+ type = TREE_TYPE ((*params)[x]);
+ }
if (!POINTER_TYPE_P (type))
{
error_at (loc, "argument %d of %qE must be a pointer type", x + 1,
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 55c2b68865c..d8ef48beed8 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -815,7 +815,7 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
}
struct cl_option_handlers handlers;
- set_default_handlers (&handlers);
+ set_default_handlers (&handlers, NULL);
const char *arg = NULL;
if (cl_options[option_index].flags & CL_JOINED)
arg = option_string + 1 + cl_options[option_index].opt_len;
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index bac133dd6e9..20492cfbbfe 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2017-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/82340
+ * c-decl.c (build_compound_literal): Use c_apply_type_quals_to_decl
+ instead of trying to set just TREE_READONLY manually.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 2acedac6b0b..fa678261bed 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5264,9 +5264,7 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const)
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
TREE_TYPE (decl) = type;
- TREE_READONLY (decl) = (TYPE_READONLY (type)
- || (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_READONLY (TREE_TYPE (type))));
+ c_apply_type_quals_to_decl (TYPE_QUALS (strip_array_types (type)), decl);
store_init_value (loc, decl, init, NULL_TREE);
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 69ca1282c37..238954a1cfa 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -442,9 +442,10 @@ find_bb_boundaries (basic_block bb)
rtx_insn *end = BB_END (bb), *x;
rtx_jump_table_data *table;
rtx_insn *flow_transfer_insn = NULL;
+ rtx_insn *debug_insn = NULL;
edge fallthru = NULL;
- if (insn == BB_END (bb))
+ if (insn == end)
return;
if (LABEL_P (insn))
@@ -455,27 +456,49 @@ find_bb_boundaries (basic_block bb)
{
enum rtx_code code = GET_CODE (insn);
+ if (code == DEBUG_INSN)
+ {
+ if (flow_transfer_insn && !debug_insn)
+ debug_insn = insn;
+ }
/* In case we've previously seen an insn that effects a control
flow transfer, split the block. */
- if ((flow_transfer_insn || code == CODE_LABEL)
- && inside_basic_block_p (insn))
+ else if ((flow_transfer_insn || code == CODE_LABEL)
+ && inside_basic_block_p (insn))
{
- fallthru = split_block (bb, PREV_INSN (insn));
+ rtx_insn *prev = PREV_INSN (insn);
+
+ /* If the first non-debug inside_basic_block_p insn after a control
+ flow transfer is not a label, split the block before the debug
+ insn instead of before the non-debug insn, so that the debug
+ insns are not lost. */
+ if (debug_insn && code != CODE_LABEL && code != BARRIER)
+ prev = PREV_INSN (debug_insn);
+ fallthru = split_block (bb, prev);
if (flow_transfer_insn)
{
BB_END (bb) = flow_transfer_insn;
+ rtx_insn *next;
/* Clean up the bb field for the insns between the blocks. */
for (x = NEXT_INSN (flow_transfer_insn);
x != BB_HEAD (fallthru->dest);
- x = NEXT_INSN (x))
- if (!BARRIER_P (x))
- set_block_for_insn (x, NULL);
+ x = next)
+ {
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
+ set_block_for_insn (x, NULL);
+ }
}
bb = fallthru->dest;
remove_edge (fallthru);
flow_transfer_insn = NULL;
+ debug_insn = NULL;
if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
}
@@ -498,17 +521,23 @@ find_bb_boundaries (basic_block bb)
/* In case expander replaced normal insn by sequence terminating by
return and barrier, or possibly other sequence not behaving like
ordinary jump, we need to take care and move basic block boundary. */
- if (flow_transfer_insn)
+ if (flow_transfer_insn && flow_transfer_insn != end)
{
BB_END (bb) = flow_transfer_insn;
/* Clean up the bb field for the insns that do not belong to BB. */
- x = flow_transfer_insn;
- while (x != end)
+ rtx_insn *next;
+ for (x = NEXT_INSN (flow_transfer_insn); ; x = next)
{
- x = NEXT_INSN (x);
- if (!BARRIER_P (x))
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
set_block_for_insn (x, NULL);
+ if (x == end)
+ break;
}
}
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 56d3953a47d..56e7791e0d4 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -775,7 +775,9 @@ case ${target} in
target_has_targetcm=yes
;;
*-*-netbsd*)
- tmake_file="t-slibgcc"
+ tm_p_file="${tm_p_file} netbsd-protos.h"
+ tmake_file="t-netbsd t-slibgcc"
+ extra_objs="${extra_objs} netbsd.o"
gas=yes
gnu_ld=yes
use_gcc_stdint=wrap
@@ -1075,11 +1077,14 @@ arm*-*-freebsd*) # ARM FreeBSD EABI
case $target in
armv6*-*-freebsd*)
target_cpu_cname="arm1176jzfs"
- tm_defines="${tm_defines} TARGET_FREEBSD_ARMv6=1"
if test $fbsd_major -ge 11; then
tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
fi
;;
+ armv7*-*-freebsd*)
+ target_cpu_cname="genericv7a"
+ tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
+ ;;
*)
target_cpu_cname="arm9"
;;
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f8b2f83e189..c9db37328c6 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -11866,19 +11866,9 @@ aarch64_builtin_support_vector_misalignment (machine_mode mode,
if (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing)
return false;
+ /* Misalignment factor is unknown at compile time. */
if (misalignment == -1)
- {
- /* Misalignment factor is unknown at compile time but we know
- it's word aligned. */
- if (aarch64_simd_vector_alignment_reachable (type, is_packed))
- {
- int element_size = TREE_INT_CST_LOW (TYPE_SIZE (type));
-
- if (element_size != 64)
- return true;
- }
- return false;
- }
+ return false;
}
return default_builtin_support_vector_misalignment (mode, type, misalignment,
is_packed);
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 7f91edb5713..03fd93046bd 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -971,4 +971,12 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
extern tree aarch64_fp16_type_node;
extern tree aarch64_fp16_ptr_type_node;
+/* The generic unwind code in libgcc does not initialize the frame pointer.
+ So in order to unwind a function using a frame pointer, the very first
+ function that is unwound must save the frame pointer. That way the frame
+ pointer is restored and its value is now valid - otherwise _Unwind_GetGR
+ crashes. Libgcc can now be safely built with -fomit-frame-pointer. */
+#define LIBGCC2_UNWIND_ATTRIBUTE \
+ __attribute__((optimize ("no-omit-frame-pointer")))
+
#endif /* GCC_AARCH64_H */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 47a28055cab..f4e971d2860 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -20714,13 +20714,13 @@ ix86_split_idivmod (machine_mode mode, rtx operands[],
if (signed_p)
{
- div = gen_rtx_DIV (SImode, operands[2], operands[3]);
- mod = gen_rtx_MOD (SImode, operands[2], operands[3]);
+ div = gen_rtx_DIV (mode, operands[2], operands[3]);
+ mod = gen_rtx_MOD (mode, operands[2], operands[3]);
}
else
{
- div = gen_rtx_UDIV (SImode, operands[2], operands[3]);
- mod = gen_rtx_UMOD (SImode, operands[2], operands[3]);
+ div = gen_rtx_UDIV (mode, operands[2], operands[3]);
+ mod = gen_rtx_UMOD (mode, operands[2], operands[3]);
}
/* Extract remainder from AH. */
@@ -32845,6 +32845,9 @@ sorted_attr_string (tree arglist)
{
const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
size_t len = strlen (str);
+ /* Skip empty string. */
+ if (len == 0)
+ continue;
str_len_sum += len + 1;
if (arg != arglist)
argnum++;
@@ -32859,11 +32862,21 @@ sorted_attr_string (tree arglist)
{
const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
size_t len = strlen (str);
+ /* Skip empty string. */
+ if (len == 0)
+ continue;
memcpy (attr_str + str_len_sum, str, len);
attr_str[str_len_sum + len] = TREE_CHAIN (arg) ? ',' : '\0';
str_len_sum += len + 1;
}
+ /* Strip ',' character at the end. */
+ if (str_len_sum > 0 && attr_str[str_len_sum - 1] == ',')
+ {
+ attr_str[str_len_sum - 1] = '\0';
+ str_len_sum--;
+ }
+
/* Replace "=,-" with "_". */
for (i = 0; i < strlen (attr_str); i++)
if (attr_str[i] == '=' || attr_str[i]== '-')
@@ -33483,6 +33496,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
M_INTEL_KNL,
M_AMD_BTVER1,
M_AMD_BTVER2,
+ M_AMDFAM17H,
M_CPU_SUBTYPE_START,
M_INTEL_COREI7_NEHALEM,
M_INTEL_COREI7_WESTMERE,
@@ -33537,6 +33551,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
{"bdver3", M_AMDFAM15H_BDVER3},
{"bdver4", M_AMDFAM15H_BDVER4},
{"btver2", M_AMD_BTVER2},
+ {"amdfam17h", M_AMDFAM17H},
{"znver1", M_AMDFAM17H_ZNVER1},
};
diff --git a/gcc/config/netbsd-protos.h b/gcc/config/netbsd-protos.h
new file mode 100644
index 00000000000..59007c479c9
--- /dev/null
+++ b/gcc/config/netbsd-protos.h
@@ -0,0 +1,20 @@
+/* Prototypes.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+extern void netbsd_patch_builtins (void);
diff --git a/gcc/config/netbsd.c b/gcc/config/netbsd.c
new file mode 100644
index 00000000000..ed39f2794d6
--- /dev/null
+++ b/gcc/config/netbsd.c
@@ -0,0 +1,54 @@
+/* Functions for generic NetBSD as target machine for GNU C compiler.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "varasm.h"
+#include "netbsd-protos.h"
+
+static void
+netbsd_patch_builtin (enum built_in_function fncode)
+{
+ tree fn = builtin_decl_explicit (fncode);
+ tree sym;
+ char *newname;
+
+ if (!fn)
+ return;
+
+ sym = DECL_ASSEMBLER_NAME (fn);
+ newname = ACONCAT (("__c99_", IDENTIFIER_POINTER (sym), NULL));
+
+ set_user_assembler_name (fn, newname);
+
+ fn = builtin_decl_implicit (fncode);
+ if (fn)
+ set_user_assembler_name (fn, newname);
+}
+
+void
+netbsd_patch_builtins (void)
+{
+ netbsd_patch_builtin (BUILT_IN_CABSF);
+ netbsd_patch_builtin (BUILT_IN_CABS);
+ netbsd_patch_builtin (BUILT_IN_CABSL);
+}
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index 18bda9c3dd4..0eba84d0ae3 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3. If not see
%{!pg:-lposix}} \
%{p:-lposix_p} \
%{pg:-lposix_p}} \
+ %{shared:-lc} \
%{!shared: \
%{!symbolic: \
%{!p: \
@@ -109,6 +110,7 @@ along with GCC; see the file COPYING3. If not see
%{!pg:-lposix}} \
%{p:-lposix_p} \
%{pg:-lposix_p}} \
+ %{shared:-lc} \
%{!shared: \
%{!symbolic: \
%{!p: \
@@ -120,8 +122,7 @@ along with GCC; see the file COPYING3. If not see
#undef LIB_SPEC
#define LIB_SPEC NETBSD_LIB_SPEC
-/* Provide a LIBGCC_SPEC appropriate for NetBSD. We also want to exclude
- libgcc with -symbolic. */
+/* Provide a LIBGCC_SPEC appropriate for NetBSD. */
#ifdef NETBSD_NATIVE
#define NETBSD_LIBGCC_SPEC \
@@ -133,7 +134,7 @@ along with GCC; see the file COPYING3. If not see
%{p: -lgcc_p} \
%{pg: -lgcc_p}}"
#else
-#define NETBSD_LIBGCC_SPEC "%{!shared:%{!symbolic: -lgcc}}"
+#define NETBSD_LIBGCC_SPEC "-lgcc"
#endif
#undef LIBGCC_SPEC
@@ -179,3 +180,9 @@ along with GCC; see the file COPYING3. If not see
#undef WINT_TYPE
#define WINT_TYPE "int"
+
+#undef SUBTARGET_INIT_BUILTINS
+#define SUBTARGET_INIT_BUILTINS \
+ do { \
+ netbsd_patch_builtins (); \
+ } while(0)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 2aa90321adb..d9905f7b2f6 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -6218,7 +6218,13 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
/* Strip qualifiers like "const" from the pointer arg. */
tree arg1_type = TREE_TYPE (arg1);
- if (!POINTER_TYPE_P (arg1_type) && TREE_CODE (arg1_type) != ARRAY_TYPE)
+ if (TREE_CODE (arg1_type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ arg1 = default_conversion (arg1);
+ arg1_type = TREE_TYPE (arg1);
+ }
+ if (!POINTER_TYPE_P (arg1_type))
goto bad;
tree inner_type = TREE_TYPE (arg1_type);
@@ -6238,15 +6244,6 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
if (!ptrofftype_p (TREE_TYPE (arg0)))
arg0 = build1 (NOP_EXPR, sizetype, arg0);
- tree arg1_type = TREE_TYPE (arg1);
- if (TREE_CODE (arg1_type) == ARRAY_TYPE)
- {
- arg1_type = TYPE_POINTER_TO (TREE_TYPE (arg1_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg1_elt0 = build_array_ref (loc, arg1, const0);
- arg1 = build1 (ADDR_EXPR, arg1_type, arg1_elt0);
- }
-
tree addr = fold_build2_loc (loc, POINTER_PLUS_EXPR, arg1_type,
arg1, arg0);
tree aligned = fold_build2_loc (loc, BIT_AND_EXPR, arg1_type, addr,
@@ -6301,12 +6298,11 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
arg1 = build1 (NOP_EXPR, sizetype, arg1);
tree arg2_type = TREE_TYPE (arg2);
- if (TREE_CODE (arg2_type) == ARRAY_TYPE)
+ if (TREE_CODE (arg2_type) == ARRAY_TYPE && c_dialect_cxx ())
{
- arg2_type = TYPE_POINTER_TO (TREE_TYPE (arg2_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg2_elt0 = build_array_ref (loc, arg2, const0);
- arg2 = build1 (ADDR_EXPR, arg2_type, arg2_elt0);
+ /* Force array-to-pointer decay for C++. */
+ arg2 = default_conversion (arg2);
+ arg2_type = TREE_TYPE (arg2);
}
/* Find the built-in to make sure a compatible one exists; if not
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a7ec6846b70..d5213627f8f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -27730,24 +27730,23 @@ debug_stack_info (rs6000_stack_t *info)
rtx
rs6000_return_addr (int count, rtx frame)
{
- /* Currently we don't optimize very well between prolog and body
- code and for PIC code the code can be actually quite bad, so
- don't try to be too clever here. */
+ /* We can't use get_hard_reg_initial_val for LR when count == 0 if LR
+ is trashed by the prologue, as it is for PIC on ABI_V4 and Darwin. */
if (count != 0
|| ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
{
cfun->machine->ra_needs_full_frame = 1;
- return
- gen_rtx_MEM
- (Pmode,
- memory_address
- (Pmode,
- plus_constant (Pmode,
- copy_to_reg
- (gen_rtx_MEM (Pmode,
- memory_address (Pmode, frame))),
- RETURN_ADDRESS_OFFSET)));
+ if (count == 0)
+ /* FRAME is set to frame_pointer_rtx by the generic code, but that
+ is good for loading 0(r1) only when !FRAME_GROWS_DOWNWARD. */
+ frame = stack_pointer_rtx;
+ rtx prev_frame_addr = memory_address (Pmode, frame);
+ rtx prev_frame = copy_to_reg (gen_rtx_MEM (Pmode, prev_frame_addr));
+ rtx lr_save_off = plus_constant (Pmode,
+ prev_frame, RETURN_ADDRESS_OFFSET);
+ rtx lr_save_addr = memory_address (Pmode, lr_save_off);
+ return gen_rtx_MEM (Pmode, lr_save_addr);
}
cfun->machine->ra_need_lr = 1;
diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd
new file mode 100644
index 00000000000..770895b6d01
--- /dev/null
+++ b/gcc/config/t-netbsd
@@ -0,0 +1,21 @@
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC 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.
+#
+# GCC 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+netbsd.o: $(srcdir)/config/netbsd.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4c1518995e0..ee292a29d32 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,73 @@
+2017-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82299
+ * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
+ init.
+ * typeck.c (convert_for_assignment): Likewise.
+
+2017-10-05 Jason Merrill <jason@redhat.com>
+
+ * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
+
+2017-10-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/82406 - C++ error with noexcept function type
+ PR c++/70029 - ICE with ref-qualifier and -flto
+ * tree.c (cxx_copy_lang_qualifiers): New.
+ * cp-tree.h: Declare it.
+ * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
+
+ PR c++/81525 - broken handling of auto in generic lambda.
+ * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
+
+2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR bootstrap/81926
+ * cp-objcp-common.c (cp_get_debug_type): Do only one lookup
+
+2017-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/81929
+ * tree.c (struct replace_placeholders_t): Add pset field.
+ (replace_placeholders_r): Call cp_walk_tree with d->pset as
+ last argument instead of NULL. Formatting fix.
+ (replace_placeholders): Add pset variable, add its address
+ into data. Pass &pset instead of NULL to cp_walk_tree.
+
+2017-09-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/81236 - ICE with template-id in generic lambda
+ * parser.c (parsing_default_capturing_generic_lambda): Don't check
+ for enclosing template.
+ * semantics.c (finish_qualified_id_expr): Call it.
+ * cp-tree.h: Adjust.
+
+ PR c++/80767 - unnecessary instantiation of generic lambda
+ PR c++/82030 - ICE inheriting from multiple lambdas
+ * call.c (convert_like_real): Call build_user_type_conversion_1 if
+ cand is null.
+ (add_conv_candidate): Build a ck_user conversion with no candidate.
+
+ PR c++/80935 - wrong C++17 error with lambda
+ * decl.c (check_for_uninitialized_const_var): Check
+ is_instantiation_of_constexpr.
+
+ PR c++/81671 - nullptr_t template parameter
+ * pt.c (convert_nontype_argument): Fix nullptr_t check.
+
+ PR c++/81525 - wrong constant value with generic lambda
+ * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
+ (tsubst_copy) [VAR_DECL]: Handle auto.
+
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81314
+ * cp-gimplify.c (omp_var_to_track): Look through references.
+ (omp_cxx_notice_variable): Likewise.
+
2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
PR bootstrap/81926
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c0c76aa7303..34d9641a0cd 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2279,8 +2279,10 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
if (i == 0)
{
- t = implicit_conversion (totype, argtype, arg, /*c_cast_p=*/false,
- flags, complain);
+ t = build_identity_conv (argtype, NULL_TREE);
+ t = build_conv (ck_user, totype, t);
+ /* Leave the 'cand' field null; we'll figure out the conversion in
+ convert_like_real if this candidate is chosen. */
convert_type = totype;
}
else if (parmnode == void_list_node)
@@ -6665,6 +6667,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
case ck_user:
{
struct z_candidate *cand = convs->cand;
+
+ if (cand == NULL)
+ /* We chose the surrogate function from add_conv_candidate, now we
+ actually need to build the conversion. */
+ cand = build_user_type_conversion_1 (totype, expr,
+ LOOKUP_NO_CONVERSION, complain);
+
tree convfn = cand->fn;
/* When converting from an init list we consider explicit
@@ -7117,13 +7126,9 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
/* In a template (or ill-formed code), we can have an incomplete type
even after require_complete_type_sfinae, in which case we don't know
whether it has trivial copy or not. */
- && COMPLETE_TYPE_P (arg_type))
+ && COMPLETE_TYPE_P (arg_type)
+ && !cp_unevaluated_operand)
{
- /* Build up a real lvalue-to-rvalue conversion in case the
- copy constructor is trivial but not callable. */
- if (!cp_unevaluated_operand && CLASS_TYPE_P (arg_type))
- force_rvalue (arg, complain);
-
/* [expr.call] 5.2.2/7:
Passing a potentially-evaluated argument of class type (Clause 9)
with a non-trivial copy constructor or a non-trivial destructor
@@ -7135,10 +7140,10 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
If the call appears in the context of a sizeof expression,
it is not potentially-evaluated. */
- if (cp_unevaluated_operand == 0
- && (type_has_nontrivial_copy_init (arg_type)
- || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (arg_type)))
+ if (type_has_nontrivial_copy_init (arg_type)
+ || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (arg_type))
{
+ arg = force_rvalue (arg, complain);
if (complain & tf_warning)
warning (OPT_Wconditionally_supported,
"passing objects of non-trivially-copyable "
@@ -7146,6 +7151,11 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
arg_type);
return cp_build_addr_expr (arg, complain);
}
+ /* Build up a real lvalue-to-rvalue conversion in case the
+ copy constructor is trivial but not callable. */
+ else if (CLASS_TYPE_P (arg_type))
+ force_rvalue (arg, complain);
+
}
return arg;
@@ -9128,7 +9138,9 @@ compare_ics (conversion *ics1, conversion *ics2)
return 0;
else if (t1->kind == ck_user)
{
- if (t1->cand->fn != t2->cand->fn)
+ tree f1 = t1->cand ? t1->cand->fn : t1->type;
+ tree f2 = t2->cand ? t2->cand->fn : t2->type;
+ if (f1 != f2)
return 0;
}
else
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index eae2a55a029..7e7f3a2d101 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -924,6 +924,8 @@ omp_var_to_track (tree decl)
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
if (type == error_mark_node || !CLASS_TYPE_P (type))
@@ -976,6 +978,8 @@ omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl)
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
get_copy_ctor (type, tf_none);
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 126cf137686..d00e5d05fb8 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -162,13 +162,13 @@ cp_get_debug_type (const_tree type)
types on the fly for the debug info only, they would not be attached
to any GC root and always be swept, so we would make the contents of
the debug info depend on the collection points. */
- struct tree_map in, *h;
+ struct tree_map in, *h, **slot;
in.base.from = CONST_CAST_TREE (type);
in.hash = htab_hash_pointer (type);
- h = debug_type_hash->find_with_hash (&in, in.hash);
- if (h)
- return h->to;
+ slot = debug_type_hash->find_slot_with_hash (&in, in.hash, INSERT);
+ if (*slot)
+ return (*slot)->to;
tree t = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
@@ -177,7 +177,7 @@ cp_get_debug_type (const_tree type)
h->base.from = CONST_CAST_TREE (type);
h->hash = htab_hash_pointer (type);
h->to = t;
- *debug_type_hash->find_slot_with_hash (h, h->hash, INSERT) = h;
+ *slot = h;
return t;
}
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 6692ca89bf4..ec63510ef29 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -94,6 +94,8 @@ extern tree cp_unit_size_without_reusable_padding (tree);
#define LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE cxx_builtin_function_ext_scope
#undef LANG_HOOKS_TYPE_HASH_EQ
#define LANG_HOOKS_TYPE_HASH_EQ cxx_type_hash_eq
+#undef LANG_HOOKS_COPY_LANG_QUALIFIERS
+#define LANG_HOOKS_COPY_LANG_QUALIFIERS cxx_copy_lang_qualifiers
#undef LANG_HOOKS_MISSING_NORETURN_OK_P
#define LANG_HOOKS_MISSING_NORETURN_OK_P cp_missing_noreturn_ok_p
#undef LANG_HOOKS_BLOCK_MAY_FALLTHRU
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 9481160e576..18bb8e7f2e4 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6125,7 +6125,7 @@ extern bool maybe_clone_body (tree);
/* In parser.c */
extern tree cp_convert_range_for (tree, tree, tree, tree, unsigned int, bool);
extern bool parsing_nsdmi (void);
-extern bool parsing_default_capturing_generic_lambda_in_template (void);
+extern bool parsing_default_capturing_generic_lambda (void);
extern void inject_this_parameter (tree, cp_cv_quals);
/* in pt.c */
@@ -6703,6 +6703,7 @@ extern tree convert_bitfield_to_declared_type (tree);
extern tree cp_save_expr (tree);
extern bool cast_valid_in_integral_constant_expression_p (tree);
extern bool cxx_type_hash_eq (const_tree, const_tree);
+extern tree cxx_copy_lang_qualifiers (const_tree, const_tree);
extern void cxx_print_statistics (void);
extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8e9a466afa0..f2cd336146c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5579,9 +5579,10 @@ check_for_uninitialized_const_var (tree decl)
"uninitialized const %qD", decl);
else
{
- error_at (DECL_SOURCE_LOCATION (decl),
- "uninitialized variable %qD in %<constexpr%> function",
- decl);
+ if (!is_instantiation_of_constexpr (current_function_decl))
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "uninitialized variable %qD in %<constexpr%> function",
+ decl);
cp_function_chain->invalid_constexpr = true;
}
@@ -6099,7 +6100,10 @@ reshape_init (tree type, tree init, tsubst_flags_t complain)
{
tree elt = CONSTRUCTOR_ELT (init, 0)->value;
if (check_narrowing (ENUM_UNDERLYING_TYPE (type), elt, complain))
- return cp_build_c_cast (type, elt, tf_warning_or_error);
+ {
+ warning_sentinel w (warn_useless_cast);
+ return cp_build_c_cast (type, elt, tf_warning_or_error);
+ }
else
return error_mark_node;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 79aea4a290f..d2904e920b8 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -20486,7 +20486,7 @@ parsing_nsdmi (void)
which we ultimately want to defer to instantiation time. */
bool
-parsing_default_capturing_generic_lambda_in_template (void)
+parsing_default_capturing_generic_lambda (void)
{
if (!processing_template_decl || !current_class_type)
return false;
@@ -20499,12 +20499,7 @@ parsing_default_capturing_generic_lambda_in_template (void)
if (!callop)
return false;
- return (DECL_TEMPLATE_INFO (callop)
- && (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (callop)) == callop)
- && ((current_nonlambda_class_type ()
- && CLASSTYPE_TEMPLATE_INFO (current_nonlambda_class_type ()))
- || ((current_nonlambda_function ()
- && DECL_TEMPLATE_INFO (current_nonlambda_function ())))));
+ return generic_lambda_fn_p (callop);
}
/* Parse a late-specified return type, if any. This is not a separate
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d1c846ecf44..38d7b45eb9b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6849,7 +6849,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
}
else if (NULLPTR_TYPE_P (type))
{
- if (expr != nullptr_node)
+ if (!NULLPTR_TYPE_P (TREE_TYPE (expr)))
{
if (complain & tf_error)
error ("%qE is not a valid template argument for type %qT "
@@ -12896,7 +12896,17 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
&& VAR_HAD_UNKNOWN_BOUND (t)
&& type != error_mark_node)
type = strip_array_domain (type);
- type = tsubst (type, args, complain, in_decl);
+ tree sub_args = args;
+ if (tree auto_node = type_uses_auto (type))
+ {
+ /* Mask off any template args past the variable's context so we
+ don't replace the auto with an unrelated argument. */
+ int nouter = TEMPLATE_TYPE_LEVEL (auto_node) - 1;
+ int extra = TMPL_ARGS_DEPTH (args) - nouter;
+ if (extra > 0)
+ sub_args = strip_innermost_template_args (args, extra);
+ }
+ type = tsubst (type, sub_args, complain, in_decl);
}
if (VAR_P (r))
{
@@ -14687,6 +14697,10 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (r)
= TREE_CONSTANT (r) = true;
DECL_INITIAL (r) = init;
+ if (tree auto_node = type_uses_auto (TREE_TYPE (r)))
+ TREE_TYPE (r)
+ = do_auto_deduction (TREE_TYPE (r), init, auto_node,
+ complain, adc_variable_type);
}
gcc_assert (cp_unevaluated_operand || TREE_STATIC (r)
|| decl_constant_var_p (r)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ecfa4e25765..e0663764638 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2008,7 +2008,9 @@ finish_qualified_id_expr (tree qualifying_class,
qualifying_class);
pop_deferring_access_checks ();
}
- else if (BASELINK_P (expr) && !processing_template_decl)
+ else if (BASELINK_P (expr)
+ && (!processing_template_decl
+ || parsing_default_capturing_generic_lambda ()))
{
/* See if any of the functions are non-static members. */
/* If so, the expression may be relative to 'this'. */
@@ -3584,12 +3586,12 @@ finish_id_expression (tree id_expression,
: CP_ID_KIND_UNQUALIFIED)));
/* If the name was dependent on a template parameter and we're not in a
- default capturing generic lambda within a template, we will resolve the
+ default capturing generic lambda, we will resolve the
name at instantiation time. FIXME: For lambdas, we should defer
building the closure type until instantiation time then we won't need
the extra test here. */
if (dependent_p
- && !parsing_default_capturing_generic_lambda_in_template ())
+ && !parsing_default_capturing_generic_lambda ())
{
if (DECL_P (decl)
&& any_dependent_type_attributes_p (DECL_ATTRIBUTES (decl)))
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7d525ad443d..a5f7f44200c 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2767,6 +2767,7 @@ struct replace_placeholders_t
{
tree obj; /* The object to be substituted for a PLACEHOLDER_EXPR. */
bool seen; /* Whether we've encountered a PLACEHOLDER_EXPR. */
+ hash_set<tree> *pset; /* To avoid walking same trees multiple times. */
};
/* Like substitute_placeholder_in_expr, but handle C++ tree codes and
@@ -2789,8 +2790,8 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
case PLACEHOLDER_EXPR:
{
tree x = obj;
- for (; !(same_type_ignoring_top_level_qualifiers_p
- (TREE_TYPE (*t), TREE_TYPE (x)));
+ for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
+ TREE_TYPE (x));
x = TREE_OPERAND (x, 0))
gcc_assert (TREE_CODE (x) == COMPONENT_REF);
*t = x;
@@ -2822,8 +2823,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
valp = &TARGET_EXPR_INITIAL (*valp);
}
d->obj = subob;
- cp_walk_tree (valp, replace_placeholders_r,
- data_, NULL);
+ cp_walk_tree (valp, replace_placeholders_r, data_, d->pset);
d->obj = obj;
}
*walk_subtrees = false;
@@ -2855,10 +2855,11 @@ replace_placeholders (tree exp, tree obj, bool *seen_p)
return exp;
tree *tp = &exp;
- replace_placeholders_t data = { obj, false };
+ hash_set<tree> pset;
+ replace_placeholders_t data = { obj, false, &pset };
if (TREE_CODE (exp) == TARGET_EXPR)
tp = &TARGET_EXPR_INITIAL (exp);
- cp_walk_tree (tp, replace_placeholders_r, &data, NULL);
+ cp_walk_tree (tp, replace_placeholders_r, &data, &pset);
if (seen_p)
*seen_p = data.seen;
return exp;
@@ -4217,6 +4218,21 @@ cxx_type_hash_eq (const_tree typea, const_tree typeb)
TYPE_RAISES_EXCEPTIONS (typeb), ce_exact);
}
+/* Copy the language-specific type variant modifiers from TYPEB to TYPEA. For
+ C++, these are the exception-specifier and ref-qualifier. */
+
+tree
+cxx_copy_lang_qualifiers (const_tree typea, const_tree typeb)
+{
+ tree type = CONST_CAST_TREE (typea);
+ if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE)
+ {
+ type = build_exception_variant (type, TYPE_RAISES_EXCEPTIONS (typeb));
+ type = build_ref_qualified_type (type, type_memfn_rqual (typeb));
+ }
+ return type;
+}
+
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal. Called from walk_tree. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index cd7732bdd37..d79b724ecca 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8414,7 +8414,10 @@ convert_for_assignment (tree type, tree rhs,
{
tree elt = CONSTRUCTOR_ELT (rhs, 0)->value;
if (check_narrowing (ENUM_UNDERLYING_TYPE (type), elt, complain))
- rhs = cp_build_c_cast (type, elt, complain);
+ {
+ warning_sentinel w (warn_useless_cast);
+ rhs = cp_build_c_cast (type, elt, complain);
+ }
else
rhs = error_mark_node;
}
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index bac9d022420..8b61c8047b3 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -19476,8 +19476,11 @@ AMD Family 15h Bulldozer version 4.
@item btver2
AMD Family 16h CPU.
-@item znver1
+@item amdfam17h
AMD Family 17h CPU.
+
+@item znver1
+AMD Family 17h Zen version 1.
@end table
Here is an example:
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 66a494d5ca6..a634fc90cae 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7203,15 +7203,10 @@ native_encode_vector (const_tree expr, unsigned char *ptr, int len, int off)
static int
native_encode_string (const_tree expr, unsigned char *ptr, int len, int off)
{
- tree type = TREE_TYPE (expr);
- HOST_WIDE_INT total_bytes;
-
- if (TREE_CODE (type) != ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (type)) != INTEGER_TYPE
- || GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))) != BITS_PER_UNIT
- || !tree_fits_shwi_p (TYPE_SIZE_UNIT (type)))
+ if (! can_native_encode_string_p (expr))
return 0;
- total_bytes = tree_to_shwi (TYPE_SIZE_UNIT (type));
+
+ HOST_WIDE_INT total_bytes = tree_to_shwi (TYPE_SIZE_UNIT (TREE_TYPE (expr)));
if ((off == -1 && total_bytes > len)
|| off >= total_bytes)
return 0;
@@ -7505,6 +7500,22 @@ can_native_encode_type_p (tree type)
}
}
+/* Return true iff a STRING_CST S is accepted by
+ native_encode_expr. */
+
+bool
+can_native_encode_string_p (const_tree expr)
+{
+ tree type = TREE_TYPE (expr);
+
+ if (TREE_CODE (type) != ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (type)) != INTEGER_TYPE
+ || (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))) != BITS_PER_UNIT)
+ || !tree_fits_shwi_p (TYPE_SIZE_UNIT (type)))
+ return false;
+ return true;
+}
+
/* Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type
TYPE at compile-time. If we're unable to perform the conversion
return NULL_TREE. */
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index 7abf4d1bc06..4ba0e4550ad 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -28,6 +28,7 @@ extern int folding_initializer;
extern int native_encode_expr (const_tree, unsigned char *, int, int off = -1);
extern tree native_interpret_expr (tree, const unsigned char *, int);
extern bool can_native_encode_type_p (tree);
+extern bool can_native_encode_string_p (const_tree);
/* Fold constants as much as possible in an expression.
Returns the simplified expression.
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2d802f128f0..0eaaf5904b0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/80118
+ * expr.c (gfc_get_full_arrayspec_from_expr): If there is
+ no symtree, set array spec to NULL.
+
2017-09-02 Janus Weil <janus@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 1718e4a55b8..bcf66bb445b 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4515,7 +4515,11 @@ gfc_get_full_arrayspec_from_expr (gfc_expr *expr)
if (expr->expr_type == EXPR_VARIABLE
|| expr->expr_type == EXPR_CONSTANT)
{
- as = expr->symtree->n.sym->as;
+ if (expr->symtree)
+ as = expr->symtree->n.sym->as;
+ else
+ as = NULL;
+
for (ref = expr->ref; ref; ref = ref->next)
{
switch (ref->type)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9a6f3ee700e..c48178f1aa3 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3742,7 +3742,8 @@ driver_handle_option (struct gcc_options *opts,
unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
location_t loc,
const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
- diagnostic_context *dc)
+ diagnostic_context *dc,
+ void (*) (void))
{
size_t opt_index = decoded->opt_index;
const char *arg = decoded->arg;
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 4cb9137dcf0..2c67d97b28f 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -476,7 +476,8 @@ find_phi_def (tree base)
c = base_cand_from_table (base);
- if (!c || c->kind != CAND_PHI)
+ if (!c || c->kind != CAND_PHI
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_phi_result (c->cand_stmt)))
return 0;
return c->cand_num;
@@ -515,6 +516,11 @@ find_basis_for_base_expr (slsr_cand_t c, tree base_expr)
gimple_bb (one_basis->cand_stmt)))
continue;
+ tree lhs = gimple_assign_lhs (one_basis->cand_stmt);
+ if (lhs && TREE_CODE (lhs) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ continue;
+
if (!basis || basis->cand_num < one_basis->cand_num)
basis = one_basis;
}
@@ -2278,7 +2284,7 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
e->src->index, e->dest->index);
print_gimple_stmt (dump_file, cast_stmt, 0, 0);
}
- fprintf (dump_file, "Inserting in block %d: ", e->src->index,
+ fprintf (dump_file, "Inserting on edge %d->%d: ", e->src->index,
e->dest->index);
print_gimple_stmt (dump_file, new_stmt, 0, 0);
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 201ffc1dbac..e23aae91094 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -5434,7 +5434,12 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
side as statements and throw away the assignment. Do this after
gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable
types properly. */
- if (zero_sized_type (TREE_TYPE (*from_p)) && !want_value)
+ if (zero_sized_type (TREE_TYPE (*from_p))
+ && !want_value
+ /* Don't do this for calls that return addressable types, expand_call
+ relies on those having a lhs. */
+ && !(TREE_ADDRESSABLE (TREE_TYPE (*from_p))
+ && TREE_CODE (*from_p) == CALL_EXPR))
{
gimplify_stmt (from_p, pre_p);
gimplify_stmt (to_p, pre_p);
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 08dd980fdf3..b40dd8653b4 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -361,10 +361,14 @@ func_checker::compare_cst_or_decl (tree t1, tree t2)
}
case LABEL_DECL:
{
+ if (t1 == t2)
+ return true;
+
int *bb1 = m_label_bb_map.get (t1);
int *bb2 = m_label_bb_map.get (t2);
- return return_with_debug (*bb1 == *bb2);
+ /* Labels can point to another function (non-local GOTOs). */
+ return return_with_debug (bb1 != NULL && bb2 != NULL && *bb1 == *bb2);
}
case PARM_DECL:
case RESULT_DECL:
@@ -539,11 +543,8 @@ func_checker::compare_operand (tree t1, tree t2)
}
}
-/* Compares two tree list operands T1 and T2 and returns true if these
- two trees are semantically equivalent. */
-
bool
-func_checker::compare_tree_list_operand (tree t1, tree t2)
+func_checker::compare_asm_inputs_outputs (tree t1, tree t2)
{
gcc_assert (TREE_CODE (t1) == TREE_LIST);
gcc_assert (TREE_CODE (t2) == TREE_LIST);
@@ -556,6 +557,16 @@ func_checker::compare_tree_list_operand (tree t1, tree t2)
if (!compare_operand (TREE_VALUE (t1), TREE_VALUE (t2)))
return return_false ();
+ tree p1 = TREE_PURPOSE (t1);
+ tree p2 = TREE_PURPOSE (t2);
+
+ gcc_assert (TREE_CODE (p1) == TREE_LIST);
+ gcc_assert (TREE_CODE (p2) == TREE_LIST);
+
+ if (strcmp (TREE_STRING_POINTER (TREE_VALUE (p1)),
+ TREE_STRING_POINTER (TREE_VALUE (p2))) != 0)
+ return return_false ();
+
t2 = TREE_CHAIN (t2);
}
@@ -1004,7 +1015,7 @@ func_checker::compare_gimple_asm (const gasm *g1, const gasm *g2)
tree input1 = gimple_asm_input_op (g1, i);
tree input2 = gimple_asm_input_op (g2, i);
- if (!compare_tree_list_operand (input1, input2))
+ if (!compare_asm_inputs_outputs (input1, input2))
return return_false_with_msg ("ASM input is different");
}
@@ -1013,7 +1024,7 @@ func_checker::compare_gimple_asm (const gasm *g1, const gasm *g2)
tree output1 = gimple_asm_output_op (g1, i);
tree output2 = gimple_asm_output_op (g2, i);
- if (!compare_tree_list_operand (output1, output2))
+ if (!compare_asm_inputs_outputs (output1, output2))
return return_false_with_msg ("ASM output is different");
}
diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h
index da904b5897e..7e69024165f 100644
--- a/gcc/ipa-icf-gimple.h
+++ b/gcc/ipa-icf-gimple.h
@@ -215,9 +215,9 @@ public:
is returned. */
bool compare_operand (tree t1, tree t2);
- /* Compares two tree list operands T1 and T2 and returns true if these
- two trees are semantically equivalent. */
- bool compare_tree_list_operand (tree t1, tree t2);
+ /* Compares GIMPLE ASM inputs (or outputs) where we iterate tree chain
+ and compare both TREE_PURPOSEs and TREE_VALUEs. */
+ bool compare_asm_inputs_outputs (tree t1, tree t2);
/* Verifies that trees T1 and T2, representing function declarations
are equivalent from perspective of ICF. */
diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c
index d5a3ae56c46..da4a22e7329 100644
--- a/gcc/ipa-visibility.c
+++ b/gcc/ipa-visibility.c
@@ -97,7 +97,8 @@ non_local_p (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
&& !DECL_EXTERNAL (node->decl)
&& !node->externally_visible
&& !node->used_from_other_partition
- && !node->in_other_partition);
+ && !node->in_other_partition
+ && node->get_availability () >= AVAIL_AVAILABLE);
}
/* Return true when function can be marked local. */
diff --git a/gcc/is-a.h b/gcc/is-a.h
index b4e5279514f..2adc7409acb 100644
--- a/gcc/is-a.h
+++ b/gcc/is-a.h
@@ -103,6 +103,11 @@ TYPE dyn_cast <TYPE> (pointer)
Note that we have converted two sets of assertions in the calls to varpool
into safe and efficient use of a variable.
+TYPE safe_dyn_cast <TYPE> (pointer)
+
+ Like dyn_cast <TYPE> (pointer), except that it accepts null pointers
+ and returns null results for them.
+
If you use these functions and get a 'inline function not defined' or a
'missing symbol' error message for 'is_a_helper<....>::test', it means that
@@ -222,4 +227,13 @@ dyn_cast (U *p)
return static_cast <T> (0);
}
+/* Similar to dyn_cast, except that the pointer may be null. */
+
+template <typename T, typename U>
+inline T
+safe_dyn_cast (U *p)
+{
+ return p ? dyn_cast <T> (p) : 0;
+}
+
#endif /* GCC_IS_A_H */
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index eb680848f6a..90d1f6a36d6 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -184,6 +184,7 @@ extern tree lhd_unit_size_without_reusable_padding (tree);
lhd_omp_firstprivatize_type_sizes
#define LANG_HOOKS_OMP_MAPPABLE_TYPE lhd_omp_mappable_type
#define LANG_HOOKS_TYPE_HASH_EQ NULL
+#define LANG_HOOKS_COPY_LANG_QUALIFIERS NULL
#define LANG_HOOKS_GET_ARRAY_DESCR_INFO NULL
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS NULL
#define LANG_HOOKS_GET_TYPE_BIAS NULL
@@ -209,6 +210,7 @@ extern tree lhd_unit_size_without_reusable_padding (tree);
LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \
LANG_HOOKS_OMP_MAPPABLE_TYPE, \
LANG_HOOKS_TYPE_HASH_EQ, \
+ LANG_HOOKS_COPY_LANG_QUALIFIERS, \
LANG_HOOKS_GET_ARRAY_DESCR_INFO, \
LANG_HOOKS_GET_SUBRANGE_BOUNDS, \
LANG_HOOKS_GET_TYPE_BIAS, \
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 2a2ef8affef..6130f0370ea 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -123,6 +123,10 @@ struct lang_hooks_for_types
FUNCTION_TYPE or METHOD_TYPE. */
bool (*type_hash_eq) (const_tree, const_tree);
+ /* If non-NULL, return TYPE1 with any language-specific modifiers copied from
+ TYPE2. */
+ tree (*copy_lang_qualifiers) (const_tree, const_tree);
+
/* Return TRUE if TYPE uses a hidden descriptor and fills in information
for the debugger about the array bounds, strides, etc. */
bool (*get_array_descr_info) (const_tree, struct array_descr_info *);
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index f2f7385a4c7..3c2553368ac 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -988,7 +988,8 @@ handle_option (struct gcc_options *opts,
{
if (!handlers->handlers[i].handler (opts, opts_set, decoded,
lang_mask, kind, loc,
- handlers, dc))
+ handlers, dc,
+ handlers->target_option_override_hook))
return false;
}
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index 50bad77c347..bfa2afb1987 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -167,7 +167,8 @@ lang_handle_option (struct gcc_options *opts,
unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
location_t loc,
const struct cl_option_handlers *handlers,
- diagnostic_context *dc)
+ diagnostic_context *dc,
+ void (*) (void))
{
gcc_assert (opts == &global_options);
gcc_assert (opts_set == &global_options_set);
@@ -267,10 +268,12 @@ decode_cmdline_options_to_array_default_mask (unsigned int argc,
/* Set *HANDLERS to the default set of option handlers for use in the
compilers proper (not the driver). */
void
-set_default_handlers (struct cl_option_handlers *handlers)
+set_default_handlers (struct cl_option_handlers *handlers,
+ void (*target_option_override_hook) (void))
{
handlers->unknown_option_callback = unknown_option_callback;
handlers->wrong_lang_callback = complain_wrong_lang;
+ handlers->target_option_override_hook = target_option_override_hook;
handlers->num_handlers = 3;
handlers->handlers[0].handler = lang_handle_option;
handlers->handlers[0].mask = initial_lang_mask;
@@ -288,7 +291,8 @@ void
decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
struct cl_decoded_option *decoded_options,
unsigned int decoded_options_count,
- location_t loc, diagnostic_context *dc)
+ location_t loc, diagnostic_context *dc,
+ void (*target_option_override_hook) (void))
{
struct cl_option_handlers handlers;
@@ -296,7 +300,7 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
lang_mask = initial_lang_mask;
- set_default_handlers (&handlers);
+ set_default_handlers (&handlers, target_option_override_hook);
default_options_optimization (opts, opts_set,
decoded_options, decoded_options_count,
diff --git a/gcc/opts.c b/gcc/opts.c
index 3f919c8ba95..f03b57aa343 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -217,7 +217,7 @@ target_handle_option (struct gcc_options *opts,
unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
location_t loc,
const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
- diagnostic_context *dc)
+ diagnostic_context *dc, void (*) (void))
{
gcc_assert (dc == global_dc);
gcc_assert (kind == DK_UNSPECIFIED);
@@ -1678,7 +1678,8 @@ common_handle_option (struct gcc_options *opts,
unsigned int lang_mask, int kind ATTRIBUTE_UNUSED,
location_t loc,
const struct cl_option_handlers *handlers,
- diagnostic_context *dc)
+ diagnostic_context *dc,
+ void (*target_option_override_hook) (void))
{
size_t scode = decoded->opt_index;
const char *arg = decoded->arg;
@@ -1705,6 +1706,7 @@ common_handle_option (struct gcc_options *opts,
undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings)
? 0
: CL_UNDOCUMENTED);
+ target_option_override_hook ();
/* First display any single language specific options. */
for (i = 0; i < cl_lang_count; i++)
print_specific_help
@@ -1724,6 +1726,7 @@ common_handle_option (struct gcc_options *opts,
if (lang_mask == CL_DRIVER)
break;
+ target_option_override_hook ();
print_specific_help (CL_TARGET, CL_UNDOCUMENTED, 0, opts, lang_mask);
opts->x_exit_after_options = true;
break;
@@ -1850,8 +1853,11 @@ common_handle_option (struct gcc_options *opts,
}
if (include_flags)
- print_specific_help (include_flags, exclude_flags, 0, opts,
- lang_mask);
+ {
+ target_option_override_hook ();
+ print_specific_help (include_flags, exclude_flags, 0, opts,
+ lang_mask);
+ }
opts->x_exit_after_options = true;
break;
}
diff --git a/gcc/opts.h b/gcc/opts.h
index eb626aa90ec..41847195065 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -267,7 +267,8 @@ struct cl_option_handler_func
const struct cl_decoded_option *decoded,
unsigned int lang_mask, int kind, location_t loc,
const struct cl_option_handlers *handlers,
- diagnostic_context *dc);
+ diagnostic_context *dc,
+ void (*target_option_override_hook) (void));
/* The mask that must have some bit in common with the flags for the
option for this particular handler to be used. */
@@ -289,6 +290,9 @@ struct cl_option_handlers
void (*wrong_lang_callback) (const struct cl_decoded_option *decoded,
unsigned int lang_mask);
+ /* Target option override hook. */
+ void (*target_option_override_hook) (void);
+
/* The number of individual handlers. */
size_t num_handlers;
@@ -333,13 +337,15 @@ extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
const char **argv,
struct cl_decoded_option **decoded_options,
unsigned int *decoded_options_count);
-extern void set_default_handlers (struct cl_option_handlers *handlers);
+extern void set_default_handlers (struct cl_option_handlers *handlers,
+ void (*target_option_override_hook) (void));
extern void decode_options (struct gcc_options *opts,
struct gcc_options *opts_set,
struct cl_decoded_option *decoded_options,
unsigned int decoded_options_count,
location_t loc,
- diagnostic_context *dc);
+ diagnostic_context *dc,
+ void (*target_option_override_hook) (void));
extern int option_enabled (int opt_idx, void *opts);
extern bool get_option_state (struct gcc_options *, int,
struct cl_option_state *);
@@ -384,14 +390,16 @@ extern bool common_handle_option (struct gcc_options *opts,
unsigned int lang_mask, int kind,
location_t loc,
const struct cl_option_handlers *handlers,
- diagnostic_context *dc);
+ diagnostic_context *dc,
+ void (*target_option_override_hook) (void));
extern bool target_handle_option (struct gcc_options *opts,
struct gcc_options *opts_set,
const struct cl_decoded_option *decoded,
unsigned int lang_mask, int kind,
location_t loc,
const struct cl_option_handlers *handlers,
- diagnostic_context *dc);
+ diagnostic_context *dc,
+ void (*target_option_override_hook) (void));
extern void finish_options (struct gcc_options *opts,
struct gcc_options *opts_set,
location_t loc);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b91509e26c1..e9967644dd7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,185 @@
+2017-10-09 James Cowgill <James.Cowgill@imgtec.com>
+
+ * go.test/go-test.exp (go-set-goarch): Update MIPS architecture names.
+
+2017-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82299
+ * g++.dg/cpp0x/pr82299.C: New test.
+
+2017-10-06 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from mainline r253251.
+ 2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/71727
+ * gcc.target/aarch64/pr71727-2.c: New test.
+
+2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/80118
+ * gfortran.dg/zero_sized_7.f90: New test.
+
+2017-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-09-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/82337
+ * gcc.c-torture/compile/pr82337.c: New file.
+
+2017-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/82340
+ * gcc.dg/tree-ssa/pr82340.c: New test.
+
+ 2017-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82159
+ * g++.dg/opt/pr82159.C: New test.
+
+2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from trunk r249639.
+ 2017-06-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports.exp
+ (check_effective_target_arm_neon_ok_nocache): Add flags with
+ -mfloat-abi=hard. Include arm_neon.h.
+ (check_effective_target_arm_neon_ok_no_float_abi_nocache): New.
+ (check_effective_target_arm_neon_ok_no_float_abi): New.
+ * gcc.target/arm/lto/pr65837_0.c: Require
+ arm_neon_ok_no_float_abi. Add -mfpu=neon to dg-lto-options.
+ * gcc.target/arm/lto/pr65837-attr_0.c: Require
+ arm_neon_ok_no_float_abi. Remove dg-suppress-ld-options.
+
+2017-09-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82244
+ * gcc.dg/torture/pr82244.c: New testcase.
+
+ 2017-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82276
+ PR tree-optimization/82244
+ * gcc.dg/torture/pr82276.c: New testcase.
+
+ 2017-09-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82264
+ * gcc.dg/torture/pr82264.c: New testcase.
+
+ 2017-09-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82285
+ * gcc.dg/torture/pr82285.c: New testcase.
+
+ 2017-09-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82291
+ * gcc.dg/torture/pr82291.c: New testcase.
+
+2017-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/81929
+ * g++.dg/ubsan/pr81929.C: New test.
+
+2017-09-19 Martin Liska <mliska@suse.cz>
+
+ Revert backport:
+ 2017-08-10 Martin Liska <mliska@suse.cz>
+
+ PR c++/81355
+ * g++.dg/other/pr81355.C: New test.
+
+2017-09-18 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82084
+ * g++.dg/torture/pr82084.C: New testcase.
+
+ 2017-09-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82108
+ * gcc.dg/vect/pr82108.c: New testcase.
+
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81325
+ * g++.dg/cpp0x/pr81325.C: New test.
+
+ 2017-09-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/82112
+ * gcc.target/powerpc/pr82112.c: New test.
+ * g++.dg/ext/altivec-18.C: New test.
+
+ PR target/82112
+ * c-c++-common/pr82112.c: New test.
+ * gcc.dg/pr82112.c: New test.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-09-12 Martin Liska <mliska@suse.cz>
+
+ PR testsuite/82114
+ * gcc.dg/gimplefe-14.c (main): Add handling of case 0.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-30 Martin Liska <mliska@suse.cz>
+
+ PR inline-asm/82001
+ * gcc.dg/ipa/pr82001.c: New test.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-10 Martin Liska <mliska@suse.cz>
+
+ PR c++/81355
+ * g++.dg/other/pr81355.C: New test.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-08-08 Martin Liska <mliska@suse.cz>
+
+ PR tree-opt/81696
+ * gcc.dg/ipa/pr81696.c: New test.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-07-19 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/63361
+ * c-c++-common/ubsan/float-cast-overflow-1.c: Add either
+ -ffloat-store or -mieee for targets that need it.
+
+2017-09-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-06-28 Martin Liska <mliska@suse.cz>
+
+ PR ipa/81128
+ * gcc.target/i386/pr81128.c: New test.
+
2017-09-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/c-c++-common/pr82112.c b/gcc/testsuite/c-c++-common/pr82112.c
new file mode 100644
index 00000000000..724d74cb33d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr82112.c
@@ -0,0 +1,13 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+
+int c[10], d[10], e[10], f[10], g[10], h[10], i[10], j[10], k[10], l[10];
+
+void
+foo (void)
+{
+ __atomic_load (c, d, __ATOMIC_ACQUIRE);
+ __atomic_store (e, f, __ATOMIC_SEQ_CST);
+ __atomic_exchange (g, h, i, __ATOMIC_RELAXED);
+ __atomic_compare_exchange (j, k, l, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c
index cd6941c9d30..aae88aa3180 100644
--- a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c
@@ -1,6 +1,7 @@
/* { dg-do run { target { lp64 || ilp32 } } } */
/* { dg-options "-fsanitize=float-cast-overflow" } */
-/* { dg-additional-options "-msse2 -mfpmath=sse" { target { sse2_runtime && ia32 } } } */
+/* { dg-additional-options "-ffloat-store" { target { ia32 } } } */
+/* { dg-additional-options "-mieee" { target { { alpha*-*-* } || { sh*-*-* } } } } */
#include <limits.h>
#include "float-cast.h"
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
new file mode 100644
index 00000000000..16adee6b9c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
@@ -0,0 +1,18 @@
+// PR c++/80767
+// { dg-do compile { target c++11 } }
+
+template <typename T, typename U = T> struct A { using type = U; };
+template <typename F, typename... G> struct B : B<F>::type, B<G...>::type {
+ using type = B;
+ using B<F>::type::operator();
+};
+template <typename F> struct B<F> { using type = F; };
+struct {
+ template <typename... F,
+ typename Overload = typename B<typename A<F>::type...>::type>
+ Overload operator()(F...){}
+} a;
+int main() {
+ auto f = a([](int) {}, [](float) {});
+ f({});
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr39.C b/gcc/testsuite/g++.dg/cpp0x/nullptr39.C
new file mode 100644
index 00000000000..a34a6af73e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr39.C
@@ -0,0 +1,15 @@
+// PR c++/81671
+// { dg-do compile { target c++11 } }
+
+namespace std { typedef decltype(nullptr) nullptr_t; }
+
+template<class R, class CB> struct Bar
+{};
+template<class R> struct Bar<R, std::nullptr_t>
+{
+ template<std::nullptr_t> struct Bind { constexpr static int const cb = 0; };
+};
+int foo()
+{
+ return Bar<int, decltype(nullptr)>::Bind<nullptr>::cb;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr81325.C b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
new file mode 100644
index 00000000000..11f0900caa2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
@@ -0,0 +1,84 @@
+// PR target/81325
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fcompare-debug" }
+
+struct A { A(const char *, const int & = 0); };
+template <typename> struct B;
+template <typename> struct C {
+ int _M_i;
+ void m_fn1() { __atomic_fetch_add(&_M_i, 0, __ATOMIC_RELAXED); }
+};
+struct D {
+ int *Data;
+ long Length = 0;
+ D(int) : Data() {}
+};
+template <> struct B<int> : C<int> {};
+struct F {
+ B<int> RefCount;
+ void m_fn2() { RefCount.m_fn1(); }
+};
+struct G {
+ F *Obj;
+ G(const G &p1) : Obj(p1.Obj) {
+ if (Obj) {
+ F *a = 0;
+ a->m_fn2();
+ }
+ }
+};
+struct H {
+ int CPlusPlus : 1;
+};
+struct I {
+ enum {} KindId;
+};
+template <typename ResultT, typename ArgT> struct J {
+ void operator()();
+ ResultT operator()(ArgT) {}
+};
+struct K {
+ int AllowBind;
+ I SupportedKind;
+ I RestrictKind;
+ G Implementation;
+};
+struct L {
+ L(int) : Implementation(Implementation) {}
+ K Implementation;
+};
+struct M {
+ int Param1;
+};
+struct N {
+ N(int, L &p2) : Param2(p2) {}
+ L Param2;
+};
+struct O {
+ L m_fn3();
+};
+L ignoringImpCasts(L);
+J<O, L> b;
+L hasName(const A &);
+M hasOverloadedOperatorName(D);
+J<O, int> c;
+struct P {
+ void m_fn4(L, int);
+};
+struct Q {
+ void m_fn5(P *);
+};
+H d;
+void Q::m_fn5(P *p1) {
+ if (!d.CPlusPlus) {
+ c();
+ L e = 0, f = ignoringImpCasts(e);
+ b(ignoringImpCasts(f)).m_fn3();
+ }
+ hasOverloadedOperatorName(0);
+ hasName("");
+ L g = 0;
+ N(0, g);
+ L h(0);
+ p1->m_fn4(h, 0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr82299.C b/gcc/testsuite/g++.dg/cpp0x/pr82299.C
new file mode 100644
index 00000000000..27f4c5f6172
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr82299.C
@@ -0,0 +1,9 @@
+// PR c++/82299
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wuseless-cast" }
+
+enum Enum : char { A = 0, B = 1 };
+
+struct S {
+ Enum e { Enum::A }; // { dg-bogus "useless cast to type" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-auto1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-auto1.C
new file mode 100644
index 00000000000..b9e98c551c0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-auto1.C
@@ -0,0 +1,19 @@
+// Related to c++/81525
+// { dg-do compile { target c++14 } }
+
+template <class X>
+struct A
+{
+ template <class T>
+ static void f()
+ {
+ [](auto b) {
+ auto c = +b;
+ }(42);
+ }
+};
+
+int main()
+{
+ A<int>::f<int>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C
new file mode 100644
index 00000000000..52f4373ccbd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C
@@ -0,0 +1,20 @@
+// PR c++/81525
+// { dg-do compile { target c++14 } }
+
+template <int i> struct A {
+ constexpr operator int () const { return i; }
+};
+template <int i> constexpr A<i> a = {};
+
+template <typename F> void foo (F f) {
+ f (A<0>{});
+}
+template <typename T>
+void bar (T) {
+ constexpr auto N = a<1>;
+ auto f = [&] (auto i) {
+ static_assert (static_cast<int>(N) == 1, "");
+ };
+ foo (f);
+}
+int main () { bar (0); }
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C
new file mode 100644
index 00000000000..65e52ccd01f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C
@@ -0,0 +1,17 @@
+// PR c++/78840
+// { dg-do compile { target c++14 } }
+
+int global;
+
+void Bar (int);
+
+template<int I> void Foo () {
+ const int cst = global;
+ auto lam0 = [&]() -> void {
+ auto lam1 = [&]() -> void { cst; };
+
+ Bar (cst);
+ };
+}
+
+template void Foo <0> ();
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1.C
new file mode 100644
index 00000000000..52d25af9c5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1.C
@@ -0,0 +1,17 @@
+// PR c++/81236
+// { dg-do compile { target c++14 } }
+
+struct A { constexpr operator int() { return 24; } };
+
+struct MyType {
+ void crash() {
+ auto l = [&](auto i){
+ make_crash<i>(); // Line (1)
+ };
+
+ l(A{});
+ }
+
+ template<int i>
+ void make_crash() {}
+};
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1a.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1a.C
new file mode 100644
index 00000000000..d321a0773ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this1a.C
@@ -0,0 +1,17 @@
+// PR c++/81236
+// { dg-do compile { target c++14 } }
+
+struct A { constexpr operator int() { return 24; } };
+
+struct MyType {
+ void crash() {
+ auto l = [&](auto i){
+ MyType::make_crash<i>(); // Line (1)
+ };
+
+ l(A{});
+ }
+
+ template<int i>
+ void make_crash() {}
+};
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda16.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda16.C
new file mode 100644
index 00000000000..8b9915524ae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda16.C
@@ -0,0 +1,15 @@
+// PR c++/80642
+// { dg-do compile { target c++14 } }
+
+int main()
+{
+ [](auto i)
+ {
+ if (i)
+ {
+ int j;
+ return i + j;
+ }
+ return i;
+ }(0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/lambda-inherit1.C b/gcc/testsuite/g++.dg/cpp1z/lambda-inherit1.C
new file mode 100644
index 00000000000..75ef586b542
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/lambda-inherit1.C
@@ -0,0 +1,23 @@
+// PR c++/80767
+// { dg-options -std=c++17 }
+
+template <typename... Fs>
+struct overloader : Fs...
+{
+ overloader(Fs... fs)
+ : Fs(fs)...
+ { }
+
+ using Fs::operator()...;
+};
+
+struct a { void foo() { } };
+struct b { void bar() { } };
+struct c { void bar() { } };
+
+int main() {
+ overloader{
+ [](a x) { x.foo(); },
+ [](auto x) { x.bar(); }
+ }(a{});
+}
diff --git a/gcc/testsuite/g++.dg/ext/altivec-18.C b/gcc/testsuite/g++.dg/ext/altivec-18.C
new file mode 100644
index 00000000000..5b83028e737
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/altivec-18.C
@@ -0,0 +1,14 @@
+// PR target/82112
+// { dg-do compile { target powerpc*-*-* } }
+// { dg-require-effective-target powerpc_altivec_ok }
+// { dg-options "-maltivec" }
+
+#include <altivec.h>
+
+__attribute__((aligned (16))) extern const unsigned char c[16];
+
+void
+foo (void)
+{
+ vec_ld (0, c);
+}
diff --git a/gcc/testsuite/g++.dg/ext/attrib54.C b/gcc/testsuite/g++.dg/ext/attrib54.C
new file mode 100644
index 00000000000..5ff28c836ef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib54.C
@@ -0,0 +1,14 @@
+// PR c++/82406
+
+class a
+{
+public:
+ template <typename b> void operator() (const b &);
+};
+void c () throw () __attribute__ ((__nonnull__));
+void
+d ()
+{
+ a e;
+ e (c);
+}
diff --git a/gcc/testsuite/g++.dg/ext/varargs2.C b/gcc/testsuite/g++.dg/ext/varargs2.C
new file mode 100644
index 00000000000..13ddf5bb527
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/varargs2.C
@@ -0,0 +1,17 @@
+// { dg-do run }
+
+int c;
+struct X { X() {}; X(const X&) { ++c; } };
+void Foo (X, ...) {}
+void bin (X &p)
+{
+ Foo (p, p);
+}
+
+int main()
+{
+ X x;
+ bin(x);
+ if (c != 2)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr70029_0.C b/gcc/testsuite/g++.dg/lto/pr70029_0.C
new file mode 100644
index 00000000000..9c8c31cf68b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr70029_0.C
@@ -0,0 +1,10 @@
+// PR c++/70029
+// { dg-lto-do assemble }
+
+struct A
+{
+ A();
+ int foo() && __attribute__ ((__warn_unused_result__)) { return 0; }
+};
+
+A a;
diff --git a/gcc/testsuite/g++.dg/opt/pr82159.C b/gcc/testsuite/g++.dg/opt/pr82159.C
new file mode 100644
index 00000000000..e39dbc353fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr82159.C
@@ -0,0 +1,18 @@
+// PR c++/82159
+// { dg-do compile }
+// { dg-options "" }
+
+template<int N>
+struct S
+{
+ ~S () {}
+ template<int M> S<M> foo () { return S<M> (); }
+ unsigned char data[N];
+};
+
+int
+main ()
+{
+ S<16> d;
+ S<0> t = d.foo<0> ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr82084.C b/gcc/testsuite/g++.dg/torture/pr82084.C
new file mode 100644
index 00000000000..416684d2cb8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr82084.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+#include <string>
+int main()
+{
+ wchar_t strs[4][2]= { L"A", L"B", L"C" , L"D"};
+ std::wstring ss(strs[0]);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr81929.C b/gcc/testsuite/g++.dg/ubsan/pr81929.C
new file mode 100644
index 00000000000..90f2628c41d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr81929.C
@@ -0,0 +1,14 @@
+// PR sanitizer/81929
+// { dg-do compile }
+// { dg-options "-std=c++14 -fsanitize=undefined" }
+
+struct S { S &operator<< (long); S foo (); S (); };
+
+void
+bar ()
+{
+ static_cast<S&>(S () << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0).foo ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82337.c b/gcc/testsuite/gcc.c-torture/compile/pr82337.c
new file mode 100644
index 00000000000..f8afa746adb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr82337.c
@@ -0,0 +1,25 @@
+/* PR82337: SLSR needs to prevent abnormal SSA names from
+ serving as a basis. */
+char *a, *b, *c;
+
+struct d {
+ short e;
+ char f[];
+};
+
+extern void j (void);
+
+void
+g() {
+ struct d *h;
+ char *i;
+ int d;
+ do {
+ i = h->f + d;
+ 20 ? j() : 0;
+ i = c;
+ if (__builtin_setjmp (h))
+ b = h->f + d;
+ d = (int)(*i);
+ } while (a);
+}
diff --git a/gcc/testsuite/gcc.dg/gimplefe-14.c b/gcc/testsuite/gcc.dg/gimplefe-14.c
index c0dd54ab430..15022297703 100644
--- a/gcc/testsuite/gcc.dg/gimplefe-14.c
+++ b/gcc/testsuite/gcc.dg/gimplefe-14.c
@@ -7,7 +7,9 @@ main (int argc, char * * argv)
int a;
bb_2:
- switch (argc_2(D)) {default: L2; case 1: L0; case 2: L1; }
+ /* Because of PR82114 we need to handle also 0 as base metal can have
+ argc == 0. */
+ switch (argc_2(D)) {default: L2; case 0: L0; case 1: L0; case 2: L1; }
L0:
a_4 = 0;
diff --git a/gcc/testsuite/gcc.dg/ipa/pr81696.c b/gcc/testsuite/gcc.dg/ipa/pr81696.c
new file mode 100644
index 00000000000..2d3d63ff0bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr81696.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fdump-ipa-icf-details" } */
+
+int
+main (int argc, char **argv)
+{
+ __label__ lab4, lab5, lab6;
+
+ void foo (void) { goto lab4; }
+ void foo2 (void) { goto lab4; }
+ void bar (void) { goto lab5; }
+ void baz (void) { goto lab6; }
+
+ if (argc)
+ foo ();
+ else
+ foo2 ();
+
+ lab4:;
+ bar ();
+ lab5:;
+ baz ();
+ lab6:;
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr82001.c b/gcc/testsuite/gcc.dg/ipa/pr82001.c
new file mode 100644
index 00000000000..05e32b10ef5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr82001.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fdump-ipa-icf-details" } */
+
+int
+mullo (int a, int b)
+{
+ asm("mul %%edx # %%1 was %1"
+ : "+"
+ "a"(a),
+ "+d"(b));
+ return a;
+}
+
+int
+mulhi (int a, int b)
+{
+ asm("mul %%edx # %%1 was %1" : "+d"(a), "+a"(b));
+ return a;
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */
diff --git a/gcc/testsuite/gcc.dg/pr82112.c b/gcc/testsuite/gcc.dg/pr82112.c
new file mode 100644
index 00000000000..4ca69195acc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82112.c
@@ -0,0 +1,21 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90" } */
+
+struct S { int a[10]; } bar (void);
+int b, c;
+
+void
+foo (void)
+{
+ __atomic_load (bar ().a, &b, __ATOMIC_ACQUIRE); /* { dg-error "argument 1 of .__atomic_load. must be a non-void pointer type" } */
+ __atomic_load (&b, bar ().a, __ATOMIC_ACQUIRE); /* { dg-error "argument 2 of .__atomic_load. must be a pointer type" } */
+ __atomic_store (bar ().a, &b, __ATOMIC_SEQ_CST); /* { dg-error "argument 1 of .__atomic_store. must be a non-void pointer type" } */
+ __atomic_store (&b, bar ().a, __ATOMIC_SEQ_CST); /* { dg-error "argument 2 of .__atomic_store. must be a pointer type" } */
+ __atomic_exchange (bar ().a, &b, &c, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_exchange. must be a non-void pointer type" } */
+ __atomic_exchange (&b, bar ().a, &c, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_exchange (&b, &c, bar ().a, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (bar ().a, &b, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_compare_exchange. must be a non-void pointer type" } */
+ __atomic_compare_exchange (&b, bar ().a, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_compare_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (&b, &c, bar ().a, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_compare_exchange. must be a pointer type" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82244.c b/gcc/testsuite/gcc.dg/torture/pr82244.c
new file mode 100644
index 00000000000..3b385f97658
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82244.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+typedef struct a {
+ struct a *b;
+} a;
+
+extern int d(void);
+extern int g(void);
+extern int h(void);
+extern int _setjmp(void *);
+
+int c(void)
+{
+ 1 ? d() : 0;
+
+ a *e;
+ while (e) {
+ e = (e == (a *) c) ? 0 : e->b;
+ while (e) {
+ int f = 0;
+ g();
+ if (_setjmp(0)) {
+ if (f & 6) {
+ ;
+ } else if (f & 2) {
+ h();
+ }
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82264.c b/gcc/testsuite/gcc.dg/torture/pr82264.c
new file mode 100644
index 00000000000..2bc03674ccd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82264.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+char a;
+int c;
+unsigned b ();
+unsigned
+setjmp ()
+{
+}
+static void
+d ()
+{
+ if (b ())
+ c = 3;
+}
+void
+e ()
+{
+ d ();
+ a && ({ setjmp (); });
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82276.c b/gcc/testsuite/gcc.dg/torture/pr82276.c
new file mode 100644
index 00000000000..2f9efc8b914
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82276.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+typedef struct a {
+ struct a *b;
+} a;
+
+extern int d(void);
+extern int g(void);
+extern int h(void);
+extern int _setjmp();
+extern int i(void);
+
+void c(void) {
+ 1 ? d() : 0;
+ a *e;
+ while (e) {
+ e = (e == (a *) c) ? 0 : e->b;
+ while (e) {
+ unsigned int f = 0;
+ g();
+ _setjmp(f);
+ if (f & 6) {
+ ;
+ } else if (f & 2) {
+ ;
+ } else {
+ h();
+ }
+ i();
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82285.c b/gcc/testsuite/gcc.dg/torture/pr82285.c
new file mode 100644
index 00000000000..6edc75070b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82285.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+enum tst { first = 0, second = 1 };
+
+int
+main ()
+{
+ enum tst data[16];
+
+ for (unsigned i = 0; i < 16; i++)
+ data[i] = (i < 5 ? second : first);
+
+ if (data[2] != second)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82291.c b/gcc/testsuite/gcc.dg/torture/pr82291.c
new file mode 100644
index 00000000000..daa1665af20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82291.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+
+int a, c, d, *h;
+unsigned b;
+
+int *fn1 ()
+{
+ int *f[3], g = 0;
+ for (; g < 3; g++)
+ f[g] = &a;
+ if (--b > a)
+ {
+ if (a > b)
+ d++;
+ return f[0];
+ }
+}
+
+void fn2 ()
+{
+ for (; c >= 0; --c)
+ {
+ int j[] = { 0, 0, 0, 0, 0 };
+ int *k = fn1 ();
+ if (!k)
+ __builtin_abort ();
+ h = &j[4];
+ }
+}
+
+int main ()
+{
+ fn2 ();
+ if (d != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr82340.c b/gcc/testsuite/gcc.dg/tree-ssa/pr82340.c
new file mode 100644
index 00000000000..ad9f1cfcee1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82340.c
@@ -0,0 +1,14 @@
+/* PR c/82340 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ssa" } */
+/* { dg-final { scan-tree-dump "D.\[0-9]*\\\[0\\\] ={v} 77;" "ssa" } } */
+
+int
+foo (void)
+{
+ int i;
+ volatile char *p = (volatile char[1]) { 77 };
+ for (i = 1; i < 10; i++)
+ *p = 4;
+ return *p;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr82108.c b/gcc/testsuite/gcc.dg/vect/pr82108.c
new file mode 100644
index 00000000000..5b8faf1aefb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr82108.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vect_float } */
+
+#include "tree-vect.h"
+
+void __attribute__((noinline,noclone))
+downscale_2 (const float* src, int src_n, float* dst)
+{
+ int i;
+
+ for (i = 0; i < src_n; i += 2) {
+ const float* a = src;
+ const float* b = src + 4;
+
+ dst[0] = (a[0] + b[0]) / 2;
+ dst[1] = (a[1] + b[1]) / 2;
+ dst[2] = (a[2] + b[2]) / 2;
+ dst[3] = (a[3] + b[3]) / 2;
+
+ src += 2 * 4;
+ dst += 4;
+ }
+}
+
+int main ()
+{
+ const float in[4 * 4] = {
+ 1, 2, 3, 4,
+ 5, 6, 7, 8,
+
+ 1, 2, 3, 4,
+ 5, 6, 7, 8
+ };
+ float out[2 * 4];
+
+ check_vect ();
+
+ downscale_2 (in, 4, out);
+
+ if (out[0] != 3 || out[1] != 4 || out[2] != 5 || out[3] != 6
+ || out[4] != 3 || out[5] != 4 || out[6] != 5 || out[7] != 6)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr71727-2.c b/gcc/testsuite/gcc.target/aarch64/pr71727-2.c
new file mode 100644
index 00000000000..2bc803ab330
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr71727-2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mstrict-align -O3" } */
+
+unsigned char foo(const unsigned char *buffer, unsigned int length)
+{
+ unsigned char sum;
+ unsigned int count;
+
+ for (sum = 0, count = 0; count < length; count++) {
+ sum = (unsigned char) (sum + *(buffer + count));
+ }
+
+ return sum;
+}
+
+/* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, 15" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr81128.c b/gcc/testsuite/gcc.target/i386/pr81128.c
new file mode 100644
index 00000000000..90a567ad690
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81128.c
@@ -0,0 +1,65 @@
+/* PR ipa/81128 */
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+/* { dg-require-ifunc "" } */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+int resolver_fn = 0;
+int resolved_fn = 0;
+
+static inline void
+do_it_right_at_runtime_A ()
+{
+ resolved_fn++;
+}
+
+static inline void
+do_it_right_at_runtime_B ()
+{
+ resolved_fn++;
+}
+
+static inline void do_it_right_at_runtime (void);
+
+void do_it_right_at_runtime (void)
+ __attribute__ ((ifunc ("resolve_do_it_right_at_runtime")));
+
+static void (*resolve_do_it_right_at_runtime (void)) (void)
+{
+ srand (time (NULL));
+ int r = rand ();
+ resolver_fn++;
+
+ /* Use intermediate variable to get a warning for non-matching
+ * prototype. */
+ typeof(do_it_right_at_runtime) *func;
+ if (r & 1)
+ func = do_it_right_at_runtime_A;
+ else
+ func = do_it_right_at_runtime_B;
+
+ return (void *) func;
+}
+
+int
+main (void)
+{
+ const unsigned int ITERS = 10;
+
+ for (int i = ITERS; i > 0; i--)
+ {
+ do_it_right_at_runtime ();
+ }
+
+ if (resolver_fn != 1)
+ __builtin_abort ();
+
+ if (resolved_fn != 10)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr82112.c b/gcc/testsuite/gcc.target/powerpc/pr82112.c
new file mode 100644
index 00000000000..fbb0f9d3d06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr82112.c
@@ -0,0 +1,16 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -std=gnu90" } */
+
+#include <altivec.h>
+
+struct __attribute__((aligned (16))) S { unsigned char c[64]; } bar (void);
+vector unsigned char v;
+
+void
+foo (void)
+{
+ vec_ld (0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+ vec_st (v, 0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+}
diff --git a/gcc/testsuite/gfortran.dg/zero_sized_7.f90 b/gcc/testsuite/gfortran.dg/zero_sized_7.f90
new file mode 100644
index 00000000000..7908532eaea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/zero_sized_7.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR 80118 - this used to ICE
+! Original test case by Marco Restelli
+module m
+implicit none
+
+ integer, parameter :: not_empty(1) = 0
+ integer, parameter :: empty1(0) = (/integer :: /)
+ integer, parameter :: empty2(0) = 0
+
+contains
+
+ subroutine sub(v)
+ integer, allocatable, intent(out) :: v(:)
+ v = 2*empty2 ! internal compiler error
+ end subroutine sub
+
+end module m
diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp
index 5f6ef299e55..4b10e4e2d16 100644
--- a/gcc/testsuite/go.test/go-test.exp
+++ b/gcc/testsuite/go.test/go-test.exp
@@ -213,29 +213,27 @@ proc go-set-goarch { } {
#error FOO
#endif
}] {
- set goarch "mipso32"
+ set goarch "mips"
} elseif [check_no_compiler_messages mipsn32 assembly {
#if _MIPS_SIM != _ABIN32
#error FOO
#endif
}] {
- set goarch "mipsn32"
+ set goarch "mips64p32"
} elseif [check_no_compiler_messages mipsn64 assembly {
#if _MIPS_SIM != _ABI64
#error FOO
#endif
}] {
- set goarch "mipsn64"
- } elseif [check_no_compiler_messages mipso64 assembly {
- #if _MIPS_SIM != _ABIO64
- #error FOO
- #endif
- }] {
- set goarch "mipso64"
+ set goarch "mips64"
} else {
perror "$target_triplet: unrecognized MIPS ABI"
return ""
}
+
+ if [istarget "mips*el-*-*"] {
+ append goarch "le"
+ }
}
"powerpc*-*-*" {
if [check_effective_target_ilp32] {
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f1384fc2fda..f7a753b9cbe 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2115,7 +2115,8 @@ toplev::main (int argc, char **argv)
enough to default flags appropriately. */
decode_options (&global_options, &global_options_set,
save_decoded_options, save_decoded_options_count,
- UNKNOWN_LOCATION, global_dc);
+ UNKNOWN_LOCATION, global_dc,
+ targetm.target_option.override);
handle_common_deferred_options ();
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index eb637952e22..1dbf0a221b6 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2198,7 +2198,7 @@ predicate_mem_writes (loop_p loop)
gimple *stmt;
int index;
- if (is_true_predicate (cond) || is_false_predicate (cond))
+ if (is_true_predicate (cond))
continue;
swap = false;
@@ -2211,96 +2211,106 @@ predicate_mem_writes (loop_p loop)
vect_sizes.truncate (0);
vect_masks.truncate (0);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- if (!gimple_assign_single_p (stmt = gsi_stmt (gsi)))
- continue;
- else if (gimple_plf (stmt, GF_PLF_2))
- {
- tree lhs = gimple_assign_lhs (stmt);
- tree rhs = gimple_assign_rhs1 (stmt);
- tree ref, addr, ptr, mask;
- gimple *new_stmt;
- gimple_seq stmts = NULL;
- int bitsize = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (lhs)));
- ref = TREE_CODE (lhs) == SSA_NAME ? rhs : lhs;
- mark_addressable (ref);
- addr = force_gimple_operand_gsi (&gsi, build_fold_addr_expr (ref),
- true, NULL_TREE, true,
- GSI_SAME_STMT);
- if (!vect_sizes.is_empty ()
- && (index = mask_exists (bitsize, vect_sizes)) != -1)
- /* Use created mask. */
- mask = vect_masks[index];
- else
- {
- if (COMPARISON_CLASS_P (cond))
- mask = gimple_build (&stmts, TREE_CODE (cond),
- boolean_type_node,
- TREE_OPERAND (cond, 0),
- TREE_OPERAND (cond, 1));
- else
- {
- gcc_assert (TREE_CODE (cond) == SSA_NAME);
- mask = cond;
- }
-
- if (swap)
- {
- tree true_val
- = constant_boolean_node (true, TREE_TYPE (mask));
- mask = gimple_build (&stmts, BIT_XOR_EXPR,
- TREE_TYPE (mask), mask, true_val);
- }
- gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);
-
- mask = ifc_temp_var (TREE_TYPE (mask), mask, &gsi);
- /* Save mask and its size for further use. */
- vect_sizes.safe_push (bitsize);
- vect_masks.safe_push (mask);
- }
- ptr = build_int_cst (reference_alias_ptr_type (ref),
- get_object_alignment (ref));
- /* Copy points-to info if possible. */
- if (TREE_CODE (addr) == SSA_NAME && !SSA_NAME_PTR_INFO (addr))
- copy_ref_info (build2 (MEM_REF, TREE_TYPE (ref), addr, ptr),
- ref);
- if (TREE_CODE (lhs) == SSA_NAME)
- {
- new_stmt
- = gimple_build_call_internal (IFN_MASK_LOAD, 3, addr,
- ptr, mask);
- gimple_call_set_lhs (new_stmt, lhs);
- gimple_set_vuse (new_stmt, gimple_vuse (stmt));
- }
- else
- {
- new_stmt
- = gimple_build_call_internal (IFN_MASK_STORE, 4, addr, ptr,
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
+ {
+ if (!gimple_assign_single_p (stmt = gsi_stmt (gsi)))
+ ;
+ else if (is_false_predicate (cond))
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&gsi, true);
+ release_defs (stmt);
+ continue;
+ }
+ else if (gimple_plf (stmt, GF_PLF_2))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs = gimple_assign_rhs1 (stmt);
+ tree ref, addr, ptr, mask;
+ gimple *new_stmt;
+ gimple_seq stmts = NULL;
+ int bitsize = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (lhs)));
+ ref = TREE_CODE (lhs) == SSA_NAME ? rhs : lhs;
+ mark_addressable (ref);
+ addr = force_gimple_operand_gsi (&gsi, build_fold_addr_expr (ref),
+ true, NULL_TREE, true,
+ GSI_SAME_STMT);
+ if (!vect_sizes.is_empty ()
+ && (index = mask_exists (bitsize, vect_sizes)) != -1)
+ /* Use created mask. */
+ mask = vect_masks[index];
+ else
+ {
+ if (COMPARISON_CLASS_P (cond))
+ mask = gimple_build (&stmts, TREE_CODE (cond),
+ boolean_type_node,
+ TREE_OPERAND (cond, 0),
+ TREE_OPERAND (cond, 1));
+ else
+ {
+ gcc_assert (TREE_CODE (cond) == SSA_NAME);
+ mask = cond;
+ }
+
+ if (swap)
+ {
+ tree true_val
+ = constant_boolean_node (true, TREE_TYPE (mask));
+ mask = gimple_build (&stmts, BIT_XOR_EXPR,
+ TREE_TYPE (mask), mask, true_val);
+ }
+ gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);
+
+ mask = ifc_temp_var (TREE_TYPE (mask), mask, &gsi);
+ /* Save mask and its size for further use. */
+ vect_sizes.safe_push (bitsize);
+ vect_masks.safe_push (mask);
+ }
+ ptr = build_int_cst (reference_alias_ptr_type (ref),
+ get_object_alignment (ref));
+ /* Copy points-to info if possible. */
+ if (TREE_CODE (addr) == SSA_NAME && !SSA_NAME_PTR_INFO (addr))
+ copy_ref_info (build2 (MEM_REF, TREE_TYPE (ref), addr, ptr),
+ ref);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ new_stmt
+ = gimple_build_call_internal (IFN_MASK_LOAD, 3, addr,
+ ptr, mask);
+ gimple_call_set_lhs (new_stmt, lhs);
+ gimple_set_vuse (new_stmt, gimple_vuse (stmt));
+ }
+ else
+ {
+ new_stmt
+ = gimple_build_call_internal (IFN_MASK_STORE, 4, addr, ptr,
mask, rhs);
- gimple_set_vuse (new_stmt, gimple_vuse (stmt));
- gimple_set_vdef (new_stmt, gimple_vdef (stmt));
- SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
- }
+ gimple_set_vuse (new_stmt, gimple_vuse (stmt));
+ gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+ SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
+ }
- gsi_replace (&gsi, new_stmt, true);
- }
- else if (gimple_vdef (stmt))
- {
- tree lhs = gimple_assign_lhs (stmt);
- tree rhs = gimple_assign_rhs1 (stmt);
- tree type = TREE_TYPE (lhs);
-
- lhs = ifc_temp_var (type, unshare_expr (lhs), &gsi);
- rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi);
- if (swap)
- std::swap (lhs, rhs);
- cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond),
- is_gimple_condexpr, NULL_TREE,
- true, GSI_SAME_STMT);
- rhs = fold_build_cond_expr (type, unshare_expr (cond), rhs, lhs);
- gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi));
- update_stmt (stmt);
- }
+ gsi_replace (&gsi, new_stmt, true);
+ }
+ else if (gimple_vdef (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tree rhs = gimple_assign_rhs1 (stmt);
+ tree type = TREE_TYPE (lhs);
+
+ lhs = ifc_temp_var (type, unshare_expr (lhs), &gsi);
+ rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi);
+ if (swap)
+ std::swap (lhs, rhs);
+ cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond),
+ is_gimple_condexpr, NULL_TREE,
+ true, GSI_SAME_STMT);
+ rhs = fold_build_cond_expr (type, unshare_expr (cond), rhs, lhs);
+ gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi));
+ update_stmt (stmt);
+ }
+ gsi_next (&gsi);
+ }
}
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 20f5ce2d140..b64c0fd5259 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -2990,16 +2990,13 @@ vn_phi_eq (const_vn_phi_t const vp1, const_vn_phi_t const vp2)
return false;
/* Verify the controlling stmt is the same. */
- gimple *last1 = last_stmt (idom1);
- gimple *last2 = last_stmt (idom2);
- if (gimple_code (last1) != GIMPLE_COND
- || gimple_code (last2) != GIMPLE_COND)
+ gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1));
+ gcond *last2 = safe_dyn_cast <gcond *> (last_stmt (idom2));
+ if (! last1 || ! last2)
return false;
bool inverted_p;
- if (! cond_stmts_equal_p (as_a <gcond *> (last1),
- vp1->cclhs, vp1->ccrhs,
- as_a <gcond *> (last2),
- vp2->cclhs, vp2->ccrhs,
+ if (! cond_stmts_equal_p (last1, vp1->cclhs, vp1->ccrhs,
+ last2, vp2->cclhs, vp2->ccrhs,
&inverted_p))
return false;
@@ -3084,7 +3081,7 @@ vn_phi_lookup (gimple *phi)
vp1.ccrhs = NULL_TREE;
basic_block idom1 = get_immediate_dominator (CDI_DOMINATORS, vp1.block);
if (EDGE_COUNT (idom1->succs) == 2)
- if (gcond *last1 = dyn_cast <gcond *> (last_stmt (idom1)))
+ if (gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1)))
{
vp1.cclhs = vn_valueize (gimple_cond_lhs (last1));
vp1.ccrhs = vn_valueize (gimple_cond_rhs (last1));
@@ -3130,7 +3127,7 @@ vn_phi_insert (gimple *phi, tree result)
vp1->ccrhs = NULL_TREE;
basic_block idom1 = get_immediate_dominator (CDI_DOMINATORS, vp1->block);
if (EDGE_COUNT (idom1->succs) == 2)
- if (gcond *last1 = dyn_cast <gcond *> (last_stmt (idom1)))
+ if (gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1)))
{
vp1->cclhs = vn_valueize (gimple_cond_lhs (last1));
vp1->ccrhs = vn_valueize (gimple_cond_rhs (last1));
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 39f01337608..18d5f922d22 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -3641,7 +3641,7 @@ vect_recog_bool_pattern (vec<gimple *> *stmts, tree *type_in,
rhs_code = gimple_assign_rhs_code (last_stmt);
if (CONVERT_EXPR_CODE_P (rhs_code))
{
- if (TREE_CODE (TREE_TYPE (lhs)) != INTEGER_TYPE
+ if (! INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
return NULL;
vectype = get_vectype_for_scalar_type (TREE_TYPE (lhs));
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 50f11de7bbe..5096d03b625 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5702,6 +5702,12 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
op = gimple_assign_rhs1 (stmt);
+ /* In the case this is a store from a STRING_CST make sure
+ native_encode_expr can handle it. */
+ if (TREE_CODE (op) == STRING_CST
+ && ! can_native_encode_string_p (op))
+ return false;
+
if (!vect_is_simple_use (op, vinfo, &def_stmt, &dt, &rhs_vectype))
{
if (dump_enabled_p ())
@@ -7109,7 +7115,6 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
{
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
- int group_gap = GROUP_GAP (vinfo_for_stmt (first_stmt));
/* For SLP vectorization we directly vectorize a subchain
without permutation. */
if (slp && ! SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
@@ -7152,7 +7157,8 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
else
{
vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
- group_gap_adj = group_gap;
+ group_gap_adj
+ = group_size - SLP_INSTANCE_GROUP_SIZE (slp_node_instance);
}
}
else
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 697cd88502e..9431b90cf52 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4897,7 +4897,12 @@ build_assert_expr_for (tree cond, tree v)
operand of the ASSERT_EXPR. Create it so the new name and the old one
are registered in the replacement table so that we can fix the SSA web
after adding all the ASSERT_EXPRs. */
- create_new_def_for (v, assertion, NULL);
+ tree new_def = create_new_def_for (v, assertion, NULL);
+ /* Make sure we preserve abnormalness throughout an ASSERT_EXPR chain
+ given we have to be able to fully propagate those out to re-create
+ valid SSA when removing the asserts. */
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (v))
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_def) = 1;
return assertion;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index d7d01bb4e52..69425ab59ee 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4810,8 +4810,9 @@ build_decl_attribute_variant (tree ddecl, tree attribute)
Record such modified types already made so we don't make duplicates. */
tree
-build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
+build_type_attribute_qual_variant (tree otype, tree attribute, int quals)
{
+ tree ttype = otype;
if (! attribute_list_equal (TYPE_ATTRIBUTES (ttype), attribute))
{
inchash::hash hstate;
@@ -4838,6 +4839,11 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
}
ttype = build_qualified_type (ttype, TYPE_UNQUALIFIED);
+ if (lang_hooks.types.copy_lang_qualifiers
+ && otype != TYPE_MAIN_VARIANT (otype))
+ ttype = (lang_hooks.types.copy_lang_qualifiers
+ (ttype, TYPE_MAIN_VARIANT (otype)));
+
ntype = build_distinct_type_copy (ttype);
TYPE_ATTRIBUTES (ntype) = attribute;
@@ -4884,6 +4890,9 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
TYPE_CANONICAL (ntype) = TYPE_CANONICAL (ttype);
ttype = build_qualified_type (ntype, quals);
+ if (lang_hooks.types.copy_lang_qualifiers
+ && otype != TYPE_MAIN_VARIANT (otype))
+ ttype = lang_hooks.types.copy_lang_qualifiers (ttype, otype);
}
else if (TYPE_QUALS (ttype) != quals)
ttype = build_qualified_type (ttype, quals);
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 190b044f420..b3fc5e42c85 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,13 @@
+2017-10-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * elf.c: Fix typo in the last commit, SFH_COMPRESSED vs SHF_COMPRESSED.
+
+2017-10-10 Ian Lance Taylor <iant@golang.org>
+
+ PR go/80914
+ * elf.c (SHF_COMPRESSED): Define.
+ (elf_add): Ignore debug sections with SHF_COMPRESSED set.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 89ed42b8021..74f653854e9 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -103,6 +103,7 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *,
#undef SHT_SYMTAB
#undef SHT_STRTAB
#undef SHT_DYNSYM
+#undef SHF_COMPRESSED
#undef STT_OBJECT
#undef STT_FUNC
@@ -195,6 +196,8 @@ typedef struct {
#define SHT_STRTAB 3
#define SHT_DYNSYM 11
+#define SHF_COMPRESSED 0x800
+
#if BACKTRACE_ELF_SIZE == 32
typedef struct
@@ -700,7 +703,8 @@ elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address,
for (j = 0; j < (int) DEBUG_MAX; ++j)
{
- if (strcmp (name, debug_section_names[j]) == 0)
+ if (strcmp (name, debug_section_names[j]) == 0
+ && (shdr->sh_flags & SHF_COMPRESSED) == 0)
{
sections[j].offset = shdr->sh_offset;
sections[j].size = shdr->sh_size;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index f23623b7fc5..aa1b04bec43 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-28 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ Backport from mainline
+ 2017-05-14 Krister Walfridsson <krister.walfridsson@gmail.com>
+
+ PR target/80600
+ * config.host (*-*-netbsd*): Add t-slibgcc-libgcc to tmake_file.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libgcc/config.host b/libgcc/config.host
index 6640afbcd21..1d42e8eeafe 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -249,6 +249,7 @@ case ${host} in
*-*-netbsd*)
tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+ tmake_file="$tmake_file t-slibgcc-libgcc"
# NetBSD 1.7 and later are set up to use GCC's crtstuff for
# ELF configurations. We will clear extra_parts in the
# a.out configurations.
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index ae277910839..8feed2f50da 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,15 @@
+2017-09-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/78387
+ * io/list_read.c (nml_read_obj): Remove use of stash.
+ * io/transfer.c (st_read_done, st_write_done): Likewise.
+ * io/unit.c (stash_internal_unit): Delete function.
+ (get_unit): Remove use of stash.
+ (init_units): Likewise.
+ (close_units): Likewise.
+ * io/write.c (nml_write_obj): Likewise:
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 943afb51c6a..6a05cfe4f22 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -3019,11 +3019,6 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
child_iomsg_len = IOMSG_LEN;
}
- /* If reading from an internal unit, stash it to allow
- the child procedure to access it. */
- if (is_internal_unit (dtp))
- stash_internal_unit (dtp);
-
/* Call the user defined formatted READ procedure. */
dtp->u.p.current_unit->child_dtio++;
dtio_ptr ((void *)&list_obj, &unit, iotype, &vlist,
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 298b29e8d3e..529637061b1 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -4080,8 +4080,7 @@ st_read_done (st_parameter_dt *dtp)
free_ionml (dtp);
/* If this is a parent READ statement we do not need to retain the
- internal unit structure for child use. Free it and stash the unit
- number for reuse. */
+ internal unit structure for child use. */
if (dtp->u.p.current_unit != NULL
&& dtp->u.p.current_unit->child_dtio == 0)
{
@@ -4095,7 +4094,6 @@ st_read_done (st_parameter_dt *dtp)
if (dtp->u.p.current_unit->ls)
free (dtp->u.p.current_unit->ls);
dtp->u.p.current_unit->ls = NULL;
- stash_internal_unit (dtp);
}
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
{
@@ -4153,8 +4151,7 @@ st_write_done (st_parameter_dt *dtp)
free_ionml (dtp);
/* If this is a parent WRITE statement we do not need to retain the
- internal unit structure for child use. Free it and stash the
- unit number for reuse. */
+ internal unit structure for child use. */
if (is_internal_unit (dtp) &&
(dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
{
@@ -4165,7 +4162,6 @@ st_write_done (st_parameter_dt *dtp)
if (dtp->u.p.current_unit->ls)
free (dtp->u.p.current_unit->ls);
dtp->u.p.current_unit->ls = NULL;
- stash_internal_unit (dtp);
}
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
{
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index ef94294526a..e06867aa0a1 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -94,16 +94,6 @@ static void newunit_free (int);
/* Unit numbers assigned with NEWUNIT start from here. */
#define NEWUNIT_START -10
-
-#define NEWUNIT_STACK_SIZE 16
-
-/* A stack to save previously used newunit-assigned unit numbers to
- allow them to be reused without reallocating the gfc_unit structure
- which is still in the treap. */
-static gfc_saved_unit newunit_stack[NEWUNIT_STACK_SIZE];
-static int newunit_tos = 0; /* Index to Top of Stack. */
-
-
#define CACHE_SIZE 3
static gfc_unit *unit_cache[CACHE_SIZE];
gfc_offset max_offset;
@@ -538,22 +528,6 @@ set_internal_unit (st_parameter_dt *dtp, gfc_unit *iunit, int kind)
}
-/* stash_internal_unit()-- Push the internal unit number onto the
- avaialble stack. */
-void
-stash_internal_unit (st_parameter_dt *dtp)
-{
- __gthread_mutex_lock (&unit_lock);
- newunit_tos++;
- if (newunit_tos >= NEWUNIT_STACK_SIZE)
- internal_error (&dtp->common, "stash_internal_unit(): Stack Size Exceeded");
- newunit_stack[newunit_tos].unit_number = dtp->common.unit;
- newunit_stack[newunit_tos].unit = dtp->u.p.current_unit;
- __gthread_mutex_unlock (&unit_lock);
-}
-
-
-
/* get_unit()-- Returns the unit structure associated with the integer
unit or the internal file. */
@@ -572,49 +546,13 @@ get_unit (st_parameter_dt *dtp, int do_create)
else
internal_error (&dtp->common, "get_unit(): Bad internal unit KIND");
- if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) != 0)
- {
- dtp->u.p.unit_is_internal = 1;
- dtp->common.unit = newunit_alloc ();
- unit = get_gfc_unit (dtp->common.unit, do_create);
- set_internal_unit (dtp, unit, kind);
- fbuf_init (unit, 128);
- return unit;
- }
- else
- {
- __gthread_mutex_lock (&unit_lock);
- if (newunit_tos)
- {
- dtp->common.unit = newunit_stack[newunit_tos].unit_number;
- unit = newunit_stack[newunit_tos--].unit;
- __gthread_mutex_unlock (&unit_lock);
- unit->fbuf->act = unit->fbuf->pos = 0;
- }
- else
- {
- __gthread_mutex_unlock (&unit_lock);
- dtp->common.unit = newunit_alloc ();
- unit = xcalloc (1, sizeof (gfc_unit));
- fbuf_init (unit, 128);
- }
- set_internal_unit (dtp, unit, kind);
- return unit;
- }
- }
-
- /* If an internal unit number is passed from the parent to the child
- it should have been stashed on the newunit_stack ready to be used.
- Check for it now and return the internal unit if found. */
- __gthread_mutex_lock (&unit_lock);
- if (newunit_tos && (dtp->common.unit <= NEWUNIT_START)
- && (dtp->common.unit == newunit_stack[newunit_tos].unit_number))
- {
- unit = newunit_stack[newunit_tos--].unit;
- __gthread_mutex_unlock (&unit_lock);
+ dtp->u.p.unit_is_internal = 1;
+ dtp->common.unit = newunit_alloc ();
+ unit = get_gfc_unit (dtp->common.unit, do_create);
+ set_internal_unit (dtp, unit, kind);
+ fbuf_init (unit, 128);
return unit;
}
- __gthread_mutex_unlock (&unit_lock);
/* Has to be an external unit. */
dtp->u.p.unit_is_internal = 0;
@@ -752,10 +690,6 @@ init_units (void)
max_offset = 0;
for (i = 0; i < sizeof (max_offset) * 8 - 1; i++)
max_offset = max_offset + ((gfc_offset) 1 << i);
-
- /* Initialize the newunit stack. */
- memset (newunit_stack, 0, NEWUNIT_STACK_SIZE * sizeof(gfc_saved_unit));
- newunit_tos = 0;
}
@@ -837,14 +771,6 @@ close_units (void)
close_unit_1 (unit_root, 1);
__gthread_mutex_unlock (&unit_lock);
- while (newunit_tos != 0)
- if (newunit_stack[newunit_tos].unit)
- {
- fbuf_destroy (newunit_stack[newunit_tos].unit);
- free (newunit_stack[newunit_tos].unit->s);
- free (newunit_stack[newunit_tos--].unit);
- }
-
free (newunits);
#ifdef HAVE_FREELOCALE
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 8dbbb0912e3..c9aad150090 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -2248,11 +2248,6 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info *obj, index_type offset,
child_iomsg_len = IOMSG_LEN;
}
- /* If writing to an internal unit, stash it to allow
- the child procedure to access it. */
- if (is_internal_unit (dtp))
- stash_internal_unit (dtp);
-
/* Call the user defined formatted WRITE procedure. */
dtp->u.p.current_unit->child_dtio++;
if (obj->type == BT_DERIVED)
diff --git a/libgo/MERGE b/libgo/MERGE
index a5808db54ff..ddfb006437b 100644
--- a/libgo/MERGE
+++ b/libgo/MERGE
@@ -1,4 +1,4 @@
-a4c18f063b6659079ca2848ca217a0587dabc001
+352996a381701cfa0c16e8de29cbde8f3922182f
The first line of this file holds the git revision number of the
last merge done from the master library sources.
diff --git a/libgo/VERSION b/libgo/VERSION
index dce1d463ba1..b38ce7712f8 100644
--- a/libgo/VERSION
+++ b/libgo/VERSION
@@ -1 +1 @@
-go1.8.1
+go1.8.3
diff --git a/libgo/config.h.in b/libgo/config.h.in
index a669ff7add1..a7b1d47ac9b 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -114,6 +114,9 @@
/* Define to 1 if you have the <linux/netlink.h> header file. */
#undef HAVE_LINUX_NETLINK_H
+/* Define to 1 if you have the <linux/ptrace.h> header file. */
+#undef HAVE_LINUX_PTRACE_H
+
/* Define to 1 if you have the <linux/reboot.h> header file. */
#undef HAVE_LINUX_REBOOT_H
diff --git a/libgo/configure b/libgo/configure
index f571d97aad6..b848167d517 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -13625,7 +13625,7 @@ esac
# supported by the gofrontend and all architectures supported by the
# gc toolchain.
# N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
-ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mipso32 mipsn32 mipso64 mipsn64 mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
# All known GOARCH_FAMILY values.
ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SPARC SPARC64"
@@ -13728,16 +13728,6 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
mips_abi="n64"
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#if _MIPS_SIM != _ABIO64
-#error not o64
-#endif
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- mips_abi="o64"
-else
as_fn_error "unknown MIPS ABI" "$LINENO" 5
mips_abi="n32"
fi
@@ -13746,26 +13736,24 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
case "$mips_abi" in
- "o32") GOARCH=mipso32 ;;
- "n32") GOARCH=mipsn32 ;;
- "n64") GOARCH=mipsn64 ;;
- "o64") GOARCH=mipso64 ;;
+ "o32") GOARCH=mips ;;
+ "n32") GOARCH=mips64p32 ;;
+ "n64") GOARCH=mips64 ;;
esac
case "$mips_abi" in
"o32" | "n32")
GOARCH_FAMILY=MIPS
GOARCH_MINFRAMESIZE=4
;;
- "n64" | "o64")
+ "n64")
GOARCH_FAMILY=MIPS64
GOARCH_MINFRAMESIZE=8
;;
esac
case "${host}" in
- mips*el)
+ mips*el-*-*)
+ GOARCH="${GOARCH}le"
;;
*)
GOARCH_BIGENDIAN=1
@@ -14762,7 +14750,7 @@ $as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
fi
-for ac_header in port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h
+for ac_header in port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 7c49d5514e7..672bc0073bc 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -197,7 +197,7 @@ AC_SUBST(USE_DEJAGNU)
# supported by the gofrontend and all architectures supported by the
# gc toolchain.
# N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
-ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mipso32 mipsn32 mipso64 mipsn64 mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
# All known GOARCH_FAMILY values.
ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SPARC SPARC64"
@@ -280,31 +280,26 @@ GOARCH_HUGEPAGESIZE="1 << 21"
#error not n64
#endif],
[mips_abi="n64"],
- [AC_COMPILE_IFELSE([
-#if _MIPS_SIM != _ABIO64
-#error not o64
-#endif],
-[mips_abi="o64"],
[AC_MSG_ERROR([unknown MIPS ABI])
-[mips_abi="n32"]])])])])
+[mips_abi="n32"]])])])
case "$mips_abi" in
- "o32") GOARCH=mipso32 ;;
- "n32") GOARCH=mipsn32 ;;
- "n64") GOARCH=mipsn64 ;;
- "o64") GOARCH=mipso64 ;;
+ "o32") GOARCH=mips ;;
+ "n32") GOARCH=mips64p32 ;;
+ "n64") GOARCH=mips64 ;;
esac
case "$mips_abi" in
"o32" | "n32")
GOARCH_FAMILY=MIPS
GOARCH_MINFRAMESIZE=4
;;
- "n64" | "o64")
+ "n64")
GOARCH_FAMILY=MIPS64
GOARCH_MINFRAMESIZE=8
;;
esac
case "${host}" in
- mips*el)
+ mips*el-*-*)
+ GOARCH="${GOARCH}le"
;;
*)
GOARCH_BIGENDIAN=1
@@ -569,7 +564,7 @@ AC_C_BIGENDIAN
GCC_CHECK_UNWIND_GETIPINFO
-AC_CHECK_HEADERS(port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
+AC_CHECK_HEADERS(port.h sched.h semaphore.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/event.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/ptrace.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.h], [], [],
[#ifdef HAVE_SYS_SOCKET_H
diff --git a/libgo/go/cmd/cgo/main.go b/libgo/go/cmd/cgo/main.go
index c91c830260f..ac102050dad 100644
--- a/libgo/go/cmd/cgo/main.go
+++ b/libgo/go/cmd/cgo/main.go
@@ -139,51 +139,47 @@ func usage() {
}
var ptrSizeMap = map[string]int64{
- "386": 4,
- "alpha": 8,
- "amd64": 8,
- "arm": 4,
- "arm64": 8,
- "m68k": 4,
- "mipso32": 4,
- "mipsn32": 4,
- "mipso64": 8,
- "mipsn64": 8,
- "mips": 4,
- "mipsle": 4,
- "mips64": 8,
- "mips64le": 8,
- "ppc": 4,
- "ppc64": 8,
- "ppc64le": 8,
- "s390": 4,
- "s390x": 8,
- "sparc": 4,
- "sparc64": 8,
+ "386": 4,
+ "alpha": 8,
+ "amd64": 8,
+ "arm": 4,
+ "arm64": 8,
+ "m68k": 4,
+ "mips": 4,
+ "mipsle": 4,
+ "mips64": 8,
+ "mips64le": 8,
+ "mips64p32": 4,
+ "mips64p32le": 4,
+ "ppc": 4,
+ "ppc64": 8,
+ "ppc64le": 8,
+ "s390": 4,
+ "s390x": 8,
+ "sparc": 4,
+ "sparc64": 8,
}
var intSizeMap = map[string]int64{
- "386": 4,
- "alpha": 8,
- "amd64": 8,
- "arm": 4,
- "arm64": 8,
- "m68k": 4,
- "mipso32": 4,
- "mipsn32": 4,
- "mipso64": 8,
- "mipsn64": 8,
- "mips": 4,
- "mipsle": 4,
- "mips64": 8,
- "mips64le": 8,
- "ppc": 4,
- "ppc64": 8,
- "ppc64le": 8,
- "s390": 4,
- "s390x": 8,
- "sparc": 4,
- "sparc64": 8,
+ "386": 4,
+ "alpha": 8,
+ "amd64": 8,
+ "arm": 4,
+ "arm64": 8,
+ "m68k": 4,
+ "mips": 4,
+ "mipsle": 4,
+ "mips64": 8,
+ "mips64le": 8,
+ "mips64p32": 8,
+ "mips64p32le": 8,
+ "ppc": 4,
+ "ppc64": 8,
+ "ppc64le": 8,
+ "s390": 4,
+ "s390x": 8,
+ "sparc": 4,
+ "sparc64": 8,
}
var cPrefix string
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go
index f2d11f43f19..4b9150583ee 100644
--- a/libgo/go/cmd/go/build.go
+++ b/libgo/go/cmd/go/build.go
@@ -3133,6 +3133,26 @@ func (b *builder) ccompile(p *Package, outfile string, flags []string, file stri
desc := p.ImportPath
output, err := b.runOut(p.Dir, desc, nil, compiler, flags, "-o", outfile, "-c", file)
if len(output) > 0 {
+ // On FreeBSD 11, when we pass -g to clang 3.8 it
+ // invokes its internal assembler with -dwarf-version=2.
+ // When it sees .section .note.GNU-stack, it warns
+ // "DWARF2 only supports one section per compilation unit".
+ // This warning makes no sense, since the section is empty,
+ // but it confuses people.
+ // We work around the problem by detecting the warning
+ // and dropping -g and trying again.
+ if bytes.Contains(output, []byte("DWARF2 only supports one section per compilation unit")) {
+ newFlags := make([]string, 0, len(flags))
+ for _, f := range flags {
+ if !strings.HasPrefix(f, "-g") {
+ newFlags = append(newFlags, f)
+ }
+ }
+ if len(newFlags) < len(flags) {
+ return b.ccompile(p, outfile, newFlags, file, compiler)
+ }
+ }
+
b.showOutput(p.Dir, desc, b.processOutput(output))
if err != nil {
err = errPrintedOutput
diff --git a/libgo/go/crypto/elliptic/elliptic_test.go b/libgo/go/crypto/elliptic/elliptic_test.go
index 902c4143837..c3e4c17d250 100644
--- a/libgo/go/crypto/elliptic/elliptic_test.go
+++ b/libgo/go/crypto/elliptic/elliptic_test.go
@@ -300,6 +300,29 @@ var p224BaseMultTests = []baseMultTest{
},
}
+type scalarMultTest struct {
+ k string
+ xIn, yIn string
+ xOut, yOut string
+}
+
+var p256MultTests = []scalarMultTest{
+ {
+ "2a265f8bcbdcaf94d58519141e578124cb40d64a501fba9c11847b28965bc737",
+ "023819813ac969847059028ea88a1f30dfbcde03fc791d3a252c6b41211882ea",
+ "f93e4ae433cc12cf2a43fc0ef26400c0e125508224cdb649380f25479148a4ad",
+ "4d4de80f1534850d261075997e3049321a0864082d24a917863366c0724f5ae3",
+ "a22d2b7f7818a3563e0f7a76c9bf0921ac55e06e2e4d11795b233824b1db8cc0",
+ },
+ {
+ "313f72ff9fe811bf573176231b286a3bdb6f1b14e05c40146590727a71c3bccd",
+ "cc11887b2d66cbae8f4d306627192522932146b42f01d3c6f92bd5c8ba739b06",
+ "a2f08a029cd06b46183085bae9248b0ed15b70280c7ef13a457f5af382426031",
+ "831c3f6b5f762d2f461901577af41354ac5f228c2591f84f8a6e51e2e3f17991",
+ "93f90934cd0ef2c698cc471c60a93524e87ab31ca2412252337f364513e43684",
+ },
+}
+
func TestBaseMult(t *testing.T) {
p224 := P224()
for i, e := range p224BaseMultTests {
@@ -379,6 +402,19 @@ func TestP256Mult(t *testing.T) {
break
}
}
+
+ for i, e := range p256MultTests {
+ x, _ := new(big.Int).SetString(e.xIn, 16)
+ y, _ := new(big.Int).SetString(e.yIn, 16)
+ k, _ := new(big.Int).SetString(e.k, 16)
+ expectedX, _ := new(big.Int).SetString(e.xOut, 16)
+ expectedY, _ := new(big.Int).SetString(e.yOut, 16)
+
+ xx, yy := p256.ScalarMult(x, y, k.Bytes())
+ if xx.Cmp(expectedX) != 0 || yy.Cmp(expectedY) != 0 {
+ t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, xx, yy, expectedX, expectedY)
+ }
+ }
}
func TestInfinity(t *testing.T) {
diff --git a/libgo/go/database/sql/sql.go b/libgo/go/database/sql/sql.go
index c016681fca1..f8a884446e4 100644
--- a/libgo/go/database/sql/sql.go
+++ b/libgo/go/database/sql/sql.go
@@ -1955,12 +1955,12 @@ func (s *Stmt) QueryContext(ctx context.Context, args ...interface{}) (*Rows, er
rowsi: rowsi,
// releaseConn set below
}
- rows.initContextClose(ctx)
s.db.addDep(s, rows)
rows.releaseConn = func(err error) {
releaseConn(err)
s.db.removeDep(s, rows)
}
+ rows.initContextClose(ctx)
return rows, nil
}
diff --git a/libgo/go/database/sql/sql_test.go b/libgo/go/database/sql/sql_test.go
index 450e5f1f8c9..381aafc86b7 100644
--- a/libgo/go/database/sql/sql_test.go
+++ b/libgo/go/database/sql/sql_test.go
@@ -322,7 +322,7 @@ func TestQueryContext(t *testing.T) {
select {
case <-ctx.Done():
if err := ctx.Err(); err != context.Canceled {
- t.Fatalf("context err = %v; want context.Canceled")
+ t.Fatalf("context err = %v; want context.Canceled", ctx.Err())
}
default:
t.Fatalf("context err = nil; want context.Canceled")
@@ -413,7 +413,8 @@ func TestTxContextWait(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
- ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
+ defer cancel()
tx, err := db.BeginTx(ctx, nil)
if err != nil {
diff --git a/libgo/go/go/build/syslist.go b/libgo/go/go/build/syslist.go
index ea316ea61a2..39603f46ed1 100644
--- a/libgo/go/go/build/syslist.go
+++ b/libgo/go/go/build/syslist.go
@@ -5,4 +5,4 @@
package build
const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos "
-const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le mipso32 mipsn32 mipsn64 mipso64 ppc s390 s390x sparc sparc64 "
+const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_mipsn32.go b/libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go
index 8f481fa58dd..4d8f6c53a99 100644
--- a/libgo/go/internal/syscall/unix/getrandom_linux_mipsn32.go
+++ b/libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build mipsn32
+// +build mips64p32 mips64p32le
package unix
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_mips64x.go b/libgo/go/internal/syscall/unix/getrandom_linux_mips64x.go
index 02fd1a06423..b328b8f1f0e 100644
--- a/libgo/go/internal/syscall/unix/getrandom_linux_mips64x.go
+++ b/libgo/go/internal/syscall/unix/getrandom_linux_mips64x.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build mips64 mips64le mipsn64 mipso64
+// +build mips64 mips64le
package unix
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_mipso32.go b/libgo/go/internal/syscall/unix/getrandom_linux_mipso32.go
deleted file mode 100644
index 612d00b4af1..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_mipso32.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build mipso32
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 4353
diff --git a/libgo/go/net/http/h2_bundle.go b/libgo/go/net/http/h2_bundle.go
index 25fdf09d92b..6fbbcd0fc76 100644
--- a/libgo/go/net/http/h2_bundle.go
+++ b/libgo/go/net/http/h2_bundle.go
@@ -1,4 +1,4 @@
-// Code generated by golang.org/x/tools/cmd/bundle.
+// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
//go:generate bundle -o h2_bundle.go -prefix http2 -underscore golang.org/x/net/http2
// Package http2 implements the HTTP/2 protocol.
@@ -3536,9 +3536,13 @@ func (sc *http2serverConn) serve() {
sc.idleTimerCh = sc.idleTimer.C
}
- var gracefulShutdownCh <-chan struct{}
+ var gracefulShutdownCh chan struct{}
if sc.hs != nil {
- gracefulShutdownCh = http2h1ServerShutdownChan(sc.hs)
+ ch := http2h1ServerShutdownChan(sc.hs)
+ if ch != nil {
+ gracefulShutdownCh = make(chan struct{})
+ go sc.awaitGracefulShutdown(ch, gracefulShutdownCh)
+ }
}
go sc.readFrames()
@@ -3587,6 +3591,14 @@ func (sc *http2serverConn) serve() {
}
}
+func (sc *http2serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, privateCh chan struct{}) {
+ select {
+ case <-sc.doneServing:
+ case <-sharedCh:
+ close(privateCh)
+ }
+}
+
// readPreface reads the ClientPreface greeting from the peer
// or returns an error on timeout or an invalid greeting.
func (sc *http2serverConn) readPreface() error {
@@ -6003,7 +6015,6 @@ func http2commaSeparatedTrailers(req *Request) (string, error) {
}
if len(keys) > 0 {
sort.Strings(keys)
-
return strings.Join(keys, ","), nil
}
return "", nil
diff --git a/libgo/go/runtime/hash32.go b/libgo/go/runtime/hash32.go
index cfb3a58c7c8..dd2e657fe3f 100644
--- a/libgo/go/runtime/hash32.go
+++ b/libgo/go/runtime/hash32.go
@@ -6,7 +6,7 @@
// xxhash: https://code.google.com/p/xxhash/
// cityhash: https://code.google.com/p/cityhash/
-// +build 386 arm armbe m68k mipso32 mipsn32 mips mipsle ppc s390 sparc
+// +build 386 arm armbe m68k mips mipsle ppc s390 sparc
package runtime
diff --git a/libgo/go/runtime/hash64.go b/libgo/go/runtime/hash64.go
index 551d5b5f8d8..f7d4a6f2f2a 100644
--- a/libgo/go/runtime/hash64.go
+++ b/libgo/go/runtime/hash64.go
@@ -6,7 +6,7 @@
// xxhash: https://code.google.com/p/xxhash/
// cityhash: https://code.google.com/p/cityhash/
-// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x alpha arm64be ia64 mipso64 mipsn64 mips64p32 mips64p32le sparc64
+// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x alpha arm64be ia64 mips64p32 mips64p32le sparc64
package runtime
diff --git a/libgo/go/runtime/lfstack_32bit.go b/libgo/go/runtime/lfstack_32bit.go
index bc53b13c414..ab0edab68f5 100644
--- a/libgo/go/runtime/lfstack_32bit.go
+++ b/libgo/go/runtime/lfstack_32bit.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build 386 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le mipso32 mipsn32 ppc s390 sparc
+// +build 386 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le ppc s390 sparc
package runtime
diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go
index 213efb10706..00541613bda 100644
--- a/libgo/go/runtime/lfstack_64bit.go
+++ b/libgo/go/runtime/lfstack_64bit.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64
+// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha sparc64
package runtime
diff --git a/libgo/go/runtime/unaligned2.go b/libgo/go/runtime/unaligned2.go
index b8aefb95223..a33c87acd56 100644
--- a/libgo/go/runtime/unaligned2.go
+++ b/libgo/go/runtime/unaligned2.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm mips mipsle mips64 mips64le armbe m68k mipso32 mipsn32 sparc alpha ia64 mipso64 mipsn64 mips64p32 mips64p32le sparc64
+// +build arm mips mipsle mips64 mips64le armbe m68k sparc alpha ia64 mips64p32 mips64p32le sparc64
package runtime
diff --git a/libgo/go/syscall/endian_big.go b/libgo/go/syscall/endian_big.go
index b96594ec280..f8ee7cfc233 100644
--- a/libgo/go/syscall/endian_big.go
+++ b/libgo/go/syscall/endian_big.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
-// +build ppc64 s390x mips mips64 armbe arm64be m68k ppc mipso32 mipsn32 mipso64 mipsn64 mips64p32 s390 sparc sparc64
+// +build ppc64 s390x mips mips64 armbe arm64be m68k ppc mips64p32 s390 sparc sparc64
package syscall
diff --git a/libgo/go/syscall/syscall_linux_mips64x.go b/libgo/go/syscall/syscall_linux_mips64x.go
deleted file mode 100644
index c1d51b1e26d..00000000000
--- a/libgo/go/syscall/syscall_linux_mips64x.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build mips64 mips64le
-
-package syscall
-
-func (r *PtraceRegs) PC() uint64 { return r.Regs[64] }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc }
-
-func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
- return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
-}
-
-func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
- return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
-}
diff --git a/libgo/go/syscall/syscall_linux_mipsx.go b/libgo/go/syscall/syscall_linux_mipsx.go
index af319ac345f..06dd1ea2bc3 100644
--- a/libgo/go/syscall/syscall_linux_mipsx.go
+++ b/libgo/go/syscall/syscall_linux_mipsx.go
@@ -3,10 +3,24 @@
// license that can be found in the LICENSE file.
// +build linux
-// +build mips mipsle
+// +build mips mipsle mips64 mips64le mips64p32 mips64p32le
package syscall
-func (r *PtraceRegs) PC() uint64 { return uint64(r.Regs[64]) }
+import "unsafe"
-func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = uint32(pc) }
+func (r *PtraceRegs) PC() uint64 {
+ return r.Cp0_epc
+}
+
+func (r *PtraceRegs) SetPC(pc uint64) {
+ r.Cp0_epc = pc
+}
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+ return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+ return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
+}
diff --git a/libgo/match.sh b/libgo/match.sh
index 94bcbc83c64..ce569b7fa9a 100755
--- a/libgo/match.sh
+++ b/libgo/match.sh
@@ -116,7 +116,7 @@ for f in $gofiles; do
android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows)
tag1=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64)
tag1=nonmatchingtag
;;
esac
@@ -128,7 +128,7 @@ for f in $gofiles; do
android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows)
tag2=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64)
tag2=nonmatchingtag
;;
esac
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index ec2224db2b4..bbc85f98ab7 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -302,9 +302,13 @@ if test "$regs" = ""; then
upcase_fields "__user_psw_struct" "PtracePsw" >> ${OUT} || true
upcase_fields "__user_fpregs_struct" "PtraceFpregs" >> ${OUT} || true
upcase_fields "__user_per_struct" "PtracePer" >> ${OUT} || true
+ else
+ # mips*
+ regs=`grep '^type _pt_regs struct' gen-sysinfo.go || true`
fi
fi
if test "$regs" != ""; then
+ regs=`echo $regs | sed -e 's/type _pt_regs struct//'`
regs=`echo $regs |
sed -e 's/type __*user_regs_struct struct //' -e 's/[{}]//g'`
regs=`echo $regs | sed -e s'/^ *//'`
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index 235941b6211..a1afc7d119c 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -102,6 +102,9 @@
#if defined(HAVE_LINUX_NETLINK_H)
#include <linux/netlink.h>
#endif
+#if defined(HAVE_LINUX_PTRACE_H)
+#include <linux/ptrace.h>
+#endif
#if defined(HAVE_LINUX_RTNETLINK_H)
#include <linux/rtnetlink.h>
#endif
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
index f070a8ae69e..d389b104892 100755
--- a/libgo/testsuite/gotest
+++ b/libgo/testsuite/gotest
@@ -314,7 +314,7 @@ x)
android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows)
tag1=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64)
tag1=nonmatchingtag
;;
esac
@@ -326,7 +326,7 @@ x)
android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows)
tag2=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64)
tag2=nonmatchingtag
;;
esac
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 93bfedf43c0..59a2ff88b0e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81314
+ * testsuite/libgomp.c++/pr81314.C: New test.
+
2017-09-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/testsuite/libgomp.c++/pr81314.C b/libgomp/testsuite/libgomp.c++/pr81314.C
new file mode 100644
index 00000000000..afe89438bd3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/pr81314.C
@@ -0,0 +1,38 @@
+// PR c++/81314
+// { dg-do link }
+
+template <int N>
+struct S {
+ S () { s = 0; }
+ S (const S &x) { s = x.s; }
+ ~S () {}
+ int s;
+};
+
+void
+foo (S<2> &x)
+{
+ #pragma omp taskloop
+ for (int i = 0; i < 100; ++i)
+ x.s++;
+}
+
+void
+bar (S<3> &x)
+{
+ #pragma omp task
+ x.s++;
+}
+
+int
+main ()
+{
+ S<2> s;
+ S<3> t;
+ #pragma omp parallel
+ #pragma omp master
+ {
+ foo (s);
+ bar (t);
+ }
+}
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 7aa9d287804..0858d074d5f 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2017-10-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR sanitizer/82379
+ * configure.tgt (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): Set
+ to sanitizer_linux_x86_64.lo if __x86_64__ is defined by $CC.
+
2017-09-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt
index 82e8a5513c5..573e3b482e9 100644
--- a/libsanitizer/configure.tgt
+++ b/libsanitizer/configure.tgt
@@ -27,6 +27,8 @@ case "${target}" in
TSAN_SUPPORTED=yes
LSAN_SUPPORTED=yes
TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_amd64.lo
+ fi
+ if echo "int x = __x86_64__;" | $CC -c -x c -o /dev/null - > /dev/null 2>&1; then
SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS=sanitizer_linux_x86_64.lo
fi
;;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d36184ea211..0ca4e9e5cc4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,73 @@
+2017-09-21 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
+ expected results when using predicate defining reverse order.
+ * testsuite/25_algorithms/clamp/constexpr.cc: Likewise.
+
+2017-09-20 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-06-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/manual/test.xml: Correct instructions on running tests.
+ * testsuite/27_io/basic_ios/copyfmt/char/1.cc: Adjust to pass when
+ -D_GLIBCXX_USE_CXX11_ABI=0 added to RUNTESTFLAGS.
+ * testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/char/
+ exceptions_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ exceptions_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
+ * testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/ios_base/storage/2.cc: Likewise.
+
+ PR libstdc++/79162
+ * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
+ (basic_string::_If_sv): Remove from the overload set when the
+ argument is derived from basic_string.
+
+ PR libstdc++/79162
+ * include/bits/basic_string.h (basic_string::_If_sv): Remove from the
+ overload set when the argument is derived from basic_string.
+ * testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: New
+ test.
+ * testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc:
+ New test.
+
+ * testsuite/24_iterators/range_access_cpp17.cc: Fix order of dg-do
+ and dg-options directives. Fix invalid test.
+
+ Backport from mainline
+ 2017-09-20 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/82262
+ * include/std/optional (__optional_hash_call_base): Add template
+ parameter for remove_const_t<_Tp> and use it consistently.
+ * testsuite/20_util/optional/hash.cc: Test optional<const T>.
+
+ Backport from mainline
+ 2017-09-19 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/82254
+ * include/std/type_traits (__is_invocable): Add partial specialization
+ for INVOKE<void> case and remove is_void<R> check from partial
+ specialization for INVOKE<R> case.
+ (__is_nt_invocable_impl): New helper for is_nothrow_invocable_r.
+ (is_nothrow_invocable_r): Use __is_nt_invocable_impl.
+ * testsuite/20_util/is_nothrow_invocable/value.cc: Add tests for
+ conversions that can throw or fail to convert. Use static assert
+ strings to explain negative results.
+ * testsuite/20_util/is_nothrow_invocable/value_ext.cc: Use
+ is_nothrow_constructible in is_nt_invocable_conv.
+
2017-09-13 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 94ac2b3275b..7df39685ad3 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -115,6 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _Tp, typename _Res>
using _If_sv = enable_if_t<
__and_<is_convertible<const _Tp&, __sv_type>,
+ __not_<is_convertible<const _Tp*, const basic_string*>>,
__not_<is_convertible<const _Tp&, const _CharT*>>>::value,
_Res>;
@@ -3438,6 +3439,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
template<typename _Tp, typename _Res>
using _If_sv = enable_if_t<
__and_<is_convertible<const _Tp&, __sv_type>,
+ __not_<is_convertible<const _Tp*, const basic_string*>>,
__not_<is_convertible<const _Tp&, const _CharT*>>>::value,
_Res>;
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 17241204abb..c28f20bcc56 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1000,23 +1000,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Hash.
- template<typename _Tp, bool
- = __poison_hash<remove_const_t<_Tp>>::__enable_hash_call>
+ template<typename _Tp, typename _Up = remove_const_t<_Tp>,
+ bool = __poison_hash<_Up>::__enable_hash_call>
struct __optional_hash_call_base
{
size_t
operator()(const optional<_Tp>& __t) const
- noexcept(noexcept(hash<_Tp> {}(*__t)))
+ noexcept(noexcept(hash<_Up>{}(*__t)))
{
// We pick an arbitrary hash for disengaged optionals which hopefully
// usual values of _Tp won't typically hash to.
constexpr size_t __magic_disengaged_hash = static_cast<size_t>(-3333);
- return __t ? hash<_Tp> {}(*__t) : __magic_disengaged_hash;
+ return __t ? hash<_Up>{}(*__t) : __magic_disengaged_hash;
}
};
- template<typename _Tp>
- struct __optional_hash_call_base<_Tp, false> {};
+ template<typename _Tp, typename _Up>
+ struct __optional_hash_call_base<_Tp, _Up, false> {};
template<typename _Tp>
struct hash<optional<_Tp>>
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 00552d7e250..e34529d8be5 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2758,7 +2758,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Result, typename _Ret>
struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
- : __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type
+ : is_convertible<typename _Result::type, _Ret>::type
+ { };
+
+ template<typename _Result>
+ struct __is_invocable_impl<_Result, void, __void_t<typename _Result::type>>
+ : true_type
{ };
template<typename _Fn, typename... _ArgTypes>
@@ -2857,10 +2862,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__call_is_nothrow_<_Fn, _ArgTypes...>>::type
{ };
+ template<typename _Result, typename _Ret, typename = void>
+ struct __is_nt_invocable_impl : false_type { };
+
+ template<typename _Result, typename _Ret>
+ struct __is_nt_invocable_impl<_Result, _Ret,
+ __void_t<typename _Result::type>>
+ : __and_<is_convertible<typename _Result::type, _Ret>,
+ is_nothrow_constructible<_Ret, typename _Result::type>>
+ { };
+
+ template<typename _Result>
+ struct __is_nt_invocable_impl<_Result, void,
+ __void_t<typename _Result::type>>
+ : true_type
+ { };
+
/// std::is_nothrow_invocable_r
template<typename _Ret, typename _Fn, typename... _ArgTypes>
struct is_nothrow_invocable_r
- : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
+ : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
__call_is_nothrow_<_Fn, _ArgTypes...>>::type
{ };
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
index 4ccb459e0f5..dfa76aae61c 100644
--- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
@@ -40,6 +40,10 @@ template<typename R, typename... T>
void test01()
{
+ struct T { T(int) { } };
+ struct NT { NT(int) noexcept { } };
+ struct Ex { explicit Ex(int) noexcept { } };
+
using func_type = void(*)();
static_assert( ! is_nt_invocable< func_type>(), "");
@@ -55,28 +59,46 @@ void test01()
static_assert( ! is_nt_invocable< mem_type, int >(), "");
static_assert( ! is_nt_invocable< mem_type, int& >(), "");
- static_assert( is_nt_invocable< mem_type, X& >(), "");
- static_assert( is_nt_invocable_r< int, mem_type, X& >(), "");
- static_assert( is_nt_invocable_r< int&, mem_type, X& >(), "");
- static_assert( is_nt_invocable_r< long, mem_type, X& >(), "");
- static_assert( is_nt_invocable_r< int&, mem_type, X* >(), "");
+ static_assert( is_nt_invocable< mem_type, X& >(), "");
+ static_assert( is_nt_invocable_r< int, mem_type, X& >(), "");
+ static_assert( is_nt_invocable_r< int&, mem_type, X& >(), "");
+ static_assert( is_nt_invocable_r< long, mem_type, X& >(), "");
+ static_assert( ! is_nt_invocable_r< long&, mem_type, X& >(),
+ "conversion fails, cannot bind long& to int");
+ static_assert( is_nt_invocable_r< int&, mem_type, X* >(), "");
+
+ static_assert( ! is_nt_invocable_r< T, mem_type, X& >(),
+ "conversion throws");
+ static_assert( is_nt_invocable_r< NT, mem_type, X& >(), "");
+ static_assert( ! is_nt_invocable_r< Ex, mem_type, X& >(),
+ "conversion fails, would use explicit constructor");
using memfun_type = int (X::*)();
- static_assert( ! is_nt_invocable< memfun_type >(), "");
- static_assert( ! is_nt_invocable< memfun_type, int >(), "");
- static_assert( ! is_nt_invocable< memfun_type, int& >(), "");
- static_assert( ! is_nt_invocable< memfun_type, X& >(), "");
- static_assert( ! is_nt_invocable< memfun_type, X* >(), "");
+ static_assert( ! is_nt_invocable< memfun_type >(), "no object");
+ static_assert( ! is_nt_invocable< memfun_type, int >(), "no object");
+ static_assert( ! is_nt_invocable< memfun_type, int& >(), "no object");
+ static_assert( ! is_nt_invocable< memfun_type, X& >(), "call throws");
+ static_assert( ! is_nt_invocable< memfun_type, X* >(), "call throws");
+
+ static_assert( ! is_nt_invocable_r< T, memfun_type, X& >(), "call throws");
+ static_assert( ! is_nt_invocable_r< NT, memfun_type, X& >(), "call throws");
+ static_assert( ! is_nt_invocable_r< Ex, memfun_type, X& >(), "call throws");
#if __cpp_noexcept_function_type
using memfun_type_nt = int (X::*)() noexcept;
- static_assert( ! is_nt_invocable< memfun_type_nt >(), "");
- static_assert( ! is_nt_invocable< memfun_type_nt, int >(), "");
- static_assert( ! is_nt_invocable< memfun_type_nt, int& >(), "");
+ static_assert( ! is_nt_invocable< memfun_type_nt >(), "no object");
+ static_assert( ! is_nt_invocable< memfun_type_nt, int >(), "no object");
+ static_assert( ! is_nt_invocable< memfun_type_nt, int& >(), "no object");
static_assert( is_nt_invocable< memfun_type_nt, X& >(), "");
static_assert( is_nt_invocable< memfun_type_nt, X* >(), "");
+
+ static_assert( ! is_nt_invocable_r< T, memfun_type_nt, X& >(),
+ "conversion throws");
+ static_assert( is_nt_invocable_r< NT, memfun_type_nt, X& >(), "");
+ static_assert( ! is_nt_invocable_r< Ex, memfun_type_nt, X& >(),
+ "conversion fails, would use explicit constructor");
#endif
struct F {
@@ -89,12 +111,44 @@ void test01()
};
using CF = const F;
- static_assert( ! is_nt_invocable_r< int&, F >(), "");
- static_assert( is_nt_invocable_r< long&, CF >(), "");
- static_assert( ! is_nt_invocable_r< short&, F, int >(), "" );
- static_assert( is_nt_invocable_r< char&, F&, int >(), "" );
- static_assert( is_nt_invocable_r< char&, CF, int >(), "" );
- static_assert( is_nt_invocable_r< char&, CF&, int >(), "" );
-
- static_assert( ! is_nt_invocable< F, int, int >(), "");
+ static_assert( ! is_nt_invocable< F >(), "call throws");
+ static_assert( is_nt_invocable< CF >(), "");
+
+ static_assert( ! is_nt_invocable_r< int&, F >(), "call throws");
+ static_assert( is_nt_invocable_r< long&, CF >(), "");
+ static_assert( ! is_nt_invocable_r< T, F >(), "call throws");
+ static_assert( ! is_nt_invocable_r< NT, F >(), "call throws");
+ static_assert( ! is_nt_invocable_r< Ex, F >(), "call throws");
+ static_assert( ! is_nt_invocable_r< T, CF >(), "conversion throws");
+ static_assert( is_nt_invocable_r< NT, CF >(), "" );
+ static_assert( ! is_nt_invocable_r< Ex, CF >(), "conversion fails");
+
+ static_assert( ! is_nt_invocable< F, int >(), "call throws");
+ static_assert( is_nt_invocable< F&, int >(), "");
+
+ static_assert( ! is_nt_invocable_r< short&, F, int >(),
+ "call throws" );
+ static_assert( is_nt_invocable_r< char&, F&, int >(), "");
+ static_assert( ! is_nt_invocable_r< T, F&, int >(),
+ "conversion throws");
+ static_assert( is_nt_invocable_r< NT, F&, int >(), "");
+ static_assert( ! is_nt_invocable_r< Ex, F&, int >(),
+ "conversion fails, would use explicit constructor");
+
+ static_assert( is_nt_invocable< CF, int >(), "");
+ static_assert( is_nt_invocable< CF&, int >(), "");
+
+ static_assert( is_nt_invocable_r< char&, CF, int >(), "");
+ static_assert( is_nt_invocable_r< char&, CF&, int >(), "");
+
+ static_assert( ! is_nt_invocable_r< T, CF&, int >(),
+ "conversion throws");
+ static_assert( is_nt_invocable_r< NT, CF&, int >(), "");
+ static_assert( ! is_nt_invocable_r< Ex, CF&, int >(),
+ "conversion fails, would use explicit constructor");
+
+ static_assert( ! is_nt_invocable< F, int, int >(),
+ "would call private member");
+ static_assert( ! is_nt_invocable_r<void, F, int, int >(),
+ "would call private member");
}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
index 7217324e1b3..7fd3d924843 100644
--- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
@@ -27,7 +27,9 @@ template<typename... T>
constexpr bool is_nt_invocable_conv(std::true_type)
{
using result_type = typename std::__invoke_result<T...>::type;
- return std::is_void<R>::value || std::is_convertible<result_type, R>::value;
+ return std::is_void<R>::value
+ || (std::is_convertible<result_type, R>::value
+ && std::is_nothrow_constructible<R, result_type>::value);
}
template<typename R, typename... T>
diff --git a/libstdc++-v3/testsuite/20_util/optional/hash.cc b/libstdc++-v3/testsuite/20_util/optional/hash.cc
index c16f0b20fb2..35ae51b947a 100644
--- a/libstdc++-v3/testsuite/20_util/optional/hash.cc
+++ b/libstdc++-v3/testsuite/20_util/optional/hash.cc
@@ -29,14 +29,23 @@ template<class T>
auto f(...) -> decltype(std::false_type());
static_assert(!decltype(f<S>(0))::value, "");
-static_assert(!std::is_invocable_v<
- std::hash<std::optional<S>>&, std::optional<S> const&> );
-static_assert(std::is_invocable_v<
- std::hash<std::optional<int>>&, std::optional<int> const&> );
+
+template<typename T>
+constexpr bool hashable()
+{ return std::is_invocable_v<std::hash<T>&, const T&>; }
+
+static_assert(!hashable<std::optional<S>>());
+static_assert(!hashable<std::optional<const S>>());
+static_assert(hashable<std::optional<int>>());
+static_assert(hashable<std::optional<const int>>());
int main()
{
int x = 42;
std::optional<int> x2 = 42;
VERIFY(std::hash<int>()(x) == std::hash<std::optional<int>>()(x2));
+
+ // PR libstdc++/82262
+ std::optional<const int> x3 = x2;
+ VERIFY(std::hash<int>()(x) == std::hash<std::optional<const int>>()(x3));
}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc
new file mode 100644
index 00000000000..78fcab05801
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do run { target c++1z } }
+
+// Copyright (C) 2011-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/>.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on string (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <string>
+#include <utility>
+#include <testsuite_hooks.h>
+
+class tstring : public std::basic_string<char>
+{
+public:
+ tstring() : std::basic_string<char>() {}
+ tstring(tstring&& s) : std::basic_string<char>(std::move(s)) {}
+ tstring& operator=(tstring&& s) = default;
+};
+
+void test01()
+{
+ tstring a, b;
+ a.push_back('1');
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
+
+ tstring c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == '1' );
+ VERIFY( b.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc
new file mode 100644
index 00000000000..1241f4385a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do run { target c++1z } }
+
+// Copyright (C) 2011-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/>.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on string (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <string>
+#include <utility>
+#include <testsuite_hooks.h>
+
+class tstring : public std::basic_string<wchar_t>
+{
+public:
+ tstring() : std::basic_string<wchar_t>() {}
+ tstring(tstring&& s) : std::basic_string<wchar_t>(std::move(s)) {}
+ tstring& operator=(tstring&& s) = default;
+};
+
+void test01()
+{
+ tstring a, b;
+ a.push_back(L'1');
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == L'1' && a.size() == 0 );
+
+ tstring c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == L'1' );
+ VERIFY( b.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc b/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
index 1d5b0739007..9bdebcdaf61 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
+++ b/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
@@ -1,5 +1,5 @@
-// { dg-do compile { target c++1z } }
// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
// Copyright (C) 2017 Free Software Foundation, Inc.
//
@@ -47,7 +47,7 @@ void
test03()
{
using std::reverse_iterator;
- static std::initializer_list<int> il{1};
+ static constexpr std::initializer_list<int> il{1};
static_assert(std::cbegin(il) == il.begin());
static_assert(std::cend(il) == il.end());
static_assert(std::rbegin(il) == reverse_iterator<const int*>(il.end()));
diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
index 991b10d1fe3..655c241e9a2 100644
--- a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
@@ -30,12 +30,12 @@ void test01()
VERIFY( y == 3 );
VERIFY( z == 4 );
- const int xc = std::clamp(1, 2, 4, std::greater<int>());
- const int yc = std::clamp(3, 2, 4, std::greater<int>());
- const int zc = std::clamp(5, 2, 4, std::greater<int>());
- VERIFY( xc == 4 );
- VERIFY( yc == 2 );
- VERIFY( zc == 2 );
+ const int xc = std::clamp(1, 4, 2, std::greater<int>());
+ const int yc = std::clamp(3, 4, 2, std::greater<int>());
+ const int zc = std::clamp(5, 4, 2, std::greater<int>());
+ VERIFY( xc == 2 );
+ VERIFY( yc == 3 );
+ VERIFY( zc == 4 );
}
int
diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
index 0864b8e1d30..606748ec689 100644
--- a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
@@ -27,5 +27,5 @@
# error "Feature-test macro for clamp has wrong value"
#endif
-static_assert(std::clamp(2, 0, 1) == 1, "");
-static_assert(std::clamp(2, 0, 1, std::greater<int>()) == 0, "");
+static_assert(std::clamp(2, 0, 1) == 1);
+static_assert(std::clamp(2, 1, 0, std::greater<int>()) == 1);
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
index 87551a08311..840017e4e85 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
@@ -17,9 +17,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
@@ -36,29 +33,36 @@ void test02()
// basic_ios& copyfmt(const basic_ios& rhs)
{
std::ios ios_01(0);
- std::ios ios_02(0);
+ std::ios ios_02(0);
ios_01.exceptions(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
-
+
try {
- ios_01.copyfmt(ios_02);
- }
+ ios_01.copyfmt(ios_02);
+ }
catch(...) {
VERIFY( false );
}
}
{
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
std::ios ios_01(0);
- std::ios ios_02(0);
+ std::ios ios_02(0);
ios_01.clear(std::ios_base::eofbit);
ios_02.exceptions(std::ios_base::eofbit);
try {
ios_01.copyfmt(ios_02);
VERIFY( false );
- }
- catch(std::ios_base::failure& fail) {
+ }
+ catch(exception_type&) {
VERIFY( true );
}
catch(...) {
@@ -67,7 +71,7 @@ void test02()
}
}
-int main()
+int main()
{
test02();
return 0;
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
index 86b7bee35d3..152e783640a 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
@@ -17,9 +17,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
// 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file.
@@ -44,7 +41,7 @@ void test01()
std::ios ios_01(0);
try {
ios_01.exceptions(std::ios_base::eofbit);
- }
+ }
catch(...) {
VERIFY( false );
}
@@ -53,13 +50,20 @@ void test01()
}
{
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
std::ios ios_01(0);
ios_01.clear(std::ios_base::eofbit);
try {
ios_01.exceptions(std::ios_base::eofbit);
VERIFY( false );
- }
- catch(std::ios_base::failure& fail) {
+ }
+ catch(exception_type&) {
iostate02 = ios_01.exceptions();
VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
}
@@ -69,7 +73,7 @@ void test01()
}
}
-int main()
+int main()
{
test01();
return 0;
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
index 2f1edf6e79c..5fa3f1f34a0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <sstream>
#include <testsuite_hooks.h>
@@ -29,20 +26,27 @@ void test_failbit()
istringstream stream("jaylib - champion sound");
stream.exceptions(ios_base::failbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
T i;
stream >> i;
VERIFY( false );
}
- catch (const ios_base::failure&)
- {
+ catch (const exception_type&)
+ {
// stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() );
VERIFY( !stream.bad() );
VERIFY( !stream.eof() );
- }
+ }
catch(...)
{ VERIFY( false ); }
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
index 7038565eb89..4ff48f73712 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <sstream>
#include <testsuite_hooks.h>
@@ -29,20 +26,27 @@ void test_failbit()
wistringstream stream(L"jaylib - champion sound");
stream.exceptions(ios_base::failbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
T i;
stream >> i;
VERIFY( false );
}
- catch (const ios_base::failure&)
- {
+ catch (const exception_type&)
+ {
// stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() );
VERIFY( !stream.bad() );
VERIFY( !stream.eof() );
- }
+ }
catch(...)
{ VERIFY( false ); }
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
index 50c70f96378..088aaa42808 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <istream>
#include <ostream>
#include <streambuf>
@@ -38,12 +35,19 @@ void test4()
istringstream stream;
stream.exceptions(ios_base::failbit);
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
stream >> static_cast<streambuf*>(0);
VERIFY(false);
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
index 0d8a3cd3f3a..fd6322b4cdb 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <istream>
#include <ostream>
#include <streambuf>
@@ -38,12 +35,19 @@ void test4()
wistringstream stream;
stream.exceptions(ios_base::failbit);
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
stream >> static_cast<wstreambuf*>(0);
VERIFY( false );
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
index ceb92347e08..0900a70d148 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
@@ -15,12 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// 27.6.1.1.2 class basic_istream::sentry
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <sstream>
#include <testsuite_hooks.h>
@@ -29,16 +25,23 @@ int main()
using namespace std;
istringstream stream;
stream.exceptions(ios_base::eofbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
istream::sentry sentry(stream, false);
VERIFY( false );
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
}
-
+
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
index dc9d48a18d8..e72fe1a03a0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
// 27.6.1.1.2 class basic_istream::sentry
#include <sstream>
@@ -28,16 +25,23 @@ int main()
using namespace std;
wistringstream stream;
stream.exceptions(ios_base::eofbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
wistream::sentry sentry(stream, false);
VERIFY( false );
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
}
-
+
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
index ab9ef94da35..9a7bd06f21a 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <istream>
#include <ostream>
#include <streambuf>
@@ -39,13 +36,20 @@ void test3()
ostringstream stream;
stream.exceptions(ios_base::badbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
stream << static_cast<streambuf*>(0);
VERIFY( false );
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
index bba6dd0e3f1..fcfb37d2dac 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
-
#include <istream>
#include <ostream>
#include <streambuf>
@@ -39,13 +36,20 @@ void test3()
wostringstream stream;
stream.exceptions(ios_base::badbit);
-
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
try
{
stream << static_cast<wstreambuf*>(0);
VERIFY( false );
}
- catch (ios_base::failure&)
+ catch (exception_type&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
index d2c9ec50e53..8fa306f61a2 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
@@ -26,10 +26,7 @@
// Skip test at -m64 on Darwin because RLIMITS are not being honored.
// Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators
// Radar 6467884: 10.X systems are not robust when paging space is exceeded
-// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
-
-// The library throws the new definition of std::ios::failure
-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
#include <sstream>
#include <iostream>
@@ -52,12 +49,19 @@ void test02()
// pword
ios.pword(1) = v;
VERIFY( ios.pword(1) == v );
-
- try
+
+ // The library throws the new definition of std::ios::failure
+#if _GLIBCXX_USE_CXX11_ABI
+ typedef std::ios_base::failure exception_type;
+#else
+ typedef std::exception exception_type;
+#endif
+
+ try
{
v = ios.pword(max);
}
- catch(std::ios_base::failure& obj)
+ catch(exception_type&)
{
// Ok.
VERIFY( ios.bad() );
@@ -69,14 +73,14 @@ void test02()
VERIFY( v == 0 );
VERIFY( ios.pword(1) == v );
-
+
// max is different code path from max-1
v = &test;
try
{
v = ios.pword(std::numeric_limits<int>::max());
}
- catch(std::ios_base::failure& obj)
+ catch(exception_type&)
{
// Ok.
VERIFY( ios.bad() );
@@ -90,12 +94,12 @@ void test02()
// iword
ios.iword(1) = 1;
VERIFY( ios.iword(1) == 1 );
-
- try
+
+ try
{
l = ios.iword(max);
}
- catch(std::ios_base::failure& obj)
+ catch(exception_type&)
{
// Ok.
VERIFY( ios.bad() );
@@ -110,11 +114,11 @@ void test02()
// max is different code path from max-1
l = 1;
- try
+ try
{
l = ios.iword(std::numeric_limits<int>::max());
}
- catch(std::ios_base::failure& obj)
+ catch(exception_type&)
{
// Ok.
VERIFY( ios.bad() );