]> gcc.gnu.org Git - gcc.git/log
gcc.git
19 months agotree-optimization/99407 - DSE with data-ref analysis
Richard Biener [Thu, 22 Sep 2022 07:40:40 +0000 (09:40 +0200)]
tree-optimization/99407 - DSE with data-ref analysis

The following resolves the issue that DSE cannot handle references
with variable offsets well when identifying possible uses of a store.
Instead of just relying on ref_maybe_used_by_stmt_p we use data-ref
analysis, making sure to perform that at most once per stmt.  The
new mode is only exercised by the DSE pass before loop optimization
as specified by a new pass parameter and when expensive optimizations
are enabled, so it's disabled below -O2.

PR tree-optimization/99407
* tree-ssa-dse.cc (dse_stmt_to_dr_map): New global.
(dse_classify_store): Use data-ref analysis to disambiguate more uses.
(pass_dse::use_dr_analysis_p): New pass parameter.
(pass_dse::set_pass_param): Implement.
(pass_dse::execute): Allocate and deallocate dse_stmt_to_dr_map.
* passes.def: Allow DR analysis for the DSE pass before loop.

* gcc.dg/vect/tsvc/vect-tsvc-s243.c: Remove XFAIL.

19 months agoSome VN TLC
Richard Biener [Thu, 22 Sep 2022 07:08:47 +0000 (09:08 +0200)]
Some VN TLC

The following was prompted by review of the patch introducing
equivalences to VN.

* tree-ssa-sccvn.cc (can_track_predicate_on_edge): New
function split out from ...
(vn_nary_op_insert_pieces_predicated): ... here.

19 months agoFix typo in floorv2sf2, should be register_operand for op1, not vector_operand.
liuhongt [Wed, 21 Sep 2022 08:07:39 +0000 (16:07 +0800)]
Fix typo in floorv2sf2, should be register_operand for op1, not vector_operand.

gcc/ChangeLog:

PR target/106994
* config/i386/mmx.md (floorv2sf2): Fix typo, use
register_operand instead of vector_operand for operands[1].

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106994.c: New test.

19 months agolibstdc++: Remove useless gdb printer registrations
François Dumont [Wed, 21 Sep 2022 16:59:43 +0000 (18:59 +0200)]
libstdc++: Remove useless gdb printer registrations

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Remove ptinter registration for non-existing
types std::__debug::unique_ptr, std::__debug::stack, std::__debug::queue,
std::__debug::priority_queue.

19 months agoDaily bump.
GCC Administrator [Thu, 22 Sep 2022 00:19:09 +0000 (00:19 +0000)]
Daily bump.

19 months agolibstdc++: Fix accidental duplicate test [PR91456]
Jonathan Wakely [Wed, 21 Sep 2022 13:59:18 +0000 (14:59 +0100)]
libstdc++: Fix accidental duplicate test [PR91456]

It looks like I committed the testcase for std::function twice, instead
of one for std::function and one for std::is_invocable_r. This replaces
the is_invocable_r one with the example from the PR.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* testsuite/20_util/function/91456.cc: Add comment with PR
number.
* testsuite/20_util/is_invocable/91456.cc: Likewise. Replace
std::function checks with std::is_invocable_r checks.

19 months agolibstdc++: Remove main() from some compile-only tests
Jonathan Wakely [Wed, 21 Sep 2022 08:31:14 +0000 (09:31 +0100)]
libstdc++: Remove main() from some compile-only tests

libstdc++-v3/ChangeLog:

* testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove
unnecessary main function.
* testsuite/17_intro/headers/c++2011/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2020/all_attributes.cc:
Likewise.

19 months agolibstdc++: Update <memory> synopsis test for C++11 and later
Jonathan Wakely [Wed, 21 Sep 2022 08:29:39 +0000 (09:29 +0100)]
libstdc++: Update <memory> synopsis test for C++11 and later

libstdc++-v3/ChangeLog:

* testsuite/20_util/headers/memory/synopsis.cc: Add declarations
from C++11 and later.

19 months ago[PR106967] Set known NANs to undefined for flag_finite_math_only.
Aldy Hernandez [Wed, 21 Sep 2022 09:18:48 +0000 (11:18 +0200)]
[PR106967] Set known NANs to undefined for flag_finite_math_only.

Explicit NANs in the IL can be treated as undefined for
flag_finite_math_only.  This causes all the right things to happen wrt
threading, folding, etc.  It also saves us special casing throughout.

PR tree-optimization/106967

gcc/ChangeLog:

* value-range.cc (frange::set): Set known NANs to undefined for
flag_finite_math_only.

19 months agoClear unused flags in frange for undefined ranges.
Aldy Hernandez [Wed, 21 Sep 2022 07:49:14 +0000 (09:49 +0200)]
Clear unused flags in frange for undefined ranges.

gcc/ChangeLog:

* value-range.cc (frange::combine_zeros): Call set_undefined.
(frange::intersect_nans): Same.
(frange::intersect): Same.
(frange::verify_range): Undefined ranges do not have a type.
* value-range.h (frange::set_undefined): Clear NAN flags and type.

19 months agotree-optimization/106984 - tsan and COND_EXPR GIMPLE
Richard Biener [Wed, 21 Sep 2022 09:30:57 +0000 (11:30 +0200)]
tree-optimization/106984 - tsan and COND_EXPR GIMPLE

The following adjusts a missed spot in TSAN for the RHS COND_EXPR
GIMPLE IL rework.

PR tree-optimization/106984
* tsan.cc (instrument_builtin_call): Build the COND_EXPR condition in
a separate statement.

* gcc.dg/tsan/pr106984.c: New testcase.

19 months agoFortran: handle RADIX kind in IEEE_SET_ROUNDING_MODE
Francois-Xavier Coudert [Wed, 21 Sep 2022 09:06:19 +0000 (11:06 +0200)]
Fortran: handle RADIX kind in IEEE_SET_ROUNDING_MODE

Make sure that calling IEEE_SET_ROUNDING_MODE with RADIX=10 does not
affect the binary rounding mode.

2022-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/

* ieee/ieee_arithmetic.F90 (IEEE_SET_ROUNDING_MODE): Handle
RADIX argument better.

gcc/testsuite/

* gfortran.dg/ieee/rounding_3.f90: New test.

19 months agoaarch64: Rewrite -march=native to -mcpu if no other -mcpu or -mtune is given
Kyrylo Tkachov [Wed, 21 Sep 2022 09:10:21 +0000 (10:10 +0100)]
aarch64: Rewrite -march=native to -mcpu if no other -mcpu or -mtune is given

We have received requests to improve the out-of-the box experience and
performance of AArch64 GCC users, particularly those porting software from other
architectures. This has many aspects. One such aspect are apps built natively
with an -march=native used as a tuning flag in the Makefile.
On AArch64 this selects the right architecture features on GNU+Linux for the
host system but tunes for the "generic" CPU target.
This patch makes GCC also tune for the host CPU, as well as selecting its
architecture. That is, it translates -march=native into -mcpu=native.
This maintains the documentation that it "causes the compiler to pick the
architecture of the host system" since -mcpu=native does that, but it also
gives a better performance experience for the user.

If the user explicitly asked for a particular CPU tuning through -mcpu or
-mtune then we don't do this rewriting so that the user option is honoured.

This would have been a one-line patch if it wasn't for --with-tune
configure-time arguments. When GCC is configured with --with-tune=<CORE> the
OPTION_DEFAULT_SPECS will insert an -mtune=<CORE> in the options if no other
-mcpu or -mtune options were given. This will spook the aforementioned desired
rewriting of -march=native into -mcpu=native, though I'd argue that we want to
do the rewrite even then. Therefore, this patch moves some specs in aarch64.h
around and refactors the --with-tune rewriting into CONFIG_TUNE_SPEC so that
the materialization of the implicit -mtune=<CORE> does not happen if -march=native
is used.

Bootstrapped and tested on aarch64-none-linux-gnu and checked with the output
of -### from the driver that the option rewriting works as expected on
aarch64-linux-gnu.

gcc/ChangeLog:

* config/aarch64/aarch64.h (HAVE_LOCAL_CPU_DETECT,
EXTRA_SPEC_FUNCTIONS, MCPU_MTUNE_NATIVE_SPECS): Move definitions up before
OPTION_DEFAULT_SPECS.
(MCPU_MTUNE_NATIVE_SPECS): Pass "cpu" to
local_cpu_detect when rewriting -march=native and no -mcpu or -mtune
is given.
(CONFIG_TUNE_SPEC): Define.
(OPTION_DEFAULT_SPECS): Use CONFIG_TUNE_SPEC for "tune".

19 months ago[PR106967] frange: revamp relational operators for NANs.
Aldy Hernandez [Tue, 20 Sep 2022 14:19:14 +0000 (16:19 +0200)]
[PR106967] frange: revamp relational operators for NANs.

Since NANs can be inserted by other passes even for -ffinite-math-only,
we can't depend on the flag to determine if a NAN is a possiblity.
Instead, we must explicitly check for them.

In the case of -ffinite-math-only, paths leading up to a NAN are
undefined and can be considered unreachable.  I have audited all the
relational code and made sure we're handling the known NAN case before
anything else, setting undefined when appropriate.

In the process, I revamped all the relational code handling NANs to
correctly notice paths that are unreachable.

The basic structure for ordered relational operators (except != of
course) is this:

If either operand is a known NAN, return FALSE.

The true side of a relop when one operand is a NAN is
unreachable.

On the false side of a relop when one operand is a NAN, we
know nothing about the other operand.

Regstrapped on x86-64 and ppc64le Linux.
lapack testing on x86-64 with and without -ffinite-math-only.

PR tree-optimization/106967

gcc/ChangeLog:

* range-op-float.cc (foperator_equal::fold_range): Adjust for NAN.
(foperator_equal::op1_range): Same.
(foperator_not_equal::fold_range): Same.
(foperator_not_equal::op1_range): Same.
(foperator_lt::fold_range): Same.
(foperator_lt::op1_range): Same.
(foperator_lt::op2_range): Same.
(foperator_le::fold_range): Same.
(foperator_le::op1_range): Same.
(foperator_le::op2_range): Same.
(foperator_gt::fold_range): Same.
(foperator_gt::op1_range): Same.
(foperator_gt::op2_range): Same.
(foperator_ge::fold_range): Same.
(foperator_ge::op1_range): Same.
(foperator_ge::op2_range): Same.
(foperator_unordered::op1_range): Same.
(foperator_ordered::fold_range): Same.
(foperator_ordered::op1_range): Same.
(build_le): Assert that we don't have a NAN.
(build_lt): Same.
(build_gt): Same.
(build_ge): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr106967.c: New test.

19 months agoFortran: add symbols in version map for IEEE_GET_MODES and IEEE_SET_MODES
Francois-Xavier Coudert [Wed, 21 Sep 2022 08:04:22 +0000 (10:04 +0200)]
Fortran: add symbols in version map for IEEE_GET_MODES and IEEE_SET_MODES

The symbols were forgotten in the patch that added IEEE_GET_MODES
and IEEE_SET_MODES.

2022-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/

* gfortran.map: Add symbols for IEEE_GET_MODES
and IEEE_SET_MODES.

19 months agoDon't check can_vec_perm_const_p for nonlinear iv_init when it's constant.
liuhongt [Tue, 20 Sep 2022 05:22:28 +0000 (13:22 +0800)]
Don't check can_vec_perm_const_p for nonlinear iv_init when it's constant.

When init_expr is INTEGER_CST or REAL_CST, can_vec_perm_const_p is not
necessary since there's no real vec_perm needed, but
vec_gen_perm_mask_checked will gcc_assert (can_vec_perm_const_p). So
it's better to use vec_gen_perm_mask_any in
vect_create_nonlinear_iv_init.

gcc/ChangeLog:

PR tree-optimization/106963
* tree-vect-loop.cc (vect_create_nonlinear_iv_init): Use
vec_gen_perm_mask_any instead of vec_gen_perm_mask_check.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106963.c: New test.

19 months agolibstdc++: Remove trailing whitespace in documentation sources
Jonathan Wakely [Wed, 21 Sep 2022 00:18:38 +0000 (01:18 +0100)]
libstdc++: Remove trailing whitespace in documentation sources

libstdc++-v3/ChangeLog:

* doc/xml/manual/documentation_hacking.xml: Remove trailing
whitespace.
* doc/xml/manual/policy_data_structures.xml: Likewise.

19 months agolibstdc++: Add _Exit to <stdlib.h> for freestanding
Jonathan Wakely [Tue, 20 Sep 2022 23:48:12 +0000 (00:48 +0100)]
libstdc++: Add _Exit to <stdlib.h> for freestanding

When I added std::_Exit to the freestanding declarations in <cstdlib> I
should also have added it to <stdlib.h>.

libstdc++-v3/ChangeLog:

* include/c_compatibility/stdlib.h [!_GLIBCXX_HOSTED]: Add
using-declaration for _Exit.

19 months agolibstdc++: Qualify std::abort() in test
Jonathan Wakely [Tue, 20 Sep 2022 23:39:14 +0000 (00:39 +0100)]
libstdc++: Qualify std::abort() in test

This test includes <cstdlib> so should use std::abort not ::abort.

libstdc++-v3/ChangeLog:

* testsuite/18_support/uncaught_exception/14026.cc: Qualify
call to std::abort.

19 months agolibstdc++: Add <initializer_list> to ranges_base.h header
Jonathan Wakely [Tue, 20 Sep 2022 23:46:04 +0000 (00:46 +0100)]
libstdc++: Add <initializer_list> to ranges_base.h header

The header should be included explicitly to use std::initializer_list.
With the upcoming changes to make <ranges> available for freestanding
this becomes an error, because <initializer_list> is no longer provided
by any of the other headers involved here.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h: Include <initializer_list>.

19 months agoDaily bump.
GCC Administrator [Wed, 21 Sep 2022 00:19:14 +0000 (00:19 +0000)]
Daily bump.

19 months agoFortran: F2018 type(*),dimension(*) with scalars [PR104143]
Tobias Burnus [Tue, 20 Sep 2022 21:06:19 +0000 (23:06 +0200)]
Fortran: F2018 type(*),dimension(*) with scalars [PR104143]

Assumed-size dummy arguments accept arrays and array elements as actual
arguments. There are also a few exceptions when real scalars are permitted.
Since F2018, this includes scalar arguments to assumed-type dummies; while
type(*) was added in TS29113, this change is only in F2018 itself.

PR fortran/104143

gcc/fortran/ChangeLog:

* interface.cc (compare_parameter): Permit scalar args to
'type(*), dimension(*)'.

gcc/testsuite/ChangeLog:

* gfortran.dg/c-interop/c407b-2.f90: Remove dg-error.
* gfortran.dg/assumed_type_16.f90: New test.
* gfortran.dg/assumed_type_17.f90: New test.

19 months agoFortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]
Harald Anlauf [Tue, 20 Sep 2022 20:41:48 +0000 (22:41 +0200)]
Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]

gcc/fortran/ChangeLog:

PR fortran/106986
* simplify.cc (gfc_simplify_findloc): Do not try to simplify
intrinsic FINDLOC when the ARRAY argument has a NULL shape.

gcc/testsuite/ChangeLog:

PR fortran/106986
* gfortran.dg/pr106986.f90: New test.

20 months agoFortran: NULL pointer dereference in invalid simplification [PR106985]
Harald Anlauf [Tue, 20 Sep 2022 20:23:43 +0000 (22:23 +0200)]
Fortran: NULL pointer dereference in invalid simplification [PR106985]

gcc/fortran/ChangeLog:

PR fortran/106985
* expr.cc (gfc_simplify_expr): Avoid NULL pointer dereference.

gcc/testsuite/ChangeLog:

PR fortran/106985
* gfortran.dg/pr106985.f90: New test.

20 months agoc++: xtreme-header modules tests cleanups
Patrick Palka [Tue, 20 Sep 2022 20:13:48 +0000 (16:13 -0400)]
c++: xtreme-header modules tests cleanups

This adds some recently implemented C++20/23 library headers to the
xtreme-header tests as appropriate.  Also, it looks like we can safely
re-add <execution> and remove the NO_ASSOCIATED_LAMBDA workaround.

gcc/testsuite/ChangeLog:

* g++.dg/modules/xtreme-header-2.h: Include <execution>.
* g++.dg/modules/xtreme-header-6.h: Include implemented
C++20 library headers.
* g++.dg/modules/xtreme-header.h: Likewise.  Remove
NO_ASSOCIATED_LAMBDA workaround.  Include implemented C++23
library headers.

20 months agoc++: modules and non-dependent auto deduction
Patrick Palka [Tue, 20 Sep 2022 20:08:14 +0000 (16:08 -0400)]
c++: modules and non-dependent auto deduction

The modules streaming code seems to rely on the invariant that a
TEMPLATE_DECL and its DECL_TEMPLATE_RESULT have the same TREE_TYPE.
But for a non-dependent VAR_DECL with deduced type, the two TREE_TYPEs
end up diverging: cp_finish_decl deduces the type of the initializer
ahead of time and updates the TREE_TYPE of the VAR_DECL, but neglects to
update the corresponding TEMPLATE_DECL as well, which leads to a
"conflicting global module declaration" error for each of the
__phase_alignment decls in the below testcase (and for the xtreme-header
tests if we try including <barrier>).

This patch makes cp_finish_decl update the TREE_TYPE of the corresponding
TEMPLATE_DECL so that the invariant is maintained.

gcc/cp/ChangeLog:

* decl.cc (cp_finish_decl): After updating the deduced type of a
VAR_DECL, also update the corresponding TEMPLATE_DECL if there
is one.

gcc/testsuite/ChangeLog:

* g++.dg/modules/auto-3.h: New test.
* g++.dg/modules/auto-3_a.H: New test.
* g++.dg/modules/auto-3_b.C: New test.

20 months agoFortran: Fix function attributes [PR100132]
José Rui Faustino de Sousa [Mon, 19 Sep 2022 20:00:45 +0000 (22:00 +0200)]
Fortran: Fix function attributes [PR100132]

gcc/fortran/ChangeLog:

PR fortran/100132
* trans-types.cc (create_fn_spec): Fix function attributes when
passing polymorphic pointers.

gcc/testsuite/ChangeLog:

PR fortran/100132
* gfortran.dg/PR100132.f90: New test.

20 months agofrange::maybe_isnan() should return FALSE for undefined ranges.
Aldy Hernandez [Tue, 20 Sep 2022 14:09:31 +0000 (16:09 +0200)]
frange::maybe_isnan() should return FALSE for undefined ranges.

Undefined ranges have undefined NAN bits.  We can't depend on them,
as they may contain garbage.  This patch returns false from
maybe_isnan() for undefined ranges (the empty set).

gcc/ChangeLog:

* value-range.h (frange::maybe_isnan): Return false for
undefined ranges.

20 months agofrange::set_nonnegative should not contain -NAN.
Aldy Hernandez [Mon, 19 Sep 2022 07:59:01 +0000 (09:59 +0200)]
frange::set_nonnegative should not contain -NAN.

A specifically nonnegative range should not contain -NAN, otherwise
signbit_p() would return false, because we'd be unsure of the sign.

PR 68097/tree-optimization

gcc/ChangeLog:

* value-range.cc (frange::set_nonnegative): Set +NAN.
(range_tests_signed_zeros): New test.
* value-range.h (frange::update_nan): New overload to set NAN sign.

20 months agofortran: add link to ISO_VARYING_STRING module [PR106636]
Martin Liska [Tue, 20 Sep 2022 12:23:29 +0000 (14:23 +0200)]
fortran: add link to ISO_VARYING_STRING module [PR106636]

PR fortran/106636

gcc/fortran/ChangeLog:

* gfortran.texi: Add back link to ISO_VARYING_STRING.

20 months agoaarch64: Fix GTY markup for arm_sve.h [PR106491]
Richard Sandiford [Tue, 20 Sep 2022 14:27:47 +0000 (15:27 +0100)]
aarch64: Fix GTY markup for arm_sve.h [PR106491]

It turns out that GTY(()) markers in definitions like:

  GTY(()) tree scalar_types[NUM_VECTOR_TYPES];

are not effective and are silently ignored.  The GTY(()) has
to come after an extern or static.

The externs associated with the SVE ACLE GTY variables are in
aarch64-sve-builtins.h.  This file is not in tm_include_list because
we don't want every target-facing file to include it.  It therefore
isn't in the list of GC header files either.

In this case that's a blessing in disguise, since the variables
belong to a namespace and gengtype doesn't understand namespaces.
I think the fix is instead to add an extra extern before each
variable declaration, similarly to varasm.cc and vtable-verify.cc.
(This works due to a "using namespace" at the end of the file.)

gcc/
PR target/106491
* config/aarch64/aarch64-sve-builtins.cc (scalar_types)
(acle_vector_types, acle_svpattern, acle_svprfop): Add GTY
markup to (new) extern declarations instead of to the main
definition.

20 months agovect: Fix SLP layout handling of masked loads [PR106794]
Richard Sandiford [Tue, 20 Sep 2022 14:27:47 +0000 (15:27 +0100)]
vect: Fix SLP layout handling of masked loads [PR106794]

PR106794 shows that I'd forgotten about masked loads when
doing the SLP layout changes.  These loads can't currently
be permuted independently of their mask input, so during
construction they never get a load permutation.

(If we did support permuting masked loads in future, the mask
would need to be in the right order for the load, rather than in
the order implied by the result of the permutation.  Since masked
loads can't be partly or fully scalarised in the way that normal
permuted loads can be, there's probably no benefit to fusing the
permutation and the load.  Permutation after the fact is probably
good enough.)

gcc/
PR tree-optimization/106794
PR tree-optimization/106914
* tree-vect-slp.cc (vect_optimize_slp_pass::internal_node_cost):
Only consider loads that already have a permutation.
(vect_optimize_slp_pass::start_choosing_layouts): Assert that
loads with permutations are leaf nodes.  Prevent any kind of grouped
access from changing layout if it doesn't have a load permutation.

gcc/testsuite/
* gcc.dg/vect/pr106914.c: New test.
* g++.dg/vect/pr106794.cc: Likewise.

20 months agovect: Fix missed gather load opportunity
Richard Sandiford [Tue, 20 Sep 2022 14:27:46 +0000 (15:27 +0100)]
vect: Fix missed gather load opportunity

While writing a testcase for PR106794, I noticed that we failed
to vectorise the testcase in the patch for SVE.  The code that
recognises gather loads tries to optimise the point at which
the offset is calculated, to avoid unnecessary extensions or
truncations:

  /* Don't include the conversion if the target is happy with
     the current offset type.  */

But breaking only makes sense if we're at an SSA_NAME (which could
then be vectorised).  We shouldn't break on a conversion embedded
in a generic expression.

gcc/
* tree-vect-data-refs.cc (vect_check_gather_scatter): Restrict
early-out optimisation to SSA_NAMEs.

gcc/testsuite/
* gcc.dg/vect/vect-gather-5.c: New test.

20 months ago[PR106970] New test for PR that has already been fixed.
Aldy Hernandez [Tue, 20 Sep 2022 14:06:05 +0000 (16:06 +0200)]
[PR106970] New test for PR that has already been fixed.

PR tree-optimization/106970

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr106970.c: New test.

20 months agoc++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
Patrick Palka [Tue, 20 Sep 2022 14:19:30 +0000 (10:19 -0400)]
c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]

It looks like after the libstdc++ commit r13-2158-g02f6b405f0e9dc
some xtreme-header-* tests are failing with "conflicting global module
declaration" errors ultimately because we're neglecting to stream
PACK_EXPANSION_EXTRA_ARGS, which leads to wrong equivalences of
different partial instantiations of _TupleConstraints::__constructible.

PR c++/106761

gcc/cp/ChangeLog:

* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
Stream PACK_EXPANSION_EXTRA_ARGS.
(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr106761.h: New test.
* g++.dg/modules/pr106761_a.H: New test.
* g++.dg/modules/pr106761_b.C: New test.

20 months agoreplace "the the" typos
Martin Liska [Tue, 20 Sep 2022 13:05:33 +0000 (15:05 +0200)]
replace "the the" typos

gcc/ada/ChangeLog:

* exp_ch6.adb: Replace "the the" with "the".
* sem_ch6.adb: Likewise.
* sem_disp.ads: Likewise.

gcc/ChangeLog:

* ctfc.cc (ctf_add_string): Replace "the the" with "the".
* doc/md.texi: Likewise.
* gimple-range-infer.cc (non_null_loadstore): Likewise.

gcc/fortran/ChangeLog:

* gfortran.texi: Replace "the the" with "the".

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wclass-memaccess.C: Replace "the the" with "the".
* g++.dg/warn/Wconversion-real-integer2.C: Likewise.
* gcc.target/powerpc/p9-extract-1.c: Likewise.
* gcc.target/s390/s390.exp: Likewise.
* gcc.target/s390/zvector/vec-cmp-2.c: Likewise.
* gdc.dg/torture/simd_store.d: Likewise.
* gfortran.dg/actual_array_offset_1.f90: Likewise.
* gfortran.dg/pdt_15.f03: Likewise.
* gfortran.dg/pointer_array_8.f90: Likewise.

20 months agolibstdc++: Fix typo in <cstdlib> for freestanding
Jonathan Wakely [Tue, 20 Sep 2022 12:20:33 +0000 (13:20 +0100)]
libstdc++: Fix typo in <cstdlib> for freestanding

libstdc++-v3/ChangeLog:

* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (quick_exit): Fix
missing space.

20 months agofortran: remove 2 dead links [PR106636]
Martin Liska [Tue, 20 Sep 2022 12:02:34 +0000 (14:02 +0200)]
fortran: remove 2 dead links [PR106636]

PR fortran/106636

gcc/fortran/ChangeLog:

* gfortran.texi: Remove 2 dead links.

20 months agocontrib: skip new egrep warning
Martin Liska [Tue, 20 Sep 2022 08:16:47 +0000 (10:16 +0200)]
contrib: skip new egrep warning

contrib/ChangeLog:

* filter-clang-warnings.py: Skip egrep: warning: egrep is
  obsolescent; using grep -E.

20 months agoSupport 64-bit vectorization for single-precision floating rounding operation.
liuhongt [Fri, 16 Sep 2022 06:28:34 +0000 (14:28 +0800)]
Support 64-bit vectorization for single-precision floating rounding operation.

Here's list the patch supported.
rint/nearbyint/ceil/floor/trunc/lrint/lceil/lfloor/round/lround.

gcc/ChangeLog:

PR target/106910
* config/i386/mmx.md (nearbyintv2sf2): New expander.
(rintv2sf2): Ditto.
(ceilv2sf2): Ditto.
(lceilv2sfv2si2): Ditto.
(floorv2sf2): Ditto.
(lfloorv2sfv2si2): Ditto.
(btruncv2sf2): Ditto.
(lrintv2sfv2si2): Ditto.
(roundv2sf2): Ditto.
(lroundv2sfv2si2): Ditto.
(*mmx_roundv2sf2): New define_insn.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106910-1.c: New test.

20 months agomiddle-end: handle bitop with an invariant induction.[PR105735]
konglin1 [Tue, 20 Sep 2022 05:58:35 +0000 (13:58 +0800)]
middle-end: handle bitop with an invariant induction.[PR105735]

Enhance final_value_replacement_loop to handle bitop
with an invariant induction.

This patch will enable below optimization:

{
-  long unsigned int bit;
-
-  <bb 2> [local count: 32534376]:
-
-  <bb 3> [local count: 1041207449]:
-  # tmp_10 = PHI <tmp_7(5), tmp_4(D)(2)>
-  # bit_12 = PHI <bit_8(5), 0(2)>
-  tmp_7 = bit2_6(D) & tmp_10;
-  bit_8 = bit_12 + 1;
-  if (bit_8 != 32)
-    goto <bb 5>; [96.97%]
-  else
-    goto <bb 4>; [3.03%]
-
-  <bb 5> [local count: 1009658865]:
-  goto <bb 3>; [100.00%]
-
-  <bb 4> [local count: 32534376]:
-  # tmp_11 = PHI <tmp_7(3)>
-  return tmp_11;
+  tmp_11 = tmp_4 (D) & bit2_6 (D);
+  return tmp_11;

}

gcc/ChangeLog:

PR middle-end/105735
* tree-scalar-evolution.cc
(analyze_and_compute_bitop_with_inv_effect): New function.
(final_value_replacement_loop): Enhanced to handle bitop
with inv induction.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr105735-1.c: New test.
* gcc.target/i386/pr105735-2.c: New test.

20 months agoLoongArch: Prepare static PIE support
Xi Ruoyao [Tue, 13 Sep 2022 15:21:39 +0000 (23:21 +0800)]
LoongArch: Prepare static PIE support

Static PIE allows us to extend the ASLR to cover static executables and
it's not too difficult to support it.  On GCC side, we just pass a group
of options to the linker, like other ports with static PIE support.

The real implementation of static PIE (rcrt1.o) will be added into Glibc
later.

gcc/ChangeLog:

* config/loongarch/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): For
-static-pie, pass -static -pie --no-dynamic-linker -z text to
the linker, and do not pass --dynamic-linker.

20 months agofrange: flush denormals to zero
Aldy Hernandez [Sat, 17 Sep 2022 08:17:13 +0000 (10:17 +0200)]
frange: flush denormals to zero

For some architectures (or for -funsafe-math-optimizations) we may
flush denormals to zero, in which case we need to be careful to
extend the ranges to the appropriate zero.  This patch does exactly that.
For a range of [x, -DENORMAL] we flush to [x, -0.0] and for [+DENORMAL, x]
we flush to [+0.0, x].

gcc/ChangeLog:

* value-range.cc (frange::flush_denormals_to_zero): New.
(frange::set): Call flush_denormals_to_zero.
* value-range.h (class frange): Add flush_denormals_to_zero.

20 months agoAdjust issue_rate for latest Intel processors.
liuhongt [Tue, 6 Sep 2022 03:04:40 +0000 (11:04 +0800)]
Adjust issue_rate for latest Intel processors.

For Skylake based processor, decoder is 4-way.
For Sunny Cove and Willow Cove, decoder is 5-way.
For Golden cove, decoder is 6-way.

gcc/ChangeLog:

* config/i386/x86-tune-sched.cc (ix86_issue_rate): Adjust for
latest Intel processors.

20 months agoi386: Fixed vec_init_dup_v16bf [PR106887]
konglin1 [Fri, 16 Sep 2022 07:59:19 +0000 (15:59 +0800)]
i386: Fixed vec_init_dup_v16bf [PR106887]

gcc/ChangeLog:

PR target/106887
* config/i386/i386-expand.cc (ix86_expand_vector_init_duplicate):
Fixed V16BF mode case.

gcc/testsuite/ChangeLog:

PR target/106887
* gcc.target/i386/vect-bfloat16-2c.c: New test.

20 months agoDaily bump.
GCC Administrator [Tue, 20 Sep 2022 00:17:49 +0000 (00:17 +0000)]
Daily bump.

20 months agoc: Stray inform note with -Waddress [PR106947]
Marek Polacek [Mon, 19 Sep 2022 18:12:55 +0000 (14:12 -0400)]
c: Stray inform note with -Waddress [PR106947]

A trivial fix for maybe_warn_for_null_address where we print an
inform note without first checking the return value of a warning
call.

PR c/106947

gcc/c/ChangeLog:

* c-typeck.cc (maybe_warn_for_null_address): Don't emit stray
notes.

gcc/testsuite/ChangeLog:

* c-c++-common/Waddress-7.c: New test.

20 months agoFortran: add IEEE_MODES_TYPE, IEEE_GET_MODES and IEEE_SET_MODES
Francois-Xavier Coudert [Sun, 4 Sep 2022 16:24:23 +0000 (18:24 +0200)]
Fortran: add IEEE_MODES_TYPE, IEEE_GET_MODES and IEEE_SET_MODES

The IEEE_MODES_TYPE type and the two functions that get and set it
were added in Fortran 2018.  They can be implemented using the already
existing target-specific functions.  A future optimization could, on
some targets, set/get all modes through one or two instructions only,
but that would need a new set of functions in all config/fpu-* files.

2022-09-04  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/

* ieee/ieee_exceptions.F90: Add IEEE_MODES_TYPE, IEEE_GET_MODES
and IEEE_SET_MODES.
* ieee/ieee_arithmetic.F90: Make them public in IEEE_ARITHMETIC
as well.

gcc/testsuite/

* gfortran.dg/ieee/modes_1.f90: New test.

20 months agoImprove sorry message for -fzero-call-used-regs
Torbjörn SVENSSON [Thu, 15 Sep 2022 06:59:30 +0000 (08:59 +0200)]
Improve sorry message for -fzero-call-used-regs

When the -fzero-call-used-regs command line option is used with an
unsupported value, indicate that it's a value problem instead of an
option problem.

Without the patch, the error is:
In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5:
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo':
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target
   10 | }
      | ^

With the patch, the error would be like this:
 In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5:
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo':
gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: argument 'all-arg' is not supported for '-fzero-call-used-regs' on this target
   10 | }
      | ^

2022-09-19  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>

gcc/ChangeLog:

* targhooks.cc (default_zero_call_used_regs): Improve sorry
message.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
20 months agoFortran: F2018 rounding modes changes
Francois-Xavier Coudert [Wed, 31 Aug 2022 17:15:20 +0000 (19:15 +0200)]
Fortran: F2018 rounding modes changes

Add the new IEEE_AWAY rounding mode. It is unsupported on all known
targets, but could be supported by glibc and AIX as part of the C2x
proposal. Testing for now is minimal.

Add the optional RADIX argument to IEEE_SET_ROUNDING_MODE and
IEEE_GET_ROUNDING_MODE. It is unused for now, because we do not
support radices other than 2.

2022-08-31  Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

gcc/fortran/
* libgfortran.h: Declare GFC_FPE_AWAY.

gcc/testsuite/
* gfortran.dg/ieee/rounding_2.f90: New test.

libgfortran/
* ieee/ieee_arithmetic.F90: Add RADIX argument to
IEEE_SET_ROUNDING_MODE and IEEE_GET_ROUNDING_MODE.
* config/fpu-387.h: Add IEEE_AWAY mode.
* config/fpu-aarch64.h: Add IEEE_AWAY mode.
* config/fpu-aix.h: Add IEEE_AWAY mode.
* config/fpu-generic.h: Add IEEE_AWAY mode.
* config/fpu-glibc.h: Add IEEE_AWAY mode.
* config/fpu-sysv.h: Add IEEE_AWAY mode.

20 months agoFix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints
Georg-Johann Lay [Mon, 19 Sep 2022 07:46:58 +0000 (09:46 +0200)]
Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints

this patch fixed PR target/99184 which incorrectly rounded during 64-bit
(long) double to 16-bit and 32-bit integers.

The patch just removes the respective roundings from
libf7-asm.sx::to_integer and ::to_unsigned.  Luckily, LibF7 does nowhere
use respective functions internally, the only user is in libf7.c::f7_exp

which reads

   f7_round (qq, qq);
   int16_t q = f7_get_s16 (qq);

so that f7_get_s16() operates on an already rounded value, and therefore
this code works unaltered with or without rounding in to_integer.

PR target/99184
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
and 32-bit integers.

20 months agoDaily bump.
GCC Administrator [Mon, 19 Sep 2022 00:17:27 +0000 (00:17 +0000)]
Daily bump.

20 months agoOpenMP: Push attaches to end of clause list in "target" regions
Julian Brown [Wed, 7 Sep 2022 21:45:07 +0000 (21:45 +0000)]
OpenMP: Push attaches to end of clause list in "target" regions

This patch moves GOMP_MAP_ATTACH{_ZERO_LENGTH_ARRAY_SECTION} nodes to
the end of the clause list, for offload regions.  This ensures that when
we do the attach operation, both the "attachment point" and the target
region have both already been mapped on the target.  This avoids a
pathological case that can otherwise happen with struct sibling-list
handling.

This version of the patch moves the attach-node motion to
gimplify_adjust_omp_clauses.

2022-09-15  Julian Brown  <julian@codesourcery.com>

gcc/
* gimplify.cc (omp_segregate_mapping_groups): Update comment.
(gimplify_adjust_omp_clauses): Move ATTACH and
ATTACH_ZERO_LENGTH_ARRAY_SECTION nodes to the end of the clause list
for offloaded OpenMP regions.

gcc/testsuite/
* g++.dg/gomp/target-lambda-1.C: Adjust expected scan output.

20 months agoRemove dependency on uintptr_t in libgcc
Thomas Neumann [Sun, 18 Sep 2022 09:31:01 +0000 (11:31 +0200)]
Remove dependency on uintptr_t in libgcc

uintptr_t is no available for all targets, use __UINTPTR_TYPE__
instead.

libgcc/ChangeLog:

* unwind-dw2-fde.c: Replace uintptr_t with typedef
for __UINTPTR_TYPE__.
* unwind-dw2-btree.h: Likewise.

20 months agoRISC-V: Don't try to vectorize tree-ssa/gen-vect-34.c
Palmer Dabbelt [Sat, 3 Sep 2022 01:28:10 +0000 (18:28 -0700)]
RISC-V: Don't try to vectorize tree-ssa/gen-vect-34.c

We don't yet support vectorization on RISC-V.

gcc/testsuite/ChangeLog

* gcc.dg/tree-ssa/gen-vect-34.c: Skip RISC-V targets.

20 months ago[PR106831] Avoid propagating long doubles that may have multiple representations.
Jakub Jelinek [Sat, 17 Sep 2022 06:50:22 +0000 (08:50 +0200)]
[PR106831] Avoid propagating long doubles that may have multiple representations.

Long doubles are tricky when it comes to considering singletons
because small numbers and +-INF can have multiple representations for
the same number.  So we need to be very careful not to treat those as
singletons, lest they be incorrectly propagated by VRP.  This is
similar to the -0.0 and +0.0 duality.

In long doubles +INF can be represented with +INF in the MSB and
either -0.0 or +0.0 in the LSB.  Similarly for numbers that are exactly
representable in DF.  For example, 1.0 can be represented as either
(1.0, +0.0) or (1.0, -0.0).

This patch avoids treating these numbers as singletons.

Note that NANs in long double format have a LSB of don't care, but
this is irrelevant for singleton_p, because NANs are never considered
singletons.  Also, internally in the frange we store NANs as a pair of
boolean flags indicating whether they are +NAN or -NAN, so we don't need
any special treatment here for comparing range equality etc.  We never
see anything but the boolean flags.

PR middle-end/106831

gcc/ChangeLog:

* value-range.cc (frange::singleton_p): Avoid propagating long
doubles that may have multiple representations.

20 months agoRewrite NAN and sign handling in frange
Aldy Hernandez [Wed, 14 Sep 2022 06:32:34 +0000 (08:32 +0200)]
Rewrite NAN and sign handling in frange

The attatched patch rewrites the NAN and sign handling, dropping both
tristates in favor of a pair of boolean flags for NANs, and nothing at
all for signs.  The signs are tracked in the range itself, so now it's
possible to describe things like [-0.0, +0.0] +NAN, [+0, +0], [-5, +0],
[+0, 3] -NAN, etc.

Here is an example of the various ranges and how they are displayed:

    [frange] float VARYING NAN ;; Varying includes NAN
    [frange] UNDEFINED                      ;; Empty set as always
    [frange] float [] +-NAN                 ;; Unknown sign NAN
    [frange] float [] -NAN                  ;; -NAN
    [frange] float [] +NAN                  ;; +NAN
    [frange] float [-0.0, 0.0]              ;; All zeros.
    [frange] float [-0.0, -0.0] +-NAN       ;; -0 or NAN.
    [frange] float [-5.0e+0, -1.0e+0] +NAN  ;; [-5, -1] or +NAN
    [frange] float [-5.0e+0, -0.0] +-NAN    ;; [-5, -0] or NAN
    [frange] float [-5.0e+0, -0.0]          ;; [-5, -0]
    [frange] float [5.0e+0, 1.0e+1]         ;; [5, 10]

Notice the NAN signs are decoupled from the range, so we can represent
a negative range with a positive NAN.  For this range,
frange::signbit_p() would return false, as only when the signs of the
NANs and range agree can we be certain.

There is no longer any pessimization of ranges for intersects
involving NANs.  Also, union and intersect work with signed zeros:

//   [-0,  x] U [+0,  x] => [-0,  x]
//   [ x, -0] U [ x, +0] => [ x, +0]
//   [-0,  x] ^ [+0,  x] => [+0,  x]
//   [ x, -0] ^ [ x, +0] => [ x, -0]

The special casing for signed zeros in the singleton code is gone in
favor of just making sure the signs in the range agree, that is
[-0, -0] for example.

I have removed the idea that a known NAN is a "range", so a NAN is no
longer in the endpoints itself.  Requesting the bound of a known NAN
is a hard fail.  For that matter, we don't store the actual NAN in the
range.  The only information we have are the set of boolean flags.
This way we make sure nothing seeps into the frange.  This also means
it's explicit that we don't track anything but the sign in NANs.  We
can revisit this if we desire to track signalling or whatever
concoction y'all can imagine.

Regstrapped with mpfr tests on x86-64 and ppc64le Linux.  Selftests
were also run with -ffinite-math-only on x86-64.

At Jakub's suggestion, I built lapack with associated tests.  They
pass on x86-64 and ppc64le Linux with no regressions from mainline.
As a sanity check, I also ran them for -ffinite-math-only on x86 which
(as expected) returned:

NaN arithmetic did not perform per the ieee spec

Otherwise, all tests pass for -ffinite-math-only.

gcc/ChangeLog:

* range-op-float.cc (frange_add_zeros): Replace set_signbit with
union of zero.
* value-query.cc (range_query::get_tree_range): Remove set_signbit
use.
* value-range-pretty-print.cc (vrange_printer::print_frange_prop):
Remove.
(vrange_printer::print_frange_nan): New.
* value-range-pretty-print.h (print_frange_prop): Remove.
(print_frange_nan): New.
* value-range-storage.cc (frange_storage_slot::set_frange): Set
kind and NAN fields.
(frange_storage_slot::get_frange): Restore kind and NAN fields.
* value-range-storage.h (class frange_storage_slot): Add kind and
NAN fields.
* value-range.cc (frange::update_nan): Remove.
(frange::set_signbit): Remove.
(frange::set): Adjust for NAN fields.
(frange::normalize_kind): Remove m_props.
(frange::combine_zeros): New.
(frange::union_nans): New.
(frange::union_): Handle new NAN fields.
(frange::intersect_nans): New.
(frange::intersect): Handle new NAN fields.
(frange::operator=): Same.
(frange::operator==): Same.
(frange::contains_p): Same.
(frange::singleton_p): Remove special case for signed zeros.
(frange::verify_range): Adjust for new NAN fields.
(frange::set_zero): Handle signed zeros.
(frange::set_nonnegative): Same.
(range_tests_nan): Adjust tests.
(range_tests_signed_zeros): Same.
(range_tests_signbit): Same.
(range_tests_floats): Same.
* value-range.h (class fp_prop): Remove.
(FP_PROP_ACCESSOR): Remove.
(class frange_props): Remove
(frange::lower_bound): NANs don't have endpoints.
(frange::upper_bound): Same.
(frange_props::operator==): Remove.
(frange_props::union_): Remove.
(frange_props::intersect): Remove.
(frange::update_nan): New.
(frange::clear_nan): New.
(frange::undefined_p): New.
(frange::set_nan): New.
(frange::known_finite): Adjust for new NAN representation.
(frange::maybe_isnan): Same.
(frange::known_isnan): Same.
(frange::signbit_p): Same.
* gimple-range-fold.cc (range_of_builtin_int_call): Rename
known_signbit_p into signbit_p.

20 months agoDaily bump.
GCC Administrator [Sun, 18 Sep 2022 00:17:03 +0000 (00:17 +0000)]
Daily bump.

20 months agoFix unsigned comparison warning
Jan-Benedict Glaw [Sat, 17 Sep 2022 13:40:28 +0000 (15:40 +0200)]
Fix unsigned comparison warning

When -mfloat-abi=hard support was added, a cast went missing that
used to silence a warning in common code:

/usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o builtins.o -MT builtins.o -MMD -MP -MF ./.deps/builtins.TPo ../../gcc/gcc/builtins.cc
In file included from ./tm.h:21,
                 from ../../gcc/gcc/backend.h:28,
                 from ../../gcc/gcc/builtins.cc:27:
../../gcc/gcc/builtins.cc: In function 'int apply_args_size()':
../../gcc/gcc/config/csky/csky.h:421:13: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
  421 |   (((REGNO) >= CSKY_FIRST_PARM_REGNUM                        \
../../gcc/gcc/builtins.cc:1444:13: note: in expansion of macro 'FUNCTION_ARG_REGNO_P'
 1444 |         if (FUNCTION_ARG_REGNO_P (regno))
      |             ^~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:1146: builtins.o] Error 1

The needed (int) cast is even mentioned in the comment above, so reinstate
it here.

gcc/ChangeLog:
* config/csky/csky.h (FUNCTION_ARG_REGNO_P): Cast REGNO to (int)
to prevent warning.

20 months agoc++: modules ICE with typename friend
Patrick Palka [Sat, 17 Sep 2022 13:16:53 +0000 (09:16 -0400)]
c++: modules ICE with typename friend

A couple of xtreme-header-* modules tests began ICEing in C++23 mode
ever since r13-2650-g5d84a4418aa962 which introduced into <ranges> a
dependently scoped friend declaration:

  friend /* typename */ _OuterIter::value_type;

This happens because the streaming code assumes a TYPE_P friend must
be a class type, but here it's a TYPENAME_TYPE, which doesn't have
a TEMPLATE_INFO or CLASSTYPE_BEFRIENDING_CLASSES.  This patch tries
to correct this in a minimal way.

gcc/cp/ChangeLog:

* module.cc (friend_from_decl_list): Don't consider
CLASSTYPE_TEMPLATE_INFO for a TYPENAME_TYPE friend.
(trees_in::read_class_def): Don't add to
CLASSTYPE_BEFRIENDING_CLASSES for a TYPENAME_TYPE friend.

gcc/testsuite/ChangeLog:

* g++.dg/modules/typename-friend_a.C: New test.
* g++.dg/modules/typename-friend_b.C: New test.

20 months agoreassoc: Fix up recent regression in optimize_range_tests_cmp_bitwise [PR106958]
Jakub Jelinek [Sat, 17 Sep 2022 06:18:24 +0000 (08:18 +0200)]
reassoc: Fix up recent regression in optimize_range_tests_cmp_bitwise [PR106958]

As the following testcase reduced from glibc fmtmsg.c shows
(it doesn't ICE on x86_64/i686 unfortunately, but does on various other
arches), my last optimize_range_tests_cmp_bitwise change wasn't fully
correct.  The intent was to let all pointer operands be cast to
pointer_sized_int_node first in addition to the other casts (to type1)
which are done for id >= l cases.
But one spot I've touched used always cast to type1 (note, the (b % 4) == 3
case is impossible for pointer operands because that is for !TYPE_UNSIGNED
operands and pointers are TYPE_UNSIGNED) and in the other spot the cast
would be done only for id >= l if not useless, but for pointers we need
to cast it always.

2022-09-17  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/106958
* tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): If
id >= l, cast op to type1, otherwise to pointer_sized_int_node.
If type has pointer type, cast exp to pointer_sized_int_node
even when id < l.

* gcc.c-torture/compile/pr106958.c: New test.

20 months agoDaily bump.
GCC Administrator [Sat, 17 Sep 2022 00:17:20 +0000 (00:17 +0000)]
Daily bump.

20 months agoFix for an AutoFDO test.
Eugene Rozenfeld [Fri, 16 Sep 2022 23:25:25 +0000 (16:25 -0700)]
Fix for an AutoFDO test.

After https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c17975d81aaed49ff759c20c68b31304a6953d58
the expected inlining in indir-call--prof-2.c test happens during afdo phase instead of einline.
This patch adjusts the test accordingly.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-prof/indir-call-prof-2.c: Fix dg-final-use-autofdo.

20 months agoeliminate mutex in fast path of __register_frame
Thomas Neumann [Tue, 1 Mar 2022 20:57:35 +0000 (21:57 +0100)]
eliminate mutex in fast path of __register_frame

The __register_frame/__deregister_frame functions are used to register
unwinding frames from JITed code in a sorted list. That list itself
is protected by object_mutex, which leads to terrible performance
in multi-threaded code and is somewhat expensive even if single-threaded.
There was already a fast-path that avoided taking the mutex if no
frame was registered at all.

This commit eliminates both the mutex and the sorted list from
the atomic fast path, and replaces it with a btree that uses
optimistic lock coupling during lookup. This allows for fully parallel
unwinding and is essential to scale exception handling to large
core counts.

libgcc/ChangeLog:

* unwind-dw2-fde.c (release_registered_frames): Cleanup at shutdown.
(__register_frame_info_table_bases): Use btree in atomic fast path.
(__deregister_frame_info_bases): Likewise.
(_Unwind_Find_FDE): Likewise.
(base_from_object): Make parameter const.
(classify_object_over_fdes): Add query-only mode.
(get_pc_range): Compute PC range for lookup.
* unwind-dw2-fde.h (last_fde): Make parameter const.
* unwind-dw2-btree.h: New file.

20 months agolibstdc++: Add preprocessor conditions for freestanding [PR106953]
Jonathan Wakely [Thu, 15 Sep 2022 20:02:32 +0000 (21:02 +0100)]
libstdc++: Add preprocessor conditions for freestanding [PR106953]

This adds checks for _GLIBCXX_HOSTED to a number of headers which are
not currently installed for freestanding, but need to be for P1642R11
support. For example, <iterator> needs to be installed for C++23
freestanding mode, but without stream iterators and streambuf iterators.
Similarly, <memory> needs to be installed, but without std::allocator
and std::shared_ptr. This change disables the non-freestanding parts of
those headers.

libstdc++-v3/ChangeLog:

PR libstdc++/106953
* include/backward/auto_ptr.h [!_GLIBCXX_HOSTED]: Do not define
shared_ptr members.
* include/bits/alloc_traits.h [!_GLIBCXX_HOSTED]: Do not declare
std::allocator_traits<std::allocator<T>> specializations for
freestanding.
* include/bits/memoryfwd.h [!_GLIBCXX_HOSTED] (allocator): Do
not declare for freestanding.
* include/bits/stl_algo.h [!_GLIBCXX_HOSTED] (stable_partition):
Do not define for freestanding.
[!_GLIBCXX_HOSTED] (merge, stable_sort): Do not use temporary
buffers for freestanding.
* include/bits/stl_algobase.h [!_GLIBCXX_HOSTED]: Do not declare
streambuf iterators and overloaded algorithms using them.
* include/bits/stl_uninitialized.h [!_GLIBCXX_HOSTED]: Do not
define specialized overloads for std::allocator.
* include/bits/unique_ptr.h [!_GLIBCXX_HOSTED] (make_unique)
(make_unique_for_overwrite, operator<<): Do not define for
freestanding.
* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (_Exit): Declare.
Use _GLIBCXX_NOTHROW instead of throw().
* include/debug/assertions.h [!_GLIBCXX_HOSTED]: Ignore
_GLIBCXX_DEBUG for freestanding.
* include/debug/debug.h [!_GLIBCXX_DEBUG]: Likewise.
* include/std/bit [!_GLIBCXX_HOSTED]: Do not use the custom
__int_traits if <ext/numeric_traits.h> is available.
* include/std/functional [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
(boyer_moore_searcher, boyer_moore_horspool_searcher): Do not
define for freestanding.
* include/std/iterator [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
* include/std/memory [!_GLIBCXX_HOSTED]: Likewise.
* include/std/ranges [!_GLIBCXX_HOSTED] (istream_view): Do not
define for freestanding.
(views::__detail::__is_basic_string_view) [!_GLIBCXX_HOSTED]:
Do not define partial specialization for freestanding.

20 months agolibstdc++: Move allocator-related helpers to <bits/alloc_traits.h>
Jonathan Wakely [Fri, 16 Sep 2022 20:29:44 +0000 (21:29 +0100)]
libstdc++: Move allocator-related helpers to <bits/alloc_traits.h>

The __alloc_swap and __shrink_to_fit_aux helpers are not specific to
std::allocator, so don't belong in <bits/allocator.h>. This also
simplifies enabling <memory> for freestanding, as now we can just omit
the whole of <bits/allocator.h> for freestanding.

libstdc++-v3/ChangeLog:

* include/bits/alloc_traits.h (__alloc_swap)
(__shrink_to_fit_aux): Move here, from ...
* include/bits/allocator.h: ... here.
* include/ext/alloc_traits.h: Do not include allocator.h.

20 months agolibstdc++: Make more internal headers include their own dependencies
Jonathan Wakely [Fri, 16 Sep 2022 09:49:54 +0000 (10:49 +0100)]
libstdc++: Make more internal headers include their own dependencies

This adds required headers to a few internal headers that currently
assume their deps will be included first. It's more robust to make them
include their own dependencies, so that later refactoring or reuse of
those headers in new contexts doesn't break.

libstdc++-v3/ChangeLog:

* include/bits/stl_algo.h: Include <bits/stl_algobase.h>.
* include/bits/stl_tempbuf.h: Include headers for __try and
__catch macros, std::pair, and __gnu_cxx::__numeric_traits.
* include/bits/stream_iterator.h: Include <iosfwd> and headers
for std::addressof and std::iterator.
* include/bits/streambuf_iterator.h: Include header for
std::iterator.
* include/std/iterator: Do not include <iosfwd>.

20 months agolibstdc++: Fix compare_exchange_padding.cc test for std::atomic_ref
Jonathan Wakely [Fri, 16 Sep 2022 16:50:21 +0000 (17:50 +0100)]
libstdc++: Fix compare_exchange_padding.cc test for std::atomic_ref

This test was written assuming that std::atomic_ref clears its target's
padding on construction, but that could introduce data races. Change the
test to store a value after construction and check that its padding is
cleared by the store.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc:
Store value with non-zero padding bits after construction.

20 months agoc++: 'mutable' member within constexpr [PR92505]
Patrick Palka [Fri, 16 Sep 2022 15:10:43 +0000 (11:10 -0400)]
c++: 'mutable' member within constexpr [PR92505]

This patch permits accessing 'mutable' members of local objects during
constexpr evaluation, while continuing to reject it for global objects
(as in the last line of cpp0x/constexpr-mutable1.C).  To distinguish
between the two cases, it looks like it suffices to just check
CONSTRUCTOR_MUTABLE_POSION in cxx_eval_component_reference before
deciding to reject a DECL_MUTABLE_P member access.

PR c++/92505

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_component_reference): Check non_constant_p
sooner.  In C++14 or later, reject a DECL_MUTABLE_P member access
only if CONSTRUCTOR_MUTABLE_POISION is also set.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-mutable3.C: New test.
* g++.dg/cpp1y/constexpr-mutable1.C: New test.

20 months agolibstdc++: Fix tr1::variate_generator::engine_value_type
Jonathan Wakely [Fri, 16 Sep 2022 14:40:06 +0000 (15:40 +0100)]
libstdc++: Fix tr1::variate_generator::engine_value_type

The tr1/5_numerical_facilities/random/variate_generator/37986.cc test
fails for strict -std=c++98 mode because _Adaptor(const _Engine&) is
ill-formed in C++98 when _Engine is a reference type.

Rather than attempt to make the _Adaptor handle references and pointers,
just strip references and pointers from the _Engine type before we adapt
it. That removes the need for the _Adaptor<_Engine*> partial
specialization and avoids the reference-to-reference problem for c++98
mode.

While looking into this I noticed that the TR1 spec requires the
variate_generator<E,D>::engine_value_type to be the underlying engine
type, whereas we make it the _Adaptor<E> type that wraps the engine.

libstdc++-v3/ChangeLog:

* include/tr1/random.h (__detail::_Adaptor::_BEngine): Remove.
(__detail::_Adaptor::_M_g): Make public.
(__detail::_Adaptor<_Engine*, _Dist>): Remove partial
specialization.
(variate_generate::_Value): New helper to simplify handling of
_Engine* and _Engine& template arguments.
(variate_generate::engine_value_type): Define to underlying
engine type, not adapted type.
(variate_generate::engine()): Return underlying engine instead
of adaptor.
* testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc:
Fix comment.
* testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc:
Check member typedefs have the correct types.

20 months agolibstdc++: Do not use nullptr in C++03-compatible code
Jonathan Wakely [Fri, 16 Sep 2022 13:27:43 +0000 (14:27 +0100)]
libstdc++: Do not use nullptr in C++03-compatible code

This has to be valid as C++98/C++03.

libstdc++-v3/ChangeLog:

* include/debug/formatter.h [_GLIBCXX_DEBUG_BACKTRACE]
(_Error_formatter): Use 0 as null pointer constant.

20 months agolibstdc++: Remove __alloc_neq helper
Jonathan Wakely [Fri, 16 Sep 2022 10:39:41 +0000 (11:39 +0100)]
libstdc++: Remove __alloc_neq helper

This class template and partial specialization were added 15 years ago
to optimize allocator equality comparisons in std::list. I think it's
safe to assume that GCC is now capable of optimizing an inline
operator!= that just returns false at least as well as an inline member
function that just returns false.

libstdc++-v3/ChangeLog:

* include/bits/allocator.h (__alloc_neq): Remove.
* include/bits/stl_list.h (list::_M_check_equal_allocators):
Compare allocators directly, without __alloc_neq.

20 months agolibstdc++: Fix Doxygen commands
Jonathan Wakely [Fri, 16 Sep 2022 10:36:41 +0000 (11:36 +0100)]
libstdc++: Fix Doxygen commands

Remove the bogus -D__allocator_base=std::__new_allocator macro
definition for Doxygen, because that's an alias template for C++11 and
later, not a macro.

Fix the @cond/@endcond pair that span the end of an @addtogroup group.
Add another @endcond inside the group, and another @cond after it.

libstdc++-v3/ChangeLog:

* doc/doxygen/user.cfg.in (PREDEFINED): Remove __allocator_base.
* include/bits/allocator.h: Fix nesting of Doxygen commands.

20 months agoc++: member fn in omp loc list [PR106858]
Jason Merrill [Thu, 15 Sep 2022 20:55:50 +0000 (22:55 +0200)]
c++: member fn in omp loc list [PR106858]

this-f names a member function, which isn't an addressable lvalue.  Give a
helpful error instead of crashing.  The first hunk makes the error range
cover the whole expression.

PR c++/106858

gcc/cp/ChangeLog:

* parser.cc (cp_parser_omp_var_list_no_open): Pass the
initial token location down.
* semantics.cc (finish_omp_clauses): Check
invalid_nonstatic_memfn_p.
* typeck.cc (invalid_nonstatic_memfn_p): Handle null TREE_TYPE.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/map-3.C: New test.

20 months agolibstdc++: Document new libstdc++.so symbol versions
Jonathan Wakely [Fri, 16 Sep 2022 09:16:04 +0000 (10:16 +0100)]
libstdc++: Document new libstdc++.so symbol versions

libstdc++-v3/ChangeLog:

* doc/xml/manual/abi.xml: Document GLIBCXX_3.4.30 and
GLIBCXX_3.4.31 versions.
* doc/html/manual/abi.html: Regenerate.

20 months agoModernize ix86_builtin_vectorized_function with corresponding expanders.
liuhongt [Thu, 15 Sep 2022 10:43:16 +0000 (18:43 +0800)]
Modernize ix86_builtin_vectorized_function with corresponding expanders.

For ifloor/lfloor/iceil/lceil/irint/lrint/iround/lround when size of
in_mode is not equal out_mode, vectorizer doesn't go to internal fn
way,still left that part in the ix86_builtin_vectorized_function.

Remove others builtins and add corresponding expanders.

gcc/ChangeLog:

PR target/106910
* config/i386/i386-builtins.cc
(ix86_builtin_vectorized_function): Modernized with
corresponding expanders.
* config/i386/sse.md (lrint<mode><sseintvecmodelower>2): New
expander.
(floor<mode>2): Ditto.
(lfloor<mode><sseintvecmodelower>2): Ditto.
(ceil<mode>2): Ditto.
(lceil<mode><sseintvecmodelower>2): Ditto.
(btrunc<mode>2): Ditto.
(lround<mode><sseintvecmodelower>2): Ditto.
(exp2<mode>2): Ditto.

20 months agoDaily bump.
GCC Administrator [Fri, 16 Sep 2022 00:16:53 +0000 (00:16 +0000)]
Daily bump.

20 months agolibstdc++: Remove unnecessary header from <memory>
Jonathan Wakely [Thu, 15 Sep 2022 17:21:32 +0000 (18:21 +0100)]
libstdc++: Remove unnecessary header from <memory>

Previously <memory> included <bits/stl_algobase.h> so that std::copy,
std::fill etc. could be used by <bits/stl_uninitialized.h>. But that
includes it explicitly now, so that it can be compiled as a header unit.
There's no need to include it in <memory>, where its purpose isn't
obvious.

libstdc++-v3/ChangeLog:

* include/std/memory: Do not include <bits/stl_algobase.h>.

20 months agoFortran: catch NULL pointer dereferences while simplifying PACK [PR106857]
Harald Anlauf [Thu, 15 Sep 2022 20:39:24 +0000 (22:39 +0200)]
Fortran: catch NULL pointer dereferences while simplifying PACK [PR106857]

gcc/fortran/ChangeLog:

PR fortran/106857
* simplify.cc (gfc_simplify_pack): Check for NULL pointer dereferences
while walking through constructors (error recovery).

gcc/testsuite/ChangeLog:

PR fortran/106857
* gfortran.dg/pr106857.f90: New test.

20 months agoFortran: error recovery for bad deferred character length assignment [PR104314]
Harald Anlauf [Thu, 15 Sep 2022 20:06:53 +0000 (22:06 +0200)]
Fortran: error recovery for bad deferred character length assignment [PR104314]

gcc/fortran/ChangeLog:

PR fortran/104314
* resolve.cc (deferred_op_assign): Do not try to generate temporary
for deferred character length assignment if types do not agree.

gcc/testsuite/ChangeLog:

PR fortran/104314
* gfortran.dg/pr104314.f90: New test.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
20 months agofloat.h: Do not define INFINITY for C2x when infinities not supported
Joseph Myers [Thu, 15 Sep 2022 20:10:42 +0000 (20:10 +0000)]
float.h: Do not define INFINITY for C2x when infinities not supported

C2x has changed the rules for defining INFINITY in <float.h> so it is
no longer defined when float does not support infinities, instead of
being defined to an expression that overflows at translation time.
Thus, make the definition conditional on __FLT_HAS_INFINITY__ (this is
already inside a C2x-conditional part of <float.h>, because previous C
standard versions only had this macro in <math.h>).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.  Also did a
spot test of the case of no infinities supported by building cc1 for
vax-netbsdelf and testing compiling the new c2x-float-11.c test with
it.

gcc/
* ginclude/float.h (INFINITY): Define only if
[__FLT_HAS_INFINITY__].

gcc/testsuite/
* gcc.dg/c2x-float-2.c: Require inff effective-target.
* gcc.dg/c2x-float-11.c: New test.

20 months agolibstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>>
Jonathan Wakely [Thu, 15 Sep 2022 15:57:30 +0000 (16:57 +0100)]
libstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>>

Do not use the __tsan_mutex_not_static flag for annotation functions
where it's not a valid flag.  Also use the try_lock and try_lock_failed
flags to more precisely annotate the CAS loop used to acquire a lock.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (_GLIBCXX_TSAN_MUTEX_PRE_LOCK):
Replace with ...
(_GLIBCXX_TSAN_MUTEX_TRY_LOCK): ... this, add try_lock flag.
(_GLIBCXX_TSAN_MUTEX_TRY_LOCK_FAILED): New macro using
try_lock_failed flag
(_GLIBCXX_TSAN_MUTEX_POST_LOCK): Rename to ...
(_GLIBCXX_TSAN_MUTEX_LOCKED): ... this.
(_GLIBCXX_TSAN_MUTEX_PRE_UNLOCK): Remove invalid flag.
(_GLIBCXX_TSAN_MUTEX_POST_UNLOCK): Remove invalid flag.
(_Sp_atomic::_Atomic_count::lock): Use new macros.

20 months agolibstdc++: Implement ranges::chunk_by_view from P2443R1
Patrick Palka [Thu, 15 Sep 2022 17:16:51 +0000 (13:16 -0400)]
libstdc++: Implement ranges::chunk_by_view from P2443R1

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__adjacent_find_fn, adjacent_find):
Move to ...
* include/bits/ranges_util.h: ... here.
* include/std/ranges (chunk_by_view): Define.
(chunk_by_view::_Iterator): Define.
(__detail::__can_chunk_by_view): Define.
(_ChunkBy, chunk_by): Define.
* testsuite/std/ranges/adaptors/chunk_by/1.cc: New test.

20 months agolibstdc++: [_GLIBCXX_INLINE_VERSION] Fix test dg-prune-output
François Dumont [Wed, 14 Sep 2022 17:14:48 +0000 (19:14 +0200)]
libstdc++: [_GLIBCXX_INLINE_VERSION] Fix test dg-prune-output

libstdc++-v3/ChangeLog:

* testsuite/20_util/is_complete_or_unbounded/memoization_neg.cc:
Adapt dg-prune-output to _GLIBCXX_INLINE_VERSION mode.

20 months agolibstdc++: [_GLIBCXX_INLINE_VERSION] Cleanup gnu-versioned-namespace.ver
François Dumont [Wed, 14 Sep 2022 17:11:51 +0000 (19:11 +0200)]
libstdc++: [_GLIBCXX_INLINE_VERSION] Cleanup gnu-versioned-namespace.ver

Remove expressions for symbols in std::__detail::__8 namespace, they are obsolete since
version namespace applies only at std:: level, not at sub-levels.

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu-versioned-namespace.ver: Remove obsolete std::__detail::__8
symbols.

20 months agoMAINTAINERS: Add myself to Write After Approval
Torbjörn SVENSSON [Thu, 15 Sep 2022 12:42:13 +0000 (14:42 +0200)]
MAINTAINERS: Add myself to Write After Approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

20 months agotree-optimization/106922 - PRE and virtual operand translation
Richard Biener [Thu, 15 Sep 2022 11:33:23 +0000 (13:33 +0200)]
tree-optimization/106922 - PRE and virtual operand translation

PRE implicitely keeps virtual operands at the blocks incoming version
but the explicit updating point during PHI translation fails to trigger
when there are no PHIs at all in a block.  Later lazy updating then
fails because of a too lose block check.  A similar issues plagues
reference invalidation when checking the ANTIC_OUT to ANTIC_IN
translation.  The following fixes both and makes the lazy updating
work.

The diagnostic testcase unfortunately requires boost so the
testcase is the one I reduced for a missed optimization in PRE.
The testcase fails with -m32 on x86_64 because we optimize too
much before PRE which causes PRE to not trigger so we fail to
eliminate a full redundancy.  I'm going to open a separate bug
for this.  Hopefully the !lp64 selector is good enough.

PR tree-optimization/106922
* tree-ssa-pre.cc (translate_vuse_through_block): Only
keep the VUSE if its def dominates PHIBLOCK.
(prune_clobbered_mems): Rewrite logic so we check whether
a value dies in a block when the VUSE def doesn't dominate it.

* g++.dg/tree-ssa/pr106922.C: New testcase.

20 months agoMove void_list_node init to common code
Richard Biener [Wed, 14 Sep 2022 13:59:37 +0000 (15:59 +0200)]
Move void_list_node init to common code

All frontends replicate this, so move it.

gcc/
* tree.cc (build_common_tree_nodes): Initialize void_list_node
here.

gcc/ada/
* gcc-interface/trans.cc (gigi): Do not initialize void_list_node.

gcc/c-family/
* c-common.h (build_void_list_node): Remove.
* c-common.cc (c_common_nodes_and_builtins): Do not initialize
void_list_node.

gcc/c/
* c-decl.cc (build_void_list_node): Remove.

gcc/cp/
* decl.cc (cxx_init_decl_processing): Inline last
build_void_list_node call.
(build_void_list_node): Remove.

gcc/d/
* d-builtins.cc (d_build_c_type_nodes): Do not initialize
void_list_node.

gcc/fortran/
* f95-lang.cc (gfc_init_decl_processing): Do not initialize
void_list_node.

gcc/go/
* go-lang.cc (go_langhook_init): Do not initialize
void_list_node.

gcc/jit/
* dummy-frontend.cc (jit_langhook_init): Do not initialize
void_list_node.

gcc/lto/
* lto-lang.cc (lto_build_c_type_nodes): Do not initialize
void_list_node.

20 months agoFix c-c++-common/gomp/target-50.c test
Julian Brown [Thu, 15 Sep 2022 12:01:28 +0000 (12:01 +0000)]
Fix c-c++-common/gomp/target-50.c test

The expected scan dump output for this test will change after the
following patch is committed:

  https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601558.html

But for now, this patch reverts to the old expected pattern so the test
passes. I will apply as obvious.

2022-09-15  Julian Brown  <julian@codesourcery.com>

gcc/testsuite/
* c-c++-common/gomp/target-50.c: Modify scan pattern.

20 months agoFix c-c++-common/goacc/mdc-2.c and g++.dg/goacc/mdc.C tests
Julian Brown [Thu, 15 Sep 2022 11:32:36 +0000 (11:32 +0000)]
Fix c-c++-common/goacc/mdc-2.c and g++.dg/goacc/mdc.C tests

These testsuite hunks got left attached to the wrong patch in the series
I just posted. I will apply as obvious.

2022-09-15  Julian Brown  <julian@codesourcery.com>

gcc/testsuite/
* c-c++-common/goacc/mdc-2.c: Update expected errors.
* g++.dg/goacc/mdc.C: Likewise.

20 months agors6000: Using pli(paddi) and rotate to build 64bit constants
Jiufu Guo [Mon, 5 Sep 2022 05:36:10 +0000 (13:36 +0800)]
rs6000: Using pli(paddi) and rotate to build 64bit constants

Hi,

Test cases are updated/added, and code is refined as the comments in the
review for previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-September/600768.html

As mentioned in PR106550, since pli could support 34bits immediate, we could
use less instructions(3insn would be ok) to build 64bits constant with pli.

For example, for constant 0x020805006106003, we could generate it with:
asm code1:
pli 9,101736451 (0x6106003)
sldi 9,9,32
paddi 9,9, 2130000 (0x0208050)

or asm code2:
pli 10, 2130000
pli 9, 101736451
rldimi 9, 10, 32, 0

The asm code2 would be better.
This patch generates the asm code2 in split1 pass, this patch also supports
to generate asm code1 when splitter is only after RA.

This patch pass boostrap and regtest on ppc64. P10 testing is running.
Thanks for any comments!

BR,
Jeff(Jiufu)

PR target/106550

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Use pli.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr106550.c: New test.
* gcc.target/powerpc/pr106550_1.c: New test.

20 months agoDaily bump.
GCC Administrator [Thu, 15 Sep 2022 00:17:35 +0000 (00:17 +0000)]
Daily bump.

20 months agolibstdc++: Add TSan annotations to std::atomic<shared_ptr<T>>
Jonathan Wakely [Wed, 14 Sep 2022 18:11:22 +0000 (19:11 +0100)]
libstdc++: Add TSan annotations to std::atomic<shared_ptr<T>>

This adds annotations to std::atomic<shared_ptr<T>> to enable TSan to
understand the custom locking. Without this, TSan reports data races for
accesses to the _M_ptr member, even though those are correctly
synchronized using atomic operations on the tagged pointer.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (_GLIBCXX_TSAN_MUTEX_DESTROY)
(_GLIBCXX_TSAN_MUTEX_PRE_LOCK, _GLIBCXX_TSAN_MUTEX_POST_LOCK)
(_GLIBCXX_TSAN_MUTEX_PRE_UNLOCK, _GLIBCXX_TSAN_MUTEX_POST_UNLOCK)
(_GLIBCXX_TSAN_MUTEX_PRE_SIGNAL, _GLIBCXX_TSAN_MUTEX_POST_SIGNAL):
Define macros for TSan annotation functions.
(_Sp_atomic::_Atomic_count): Add annotations.

20 months agolibstdc++: Add missing <new> header to <bits/stl_tempbuf.h>
Jonathan Wakely [Wed, 14 Sep 2022 14:52:44 +0000 (15:52 +0100)]
libstdc++: Add missing <new> header to <bits/stl_tempbuf.h>

This is needed for std::nothrow and the nothrow operator new overload,
so should be included explicitly.

libstdc++-v3/ChangeLog:

* include/bits/stl_tempbuf.h: Include <new>.

20 months agolibstdc++: Add comment to 17_intro/names.cc test
Jonathan Wakely [Wed, 14 Sep 2022 13:16:25 +0000 (14:16 +0100)]
libstdc++: Add comment to 17_intro/names.cc test

libstdc++-v3/ChangeLog:

* testsuite/17_intro/names.cc: Explain why poison pragma can't
be used.

20 months agolibstdc++: Add assertion to std::promise::set_exception (LWG 2276)
Jonathan Wakely [Wed, 14 Sep 2022 13:03:19 +0000 (14:03 +0100)]
libstdc++: Add assertion to std::promise::set_exception (LWG 2276)

Without this assertion, the shared state is made ready, but contains
neither a value nor an exception. Add an assertion to prevent users from
accessing a value that was never initialized in the shared state.

libstdc++-v3/ChangeLog:

* include/std/future
(_State_baseV2::__setter(exception_ptr&, promise&)): Add
assertion for LWG 2276 precondition.
* testsuite/30_threads/promise/members/set_exception_neg.cc:
New test.

20 months agolibstdc++: Document LWG 1203 API change in manual
Jonathan Wakely [Wed, 14 Sep 2022 12:48:25 +0000 (13:48 +0100)]
libstdc++: Document LWG 1203 API change in manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Document LWG 1203.
* doc/html/*: Regenerate.

20 months agolibstdc++: Add pretty printer for std::stringstreams
Philipp Fent [Tue, 6 Sep 2022 21:24:29 +0000 (23:24 +0200)]
libstdc++: Add pretty printer for std::stringstreams

To display (o-,i-)stringstreams in the common case, we just print the
underlying stringbuf, without the many ios_base members. In the
unconventional case that the underlying streambuf was redirected, we
report the redirected target.

Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (access_streambuf_ptrs):
New helper function.
(StdStringBufPrinter, StdStringStreamPrinter): New printers.
(build_libstdcxx_dictionary): Register stringstream printers.
* testsuite/libstdc++-prettyprinters/debug.cc: Check string
streams.
* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.

20 months agofrange: add both zeros to ranges when there's the possiblity of equality.
Aldy Hernandez [Wed, 14 Sep 2022 06:11:54 +0000 (08:11 +0200)]
frange: add both zeros to ranges when there's the possiblity of equality.

Every time there's equality at play, we must be careful that any
equality with zero matches both -0.0 and +0.0 when honoring signed
zeros.

We were doing this correctly for the == and != op1_range operators
(albeit inefficiently), but aren't doing it at all when building >=
and <=.  This fixes the oversight.

There is change in functionality here for the build_* functions.

This is the last "simple" patch I submit before overhauling NAN and
sign tracking.  And that will likely be after Cauldron because it will need
further testing (lapack, ppc64le, -ffinite-math-only, etc).

Regstrapped on x86-64 Linux, plus I ran selftests for
-ffinite-math-only.

gcc/ChangeLog:

* range-op-float.cc (frange_add_zeros): New.
(build_le): Call frange_add_zeros.
(build_ge): Same.
(foperator_equal::op1_range): Same.
(foperator_not_equal::op1_range): Same.

20 months agoPass full range to build_* in range-op-float.cc
Aldy Hernandez [Wed, 14 Sep 2022 06:01:16 +0000 (08:01 +0200)]
Pass full range to build_* in range-op-float.cc

The build_<relop> helper functions in range-op-float.cc take the
actual value from the operand's endpoint, but this value could be
deduced from the operand itself therefore cleaning up the call site.
This also reduces the potential of mistakenly passing the wrong bound.

No functional changes.

Regstrapped on x86-64 Linux, plus I ran selftests for
-ffinite-math-only.

gcc/ChangeLog:

* range-op-float.cc (build_le): Accept frange instead of number.
(build_lt): Same.
(build_ge): Same.
(build_gt): Same.
(foperator_lt::op1_range): Pass full range to build_*.
(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.

This page took 0.115161 seconds and 5 git commands to generate.