François Dumont [Wed, 4 Jan 2023 18:34:21 +0000 (19:34 +0100)]
libstdc++: Optimize basic_string move assignment
Since resolution of Issue 2593 [1] we can consider that equal allocators
before the propagate-on-move-assignment operations will still be equal
afterward.
So we can extend the optimization of transfering the storage of the move-to
instance to the move-from one that is currently limited to always equal
allocators.
[1] https://cplusplus.github.io/LWG/issue2593
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (operator=(basic_string&&)): Transfer move-to
storage to the move-from instance when allocators are equal.
* testsuite/21_strings/basic_string/allocator/char/move_assign.cc (test04):
New test case.
GCC Administrator [Sat, 4 Feb 2023 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Fri, 3 Feb 2023 20:39:16 +0000 (21:39 +0100)]
range-op: Handle op?.undefined_p () in op[12]_range of comparisons [PR108647]
As mentioned in the PR, we ICE because lhs is singleton [0, 0]
or [1, 1] but op2 (or in other cases op1) is undefined and op?.*_bound ()
ICEs on those because there are no pairs for UNDEFINED.
The following patch makes us set r to varying or return false in those
cases.
2023-02-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/108647
* range-op.cc (operator_equal::op1_range,
operator_not_equal::op1_range): Don't test op2 bound
equality if op2.undefined_p (), instead set_varying.
(operator_lt::op1_range, operator_le::op1_range,
operator_gt::op1_range, operator_ge::op1_range): Return false if
op2.undefined_p ().
(operator_lt::op2_range, operator_le::op2_range,
operator_gt::op2_range, operator_ge::op2_range): Return false if
op1.undefined_p ().
* g++.dg/torture/pr108647.C: New test.
Jakub Jelinek [Fri, 3 Feb 2023 20:37:27 +0000 (21:37 +0100)]
fortran: Fix up hash table usage in gfc_trans_use_stmts [PR108451]
The first testcase in the PR (which I haven't included in the patch because
it is unclear to me if it is supposed to be valid or not) ICEs since extra
hash table checking has been added recently. The problem is that
gfc_trans_use_stmts does
tree *slot = entry->decls->find_slot_with_hash (rent->use_name, hash,
INSERT);
if (*slot == NULL)
and later on doesn't store anything into *slot and continues. Another spot
a few lines later correctly clears the slot if it decides not to use the
slot, so the following patch does the same.
2023-02-03 Jakub Jelinek <jakub@redhat.com>
PR fortran/108451
* trans-decl.cc (gfc_trans_use_stmts): Call clear_slot before
doing continue.
Aldy Hernandez [Thu, 2 Feb 2023 17:08:44 +0000 (18:08 +0100)]
irange: Compare nonzero bits in irange with widest_int [PR108639]
The problem here is we are trying to compare two ranges with different
precisions and the == operator in wide_int is complaining.
Interestingly, the problem is not the nonzero bits, but the fact that
the entire ranges have different precisions. The reason we don't ICE
when comparing the sub-ranges, is because the code in
irange::operator== works on trees, and tree_int_cst_equal is
promoting the comparison to a widest int:
if (TREE_CODE (t1) == INTEGER_CST
&& TREE_CODE (t2) == INTEGER_CST
&& wi::to_widest (t1) == wi::to_widest (t2))
return 1;
This is why we don't see the ICE until the nonzero bits comparison is
done on wide ints. I think we should maintain the current equality
behavior, and follow suit in the nonzero bit comparison.
I have also fixed the legacy equality code, even though technically
nonzero bits shouldn't appear in legacy. But better safe than sorry.
PR tree-optimization/108639
gcc/ChangeLog:
* value-range.cc (irange::legacy_equal_p): Compare nonzero bits as
widest_int.
(irange::operator==): Same.
Aldy Hernandez [Fri, 3 Feb 2023 16:28:52 +0000 (17:28 +0100)]
range-ops: Handle undefined ranges in frange op[12]_range [PR108647]
This patch gracefully handles undefined operand ranges for the floating
point op[12]_range operators. This is very low risk, as we would have
ICEd otherwise.
We don't have a testcase that ICEs for floating point ranges, but it's
only a matter of time. Besides, this dovetails nicely with the integer
versions Jakub is testing.
gcc/ChangeLog:
PR tree-optimization/108647
* range-op-float.cc (foperator_lt::op1_range): Handle undefined ranges.
(foperator_lt::op2_range): Same.
(foperator_le::op1_range): Same.
(foperator_le::op2_range): Same.
(foperator_gt::op1_range): Same.
(foperator_gt::op2_range): Same.
(foperator_ge::op1_range): Same.
(foperator_ge::op2_range): Same.
(foperator_unordered_lt::op1_range): Same.
(foperator_unordered_lt::op2_range): Same.
(foperator_unordered_le::op1_range): Same.
(foperator_unordered_le::op2_range): Same.
(foperator_unordered_gt::op1_range): Same.
(foperator_unordered_gt::op2_range): Same.
(foperator_unordered_ge::op1_range): Same.
(foperator_unordered_ge::op2_range): Same.
Andrew MacLeod [Wed, 1 Feb 2023 16:46:18 +0000 (11:46 -0500)]
Reset SCEV before removing unreachable globals.
SCEV should be reset in VRP before trying to remove unreachable globals
to avoid triggering issues with it's cache.
PR tree-optimization/107570
gcc/
* tree-vrp.cc (remove_and_update_globals): Reset SCEV.
gcc/testsuite/
* gcc.dg/pr107570.c: New.
Marek Polacek [Mon, 30 Jan 2023 14:02:00 +0000 (09:02 -0500)]
c++: wrong error with constexpr array and value-init [PR108158]
In this test case, we find ourselves evaluating 't' which is
((const struct carray *) this)->data_[VIEW_CONVERT_EXPR<long int>(index)]
in cxx_eval_array_reference. ctx->object is non-null, a RESULT_DECL, so
we replace it with 't':
new_ctx.object = t; // result_decl replaced
and then we go to cxx_eval_constant_expression to evaluate an
AGGR_INIT_EXPR, where we end up evaluating an INIT_EXPR (which is in the
body of the constructor for seed_or_index):
((struct seed_or_index *) this)->value_ = NON_LVALUE_EXPR <0>
whereupon in cxx_eval_store_expression we go to the probe loop
where the 'this' is evaluated to
ze_set.tables_.first_table_.data_[0]
so the 'object' is ze_set, but that isn't in ctx->global->get_value_ptr
so we fail with a bogus error. ze_set is not there because it comes
from a different constexpr context (it's not in cv_cache either).
The problem started with r12-2304 where I added the new_ctx.object
replacement. That was to prevent a type mismatch: the type of 't'
and ctx.object were different.
It seems clear that we shouldn't have replaced ctx.object here.
The cxx_eval_array_reference I mentioned earlier is called from
cxx_eval_store_expression:
6257 init = cxx_eval_constant_expression (&new_ctx, init, vc_prvalue,
6258 non_constant_p, overflow_p);
which already created a new context, whose .object we should be
using unless, for instance, INIT contained a.b and we're evaluating
the 'a' part, which I think was the case for r12-2304; in that case
ctx.object has to be something different.
It no longer seems necessary to replace new_ctx.object (likely due to
changes in empty class handling).
PR c++/108158
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_array_reference): Don't replace
new_ctx.object.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/constexpr-108158.C: New test.
Marek Polacek [Fri, 3 Feb 2023 18:45:10 +0000 (13:45 -0500)]
c++: Add fixed test [PR101071]
As a happy accident, this was fixed by the recent r13-2978.
PR c++/101071
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/variadic-alias8.C: New test.
Samuel Thibault [Fri, 7 Oct 2022 20:45:06 +0000 (22:45 +0200)]
libstdc++: Mark pieces of gnu-linux/os_support.h linux-specific
This is notably needed because in glibc 2.34, the move of pthread functions
into libc.so happened for Linux only, not GNU/Hurd.
The pthread_self() function can also always be used fine as it is on
GNU/Hurd.
libstdc++-v3/ChangeLog:
* config/os/gnu-linux/os_defines.h [!__linux__]
(_GLIBCXX_NATIVE_THREAD_ID, _GLIBCXX_GTHREAD_USE_WEAK): Do not define.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Gaius Mulley [Fri, 3 Feb 2023 16:35:22 +0000 (16:35 +0000)]
[modula-2] Bugfix to allow html doc build and simplify target dir creation
This patch allows the m2 html documentation to be built.
It also simplifies all calls to $(mkinstalldirs) using $(@D) in
gcc/m2/Make-lang.in.
gcc/ChangeLog:
* doc/gm2.texi (Internals): Remove from menu.
(Using): Comment out ifnohtml conditional.
(Documentation): Use gcc url.
(License): Node simplified.
(Copying): New node. Include gpl_v3_without_node.
(Contributing): Node simplified.
(Internals): Commented out.
(Libraries): Node simplified.
(Indices): Ditto.
(Contents): Ditto.
(Functions): Ditto.
gcc/m2/ChangeLog:
* Make-lang.in (TEXISRC): Remove m2/images/gnu.eps.
(RSTSRC): Remove m2/images/gnu.eps.
(doc/m2.dvi): Add $(objdir)/m2/images/gnu.eps.
(doc/m2.pdf): Add $(objdir)/m2/images/gnu.eps.
(M2_PDFFILES): New definition.
(m2.install-pdf): New rule.
(m2.pod): Add $(objdir)/m2/images/gnu.eps.
(m2.info): Add $(objdir)/m2/images/gnu.eps.
(m2.html): New rule.
(m2/gpl_v3_without_node.texi): New rule.
(plugin/m2rte$(soext)): Simplify mkinstalldirs.
(cc1gm2$(exeext)): Ditto.
(m2/stage1/cc1gm2$(exeext)): Ditto.
(m2/gm2-gcc/%.o): Ditto.
(m2/gm2-gcc/rtegraph.o): Ditto.
(m2/gm2-gcc/$(SRC_PREFIX)%.h): Ditto.
(m2/mc-boot/$(SRC_PREFIX)%.o):Ditto.
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
(m2/mc-boot/main.o): Ditto.
(m2/gm2-libs-boot/%.o): Ditto.
(m2/gm2-libs-boot/$(SRC_PREFIX)%.h): Ditto.
(m2/gm2-libs-boot/RTcodummy.o): Ditto.
(m2/gm2-libs-boot/wrapc.o): Ditto.
(m2/gm2-libs-boot/M2LINK.o): Ditto.
(m2/gm2-libs-boot/UnixArgs.o): Ditto.
(m2/gm2-libs-boot/choosetemp.o): Ditto.
(m2/gm2-libs-boot/errno.o): Ditto.
(m2/gm2-libs-boot/dtoa.o): Ditto.
(m2/gm2-libs-boot/ldtoa.o): Ditto.
(m2/gm2-libs-boot/termios.o): Ditto.
(m2/gm2-libs-boot/SysExceptions.o): Ditto.
(m2/gm2-libs-boot/SysStorage.o): Ditto.
(m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto.
(m2/gm2-compiler-boot/M2Error.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.
(m2/gm2-compiler-boot/$(SRC_PREFIX)%.h): Ditto.
(m2/gm2-compiler-boot/m2flex.o): Ditto.
(m2/gm2-compiler/m2flex.c): Ditto.
(m2/gm2-libiberty/$(SRC_PREFIX)%.h): Ditto.
(m2/gm2-compiler/%.o): Ditto.
(m2/gm2-compiler/m2flex.o): Ditto.
(m2/gm2-compiler/%.o): Ditto.
(m2/gm2-libs-iso/%.o): Ditto.
(m2/gm2-libs/gm2-libs-host.h): Ditto.
($(objdir)/m2/gm2-libs-min/SYSTEM.def): Ditto.
($(objdir)/m2/gm2-libs/SYSTEM.def): Ditto.
($(objdir)/m2/gm2-libs-iso/SYSTEM.def): Ditto.
($(objdir)/m2/gm2-libs-coroutines/SYSTEM.def): Ditto.
(m2/gm2-compiler/gm2.a): Ditto.
(m2/gm2-libs-boot/libgm2.a): Ditto.
(m2/gm2-compiler-boot/gm2.a): Ditto.
(m2/boot-bin/mklink$(exeext)): Ditto.
(m2/gm2-compiler-boot/$(SRC_PREFIX)%.h): Ditto.
(m2/gm2-compiler/%.mod): Ditto.
(m2/gm2-compiler-boot/%.mod): Ditto.
(m2/pge-boot/%.o): Ditto.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Patrick Palka [Fri, 3 Feb 2023 15:52:18 +0000 (10:52 -0500)]
libstdc++: Implement ranges::find_last{,_if,_if_not} from P1223R5
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__find_last_fn, find_last):
Define.
(__find_last_if_fn, find_last_if): Define.
(__find_last_if_not_fn, find_last_if_not): Define.
* testsuite/25_algorithms/find_last/1.cc: New test.
* testsuite/25_algorithms/find_last_if/1.cc: New test.
* testsuite/25_algorithms/find_last_if_not/1.cc: New test.
Patrick Palka [Fri, 3 Feb 2023 15:52:15 +0000 (10:52 -0500)]
libstdc++: Implement ranges::iota from P2440R1
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (out_value_result): Define.
(iota_result): Define.
(__iota_fn, iota): Define.
* testsuite/25_algorithms/iota/1.cc: New test.
Patrick Palka [Fri, 3 Feb 2023 15:52:13 +0000 (10:52 -0500)]
libstdc++: Implement ranges::contains/contains_subrange from P2302R4
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__contains_fn, contains): Define.
(__contains_subrange_fn, contains_subrange): Define.
* testsuite/25_algorithms/contains/1.cc: New test.
* testsuite/25_algorithms/contains_subrange/1.cc: New test.
Christophe Lyon [Mon, 30 Jan 2023 16:30:12 +0000 (17:30 +0100)]
arm: [MVE] Add missing length=8 attribute
I have noticed that the "length" "8" attribute is missing in a few
patterns in mve.md.
gcc/
* config/arm/mve.md (mve_vabavq_p_<supf><mode>): Add length
attribute.
(mve_vqshluq_m_n_s<mode>): Likewise.
(mve_vshlq_m_<supf><mode>): Likewise.
(mve_vsriq_m_n_<supf><mode>): Likewise.
(mve_vsubq_m_<supf><mode>): Likewise.
Christophe Lyon [Mon, 30 Jan 2023 16:39:22 +0000 (17:39 +0100)]
arm: Fix warning in libgcc/config/arm/pr-support.c
I have noticed some warnings when building GCC for arm-eabi:
pr-support.c:110:7: warning: variable ‘set_pac_sp’ set but not used [-Wunused-but-set-variable]
pr-support.c:109:7: warning: variable ‘set_pac’ set but not used [-Wunused-but-set-variable]
This small patch avoids them by defining these two variables undef
TARGET_HAVE_PACBTI, like the code which actually uses them.
libgcc/
* config/arm/pr-support.c (__gnu_unwind_execute): Use
TARGET_HAVE_PACBTI to define set_pac and set_pac_sp.
Patrick Palka [Fri, 3 Feb 2023 14:41:10 +0000 (09:41 -0500)]
c++: unexpected ADDR_EXPR after overload set pruning [PR107461]
Here the ahead-of-time overload set pruning in finish_call_expr is
unintentionally returning a CALL_EXPR whose (pruned) callee is wrapped
in an ADDR_EXPR, despite the original callee not being wrapped in an
ADDR_EXPR. This ends up causing a bogus declaration mismatch error in
the below testcase because the call to min in #1 gets expressed as a
CALL_EXPR of ADDR_EXPR of FUNCTION_DECL, whereas the level-lowered call
to min in #2 gets expressed instead as a CALL_EXPR of FUNCTION_DECL.
This patch fixes this by stripping the spurious ADDR_EXPR appropriately.
Thus the first call to min now also gets expressed as a CALL_EXPR of
FUNCTION_DECL, matching the behavior before r12-6075-g2decd2cabe5a4f.
PR c++/107461
gcc/cp/ChangeLog:
* semantics.cc (finish_call_expr): Strip ADDR_EXPR from
the selected callee during overload set pruning.
gcc/testsuite/ChangeLog:
* g++.dg/template/call9.C: New test.
Patrick Palka [Fri, 3 Feb 2023 14:15:29 +0000 (09:15 -0500)]
c++: ICE on unviable/ambiguous constrained dtors [PR96745]
Here we're crashing from check_bases_and_members due to
CLASSTYPE_DESTRUCTOR being an OVERLOAD which, due to the pruning
performed by add_method, should only happen if there is no viable
destructor or the destructor is ambiguous because of unsatisfied
or ambiguous constraints.
This patch fixes this by making check_bases_and_members naturally handle
CLASSTYPE_DESTRUCTOR being an OVERLOAD. It's then convenient to prune
the OVERLOAD after effectively diagnosing the overload resolution
failure in check_methods.
PR c++/96745
gcc/cp/ChangeLog:
* class.cc (check_methods): Diagnose an unviable OVERLOAD
set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one.
Then prune the OVERLOAD to a single function.
(check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being
an OVERLOAD when calling deduce_noexcept_on_destructor.
Document why it has to be called before check_methods.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-dtor1.C: New test.
Patrick Palka [Fri, 3 Feb 2023 14:12:31 +0000 (09:12 -0500)]
c++: excessive satisfaction in check_methods [PR108579]
In check_methods we're unnecessarily checking satisfaction for all
constructors and assignment operators, even those that don't look like
copy/move special members. In the testcase below this manifests as an
unstable satisfaction error because the satisfaction result is first
determined to be false during check_methods (since A<int> is incomplete
at this point) and later true after completion of A<int>.
This patch fixes this simply by swapping the order of the
constraint_satisfied_p and copy/move_fn_p tests.
PR c++/108579
gcc/cp/ChangeLog:
* class.cc (check_methods): Swap order of constraints_satisfied_p
and copy/move_fn_p tests.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-pr108579.C: New test.
Martin Jambor [Fri, 3 Feb 2023 12:28:24 +0000 (13:28 +0100)]
ipa: Avoid invalid gimple when IPA-CP and IPA-SRA disagree on types (108384)
When the compiled program contains type mismatches between callers and
callees when it comes to a parameter, IPA-CP can try to propagate one
constant from callers while IPA-SRA may try to split a parameter
expecting a value of a different size on the same offset. This then
currently leads to creation of a VIEW_CONVERT_EXPR with mismatching
type sizes of LHS and RHS which is correctly flagged by the GIMPLE
verifier as invalid.
It seems that the best course of action is to try and avoid the
situation altogether and so this patch adds a check to IPA-SRA that
peeks into the result of IPA-CP and when it sees a value on the same
offset but with a mismatching size, it just decides to leave that
particular parameter be.
gcc/ChangeLog:
2023-02-02 Martin Jambor <mjambor@suse.cz>
PR ipa/108384
* ipa-sra.cc (push_param_adjustments_for_index): Remove a size check
when comparing to an IPA-CP value.
(dump_list_of_param_indices): New function.
(adjust_parameter_descriptions): Check for mismatching IPA-CP values.
Dump removed candidates using dump_list_of_param_indices.
* ipa-param-manipulation.cc
(ipa_param_body_adjustments::modify_expression): Add assert checking
sizes of a VIEW_CONVERT_EXPR will match.
(ipa_param_body_adjustments::modify_assignment): Likewise.
gcc/testsuite/ChangeLog:
2023-02-02 Martin Jambor <mjambor@suse.cz>
PR ipa/108384
* gcc.dg/ipa/pr108384.c: New test.
Tobias Burnus [Fri, 3 Feb 2023 10:31:53 +0000 (11:31 +0100)]
libgomp: Fix reverse offload issues
If there is nothing to map, skip the mapping and avoid attempting to
copy 0 bytes from addrs, sizes and kinds.
Additionally, it could happen that a non-allocated address was deallocated,
such as a pointer set, leading to a free for the actual data.
libgomp/
* target.c (gomp_target_rev): Handle mapnum == 0 and avoid
freeing not allocated memory.
* testsuite/libgomp.fortran/reverse-offload-6.f90: New test.
Tobias Burnus [Fri, 3 Feb 2023 07:33:17 +0000 (08:33 +0100)]
libgomp: enable reverse offload for AMDGCN
libgomp/ChangeLog:
* libgomp.texi (5.0 Impl. Status, gcn specifics): Update for
reverse offload.
* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept
reverse-offload requirement.
Monk Chiang [Fri, 3 Feb 2023 04:58:51 +0000 (12:58 +0800)]
RISC-V: Remove unnecessary register class.
Avoid VL_REGS, VTYPE_REGS join register allocation.
gcc/ChangeLog:
* config/riscv/riscv.h: Remove VL_REGS, VTYPE_REGS class.
* config/riscv/riscv.cc: Ditto.
Ju-Zhe Zhong [Wed, 1 Feb 2023 01:47:33 +0000 (09:47 +0800)]
RISC-V: Fix constraint bug for binary operation
Current constraint configuration will generate:
vadd.vv v0,v24,v25,v0.t
vsll.vx v0,v24,a5,v0.t
They are incorrect according to RVV ISA.
This patch fix this obvious issue.
gcc/ChangeLog:
* config/riscv/vector-iterators.md (sll.vi): Fix constraint bug.
(sll.vv): Ditto.
(%3,%4): Ditto.
(%3,%v4): Ditto.
* config/riscv/vector.md: Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/binop_vv_constraint-1.c:
* gcc.target/riscv/rvv/base/shift_vx_constraint-1.c:
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:20:56 +0000 (06:20 +0800)]
RISC-V: Add vsll.vx C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vsll_vx-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vx-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vx-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vx_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:19:43 +0000 (06:19 +0800)]
RISC-V: Add vsra.vx C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vsra_vx-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vx-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vx-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vx_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:17:52 +0000 (06:17 +0800)]
RISC-V: Add vsrl.vx C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vsrl_vx-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsrl_vx_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:15:13 +0000 (06:15 +0800)]
RISC-V: Add shift constraint tests
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/shift_vx_constraint-1.c: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:13:25 +0000 (06:13 +0800)]
RISC-V: Add vsll.vx C++ API tests
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/vsll_vx-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsll_vx_tumu-3.c: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:11:10 +0000 (06:11 +0800)]
RISC-V: Add vsra.vx C API tests
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/vsra_vx-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsra_vx_tumu-3.c: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:09:58 +0000 (06:09 +0800)]
RISC-V: Add vsrl.vx C API tests
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/vsrl_vx-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_m-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_m-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_m-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_mu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_mu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_mu-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tu-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tum-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tum-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tum-3.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tumu-1.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tumu-2.c: New test.
* gcc.target/riscv/rvv/base/vsrl_vx_tumu-3.c: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 22:07:24 +0000 (06:07 +0800)]
RISC-V: Add RVV shift.vx C/C++ API support
gcc/ChangeLog:
* config/riscv/predicates.md (pmode_reg_or_uimm5_operand): New predicate.
* config/riscv/riscv-vector-builtins-bases.cc: New class.
* config/riscv/riscv-vector-builtins-functions.def (vsll): Ditto.
(vsra): Ditto.
(vsrl): Ditto.
* config/riscv/riscv-vector-builtins.cc: Ditto.
* config/riscv/vector.md (@pred_<optab><mode>_scalar): New pattern.
GCC Administrator [Fri, 3 Feb 2023 00:16:44 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Thu, 2 Feb 2023 23:29:45 +0000 (23:29 +0000)]
c: Update nullptr_t comparison checks
WG14 has agreed to allow equality comparisons between pointers and
nullptr_t values that are not null pointer constants (this was
previously an exceptional case where such nullptr_t values were
handled differently from null pointer constants; other places in the
standard allowed nullptr_t values, whether or not those values are
null pointer constants, in the same contexts as null pointer
constants); see the wording at the end of N3077. Update GCC's
implementation to match this change.
There are also changes to allow null pointer constants of integer or
pointer type to be converted to nullptr_t (by assignment, cast or
conversion as if by assignment), which I'll deal with separately.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c/
* c-typeck.cc (build_binary_op): Allow comparisons between
pointers and nullptr_t values that are not null pointer constants.
gcc/testsuite/
* gcc.dg/c2x-constexpr-3.c: Do not expect comparison of nullptr_t
and pointer to be disallowed.
* gcc.dg/c2x-nullptr-1.c: Test comparisons of nullptr_t and
pointers are allowed.
* gcc.dg/c2x-nullptr-3.c: Do not test that comparisons of
nullptr_t and pointers are disallowed.
Gerald Pfeifer [Thu, 2 Feb 2023 21:55:17 +0000 (22:55 +0100)]
libstdc++: Tweak link to ABIcheck project
libstdc++-v3/ChangeLog:
* doc/xml/manual/abi.xml: Tweak link to ABIcheck project.
* doc/html/manual/abi.html: Regenerate.
Joseph Myers [Thu, 2 Feb 2023 20:07:08 +0000 (20:07 +0000)]
c: Update checks on constexpr floating-point initializers
WG14 has agreed some changes (detailed at the end of N3082) to the
rules on constexpr initializers for floating types. Update GCC's
implementation to match: binary initializers are now allowed for
decimal types, and real initializers for complex types, but signaling
NaN initializers can't be used for a different type with the same
mode.
There are also changes to the constexpr rules for pointer types
(allowing null pointer address constants that aren't null pointer
constants), which I'll deal with separately.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c/
* c-typeck.cc: Include "realmpfr.h".
(constexpr_init_fits_real_type): Do not allow signaling NaN
conversions to different types with the same mode. Handle
conversions from binary to decimal types.
(check_constexpr_init): Do not disallow real initializers for
complex types. Do not disallow binary initializers for decimal
floating types.
gcc/testsuite/
* gcc.dg/c2x-constexpr-1.c: Test constexpr initializers of complex
types with real initializers are allowed.
* gcc.dg/c2x-constexpr-3.c: Do not test for constexpr initializers
of complex types with real initializers being disallowed.
* gcc.dg/c2x-constexpr-8.c: Add tests of signaling NaN complex
initializers.
* gcc.dg/c2x-constexpr-9.c: Add more tests.
* gcc.dg/dfp/c2x-constexpr-dfp-1.c: Add tests of binary floating
initializers for decimal types.
* gcc.dg/dfp/c2x-constexpr-dfp-2.c: Change tests of binary
initializers for decimal types. Add more tests of decimal
initializers for binary types.
Jonathan Wakely [Thu, 2 Feb 2023 16:00:21 +0000 (16:00 +0000)]
libstdc++: Use ENOSYS for unsupported filesystem ops on AVR
Because avr-libc <errno.h> defines most error numbers with duplicate
values it's not sufficient to check #ifdef ENOTSUP when deciding which
std::errc constant to use for the filesystem library's __unsupported()
helper. Add a special case for AVR to always use the ENOSYS value.
libstdc++-v3/ChangeLog:
* src/filesystem/ops-common.h [AVR] (__unsupported): Always use
errc::function_not_supported instead of errc::not_supported.
Jonathan Wakely [Tue, 31 Jan 2023 22:32:15 +0000 (22:32 +0000)]
libstdc++: Define std::basic_stringbuf::view() for old std::string ABI
Unlike the new str()&& members in <sstream>, there is no real difficulty
in supporting the new view() members for the old std::string ABI.
Enabling it fixes errors in <chrono> where std::ostringstream::view() is
used by ostream insertion operators for calendar types.
We just need to use [[gnu::always_inline]] on the view() members for the
old ABI, because the library doesn't contain instantiations of them for
the old ABI. Making them always inline avoids needing to add those
instantiations and export them.
libstdc++-v3/ChangeLog:
* include/std/sstream (basic_stringbuf::view): Define for old
std::string ABI.
(basic_istringstream::view, basic_0stringstream::view)
(basic_stringstream::view): Likewise.
* testsuite/27_io/basic_istringstream/view/char/1.cc: Remove
{ dg-require-effective-target cxx11_abi }.
* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_stringbuf/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc:
Likewise.
Jonathan Wakely [Thu, 2 Feb 2023 14:06:40 +0000 (14:06 +0000)]
libstdc++: Fix std::filesystem errors with -fkeep-inline-functions [PR108636]
With -fkeep-inline-functions there are linker errors when including
<filesystem>. This happens because there are some filesystem::path
constructors defined inline which call non-exported functions defined in
the library. That's usually not a problem, because those constructors
are only called by code that's also inside the library. But when the
header is compiled with -fkeep-inline-functions those inline functions
are emitted even though they aren't called. That then creates an
undefined reference to the other library internsl. The fix is to just
move the private constructors into the library where they are called.
That way they are never even seen by users, and so not compiled even if
-fkeep-inline-functions is used.
On trunk there is a second problem, which is that the new equality
operators for comparing directory iterators with default_sentinel use
the shared_ptr::operator bool() conversion operator. The shared_ptr
specializations used by directory iterators are explicitly instantiated
in the library, but the bool conversion operators are not exported. This
causes linker errors at -O0 or with -fkeep-inline-functions. That just
requires the conversion operators to be exported.
libstdc++-v3/ChangeLog:
PR libstdc++/108636
* config/abi/pre/gnu.ver (GLIBCXX_3.4.31): Export shared_ptr
conversion operators for directory iterator comparisons with
std::default_sentinel_t.
* include/bits/fs_path.h (path::path(string_view, _Type))
(path::_Cmpt::_Cmpt(string_view, _Type, size_t)): Move inline
definitions to ...
* src/c++17/fs_path.cc: ... here.
* testsuite/27_io/filesystem/path/108636.cc: New test.
Jonathan Wakely [Wed, 1 Feb 2023 20:54:22 +0000 (20:54 +0000)]
libstdc++: Use emplace in std::variant::operator=(T&&) as per LWG 3585
This was approved at the October 2021 plenary.
libstdc++-v3/ChangeLog:
* include/std/variant (variant::operator=): Implement resolution
of LWG 3585.
* testsuite/20_util/variant/lwg3585.cc: New test.
Iain Sandoe [Sun, 22 Jan 2023 21:12:15 +0000 (21:12 +0000)]
driver, toplevel: Avoid emitting the version information twice.
For a regular compile job, with -v we emit the GCC version information
twice - once from main() and once from process_options().
We do not need to output the second header.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* toplev.cc (toplev::main): Only print the version information header
from toplevel main().
Paul-Antoine Arras [Wed, 1 Feb 2023 15:13:23 +0000 (16:13 +0100)]
amdgcn: Add instruction pattern for conditional shift operations
gcc/ChangeLog:
* config/gcn/gcn-valu.md (cond_<expander><mode>): Add
cond_{ashl|ashr|lshr}
gcc/testsuite/ChangeLog:
* gcc.target/gcn/cond_shift_3.c: New test.
* gcc.target/gcn/cond_shift_3_run.c: New test.
* gcc.target/gcn/cond_shift_4.c: New test.
* gcc.target/gcn/cond_shift_4_run.c: New test.
* gcc.target/gcn/cond_shift_8.c: New test.
* gcc.target/gcn/cond_shift_8_run.c: New test.
* gcc.target/gcn/cond_shift_9.c: New test.
* gcc.target/gcn/cond_shift_9_run.c: New test.
Richard Sandiford [Thu, 2 Feb 2023 14:53:34 +0000 (14:53 +0000)]
rtl-ssa: Extend m_num_defs to a full unsigned int [PR108086]
insn_info tried to save space by storing the number of
definitions in a 16-bit bitfield. The justification was:
// ... FIRST_PSEUDO_REGISTER + 1
// is the maximum number of accesses to hard registers and memory, and
// MAX_RECOG_OPERANDS is the maximum number of pseudos that can be
// defined by an instruction, so the number of definitions should fit
// easily in 16 bits.
But while that reasoning holds (I think) for real instructions,
it doesn't hold for artificial instructions. I don't think there's
any sensible higher limit we can use, so this patch goes for a full
unsigned int.
gcc/
PR rtl-optimization/108086
* rtl-ssa/insns.h (insn_info): Make m_num_defs a full unsigned int.
Adjust size-related commentary accordingly.
Richard Sandiford [Thu, 2 Feb 2023 14:53:34 +0000 (14:53 +0000)]
rtl-ssa: Fix splitting of clobber groups [PR108508]
Since rtl-ssa isn't a real/native SSA representation, it has
to honour the constraints of the underlying rtl representation.
Part of this involves maintaining an rpo list of definitions
for each rtl register, backed by a splay tree where necessary
for quick lookup/insertion.
However, clobbers of a register don't act as barriers to
other clobbers of a register. E.g. it's possible to move one
flag-clobbering instruction across an arbitrary number of other
flag-clobbering instructions. In order to allow passes to do
that without quadratic complexity, the splay tree groups all
consecutive clobbers into groups, with only the group being
entered into the splay tree. These groups in turn have an
internal splay tree of clobbers where necessary.
This means that, if we insert a new definition and use into
the middle of a sea of clobbers, we need to split the clobber
group into two groups. This was quite a difficult condition
to trigger during development, and the PR shows that the code
to handle it had (at least) two bugs.
First, the process involves searching the clobber tree for
the split point. This search can give either the previous
clobber (which will belong to the first of the split groups)
or the next clobber (which will belong to the second of the
split groups). The code for the former case handled the
split correctly but the code for the latter case didn't.
Second, I'd forgotten to add the second clobber group to the
main splay tree. :-(
gcc/
PR rtl-optimization/108508
* rtl-ssa/accesses.cc (function_info::split_clobber_group): When
the splay tree search gives the first clobber in the second group,
make sure that the root of the first clobber group is updated
correctly. Enter the new clobber group into the definition splay
tree.
gcc/testsuite/
PR rtl-optimization/108508
* gcc.target/aarch64/pr108508.c: New test.
Richard Sandiford [Thu, 2 Feb 2023 14:53:33 +0000 (14:53 +0000)]
testsuite: Add case-values-threshold to pr107876.C
This test was failing on aarch64 because aarch64 overrides
TARGET_CASE_VALUES_THRESHOLD. The maximum value that allows
the test to pass appears to be 6, but the default threshold
is 4 or 5 (depending on whether casesi is provided).
Going for 4 seemed safest, in case any target-specific
features force the maximum passing threshold to be lower
on some targets.
gcc/testsuite/
* g++.dg/tree-ssa/pr107876.C: Add --param case-values-threshold=4.
David Malcolm [Thu, 2 Feb 2023 14:11:36 +0000 (09:11 -0500)]
analyzer: fix -Wanalyzer-fd-type-mismatch false +ve on "listen" [PR108633]
gcc/analyzer/ChangeLog:
PR analyzer/108633
* sm-fd.cc (fd_state_machine::check_for_fd_attrs): Add missing
"continue".
(fd_state_machine::on_listen): Don't issue phase-mismatch or
type-mismatch warnings for the "invalid" state.
gcc/testsuite/ChangeLog:
PR analyzer/108633
* gcc.dg/analyzer/fd-pr108633.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Thu, 2 Feb 2023 14:11:31 +0000 (09:11 -0500)]
analyzer: add deref-before-check-qemu-qtest_rsp_args.c test case
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/deref-before-check-qemu-qtest_rsp_args.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jin Ma [Thu, 2 Feb 2023 11:46:04 +0000 (19:46 +0800)]
RISC-V: Fix bug of TARGET_COMPUTE_MULTILIB implemented in riscv.
MAX_MATCH_SCORE is not assigned anywhere except initialized to 0,
causing BEST_MATCH_MULTI_LIB to always be 0 or -1, which will
cause the result of TARGET_COMPUTE_MULTILIB hook to fail.
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc (riscv_compute_multilib):
Fix finding best match score.
Jakub Jelinek [Thu, 2 Feb 2023 12:52:45 +0000 (13:52 +0100)]
sched-deps, cselib: Fix up some -fcompare-debug issues and regressions [PR108463]
On Sat, Jan 14, 2023 at 08:26:00AM -0300, Alexandre Oliva via Gcc-patches wrote:
> The testcase used to get scheduled differently depending on the
> presence of debug insns with MEMs. It's not clear to me why those
> MEMs affected scheduling, but the cselib pre-canonicalization of the
> MEM address is not used at all when analyzing debug insns, so the
> memory allocation and lookup are pure waste. Somehow, avoiding that
> waste fixes the problem, or makes it go latent.
Unfortunately, this patch breaks the following testcase.
The code in sched_analyze_2 did 2 things:
1) cselib_lookup_from_insn
2) shallow_copy_rtx + cselib_subst_to_values_from_insn
Now, 1) is precondition of 2), we can only subst the VALUEs if we
have actually looked the address up, but as can be seen on that testcase,
we are relying on at least the 1) to be done because we subst the values
later on even on DEBUG_INSNs and actually use those when needed.
cselib_subst_to_values_from_insn mostly just replaces stuff in the
returned rtx, except for:
/* This used to happen for autoincrements, but we deal with them
properly now. Remove the if stmt for the next release. */
if (! e)
{
/* Assign a value that doesn't match any other. */
e = new_cselib_val (next_uid, GET_MODE (x), x);
}
which is like that since 2011, I hope it is never reachable and we should
in stage1 replace that with gcc_assert or just remove (then it will
segfault on following
return e->val_rtx;
).
So, I (as done in the patch below) reinstalled the 1) and not 2) for
DEBUG_INSNs. This fixed the new testcase, but broke again the PR106746
testcases.
I've spent a day debugging that and found the problem is that as documented
in a large comment in cselib.cc above n_useless_values variable definition,
we spend quite a few effort on making sure that VALUEs created on
DEBUG_INSNs don't affect the cselib decisions for non-DEBUG_INSNs such as
pruning of useless values etc., but if a VALUE created that way is then
looked up/needed from non-DEBUG_INSNs, we promote it to non-debug.
The reason for -fcompare-debug failure is that there is one large DEBUG_INSN
with 16 MEMs in it mostly with addresses that so far didn't appear in the IL
otherwise. Later on, we see an instruction storing into MEM destination
and invalidate that MEM. Unfortunately, there is a bug caused by the
introduction of SP_DERIVED_VALUE_P where alias.cc isn't able to disambiguate
MEMs with sp + optional offset in address vs. MEMs with address being a
VALUE having SP_DERIVED_VALUE_P + constant (or the SP_DERIVED_VALUE_P
itself), which ought to be possible when REG_VALUES (REGNO
(stack_pointer_rtx)) has SP_DERIVED_VALUE_P + constant location. Not sure
if I should try to fix that in stage4 or defer for stage1.
Anyway, the cselib_invalidate_mem call because of this invalidates basically
all MEMs with the exception of 5 which have MEM_EXPRs that guarantee
non-aliasing with the sp based store.
Unfortunately, n_useless_values which in my understanding should be always
the same between -g and -g0 compilations diverges, has 3 more useless values
for -g.
Now, these were initially VALUEs created for DEBUG_INSN lookups. As I said,
cselib.cc has code to promote such VALUEs (well, their location elements) to
non-debug if they are looked up from non-DEBUG_INSNs. The problem is that
when looking some completely unrelated MEM from a non-DEBUG_INSN we run into
a hash collision and so call cselib_hasher::equal to check if the unrelated
MEM is equal to the one from DEBUG_INSN only element. The equal static
member function calls rtx_equal_for_cselib_1 and if that returns true,
promotes the location to non-DEBUG, otherwise returns false. So far so
good. But rtx_equal_for_cselib_1 internally performs various other cselib
lookups, all done with the non-DEBUG_INSN cselib_current_insn, so they
all promote to non-debug. And that is wrong, because if it was -g0
compilation, such hashtable entry wouldn't be there at all (or would be
but wouldn't contain that locs element), so with -g0 we wouldn't call
that rtx_equal_for_cselib_1 at all. So, I think we need to pretend
that such lookup which only happens with -g and not -g0 actually comes
from some DEBUG_INSN (note, the lookups rtx_equal_for_cselib_1 does
are always with create = 0).
The cselib.cc part of the patch does that.
BTW, I'm not really sure how:
if (num_mems < param_max_cselib_memory_locations
&& ! canon_anti_dependence (x, false, mem_rtx,
GET_MODE (mem_rtx), mem_addr))
{
has_mem = true;
num_mems++;
p = &(*p)->next;
continue;
}
num_mems cap can actually work correctly for -fcompare-debug,
I'd think we would need to differentiate between num_debug_mems and
num_mems depending on if setting_insn is non-NULL DEBUG_INSN or not.
That was one of my suspicions on this testcase, but the number of MEMs
was small enough for the param in either case (especially because of
the above mentioned missed non-aliasings). But as implemented, I think
if we have tons of non-aliased MEMs from DEBUG_INSN setting_insns,
we could unchain lots more non-DEBUG MEMs with -g than with -g0.
2023-02-02 Jakub Jelinek <jakub@redhat.com>
PR debug/106746
PR rtl-optimization/108463
PR target/108484
* cselib.cc (cselib_current_insn): Move declaration earlier.
(cselib_hasher::equal): For debug only locs, temporarily override
cselib_current_insn to their l->setting_insn for the
rtx_equal_for_cselib_1 call, so that unsuccessful comparisons don't
promote some debug locs.
* sched-deps.cc (sched_analyze_2) <case MEM>: For MEMs in DEBUG_INSNs
when using cselib call cselib_lookup_from_insn on the address but
don't substitute it.
* gcc.dg/pr108463.c: New test.
Richard Biener [Thu, 2 Feb 2023 10:09:26 +0000 (11:09 +0100)]
middle-end/108625 - wrong folding due to misinterpreted !
The following fixes a problem with ! handling in genmatch which isn't
conservative enough when intermediate simplifications push to the
sequence but the final operation appears to just pick an existing
(but in this case newly defined in the sequence) operand. The easiest
fix is to disallow adding to the sequence when processing !.
PR middle-end/108625
* genmatch.cc (expr::gen_transform): Also disallow resimplification
from pushing to lseq with force_leaf.
(dt_simplify::gen_1): Likewise.
* gcc.dg/pr108625.c: New testcase.
Andrew Stubbs [Thu, 1 Dec 2022 17:30:21 +0000 (17:30 +0000)]
amdgcn, libgomp: Manually allocated stacks
Switch from using stacks in the "private segment" to using a memory block
allocated on the host side. The primary reason is to permit the reverse
offload implementation to access values located on the device stack, but
there may also be performance benefits, especially with repeated kernel
invocations.
This implementation unifies the stacks with the "team arena" optimization
feature, and now allows both to have run-time configurable sizes.
A new ABI is needed, so all libraries must be rebuilt, and newlib must be
version 4.3.0.
20230120 or newer.
gcc/ChangeLog:
* config/gcn/gcn-run.cc: Include libgomp-gcn.h.
(struct kernargs): Replace the common content with kernargs_abi.
(struct heap): Delete.
(main): Read GCN_STACK_SIZE envvar.
Allocate space for the device stacks.
Write the new kernargs fields.
* config/gcn/gcn.cc (gcn_option_override): Remove stack_size_opt.
(default_requested_args): Remove PRIVATE_SEGMENT_BUFFER_ARG and
PRIVATE_SEGMENT_WAVE_OFFSET_ARG.
(gcn_addr_space_convert): Mask the QUEUE_PTR_ARG content.
(gcn_expand_prologue): Move the TARGET_PACKED_WORK_ITEMS to the top.
Set up the stacks from the values in the kernargs, not private.
(gcn_expand_builtin_1): Match the stack configuration in the prologue.
(gcn_hsa_declare_function_name): Turn off the private segment.
(gcn_conditional_register_usage): Ensure QUEUE_PTR is fixed.
* config/gcn/gcn.h (FIXED_REGISTERS): Fix the QUEUE_PTR register.
* config/gcn/gcn.opt (mstack-size): Change the description.
include/ChangeLog:
* gomp-constants.h (GOMP_VERSION_GCN): Bump.
libgomp/ChangeLog:
* config/gcn/libgomp-gcn.h (DEFAULT_GCN_STACK_SIZE): New define.
(DEFAULT_TEAM_ARENA_SIZE): New define.
(struct heap): Move to this file.
(struct kernargs_abi): Likewise.
* config/gcn/team.c (gomp_gcn_enter_kernel): Use team arena size from
the kernargs.
* libgomp.h: Include libgomp-gcn.h.
(TEAM_ARENA_SIZE): Remove.
(team_malloc): Update the error message.
* plugin/plugin-gcn.c (struct kernargs): Move common content to
struct kernargs_abi.
(struct agent_info): Rename team arenas to ephemeral memories.
(struct team_arena_list): Rename ....
(struct ephemeral_memories_list): to this.
(struct heap): Delete.
(team_arena_size): New variable.
(stack_size): New variable.
(print_kernel_dispatch): Update debug messages.
(init_environment_variables): Read GCN_TEAM_ARENA_SIZE.
Read GCN_STACK_SIZE.
(get_team_arena): Rename ...
(configure_ephemeral_memories): ... to this, and set up stacks.
(release_team_arena): Rename ...
(release_ephemeral_memories): ... to this.
(destroy_team_arenas): Rename ...
(destroy_ephemeral_memories): ... to this.
(create_kernel_dispatch): Add num_threads parameter.
Adjust for kernargs_abi refactor and ephemeral memories.
(release_kernel_dispatch): Adjust for ephemeral memories.
(run_kernel): Pass thread-count to create_kernel_dispatch.
(GOMP_OFFLOAD_init_device): Adjust for ephemeral memories.
(GOMP_OFFLOAD_fini_device): Adjust for ephemeral memories.
gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/pr47237.c: Xfail on amdgcn.
* gcc.dg/builtin-apply3.c: Xfail for amdgcn.
* gcc.dg/builtin-apply4.c: Xfail for amdgcn.
* gcc.dg/torture/stackalign/builtin-apply-3.c: Xfail for amdgcn.
* gcc.dg/torture/stackalign/builtin-apply-4.c: Xfail for amdgcn.
Tobias Burnus [Thu, 2 Feb 2023 11:05:58 +0000 (12:05 +0100)]
libgomp.texi (OpenMP TR11 impl. status): Fix 'strict' item
Fix the 'strict' modifier status: it is already listed (as 'Y') for OpenMP
5.1 for num_task and grainsize; only strict on num_threads is new with TR11.
libgomp/
* libgomp.texi (OpenMP TR11): Fix item for 'strict' modifier.
Andre Vieira [Thu, 2 Feb 2023 10:01:30 +0000 (10:01 +0000)]
arm: Fix MVE predicates synthesis [PR 108443]
This patch fixes the way we synthesize MVE predicate immediates and fixes some
other inconsistencies around predicates. For instance this patch fixes the modes
used in the vctp intrinsics, to couple them with predicate modes with the
appropriate lane numbers. For this V2QI is added to represent a predicate
created by vctp64q. The reason we use V2QI and not for instance a V2BI with
8-bit boolean modes is because we are trying to avoid having two 'INT' modes of
the same size. We make sure we use the V2QI mode instead of HI for any
instruction working on two lanes of 64-bits consuming a predicate.
gcc/ChangeLog:
PR target/108443
* config/arm/arm.h (VALID_MVE_PRED_MODE): Add V2QI.
* config/arm/arm.cc (thumb2_legitimate_address_p): Use HImode for
addressing MVE predicate modes.
(mve_bool_vec_to_const): Change to represent correct MVE predicate
format.
(arm_hard_regno_mode_ok): Use VALID_MVE_PRED_MODE instead of checking
modes.
(arm_vector_mode_supported_p): Likewise.
(arm_mode_to_pred_mode): Add V2QI.
* config/arm/arm-builtins.cc (UNOP_PRED_UNONE_QUALIFIERS): New
qualifier.
(UNOP_PRED_PRED_QUALIFIERS): New qualifier
(BINOP_PRED_UNONE_PRED_QUALIFIERS): New qualifier.
(v2qi_UP): New macro.
(v4bi_UP): New macro.
(v8bi_UP): New macro.
(v16bi_UP): New macro.
(arm_expand_builtin_args): Make it able to expand the new predicate
modes.
* config/arm/arm-modes.def (V2QI): New mode.
* config/arm/arm-simd-builtin-types.def (Pred1x16_t, Pred2x8_t
Pred4x4_t): Remove unused predicate builtin types.
* config/arm/arm_mve.h (__arm_vctp16q, __arm_vctp32q, __arm_vctp64q,
__arm_vctp8q, __arm_vpnot, __arm_vctp8q_m, __arm_vctp64q_m,
__arm_vctp32q_m, __arm_vctp16q_m): Use predicate modes.
* config/arm/arm_mve_builtins.def (vctp16q, vctp32q, vctp64q, vctp8q,
vpnot, vctp8q_m, vctp16q_m, vctp32q_m, vctp64q_m): Likewise.
* config/arm/constraints.md (DB): Check for VALID_MVE_PRED_MODE instead
of MODE_VECTOR_BOOL.
* config/arm/iterators.md (MVE_7, MVE_7_HI): Add V2QI
(MVE_VPRED): Likewise.
(MVE_vpred): Add V2QI and map upper case predicate modes to lower case.
(MVE_vctp): New mode attribute.
(mode1): Remove.
(VCTPQ): Remove.
(VCTPQ_M): Remove.
* config/arm/mve.md (mve_vctp<mode1>qhi): Rename this...
(mve_vctp<MVE_vctp>q<MVE_vpred>): ... to this. And use new mode
attributes.
(mve_vpnothi): Rename this...
(mve_vpnotv16bi): ... to this.
(mve_vctp<mode1>q_mhi): Rename this...
(mve_vctp<MVE_vctp>q_m<MVE_vpred>):... to this.
(mve_vldrdq_gather_base_z_<supf>v2di,
mve_vldrdq_gather_offset_z_<supf>v2di,
mve_vldrdq_gather_shifted_offset_z_<supf>v2di,
mve_vstrdq_scatter_base_p_<supf>v2di,
mve_vstrdq_scatter_offset_p_<supf>v2di,
mve_vstrdq_scatter_offset_p_<supf>v2di_insn,
mve_vstrdq_scatter_shifted_offset_p_<supf>v2di,
mve_vstrdq_scatter_shifted_offset_p_<supf>v2di_insn,
mve_vstrdq_scatter_base_wb_p_<supf>v2di,
mve_vldrdq_gather_base_wb_z_<supf>v2di,
mve_vldrdq_gather_base_nowb_z_<supf>v2di,
mve_vldrdq_gather_base_wb_z_<supf>v2di_insn): Use V2QI insead of HI for
predicates.
* config/arm/unspecs.md (VCTP8Q, VCTP16Q, VCTP32Q, VCTP64Q): Replace
these...
(VCTP): ... with this.
(VCTP8Q_M, VCTP16Q_M, VCTP32Q_M, VCTP64Q_M): Replace these...
(VCTP_M): ... with this.
* config/arm/vfp.md (*thumb2_movhi_vfp, *thumb2_movhi_fp16): Use
VALID_MVE_PRED_MODE instead of checking for MODE_VECTOR_BOOL class.
gcc/testsuite/ChangeLog:
* gcc.target/arm/mve/pr108443-run.c: New test.
* gcc.target/arm/mve/pr108443.c: New test.
Andre Vieira [Thu, 2 Feb 2023 10:01:13 +0000 (10:01 +0000)]
arm: Remove unnecessary zero-extending of MVE predicates before use [PR 107674]
This patch teaches GCC that zero-extending a MVE predicate from 16-bits to
32-bits and then only using 16-bits is a no-op.
It does so in two steps:
- it lets gcc know that it can access any MVE predicate mode using any other MVE
predicate mode without needing to copy it, using the TARGET_MODES_TIEABLE_P hook,
- it teaches simplify_subreg to optimize a subreg with a vector outermode, by
replacing this outermode with a same-sized integer mode and trying the
avalailable optimizations, then if successful it surrounds the result with a
subreg casting it back to the original vector outermode.
gcc/ChangeLog:
PR target/107674
* config/arm/arm.cc (arm_hard_regno_mode_ok): Use new MACRO.
(arm_modes_tieable_p): Make MVE predicate modes tieable.
* config/arm/arm.h (VALID_MVE_PRED_MODE): New define.
* simplify-rtx.cc (simplify_context::simplify_subreg): Teach
simplify_subreg to simplify subregs where the outermode is not scalar.
gcc/testsuite/ChangeLog:
* gcc.target/arm/mve/mve_vpt.c: Change to remove unecessary zero-extend.
Andre Vieira [Thu, 2 Feb 2023 10:00:57 +0000 (10:00 +0000)]
arm: Fix sign of MVE predicate mve_pred16_t [PR 107674]
The ACLE defines mve_pred16_t as an unsigned short. This patch makes sure GCC
treats the predicate as an unsigned type, rather than signed.
gcc/ChangeLog:
PR target/107674
* config/arm/arm-builtins.cc (arm_simd_builtin_type): Rewrite to use
new qualifiers parameter and use unsigned short type for MVE predicate.
(arm_init_builtin): Call arm_simd_builtin_type with qualifiers
parameter.
(arm_init_crypto_builtins): Likewise.
gcc/testsuite/ChangeLog:
PR target/107674
* gcc.target/arm/mve/mve_vpt.c: New test.
Jakub Jelinek [Thu, 2 Feb 2023 09:54:54 +0000 (10:54 +0100)]
Replace IFN_TRAP with BUILT_IN_UNREACHABLE_TRAP [PR107300]
For PR106099 I've added IFN_TRAP as an alternative to __builtin_trap
meant for __builtin_unreachable purposes (e.g. with -funreachable-traps
or some sanitizers) which doesn't need vops because __builtin_unreachable
doesn't need them either. This works in various cases, but unfortunately
IPA likes to decide on the redirection to unreachable just by tweaking
the cgraph edge to point to a different FUNCTION_DECL. As internal
functions don't have a decl, this causes problems like in the following
testcase.
The following patch fixes it by removing IFN_TRAP again and replacing
it with user inaccessible BUILT_IN_UNREACHABLE_TRAP, so that e.g.
builtin_decl_unreachable can return it directly and we don't need to tweak
it later in wherever we actually replace the call stmt.
2023-02-02 Jakub Jelinek <jakub@redhat.com>
PR ipa/107300
* builtins.def (BUILT_IN_UNREACHABLE_TRAP): New builtin.
* internal-fn.def (TRAP): Remove.
* internal-fn.cc (expand_TRAP): Remove.
* tree.cc (build_common_builtin_nodes): Define
BUILT_IN_UNREACHABLE_TRAP if not yet defined.
(builtin_decl_unreachable): Use BUILT_IN_UNREACHABLE_TRAP
instead of BUILT_IN_TRAP.
* gimple.cc (gimple_build_builtin_unreachable): Remove
emitting internal function for BUILT_IN_TRAP.
* asan.cc (maybe_instrument_call): Handle BUILT_IN_UNREACHABLE_TRAP.
* cgraph.cc (cgraph_edge::verify_corresponds_to_fndecl): Handle
BUILT_IN_UNREACHABLE_TRAP instead of BUILT_IN_TRAP.
* ipa-devirt.cc (possible_polymorphic_call_target_p): Handle
BUILT_IN_UNREACHABLE_TRAP.
* builtins.cc (expand_builtin, is_inexpensive_builtin): Likewise.
* tree-cfg.cc (verify_gimple_call,
pass_warn_function_return::execute): Likewise.
* attribs.cc (decl_attributes): Don't report exclusions on
BUILT_IN_UNREACHABLE_TRAP either.
* gcc.dg/pr107300.c: New test.
liuhongt [Wed, 1 Feb 2023 05:30:12 +0000 (13:30 +0800)]
Don't peel nonlinear iv(mult or shift) for epilog when vf is not constant.
Normally when vf is not constant, it will be prevented by
vectorizable_nonlinear_inductions, but for this case, it failed going
into
if (STMT_VINFO_RELEVANT_P (stmt_info))
{
need_to_vectorize = true;
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def
&& ! PURE_SLP_STMT (stmt_info))
ok = vectorizable_induction (loop_vinfo,
stmt_info, NULL, NULL,
&cost_vec);
since the iv is never used outside of the loop, and will be dce later, so
vectorizer doesn't bother checking if it's vectorizable. it's
true but hit gcc_assert in vect_can_peel_nonlinear_iv_p when vf is not
constant. One solution is ignoring the nonlinear iv peeling if it's
!STMT_VINFO_RELEVANT_P (stmt_info) just like the upper code, the other
solution is returning false earlier in the
vect_can_peel_nonlinear_iv_p when vf is not constant, the patch chooses
the second incase there's other cases using vect_can_advance_ivs_p which
calls vect_can_peel_nonlinear_iv_p.
Also remove vect_peel_nonlinear_iv_p from
vectorizable_nonlinear_inductions.
gcc/ChangeLog:
PR tree-optimization/108601
* tree-vectorizer.h (vect_can_peel_nonlinear_iv_p): Removed.
* tree-vect-loop.cc
(vectorizable_nonlinear_induction): Remove
vect_can_peel_nonlinear_iv_p.
(vect_can_peel_nonlinear_iv_p): Don't peel
nonlinear iv(mult or shift) for epilog when vf is not
constant and moved the defination to ..
* tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p):
.. Here.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/pr108601.c: New test.
Jakub Jelinek [Thu, 2 Feb 2023 08:54:18 +0000 (09:54 +0100)]
nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for declare_vars [PR108435]
When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
into a GIMPLE_BIND, but when putting statements directly into
OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
are any temporaries that need to be declared in the sequence).
convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there always
because it called declare_vars on it.
The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
declare_vars on it on demand.
2023-02-02 Jakub Jelinek <jakub@redhat.com>
PR middle-end/108435
* tree-nested.cc (convert_nonlocal_omp_clauses)
<case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and *seq
is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
before calling declare_vars.
(convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
with the OMP_CLAUSE_LASTPRIVATE handling except for whether
seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).
* gcc.dg/gomp/pr108435.c: New test.
Gerald Pfeifer [Thu, 2 Feb 2023 00:50:44 +0000 (01:50 +0100)]
libstdc++: Switch a www.open-std.org link to https
libstdc++-v3/ChangeLog:
* doc/xml/manual/using_exceptions.xml: Update a www.open-std.org
link to https.
* doc/html/manual/using_exceptions.html: Regenerate.
Gerald Pfeifer [Thu, 2 Feb 2023 00:30:02 +0000 (01:30 +0100)]
libstdc++: Fix link to online GDB manual
libstdc++-v3/ChangeLog:
* doc/xml/manual/debug.xml: Fix link to online GDB manual.
* doc/html/manual/debug.html: Regenerate.
GCC Administrator [Thu, 2 Feb 2023 00:17:43 +0000 (00:17 +0000)]
Daily bump.
Jonathan Wakely [Tue, 31 Jan 2023 22:28:16 +0000 (22:28 +0000)]
libstdc++: Fix std::random_device for avr
This fixes a build failure that affects avr, but could affect other
targets in theory. The _M_fini function should not try to use ::open or
::fopen if _GLIBCXX_USE_DEV_RANDOM is not defined, because no file can
ever have been opened.
libstdc++-v3/ChangeLog:
* src/c++11/random.cc (random_device::_M_fini): Do not try to
close the file handle if the target doesn't support the
/dev/random and /dev/urandom files.
Jonathan Wakely [Tue, 31 Jan 2023 22:16:31 +0000 (22:16 +0000)]
libstdc++: Fix build failures for avr
The abr-libc <errno.h> does not define EOVERFLOW, which means that
std::errc::value_too_large is not defined, and so <charconv> cannot be
compiled. Define value_too_large for avr with a value that does not
clash with any that is defined in <errno.h>. This is a kluge to fix
bootstrap for avr; it can be removed after PR libstdc++/104883 is
resolved.
The avr-libc <errno.h> fails to meet the C and POSIX requirements that
each error macro has a distinct integral value, and is usable in #if
directives. Add a special case for avr to system_error.cc so that only
the valid errors are recognized. Also disable the errno checks in
std::filesystem::remove_all that assume a meaningful value for errno.
On avr-libc <unistd.h> exists but does not define the POSIX functions
needed by std::filesystem, so _GLIBCXX_HAVE_UNISTD_H is not sufficient
to check for basic POSIX APIs. Check !defined __AVR__ as well as
_GLIBCXX_HAVE_UNISTD_H before using those functions. This is a kluge and
we should really have a specific macro that says the required functions
are available.
libstdc++-v3/ChangeLog:
* config/os/generic/error_constants.h (errc::value_too_large)
[__AVR__]: Define.
* src/c++11/system_error.cc
(system_category::default_error_condition) [__AVR__]: Only match
recognize values equal to EDOM, ERANGE, ENOSYS and EINTR.
* src/c++17/fs_ops.cc (fs::current_path) [__AVR__]: Do not check
for ENOENT etc. in switch.
(fs::remove_all) [__AVR__]: Likewise.
* src/filesystem/ops-common.h [__AVR__]: Do not use POSIX open,
close etc.
Jonathan Wakely [Tue, 31 Jan 2023 22:11:49 +0000 (22:11 +0000)]
libstdc++: Do not embed tzdata.zi for 8-bit and 16-bit targets
The string literal containing the static tzdata.zi information is too
large for some targets, so do not enable it by default for avr-*-* and
msp430-*-*.
libstdc++-v3/ChangeLog:
* acinclude.m4 (GLIBCXX_ZONEINFO_DIR) [avr-*-*, msp430-*-*]: Set
embed_zoneinfo=no
* configure: Regenerate.
Harald Anlauf [Wed, 1 Feb 2023 20:01:32 +0000 (21:01 +0100)]
Fortran: error recovery on invalid array section [PR108609]
The testcase for PR108527 uncovered a latent issue with invalid array
sections that resulted in different paths being taken on different
architectures. Detect the invalid array declaration for a clean recovery.
gcc/fortran/ChangeLog:
PR fortran/108609
* expr.cc (find_array_section): Add check to prevent interpreting an
mpz non-integer constant as an integer.
gcc/testsuite/ChangeLog:
PR fortran/108609
* gfortran.dg/pr108527.f90: Adjust test pattern.
Tamar Christina [Wed, 1 Feb 2023 18:31:41 +0000 (18:31 +0000)]
AArch64: Fix native detection in the presence of mandatory features which don't have midr values
aarch64-option-extensions.def explicitly defines the semantics for an empty midr
field as being:
In that case this field
should contain a space (" ") separated list of the strings in 'Features'
that are required. Their order is not important. An empty string means
do not detect this feature during auto detection.
That is to say, an empty string means that we don't know the midr value for this
feature and so it just shouldn't be taken into account for native features
detection. However this meaning seems to have gotten lost at some point.
This results in e.g. -mcpu=native on a Neoverse N2 disabling features it does
have. Essentially we disabled any mandatory feature for which there is no midr
entry.
The rationale for having -mcpu=native being able to disable features at all, is
because the kernel is able to disable a mandatory feature for correctness
issues. Unfortunately we can't distinguish between "old kernel"
and "kernel disabled".
This patch adds a new field that indicates whether the midr field has any value
at all. If there's no value we skip the extension when determining the "off"
flags.
gcc/ChangeLog:
* common/config/aarch64/aarch64-common.cc
(struct aarch64_option_extension): Add native_detect and document struct
a bit more.
(all_extensions): Set new field native_detect.
* config/aarch64/aarch64.cc (struct aarch64_option_extension): Delete
unused struct.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/cpunative/info_19: New test.
* gcc.target/aarch64/cpunative/info_20: New test.
* gcc.target/aarch64/cpunative/info_21: New test.
* gcc.target/aarch64/cpunative/info_22: New test.
* gcc.target/aarch64/cpunative/native_cpu_19.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_20.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_21.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_22.c: New test.
Gaius Mulley [Wed, 1 Feb 2023 17:26:00 +0000 (17:26 +0000)]
Fixup noreturn attributes in modula-2 [PR108551] and [PR108612]
PR108612 - m2/gm2-libs-iso/ClientSocket.mod:229:1: error: control
reaches end of non-void function [-Werror=return-type]
PR108551 - gcc/m2/gm2-libs-pim/Termbase.mod:128:1: error: control
reaches end of non-void function [-Werror=return-type]
This patch adds missing return values to the procedure functions
mentioned in PR108612 and PR108551. It corrects the noreturn
attribute to throw and rethrow in the modula2 frontend. The patch
also changes HALT, Halt, Raise procedures in the libraries to use
the <* noreturn *> attribute. Finally the patch includes
rebuilt bootstrap tools mc and pge.
gcc/m2/ChangeLog:
* Make-lang.in (GM2_FLAGS): Add -fno-return -Wreturn-type.
(GM2_ISO_FLAGS): Add -fno-return -Wreturn-type.
* Make-maintainer.in (GM2PATH): Split into separate -I components.
(MC-LIB-DEFS): Add RTentity.def.
(m2/boot-bin/mc-devel$(exeext)): Changed -I$(GM2PATH) to
$(GM2PATH).
(m2/boot-bin/mc-opt$(exeext)): Separate -I paths.
(m2/mc/decl.o): Separate -I paths.
(gm2-bootstrap): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)%.h): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)decl.c): Separate -I paths.
(m2/mc-boot-gen/$(SRC_PREFIX)%.c): Separate -I paths.
(gm2.verifyparanoid): Separate -I paths.
(gm2.verifystage12): Separate -I paths.
* gm2-compiler/M2ALU.mod (GetConstructorElement): Add default
Return NulSym. Remove return from the error case.
* gm2-compiler/M2Base.mod (ComplexToScalar): Return RType
from the error case.
(MixMetaTypes): Return MakeError as a default.
* gm2-compiler/M2GCCDeclare.mod (GetTypeMin): Return NulSym
from the error case.
(GetTypeMax): Return NulSym from the error case.
* gm2-compiler/M2GenGCC.mod (IsExportedGcc): Replace Assert
by InternalError.
* gm2-compiler/M2Quads.mod (GetItemPointedTo): Add InternalError.
(GetTypeMin): Add InternalError.
(GetTypeMax): Add InternalError.
* gm2-compiler/M2System.mod (InitSystem): Call
PutProcedureNoReturn on Throw.
* gm2-gcc/m2except.cc (m2except_InitExceptions): fn_throw_tree
declare as noreturn. fn_rethrow_tree declare as noreturn.
* gm2-libs-coroutines/Debug.def (Halt): Add noreturn attribute.
* gm2-libs-coroutines/SYSTEM.def (THROW): Add noreturn attribute.
* gm2-libs-iso/ClientSocket.mod (dorbytes): Add return FALSE.
* gm2-libs-iso/EXCEPTIONS.def (RAISE): Add noreturn attribute.
* gm2-libs-iso/IOLink.def (RAISEdevException): Add noreturn attribute.
* gm2-libs-iso/M2RTS.def (HALT): Add noreturn attribute.
(Halt): Ditto.
(HaltC): Ditto.
(ErrorMessage): Ditto.
(AssignmentException): Ditto.
(ReturnException): Ditto.
(IncException): Ditto.
(DecException): Ditto.
(InclException): Ditto.
(ExclException): Ditto.
(ShiftException): Ditto.
(RotateException): Ditto.
(StaticArraySubscriptException): Ditto.
(DynamicArraySubscriptException): Ditto.
(ForLoopBeginException): Ditto.
(ForLoopToException): Ditto.
(ForLoopEndException): Ditto.
(PointerNilException): Ditto.
(NoReturnException): Ditto.
(CaseException): Ditto.
(WholeNonPosDivException): Ditto.
(WholeNonPosModException): Ditto.
(WholeZeroDivException): Ditto.
(WholeZeroRemException): Ditto.
(WholeValueException): Ditto.
(RealValueException): Ditto.
(ParameterException): Ditto.
(NoException): Ditto.
* gm2-libs-iso/SYSTEM.def (THROW): Ditto.
* gm2-libs-iso/TermFile.mod (dorbytes): Add default return FALSE.
* gm2-libs-min/M2RTS.def: Add noreturn attribute.
* gm2-libs/FIO.mod (BufferedRead): Return -1.
(getFileName): Return NIL.
(getFileNameLength): Return 0.
* gm2-libs/M2RTS.def (HaltC): Add noreturn attribute.
(AssignmentException): Ditto.
(ReturnException): Ditto.
(IncException): Ditto.
(DecException): Ditto.
(InclException): Ditto.
(ExclException): Ditto.
(ShiftException): Ditto.
(RotateException): Ditto.
(StaticArraySubscriptException): Ditto.
(DynamicArraySubscriptException): Ditto.
(ForLoopBeginException): Ditto.
(ForLoopToException): Ditto.
(ForLoopEndException): Ditto.
(PointerNilException): Ditto.
(NoReturnException): Ditto.
(CaseException): Ditto.
(WholeNonPosDivException): Ditto.
(WholeNonPosModException): Ditto.
(WholeZeroDivException): Ditto.
(WholeZeroRemException): Ditto.
(WholeValueException): Ditto.
(RealValueException): Ditto.
(ParameterException): Ditto.
(NoException): Ditto.
* gm2-libs/RTExceptions.def (Raise): Ditto.
* gm2-libs/RTExceptions.mod (InvokeHandler): Ditto.
* gm2-libs/SYSTEM.def (THROW): Ditto.
* m2.flex (_M2_m2flex_fini): Remamed to...
(_M2_m2flex_finish): ...here.
* mc-boot-ch/GBuiltins.c (_M2_Builtins_finish): Remamed to...
(_M2_Builtins_fini): ...this.
* mc-boot-ch/GRTco.c (_M2_RTco_finish): Remamed to...
(_M2_RTco_fini): ...this.
* mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_finish): Remamed to...
(_M2_SYSTEM_fini): ...this.
* mc-boot-ch/GSelective.c (_M2_Selective_finish): Remamed to...
(_M2_Selective_fini): ...this.
* mc-boot-ch/GSysExceptions.c (_M2_SysExceptions_init): Add
parameters.
(_M2_SysExceptions_finish): Remamed to...
(_M2_SysExceptions_fini): ...this.
* mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_finish): Remamed to...
(_M2_UnixArgs_fini): ...this.
(_M2_UnixArgs_ctor::_M2_UnixArgs_ctor): Change parameter
to _M2_UnixArgs_fini.
* mc-boot-ch/Gdtoa.c (_M2_dtoa_finish): Remamed to...
(_M2_dtoa_fini): ...this.
* mc-boot-ch/Gerrno.c (_M2_errno_finish): Remamed to...
(_M2_errno_fini): ...this.
* mc-boot-ch/Gldtoa.c (_M2_ldtoa_finish): Remamed to...
(_M2_ldtoa_fini): ...this.
* mc-boot-ch/Gtermios.cc (_M2_termios_init): Add parameters.
(_M2_termios_finish): Remamed to...
(_M2_termios_fini): ...this.
* mc-boot-ch/Gwrapc.c (_M2_wrapc_init): Add parameters.
(_M2_wrapc_finish): Remamed to...
(_M2_wrapc_fini): ...this.
* mc-boot/GASCII.c: Rebuild.
* mc-boot/GArgs.c: Rebuild.
* mc-boot/GAssertion.c: Rebuild.
* mc-boot/GBreak.c: Rebuild.
* mc-boot/GCmdArgs.c: Rebuild.
* mc-boot/GDebug.c: Rebuild.
* mc-boot/GDynamicStrings.c: Rebuild.
* mc-boot/GEnvironment.c: Rebuild.
* mc-boot/GFIO.c: Rebuild.
* mc-boot/GFormatStrings.c: Rebuild.
* mc-boot/GFpuIO.c: Rebuild.
* mc-boot/GIO.c: Rebuild.
* mc-boot/GIndexing.c: Rebuild.
* mc-boot/GM2Dependent.c: Rebuild.
* mc-boot/GM2EXCEPTION.c: Rebuild.
* mc-boot/GM2RTS.c: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GMemUtils.c: Rebuild.
* mc-boot/GNumberIO.c: Rebuild.
* mc-boot/GPushBackInput.c: Rebuild.
* mc-boot/GRTExceptions.c: Rebuild.
* mc-boot/GRTExceptions.h: Rebuild.
* mc-boot/GRTco.h: Rebuild.
* mc-boot/GRTint.c: Rebuild.
* mc-boot/GSArgs.c: Rebuild.
* mc-boot/GSFIO.c: Rebuild.
* mc-boot/GStdIO.c: Rebuild.
* mc-boot/GStorage.c: Rebuild.
* mc-boot/GStrCase.c: Rebuild.
* mc-boot/GStrIO.c: Rebuild.
* mc-boot/GStrLib.c: Rebuild.
* mc-boot/GStringConvert.c: Rebuild.
* mc-boot/GSysStorage.c: Rebuild.
* mc-boot/GTimeString.c: Rebuild.
* mc-boot/Galists.c: Rebuild.
* mc-boot/Gdecl.c: Rebuild.
* mc-boot/Gkeyc.c: Rebuild.
* mc-boot/Glists.c: Rebuild.
* mc-boot/GmcComment.c: Rebuild.
* mc-boot/GmcComp.c: Rebuild.
* mc-boot/GmcDebug.c: Rebuild.
* mc-boot/GmcError.c: Rebuild.
* mc-boot/GmcFileName.c: Rebuild.
* mc-boot/GmcLexBuf.c: Rebuild.
* mc-boot/GmcMetaError.c: Rebuild.
* mc-boot/GmcOptions.c: Rebuild.
* mc-boot/GmcPreprocess.c: Rebuild.
* mc-boot/GmcPretty.c: Rebuild.
* mc-boot/GmcPrintf.c: Rebuild.
* mc-boot/GmcQuiet.c: Rebuild.
* mc-boot/GmcReserved.c: Rebuild.
* mc-boot/GmcSearch.c: Rebuild.
* mc-boot/GmcStack.c: Rebuild.
* mc-boot/GmcStream.c: Rebuild.
* mc-boot/Gmcp1.c: Rebuild.
* mc-boot/Gmcp2.c: Rebuild.
* mc-boot/Gmcp3.c: Rebuild.
* mc-boot/Gmcp4.c: Rebuild.
* mc-boot/Gmcp5.c: Rebuild.
* mc-boot/GnameKey.c: Rebuild.
* mc-boot/GsymbolKey.c: Rebuild.
* mc-boot/Gtop.c: Rebuild.
* mc-boot/Gvarargs.c: Rebuild.
* mc-boot/Gwlists.c: Rebuild.
* mc-boot/GRTentity.h: New file.
* mc/decl.mod (scaffoldStatic): Change _finish to _fini.
* mc/mc.flex (_M2_mcflex_fini): New function.
(_M2_mcflex_finish): Remove function.
* tools-src/mklink.c (GenerateFinishCalls): Change
_finish to _fini.
(GeneratePrototypes): Change _finish to _fini.
libgm2/ChangeLog:
* libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2cor/Makefile.in: Rebuild.
* libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2iso/Makefile.in: Rebuild.
* libm2log/Makefile.am (libm2log_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2log/Makefile.in: Rebuild.
* libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Add -Wreturn-type
-fcase.
* libm2pim/Makefile.in: Rebuild.
PR modula2/108612
PR modula2/108551
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Hans-Peter Nilsson [Wed, 1 Feb 2023 13:56:47 +0000 (14:56 +0100)]
libstdc++ testsuite: Correct S0 in std/time/hh_mm_ss/1.cc
For targets where the ABI mandates structure layout that has
no padding, like cris-elf, this test started failing when
introduced as an add-on to the existing 1.cc, thereby
effectively causing a regression in testsuite results.
Adding an empty structure to S0, corresponds better to the
layout of hh_mm_ss<seconds>.
PR testsuite/108632
* testsuite/std/time/hh_mm_ss/1.cc (size): Add empty
struct at end of S0.
Siddhesh Poyarekar [Wed, 1 Feb 2023 16:41:22 +0000 (11:41 -0500)]
testsuite: Run __bos tests to completion
Instead of failing on first error, run all __builtin_object_size and
__builtin_dynamic_object_size tests to completion and then provide a
summary of which tests failed.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-dynamic-object-size-0.c: Move FAIL and nfail
into...
* gcc.dg/builtin-object-size-common.h: ... new file.
* g++.dg/ext/builtin-object-size1.C: Include
builtin-object-size-common.h. Replace all abort with FAIL.
(main): Call DONE.
* g++.dg/ext/builtin-object-size2.C: Likewise.
* gcc.dg/builtin-object-size-1.c: Likewise.
* gcc.dg/builtin-object-size-12.c: Likewise.
* gcc.dg/builtin-object-size-13.c: Likewise.
* gcc.dg/builtin-object-size-15.c: Likewise.
* gcc.dg/builtin-object-size-2.c: Likewise.
* gcc.dg/builtin-object-size-3.c: Likewise.
* gcc.dg/builtin-object-size-4.c: Likewise.
* gcc.dg/builtin-object-size-6.c: Likewise.
* gcc.dg/builtin-object-size-7.c: Likewise.
* gcc.dg/builtin-object-size-8.c: Likewise.
* gcc.dg/pr101836.c: Likewise.
* gcc.dg/strict-flex-array-3.c: Likewise.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Martin Liska [Fri, 2 Dec 2022 10:37:41 +0000 (11:37 +0100)]
ipa: silent -Wodr notes with -w
If -w is used, warn_odr properly sets *warned = false and
so it should be preserved when calling warn_types_mismatch.
Noticed that during a LTO reduction where I used -w.
gcc/ChangeLog:
* ipa-devirt.cc (odr_types_equivalent_p): Respect *warned
value if set.
Andrew MacLeod [Tue, 10 Jan 2023 18:40:56 +0000 (13:40 -0500)]
Ranger cache - always use range_from_dom when updating.
When updating an existing range, if we dont query the dom tree, we can
get the global range instead of a proper range on some incoming edges
which cause the range to not be refined properly.
PR tree-optimization/108356
gcc/
* gimple-range-cache.cc (ranger_cache::range_on_edge): Always
do a search of the DOM tree for a range.
gcc/testsuite/
* gcc.dg/pr108356.c: New.
Martin Liska [Tue, 24 Jan 2023 13:39:11 +0000 (14:39 +0100)]
ipa: check if cache_token != NULL before hash_set::add call
We should not insert an empty value to the container.
PR ipa/108509
gcc/ChangeLog:
* cgraphunit.cc (walk_polymorphic_call_targets): Insert
ony non-null values.
* ipa.cc (walk_polymorphic_call_targets): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/ipa/pr108509.C: New test.
Tobias Burnus [Wed, 1 Feb 2023 13:49:36 +0000 (14:49 +0100)]
Fortran: Extend align-clause checks of OpenMP's allocate directive
gcc/fortran/ChangeLog:
* openmp.cc (resolve_omp_clauses): Check also for
power of two.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/allocate-3.f90: Fix ALIGN
usage, remove unused -fdump-tree-original.
* testsuite/libgomp.fortran/allocate-4.f90: New.
Marek Polacek [Tue, 31 Jan 2023 19:36:30 +0000 (14:36 -0500)]
c++: ICE with -Wlogical-op [PR107755]
Here we crash in the middle end because warn_logical_operator calls
build_range_check which calls various fold_* functions and those
don't work too well when we're still processing template trees. For
instance here we crash because we're converting a RECORD_TYPE to bool.
At this point VIEW_CONVERT_EXPR<struct Foo>(b) hasn't yet been converted
to Foo::operator bool (&b).
I was excited to fix this with instantiation_dependent_expression_p
which can now be called from c-family/ as well, but the problem isn't
that the expression is dependent. So, p_t_d it is.
PR c++/107755
gcc/cp/ChangeLog:
* call.cc (build_new_op): Don't call warn_logical_operator when
processing a template.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wlogical-op-4.C: New test.
Martin Liska [Fri, 27 Jan 2023 13:56:31 +0000 (14:56 +0100)]
driver: fix -gz=none error message with missing zstd
We wrongly report:
$ echo "int main () {}" | gcc -xc -gz=none -
gcc: error: -gz=zstd is not supported in this configuration
if zstd compression is not supported by binutils. We should emit the
error message only if -gz=zstd.
PR driver/108572
gcc/ChangeLog:
* gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Report error only for
-gz=zstd.
Jakub Jelinek [Wed, 1 Feb 2023 11:52:52 +0000 (12:52 +0100)]
ree: Fix -fcompare-debug issues in combine_reaching_defs [PR108573]
The PR78437 r7-4871 changes made combine_reaching_defs punt on
WORD_REGISTER_OPERATIONS targets if a setter of smaller than word
register has wider uses. This unfortunately breaks -fcompare-debug,
because if such a use appears only in DEBUG_INSN(s), while all other
uses aren't wider than the setter, we can REE optimize it without -g
and not with -g.
Such decisions shouldn't be based on debug instructions. We could try
to reset them or adjust in some other way after we decide to perform the
change, but at least on the testcase which used to fail on riscv64-linux
the
(debug_insn 8 7 9 2 (var_location:HI s (minus:HI (subreg:HI (and:DI (reg:DI 10 a0 [160])
(const_int 1 [0x1])) 0)
(subreg:HI (ashiftrt:DI (reg/v:DI 9 s1 [orig:151 l ] [151])
(debug_expr:SI D#1)) 0))) "pr108573.c":12:5 -1
(nil))
clearly doesn't care about the upper bits and I have hard time imaging how
could one end up with DEBUG_INSN which actually cares about those upper
bits.
So, the following patch just ignores uses on DEBUG_INSNs in this case,
if we run into something where we'd need to do something further later on,
let's deal with it when we have a testcase for it.
2023-02-01 Jakub Jelinek <jakub@redhat.com>
PR debug/108573
* ree.cc (combine_reaching_defs): Don't return false for paradoxical
subregs in DEBUG_INSNs.
* gcc.dg/pr108573.c: New test.
Tobias Burnus [Wed, 1 Feb 2023 11:19:27 +0000 (12:19 +0100)]
libgomp.texi: Reverse-offload updates
libgomp/
* libgomp.texi (5.0 Impl. Status): Update 'requires' and 'ancestor'.
(GCN): Add item about 'omp requires'.
(nvptx): Likewise; add item about reverse offload.
Richard Sandiford [Wed, 1 Feb 2023 09:53:50 +0000 (09:53 +0000)]
compare-elim: Fix an RTL checking failure
find_flags_uses_in_insn used SET_SRC without first checking
for a SET. This showed up as an RTL checking failure in
g++.dg/torture/pr90994.C on aarch64.
gcc/
* compare-elim.cc (find_flags_uses_in_insn): Guard use of SET_SRC.
Richard Sandiford [Wed, 1 Feb 2023 09:53:50 +0000 (09:53 +0000)]
testsuite: Fix g++.dg/gomp warnings for aarch64
A couple of tweaks to make g++.dg/gomp clean on aarch64.
gcc/testsuite/
* g++.dg/gomp/attrs-10.C: Update warning strings for aarch64.
* g++.dg/gomp/declare-simd-8.C: Add expected warning for aarch64.
Jakub Jelinek [Wed, 1 Feb 2023 09:38:46 +0000 (10:38 +0100)]
c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression evaluation [PR108607]
While potential_constant_expression_1 handled most of OMP_* codes (by saying that
they aren't potential constant expressions), OMP_SCOPE was missing in that list.
I've also added OMP_SCAN, though that is less important (similarly to OMP_SECTION
it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
As the testcase shows, it isn't enough, potential_constant_expression_1
can catch only some cases, as soon as one uses switch or ifs where at least
one of the possible paths could be constant expression, we can run into the
same codes during cxx_eval_constant_expression, so this patch handles those
there as well.
2023-02-01 Jakub Jelinek <jakub@redhat.com>
PR c++/108607
* constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
and OACC_* constructs as non-constant.
(potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.
* g++.dg/gomp/pr108607.C: New test.
Andreas Krebbel [Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)]
IBM zSystems: Save argument registers to the stack -mpreserve-args
This adds support for preserving the content of parameter registers to
the stack and emit CFI for it. This useful for applications which want
to implement their own stack unwinding and need access to function
arguments.
With the -mpreserve-args option GPRs and FPRs are save to the stack
slots which are reserved for stdargs in the register save area.
gcc/ChangeLog:
* config/s390/s390.cc (s390_restore_gpr_p): New function.
(s390_preserve_gpr_arg_in_range_p): New function.
(s390_preserve_gpr_arg_p): New function.
(s390_preserve_fpr_arg_p): New function.
(s390_register_info_stdarg_fpr): Rename to ...
(s390_register_info_arg_fpr): ... this. Add -mpreserve-args handling.
(s390_register_info_stdarg_gpr): Rename to ...
(s390_register_info_arg_gpr): ... this. Add -mpreserve-args handling.
(s390_register_info): Use the renamed functions above.
(s390_optimize_register_info): Likewise.
(save_fpr): Generate CFI for -mpreserve-args.
(save_gprs): Generate CFI for -mpreserve-args. Drop return value.
(s390_emit_prologue): Adjust to changed calling convention of save_gprs.
(s390_optimize_prologue): Likewise.
* config/s390/s390.opt: New option -mpreserve-args
gcc/testsuite/ChangeLog:
* gcc.target/s390/preserve-args-1.c: New test.
* gcc.target/s390/preserve-args-2.c: New test.
Andreas Krebbel [Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)]
IBM zSystems: Make stack_tie to work with hard frame pointer
With this patch a scheduling barrier is created to prevent the insn
setting up the frame-pointer and instructions which save GPRs to the
stack to be swapped. Otherwise broken CFI information would be
generated since the stack save insns would use a base register which
is not currently declared as holding the CFA.
Without -mpreserve-args this did not happen because the store multiple
we used for saving the GPRs would also cover the frame-pointer
register and therefore creates a dependency on the frame-pointer
hardreg. However, with this patch the stack_tie is emitted regardless
of -mpreserve-args since this in general appears to be the safer
approach.
* config/s390/s390.cc (save_gprs): Use gen_frame_mem.
(restore_gprs): Likewise.
(s390_emit_stack_tie): Make the stack_tie to be dependent on the
frame pointer if a frame-pointer is used.
(s390_emit_prologue): Emit stack_tie when frame-pointer is needed.
* config/s390/s390.md (stack_tie): Add a register operand and
rename to ...
(@stack_tie<mode>): ... this.
Andreas Krebbel [Wed, 1 Feb 2023 07:59:41 +0000 (08:59 +0100)]
New reg note REG_CFA_NORESTORE
This patch introduces a new reg note which can be used to tell the CFI
verification in dwarf2cfi that a register is stored without intending
to restore from it.
This is useful when storing e.g. register contents to the stack and
generate CFI for it although the register is not really supposed to be
restored.
gcc/ChangeLog:
* dwarf2cfi.cc (dwarf2out_frame_debug_cfa_restore): Add
EMIT_CFI parameter.
(dwarf2out_frame_debug): Add case for REG_CFA_NORESTORE.
* reg-notes.def (REG_CFA_NOTE): New reg note definition.
Richard Biener [Tue, 31 Jan 2023 14:45:43 +0000 (15:45 +0100)]
middle-end/108500 - replace recursive domtree DFS traversal
The following replaces the recursive DFS traversal of the dominator
tree in assign_dfs_numbers with a tree traversal using the fact
that we have recorded parents.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
This makes r13-5325 somewhat obsolete, though not computing the
DFS numbers at all is beneficial in the cases where we perform
immediate CFG manipulations.
OK for trunk and later branch(es)?
Thanks,
Richard.
PR middle-end/108500
* dominance.cc (assign_dfs_numbers): Replace recursive DFS
with tree traversal algorithm.
Jason Merrill [Tue, 31 Jan 2023 17:56:56 +0000 (12:56 -0500)]
c++: Add -Wno-changes-meaning
In recent years this error has been coming up more because other compilers
don't diagnose it as consistently. So let's add a flag for it, and be more
lenient about cases that aren't likely to cause bugs.
gcc/ChangeLog:
* doc/invoke.texi: Document -Wno-changes-meaning.
gcc/c-family/ChangeLog:
* c.opt: Add -Wno-changes-meaning.
gcc/cp/ChangeLog:
* class.cc (note_name_declared_in_class): Change from permerror to
-Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.
gcc/testsuite/ChangeLog:
* g++.dg/warn/changes-meaning2.C: New test.
* g++.dg/warn/changes-meaning3.C: New test.
David Malcolm [Wed, 1 Feb 2023 02:18:22 +0000 (21:18 -0500)]
analyzer: fix uses of alloca in testsuite
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/call-summaries-2.c: Add
dg-require-effective-target alloca.
* gcc.dg/analyzer/imprecise-floating-point-1.c: Likewise.
* gcc.dg/analyzer/infinite-recursion-alloca.c: Likewise.
* gcc.dg/analyzer/malloc-callbacks.c: Likewise.
* gcc.dg/analyzer/out-of-bounds-5.c: Likewise. Remove includes
of <stdio.h> and <alloca.h>. Use "__builtin_free" rather than
"free", to match uses of "__builtin_malloc".
* gcc.dg/analyzer/putenv-1.c: Add dg-require-effective-target
alloca.
* gcc.dg/analyzer/write-to-string-literal-5.c: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 1 Feb 2023 02:18:10 +0000 (21:18 -0500)]
analyzer: fix -Wanalyzer-allocation-size false -ve on alloca [PR108616]
gcc/analyzer/ChangeLog:
PR analyzer/108616
* pending-diagnostic.cc (fixup_location_in_macro_p): Add "alloca"
to macros that we shouldn't unwind inside.
gcc/testsuite/ChangeLog:
PR analyzer/108616
* gcc.dg/analyzer/allocation-size-multiline-3.c: New test.
* gcc.dg/analyzer/test-alloca.h: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 1 Feb 2023 02:18:00 +0000 (21:18 -0500)]
doc: add notes about limitations of -fanalyzer
gcc/ChangeLog:
* doc/invoke.texi (Static Analyzer Options): Add notes about
limitations of -fanalyzer.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
GCC Administrator [Wed, 1 Feb 2023 00:18:50 +0000 (00:18 +0000)]
Daily bump.
Jason Merrill [Mon, 30 Jan 2023 23:18:54 +0000 (18:18 -0500)]
c++: aggregate base and TARGET_EXPR_ELIDING_P [PR108559]
We also need to split up a CONSTRUCTOR in cp_genericize_init if we need to
add extra copy constructor calls to deal with CWG2403.
PR c++/108559
gcc/cp/ChangeLog:
* cp-gimplify.cc (any_non_eliding_target_exprs): New.
(cp_genericize_init): Check it.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aggr-base13.C: New test.
H.J. Lu [Tue, 31 Jan 2023 22:34:00 +0000 (14:34 -0800)]
libsanitizer: cherry-pick commit
742bcbf685bc from upstream
cherry-pick:
742bcbf685bc compiler-rt/lib: Add .Linterceptor_sigsetjmp
PR sanitizer/108106
* hwasan/hwasan_setjmp_x86_64.S (__interceptor_setjmp): Jump
to .Linterceptor_sigsetjmp instead of __interceptor_sigsetjmp.
(__interceptor_sigsetjmp): Add a local alias,
.Linterceptor_sigsetjmp.
Thomas Schwinge [Tue, 31 Jan 2023 10:38:15 +0000 (11:38 +0100)]
For Modula-2 build-tree testing, also set up paths to compiler libraries
Currently, 'gcc/testsuite/lib/gm2.exp:gm2_link_flags' doesn't set up
paths to compiler libraries (such as libgcc, which libstdc++
may depend on). For example, I see my x86_64-pc-linux-gnu '-m32' testing
not pick up the build-tree libgcc, but instead some random system one,
which (expectedly) doesn't satisfy requirements of other build-tree
libraries:
[...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6)
..., and thus a lot of execution FAILs.
As seen in a number of other '[...]_link_flags' procedures, the standard idiom
seems to be to also consider 'gcc-set-multilib-library-path' for
'ld_library_path'.
gcc/testsuite/
* lib/gm2.exp (gm2_link_flags) [$gccpath != ""]: Also consider
'gcc-set-multilib-library-path' for 'ld_library_path'.
Marek Polacek [Tue, 31 Jan 2023 18:27:21 +0000 (13:27 -0500)]
c++: Add fixed test [PR102870]
This was fixed by r12-7857: now we properly reject instead of
crashing.
PR c++/102870
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/variadic184.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:10:28 +0000 (21:10 +0800)]
RISC-V: Add vdiv*.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vdiv_vv-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vdiv_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vdivu_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:08:39 +0000 (21:08 +0800)]
RISC-V: Add vmax*.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vmax_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmax_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmaxu_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:06:50 +0000 (21:06 +0800)]
RISC-V: Add vmin*.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vmin_vv-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vmin_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vminu_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:05:17 +0000 (21:05 +0800)]
RISC-V: Add vor.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vor_vv-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vor_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:03:19 +0000 (21:03 +0800)]
RISC-V: Add vrem*.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vrem_vv-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vrem_vv_tumu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vremu_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 13:01:37 +0000 (21:01 +0800)]
RISC-V: Add vsll.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vsll_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsll_vv_tumu-3.C: New test.
Ju-Zhe Zhong [Tue, 31 Jan 2023 12:59:58 +0000 (20:59 +0800)]
RISC-V: Add vsra.vv C++ API tests
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vsra_vv-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_mu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tu-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tum-3.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vsra_vv_tumu-3.C: New test.