GCC Administrator [Tue, 4 Oct 2022 00:17:16 +0000 (00:17 +0000)]
Daily bump.
Jonathan Wakely [Mon, 3 Oct 2022 17:27:23 +0000 (18:27 +0100)]
libstdc++: Update status docs for compare_exchange padding bits
libstdc++-v3/ChangeLog:
* doc/xml/manual/status_cxx2020.xml: Update C++20 status.
* doc/html/manual/status.html: Regenerate.
Sergei Trofimovich [Fri, 16 Sep 2022 17:33:11 +0000 (18:33 +0100)]
gcc/config/t-i386: add build dependencies on i386-builtin-types.inc
i386-builtin-types.inc is included indirectly via i386-builtins.h
into 4 files: i386.cc i386-builtins.cc i386-expand.cc i386-features.cc
Only i386.cc dependency was present in gcc/config/t-i386 makefile.
As a result parallel builds occasionally fail as:
g++ ... -o i386-builtins.o ... ../../gcc-13-
20220911/gcc/config/i386/i386-builtins.cc
In file included from ../../gcc-13-
20220911/gcc/config/i386/i386-builtins.cc:92:
../../gcc-13-
20220911/gcc/config/i386/i386-builtins.h:25:10:
fatal error: i386-builtin-types.inc: No such file or directory
25 | #include "i386-builtin-types.inc"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [../../gcc-13-
20220911/gcc/config/i386/t-i386:54: i386-builtins.o]
Error 1 shuffle=
1663349189
gcc/
* config/i386/t-i386: Add build-time dependencies against
i386-builtin-types.inc to i386-builtins.o, i386-expand.o,
i386-features.o.
Torbjörn SVENSSON [Fri, 23 Sep 2022 08:35:15 +0000 (10:35 +0200)]
[testsuite][arm] Fix cmse-15.c expected output
The cmse-15.c testcase fails at -Os because ICF means that we
generate
secure3:
b secure1
which is OK, but does not match the currently expected
secure3:
...
bx r[0-3]
gcc/testsuite/ChangeLog:
* gcc.target/arm/cmse/cmse-15.c: Align with -Os improvements.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Jakub Jelinek [Mon, 3 Oct 2022 16:04:37 +0000 (18:04 +0200)]
c++: Disallow jumps into statement expressions
On Fri, Sep 30, 2022 at 04:39:25PM -0400, Jason Merrill wrote:
> > --- gcc/cp/decl.cc.jj 2022-09-22 00:14:55.
478599363 +0200
> > +++ gcc/cp/decl.cc 2022-09-22 00:24:01.
121178256 +0200
> > @@ -223,6 +223,7 @@ struct GTY((for_user)) named_label_entry
> > bool in_transaction_scope;
> > bool in_constexpr_if;
> > bool in_consteval_if;
> > + bool in_assume;
>
> I think it would be better to reject jumps into statement-expressions like
> the C front-end.
Ok, here is a self-contained patch that does that.
2022-10-03 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (BCS_STMT_EXPR): New enumerator.
* name-lookup.h (enum scope_kind): Add sk_stmt_expr.
* name-lookup.cc (begin_scope): Handle sk_stmt_expr like sk_block.
* semantics.cc (begin_compound_stmt): For BCS_STMT_EXPR use
sk_stmt_expr.
* parser.cc (cp_parser_statement_expr): Use BCS_STMT_EXPR instead of
BCS_NORMAL.
* decl.cc (struct named_label_entry): Add in_stmt_expr.
(poplevel_named_label_1): Handle sk_stmt_expr.
(check_previous_goto_1): Diagnose entering of statement expression.
(check_goto): Likewise.
* g++.dg/ext/stmtexpr24.C: New test.
Joseph Myers [Mon, 3 Oct 2022 16:00:10 +0000 (16:00 +0000)]
Update gcc sv.po
* sv.po: Update.
Patrick Palka [Mon, 3 Oct 2022 15:20:32 +0000 (11:20 -0400)]
c++: rename IS_SAME_AS trait code to IS_SAME
... to match the trait's canonical spelling __is_same instead
of its alternative spelling __is_same_as.
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Use RID_IS_SAME instead of
RID_IS_SAME_AS.
gcc/cp/ChangeLog:
* constraint.cc (diagnose_trait_expr): Use CPTK_IS_SAME instead
of CPTK_IS_SAME_AS.
* cp-trait.def (IS_SAME_AS): Rename to ...
(IS_SAME): ... this.
* pt.cc (alias_ctad_tweaks): Use CPTK_IS_SAME instead of
CPTK_IS_SAME_AS.
* semantics.cc (trait_expr_value): Likewise.
(finish_trait_expr): Likewise.
Arsen Arsenović [Fri, 30 Sep 2022 15:06:49 +0000 (17:06 +0200)]
libstdc++: Disable hosted-only tests [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc:
Require ET hosted.
* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Likewise.
* testsuite/18_support/new_nothrow.cc: Likewise.
* testsuite/20_util/allocator/105975.cc: Likewise.
* testsuite/20_util/allocator/14176.cc: Likewise.
* testsuite/20_util/allocator/64135.cc: Likewise.
* testsuite/20_util/allocator/89510.cc: Likewise.
* testsuite/20_util/allocator/lwg3190.cc: Likewise.
* testsuite/20_util/allocator/overaligned.cc: Likewise.
* testsuite/20_util/allocator/rebind_c++20.cc: Likewise.
* testsuite/20_util/allocator/requirements/constexpr.cc:
Likewise.
* testsuite/20_util/allocator/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs_c++20.cc:
Likewise.
* testsuite/20_util/allocator/void.cc: Likewise.
* testsuite/20_util/allocator_traits/header-2.cc: Likewise.
* testsuite/20_util/allocator_traits/header.cc: Likewise.
* testsuite/20_util/allocator_traits/members/92878_92947.cc:
Likewise.
* testsuite/20_util/allocator_traits/members/pointers.cc:
Likewise.
* testsuite/20_util/allocator_traits/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/bad_function_call/cons_virtual_derivation.cc:
Likewise.
* testsuite/20_util/bind/42593.cc: Likewise.
* testsuite/20_util/bitset/access/dr396.cc: Likewise.
* testsuite/20_util/bitset/access/to_string.cc: Likewise.
* testsuite/20_util/bitset/cons/16020.cc: Likewise.
* testsuite/20_util/bitset/cons/dr1325-2.cc: Likewise.
* testsuite/20_util/bitset/cons/dr396.cc: Likewise.
* testsuite/20_util/bitset/debug/invalidation/1.cc: Likewise.
* testsuite/20_util/bitset/ext/15361.cc: Likewise.
* testsuite/20_util/bitset/operations/13838.cc: Likewise.
* testsuite/20_util/bitset/operations/96303.cc: Likewise.
* testsuite/20_util/bitset/version.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/56383.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/89303.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/members/assign.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/const.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/reinit.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/unique_ptr.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/forward/1.cc: Likewise.
* testsuite/20_util/forward/1_neg.cc: Likewise.
* testsuite/20_util/function/1.cc: Likewise.
* testsuite/20_util/function/10.cc: Likewise.
* testsuite/20_util/function/2.cc: Likewise.
* testsuite/20_util/function/3.cc: Likewise.
* testsuite/20_util/function/4.cc: Likewise.
* testsuite/20_util/function/43397.cc: Likewise.
* testsuite/20_util/function/48541.cc: Likewise.
* testsuite/20_util/function/5.cc: Likewise.
* testsuite/20_util/function/58569.cc: Likewise.
* testsuite/20_util/function/6.cc: Likewise.
* testsuite/20_util/function/60594.cc: Likewise.
* testsuite/20_util/function/65760.cc: Likewise.
* testsuite/20_util/function/69222.cc: Likewise.
* testsuite/20_util/function/7.cc: Likewise.
* testsuite/20_util/function/77322.cc: Likewise.
* testsuite/20_util/function/8.cc: Likewise.
* testsuite/20_util/function/9.cc: Likewise.
* testsuite/20_util/function/91456.cc: Likewise.
* testsuite/20_util/function/assign/move.cc: Likewise.
* testsuite/20_util/function/assign/move_target.cc: Likewise.
* testsuite/20_util/function/cmp/cmp_neg.cc: Likewise.
* testsuite/20_util/function/cons/55320.cc: Likewise.
* testsuite/20_util/function/cons/57465.cc: Likewise.
* testsuite/20_util/function/cons/72820.cc: Likewise.
* testsuite/20_util/function/cons/addressof.cc: Likewise.
* testsuite/20_util/function/cons/callable.cc: Likewise.
* testsuite/20_util/function/cons/deduction.cc: Likewise.
* testsuite/20_util/function/cons/lwg2774.cc: Likewise.
* testsuite/20_util/function/cons/move.cc: Likewise.
* testsuite/20_util/function/cons/move_target.cc: Likewise.
* testsuite/20_util/function/cons/noexcept.cc: Likewise.
* testsuite/20_util/function/cons/non_copyconstructible.cc:
Likewise.
* testsuite/20_util/function/cons/refqual.cc: Likewise.
* testsuite/20_util/function/cons/70692.cc: Likewise.
* testsuite/20_util/function/cons/deduction_c++23.cc: Likewise.
* testsuite/20_util/function/invoke/forwarding.cc: Likewise.
* testsuite/20_util/function/invoke/move_only.cc: Likewise.
* testsuite/20_util/function/null_pointer_comparisons.cc:
Likewise.
* testsuite/20_util/function/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/function/target_no_rtti.cc: Likewise.
* testsuite/20_util/function_objects/83607.cc: Likewise.
* testsuite/20_util/function_objects/mem_fn/adl.cc: Likewise.
* testsuite/20_util/headers/cstdlib/functions_std.cc: Likewise.
* testsuite/20_util/headers/functional/types_std_c++0x.cc:
Likewise.
* testsuite/20_util/headers/memory/types_std_c++0x.cc: Likewise.
* testsuite/20_util/is_function/35637.cc: Likewise.
* testsuite/20_util/move/1.cc: Likewise.
* testsuite/20_util/move_only_function/call.cc: Likewise.
* testsuite/20_util/move_only_function/cons.cc: Likewise.
* testsuite/20_util/move_only_function/move.cc: Likewise.
* testsuite/20_util/move_only_function/version.cc: Likewise.
* testsuite/20_util/owner_less/cmp.cc: Likewise.
* testsuite/20_util/owner_less/noexcept.cc: Likewise.
* testsuite/20_util/owner_less/void.cc: Likewise.
* testsuite/20_util/pointer_safety/1.cc: Likewise.
* testsuite/20_util/scoped_allocator/65279.cc: Likewise.
* testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise.
* testsuite/20_util/scoped_allocator/construct_pair.cc:
Likewise.
* testsuite/20_util/scoped_allocator/dr2586.cc: Likewise.
* testsuite/20_util/scoped_allocator/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/assign.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/dr541.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/move.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/sfinae.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/shared_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc:
Likewise.
* testsuite/20_util/shared_ptr/atomic/1.cc: Likewise.
* testsuite/20_util/shared_ptr/atomic/2.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/1.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/rval.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/42925.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/86537.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/cmp.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc:
Likewise.
* testsuite/20_util/shared_ptr/comparison/dr1401.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/less.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/39405.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/46910.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/51365.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/52924.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/55123.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/58659.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/58839.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/61036.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/79467.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/80229.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/alias-rval.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/alias.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/array.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/copy.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/default.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/lwg2802.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/lwg3548.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/move.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/nullptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/pointer.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_array.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_1.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_2.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/weak_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/36949.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/58594-no-rtti.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/58594.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/87278.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/99006.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/dr402.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/dr925.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/make.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/no_rtti.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/overwrite.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/private.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/single_allocation.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/version.cc: Likewise.
* testsuite/20_util/shared_ptr/dest/dest.cc: Likewise.
* testsuite/20_util/shared_ptr/hash/1.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/24595.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/42019.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/get_deleter.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/swap.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset_sfinae.cc:
Likewise.
* testsuite/20_util/shared_ptr/modifiers/swap.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/swap_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/array.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/bool_conv.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/get.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/owner_before.cc:
Likewise.
* testsuite/20_util/shared_ptr/observers/unique.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/use_count.cc: Likewise.
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/20_util/shared_ptr/requirements/weak_type.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/95788.cc:
Likewise.
* testsuite/20_util/temporary_buffer.cc: Likewise.
* testsuite/20_util/tuple/48476.cc: Likewise.
* testsuite/20_util/tuple/cons/90700.cc: Likewise.
* testsuite/20_util/tuple/cons/96803.cc: Likewise.
* testsuite/20_util/tuple/cons/allocator_with_any.cc: Likewise.
* testsuite/20_util/tuple/cons/allocators.cc: Likewise.
* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc:
Likewise.
* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.
* testsuite/20_util/tuple/p2321r2.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/array.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/array_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/constexpr.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite__neg.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/single.cc: Likewise.
* testsuite/20_util/uses_allocator/69293_neg.cc: Likewise.
* testsuite/20_util/uses_allocator/92878_92947.cc: Likewise.
* testsuite/20_util/uses_allocator/uninitialized_construct.cc:
Likewise.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
* testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/20_util/weak_ptr/lock/1.cc: Likewise.
* testsuite/20_util/weak_ptr/observers/owner_before.cc:
Likewise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/21_strings/basic_string/version.cc: Likewise.
* testsuite/21_strings/basic_string_view/operations/contains/char/2.cc:
Likewise.
* testsuite/21_strings/c_strings/char/69626.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/version.cc:
Likewise.
* testsuite/23_containers/vector/requirements/version.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istream_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/92285.cc: Likewise.
* testsuite/24_iterators/istreambuf_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/requirements/dr445.cc:
Likewise.
* testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/25_algorithms/constexpr_macro.cc: Likewise.
* testsuite/25_algorithms/equal/constrained.cc: Likewise.
* testsuite/25_algorithms/headers/cstdlib/functions_std.cc:
Likewise.
* testsuite/25_algorithms/inplace_merge/1.cc: Likewise.
* testsuite/25_algorithms/lexicographical_compare/constrained.cc:
Likewise.
* testsuite/25_algorithms/make_heap/movable.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test-4.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/1.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/25_algorithms/sort/35588.cc: Likewise.
* testsuite/25_algorithms/stable_partition/1.cc: Likewise.
* testsuite/25_algorithms/stable_partition/constrained.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/mem_check.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/moveable.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc:
Likewise.
* testsuite/25_algorithms/stable_sort/1.cc: Likewise.
* testsuite/26_numerics/complex/2.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/13943.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/2190.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/60401.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2192.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2192_neg.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2735.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/functions_std.cc:
Likewise.
* testsuite/26_numerics/headers/cstdlib/macros.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/types_std.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc:
Likewise.
* testsuite/26_numerics/lerp/version.cc: Likewise.
* testsuite/26_numerics/midpoint/version.cc: Likewise.
* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
* testsuite/27_io/basic_syncstream/2.cc: Likewise.
* testsuite/27_io/fpos/14320-1.cc: Likewise.
* testsuite/27_io/fpos/14320-2.cc: Likewise.
* testsuite/27_io/fpos/14320-3.cc: Likewise.
* testsuite/27_io/fpos/14320-4.cc: Likewise.
* testsuite/27_io/spanstream/version.cc: Likewise.
* testsuite/29_atomics/atomic/lwg3220.cc: Likewise.
* testsuite/29_atomics/atomic/operators/51811.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.
* testsuite/29_atomics/headers/stdatomic.h/version.cc: Likewise.
* testsuite/30_threads/barrier/2.cc: Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
Likewise.
* testsuite/30_threads/jthread/version.cc: Likewise.
* testsuite/30_threads/latch/2.cc: Likewise.
* testsuite/30_threads/semaphore/2.cc: Likewise.
* testsuite/30_threads/stop_token/2.cc: Likewise.
* testsuite/abi/pr42230.cc: Likewise.
* testsuite/ext/shared_ptr/1.cc: Likewise.
* testsuite/libstdc++-xmethods/shared_ptr.cc: Likewise.
* testsuite/std/ranges/adaptors/lazy_split_neg.cc: Likewise.
* testsuite/std/ranges/adaptors/p1739.cc: Likewise.
* testsuite/std/ranges/iota/lwg3292_neg.cc: Likewise.
* testsuite/std/ranges/p2325.cc: Likewise.
Jonathan Wakely [Fri, 30 Sep 2022 12:36:30 +0000 (13:36 +0100)]
libstdc++: Enable std::bitset<N>::bitset(const char*) for freestanding
The std::bitset constructor from a character string is specified in
terms of std::basic_string and std::char_traits, but doesn't need to be.
This makes it available for freestanding.
libstdc++-v3/ChangeLog:
* include/std/bitset (bitset(const C*, size_type n, C, C))
[!_GLIBCXX_HOSTED]: Remove std::basic_string dependency.
(_M_copy_from_ptr) [!_GLIBCXX_HOSTED]: Abort instead of
throwing.
Arsen Arsenović [Wed, 28 Sep 2022 19:30:11 +0000 (21:30 +0200)]
libstdc++: Re-enable std::hash<std::bitset> in freestanding [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* include/std/bitset [!_GLIBCXX_HOSTED]: Re-enable std::hash.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Require ET
hosted.
* testsuite/20_util/bitset/ext/constexpr.cc: Likewise.
Jonathan Wakely [Fri, 30 Sep 2022 14:58:31 +0000 (16:58 +0200)]
libstdc++: Add effective-target 'hosted' for testsuite [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
Also require hosted.
(check_effective_target_hosted): New proc.
Arsen Arsenović [Fri, 30 Sep 2022 14:53:18 +0000 (16:53 +0200)]
libstdc++: Make some tests work on freestanding [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* testsuite/17_intro/headers/c++1998/stdc++.cc [!__STDC_HOSTED__]:
Do not include C headers that aren't valid for freestanding.
* testsuite/17_intro/tag_type_explicit_ctor.cc [!__STDC_HOSTED__]:
Do not test tag types that aren't defined for freestanding.
* testsuite/18_support/headers/cstdlib/functions_std.cc: Do not
check for std::getenv and std::system for freestanding.
* testsuite/17_intro/using_namespace_std_exp_neg.cc [!__STDC_HOSTED__]:
Do not test hosted parts of the standard library.
* testsuite/17_intro/using_namespace_std_tr1_neg.cc [!__STDC_HOSTED__]:
Likewise.
* testsuite/20_util/allocator_traits/members/rebind_alloc.cc [!__STDC_HOSTED__]:
Likewise.
* testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc [!HOSTED]:
Likewise.
* testsuite/20_util/headers/bitset/synopsis.cc [!__STDC_HOSTED__]: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc [!__STDC_HOSTED__]:
Likewise.
* testsuite/20_util/pointer_traits/requirements/typedefs.cc [!__STDC_HOSTED__]:
Likewise.
* testsuite/20_util/tuple/cons/deduction.cc [!__STDC_HOSTED__]: Likewise.
* testsuite/25_algorithms/move/93872.cc [!__STDC_HOSTED__]: Likewise.
* testsuite/std/ranges/adaptors/100577.cc [!__STDC_HOSTED__]: Likewise.
Arsen Arsenović [Fri, 16 Sep 2022 08:38:41 +0000 (10:38 +0200)]
libstdc++: Rework how freestanding install works [PR106953]
In light of there being far more freestanding headers now, ad-hoc
maintenance of a subset of the install implementation has become
unsustainable. Instead, we gate off a part of the normal install routine
so that it works without HOSTED enabled, as well as subdivide lists of
headers into freestanding and hosted components, according to the HOSTED
flag.
libstdc++-v3/ChangeLog:
PR libstdc++/106953
* include/Makefile.am [!_GLIBCXX_HOSTED]: Remove
install-freestanding-headers, unifying it with the usual
install-headers
* include/Makefile.in: Regenerate.
Arsen Arsenović [Mon, 19 Sep 2022 19:54:49 +0000 (21:54 +0200)]
libstdc++: Mark headers that must be hosted as such [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/requires_hosted.h: New header.
* include/experimental/algorithm: Include
<bits/requires_hosted.h>.
* include/experimental/any: Likewise.
* include/experimental/array: Likewise.
* include/experimental/buffer: Likewise.
* include/experimental/chrono: Likewise.
* include/experimental/deque: Likewise.
* include/experimental/executor: Likewise.
* include/experimental/filesystem: Likewise.
* include/experimental/forward_list: Likewise.
* include/experimental/functional: Likewise.
* include/experimental/internet: Likewise.
* include/experimental/io_context: Likewise.
* include/experimental/iterator: Likewise.
* include/experimental/list: Likewise.
* include/experimental/map: Likewise.
* include/experimental/memory: Likewise.
* include/experimental/memory_resource: Likewise.
* include/experimental/net: Likewise.
* include/experimental/netfwd: Likewise.
* include/experimental/numeric: Likewise.
* include/experimental/optional: Likewise.
* include/experimental/propagate_const: Likewise.
* include/experimental/random: Likewise.
* include/experimental/ratio: Likewise.
* include/experimental/regex: Likewise.
* include/experimental/scope: Likewise.
* include/experimental/set: Likewise.
* include/experimental/simd: Likewise.
* include/experimental/socket: Likewise.
* include/experimental/source_location: Likewise.
* include/experimental/string: Likewise.
* include/experimental/string_view: Likewise.
* include/experimental/system_error: Likewise.
* include/experimental/timer: Likewise.
* include/experimental/tuple: Likewise.
* include/experimental/unordered_map: Likewise.
* include/experimental/unordered_set: Likewise.
* include/experimental/utility: Likewise.
* include/experimental/vector: Likewise.
* include/std/barrier: Likewise.
* include/std/chrono: Likewise.
* include/std/condition_variable: Likewise.
* include/std/deque: Likewise.
* include/std/execution: Likewise.
* include/std/filesystem: Likewise.
* include/std/forward_list: Likewise.
* include/std/fstream: Likewise.
* include/std/future: Likewise.
* include/std/iomanip: Likewise.
* include/std/ios: Likewise.
* include/std/iosfwd: Likewise.
* include/std/iostream: Likewise.
* include/std/istream: Likewise.
* include/std/latch: Likewise.
* include/std/list: Likewise.
* include/std/locale: Likewise.
* include/std/map: Likewise.
* include/std/memory_resource: Likewise.
* include/std/mutex: Likewise.
* include/std/ostream: Likewise.
* include/std/queue: Likewise.
* include/std/random: Likewise.
* include/std/regex: Likewise.
* include/std/semaphore: Likewise.
* include/std/set: Likewise.
* include/std/shared_mutex: Likewise.
* include/std/spanstream: Likewise.
* include/std/sstream: Likewise.
* include/std/stack: Likewise.
* include/std/stacktrace: Likewise.
* include/std/stop_token: Likewise.
* include/std/streambuf: Likewise.
* include/std/string: Likewise.
* include/std/syncstream: Likewise.
* include/std/system_error: Likewise.
* include/std/thread: Likewise.
* include/std/unordered_map: Likewise.
* include/std/unordered_set: Likewise.
* include/std/valarray: Likewise.
* include/std/vector: Likewise.
* include/tr1/array: Likewise.
* include/tr1/ccomplex: Likewise.
* include/tr1/cctype: Likewise.
* include/tr1/cfenv: Likewise.
* include/tr1/cfloat: Likewise.
* include/tr1/cinttypes: Likewise.
* include/tr1/climits: Likewise.
* include/tr1/cmath: Likewise.
* include/tr1/complex: Likewise.
* include/tr1/complex.h: Likewise.
* include/tr1/cstdarg: Likewise.
* include/tr1/cstdbool: Likewise.
* include/tr1/cstdint: Likewise.
* include/tr1/cstdio: Likewise.
* include/tr1/cstdlib: Likewise.
* include/tr1/ctgmath: Likewise.
* include/tr1/ctime: Likewise.
* include/tr1/ctype.h: Likewise.
* include/tr1/cwchar: Likewise.
* include/tr1/cwctype: Likewise.
* include/tr1/fenv.h: Likewise.
* include/tr1/float.h: Likewise.
* include/tr1/functional: Likewise.
* include/tr1/inttypes.h: Likewise.
* include/tr1/limits.h: Likewise.
* include/tr1/math.h: Likewise.
* include/tr1/memory: Likewise.
* include/tr1/random: Likewise.
* include/tr1/regex: Likewise.
* include/tr1/stdarg.h: Likewise.
* include/tr1/stdbool.h: Likewise.
* include/tr1/stdint.h: Likewise.
* include/tr1/stdio.h: Likewise.
* include/tr1/stdlib.h: Likewise.
* include/tr1/tgmath.h: Likewise.
* include/tr1/tuple: Likewise.
* include/tr1/type_traits: Likewise.
* include/tr1/unordered_map: Likewise.
* include/tr1/unordered_set: Likewise.
* include/tr1/utility: Likewise.
* include/tr1/wchar.h: Likewise.
* include/tr1/wctype.h: Likewise.
* include/c_global/cmath: Likewise.
* include/ext/algorithm: Include <bits/requires_hosted.h>.
* include/ext/bitmap_allocator.h: Likewise.
* include/ext/cmath: Likewise.
* include/ext/codecvt_specializations.h: Likewise.
* include/ext/debug_allocator.h: Likewise.
* include/ext/enc_filebuf.h: Likewise.
* include/ext/extptr_allocator.h: Likewise.
* include/ext/functional: Likewise.
* include/ext/malloc_allocator.h: Likewise.
* include/ext/memory: Likewise.
* include/ext/mt_allocator.h: Likewise.
* include/ext/new_allocator.h: Likewise.
* include/ext/numeric: Likewise.
* include/ext/pod_char_traits.h: Likewise.
* include/ext/pool_allocator.h: Likewise.
* include/ext/random: Likewise.
* include/ext/random.tcc: Likewise.
* include/ext/rb_tree: Likewise.
* include/ext/rc_string_base.h: Likewise.
* include/ext/rope: Likewise.
* include/ext/ropeimpl.h: Likewise.
* include/ext/slist: Likewise.
* include/ext/sso_string_base.h: Likewise.
* include/ext/stdio_filebuf.h: Likewise.
* include/ext/stdio_sync_filebuf.h: Likewise.
* include/ext/string_conversions.h: Likewise.
* include/ext/throw_allocator.h: Likewise.
* include/ext/vstring.h: Likewise.
* include/ext/vstring.tcc: Likewise.
* include/ext/vstring_fwd.h: Likewise.
* include/ext/vstring_util.h: Likewise.
* include/std/charconv: Likewise.
(__cpp_lib_to_chars): Do not define for freestanding.
* include/std/version: Adjust which macros get defined in
freestanding.
* include/ext/pointer.h [!_GLIBCXX_HOSTED]: Omit iostream
functionality from freestanding.
* include/std/algorithm [!_GLIBCXX_HOSTED]: Omit PSTL algos.
* include/std/memory [!_GLIBCXX_HOSTED]: Omit
<bits/stl_tempbuf.h> in freestanding
* include/bits/algorithmfwd.h [!_GLIBCXX_HOSTED]: Omit leftover
random_shuffle and stable_partition definition.
* include/bits/stl_algo.h [!_GLIBCXX_HOSTED]: Omit
random_shuffle and stable_partition from freestanding.
* include/bits/ranges_algo.h [!_GLIBCXX_HOSTED]: Omit
stable_partition from freestanding.
* include/bits/concept_check.h: Remove needless HOSTED check.
* include/std/iterator: Include <bits/ranges_base.h>.
* include/std/numeric (__cpp_lib_parallel_algorithms): Do not
define for freestanding.
* include/std/functional (__cpp_lib_boyer_moore_searcher):
Likewise.
* testsuite/lib/prune.exp: Match error for hosted-only libstdc++
tests.
Jonathan Wakely [Tue, 20 Sep 2022 12:30:43 +0000 (13:30 +0100)]
libstdc++: Adjust precompiled headers for freestanding
Co-authored-by: Arsen Arsenović <arsen@aarsen.me>
libstdc++-v3/ChangeLog:
* include/precompiled/extc++.h [!_GLIBCXX_HOSTED]: Do not
include headers that aren't valid for freestanding.
* include/precompiled/stdc++.h [!_GLIBCXX_HOSTED]: Likewise.
Arsen Arsenović [Tue, 27 Sep 2022 10:20:33 +0000 (12:20 +0200)]
libstdc++: Filter out unconditional <stdio.h> default include
_AC_INCLUDES_DEFAULT_REQUIREMENTS including <stdio.h> when checking for
stdint.h has prevented proper detection of whether stdint.h is present,
since it'd poison the cache variables with test results failing due to
<stdio.h> failing to include. As a solution, for autoconf versions under
2.70, we filter out that bit of code from ac_includes_default.
This issue was fixed in autoconf-2.70.
This also applies to various other headers, but was noticed when looking
into why HAVE_STDINT_H was misdefined.
libstdc++-v3/ChangeLog:
* configure.ac: Remove any lines that unconditionally include
<stdio.h> from ac_includes_default, when running Autoconf <2.70.
* configure: Regenerate.
Jonathan Wakely [Tue, 20 Sep 2022 10:57:28 +0000 (11:57 +0100)]
libstdc++: Make _GLIBCXX_HOSTED respect -ffreestanding [PR103626]
This allows the library to switch to freestanding mode when compiling
with the -ffreestanding flag. This means you don't need a separate
libstdc++ build configured with --disable-hosted-libstdcxx in order to
compile for a freestanding environment.
The testsuite support files cannot be compiled for freestanding, so add
-fno-freestanding to override any -ffreestanding in the test flags.
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* acinclude.m4 (GLIBCXX_ENABLE_HOSTED): Define _GLIBCXX_HOSTED
to __STDC_HOSTED__ for non-freestanding installations.
* configure: Regenerate.
* include/Makefile.am (${host_builddir}/c++config.h): Adjust
grep pattern.
* include/Makefile.in: Regenerate.
* testsuite/lib/libstdc++.exp (v3-build_support): Use
-fno-freestanding.
* testsuite/libstdc++-abi/abi.exp: Likewise.
Rainer Orth [Mon, 3 Oct 2022 14:28:46 +0000 (16:28 +0200)]
libsanitizer: Fix Solaris 11.3 compilation of sanitizer_procmaps_solaris.cpp [PR105531]
The latest libsanitizer import broke Solaris 11.3 bootstrap again, due
to an oversight of mine. A fix has been committed upstream
https://reviews.llvm.org/D133556
This patch cherry-picks it. Tested on Solaris 11.3 and 11.4, SPARC and
x86.
2022-09-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
libsanitizer:
PR sanitizer/105531
* sanitizer_common/sanitizer_procmaps_solaris.cpp: Cherry-pick
llvm-project revision
1cd4d63fb9ab0f04c7151911dde0d58b673823de.
Andrew Stubbs [Fri, 2 Oct 2020 14:12:50 +0000 (15:12 +0100)]
vect: while_ult for integer masks
Add a vector length parameter needed by amdgcn without breaking aarch64.
All amdgcn vector masks are DImode, regardless of vector length, so we can't
tell what length is implied simply from the operator mode. (Even if we used
different integer modes there's no mode small enough to differenciate a 2 or
4 lane mask). Without knowing the intended length we end up using a mask with
too many lanes enabled, which leads to undefined behaviour..
The extra operand is not added for vector mask types so AArch64 does not need
to be adjusted.
gcc/ChangeLog:
* config/gcn/gcn-valu.md (while_ultsidi): Limit mask length using
operand 3.
* doc/md.texi (while_ult): Document new operand 3 usage.
* internal-fn.cc (expand_while_optab_fn): Set operand 3 when lhs_type
maps to a non-vector mode.
Andrew MacLeod [Sun, 2 Oct 2022 22:43:35 +0000 (18:43 -0400)]
Don't process undefined range.
No need to continue processing an undefined range.
gcc/
PR tree-optimization/107109
* range-op.cc (adjust_op1_for_overflow): Don't process undefined.
gcc/testsuite/
* gcc.dg/pr107109.c: New.
Christophe Lyon [Mon, 3 Oct 2022 10:26:03 +0000 (12:26 +0200)]
arm: Add missing early clobber to MVE vrev64q_m patterns
Like the non-predicated vrev64q patterns, mve_vrev64q_m_<supf><mode>
and mve_vrev64q_m_f<mode> need an early clobber constraint, otherwise
we can generate an unpredictable instruction:
Warning: 64-bit element size and same destination and source operands makes instruction UNPREDICTABLE
when calling vrevq64_m* with the same first and second arguments.
OK for trunk?
Thanks,
Christophe
gcc/ChangeLog:
* config/arm/mve.md (mve_vrev64q_m_<supf><mode>): Add early
clobber.
(mve_vrev64q_m_f<mode>): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/arm/mve/intrinsics/vrev64q_m_s16-clobber.c: New test.
Joseph Myers [Mon, 3 Oct 2022 13:10:42 +0000 (13:10 +0000)]
c: Adjust LDBL_EPSILON for C2x for IBM long double
C2x changes the <float.h> definition of *_EPSILON to apply only to
normalized numbers. The effect is that LDBL_EPSILON for IBM long
double becomes 0x1p-105L instead of 0x1p-1074L.
There is a reasonable case for considering this a defect fix - it
originated from the issue reporting process (DR#467), though it ended
up being resolved by a paper (N2326) for C2x rather than through the
issue process, and code using *_EPSILON often needs to override the
pre-C2x value of LDBL_EPSILON and use something on the order of
magnitude of the C2x value instead. However, I've followed the
conservative approach of only making the change for C2x and not for
previous standard versions (and not for C++, which doesn't have the
C2x changes in this area).
The testcases added are intended to be valid for all long double
formats. The C11 one is based on
gcc.target/powerpc/rs6000-ldouble-2.c (and when we move to a C2x
default, gcc.target/powerpc/rs6000-ldouble-2.c will need an
appropriate option added to keep using an older language version).
Tested with no regressions for cross to powerpc-linux-gnu.
gcc/c-family/
* c-cppbuiltin.cc (builtin_define_float_constants): Do not
special-case __*_EPSILON__ setting for IBM long double for C2x.
gcc/testsuite/
* gcc.dg/c11-float-7.c, gcc.dg/c2x-float-12.c: New tests.
Jonathan Wakely [Mon, 3 Oct 2022 11:10:07 +0000 (12:10 +0100)]
libstdc++: Fix tests broken by C++23 P2266R3 "Simpler implicit move"
In C++23 mode these tests started to FAIL because an rvalue reference
parameter can no longer be bound to an lvalue reference return type. As
confirmed by Ville (who added these tests) the problem overloads are not
intended to be called, and only exist to verify that they don't
interfere with the intended behaviour. This changes the function bodies
to just throw, so that the tests will fail if the function is called.
libstdc++-v3/ChangeLog:
* testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
Change body of unused operator<< overload to throw if called.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
Likewise.
Aldy Hernandez [Sun, 2 Oct 2022 08:46:47 +0000 (10:46 +0200)]
Do not pessimize range in set_nonzero_bits.
Currently if we have a range of [0,0] and we set the nonzero bits to
1, the current code pessimizes the range to [0,1] because it assumes
the range is [1,1] plus the possibility of 0. This fixes the
oversight.
gcc/ChangeLog:
* value-range.cc (irange::set_nonzero_bits): Do not pessimize range.
(range_tests_nonzero_bits): New test.
Aldy Hernandez [Sat, 1 Oct 2022 20:31:34 +0000 (22:31 +0200)]
Avoid comparing ranges when sub-ranges is 0.
There is nothing else to compare when the number of sub-ranges is 0.
gcc/ChangeLog:
* value-range.cc (irange::operator==): Early bail on m_num_ranges
equal to 0.
Aldy Hernandez [Sat, 1 Oct 2022 20:25:52 +0000 (22:25 +0200)]
Do not compare nonzero masks for varying.
There is no need to compare nonzero masks when comparing two VARYING
ranges, as they are always the same when range types are the same.
gcc/ChangeLog:
* value-range.cc (irange::legacy_equal_p): Remove nonozero mask
check when comparing VR_VARYING ranges.
Aldy Hernandez [Sat, 1 Oct 2022 20:20:49 +0000 (22:20 +0200)]
Do not compare incompatible ranges in ipa-prop.
gcc/ChangeLog:
* ipa-prop.cc (struct ipa_vr_ggc_hash_traits): Do not compare
incompatible ranges in ipa-prop.
Francois-Xavier Coudert [Mon, 3 Oct 2022 07:24:10 +0000 (09:24 +0200)]
Fortran: fix testcases
Remove unreliable test for IEEE_FMA(), which fails on powerpc.
Adjust stop codes for modes_1.f90.
2022-10-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
gcc/testsuite/
PR fortran/107062
* gfortran.dg/ieee/fma_1.f90: Fix test.
* gfortran.dg/ieee/modes_1.f90: Fix test.
François Dumont [Mon, 26 Sep 2022 17:14:54 +0000 (19:14 +0200)]
libstdc++: Fix gdb pretty printers when dealing with std::string
Since revision
33b43b0d8cd2de722d177ef823930500948a7487 std::string and other
similar typedef are ambiguous from a gdb point of view because it matches both
std::basic_string<char> and std::__cxx11::basic_string<char> symbols. For those
typedef add a workaround to accept the substitution as long as the same regardless
of __cxx11 namespace.
Also avoid to register printers for types in std::__cxx11::__8:: namespace, there is
no such symbols.
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (Printer.add_version): Do not add version
namespace for __cxx11 symbols.
(add_one_template_type_printer): Likewise.
(add_one_type_printer): Likewise.
(FilteringTypePrinter._recognizer.recognize): Add a workaround for std::string & al
ambiguous typedef matching both std:: and std::__cxx11:: symbols.
* testsuite/libstdc++-prettyprinters/cxx17.cc: Remove obsolete
\#define _GLIBCXX_USE_CXX11_ABI 0.
* testsuite/libstdc++-prettyprinters/simple.cc: Likewise. Adapt test to accept
std::__cxx11::list.
* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.
* testsuite/libstdc++-prettyprinters/80276.cc: Likewise and remove xfail for c++20
and debug mode.
* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
GCC Administrator [Mon, 3 Oct 2022 00:17:44 +0000 (00:17 +0000)]
Daily bump.
Jakub Jelinek [Sun, 2 Oct 2022 14:42:32 +0000 (16:42 +0200)]
tree-cfg: Fix a verification diagnostic typo [PR107121]
Obvious typo in diagnostics.
2022-10-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/107121
* tree-cfg.cc (verify_gimple_call): Fix a typo in diagnostics,
DEFFERED_INIT -> DEFERRED_INIT.
Olivier Hainque [Mon, 7 Mar 2022 10:55:29 +0000 (10:55 +0000)]
Adjust LIBGCC2_INCLUDES for VxWorks and augment comment
Investigating the reasons for libgcc build failures in a canadian
context, orthogonally to the recent update of vxcrtstuff, exposed
interesting differences in the way include search paths are managed
between a regular Linux->VxWorks cross build and a canadian setup
building a Windows->VxWorks toolchain in a Linux environment.
This change augments the comment attached to LIBGCC2_INCLUDE in
libgcc/config/t-vxworks to better describe the parameters at play.
It also adjusts the addition of options for gcc/include and
gcc/include-fixed to minimize the actual differences for libgcc
in the two kinds of configurations.
2022-03-06 Olivier Hainque <hainque@adacore.com>
libgcc/
* config/t-vxworks (LIBGCC2_INCLUDE): Augment comment. Move
-I options for gcc/include and gcc/include-fixed at the end
and make them -isystem.
Marc Poulhiès [Tue, 4 Jan 2022 14:56:27 +0000 (14:56 +0000)]
Define GCC_DRIVER_HOST_INITIALIZATION for VxWorks targets
We need to perform static links by default on VxWorks, where the use
of shared libraries involves unusual steps compared to standard native
systems.
This has to be conveyed before the lang_specific_driver code gets
invoked (in particular for g++), so specs aren't available.
This change defines the GCC_DRIVER_HOST_INITIALIZATION macro for
VxWorks, to insert a -static option in case the user hasn't provided any
explicit indication on the command line of the kind of link desired.
While a HOST macro doesn't seem appropriate to control a target OS
driven behavior, this matches other uses and won't conflict as VxWorks
is not supported on any of the other configurations using this macro.
gcc/
* config/vxworks-driver.cc: New.
* config.gcc (*vxworks*): Add vxworks-driver.o in extra_gcc_objs.
* config/t-vxworks: Add vxworks-driver.o.
* config/vxworks.h (GCC_DRIVER_HOST_INITIALIZATION): New.
Olivier Hainque [Thu, 3 Feb 2022 15:57:32 +0000 (15:57 +0000)]
Prevent secondary warning from diagnostic tweak in gthr-vxworks.h
Within gthr-vxworks.h, we prevent C++ errors from missing
declarations in some system headers by prepending their inclusion
with a
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
But Wstrict-prototypes is internally registered as valid for
C/ObjC only, not C++, and this trick in turn triggers a Wpragma
warning with -Wsystem-headers.
This change just arranges to ignore the secondary warning locally.
2021-02-03 Olivier Hainque <hainque@adacore.com>
* config/gthr-vxworks.h: Prevent Wpragma warning for the
pragma diagnostics on Wstrict-prototypes.
Olivier Hainque [Thu, 10 Mar 2022 11:02:11 +0000 (11:02 +0000)]
Refine guard for vxworks crtstuff spec
Working on the reintroduction of shared libraries support
(and of modules depending on shared libraries) exposed a few
test failures of simple c++ constructor tests on arm-vxworks7r2.
Investigation revealed that we were not linking the
crtstuff objects as needed from a compiler configured not to
have shared libs support, because of the ENABLE_SHARED_LIBGCC
guard in this piece of vxworks.h:
/* Setup the crtstuff begin/end we might need for dwarf EH registration
and/or INITFINI_ARRAY support for shared libs. */
#if (HAVE_INITFINI_ARRAY_SUPPORT && defined(ENABLE_SHARED_LIBGCC)) \
|| (DWARF2_UNWIND_INFO && !defined(CONFIG_SJLJ_EXCEPTIONS))
#define VX_CRTBEGIN_SPEC "%{!shared:vx_crtbegin.o%s;:vx_crtbeginS.o%s}"
crtstuff initfini array support is meant to be leveraged for
constructors regardless of whether the compiler also happens to be
configured with shared library support, so the guard on ENABLE_SHARED_LIBGCC
here is inappropriate.
This change just removes it,
2022-09-30 Olivier Hainque <hainque@adacore.com>
gcc/
* config/vxworks.h (VX_CRTBEGIN_SPEC, VX_CRTEND_SPEC): If
HAVE_INITFINI_ARRAY_SUPPORT, pick crtstuff objects regardless
of ENABLE_SHARED_LIBGCC.
GCC Administrator [Sun, 2 Oct 2022 00:18:17 +0000 (00:18 +0000)]
Daily bump.
José Rui Faustino de Sousa [Sun, 25 Sep 2022 20:48:55 +0000 (22:48 +0200)]
Fortran: Fix ICE and wrong code for assumed-rank arrays [PR100029, PR100040]
gcc/fortran/ChangeLog:
PR fortran/100040
PR fortran/100029
* trans-expr.cc (gfc_conv_class_to_class): Add code to have
assumed-rank arrays recognized as full arrays and fix the type
of the array assignment.
(gfc_conv_procedure_call): Change order of code blocks such that
the free of ALLOCATABLE dummy arguments with INTENT(OUT) occurs
first.
gcc/testsuite/ChangeLog:
PR fortran/100029
* gfortran.dg/PR100029.f90: New test.
PR fortran/100040
* gfortran.dg/PR100040.f90: New test.
Patrick Palka [Sat, 1 Oct 2022 16:21:36 +0000 (12:21 -0400)]
c++: make some cp_trait_kind switch statements exhaustive
This replaces the unreachable default case in some cp_trait_kind
switches with an exhaustive listing of the trait codes that we don't
expect to see, so that when adding a new trait we'll get a helpful
-Wswitch warning if we forget to handle the new trait in a relevant
switch.
gcc/cp/ChangeLog:
* semantics.cc (trait_expr_value): Make cp_trait_kind switch
statement exhaustive.
(finish_trait_expr): Likewise.
(finish_trait_type): Likewise.
Stafford Horne [Thu, 29 Sep 2022 14:32:39 +0000 (15:32 +0100)]
or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLS
This was found when testing buildroot with linuxthreads enabled. In
this case, the build passes --disable-tls to the toolchain during
configuration. After building the OpenRISC toolchain it was still
generating TLS code sequences and causing linker failures such as:
..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl
..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr'
This patch fixes this by disabling tls for the OpenRISC target when requested
via --disable-tls.
gcc/ChangeLog:
* config/or1k/or1k.cc (TARGET_HAVE_TLS): Only define if
HAVE_AS_TLS is defined.
Tested-by: Yann E. MORIN <yann.morin@orange.com>
Julian Brown [Fri, 30 Sep 2022 17:30:58 +0000 (17:30 +0000)]
OpenACC: Fix struct-component-kind-1.c test
This patch is a minimal fix for the recently-added
struct-component-kind-1.c test (which is currently failing to emit one
of the errors it expects in scan output). This fragment was erroneously
omitted from the second version of the patch posted previously:
https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602504.html
2022-10-01 Julian Brown <julian@codesourcery.com>
gcc/
* gimplify.cc (omp_group_base): Fix IF_PRESENT (no_create)
handling.
Jeff Law [Sat, 1 Oct 2022 04:42:15 +0000 (00:42 -0400)]
Improve Z flag handling on H8
This patch improves handling of the Z bit in the status register in a
variety of ways to improve either the code size or code speed on various
H8 subtargets.
For example, we can test the zero/nonzero status of the upper byte of a
16 bit register using mov.b, we can move the Z or an inverted Z into a
QImode register profitably on some subtargets. We can move Z or an
inverted Z into the sign bit on the H8/SX profitably, etc.
gcc/
* config/h8300/h8300.md (HSI2): New iterator.
(eqne_invert): Similarly.
* config/h8300/testcompare.md (testhi_upper_z): New pattern.
(cmpqi_z, cmphi_z, cmpsi_z): Likewise.
(store_z_qi, store_z_i_qi, store_z_hi, store_z_hi_sb): New
define_insn_and_splits and/or define_insns.
(store_z_hi_neg, store_z_hi_and, store_z_<mode>): Likewise.
(store_z_<mode>_neg, store_z_<mode>_and, store_z): Likewise.
Jason Merrill [Tue, 20 Sep 2022 20:06:26 +0000 (16:06 -0400)]
c++: loop through array CONSTRUCTOR
I noticed that we were ignoring all the special rules for when to use a
simple INIT_EXPR for array initialization from a CONSTRUCTOR, because
split_nonconstant_init_1 was also passing 1 to the from_array parameter.
Arguably that's the real bug, but I think we can be flexible.
The test that I noticed this with no longer fails without it.
gcc/cp/ChangeLog:
* init.cc (build_vec_init): Clear from_array for CONSTRUCTOR
initializer.
Jason Merrill [Mon, 19 Sep 2022 17:17:41 +0000 (19:17 +0200)]
c++: cast split_nonconstant_init return val to void
We were already converting the result of expand_vec_init_expr to void; we
need to do the same for split_nonconstant_init.
The test that I noticed this with no longer fails without it.
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_genericize_init): Also convert the result of
split_nonconstant_init to void.
Jeff Law [Sat, 1 Oct 2022 00:46:04 +0000 (20:46 -0400)]
Install correct patch version.
gcc/
* tree-ssa-dom.cc (record_edge_info): Install correct version of
patch.
Eugene Rozenfeld [Thu, 21 Apr 2022 23:17:52 +0000 (16:17 -0700)]
Emit discriminators for inlined call sites.
This change is based on commit
9fa26998a63d4b22b637ed8702520819e408a694
by Dehao Chen in vendors/google/heads/gcc-4_8.
Tested on x86_64-pc-linux-gnu.
gcc/ChangeLog:
* dwarf2out.cc (add_call_src_coords_attributes): Emit discriminators for inlined call sites.
GCC Administrator [Sat, 1 Oct 2022 00:18:00 +0000 (00:18 +0000)]
Daily bump.
Jeff Law [Fri, 30 Sep 2022 23:26:31 +0000 (19:26 -0400)]
More gimple const/copy propagation opportunities
While investigating a benchmark for optimization opportunities I came across single block loop which either iterates precisely once or forever. This is an interesting scenario as we can ignore the infinite looping path and treat any PHI nodes as degenerates. So more concretely let's consider this trivial testcase:
volatile void abort (void);
void
foo(int a)
{
int b = 0;
while (1)
{
if (!a)
break;
b = 1;
}
if (b != 0)
abort ();
}
Quick analysis shows that b's initial value is 0 and its value only changes if we enter an infinite loop. So if we get to the test b != 0, the only possible value b could have would be 0 and the test and its true arm can be eliminated.
The DOM3 dump looks something like this:
;; basic block 2, loop depth 0, count
118111600 (estimated locally), maybe hot
;; prev block 0, next block 3, flags: (NEW, VISITED)
;; pred: ENTRY [always] count:
118111600 (estimated locally) (FALLTHRU,EXECUTABLE)
;; succ: 3 [always] count:
118111600 (estimated locally) (FALLTHRU,EXECUTABLE)
;; basic block 3, loop depth 1, count
1073741824 (estimated locally), maybe hot
;; prev block 2, next block 4, flags: (NEW, VISITED)
;; pred: 2 [always] count:
118111600 (estimated locally) (FALLTHRU,EXECUTABLE)
;; 3 [89.0% (guessed)] count:
955630224 (estimated locally) (FALSE_VALUE,EXECUTABLE)
# b_1 = PHI <0(2), 1(3)>
if (a_3(D) == 0)
goto <bb 4>; [11.00%]
else
goto <bb 3>; [89.00%]
;; succ: 4 [11.0% (guessed)] count:
118111600 (estimated locally) (TRUE_VALUE,EXECUTABLE)
;; 3 [89.0% (guessed)] count:
955630224 (estimated locally) (FALSE_VALUE,EXECUTABLE)
;; basic block 4, loop depth 0, count
118111600 (estimated locally), maybe hot
;; prev block 3, next block 5, flags: (NEW, VISITED)
;; pred: 3 [11.0% (guessed)] count:
118111600 (estimated locally) (TRUE_VALUE,EXECUTABLE)
if (b_1 != 0)
goto <bb 5>; [0.00%]
else
goto <bb 6>; [100.00%]
;; succ: 5 [never] count:0 (precise) (TRUE_VALUE,EXECUTABLE)
;; 6 [always] count:
118111600 (estimated locally) (FALSE_VALUE,EXECUTABLE)
This is a good representative of what the benchmark code looks like.
The primary effect we want to capture is to realize that the test if (b_1 != 0) is always false and optimize it accordingly.
In the benchmark, this opportunity is well hidden until after the loop optimizers have completed, so the first chance to capture this case is in DOM3. Furthermore, DOM wants loops normalized with latch blocks/edges. So instead of bb3 looping back to itself, there's an intermediate empty block during DOM.
I originally thought this was likely to only affect the benchmark. But when I instrumented the optimization and bootstrapped GCC, much to my surprise there were several hundred similar cases identified in GCC itself. So it's not as benchmark specific as I'd initially feared.
Anyway, detecting this in DOM is pretty simple. We detect the infinite loop, including the latch block. Once we've done that, we walk the PHI nodes and attach equivalences to the appropriate outgoing edge. That's all we need to do as the rest of DOM is already prepared to handle equivalences on edges.
gcc/
* tree-ssa-dom.cc (single_block_loop_p): New function.
(record_edge_info): Also record equivalences for the outgoing
edge of a single block loop where the condition is an invariant.
gcc/testsuite/
* gcc.dg/infinite-loop.c: New test.
Jeff Law [Fri, 30 Sep 2022 22:59:24 +0000 (18:59 -0400)]
Minor cleanup/prep in DOM
It's a bit weird that free_dom_edge_info leaves a dangling pointer in e->aux.
Not sure what I was thinking.
There's two callers. One wipes e->aux immediately after the call, the other
attaches a newly created object immediately after the call. So we can wipe
e->aux within the call and simplify one of the two call sites.
This is preparatory work for a minor optimization where we want to detect
another class of edge equivalences in DOM (until something better is available)
and either attach them an existing edge_info structure or create a new one if
one doesn't currently exist for a given edge.
gcc/
* tree-ssa-dom.cc (free_dom_edge_info): Clear e->aux too.
(free_all_edge_infos): Do not clear e->aux here.
H.J. Lu [Fri, 30 Sep 2022 22:51:18 +0000 (15:51 -0700)]
Document -fexcess-precision=16 in target.def
* target.def (TARGET_C_EXCESS_PRECISION): Document
-fexcess-precision=16.
Palmer Dabbelt [Fri, 9 Sep 2022 09:46:40 +0000 (02:46 -0700)]
Document -fexcess-precision=16 in tm.texi
I just happened to stuble on this one while trying to sort out the
RISC-V bits.
gcc/ChangeLog
* doc/tm.texi (TARGET_C_EXCESS_PRECISION): Add 16.
Palmer Dabbelt [Fri, 9 Sep 2022 09:43:26 +0000 (02:43 -0700)]
RISC-V: Support -fexcess-precision=16
This fixes
f19a327077e ("Support -fexcess-precision=16 which will enable
FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 when backend supports _Float16.") on
RISC-V targets.
gcc/ChangeLog
PR target/106815
* config/riscv/riscv.cc (riscv_excess_precision): Add support
for EXCESS_PRECISION_TYPE_FLOAT16.
Jonathan Wakely [Fri, 30 Sep 2022 14:54:19 +0000 (15:54 +0100)]
libstdc++: Remove <sstream> dependency from std::bitset::to_ulong() test
There's no need to use a stringstream to test the to_ulong() member.
This will allow the test to be used in freestanding mode.
libstdc++-v3/ChangeLog:
* testsuite/20_util/bitset/access/to_ulong.cc: Construct bitset
from binary literal instead of using stringstream.
Jonathan Wakely [Fri, 30 Sep 2022 16:06:15 +0000 (17:06 +0100)]
libstdc++: Optimize operator>> for std::bitset
We can improve performance by using a char buffer instead of
basic_string. The loop bound already means we can't overflow the buffer,
and we don't need to keep writing a null character after every character
written to the buffer.
We could just use basic_string::resize(N) to zero-init the whole string,
then overwrite those chars. But that zero-init of all N chars would be
wasted in the case where we are writing to a bitset<N> with large N, but
only end up extracting one or two chars from the stream.
With this change we just use buffer of uninitialized chars. For a
small-ish bitset (currently <= 256) we can improve performance further
by using alloca instead of the heap.
libstdc++-v3/ChangeLog:
* include/std/bitset (operator>>): Use a simple buffer instead
of std::basic_string.
Jonathan Wakely [Fri, 30 Sep 2022 13:57:24 +0000 (14:57 +0100)]
libstdc++: Remove non-standard public members in std::bitset
This makes _M_copy_from_ptr, _M_copy_from_string and _M_copy_to_string
private, and declares operator<< and operator>> as friends.
Also remove the historical _M_copy_from_string and _M_copy_to_string
overloads. Those were used before DR 396 was implemented but are
not needed now. There are no tests or docs describing them, so I don't
think we intend to support them as extensions.
libstdc++-v3/ChangeLog:
* include/std/bitset (_M_copy_from_ptr, _M_copy_from_string)
(_M_copy_to_string): Change access to private.
(_M_copy_from_string(const basic_string&, size_t, size_t)):
Remove.
(_M_copy_to_string(const basic_string&)): Remove.
Jonathan Wakely [Fri, 30 Sep 2022 18:10:29 +0000 (19:10 +0100)]
libstdc++: Fix broken dg-prune-output
The new pattern in the dg-prune-output directive doesn't work. Instead
of a messy regex full of leaning toothpicks, just match on the
diagnostic text instead of the header paths.
libstdc++-v3/ChangeLog:
* testsuite/20_util/bind/ref_neg.cc: Fix dg-prune-output
directive.
Jakub Jelinek [Fri, 30 Sep 2022 19:54:08 +0000 (21:54 +0200)]
arm, csky: Fix C++ ICEs with _Float16 and __fp16 [PR107080]
On Fri, Sep 30, 2022 at 09:54:49AM -0400, Jason Merrill wrote:
> > Note, there is one further problem on aarch64/arm, types with HFmode
> > (_Float16 and __fp16) are there mangled as Dh (which is standard
> > Itanium mangling:
> > ::= Dh # IEEE 754r half-precision floating point (16 bits)
> > ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
> > so in theory is also ok, but DF16_ is more specific. Should we just
> > change Dh to DF16_ in those backends, or should __fp16 there be distinct
> > type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ?
>
> You argued for keeping __float128 separate from _Float128, does the same
> argument not apply to this case?
Actually, they already were distinct types that just mangled the same.
So the same issue that had to be solved on i?86, ia64 and rs6000 for
_Float64x vs. long double is a problem on arm and aarch64 with _Float16
vs. __fp16.
The following patch fixes it for arm after aarch64 has been changed
already before.
> > And there is csky, which mangles __fp16 (but only if type's name is __fp16,
> > not _Float16) as __fp16, that looks clearly invalid to me as it isn't
> > valid in the mangling grammar. So perhaps just nuke csky's mangle_type
> > and have it mangled as DF16_ by the generic code?
And seems even on csky __fp16 is distinct type from _Float16 (which is a
good thing for consistency, these 3 targets are the only ones that have
__fp16 type), so instead the patch handles it the same as on arm/aarch64,
Dh mangling for __fp16 and DF16_ for _Float16.
2022-09-30 Jakub Jelinek <jakub@redhat.com>
PR c++/107080
* config/arm/arm.cc (arm_mangle_type): Mangle just __fp16 as Dh
and _Float16 as DF16_.
* config/csky/csky.cc (csky_init_builtins): Fix a comment typo.
(csky_mangle_type): Mangle __fp16 as Dh and _Float16 as DF16_
rather than mangling __fp16 as __fp16.
* g++.target/arm/pr107080.C: New test.
Lewis Hyatt [Fri, 30 Sep 2022 18:10:00 +0000 (14:10 -0400)]
diagnostics: Fix virtual location for -Wuninitialized [PR69543]
Warnings issued for -Wuninitialized have been using the spelling location of
the problematic usage, discarding any information on the location of the macro
expansion point if such usage was in a macro. This makes the warnings
impossible to control reliably with #pragma GCC diagnostic, and also discards
useful context in the diagnostic output. There seems to be no need to discard
the virtual location information, so this patch fixes that.
PR69543 was mostly about _Pragma issues which have been fixed for many years
now. The PR remains open because two of the testcases added in response to it
still have xfails, but those xfails have nothing to do with _Pragma and rather
just with the issue fixed by this patch, so the PR can be closed now as well.
The other testcase modified here, pragma-diagnostic-2.c, was explicitly
testing for the undesirable behavior that was xfailed in pr69543-3.c. I have
adjusted that and also added a new testcase verifying all 3 types of warning
that come from tree-ssa-uninit.cc get the proper location information now.
gcc/ChangeLog:
PR preprocessor/69543
* tree-ssa-uninit.cc (warn_uninit): Stop stripping macro tracking
information away from the diagnostic location.
(maybe_warn_read_write_only): Likewise.
(maybe_warn_operand): Likewise.
gcc/testsuite/ChangeLog:
PR preprocessor/69543
* c-c++-common/pr69543-3.c: Remove xfail.
* c-c++-common/pr69543-4.c: Likewise.
* gcc.dg/cpp/pragma-diagnostic-2.c: Adjust test for new behavior.
* c-c++-common/pragma-diag-16.c: New test.
Jakub Jelinek [Fri, 30 Sep 2022 17:52:49 +0000 (19:52 +0200)]
aarch64: Fix C++ ICEs with _Float16 and __fp16 [PR107080]
On Fri, Sep 30, 2022 at 09:54:49AM -0400, Jason Merrill wrote:
> > Note, there is one further problem on aarch64/arm, types with HFmode
> > (_Float16 and __fp16) are there mangled as Dh (which is standard
> > Itanium mangling:
> > ::= Dh # IEEE 754r half-precision floating point (16 bits)
> > ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
> > so in theory is also ok, but DF16_ is more specific. Should we just
> > change Dh to DF16_ in those backends, or should __fp16 there be distinct
> > type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ?
>
> You argued for keeping __float128 separate from _Float128, does the same
> argument not apply to this case?
Actually, they already were distinct types that just mangled the same.
So the same issue that had to be solved on i?86, ia64 and rs6000 for
_Float64x vs. long double is a problem on arm and aarch64 with _Float16
vs. __fp16.
The following patch fixes it so far for aarch64.
2022-09-30 Jakub Jelinek <jakub@redhat.com>
PR c++/107080
* config/aarch64/aarch64.cc (aarch64_mangle_type): Mangle just __fp16
as Dh and _Float16 as DF16_.
* g++.target/aarch64/pr107080.C: New test.
Jakub Jelinek [Fri, 30 Sep 2022 16:40:35 +0000 (18:40 +0200)]
i386, rs6000, ia64, s390: Fix C++ ICEs with _Float64x or _Float128 [PR107080]
The following testcase ICEs on x86 as well as ppc64le (the latter
with -mabi=ieeelongdouble), because _Float64x there isn't mangled as
DF64x but e or u9__ieee128 instead.
Those are the mangling that should be used for the non-standard
types with the same mode or for long double, but not for _Float64x.
All the 4 mangle_type targhook implementations start with
type = TYPE_MAIN_VARIANT (type);
so I think it is cleanest to handle it the same in all and return NULL
before the switches on mode or whatever other tests.
s390 doesn't actually have a bug, but while I was there, having
type = TYPE_MAIN_VARIANT (type);
if (TYPE_MAIN_VARIANT (type) == long_double_type_node)
looked useless to me.
Note, there is one further problem on aarch64/arm, types with HFmode
(_Float16 and __fp16) are there mangled as Dh (which is standard
Itanium mangling:
::= Dh # IEEE 754r half-precision floating point (16 bits)
::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
so in theory is also ok, but DF16_ is more specific. Should we just
change Dh to DF16_ in those backends, or should __fp16 there be distinct
type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ?
And there is csky, which mangles __fp16 (but only if type's name is __fp16,
not _Float16) as __fp16, that looks clearly invalid to me as it isn't
valid in the mangling grammar. So perhaps just nuke csky's mangle_type
and have it mangled as DF16_ by the generic code?
2022-09-30 Jakub Jelinek <jakub@redhat.com>
PR c++/107080
* config/i386/i386.cc (ix86_mangle_type): Always return NULL
for float128_type_node or float64x_type_node, don't check
float128t_type_node later on.
* config/ia64/ia64.cc (ia64_mangle_type): Always return NULL
for float128_type_node or float64x_type_node.
* config/rs6000/rs6000.cc (rs6000_mangle_type): Likewise.
Don't check float128_type_node later on.
* config/s390/s390.cc (s390_mangle_type): Don't use
TYPE_MAIN_VARIANT on type which was set to TYPE_MAIN_VARIANT
a few lines earlier.
* g++.dg/cpp23/ext-floating11.C: New test.
Torbjörn SVENSSON [Fri, 30 Sep 2022 14:33:24 +0000 (16:33 +0200)]
testsuite: Windows paths use \ and not /
libstdc++-v3/ChangeLog:
* testsuite/20_util/bind/ref_neg.cc: Prune Windows paths too.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Torbjörn SVENSSON [Fri, 16 Sep 2022 17:49:01 +0000 (19:49 +0200)]
testsuite: Only run test on target if VMA == LMA
Checking that the triplet matches arm*-*-eabi (or msp430-*-*) is not
enough to know if the execution will enter an endless loop, or if it
will give a meaningful result. As the execution test only work when
VMA and LMA are equal, make sure that this condition is met.
gcc/ChangeLog:
* doc/sourcebuild.texi: Document new vma_equals_lma effective
target check.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_effective_target_vma_equals_lma): New.
* c-c++-common/torture/attr-noinit-1.c: Requre VMA == LMA to run.
* c-c++-common/torture/attr-noinit-2.c: Likewise.
* c-c++-common/torture/attr-noinit-3.c: Likewise.
* c-c++-common/torture/attr-persistent-1.c: Likewise.
* c-c++-common/torture/attr-persistent-3.c: Likewise.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Torbjörn SVENSSON [Mon, 19 Sep 2022 16:52:50 +0000 (18:52 +0200)]
testsuite: Do not prefix linker script with "-Wl,"
The linker script should not be prefixed with "-Wl," - it's not an
input file and does not interfere with the new dump output filename
strategy.
gcc/testsuite/ChangeLog:
* lib/gcc-defs.exp: Do not prefix linker script with "-Wl,".
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Jiawei [Thu, 8 Sep 2022 01:50:49 +0000 (09:50 +0800)]
RISC-V: Add '-m[no]-csr-check' option in gcc.
Add -m[no]-csr-check option in gcc part, when enable -mcsr-check option,
it will add csr-check in .option section and pass this to assembler.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_file_start): New .option.
* config/riscv/riscv.opt: New options.
* doc/invoke.texi: New definations.
Patrick Palka [Fri, 30 Sep 2022 15:06:54 +0000 (11:06 -0400)]
c++: streamline built-in trait addition process
Adding a new built-in trait currently involves manual boilerplate
consisting of defining an rid enumerator for the identifier as well as a
corresponding cp_trait_kind enumerator and handling them in various switch
statements, the exact set of which depends on whether the proposed trait
yields (and thus is recognized as) a type or an expression.
To streamline the process, this patch adds a central cp-trait.def file
that tabulates the essential details about each built-in trait (whether
it yields a type or an expression, its code, its spelling and its arity)
and uses this file to automate away the manual boilerplate. It also
migrates all the existing C++-specific built-in traits to use this
approach.
After this change, adding a new built-in trait just entails declaring
it in cp-trait.def and defining its behavior in finish_trait_expr/type
(and handling it in diagnose_trait_expr, if it's an expression-yielding
trait).
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Use cp/cp-trait.def to handle
C++ traits.
* c-common.h (enum rid): Likewise.
gcc/cp/ChangeLog:
* constraint.cc (diagnose_trait_expr): Likewise.
* cp-objcp-common.cc (names_builtin_p): Likewise.
* cp-tree.h (enum cp_trait_kind): Likewise.
* cxx-pretty-print.cc (pp_cxx_trait): Likewise.
* parser.cc (cp_keyword_starts_decl_specifier_p): Likewise.
(cp_parser_primary_expression): Likewise.
(cp_parser_trait): Likewise.
(cp_parser_simple_type_specifier): Likewise.
* cp-trait.def: New file.
Torbjörn SVENSSON [Fri, 30 Sep 2022 08:09:31 +0000 (10:09 +0200)]
testsuite: Colon is reserved on Windows
The ':' is reserved in filenames on Windows.
Without this patch, the test case failes with:
.../ben-1_a.C:4:8: error: failed to write compiled module: Invalid argument
.../ben-1_a.C:4:8: note: compiled module file is 'partitions/module:import.mod'
gcc/testsuite:
* g++.dg/modules/ben-1.map: Replace the colon with dash.
* g++.dg/modules/ben-1_a.C: Likewise
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Arsen Arsenović [Thu, 22 Sep 2022 18:48:25 +0000 (20:48 +0200)]
libstdc++: Add missing <bits/stl_algobase.h> include to <bitset>
libstdc++-v3/ChangeLog:
* include/std/bitset: Include <bits/stl_algobase.h>.
Kewen Lin [Fri, 30 Sep 2022 12:16:49 +0000 (07:16 -0500)]
rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]
As PR99888 and its related show, the current support for
-fpatchable-function-entry on powerpc ELFv2 doesn't work
well with global entry existence. For example, with one
command line option -fpatchable-function-entry=3,2, it got
below w/o this patch:
.LPFE1:
nop
nop
.type foo, @function
foo:
nop
.LFB0:
.cfi_startproc
.LCF0:
0: addis 2,12,.TOC.-.LCF0@ha
addi 2,2,.TOC.-.LCF0@l
.localentry foo,.-foo
, the assembly is unexpected since the patched nops have
no effects when being entered from local entry.
This patch is to update the nops patched before and after
local entry, it looks like:
.type foo, @function
foo:
.LFB0:
.cfi_startproc
.LCF0:
0: addis 2,12,.TOC.-.LCF0@ha
addi 2,2,.TOC.-.LCF0@l
nop
nop
.localentry foo,.-foo
nop
PR target/99888
PR target/105649
gcc/ChangeLog:
* doc/invoke.texi (option -fpatchable-function-entry): Adjust the
documentation for PowerPC ELFv2 ABI dual entry points.
* config/rs6000/rs6000-internal.h
(rs6000_print_patchable_function_entry): New function declaration.
* config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue):
Support patchable-function-entry by emitting nops before and after
local entry for the function that needs global entry.
* config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry): Skip
the function that needs global entry till global entry has been
emitted.
* config/rs6000/rs6000.h (struct machine_function): New bool member
global_entry_emitted.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr99888-1.c: New test.
* gcc.target/powerpc/pr99888-2.c: New test.
* gcc.target/powerpc/pr99888-3.c: New test.
* gcc.target/powerpc/pr99888-4.c: New test.
* gcc.target/powerpc/pr99888-5.c: New test.
* gcc.target/powerpc/pr99888-6.c: New test.
* c-c++-common/patchable_function_entry-default.c: Adjust for
powerpc_elfv2 to avoid compilation error.
Kewen Lin [Fri, 30 Sep 2022 12:16:36 +0000 (07:16 -0500)]
rs6000/test: Adjust pr104992.c with vect_int_mod [PR106516]
As PR106516 shows, we can get unexpected gimple outputs for
function thud on some target which supports modulus operation
for vector int. This patch introduces one effective target
vect_int_mod for it, then adjusts the test case with it.
PR testsuite/106516
gcc/testsuite/ChangeLog:
* gcc.dg/pr104992.c: Adjust with vect_int_mod.
* lib/target-supports.exp (check_effective_target_vect_int_mod): New
effective target.
Christophe Lyon [Thu, 29 Sep 2022 13:34:11 +0000 (15:34 +0200)]
testsuite: [arm] Relax expected register names in MVE tests
These two tests have hardcoded q0 as destination/source of load/store
instructions, but this register is actually used only under
-mfloat-abi=hard. When using -mfloat-abi=softfp, other registers
(eg. q3) can be used to transfer function arguments from core
registers to MVE registers, making the expected regexp fail.
This small patch replaces q0 with q[0-7] to accept any 'q' register.
In several places where we had q[0-9]+, replace it with q[0-7] as MVE
only has q0-q7 registers.
OK for trunk?
gcc/testsuite/ChangeLog:
* gcc.target/arm/mve/mve_load_memory_modes.c: Update expected
registers.
* gcc.target/arm/mve/mve_store_memory_modes.c: Likewise.
Richard Biener [Fri, 30 Sep 2022 10:47:22 +0000 (12:47 +0200)]
tree-optimization/107095 - fix typo in .MASK_STORE DSE handling
We were using the size of the mask argument rather than the data
argument for the ao_ref.
PR tree-optimization/107095
* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Use data arg
for .MASK_STORE size.
Tobias Burnus [Fri, 30 Sep 2022 11:27:32 +0000 (13:27 +0200)]
Fortran: Update use_device_ptr for OpenMP 5.1 [PR105318]
OpenMP 5.1 added has_device_addr and relaxed the restrictions for
use_device_ptr, including processing non-type(c_ptr) arguments as
if has_device_addr was used. (There is a semantic difference.)
For completeness, the likewise change was done for 'use_device_ptr',
where non-type(c_ptr) arguments now use use_device_addr.
Finally, a warning for 'device(omp_{initial,invalid}_device)' was
silenced on the way as affecting the new testcase.
PR fortran/105318
gcc/fortran/ChangeLog:
* openmp.cc (resolve_omp_clauses): Update is_device_ptr restrictions
for OpenMP 5.1 and map to has_device_addr where applicable; map
use_device_ptr to use_device_addr where applicable.
Silence integer-range warning for device(omp_{initial,invalid}_device).
libgomp/ChangeLog:
* testsuite/libgomp.fortran/is_device_ptr-2.f90: New test.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/is_device_ptr-1.f90: Remove dg-error.
* gfortran.dg/gomp/is_device_ptr-2.f90: Likewise.
* gfortran.dg/gomp/is_device_ptr-3.f90: Update tree-scan-dump.
Olivier Hainque [Fri, 3 Dec 2021 17:48:18 +0000 (17:48 +0000)]
Arrange to --disable-shared by default for VxWorks
This change makes sure that shared libraries for VxWorks are
only built on explicit request, when configured with --enable-shared.
As the support to build shared libs gets in very incrementally,
this provides us with a robust way to guard the relevant pieces
and reduce the risks of accidentally breaking a platform not yet
ready for it.
2022-09-30 Olivier Hainque <hainque@adacore.com>
* configure.ac (*vxworks*): If enable_shared is not
set, set to "no" and add --disable-shared to target and
host_configargs.
* configure: Regenerate.
Jason Merrill [Tue, 20 Sep 2022 14:25:42 +0000 (16:25 +0200)]
c++: reduce redundant TARGET_EXPR
An experiment led me to notice that in some cases we were ending up with
TARGET_EXPR initialized by TARGET_EXPR, which isn't useful.
The target_expr_needs_replace change won't make a difference in most cases,
since cp_genericize_init will have already expanded VEC_INIT_EXPR by the
time we consider it, but it is correct.
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Collapse
TARGET_EXPR within TARGET_EXPR.
* constexpr.cc (cxx_eval_outermost_constant_expr): Avoid
adding redundant TARGET_EXPR.
* cp-tree.h (target_expr_needs_replace): VEC_INIT_EXPR doesn't.
GCC Administrator [Fri, 30 Sep 2022 00:17:47 +0000 (00:17 +0000)]
Daily bump.
Joseph Myers [Thu, 29 Sep 2022 22:59:22 +0000 (22:59 +0000)]
c: C2x noreturn attribute
C2x adds a standard [[noreturn]] attribute (which can also be spelt
[[_Noreturn]] for use with <stdnoreturn.h>), so allowing non-returning
functions to be declared in a manner compatible with C++; the
_Noreturn function specifier remains available but is marked
obsolescent.
Implement this attribute. It's more restricted than GNU
__attribute__ ((noreturn)) - that allows function pointers but using
the standard attribute on a function pointer is a constraint
violation. Thus, the attribute gets its own handler that checks for a
FUNCTION_DECL before calling the handler for the GNU attribute. Tests
for the attribute are based on those for C11 _Noreturn and for other
C2x attributes.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c-family/
* c-lex.cc (c_common_has_attribute): Handle noreturn attribute for
C.
gcc/c/
* c-decl.cc (handle_std_noreturn_attribute): New function.
(std_attribute_table): Add _Noreturn and noreturn.
gcc/testsuite/
* gcc.dg/c2x-attr-noreturn-1.c, gcc.dg/c2x-attr-noreturn-2.c,
gcc.dg/c2x-attr-noreturn-3.c: New tests.
* gcc.dg/c2x-has-c-attribute-2.c: Also test __has_c_attribute for
noreturn attribute.
Andrew MacLeod [Tue, 23 Aug 2022 14:17:02 +0000 (10:17 -0400)]
Process unsigned overflow relations for plus and minus is range-ops.
If a relation is available, calculate overflow and normal ranges. Then
apply as appropriate.
gcc/
* range-op.cc (plus_minus_ranges): New.
(adjust_op1_for_overflow): New.
(operator_plus::op1_range): Use new adjustment.
(operator_plus::op2_range): Ditto.
(operator_minus::op1_range): Ditto.
* value-relation.h (relation_lt_le_gt_ge_p): New.
gcc/testsuite/
* gcc.dg/tree-ssa/pr79095.c: Test evrp pass rather than vrp1.
Andrew MacLeod [Thu, 22 Sep 2022 22:17:20 +0000 (18:17 -0400)]
Refine ranges using relations in GORI.
This allows GORI to recognize when a relation passed in applies to the
2 operands of the current statement. Check to see if further range
refinement is possible before proceeding.
* gimple-range-gori.cc (gori_compute::refine_using_relation): New.
(gori_compute::compute_operand1_range): Invoke
refine_using_relation when applicable.
(gori_compute::compute_operand2_range): Ditto.
* gimple-range-gori.h (class gori_compute): Adjust prototypes.
Andrew MacLeod [Thu, 22 Sep 2022 21:55:56 +0000 (17:55 -0400)]
Track value_relations in GORI.
This allows GORI to recognize and pass relations along the calculation chain.
This will allow relations between the LHS and the operand being calculated
to be utilized in op1_range and op2_range.
* gimple-range-gori.cc (ori_compute::compute_operand_range):
Create a relation record and pass it along when possible.
(gori_compute::compute_operand1_range): Pass relation along.
(gori_compute::compute_operand2_range): Ditto.
(gori_compute::compute_operand1_and_operand2_range): Ditto.
* gimple-range-gori.h (class gori_compute): Adjust prototypes.
* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Pass
relation to op1_range call.
(gimple_range_op_handler::calc_op2): Pass relation to op2_range call.
* gimple-range-op.h (class gimple_range_op_handler): Adjust
prototypes.
Andrew MacLeod [Thu, 22 Sep 2022 21:27:36 +0000 (17:27 -0400)]
Move class value_relation the header file.
* value-relation.cc (class value_relation): Move to .h file.
(value_relation::set_relation): Ditto.
(value_relation::value_relation): ditto.
* value-relation.h (class value_relation): Move from .cc file.
(value_relation::set_relation): Ditto
(value_relation::value_relation): Ditto.
Andrew MacLeod [Tue, 27 Sep 2022 23:12:06 +0000 (19:12 -0400)]
Audit op1_range and op2_range for undefined LHS.
If the LHS is undefined, GORI should cease looking. There are numerous
places where this happens, and a few potential traps.
* range-op.cc (operator_minus::op2_range): Check for undefined.
(operator_mult::op1_range): Ditto.
(operator_exact_divide::op1_range): Ditto.
(operator_lshift::op1_range): Ditto.
(operator_rshift::op1_range): Ditto.
(operator_cast::op1_range): Ditto.
(operator_bitwise_and::op1_range): Ditto.
(operator_bitwise_or::op1_range): Ditto.
(operator_trunc_mod::op1_range): Ditto.
(operator_trunc_mod::op2_range): Ditto.
(operator_bitwise_not::op1_range): Ditto.
(pointer_or_operator::op1_range): Ditto.
(range_op_handler::op1_range): Ditto.
(range_op_handler::op2_range): Ditto.
Andrew MacLeod [Tue, 27 Sep 2022 22:42:33 +0000 (18:42 -0400)]
Remove undefined behaviour from testscase.
There was a patch posted to remove the undefined behaviour from this
testcase, but it appear to never have been applied.
gcc/teststuite/
PR tree-optimization/102892
* gcc.dg/pr102892-1.c: Remove undefined behaviour.
Patrick Palka [Thu, 29 Sep 2022 20:27:30 +0000 (16:27 -0400)]
c++: implicit lookup of std::initializer_list [PR102576]
Here the lookup for the implicit use of std::initializer_list fails
because we do it using get_namespace_binding, which isn't import aware.
Fix this by using lookup_qualified_name instead.
PR c++/102576
gcc/cp/ChangeLog:
* pt.cc (listify): Use lookup_qualified_name instead of
get_namespace_binding.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr102576_a.H: New test.
* g++.dg/modules/pr102576_b.C: New test.
Jason Merrill [Thu, 29 Sep 2022 17:45:02 +0000 (13:45 -0400)]
c++: fix triviality of class with unsatisfied op=
cxx20_pair is trivially copyable because it has a trivial copy constructor
and only a deleted copy assignment operator; the non-triviality of the
unsatisfied copy assignment overload is not considered.
gcc/cp/ChangeLog:
* class.cc (check_methods): Call constraints_satisfied_p.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/cond-triv3.C: New test.
François Dumont [Thu, 22 Sep 2022 04:58:48 +0000 (06:58 +0200)]
libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for _GLIBCXX_DEBUG
In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but not template
parameters. In _GLIBCXX_INLINE_VERSION mode most types are in std::__8 namespace but
not std::__debug containers. We need to register specific type printers for this
combination.
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (add_one_template_type_printer): Register
printer for types in std::__debug namespace with template parameters in std::__8
namespace.
Olivier Hainque [Mon, 7 Mar 2022 11:50:27 +0000 (11:50 +0000)]
Improve comments and INITFINI macro use in vxcrtsutff.c
This change augments the comment attached to the use of auto-host.h
in vxcrtstuff.c to better describe the reason for including it and
for the associated series of #undef directives.
It also augments the comment on dso_handle and removes a redundant
guard on HAVE_INITFINI_ARRAY_SUPPORT for the shared version of the
objects, nested within a section guarded on USE_INITFINI_ARRAY.
2022-09-29 Olivier Hainque <hainque@adacore.com>
libgcc/
* config/vxcrtstuff.c: Improve the comment attached to the use
of auto-host.h and of __dso_handle. Remove redundant guard on
HAVE_INITFINI_ARRAY_SUPPORT within a USE_INITFINI_ARRAY section.
Jason Merrill [Tue, 20 Sep 2022 21:12:29 +0000 (17:12 -0400)]
c++: check DECL_INITIAL for constexpr
We were overlooking non-potentially-constant bits in variable initializer
because we didn't walk into DECL_INITIAL.
gcc/cp/ChangeLog:
* constexpr.cc (potential_constant_expression_1): Look into
DECL_INITIAL. Use location wrappers.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/constexpr-local4.C: Expect error sooner.
* g++.dg/cpp2a/consteval24.C: Likewise.
* g++.dg/cpp2a/consteval7.C: Likewise.
* g++.dg/cpp2a/inline-asm3.C: Likewise.
Jason Merrill [Fri, 23 Sep 2022 13:07:22 +0000 (09:07 -0400)]
c++: fix class-valued ?: extension
When the gimplifier encounters the same TARGET_EXPR twice, it evaluates
TARGET_EXPR_INITIAL the first time and clears it so that the later
evaluation is just the temporary. With this testcase, using the extension
to treat an omitted middle operand as repeating the first operand, that led
to doing a bitwise copy of the S(1) temporary on return rather than properly
calling the copy constructor.
We can't use S(1) to initialize the return value here anyway, because we
need to materialize it into a temporary so we can convert it to bool and
determine which arm we're evaluating. So let's just treat the middle
operand as an xvalue.
PR c++/93046
gcc/cp/ChangeLog:
* call.cc (build_conditional_expr): For a?:c extension, treat
a reused class prvalue as an xvalue.
gcc/testsuite/ChangeLog:
* g++.dg/ext/cond4.C: Add runtime test.
Jason Merrill [Mon, 19 Sep 2022 17:08:10 +0000 (19:08 +0200)]
c++: reduce temporaries in ?:
When the sides of ?: are class prvalues, we wrap the COND_EXPR in a
TARGET_EXPR so that both sides will initialize the same temporary. But in
this case we were stripping the outer TARGET_EXPR and conditionally creating
different temporaries, unnecessarily using extra stack. The
recently added TARGET_EXPR_NO_ELIDE flag avoids this.
gcc/cp/ChangeLog:
* call.cc (build_conditional_expr): Set TARGET_EXPR_NO_ELIDE on the
outer TARGET_EXPR.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/cond-temp1.C: New test.
Andrew Stubbs [Mon, 26 Sep 2022 16:33:38 +0000 (17:33 +0100)]
amdgcn: remove unused variable
This was left over from a previous version of the SIMD clone patch.
gcc/ChangeLog:
* config/gcn/gcn.cc (gcn_simd_clone_compute_vecsize_and_simdlen):
Remove unused elt_bits variable.
Olivier Hainque [Thu, 10 Mar 2022 10:53:27 +0000 (10:53 +0000)]
Comment about HAVE_INITFINI_ARRAY_SUPPORT in vxworks.h
Explain that we rely on compiler .c files
to include auto-host.h before target configuration headers.
2022-09-29 Olivier Hainque <hainque@adacore.com>
gcc/
* config/vxworks.h: Add comment on our use of
HAVE_INITFINI_ARRAY_SUPPORT.
Olivier Hainque [Sun, 20 Mar 2022 17:39:15 +0000 (17:39 +0000)]
Add an mcmodel=large multilib for aarch64-vxworks
This makes good sense in general anyway, and in particular
with forthcoming support for shared shared libraries, which will
work for mrtp alone but not yet for mrtp+mcmodel=large.
2022-09-29 Olivier Hainque <hainque@adacore.com>
gcc/
* config/aarch64/t-aarch64-vxworks: Request multilib
variants for mcmodel=large.
Olivier Hainque [Tue, 19 Apr 2022 09:07:32 +0000 (09:07 +0000)]
Remove TARGET_FLOAT128_ENABLE_TYPE setting for VxWorks
We have, in vxworks.h:
/* linux64.h enables this, not supported in vxWorks. */
#undef TARGET_FLOAT128_ENABLE_TYPE
#define TARGET_FLOAT128_ENABLE_TYPE 0
We inherit linux64.h for a few reasons, but don't really support
float128 for vxworks, so the setting made sense.
Many tests rely on the linux default (1) though, so resetting is
causing lots of failures on compilation tests that would pass otherwise.
Not resetting lets users write code declaring floa128
objects but linking will typically fail at some point, so
there's no real adverse effect.
Bottom line is we don't have any particular incentive to alter
the default, whatever the default, so better leave the parameter
alone.
2022-09-29 Olivier Hainque <hainque@adacore.com>
gcc/
* config/rs6000/vxworks.h (TARGET_FLOAT128_ENABLE_TYPE): Remove
resetting to 0.
Olivier Hainque [Thu, 10 Mar 2022 10:46:19 +0000 (10:46 +0000)]
Robustify DWARF2_UNWIND_INFO handling in vx-common.h
This adjusts vx-common.h to #define DWARF2_UNWIND_INFO to 0
when ARM_UNWIND_INFO is set, preventing defaults.h from
possibly setting DWARF2_UNWIND_INFO to 1 (as well) on its own
afterwards if the macro isn't defined.
2022-09-29 Olivier Hainque <hainque@adacore.com>
gcc/
* config/vx-common.h (DWARF2_UNWIND_INFO): #define to 0
when ARM_UNWIND_INFO is set.
Julian Brown [Tue, 27 Sep 2022 17:39:59 +0000 (17:39 +0000)]
OpenACC: whole struct vs. component mappings (PR107028)
This patch fixes an ICE when both a complete struct variable and
components of that struct are mapped on the same directive for OpenACC,
using a modified version of the scheme used for OpenMP in the following
patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601558.html
A new function has been added to make sure that the mapping kinds of
the whole struct and the member access are compatible -- conservatively,
so as not to copy more to/from the device than the user expects.
This version of the patch uses a different method to detect duplicate
clauses for OpenACC in oacc_resolve_clause_dependencies, and removes
the now-redundant check in omp_accumulate_sibling_lists. (The latter
check would no longer trigger when we map the whole struct on the same
directive because the component-mapping clauses are now deleted before
the check is executed.)
2022-09-28 Julian Brown <julian@codesourcery.com>
gcc/
PR middle-end/107028
* gimplify.cc (omp_check_mapping_compatibility,
oacc_resolve_clause_dependencies): New functions.
(omp_accumulate_sibling_list): Remove redundant duplicate clause
detection for OpenACC.
(build_struct_sibling_lists): Skip deleted groups. Don't build sibling
list for struct variables that are fully mapped on the same directive
for OpenACC.
(gimplify_scan_omp_clauses): Call oacc_resolve_clause_dependencies.
gcc/testsuite/
PR middle-end/107028
* c-c++-common/goacc/struct-component-kind-1.c: New test.
* g++.dg/goacc/pr107028-1.C: New test.
* g++.dg/goacc/pr107028-2.C: New test.
* gfortran.dg/goacc/mapping-tests-5.f90: New test.
Patrick Palka [Thu, 29 Sep 2022 13:18:40 +0000 (09:18 -0400)]
c++: implement __remove_cv, __remove_reference and __remove_cvref
This implements builtins for std::remove_cv, std::remove_reference and
std::remove_cvref using TRAIT_TYPE from the previous patch.
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Add __remove_cv,
__remove_reference and __remove_cvref.
* c-common.h (enum rid): Add RID_REMOVE_CV, RID_REMOVE_REFERENCE
and RID_REMOVE_CVREF.
gcc/cp/ChangeLog:
* constraint.cc (diagnose_trait_expr): Handle CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* cp-objcp-common.cc (names_builtin_p): Likewise.
* cp-tree.h (enum cp_trait_kind): Add CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* cxx-pretty-print.cc (pp_cxx_trait): Handle CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* parser.cc (cp_keyword_starts_decl_specifier_p): Return true
for RID_REMOVE_CV, RID_REMOVE_REFERENCE and RID_REMOVE_CVREF.
(cp_parser_trait): Handle RID_REMOVE_CV, RID_REMOVE_REFERENCE
and RID_REMOVE_CVREF.
(cp_parser_simple_type_specifier): Likewise.
* semantics.cc (finish_trait_type): Likewise.
libstdc++-v3/ChangeLog:
* include/bits/unique_ptr.h (unique_ptr<_Tp[], _Dp>): Remove
__remove_cv and use __remove_cv_t instead.
gcc/testsuite/ChangeLog:
* g++.dg/ext/has-builtin-1.C: Test existence of __remove_cv,
__remove_reference and __remove_cvref.
* g++.dg/ext/remove_cv.C: New test.
* g++.dg/ext/remove_reference.C: New test.
* g++.dg/ext/remove_cvref.C: New test.
Patrick Palka [Thu, 29 Sep 2022 13:18:11 +0000 (09:18 -0400)]
c++: introduce TRAIT_TYPE alongside TRAIT_EXPR
We already have generic support for predicate-like traits that yield a
boolean value via TRAIT_EXPR, but we lack the same support for traits
that yield a type instead of a value. Such support would streamline
implementing efficient builtins for the standard library type traits.
To that end this patch implements a generic TRAIT_TYPE type alongside
TRAIT_EXPR, and reimplements the existing UNDERLYING_TYPE builtin trait
using this new TRAIT_TYPE.
gcc/cp/ChangeLog:
* cp-objcp-common.cc (cp_common_init_ts): Replace
UNDERLYING_TYPE with TRAIT_TYPE.
* cp-tree.def (TRAIT_TYPE): Define.
(UNDERLYING_TYPE): Remove.
* cp-tree.h (TRAIT_TYPE_KIND_RAW): Define.
(TRAIT_TYPE_KIND): Define.
(TRAIT_TYPE_TYPE1): Define.
(TRAIT_TYPE_TYPE2): Define.
(WILDCARD_TYPE_P): Return true for TRAIT_TYPE.
(finish_trait_type): Declare.
* cxx-pretty-print.cc (cxx_pretty_printer::primary_expression):
Adjust after renaming pp_cxx_trait_expression.
(cxx_pretty_printer::simple_type_specifier) <case TRAIT_TYPE>:
New.
(cxx_pretty_printer::type_id): Replace UNDERLYING_TYPE with
TRAIT_TYPE.
(pp_cxx_trait_expression): Rename to ...
(pp_cxx_trait): ... this. Handle TRAIT_TYPE as well. Correct
pretty printing of the trailing arguments.
* cxx-pretty-print.h (pp_cxx_trait_expression): Rename to ...
(pp_cxx_trait_type): ... this.
* error.cc (dump_type) <case UNDERLYING_TYPE>: Remove.
<case TRAIT_TYPE>: New.
(dump_type_prefix): Replace UNDERLYING_WITH with TRAIT_TYPE.
(dump_type_suffix): Likewise.
* mangle.cc (write_type) <case UNDERLYING_TYPE>: Remove.
<case TRAIT_TYPE>: New.
* module.cc (trees_out::type_node) <case UNDERLYING_TYPE>:
Remove.
<case TRAIT_TYPE>: New.
(trees_in::tree_node): Likewise.
* parser.cc (cp_parser_primary_expression): Adjust after
renaming cp_parser_trait_expr.
(cp_parser_trait_expr): Rename to ...
(cp_parser_trait): ... this. Call finish_trait_type for traits
that yield a type.
(cp_parser_simple_type_specifier): Adjust after renaming
cp_parser_trait_expr.
* pt.cc (for_each_template_parm_r) <case UNDERLYING_TYPE>:
Remove.
<case TRAIT_TYPE>: New.
(tsubst): Likewise.
(unify): Replace UNDERLYING_TYPE with TRAIT_TYPE.
(dependent_type_p_r): Likewise.
* semantics.cc (finish_underlying_type): Don't return
UNDERLYING_TYPE anymore when processing_template_decl.
(finish_trait_type): Define.
* tree.cc (strip_typedefs) <case UNDERLYING_TYPE>: Remove.
<case TRAIT_TYPE>: New.
(cp_walk_subtrees): Likewise.
* typeck.cc (structural_comptypes): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-59.C: Adjust expected error message.
* g++.dg/ext/underlying_type7.C: Likewise.
* g++.dg/ext/underlying_type13.C: New test.
* g++.dg/ext/underlying_type14.C: New test.
Jonathan Wakely [Thu, 29 Sep 2022 10:30:05 +0000 (11:30 +0100)]
libstdc++: Guard use of new built-in with __has_builtin
I forgot that non-GCC compilers don't have this built-in yet.
For Clang we could do something like the check below (as described in
P2255), but for now I'm just fixing the regression.
#if __has_builtin((__reference_binds_to_temporary)
bool _Dangle = __reference_binds_to_temporary(_Tp, _Res_t)
&& __and_<is_reference<_Tp>,
__not_<is_reference<_Res_t>>,
is_convertible<__remove_cvref_t<_Res_t>*,
__remove_cvref_t<_Tp>*>>::value
#endif
libstdc++-v3/ChangeLog:
* include/std/type_traits (__is_invocable_impl): Check
__has_builtin(__reference_converts_from_temporary) before using
built-in.
Nathan Sidwell [Wed, 28 Sep 2022 16:21:14 +0000 (09:21 -0700)]
c++: import/export NTTP objects
This adds smarts to the module machinery to handle NTTP object
VAR_DECLs. Like typeinfo objects, these must be ignored in the symbol
table, streamed specially and recreated on stream in.
gcc/cp/
PR c++/100616
* module.cc (enum tree_tag): Add tt_nttp_var.
(trees_out::decl_node): Handle NTTP objects.
(trees_in::tree_node): Handle tt_nttp_var.
(depset::hash::add_binding_entry): Skip NTTP objects.
gcc/testsuite/
PR c++/100616
* g++.dg/modules/100616_a.H: New.
* g++.dg/modules/100616_b.C: New.
* g++.dg/modules/100616_c.C: New.
* g++.dg/modules/100616_d.C: New.
Jose E. Marchesi [Thu, 4 Aug 2022 19:16:10 +0000 (21:16 +0200)]
place `const volatile' objects in read-only sections
It is common for C BPF programs to use variables that are implicitly
set by the BPF loader and run-time. It is also necessary for these
variables to be stored in read-only storage so the BPF verifier
recognizes them as such. This leads to declarations using both
`const' and `volatile' qualifiers, like this:
const volatile unsigned char is_allow_list = 0;
Where `volatile' is used to avoid the compiler to optimize out the
variable, or turn it into a constant, and `const' to make sure it is
placed in .rodata.
Now, it happens that:
- GCC places `const volatile' objects in the .data section, under the
assumption that `volatile' somehow voids the `const'.
- LLVM places `const volatile' objects in .rodata, under the
assumption that `volatile' is orthogonal to `const'.
So there is a divergence, that has practical consequences: it makes
BPF programs compiled with GCC to not work properly.
When looking into this, I found this bugzilla:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25521
"change semantics of const volatile variables"
which was filed back in 2005, long ago. This report was already
asking to put `const volatile' objects in .rodata, questioning the
current behavior.
While discussing this in the #gcc IRC channel I was pointed out to the
following excerpt from the C18 spec:
6.7.3 Type qualifiers / 5 The properties associated with qualified
types are meaningful only for expressions that are
lval-values [note 135]
135) The implementation may place a const object that is not
volatile in a read-only region of storage. Moreover, the
implementation need not allocate storage for such an object if
its $ address is never used.
This footnote may be interpreted as if const objects that are volatile
shouldn't be put in read-only storage. Even if I personally was not
very convinced of that interpretation (see my earlier comment in BZ
25521) I filed the following issue in the LLVM tracker in order to
discuss the matter:
https://github.com/llvm/llvm-project/issues/56468
As you can see, Aaron Ballman, one of the LLVM hackers, asked the WG14
reflectors about this. He reported that the reflectors don't think
footnote 135 has any normative value.
So, not having a normative mandate on either direction, there are two
options:
a) To change GCC to place `const volatile' objects in .rodata instead
of .data.
b) To change LLVM to place `const volatile' objects in .data instead
of .rodata.
Considering that:
- One target (bpf-unknown-none) breaks with the current GCC behavior.
- No target/platform relies on the GCC behavior, that we know.
- Changing the LLVM behavior at this point would be very severely
traumatic for the BPF people and their users.
I think the right thing to do at this point is a).
Therefore this patch.
Regtested in x86_64-linux-gnu and bpf-unknown-none.
No regressions observed.
gcc/ChangeLog:
PR middle-end/25521
* varasm.cc (categorize_decl_for_section): Place `const volatile'
objects in read-only sections.
(default_select_section): Likewise.
gcc/testsuite/ChangeLog:
PR middle-end/25521
* lib/target-supports.exp (check_effective_target_elf): Define.
* gcc.dg/pr25521.c: New test.
Richard Sandiford [Thu, 29 Sep 2022 10:32:57 +0000 (11:32 +0100)]
data-ref: Fix ranges_maybe_overlap_p test
dr_may_alias_p rightly used poly_int_tree_p to guard a use of
ranges_maybe_overlap_p, but used the non-poly extractors.
This caused a few failures in the SVE ACLE asm tests.
gcc/
* tree-data-ref.cc (dr_may_alias_p): Use to_poly_widest instead
of to_widest.