1. 20 Feb, 2020 11 commits
    • libstdc++: Issues with range access CPOs (P2091R0) · e817c23f
      This changes how arrays of unknown bound and/or incomplete element type
      are handled.
      
      	* include/bits/range_access.h (ranges::begin): Reject array of
      	incomplete type.
      	(ranges::end, ranges::size): Require arrays to be bounded.
      	(ranges::data): Require lvalue or borrowed_range.
      	(ranges::iterator_t): Remove constraint.
      	* testsuite/std/ranges/access/begin.cc: Do not check array of
      	incomplete type.
      	* testsuite/std/ranges/access/begin_neg.cc: New test.
      	* testsuite/std/ranges/access/end_neg.cc: Adjust expected error.
      	* testsuite/std/ranges/access/size_neg.cc: Adjust expected error.
      	* testsuite/std/ranges/access/ssize.cc: Do not check array of
      	incomplete type.
      Jonathan Wakely committed
    • libstdc++: Define operator<=> for <system_error> types · 4be779f5
      Another piece of P1614R2 for C++20.
      
      This also adds tests for operator< in C++11, which was present but
      untested.
      
      	* include/std/system_error (error_category::operator<=>)
      	(operator<=>(const error_code&, const error_code&))
      	(operator<=>(const error_condition&, const error_condition&)): Define
      	for C++20.
      	* testsuite/19_diagnostics/error_category/operators/less.cc: New test.
      	* testsuite/19_diagnostics/error_category/operators/three_way.cc: New
      	test.
      	* testsuite/19_diagnostics/error_code/operators/equal.cc: Remove
      	incorrect comment.
      	* testsuite/19_diagnostics/error_code/operators/less.cc: New test.
      	* testsuite/19_diagnostics/error_code/operators/not_equal.cc: Remove
      	incorrect comment.
      	* testsuite/19_diagnostics/error_code/operators/three_way.cc: New test.
      	* testsuite/19_diagnostics/error_condition/operators/equal.cc: Remove
      	incorrect comment.
      	* testsuite/19_diagnostics/error_condition/operators/less.cc: New test.
      	* testsuite/19_diagnostics/error_condition/operators/not_equal.cc:
      	Remove incorrect comment.
      	* testsuite/19_diagnostics/error_condition/operators/three_way.cc: New
      	test.
      Jonathan Wakely committed
    • libstdc++: Remove std::type_info::operator!= for C++20 · 20fa41e6
      This function can be synthesized by the compiler now.
      
      	* libsupc++/typeinfo (type_info::operator!=): Remove for C++20.
      Jonathan Wakely committed
    • libstdc++: Add <=> to thread::id · c7b591f3
      	* include/std/thread (thread::id::operator<=>): Define for C++20.
      	* testsuite/30_threads/thread/id/70294.cc: Do not take addresses of
      	functions in namespace std.
      	* testsuite/30_threads/thread/id/operators_c++20.cc: New test.
      Jonathan Wakely committed
    • Remove superfluous word in documentation. · 4a172be3
      	PR translation/93841
      	* config/or1k/or1k.opt: Remove superfluous word.
      	* doc/invoke.texi: Likewise.
      Martin Liska committed
    • Remove triling space for a warning. · 6c39d0b7
      	PR translation/93838
      	* parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
      Martin Liska committed
    • Fix error message for Darwin. · 093bdf2c
      	PR translation/93831
      	* config/darwin.c (darwin_override_options): Change 64b to 64-bit mode.
      Martin Liska committed
    • Remove trailing | in help message. · f40237a3
      	PR translation/93830
      	* common/config/avr/avr-common.c: Remote trailing "|".
      Martin Liska committed
    • Update gcc de.po. · 85232b45
      	* de.po: Update.
      Joseph Myers committed
    • Daily bump. · 549a2400
      GCC Administrator committed
    • c++: Fix wrong-code with non-constexpr constructor [PR93169] · 8f9dd1b0
      In order to detect modifying constant objects in constexpr evaluation,
      which is UB, in r10-2655 I added code that sets TREE_READONLY on
      CONSTRUCTORs of const-qualified objects after they have been fully
      constructed.  But I never made sure that what we're setting the flag
      on actually is a CONSTRUCTOR.  Consequently, as this test case shows,
      we could set TREE_READONLY on a VAR_DECL that in fact wasn't constant,
      causing problems later.  Fixed by setting the flag on CONSTRUCTORs
      only, and only when the evaluation produced something constant.
      
      2020-02-19  Marek Polacek  <polacek@redhat.com>
      
      	PR c++/93169 - wrong-code with a non-constexpr constructor.
      	* constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
      	on constant CONSTRUCTORs.
      
      	* g++.dg/cpp0x/constexpr-93169.C: New test.
      Marek Polacek committed
  2. 19 Feb, 2020 29 commits
    • PR tree-optimization/92128 - fold more non-constant strlen relational expressions · ccf86d54
      gcc/testsuite/ChangeLog:
      	* gcc.dg/strlenopt-81.c: Align arrays to let strictly aligned targets
      	optimize away calls as expected.
      Martin Sebor committed
    • libstdc++: Add missing call to unused subroutine in split_view test · 38c7b74d
      libstdc++-v3/ChangeLog:
      
      	* testsuite/std/ranges/adaptors/split.cc (test03): Don't include the
      	null terminator of the underlying string as part of the test_range.
      	(main): Call test03.
      Patrick Palka committed
    • libstdc++: make common_iterator<I, S> require copyable<I> (LWG 3385) · 1b425f3a
      	* include/bits/stl_iterator.h (common_iterator): Add copyable<I>
      	requirement (LWG 3385).
      	* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust
      	expected declaration.
      Jonathan Wakely committed
    • libstdc++: Add default-initializers to views (LWG 3364) · 7433536b
      	* include/std/ranges (take_while_view, drop_view, drop_while_view)
      	(elements_view:_Iterator): Initialize data members (LWG 3364).
      Jonathan Wakely committed
    • libstdc++: Simplify std::three_way_comparable_with (LWG 3360) · 256f67aa
      This also removes a useless condition that was supposed to be removed by
      the P1959R0 changes, but left in when that was implemented.
      
      	* libsupc++/compare (three_way_comparable): Remove always-false check
      	that should have been removed with weak_equality (P1959R0).
      	(three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
      Jonathan Wakely committed
    • libstdc++: Simplify std::totally_ordered (LWG 3331) · 0294dc5f
      	* include/std/concepts (__detail::__partially_ordered_with): Move here
      	from <compare>.
      	(totally_ordered, totally_ordered_with): Use __partially_ordered_with
      	to simplify definition (LWG 3331).
      	* libsupc++/compare (__detail::__partially_ordered_with): Move to
      	<concepts>.
      Jonathan Wakely committed
    • libstdc++: Simplify std::totally_ordered_with (LWG 3329) · 241ed965
      	* include/std/concepts (totally_ordered_with): Remove redundant
      	requirement (LWG 3329).
      Jonathan Wakely committed
    • libstdc++: subrange converting constructor should disallow slicing (LWG 3282) · 77f5310f
      	* include/std/ranges (__detail::__convertible_to_non_slicing): New
      	helper concept.
      	(__detail::__pair_like_convertible_to): Remove.
      	(__detail::__pair_like_convertible_from): Add requirements for
      	non-slicing conversions.
      	(subrange): Constrain constructors with __convertible_to_non_slicing.
      	Remove constructors from pair-like types. Add new deduction guide.
      	* testsuite/std/ranges/subrange/lwg3282_neg.cc: New test.
      Jonathan Wakely committed
    • libstdc++: ranges::iter_move should perform ADL-only lookup (LWG 3247) · 59aa9e57
      	* include/bits/iterator_concepts.h (iter_move): Add declaration to
      	prevent unqualified lookup finding a suitable declaration (LWG 3247).
      Jonathan Wakely committed
    • testsuite: Add -msse2 to fix ia32 tests. · 58f2e59a
      	* gcc.dg/gimplefe-41.c: Add -msse2 additional options for x86 targets.
      	* gcc.dg/ipa/ipa-sra-19.c: Ditto.
      Uros Bizjak committed
    • Fix a typo in comment. · fd136f01
      2020-02-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              * collect2.c (maybe_run_lto_and_relink): Fix typo in
              comment.
      Bernd Edlinger committed
    • libstdc++: make polymorphic_allocator throw consistent type (LWG 3237) · e89100ef
      	* include/std/memory_resource (polymorphic_allocator::allocate)
      	(polymorphic_allocator::allocate_object): Change type of exception to
      	bad_array_new_length (LWG 3237).
      	* testsuite/20_util/polymorphic_allocator/lwg3237.cc: New test.
      Jonathan Wakely committed
    • libstdc++: Add __cpp_lib_unwrap_ref feature test macro · bb54e0b8
      We already defined the traits in <type_traits> as now required by LWG
      3348, but the macro was missing. This adds it.
      
      	* include/std/type_traits (__cpp_lib_unwrap_ref): Define (LWG 3348).
      	* include/std/version (__cpp_lib_unwrap_ref): Likewise.
      	* testsuite/20_util/unwrap_reference/1.cc: Check macro.
      	* testsuite/20_util/unwrap_reference/3.cc: New test.
      Jonathan Wakely committed
    • libstdc++: midpoint should not constrain T is complete (LWG 3200) · 5f031f97
      	* include/std/numeric (midpoint(T8, T*)): Do not check for complete
      	type during overload resolution, use static assert instead (LWG 3200).
      	* testsuite/26_numerics/midpoint/pointer.cc: Do not test with
      	incomplete type.
      	* testsuite/26_numerics/midpoint/pointer_neg.cc: New test.
      Jonathan Wakely committed
    • libstdc++: span's deduction-guide for built-in arrays doesn't work (LWG 3369) · 66ae31eb
      The 23_containers/span/deduction.cc test was already passing, but only
      because I had previously implemented the original proposed resolution of
      3255. As pointed out in 3255 that original P/R was incorrect because it
      broke construction from array xvalues. This reverts the incorrect part
      of 3255 (and adds tests for the case it broke), and implements the
      resolution of 3369 instead.
      
      	* include/std/span (span(T (&)[N])): Use non-deduced context to
      	prevent first parameter from interfering with class template argument
      	deduction (LWG 3369).
      	* testsuite/23_containers/span/deduction.cc: Add missing 'const'.
      	* testsuite/23_containers/span/lwg3255.cc: Check for construction from
      	rvalues.
      Jonathan Wakely committed
    • libstdc++: Remove std::span::cbegin and std::span::cend (LWG 3320) · 247f410b
      	* include/std/span (span::const_iterator, span::const_reverse_iterator)
      	(span::cbegin(), span::cend(), span::crbegin(), span::crend()):
      	Remove (LWG 3320).
      	* testsuite/23_containers/span/everything.cc: Replace uses of cbegin
      	and cend.
      	* testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
      	Likewise.
      	* testsuite/20_util/specialized_algorithms/uninitialized_copy/
      	constrained.cc: Likewise.
      	* testsuite/20_util/specialized_algorithms/
      	uninitialized_default_construct/constrained.cc: Likewise.
      	* testsuite/20_util/specialized_algorithms/uninitialized_fill/
      	constrained.cc: Likewise.
      	* testsuite/20_util/specialized_algorithms/uninitialized_move/
      	constrained.cc: Likewise.
      	* testsuite/20_util/specialized_algorithms/
      	uninitialized_value_construct/constrained.cc: Likewise.
      Jonathan Wakely committed
    • vect: Fix offset calculation for -ve strides [PR93767] · f91aa3e6
      This PR is a regression caused by r256644, which added support for alias
      checks involving variable strides.  One of the changes in that commit
      was to split the access size out of the segment length.  The PR shows
      that I hadn't done that correctly for the handling of negative strides
      in vect_compile_time_alias.  The old code was:
      
            const_length_a = (-wi::to_poly_wide (segment_length_a)).force_uhwi ();
            offset_a = (offset_a + vect_get_scalar_dr_size (a)) - const_length_a;
      
      where vect_get_scalar_dr_size (a) was cancelling out the subtraction
      of the access size inherent in "- const_length_a".  Taking the access
      size out of the segment length meant that the addition was no longer
      needed/correct.
      
      2020-02-19  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	PR tree-optimization/93767
      	* tree-vect-data-refs.c (vect_compile_time_alias): Remove the
      	access-size bias from the offset calculations for negative strides.
      
      gcc/testsuite/
      	PR tree-optimization/93767
      	* gcc.dg/vect/pr93767.c: New test.
      Richard Sandiford committed
    • libstdc++: Add ranges_size_t and rename all_view (LWG 3335) · aca60ecf
      	* include/bits/range_access.h (range_size_t): Define alias template.
      	* include/std/ranges (all_view): Rename to views::all_t (LWG 3335).
      	* testsuite/std/ranges/adaptors/filter.cc: Adjust to new name.
      Jonathan Wakely committed
    • libstdc++: Remove converting constructors from views (LWG 3280) · 4cc3b275
      	* include/std/ranges (filter_view, transform_view, take_view)
      	(join_view, split_view, reverse_view): Remove commented-out converting
      	constructors (LWG 3280).
      Jonathan Wakely committed
    • libstdc++: uninitialized_construct_using_allocator should use construct_at (LWG 3321) · 5f3641d0
      	* include/std/memory (uninitialized_construct_using_allocator): Use
      	std::construct_at (LWG 3321).
      Jonathan Wakely committed
    • libstdc++: Add nodiscard to polymorphic_allocator members (LWG 3304) · 020a03ee
      	* include/std/memory_resource (polymorphic_allocator::allocate_bytes)
      	(polymorphic_allocator::allocate_object)
      	(polymorphic_allocator::new_object): Add nodiscard attribute (LWG3304).
      Jonathan Wakely committed
    • libstdc++: "safe" in several library names is misleading (LWG 3379) · 15411a64
      	* include/bits/range_access.h (enable_safe_range): Rename to
      	enable_borrowed_range.
      	(__detail::__maybe_safe_range): Rename to __maybe_borrowed_range.
      	(safe_range): Rename to borrowed_range.
      	* include/bits/ranges_algo.h: Adjust to use new names.
      	* include/bits/ranges_algobase.h: Likewise.
      	* include/bits/ranges_uninitialized.h: Likewise.
      	* include/std/ranges: Likewise.
      	(safe_iterator_t): Rename to borrowed_iterator_t.
      	(safe_subrange_t): Rename to borrowed_subrange_t.
      	* include/std/span: Adjust to use new names.
      	* include/std/string_view: Likewise.
      	* include/experimental/string_view: Likewise.
      	* testsuite/std/ranges/access/begin.cc: Likewise.
      	* testsuite/std/ranges/access/cbegin.cc: Likewise.
      	* testsuite/std/ranges/access/cdata.cc: Likewise.
      	* testsuite/std/ranges/access/cend.cc: Likewise.
      	* testsuite/std/ranges/access/crbegin.cc: Likewise.
      	* testsuite/std/ranges/access/crend.cc: Likewise.
      	* testsuite/std/ranges/access/data.cc: Likewise.
      	* testsuite/std/ranges/access/end.cc: Likewise.
      	* testsuite/std/ranges/access/rbegin.cc: Likewise.
      	* testsuite/std/ranges/access/rend.cc: Likewise.
      	* testsuite/std/ranges/safe_range.cc: Likewise.
      	* testsuite/std/ranges/safe_range_types.cc: Likewise.
      	* testsuite/util/testsuite_iterators.h: Likewise.
      Jonathan Wakely committed
    • libstdc++: tuple_element_t is also wrong for const subrange (LWG 3398) · fa89adaa
      	* include/std/ranges (tuple_element<0, const subrange<I, S, K>>)
      	(tuple_element<1, const subrange<I, S, K>>): Add partial
      	specializations (LWG 3398).
      	* testsuite/std/ranges/subrange/tuple_like.cc: New test.
      Jonathan Wakely committed
    • libstdc++: Remove redundant bool casts in ranges algorithms · a45fb21a
      Some of these casts were added by me the other day, but some were
      already present. I think they are all redundant following the
      introduction of the boolean-testable concept in P1964R2.
      
      	* include/bits/ranges_algo.h (__find_fn, __find_first_of_fn)
      	(__adjacent_find_fn, __remove_if_fn, __remove_copy_if_fn)
      	(__unique_fn, __unique_copy_fn): Remove redundant conversions to bool.
      Jonathan Wakely committed
    • Fix -save-temp leaking files in /tmp · 73d53120
      And avoid signal handler calling signal unsafe functions,
      and/or calling unlink with uninitialized memory pointer.
      
      2020-02-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
      	* collect2.c (c_file, o_file): Make const again.
      	(ldout,lderrout, dump_ld_file): Remove.
      	(tool_cleanup): Avoid calling not signal-safe functions.
      	(maybe_run_lto_and_relink): Avoid possible signal handler
      	access to unintialzed memory (lto_o_files).
      	(main): Avoid leaking temp files in $TMPDIR.
      	Initialize c_file/o_file with concat, which avoids exposing
      	uninitialized memory to signal handler, which calls unlink(!).
      	Avoid calling maybe_unlink when the main function returns,
      	since the atexit handler is already doing this.
      	* collect2.h (dump_ld_file, ldout, lderrout): Remove.
      Bernd Edlinger committed
    • sra: Do not create zero sized accesses (PR 93776) · 51faf07c
      SRA can get a bit confused with zero-sized accesses like the one in
      the testcase.  Since there is nothing in the access, nothing is
      scalarized, but we can get order of the structures wrong, which the
      verifier is not happy about.
      
      Fixed by simply ignoring such accesses.
      
      2020-02-19  Martin Jambor  <mjambor@suse.cz>
      
      	PR tree-optimization/93776
      	* tree-sra.c (create_access): Do not create zero size accesses.
      	(get_access_for_expr): Do not search for zero sized accesses.
      
      	testsuite/
      	* gcc.dg/tree-ssa/pr93776.c: New test.
      Martin Jambor committed
    • sra: Avoid totally scalarizing overallping field_decls (PR 93667) · 665c5bad
      [[no_unique_address]] C++ attribute can cause two fields of a
      RECORD_TYPE overlap, which currently confuses the totally scalarizing
      code into creating invalid access tree.  For GCC 10, I'd like to
      simply disable total scalarization of types where this happens.
      
      For GCC 11 I'll write down a TODO item to enable total scalarization
      of cases like this where the problematic fields are basically empty -
      despite having a non-zero size - i.e. when they are just RECORD_TYPEs
      without any data fields.
      
      2020-02-19  Martin Jambor  <mjambor@suse.cz>
      
      	gcc/
      
      	PR tree-optimization/93667
      	* tree-sra.c (scalarizable_type_p): Return false if record fields
      	do not follow wach other.
      
      	gcc/testsuite/
      
      	PR tree-optimization/93667
      	* g++.dg/tree-ssa/pr93667.C: New test.
      Martin Jambor committed
    • libgomp: Fixes + cleanup for OpenACC's Fortran module + openacc_lib.h · 8d1a1cb1
      2020-02-19  Tobias Burnus  <tobias@codesourcery.com>
      
      	* .gitattributes: New; whitespace handling for Fortran's openacc_lib.h.
      	* config/accel/openacc.f90 (openacc_kinds): Add acc_device_current.
      	(openacc_internal, acc_on_device_h): Fix argument name; minor cleanup.
      	* libgomp.texi (Enabling OpenACC): No longer mark as experimental.
      	(acc_set_device_num): Fix Fortran argument name, use same name for C.
      	(acc_get_property): Update Fortran interface to post-OpenACC 3.0
      	corrections; add note about the previous interface and named constant.
      	(OpenACC library and environment variables): Fix two typos.
      	* openacc.f90: Use for all procedures the argument names from the spec
      	as for …_h they are user visible.
      	(openacc_kinds): Rename acc_device_property to
      	acc_device_property_kinds and change value to int32 ; and update users.
      	Re-add acc_device_property for for backward compatibility.
      	(acc_get_property_string_h): Clean up as acc_device_property_kind
      	changed.
      	(acc_get_property_h): Likewise and return c_size_t instead of
      	acc_device_property.
      	(openacc): Also export acc_device_property_kinds.
      	(acc_async_test_h, acc_async_test_all_h, acc_on_device_h,
      	acc_is_present_32_h, acc_is_present_64_h): Simplify logical-return-value
      	handling; check against /= 0 instead of == 1 to match C.
      	* openacc_lib.h: Use for all procedures the argument names from the spec
      	as for …_h they are user visible. Place !GCC$ into the first column to
      	be active also for fixed-form souce form.
      	(acc_device_current, acc_device_property_kind, acc_device_property,
      	acc_property_memory, acc_property_free_memory, acc_property_name,
      	acc_property_vendor, acc_property_driver): New named constants.
      	(acc_get_property, acc_get_property_string): New generic interface.
      Tobias Burnus committed
    • RISC-V: Using fmv.x.w/fmv.w.x rather than fmv.x.s/fmv.s.x · bfe78b08
       - fmv.x.s/fmv.s.x renamed to fmv.x.w/fmv.w.x in the latest RISC-V ISA
         manual.
      
       - Tested rv32gc/rv64gc on bare-metal with qemu.
      
      ChangeLog
      
      gcc/
      
      Kito Cheng  <kito.cheng@sifive.com>
      
      	* config/riscv/riscv.c (riscv_output_move) Using fmv.x.w/fmv.w.x
      	rather than fmv.x.s/fmv.s.x.
      Kito Cheng committed