2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-03-20 06:50:26 +08:00

197523 Commits

Author SHA1 Message Date
Jason Merrill
1e007fa5c9 build: avoid -Wconditionally-supported on qsort check
It's OK to rely on conditionally-supported features in #if CHECKING_P, since
that isn't defined in stage 1.

gcc/ChangeLog:

	* sort.cc: Disable -Wconditionally-supported in
	CHECKING_P code.
2022-12-19 15:46:35 -05:00
Patrick Palka
64f7a3b387 c++: modules and std::source_location::current() def arg [PR100881]
We currently declare __builtin_source_location with a const void* return
type instead of the actual type const std::source_location::__impl*, and
later when folding this builtin we obtain the actual type via name lookup.

But the below testcase demonstrates this approach seems to interact
poorly with modules, since we may import an entity that uses
std::source_location::current() in its default argument (or DMI) without
necessarily importing <source_location>, and thus the name lookup for
std::source_location will fail at the call site (when using the default
argument) unless we also import <source_location>.

This patch fixes this by instead initially declaring the builtin with an
auto return type and updating it appropriately upon its first use (in
standard code the first/only use would be in the definition of
std::source_location).  Thus when folding calls to this builtin we can
get at its return type through the type of the CALL_EXPR and avoid
needing to do a name lookup.

	PR c++/100881

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_builtin_function_call): Adjust calls
	to fold_builtin_source_location.
	* cp-gimplify.cc (cp_gimplify_expr): Likewise.
	(cp_fold): Likewise.
	(get_source_location_impl_type): Remove location_t parameter and
	adjust accordingly.  No longer static.
	(fold_builtin_source_location): Take a CALL_EXPR tree instead of a
	location and obtain the impl type from its return type.
	* cp-tree.h (enum cp_tree_index): Remove CPTI_SOURCE_LOCATION_IMPL
	enumerator.
	(source_location_impl): Remove.
	(fold_builtin_source_location): Adjust parameter type.
	(get_source_location_impl_type): Declare.
	* decl.cc (cxx_init_decl_processing): Declare
	__builtin_source_location with auto return type instead of
	const void*.
	(require_deduced_type): Update the return type of
	__builtin_source_location.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/srcloc3.C: Adjust expected note s/evaluating/using.
	* g++.dg/cpp2a/srcloc4.C: Likewise.
	* g++.dg/cpp2a/srcloc5.C: Likewise.
	* g++.dg/cpp2a/srcloc6.C: Likewise.
	* g++.dg/cpp2a/srcloc7.C: Likewise.
	* g++.dg/cpp2a/srcloc8.C: Likewise.
	* g++.dg/cpp2a/srcloc9.C: Likewise.
	* g++.dg/cpp2a/srcloc10.C: Likewise.
	* g++.dg/cpp2a/srcloc11.C: Likewise.
	* g++.dg/cpp2a/srcloc12.C: Likewise.
	* g++.dg/cpp2a/srcloc13.C: Likewise.
	* g++.dg/modules/pr100881_a.C: New test.
	* g++.dg/modules/pr100881_b.C: New test.
2022-12-19 15:35:51 -05:00
Patrick Palka
a7c8036b26 c++: ICE with concepts TS multiple auto deduction [PR101886]
In extract_autos_r, we need to recompute TYPE_CANONICAL for the template
type parameter after adjusting its index, otherwise we end up with a
comptypes ICE for the below testcase.  Note that such in-place type
adjustment isn't generally safe to do since the type could be the
TYPE_CANONICAL of another (unadjusted) type, but in this case the
canonical auto (of some level and 0 index) is the first auto (of that
level) that's created, and so any auto that we do end up adjusting can't
be the canonical one.

	PR c++/101886

gcc/cp/ChangeLog:

	* pt.cc (extract_autos_r): Recompute TYPE_CANONICAL after
	adjusting the template type parameter's index.  Simplify
	by using TEMPLATE_TYPE_IDX.  Add some sanity checks.

gcc/testsuite/ChangeLog:

	* g++.dg/concepts/auto5.C: New test.
2022-12-19 15:26:37 -05:00
Arsen Arsenović
a39f454f0f contracts: Lowercase {MAYBE,NEVER}_CONTINUE
The lowercase constants are more consistent with the standard, and it is
unlikely that the uppercase versions would've been accepted.

gcc/cp/ChangeLog:

	* contracts.cc: Rename references to
	contract_violation_continuation_mode constants to be lowercase.

libstdc++-v3/ChangeLog:

	* include/experimental/contract: Lowercase the constants in
	contract_violation_continuation_mode.
2022-12-19 15:08:08 -05:00
Jakub Jelinek
4e4620d8c7 c: Diagnose compound literals with function type [PR108043]
Both C99 and latest C2X say that compound literal shall have an object type
(complete object type in the latter case) or array of unknown bound,
so complit with function type is invalid.  When the initializer had to be
non-empty for such case, we used to diagnose it as incorrect initializer,
but with (fntype){} now allowed we just ICE on it.

The following patch diagnoses that.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR c/108043
	* c-parser.cc (c_parser_postfix_expression_after_paren_type): Diagnose
	compound literals with function type.

	* gcc.dg/pr108043.c: New test.
	* gcc.dg/c99-complit-2.c (foo): Adjust expected diagnostics for
	complit with function type.
2022-12-19 20:55:56 +01:00
Marek Polacek
68e51bd0a8 c-family: Fix ICE with -Wsuggest-attribute [PR98487]
Here we crash because check_function_format was using TREE_PURPOSE
directly rather than using get_attribute_name.

	PR c/98487

gcc/c-family/ChangeLog:

	* c-format.cc (check_function_format): Use get_attribute_name.

gcc/testsuite/ChangeLog:

	* c-c++-common/Wsuggest-attribute-1.c: New test.
2022-12-19 11:16:42 -05:00
Jason Merrill
263c22a95b build: add -Wconditionally-supported to strict_warn [PR64867]
The PR (which isn't resolved by this commit) pointed out to me that GCC
should build with -Wconditionally-supported to support bootstrapping with a
C++11 compiler that makes different choices.

	PR c++/64867

gcc/ChangeLog:

	* configure.ac (strict_warn): Add -Wconditionally-supported.
	* configure: Regenerate.
2022-12-19 10:56:33 -05:00
Richard Biener
ec459469f8 tree-optimization/108164 - undefined overflow with IV vectorization
vect_update_ivs_after_vectorizer can end up emitting a signed
IV update when the loop body performed an unsigned computation.
The following makes sure to perform that update in the type
of the loop update type to avoid undefined behavior on overflow.

	PR tree-optimization/108164
	* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
	Perform vect_step_op_add update in the appropriate type.

	* gcc.dg/pr108164.c: New testcase.
2022-12-19 16:36:21 +01:00
Richard Earnshaw
aa510619f8 arm: correctly define __ARM_FEATURE_CLZ
The ACLE requires that __ARM_FEATURE_CLZ be defined if the hardware
supports it; it's also clear that this doesn't mean the current ISA,
so we must define this even when compiling for Thumb1 if the target
supports CLZ in A32.

This brings GCC into alignment with Clang.

gcc/ChangeLog:

	* config/arm/arm-c.cc (__ARM_FEATURE_CLZ): Fix definition of
	preprocessor macro when target has CLZ in another ISA.
2022-12-19 15:03:30 +00:00
Ju-Zhe Zhong
8577356f4b RISC-V: Remove unit-stride store from ta attribute
Since store instructions doesn't care about tail policy, we remove
vste from "ta" attribute. Hence, we could have more fusion chances
and better optimization.

gcc/ChangeLog:

	* config/riscv/vector.md: Remove vste.
2022-12-19 22:23:32 +08:00
Ju-Zhe Zhong
6c098f7d23 RISC-V: Add testcases for VSETVL PASS 5
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-29.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-30.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-31.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-32.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-33.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-34.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-35.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-36.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-37.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-38.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-39.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-40.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-41.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-42.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-43.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-44.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-46.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-9.c: New test.
2022-12-19 22:23:29 +08:00
Ju-Zhe Zhong
5a1b66b77c RISC-V: Add testcases for VSETVL PASS 4
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c: New test.
2022-12-19 22:23:26 +08:00
Ju-Zhe Zhong
76023293e6 RISC-V: Add testcases for VSETVL PASS 3
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-9.c: New test.
2022-12-19 22:23:22 +08:00
Ju-Zhe Zhong
6f18836ca0 RISC-V: Add testcases for VSETVL PASS 2
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-9.c: New test.
2022-12-19 22:23:18 +08:00
Ju-Zhe Zhong
e4433e075f RISC-V: Add testcases for VSETVL PASS
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/rvv.exp: Adjust to enable tests for VSETVL PASS.
	* gcc.target/riscv/rvv/vsetvl/dump-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-8.c: New test.
2022-12-19 22:23:11 +08:00
Kito Cheng
c2c29fbebb RISC-V: Simplify ASM checks in gcc.target/riscv/rvv/base/.
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/mov-1.c: Simplify operand check.
	* gcc.target/riscv/rvv/base/mov-10.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-11.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-12.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-2.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-3.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-4.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-5.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-6.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-8.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-9.c: Ditto.
	* gcc.target/riscv/rvv/base/vread_csr.c: Ditto.
	* gcc.target/riscv/rvv/base/vsetvl-1.c: Ditto.
	* gcc.target/riscv/rvv/base/vwrite_csr.c: Ditto.
2022-12-19 22:22:30 +08:00
Ju-Zhe Zhong
9243c3d1b6 RISC-V: Support VSETVL PASS for RVV support
This patch is to support VSETVL PASS for RVV support.
1.The optimization and performance is guaranteed LCM (Lazy code motion).
2.Base on RTL_SSA framework to gain better optimization chances.
3.Also we do VL/VTYPE, demand information backward propagation across
  blocks by RTL_SSA reverse order in CFG.
4.It has been well and fully tested by about 200+ testcases for VLMAX
  AVL situation (Only for VLMAX since we don't have an intrinsics to
  test non-VLMAX).
5.Will support AVL model in the next patch.

gcc/ChangeLog:

	* config.gcc: Add riscv-vsetvl.o.
	* config/riscv/riscv-passes.def (INSERT_PASS_BEFORE): Add VSETVL PASS
	location.
	* config/riscv/riscv-protos.h (make_pass_vsetvl): New function.
	(enum avl_type): New enum.
	(get_ta): New function.
	(get_ma): Ditto.
	(get_avl_type): Ditto.
	(calculate_ratio): Ditto.
	(enum tail_policy): New enum.
	(enum mask_policy): Ditto.
	* config/riscv/riscv-v.cc (calculate_ratio): New function.
	(emit_pred_op): change the VLMAX mov codgen.
	(get_ta): New function.
	(get_ma): Ditto.
	(enum tail_policy): Change enum.
	(get_prefer_tail_policy): New function.
	(enum mask_policy): Change enum.
	(get_prefer_mask_policy): New function.
	* config/riscv/t-riscv: Add riscv-vsetvl.o
	* config/riscv/vector.md: Adjust attribute and pattern for VSETVL
	PASS.
	(@vlmax_avl<mode>): Ditto.
	(@vsetvl<mode>_no_side_effects): Delete.
	(vsetvl_vtype_change_only): New MD pattern.
	(@vsetvl_discard_result<mode>): Ditto.
	* config/riscv/riscv-vsetvl.cc: New file.
	* config/riscv/riscv-vsetvl.h: New file.
2022-12-19 22:21:37 +08:00
Ju-Zhe Zhong
22dc669e10 RISC-V: Fix RVV machine mode attribute configuration
The attribute configuration of each machine mode are support in the previous patch.
I noticed some of them are not correct during VSETVL PASS testsing.
Correct them in the single patch now.

gcc/ChangeLog:

	* config/riscv/riscv-vector-switch.def (ENTRY): Correct attributes.
2022-12-19 22:09:35 +08:00
Jakub Jelinek
6e85f89a7d testsuite: Fix up pr64536.c for LLP64 targets [PR108151]
Apparently llp64 had 2 further warnings, fixed thusly.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/108151
	* gcc.dg/pr64536.c (bar): Cast long to __INTPTR_TYPE__
	before casting to long *.
2022-12-19 15:05:16 +01:00
Jakub Jelinek
de2b8c41b8 modula2: Don't treat % in Modula 2 messages specially
On top of the just posted patch, this patch makes sure that
any % chars in message strings aren't treated as format chars.
None of these functions take variable number of arguments, so for
most of format specifiers there is nowhere to take arguments from,
it is true that a couple of format specifiers don't take any
arguments - %%, %m, %<, %>, %' - so it is actually possible
to use them, but one needs to verify that no other are emitted and
that what should be printed as % is really emitted as %%.
If the FE does that, then please ignore this patch, otherwise I think
it is safer to do this.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	* gm2-gcc/m2linemap.cc (m2linemap_ErrorAt, m2linemap_ErrorAtf,
	m2linemap_WarningAtf, m2linemap_NoteAtf, m2linemap_internal_error):
	Call functions with "%s", message rather than just message, so that
	% chars in message aren't treated as format specifiers.
2022-12-19 15:00:47 +01:00
Jakub Jelinek
158b18ffa5 modula2: Fix up bootstrap on powerpc64le-linux [PR108147]
As mentioned in the PR, bootstrap with m2 enabled currently fails
on powerpc64le-linux, we get weird ICE after printing some diagnostics.
The problem is that mc creates from *.def prototypes like
extern void m2linemap_WarningAtf (m2linemap_location_t location, void * message);
but the actual function definitions use
void m2linemap_WarningAtf (m2linemap_location_t location, void * message,
...) { code }
and on powerpc64le-linux such lying about the prototype results in
wrong-code, on the caller side we assume the function isn't varargs
and so don't reserve 64 bytes in the frame for it, while the callee
relies on the area being reserved and stores into it.

Fixed by adding non-stdarg wrappers around stdarg functions (because
we want va_list and pass it to diagnostics functions).

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR modula2/108147
	* gm2-gcc/m2linemap.def (ErrorAtf, WarningAtf, NoteAtf):
	Comment out prototypes with varargs.
	* gm2-gcc/m2linemap.h (m2linemap_ErrorAtf, m2linemap_WarningAtf,
	m2linemap_NoteAtf): No longer varargs.
	* gm2-gcc/m2linemap.cc (m2linemap_ErrorAtf): Turned into a
	non-varargs wrapper around ...
	(m2linemap_ErrorAtf_1): ... this.  New static function.
	(m2linemap_WarningAtf): Turned into a non-varargs wrapper around ...
	(m2linemap_WarningAtf_1): ... this.  New static function.
	(m2linemap_NoteAtf): Turned into a non-varargs wrapper around ...
	(m2linemap_NoteAtf_1): ... this.  New static function.
2022-12-19 15:00:08 +01:00
Martin Liska
a9f6a2b7f5 gcc-changelog: support digits in PR's component in subject
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Support digits in PR's
	component in subject.
2022-12-19 14:55:39 +01:00
Martin Liska
7e9ec734f9 gcc-changelog: allow digit in component name
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow digit in component name.

contrib/ChangeLog:

	* gcc-changelog/test_email.py: Add new test.
	* gcc-changelog/test_patches.txt: Add new patch.
2022-12-19 14:39:25 +01:00
Jakub Jelinek
ea37e96a37 testsuite: Fix up pr64536.c for LLP64 targets [PR108151]
The test casts a pointer to long, which is ok for ilp32 and lp64
targets but not for llp64 targets.  Nothing reads the values later,
it is a link test, so all we care about is that it is the same
cast on s390x-linux where it used to fail before the PR64536 fix,
and that we don't warn about it.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/108151
	* gcc.dg/pr64536.c (bar): Use casts to __INTPTR_TYPE__ rather than
	long when casting pointer to integral type.
2022-12-19 13:49:52 +01:00
Kyrylo Tkachov
98756bcbe2 aarch64: PR target/108140 Handle NULL target in data intrinsic expansion
In this PR we ICE when expanding the __rbit builtin with a NULL target rtx.
I *think* that only happens when the result is unused and hence maybe we shouldn't be expanding
any RTL at all, but the ICE here is easily fixed by deriving the mode from the type of the expression
rather than the target.

This patch does that.
Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/ChangeLog:

	PR target/108140
	* config/aarch64/aarch64-builtins.cc
	(aarch64_expand_builtin_data_intrinsic): Handle NULL target.

gcc/testsuite/ChangeLog:

	PR target/108140
	* gcc.target/aarch64/acle/pr108140.c: New test.
2022-12-19 11:16:47 +00:00
Tobias Burnus
2b2cec58ff gcc-changelog: Add warning for auto-added files
git_email.py prints now a warning for files added automatically.
git_check_commit.py does likewise but only with --verbose.
It prints one line per ChangeLog file, either stating the file
or if more than one the number of files.

contrib/ChangeLog:

	* gcc-changelog/git_check_commit.py (__main__): With -v print a
	warning for the auto-added files.
	* gcc-changelog/git_commit.py (GitCommit.__init__): Add self.warnings.
	(GitCommit.check_mentioned_files): Add warning for auto-added files.
	(GitCommit.print_warnings): New function.
	* gcc-changelog/git_email.py (__main__): Remove bogus argument to
	GitEmail constructor; print auto-added-files warning.
	* gcc-changelog/test_email.py (test_auto_add_file_1,
	test_auto_add_file_2): New tests.
	* gcc-changelog/test_patches.txt: Add two test cases.
2022-12-19 12:12:16 +01:00
Jakub Jelinek
03fb35f875 testsuite: Fix up pr107397.f90 test [PR107397]
The pr107397.f90 test FAILs for me, one problem was that the
added diagnostics has an indefinite article before BOZ, but
the test dg-error didn't.  The other problem was that on the
other dg-error there was no space between the string and closing
}, so it was completely ignored and the error was an excess
error.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/107397
	* gfortran.dg/pr107397.f90: Adjust expected diagnostic wording and
	add space between dg-error string and closing }.
2022-12-19 11:24:55 +01:00
Jakub Jelinek
f39b7a4d37 hwasan: Add libhwasan_preinit.o
I've noticed an inconsistency with the other sanitizers.
For -fsanitize={address,thread,leak} we link into binaries
lib*san_preinit.o such that the -lasan, -ltsan or -llsan libraries
are initialized as early as possible through .preinit_array.
The hwasan library has the same thing, but we strangely compiled
it into the library (where it apparently didn't do anything,
.preinit_array doesn't seem to be created for shared libraries),
rather than installing it like in the other 3 cases.

The following patch handles it for hwasan similarly to asan, tsan and lsan.

I don't have any hw with hwasan support, so I've just checked it
builds and installs as expected and that
gcc -fsanitize=hwaddress -o a a.c -mlam=u57
on trivial main results in .preinit_array section in the binary.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	* config/gnu-user.h (LIBHWASAN_EARLY_SPEC): Add libhwasan_preinit.o
	to link spec if not -shared.

	* hwasan/Makefile.am (nodist_toolexeclib_HEADERS): Set to
	libhwasan_preinit.o.
	(hwasan_files): Remove hwasan_preinit.cpp.
	(libhwasan_preinit.o): Copy from hwasan_preinit.o.
	* hwasan/Makefile.in: Regenerated.
2022-12-19 11:14:55 +01:00
Ju-Zhe Zhong
61f9fe4049 RISC-V: Change vlmul printing rule
This patch is preparing patch for the following patch (VSETVL PASS)
support since the current vlmul printing rule is not appropriate
information for VSETVL PASS. I split this fix in a single patch.

gcc/ChangeLog:

	* config/riscv/riscv-v.cc (emit_vlmax_vsetvl): Pass through VLMUL enum
	instead of machine mode.
	* config/riscv/riscv-vector-builtins-bases.cc: Ditto.
	* config/riscv/riscv.cc (riscv_print_operand): Print LMUL by enum vlmul
	instead of machine mode.
2022-12-19 17:40:07 +08:00
Kito Cheng
b346e77f4d RISC-V: Fix vwrite_csr.c and vread_csr.c
gcc/testsuite:

	* gcc.target/riscv/rvv/base/vread_csr.c: Use specific option
	instead.
	* gcc.target/riscv/rvv/base/vwrite_csr.c: Ditto.
2022-12-19 17:39:33 +08:00
Jiufu Guo
97a8e88cd7 rs6000: use li;x?oris to build constant
For constant C:
If '(c & 0xFFFFFFFF00008000ULL) == 0xFFFFFFFF00008000ULL' or say:
32(1) || 16(x) || 1(1) || 15(x), using "li; xoris" would be ok.

If '(c & 0xFFFFFFFF80008000ULL) == 0x80000000ULL' or say:
32(0) || 1(1) || 15(x) || 1(0) || 15(x), we could use "li; oris" to
build constant 'C'.

Here N(M) means N continuous bit M, x for M means it is ok for either
1 or 0; '||' means concatenation.

This patch update rs6000_emit_set_long_const to support those constants.

	PR target/106708

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
	"li; x?oris" to build constant.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr106708.c: New test.
2022-12-19 17:11:36 +08:00
Martin Liska
17b41a2839 gcc-changelog: stop using --flake8
The flake8 pytest plug-in is broken and we should not use it.

contrib/ChangeLog:

	* gcc-changelog/setup.cfg: Do not use flake8 pytest plug-in.
2022-12-19 10:02:38 +01:00
liuhongt
88b531d032 x86: Don't add crtfastmath.o for -shared
Don't add crtfastmath.o for -shared to avoid changing the MXCSR register
when loading a shared library.  crtfastmath.o will be used only when
building executables.

	PR target/55522
	* config/i386/gnu-user-common.h (GNU_USER_TARGET_MATHFILE_SPEC):
	Don't add crtfastmath.o for -shared.
	* doc/invoke.texi (-shared): Add related documentation.
2022-12-19 16:47:21 +08:00
Kito Cheng
e433739862 RISC-V: Fix RVV related testsuite
Use wrapper of riscv_vector.h for RVV related testcases,
more detail see https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603140.html

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/mov-1.c: Use double quotes to
	include riscv_vector.h rather than angle brackets.
	* gcc.target/riscv/rvv/base/mov-10.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-11.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-12.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-13.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-2.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-3.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-4.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-5.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-6.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-7.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-8.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-9.c: Ditto.
	* gcc.target/riscv/rvv/base/vread_csr.c: Ditto.
	* gcc.target/riscv/rvv/base/vsetvl-1.c: Ditto.
	* gcc.target/riscv/rvv/base/vwrite_csr.c: Ditto.
2022-12-19 15:57:48 +08:00
GCC Administrator
e2e154fe5b Daily bump. 2022-12-19 00:16:53 +00:00
Rainer Orth
fd69977feb build: doc: Obsolete Solaris 11.3 support
This patch implements the Solaris 11.[0-3] obsoletion just announced in

	https://gcc.gnu.org/pipermail/gcc/2022-December/240322.html

Bootstrapped without regressions on Solaris 11.3 (i386-pc-solaris2.11,
sparc-sun-solaris2.11 without and with --enable-obsolete) and 11.4.

2022-12-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config.gcc: Determine Solaris minor version.
	Obsolete *-*-solaris2.11.[0-3]*.
	* doc/install.texi (Specific, *-*-solaris2*): Document it.
2022-12-18 20:39:14 +01:00
Gaius Mulley
0b2428ee83 PR-108122 Reduce sleep times in gm2/pimcoroutines/run/pass/testtime.mod
Change time unit to 1 jiffy (with respect to TimerHandler.def) rather
than a second.

gcc/testsuite/ChangeLog:

	* gm2/pimcoroutines/run/pass/testtime.mod: Reduce sleep times in
	the test by a factor of 25.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-12-18 10:04:02 +00:00
Steve Kargl
09710f9934 Add a check for invalid use of BOZ with a derived type.
PR fortran/107397

gcc/fortran/ChangeLog:

	* decl.cc (add_init_expr_to_sym): Add check with new error message.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr107397.f90: New test.
2022-12-17 19:36:59 -08:00
GCC Administrator
92bc361757 Daily bump. 2022-12-18 00:16:57 +00:00
Segher Boessenkool
f80f540e39 rs6000: Add Rust support to traceback table
Use 0 for the "lang" identifier for Rust, just like we do for all other
source languages without assigned language code (0 means "C").

Tested on powerpc64-linux.  Without this patch there are ICEs galore in
the gm2 testsuite for 64-bit Linux targets, and with the ptch there are
just a few FAILs.

2022-12-17  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000-logue.cc (rs6000_output_function_epilogue):
	Handle GNU Rust for the tbtab lang field.
2022-12-17 20:56:13 +00:00
Patrick Palka
982629bea4 c++: constantness of non-dependent NTTP argument [PR107437]
Here we're rejecting the use of the lambda capture of 't' (of empty
type) as a template argument ultimately because convert_nontype_argument
checks constantness using is_constant_expression, which returns false
for lambda captures since want_rval=false.  But in this case I believe
an lvalue-to-rvalue conversion of the argument is implied, so we should
be using is_rvalue_constant_expression instead (which would return true
here).

However, it doesn't seem necessary to consider constantness at all
when deciding whether to instantiate a non-dependent argument in
convert_nontype_argument.  So this patch gets rid of the problematic
constantness test altogether, which incidentally also fixes the similar
dg-ice'd testcase from PR87765.  This is in line with a similar
change we made to finish_decltype_type in r12-7564-gec0f53a3a542e7.

	PR c++/107437
	PR c++/87765

gcc/cp/ChangeLog:

	* pt.cc (convert_nontype_argument): Relax is_nondep_const_expr
	test to !inst_dep_expr_p.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/lambda-generic-107437.C: New test.
	* g++.dg/cpp1z/constexpr-lambda26.C: Remove dg-ice.
2022-12-17 11:24:44 -05:00
Ian Lance Taylor
b1f91819e3 libbacktrace: unpack literals into output buffer
* elf.c (elf_fetch_backward_init): New static function.
	(ZSTD_TABLE_SIZE): Use huffman scratch space size rather than
	literal size.
	(ZSTD_TABLE_WORK_LIT_SIZE): Don't define.
	(elf_zstd_read_huff): Use elf_fetch_backward_init.
	(elf_zstd_read_literals): New static function.
	(ZSTD_LIT_RAW, ZSTD_LIT_RLE, ZSTD_LIT_HUFF): Don't define.
	(struct elf_zstd_literals): Don't define.
	(elf_zstd_literal_output): Remove static function.
	(elf_zstd_decompress): Use elf_fetch_backward_init and
	elf_zstd_read_literals.  Rewrite literal copying.<
2022-12-16 18:48:04 -08:00
GCC Administrator
5fb1e67453 Daily bump. 2022-12-17 00:17:56 +00:00
Thomas Neumann
6e56633daa initialize fde objects lazily
When registering an unwind frame with __register_frame_info_bases
we currently initialize that fde object eagerly. This has the
advantage that it is immutable afterwards and we can safely
access it from multiple threads, but it has the disadvantage
that we pay the initialization cost even if the application
never throws an exception.

This commit changes the logic to initialize the objects lazily.
The objects themselves are inserted into the b-tree when
registering the frame, but the sorted fde_vector is
not constructed yet. Only on the first time that an
exception tries to pass through the registered code the
object is initialized. We notice that with a double checking,
first doing a relaxed load of the sorted bit and then re-checking
under a mutex when the object was not initialized yet.

Note that the check must implicitly be safe concering a concurrent
frame deregistration, as trying the deregister a frame that is
on the unwinding path of a concurrent exception is inherently racy.

libgcc/ChangeLog:
	* unwind-dw2-fde.c: Initialize fde object lazily when
	the first exception tries to pass through.
2022-12-17 00:48:25 +01:00
Thomas Neumann
1c118c9970 speed up end_fde_sort using radix sort
When registering a dynamic unwinding frame the fde list is sorted.
Previously, we split the list into a sorted and an unsorted part,
sorted the later using heap sort, and merged both. That can be
quite slow due to the large number of (expensive) comparisons.

This patch replaces that logic with a radix sort instead. The
radix sort uses the same amount of memory as the old logic,
using the second list as auxiliary space, and it includes two
techniques to speed up sorting: First, it computes the pointer
addresses for blocks of values, reducing the decoding overhead.
And it recognizes when the data has reached a sorted state,
allowing for early termination. When running out of memory
we fall back to pure heap sort, as before.

For this test program

\#include <cstdio>
int main(int argc, char** argv) {
     return 0;
}

compiled with g++ -O -o hello -static hello.c we get with
perf stat -r 200 on a 5950X the following performance numbers:

old logic:

              0,20 msec task-clock
           930.834      cycles
         3.079.765      instructions
        0,00030478 +- 0,00000237 seconds time elapsed

new logic:

              0,10 msec task-clock
           473.269      cycles
         1.239.077      instructions
        0,00021119 +- 0,00000168 seconds time elapsed

libgcc/ChangeLog:
	* unwind-dw2-fde.c: Use radix sort instead of split+sort+merge.
2022-12-17 00:48:16 +01:00
John David Anglin
e51c5d5aa2 Update baseline symbols for hppa-linux.
2022-12-16  John David Anglin  <danglin@gcc.gnu.org>

libstdc++-v3/ChangeLog:

	* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update.
2022-12-16 22:23:16 +00:00
John David Anglin
1dea4fc642 Suppress -fstack-protector warning on hppa.
Some package builds enable -fstack-protector and -Werror. Since
-fstack-protector is not supported on hppa because the stack grows
up, these packages must check for the warning generated by
-fstack-protector and suppress it on hppa. This is problematic
since hppa is the only significant architecture where the stack
grows up.

2022-12-16  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.cc (pa_option_override): Disable -fstack-protector.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_static): Return 0
	on hppa*-*-*.
2022-12-16 21:44:40 +00:00
Jonathan Wakely
8d9e2776a6 libstdc++: Add monadic operations to std::expected for C++23 (P2505R5)
This was approved for C++23 last month in Kona.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected): Add monadic operations.
	(expected<void, E>): Likewise.
	* include/std/version (__cpp_lib_expected): Bump value.
	* testsuite/20_util/expected/synopsis.cc: Adjust expected macro
	value.
	* testsuite/20_util/expected/version.cc: Likewise.
	* testsuite/20_util/expected/illformed_neg.cc: Prune additional
	errors from ill-formed monadic operations.
	* testsuite/20_util/expected/observers.cc: Check error_or.
	* testsuite/20_util/expected/monadic.cc: New test.
2022-12-16 20:59:19 +00:00
Jonathan Wakely
59822c3920 libstdc++: Fixes for std::expected
This fixes some bugs in the swap functions for std::expected.

It also disables the noexcept-specifiers for equality operators, because
those are problematic when querying whether a std::expected is equality
comparable. The operator==(const expected<T,E>&, const U&) function is
not constrained, so is viable for comparing expected<T,E> with
expected<void,G>, but then we get an error from the noexcept-specifier.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::_M_swap_val_unex): Guard the
	correct object.
	(expected::swap): Move is_swappable
	requirement from static_assert to constraint.
	(swap): Likewise.
	(operator==): Remove noexcept-specifier.
	* testsuite/20_util/expected/swap.cc: Check swapping of
	types without non-throwing move constructor. Check constraints
	on swap.
	* testsuite/20_util/expected/unexpected.cc: Check constraints on
	swap.
	* testsuite/20_util/expected/equality.cc: New test.
2022-12-16 20:58:09 +00:00
Jonathan Wakely
64c986b495 libstdc++: Diagnose broken allocator rebind members
This adds a static assertion to std::allocator_traits::rebind_alloc to
diagnose violations of the rule that rebinding an allocator to its own
value type yields the same allocator type.

This helps to catch the easy mistake of deriving from std::allocator but
forgetting to override the rebind behaviour (no longer an issue in C++20
as std::allocator doesn't have a rebind member that can be inherited).
It also catches bugs like in 23_containers/vector/52591.cc where a typo
means the rebound allocator is a completely different type.

I initially wanted to put this static assert into the body of
allocator_traits:

      static_assert(is_same<rebind_alloc<value_type>, _Alloc>::value,
		    "rebind_alloc<value_type> must be Alloc");

However, this causes a regression in the test for PR libstdc++/72792.
It seems that instantiating std::allocator_traits should be allowed for
invalid allocator types as long as you don't try to rebind them. To
support that, only assert in the __allocator_traits_base::__rebind class
template (in both the primary template and the partial specialization).
As a result, the bug in 20_util/scoped_allocator/outermost.cc is not
diagnosed, because nothing in that test rebinds the allocator.

libstdc++-v3/ChangeLog:

	* include/bits/alloc_traits.h (__allocator_traits_base::__rebind):
	Add static assert for rebind requirement.
	* testsuite/20_util/allocator_traits/members/rebind_alloc.cc:
	Fix invalid rebind member in test allocator.
	* testsuite/20_util/allocator_traits/requirements/rebind_neg.cc:
	New test.
	* testsuite/20_util/scoped_allocator/outermost.cc: Add rebind to
	test allocator.
	* testsuite/23_containers/forward_list/48101_neg.cc: Prune new
	static assert error.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/48101_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/52591.cc: Fix typo in rebind.
2022-12-16 20:58:09 +00:00