Jakub Jelinek [Fri, 12 Oct 2018 17:33:25 +0000 (19:33 +0200)]
backport: re PR middle-end/87248 (Bad code for masked operations involving signed ints)
Backported from mainline
2018-09-12 Jakub Jelinek <jakub@redhat.com>
PR middle-end/87248
* fold-const.c (fold_ternary_loc) <case COND_EXPR>: Verify also that
BIT_AND_EXPR's second operand is a power of two. Formatting fix.
Jakub Jelinek [Fri, 12 Oct 2018 17:31:33 +0000 (19:31 +0200)]
backport: re PR middle-end/86627 (Signed 128-bit division by 2 no longer expanded to RTL)
Backported from mainline
2018-07-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/86627
* expmed.c (expand_divmod): Punt if d == HOST_WIDE_INT_MIN
and size > HOST_BITS_PER_WIDE_INT. For size > HOST_BITS_PER_WIDE_INT
and abs_d == d, do the power of two handling if profitable.
Jakub Jelinek [Fri, 12 Oct 2018 17:29:35 +0000 (19:29 +0200)]
backport: re PR middle-end/86539 (OpenMP wrong-code with taskloop and references)
Backported from mainline
2018-07-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/86539
* gimplify.c (gimplify_omp_for): Ensure taskloop firstprivatized init
and cond temporaries don't have reference type if iterator has
pointer type. For init use &for_pre_body instead of pre_p if
for_pre_body is non-empty.
Jakub Jelinek [Fri, 12 Oct 2018 17:28:51 +0000 (19:28 +0200)]
backport: re PR middle-end/86660 (libgomp.c++/for-15.C ICEs with nvptx offloading)
Backported from mainline
2018-07-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/86660
* omp-low.c (scan_sharing_clauses): Don't ignore map clauses for
declare target to variables if they have always,{to,from,tofrom} map
kinds.
Richard Biener [Fri, 12 Oct 2018 13:44:35 +0000 (13:44 +0000)]
backport: [multiple changes]
2018-10-12 Richard Biener <rguenther@suse.de>
PR c++/54278
Backport from mainline
2017-03-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/80032
* gimplify.c (gimple_push_cleanup): Forced unconditional
cleanups still have to go to the conditional_cleanups
sequence.
2017-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/80032
* gimplify.c (gimple_push_cleanup): Add force_uncond parameter,
if set force the cleanup to happen unconditionally.
(gimplify_target_expr): Push inserted clobbers with force_uncond
to avoid them being removed by control-dependent DCE.
Jonathan Wakely [Fri, 12 Oct 2018 13:04:44 +0000 (14:04 +0100)]
Fix __gnu_cxx::_Pointer_adapter for long long arithmetic
Backport from mainline
2018-08-30 Jonathan Wakely <jwakely@redhat.com>
* include/ext/pointer.h (_Pointer_adapter): Define operators for
pointer arithmetic using long long offsets.
* testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using
long long values.
Jonathan Wakely [Fri, 12 Oct 2018 13:04:38 +0000 (14:04 +0100)]
Fix experimental::pmr typedefs and add tests
The typedefs in <experimental/regex> and <experimental/string> don't
need to be in the __cxx11 namespace, because they are only aliases and
so will have the same mangled name as the underlying types.
Backport from mainline
2018-08-22 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/87061
* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::match_results, experimental::pmr::cmatch)
(experimental::pmr::smatch, experimental::pmr::wcmatch)
(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
because COW strings don't support C++11 allocator model.
* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::basic_string, experimental::pmr::string)
(experimental::pmr::u16string, experimental::pmr::u32string)
(experimental::pmr::wstring): Likewise.
Backport from mainline
2018-08-15 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/regex: Remove begin/end macros for namespace.
* include/experimental/string: Likewise.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_forward_list.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_multimap.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_multiset.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_map.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_multimap.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_multiset.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_set.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
New test.
Jonathan Wakely [Fri, 12 Oct 2018 13:04:24 +0000 (14:04 +0100)]
PR libstdc++/70966 make pmr::new_delete_resource() immortal
Construct the program-wide resource objects using placement new. This
means they have dynamic storage duration and won't be destroyed during
termination.
Backport from mainline
2018-07-24 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/70966
* include/experimental/memory_resource (__get_default_resource): Use
placement new to create an object with dynamic storage duration.
Backport from mainline
2018-06-20 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/70966
* include/experimental/memory_resource (__resource_adaptor_imp): Add
static assertions to enforce requirements on pointer types.
(__resource_adaptor_imp::get_allocator()): Add noexcept.
(new_delete_resource, null_memory_resource): Return address of an
object with dynamic storage duration.
(__null_memory_resource): Remove.
* testsuite/experimental/memory_resource/70966.cc: New.
LTO correctly generates AVX for b.o and SSE for a.o. But the GCC driver
passes -msse2avx to assembler, which encodes SSE instructions as AVX
instructions. We shouldn't pass -msse2avx to assembler for -mavx.
Backport from mainline
PR target/87522
* config/i386/gnu-user.h (ASM_SPEC): Don't pass -msse2avx to
assembler for -mavx.
* config/i386/gnu-user64.h (ASM_SPEC): Likewise.
Jonathan Wakely [Fri, 12 Oct 2018 11:37:46 +0000 (12:37 +0100)]
PR libstdc++/85098 add missing definitions for static constants
In C++11 and C++14 any odr-use of these constants requires a definition
at namespace-scope. In C++17 they are implicitly inline and so the
namespace-scope redeclarations are redundant (and allowing them is
deprecated).
Backport from mainline
2018-05-18 Jonathan Wakely <jwakely@redhat.com>
Joseph Myers [Tue, 9 Oct 2018 11:40:45 +0000 (12:40 +0100)]
Use -fno-show-column in libstdc++ installed testing.
<https://gcc.gnu.org/ml/libstdc++/2016-08/msg00006.html> arranged for
libstdc++ tests to use -fno-show-column by default, but only for
build-tree testing. This patch adds it to the options used for
installed testing as well.
Tested with installed testing for a cross to x86_64-linux-gnu, where
it fixes various test failures.
Backport from mainline
2018-10-02 Joseph Myers <joseph@codesourcery.com>
* testsuite/lib/libstdc++.exp (libstdc++_init): Use
-fno-show-column in default cxxflags.
backport: re PR sanitizer/85835 (libsanitizer includes <sys/ustat.h> unconditionally)
2017-09-21 Matthias Klose <doko@ubuntu.com>
Backported from the gcc-7-branch:
2018-05-24 H.J. Lu <hongjiu.lu@intel.com>
PR sanitizer/85835
* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
include <sys/ustat.h> for Linux.
(SIZEOF_STRUCT_USTAT): New.
(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.
Janus Weil [Fri, 7 Sep 2018 18:01:23 +0000 (20:01 +0200)]
backport: re PR fortran/86116 (Ambiguous generic interface not recognised)
2018-09-07 Janus Weil <janus@gcc.gnu.org>
Backported from trunk
PR fortran/86116
* interface.c (compare_type): Remove a CLASS/TYPE check.
(compare_type_characteristics): New function that behaves like the old
'compare_type'.
(gfc_check_dummy_characteristics, gfc_check_result_characteristics):
Call 'compare_type_characteristics' instead of 'compare_type'.
2018-09-07 Janus Weil <janus@gcc.gnu.org>
Backported from trunk
PR fortran/86116
* gfortran.dg/generic_34.f90: New test case.
backport: pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum.
Backport from mainline
2018-08-11 John David Anglin <danglin@gcc.gnu.org>
gcc
* config/pa/pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum.
Update comment for atomic instructions.
(atomic_storeqi, atomic_storehi, atomic_storesi, atomic_storesf,
atomic_loaddf, atomic_loaddf_1, atomic_storedf, atomic_storedf_1):
Remove.
(atomic_loaddi): Revise fence expansion to only emit fence prior to
load for __ATOMIC_SEQ_CST model.
(atomic_loaddi_1): Remove float register target.
(atomic_storedi): Handle CONST_INT values.
(atomic_storedi_1): Remove float register source. Add special case
for zero value.
(memory_barrier): New expander and insn.
libgcc
* config/pa/linux-atomic.c: Update comment.
(FETCH_AND_OP_2, OP_AND_FETCH_2, FETCH_AND_OP_WORD, OP_AND_FETCH_WORD,
COMPARE_AND_SWAP_2, __sync_val_compare_and_swap_4,
SYNC_LOCK_TEST_AND_SET_2, __sync_lock_test_and_set_4): Use
__ATOMIC_RELAXED for atomic loads.
(SYNC_LOCK_RELEASE_1): New define. Use __sync_synchronize() and
unordered store to release lock.
(__sync_lock_release_8): Likewise.
(SYNC_LOCK_RELEASE_2): Remove define.
backport: re PR target/86197 (POWERPC: float128 parameter passing)
Backport from mainline
2018-06-19 Segher Boessenkool <segher@kernel.crashing.org>
PR target/86197
* config/rs6000/rs6000.md (rs6000_discover_homogeneous_aggregate): An
ieee128 argument takes up only one (vector) register, not two (floating
point) registers.
Jonathan Wakely [Wed, 8 Aug 2018 16:31:55 +0000 (17:31 +0100)]
PR libstdc++/83982 fix exception-safety guarantee of std::vector::resize
Construct new elements before moving existing ones, so that if a default
constructor throws, the existing elements are not left in a moved-from
state.
Backport from mainline
2018-06-14 Daniel Trebbien <dtrebbien@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/83982
* include/bits/vector.tcc (vector::_M_default_append(size_type)):
Default-construct new elements before moving existing ones.
* testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc:
New.