Jonathan Wakely [Fri, 17 Mar 2017 19:28:42 +0000 (19:28 +0000)]
Backport <codecvt> fixes from trunk
Fix alignment bugs in std::codecvt_utf16
* src/c++11/codecvt.cc (range): Add non-type template parameter and
define oerloaded operators for reading and writing code units.
(range<Elem, false>): Define partial specialization for accessing
wide characters in potentially unaligned byte ranges.
(ucs2_span(const char16_t*, const char16_t*, ...))
(ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
to range<const char16_t, false> in order to avoid unaligned reads.
(__codecvt_utf16_base<char16_t>::do_out)
(__codecvt_utf16_base<char32_t>::do_out)
(__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
unaligned data to avoid unaligned writes.
(__codecvt_utf16_base<char16_t>::do_in)
(__codecvt_utf16_base<char32_t>::do_in)
(__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
error if there are unprocessable trailing bytes.
(__codecvt_utf16_base<char16_t>::do_length)
(__codecvt_utf16_base<char32_t>::do_length)
(__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
range<const char16_t, false> to span functions.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.
PR libstdc++/80041 fix codecvt_utf16<wchar_t> to use UTF-16 not UTF-8
PR libstdc++/80041
* src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
(__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
char16_t to work with UTF-16 instead of UTF-8.
* testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.
Fix encoding() and max_length() values for codecvt facets
* src/c++11/codecvt.cc (codecvt<char16_t, char, mbstate_t>)
(codecvt<char32_t, char, mbstate_t>, __codecvt_utf8_base<char16_t>)
(__codecvt_utf8_base<char32_t>, __codecvt_utf8_base<wchar_t>)
(__codecvt_utf16_base<char16_t>, __codecvt_utf16_base<char32_t>)
(__codecvt_utf16_base<wchar_t>, __codecvt_utf8_utf16_base<char16_t>)
(__codecvt_utf8_utf16_base<char32_t>)
(__codecvt_utf8_utf16_base<wchar_t>): Fix do_encoding() and
do_max_length() return values.
* testsuite/22_locale/codecvt/codecvt_utf16/members.cc: New test.
* testsuite/22_locale/codecvt/codecvt_utf8/members.cc: New test.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc: New test.
PR libstdc++/79980
* include/bits/locale_conv.h (__do_str_codecvt): Set __count on
error path.
* src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
for manipulating codecvt_mode values.
(read_utf16_bom): Compare input to BOM constants instead of integral
constants that depend on endianness. Take mode parameter by
reference and adjust it, to distinguish between no BOM present and
UTF-16BE BOM present.
(ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
(surrogates): New enumeration type.
(utf16_in, utf16_out): Add surrogates parameter to choose between
UTF-16 and UCS2 behaviour.
(utf16_span, ucs2_span): Use std::min not std::max.
(ucs2_out): Use std::min not std::max. Disallow surrogate pairs.
(ucs2_in): Likewise. Adjust calls to read_utf16_bom.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.
PR libstdc++/79511 fix endianness of UTF-16 data
PR libstdc++/79511
* src/c++11/codecvt.cc (write_utf16_code_point): Don't write 0xffff
as a surrogate pair.
(__codecvt_utf8_utf16_base<char32_t>::do_in): Use native endianness
for internal representation.
(__codecvt_utf8_utf16_base<wchar_t>::do_in): Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: New test.
re PR libstdc++/80034 (unqualified calls to std::distance in std::list::sort)
PR libstdc++/80034
* include/bits/list.tcc (merge(list&&)): Use const for the size_t
in the function and in the catch-block, qualify uses of std::distance.
(merge(list&&, _StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/80034.cc: New.
Bill Schmidt [Wed, 22 Feb 2017 22:54:56 +0000 (22:54 +0000)]
backport: re PR target/79261 (vec_xxpermdi appears to have endian issues)
[gcc]
2017-02-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2017-02-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/79261
* config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
support for CODE_FOR_vsx_xxpermdi_v2d[fi]_be.
* config/rs6000/rs6000.md (reload_gpr_from_vsx<mode>): Call
generator for vsx_xxpermdi_<mode>_be.
* config/rs6000/vsx.md (vsx_xxpermdi_<mode>): Remove logic to
force big-endian semantics.
(vsx_xxpermdi_<mode>_be): New define_expand with same
implementation as previous version of vsx_xxpermdi_<mode>.
[gcc/testsuite]
2017-02-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2017-02-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/79261
* gcc.target/powerpc/vec-xxpermdi.c: New file.
Carl Love [Thu, 16 Feb 2017 20:59:20 +0000 (20:59 +0000)]
backport: re PR target/79545 (gcc[5/6]: RS6000, xvcvuxdsp and xvcvsxdsp RTL defines have wrong type)
gcc/ChangeLog:
2017-02-16 Carl Love <cel@us.ibm.com>
Backport from mainline commit r245460 on 2017-02-14
PR 79545
* config/rs6000/rs6000.c: Add case statement entry to make the xvcvuxdsp
built-in argument unsigned.
* config/rs6000/vsx.md: Fix the source and return operand types so they
match the instruction definitions from the ISA document. Fix typo
in the instruction generation for the (define_insn "vsx_xvcvuxdsp"
statement.
gcc/testsuite/ChangeLog:
2017-01-16 Carl Love <cel@us.ibm.com>
Backport from mainline commit r245460 on 2017-02-14
PR 79545
* gcc.target/powerpc/vsx-builtin-3.c: Add missing test case for the
xvcvsxdsp and xvcvuxdsp instructions.
Jonathan Wakely [Tue, 14 Feb 2017 21:17:34 +0000 (21:17 +0000)]
PR69321 fix any_cast<T>(any*) for non-copyable T
Backport from mainline
2017-01-20 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/69321
* include/experimental/any (__any_caster): Avoid instantiating
manager function for types that can't be stored in any.
* testsuite/experimental/any/misc/any_cast.cc: Likewise.
* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.
Jonathan Wakely [Tue, 14 Feb 2017 21:17:23 +0000 (21:17 +0000)]
PR78702 fix accessibility of locale::facet::__shim
Backport from mainline
2017-01-16 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/78702
* include/bits/locale_classes.h (locale::facet::__shim): Change from
private to protected.
* src/c++11/cxx11-shim_facets.cc (__shim_accessor): Define helper to
make locale::facet::__shim accessible.
Jonathan Wakely [Tue, 14 Feb 2017 21:17:11 +0000 (21:17 +0000)]
PR78273 fix count to work with partitioning function
Backport from mainline
2017-01-11 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/78273
* include/bits/stl_map.h (map::count<_Kt>(const _Kt&)): Don't assume
the heterogeneous comparison can only find one match.
* include/bits/stl_set.h (set::count<_Kt>(const _Kt&)): Likewise.
* testsuite/23_containers/map/operations/2.cc: Test count works with
comparison function that just partitions rather than sorting.
* testsuite/23_containers/set/operations/2.cc: Likewise.
Carl Love [Mon, 6 Feb 2017 17:40:29 +0000 (17:40 +0000)]
backport: dated 2017-01-26 and 2017-01-25 respectively
gcc/ChangeLog:
2017-02-06 Carl Love <cel@us.ibm.com>
Backport of two commits from mainline, r244943 and r244904,
dated 2017-01-26 and 2017-01-25 respectively
* config/rs6000/rs6000-c (altivec_overloaded_builtins): Fix order
of entries for ALTIVEC_BUILTIN_VEC_PACKS. Remove bogus entries
for P8V_BUILTIN_VEC_VGBBD.
gcc/testsuite/ChangeLog:
2017-02-06 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-3-p8.c: Add new testfile for missing
vec_packs built-in tests.
Jonathan Wakely [Wed, 1 Feb 2017 12:57:58 +0000 (12:57 +0000)]
PR78346 make <bits/predefined_ops.h> handle stashing iterators
PR libstdc++/78346
* include/bits/predefined_ops.h (_Iter_equals_iter): Store iterator
not its referent.
(_Iter_comp_to_iter): Likewise.
* testsuite/25_algorithms/search/78346.cc: New test.
Jonathan Wakely [Wed, 1 Feb 2017 12:18:43 +0000 (12:18 +0000)]
PR libstdc++/79254 fix exception-safety of std::string copy assignment
PR libstdc++/79254
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::operator=(const basic_string&)): If source object is
small just deallocate, otherwise perform new allocation before
making any changes.
* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
Test exception-safety of copy assignment when allocator propagates.
* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
Likewise.
* testsuite/util/testsuite_allocator.h (uneq_allocator::swap): Make
std::swap visible.
Richard Biener [Thu, 26 Jan 2017 13:08:43 +0000 (13:08 +0000)]
backport: [multiple changes]
2017-01-26 Richard Biener <rguenther@suse.de>
Backport from mainline
2016-01-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/79034
* tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
Propagate out degenerate PHIs in the joiner.
* g++.dg/torture/pr79034.C: New testcase.
2016-11-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/78224
* tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
Split the fallthru edge in case its successor may have PHIs.
Do not free dominance info.
Richard Biener [Thu, 26 Jan 2017 08:16:37 +0000 (08:16 +0000)]
backport: [multiple changes]
2017-01-26 Richard Biener <rguenther@suse.de>
Backport from mainline
2016-09-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/77745
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
When removing redundant stores make sure to check compatibility
of the TBAA state for downstream accesses.
* tree-ssa-sccvn.c (visit_reference_op_store): Likewise for when
value-numbering virtual operands for store matches.
* g++.dg/torture/pr77745.C: New testcase.
2016-09-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/77768
* tree-ssa-sccvn.c (visit_reference_op_store): Properly deal
with stores to a place we know has a constant value.
* tree-vrp.c (set_defs_to_varying): New helper avoiding
writing to vr_const_varying.
(vrp_initialize): Call it.
(vrp_visit_stmt): Likewise.
(evrp_dom_walker::before_dom_children): Likewise.
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Handle stores to readonly memory when removing redundant stores.
Wilco Dijkstra [Tue, 24 Jan 2017 14:14:12 +0000 (14:14 +0000)]
With -fpu=neon DI mode shifts are expanded after reload.
With -fpu=neon DI mode shifts are expanded after reload. DI mode registers can
either fully or partially overlap on both ARM and Thumb-2. However the shift
expansion code can only deal with the full overlap case, and generates incorrect
code for partial overlaps. The fix is to add new variants that support either
full overlap or no overlap.
Backport from mainline
gcc/
PR target/78041
* config/arm/neon.md (ashldi3_neon): Add "r 0 i" and "&r r i" variants.
Remove partial overlap check for shift by 1.
(ashldi3_neon): Likewise.
testsuite/
* gcc.target/arm/pr78041.c: New test.