platform/upstream/gcc.git
2 years agodwarf2ctf: fix typo in comment
Jose E. Marchesi [Wed, 13 Oct 2021 08:07:37 +0000 (10:07 +0200)]
dwarf2ctf: fix typo in comment

gcc/ChangeLog:

* dwarf2ctf.c: Fix typo in comment.

2 years agors6000/test: Adjust test cases due to O2 vect [PR102658]
Kewen Lin [Wed, 13 Oct 2021 05:20:45 +0000 (00:20 -0500)]
rs6000/test: Adjust test cases due to O2 vect [PR102658]

Commit r12-4240 enables vectorization at O2, this patch is to
adjust some test cases for rs6000 port accordingly.

It simply adds -fno-tree-vectorize to retain original test points.

gcc/testsuite/ChangeLog:

PR testsuite/102658
* gcc.target/powerpc/dform-1.c: Adjust as vectorization enabled at O2.
* gcc.target/powerpc/dform-2.c: Likewise.
* gcc.target/powerpc/pr80510-2.c: Likewise.

2 years agoDaily bump.
GCC Administrator [Wed, 13 Oct 2021 00:16:22 +0000 (00:16 +0000)]
Daily bump.

2 years agoc-family: Support format checking C2X %b, %B formats
Joseph Myers [Tue, 12 Oct 2021 23:40:17 +0000 (23:40 +0000)]
c-family: Support format checking C2X %b, %B formats

C2X adds a %b printf format to print integers in binary (analogous to
%x, including %#b printing a leading 0b on nonzero integers), with
recommended practice for a corresponding %B (where %#B uses 0B instead
of 0b) where that doesn't conflict with existing implementation
extensions.  See N2630 for details (accepted for C2X, not yet in the
latest working draft).  There is also a scanf %b format.

Add corresponding format checking support (%b accepted by -std=c2x
-Wformat -pedantic, %B considered an extension to be diagnosed with
-Wformat -pedantic).  glibc support for the printf formats has been
proposed at
<https://sourceware.org/pipermail/libc-alpha/2021-October/131764.html>
(scanf support to be done in a separate patch).

Note that this does not add any support for these formats to the code
for bounding the amount of output produces by a printf function,
although that would also be useful.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c-family/
* c-format.c (print_char_table): Add %b and %B formats.
(scan_char_table): Add %b format.
* c-format.h (T2X_UI, T2X_UL, T2X_ULL, T2X_US, T2X_UC, T2X_ST)
(T2X_UPD, T2X_UIM): New macros.

gcc/testsuite/
* gcc.dg/format/c11-printf-1.c, gcc.dg/format/c11-scanf-1.c,
gcc.dg/format/c2x-printf-1.c, gcc.dg/format/c2x-scanf-1.c,
gcc.dg/format/ext-9.c, gcc.dg/format/ext-10.c: New tests.

2 years agors6000: Fix vec_cpsgn parameter order (PR101985)
Bill Schmidt [Tue, 12 Oct 2021 22:37:16 +0000 (17:37 -0500)]
rs6000: Fix vec_cpsgn parameter order (PR101985)

The vec_cpsgn built-in function API differs in argument order from the
copysign<mode>3 convention.  Currently that pattern is incorrctly used to
implement vec_cpsgn.  Fix that by reversing the operand order of the
builtin while leaving the existing pattern in place to implement copysignf
for vector modes.

Part of the fix when using the new built-in support requires an adjustment
to a pending patch that replaces much of altivec.h with an automatically
generated file.

Also fix a bug in the new built-in overload infrastructure where we were
using the VSX form of the VEC_COPYSIGN built-in when we should default to
the VMX form.

2021-10-12  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
* config/rs6000/rs6000-overload.def (VEC_COPYSIGN): Use SKIP to
avoid generating an automatic #define of vec_cpsgn.  Use the
correct built-in for V4SFmode that doesn't depend on VSX.

gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.

2 years agoMark certain subdirectories as missing TAGS targets.
Eric Gallager [Tue, 12 Oct 2021 20:55:21 +0000 (16:55 -0400)]
Mark certain subdirectories as missing TAGS targets.

The subdirectories in question are libcody,
libdecnumber, c++tools, libgcc, and libobjc.
This is progress towards allowing "make tags" to
work from the top-level directory; a few additional
changes may also be necessary, though.

ChangeLog:

* Makefile.def: Mark libcody, libdecnumber,
c++tools, libgcc, and libobjc as missing TAGS
targets.
* Makefile.in: Regenerate.

2 years agoi386: Improve workaround for PR82524 LRA limitation [PR85730]
Uros Bizjak [Tue, 12 Oct 2021 16:20:38 +0000 (18:20 +0200)]
i386: Improve workaround for PR82524 LRA limitation [PR85730]

As explained in PR82524, LRA is not able to reload strict_low_part inout
operand with matched input operand. The patch introduces a workaround,
where we allow LRA to generate an instruction with non-matched input operand
which is split post reload to an instruction that inserts non-matched input
operand to an inout operand and the instruction that uses matched operand.

The generated code improves from:

        movsbl  %dil, %edx
        movl    %edi, %eax
        sall    $3, %edx
        movb    %dl, %al

to:

        movl    %edi, %eax
        movb    %dil, %al
        salb    $3, %al

which is still not optimal, but the code is one instruction shorter and
does not use a temporary register.

2021-10-12  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/85730
PR target/82524
* config/i386/i386.md (*add<mode>_1_slp): Rewrite as
define_insn_and_split pattern.  Add alternative 1 and split it
post reload to insert operand 1 into the low part of operand 0.
(*sub<mode>_1_slp): Ditto.
(*and<mode>_1_slp): Ditto.
(*<any_or:code><mode>_1_slp): Ditto.
(*ashl<mode>3_1_slp): Ditto.
(*<any_shiftrt:insn><mode>3_1_slp): Ditto.
(*<any_rotate:insn><mode>3_1_slp): Ditto.
(*neg<mode>_1_slp): New insn_and_split pattern.
(*one_cmpl<mode>_1_slp): Ditto.

gcc/testsuite/
PR target/85730
PR target/82524
* gcc.target/i386/pr85730.c: New test.

2 years agodoc: Update MinGW and mingw-64 download links.
David Edelsohn [Tue, 12 Oct 2021 15:48:05 +0000 (11:48 -0400)]
doc: Update MinGW and mingw-64 download links.

gcc/ChangeLog:

* doc/install.texi: Update MinGW and mingw-64 Binaries
download links.

2 years agolibstdc++: Fix test that fails for C++20
Jonathan Wakely [Tue, 12 Oct 2021 14:39:18 +0000 (15:39 +0100)]
libstdc++: Fix test that fails for C++20

Also restore the test for 'a < a' that was removed by r12-2537 because
it is ill-formed. We still want to test operator< for tuple, we just
need to not use std::nullptr_t in that tuple type.

libstdc++-v3/ChangeLog:

* testsuite/20_util/tuple/comparison_operators/overloaded.cc:
Restore test for operator<.
* testsuite/20_util/tuple/comparison_operators/overloaded2.cc:
Adjust expected errors for C++20.

2 years agolibstdc++: Fix move construction of std::tuple with array elements [PR101960]
Jonathan Wakely [Tue, 12 Oct 2021 14:09:50 +0000 (15:09 +0100)]
libstdc++: Fix move construction of std::tuple with array elements [PR101960]

The r12-3022 commit only fixed the case where an array is the last
element of the tuple. This fixes the other cases too. We can just define
the move constructor as defaulted, which does the right thing. Changing
the move constructor to be trivial would be an ABI break, but since the
last base class still has a non-trivial move constructor, defining the
derived ones as defaulted doesn't change anything.

libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as
defauled.
* testsuite/20_util/tuple/cons/101960.cc: Check tuples with
array elements before the last element.

2 years agolibstdc++: Improve diagnostics for misuses of output iterators
Jonathan Wakely [Wed, 29 Sep 2021 20:19:36 +0000 (21:19 +0100)]
libstdc++: Improve diagnostics for misuses of output iterators

This adds deleted overloads so that the errors for invalid uses of
std::advance and std::distance are easier to understand (see for example
PR 102181).

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator_base_funcs.h (__advance): Add
deleted overload to improve diagnostics.
(__distance): Likewise.

2 years agodoc: Fix typos in alloc_size documentation
Daniel Le Duc Khoi Nguyen [Tue, 12 Oct 2021 14:52:35 +0000 (10:52 -0400)]
doc: Fix typos in alloc_size documentation

gcc/
* doc/extend.texi (Common Variable Attributes): Fix typos in
alloc_size documentation.

2 years ago[PATCH v2] libiberty: d-demangle: remove parenthesis where it is not needed
Luís Ferreira [Tue, 12 Oct 2021 14:40:20 +0000 (10:40 -0400)]
[PATCH v2] libiberty: d-demangle: remove parenthesis where it is not needed

libiberty/
* d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
around lhs and rhs of assignments.

2 years agolibgomp: Release device lock on cbuf error path
Julian Brown [Fri, 24 Sep 2021 11:18:40 +0000 (04:18 -0700)]
libgomp: Release device lock on cbuf error path

This patch releases the device lock on a sanity-checking error path in
transfer combining (cbuf) handling in libgomp:target.c.  This shouldn't
happen when handling well-formed mapping clauses, but erroneous clauses
can currently cause a hang if the condition triggers.

2021-12-10  Julian Brown  <julian@codesourcery.com>

libgomp/
* target.c (gomp_copy_host2dev): Release device lock on cbuf
error path.

2 years agotree-optimization/102696 - fix SLP discovery for failed BIT_FIELD_REF
Richard Biener [Tue, 12 Oct 2021 11:49:39 +0000 (13:49 +0200)]
tree-optimization/102696 - fix SLP discovery for failed BIT_FIELD_REF

This fixes a forgotten adjustment of matches[] when we fail SLP
discovery.

2021-10-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102696
* tree-vect-slp.c (vect_build_slp_tree_2): Properly mark
the tree fatally failed when we reject a BIT_FIELD_REF.

* g++.dg/vect/pr102696.cc: New testcase.

2 years agotree-optimization/102572 - fix gathers with invariant mask
Richard Biener [Tue, 12 Oct 2021 11:42:08 +0000 (13:42 +0200)]
tree-optimization/102572 - fix gathers with invariant mask

This fixes the vector def gathering for invariant masks which
failed to pass in the desired vector type resulting in a non-mask
type to be generate.

2021-10-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102572
* tree-vect-stmts.c (vect_build_gather_load_calls): When
gathering the vectorized defs for the mask pass in the
desired mask vector type so invariants will be handled
correctly.

* g++.dg/vect/pr102572.cc: New testcase.

2 years agosve: combine inverted masks into NOTs
Tamar Christina [Tue, 12 Oct 2021 10:34:06 +0000 (11:34 +0100)]
sve: combine inverted masks into NOTs

The following example

void f10(double * restrict z, double * restrict w, double * restrict x,
 double * restrict y, int n)
{
    for (int i = 0; i < n; i++) {
        z[i] = (w[i] > 0) ? x[i] + w[i] : y[i] - w[i];
    }
}

generates currently:

        ld1d    z1.d, p1/z, [x1, x5, lsl 3]
        fcmgt   p2.d, p1/z, z1.d, #0.0
        fcmgt   p0.d, p3/z, z1.d, #0.0
        ld1d    z2.d, p2/z, [x2, x5, lsl 3]
        bic     p0.b, p3/z, p1.b, p0.b
        ld1d    z0.d, p0/z, [x3, x5, lsl 3]

where a BIC is generated between p1 and p0 where a NOT would be better here
since we won't require the use of p3 and opens the pattern up to being CSEd.

After this patch using a 2 -> 2 split we generate:

        ld1d    z1.d, p0/z, [x1, x5, lsl 3]
        fcmgt   p2.d, p0/z, z1.d, #0.0
        not     p1.b, p0/z, p2.b

The additional scratch is needed such that we can CSE the two operations.  If
both statements wrote to the same register then CSE won't be able to CSE the
values if there are other statements in between that use the register.

A second pattern is needed to capture the nor case as combine will match the
longest sequence first.  So without this pattern we end up de-optimizing nor
and instead emit two nots.  I did not find a better way to do this.

gcc/ChangeLog:

* config/aarch64/aarch64-sve.md (*fcm<cmp_op><mode>_bic_combine,
*fcm<cmp_op><mode>_nor_combine, *fcmuo<mode>_bic_combine,
*fcmuo<mode>_nor_combine): New.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/pred-not-gen-1.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-2.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-3.c: New test.
* gcc.target/aarch64/sve/pred-not-gen-4.c: New test.

2 years agoFix PR target/102588
Eric Botcazou [Tue, 12 Oct 2021 09:20:42 +0000 (11:20 +0200)]
Fix PR target/102588

We need a 32-byte wide integer mode (OImode) in order to handle structure
returns in the 64-bit ABI.

gcc/
PR target/102588
* config/sparc/sparc-modes.def (OI): New integer mode.

2 years agoFortran version of libgomp.c-c++-common/icv-{3,4}.c
Tobias Burnus [Tue, 12 Oct 2021 08:54:18 +0000 (10:54 +0200)]
Fortran version of libgomp.c-c++-common/icv-{3,4}.c

This adds the Fortran testsuite coverage of
omp_{get_max,set_num}_threads and omp_{s,g}et_teams_thread_limit

libgomp/
* testsuite/libgomp.fortran/icv-3.f90: New.
* testsuite/libgomp.fortran/icv-4.f90: New.

2 years agoFortran: Various CLASS + assumed-rank fixed [PR102541]
Tobias Burnus [Tue, 12 Oct 2021 07:56:08 +0000 (09:56 +0200)]
Fortran: Various CLASS + assumed-rank fixed [PR102541]

Starting point was PR102541, were a previous patch caused an invalid
e->ref access for class. When testing, it turned out that for
CLASS to CLASS the code was never executed - additionally, issues
appeared for optional and a bogus error for -fcheck=all. In particular:

There were a bunch of issues related to optional CLASS, can have the
'attr.dummy' set in CLASS_DATA (sym) - but sometimes also in 'sym'!?!
Additionally, gfc_variable_attr could return pointer = 1 for nonpointers
when the expr is no longer "var" but "var%_data".

PR fortran/102541

gcc/fortran/ChangeLog:

* check.c (gfc_check_present): Handle optional CLASS.
* interface.c (gfc_compare_actual_formal): Likewise.
* trans-array.c (gfc_trans_g77_array): Likewise.
* trans-decl.c (gfc_build_dummy_array_decl): Likewise.
* trans-types.c (gfc_sym_type): Likewise.
* primary.c (gfc_variable_attr): Fixes for dummy and
pointer when 'class%_data' is passed.
* trans-expr.c (set_dtype_for_unallocated, gfc_conv_procedure_call):
For assumed-rank dummy, fix setting rank for dealloc/notassoc actual
and setting ubound to -1 for assumed-size actuals.

gcc/testsuite/ChangeLog:

* gfortran.dg/assumed_rank_24.f90: New test.

2 years agoopenmp: Avoid calling clear_type_padding_in_mask in the common case where there can...
Jakub Jelinek [Tue, 12 Oct 2021 07:37:25 +0000 (09:37 +0200)]
openmp: Avoid calling clear_type_padding_in_mask in the common case where there can't be any padding

We can use the clear_padding_type_may_have_padding_p function, which
is conservative for e.g. RECORD_TYPE/UNION_TYPE, but for the floating and
complex floating types is accurate.  clear_type_padding_in_mask is
more expensive because we need to allocate memory, fill it, call the function
which itself is more expensive and then analyze the memory, so for the
common case of float/double atomics or even long double on most targets
we can avoid that.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

gcc/
* gimple-fold.h (clear_padding_type_may_have_padding_p): Declare.
* gimple-fold.c (clear_padding_type_may_have_padding_p): No longer
static.
gcc/c-family/
* c-omp.c (c_finish_omp_atomic): Use
clear_padding_type_may_have_padding_p.

2 years agoopenmp: Add documentation for omp_{get_max, set_num}_threads and omp_{s, g}et_teams_t...
Jakub Jelinek [Tue, 12 Oct 2021 07:35:43 +0000 (09:35 +0200)]
openmp: Add documentation for omp_{get_max, set_num}_threads and omp_{s, g}et_teams_thread_limit

This patch adds documentation for these new OpenMP 5.1 APIs as well as
two new environment variables - OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

* libgomp.texi (omp_get_max_teams, omp_get_teams_thread_limit,
omp_set_num_teams, omp_set_teams_thread_limit, OMP_NUM_TEAMS,
OMP_TEAMS_THREAD_LIMIT): Document.

2 years agoopenmp: Fix up warnings on libgomp.info build
Jakub Jelinek [Tue, 12 Oct 2021 07:34:38 +0000 (09:34 +0200)]
openmp: Fix up warnings on libgomp.info build

When building libgomp documentation, I see
makeinfo --split-size=5000000  -I ../../../libgomp/../gcc/doc/include -I ../../../libgomp -o libgomp.info ../../../libgomp/libgomp.texi
../../../libgomp/libgomp.texi:503: warning: node next `omp_get_default_device' in menu `omp_get_device_num' and in sectioning `omp_get_dynamic' differ
../../../libgomp/libgomp.texi:528: warning: node prev `omp_get_dynamic' in menu `omp_get_device_num' and in sectioning `omp_get_default_device' differ
../../../libgomp/libgomp.texi:560: warning: node next `omp_get_initial_device' in menu `omp_get_level' and in sectioning `omp_get_device_num' differ
../../../libgomp/libgomp.texi:587: warning: node next `omp_get_device_num' in menu `omp_get_dynamic' and in sectioning `omp_get_level' differ
../../../libgomp/libgomp.texi:587: warning: node prev `omp_get_device_num' in menu `omp_get_default_device' and in sectioning `omp_get_initial_device' differ
../../../libgomp/libgomp.texi:615: warning: node prev `omp_get_level' in menu `omp_get_initial_device' and in sectioning `omp_get_device_num' differ
warnings.  This patch fixes those.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

* libgomp.texi (omp_get_device_num): Move @node before omp_get_dynamic
to avoid makeinfo warnings.

2 years agoopenmp: Add testsuite coverage for omp_{get_max,set_num}_threads and omp_{s,g}et_team...
Jakub Jelinek [Tue, 12 Oct 2021 07:32:28 +0000 (09:32 +0200)]
openmp: Add testsuite coverage for omp_{get_max,set_num}_threads and omp_{s,g}et_teams_thread_limit

This adds (C/C++ only) testsuite coverage for these new OpenMP 5.1 APIs.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

* testsuite/libgomp.c-c++-common/icv-3.c: New test.
* testsuite/libgomp.c-c++-common/icv-4.c: New test.

2 years agolibgomp: alloc* test fixes [PR102628, PR102668]
Jakub Jelinek [Tue, 12 Oct 2021 07:30:41 +0000 (09:30 +0200)]
libgomp: alloc* test fixes [PR102628, PR102668]

As reported, the alloc-9.c test and alloc-{1,2,3}.F* and alloc-11.f90
tests fail on powerpc64-linux with -m32.
The reason why it fails just there is that malloc doesn't guarantee there
128-bit alignment (historically glibc guaranteed 2 * sizeof (void *)
alignment from malloc).

There are two separate issues.
One is a thinko on my side.
In this part of alloc-9.c test (copied to alloc-11.f90), we have
2 allocators, a with pool size 1024B and alignment 16B and default fallback
and a2 with pool size 512B and alignment 32B and a as fallback allocator.
We start at no allocations in both at line 194 and do:
  p = (int *) omp_alloc (sizeof (int), a2);
// This succeeds in a2 and needs 4+overhead bytes (which includes the 32B alignment)
  p = (int *) omp_realloc (p, 420, a, a2);
// This allocates 420 bytes+overhead in a, with 16B alignment and deallocates the above
  q = (int *) omp_alloc (sizeof (int), a);
// This allocates 4+overhead bytes in a, with 16B alignment
  q = (int *) omp_realloc (q, 420, a2, a);
// This allocates 420+overhead in a2 with 32B alignment
  q = (int *) omp_realloc (q, 768, a2, a2);
// This attempts to reallocate, but as there are elevated alignment
// requirements doesn't try to just realloc (even if it wanted to try that
// a2 is almost full, with 512-420-overhead bytes left in it), so it
// tries to alloc in a2, but there is no space left in the pool, falls
// back to a, which already has 420+overhead bytes allocated in it and
// 1024-420-overhead bytes left and so fails too and fails to default
// non-pool allocator that allocates it, but doesn't guarantee alignment
// higher than malloc guarantees.
// But, the test expected 16B alignment.

So, I've slightly lowered the allocation sizes in that part of the test
420->320 and 768 -> 568, so that the last test still fails to allocate
in a2 (568 > 512-320-overhead) but succeeds in a as fallback, which was
the intent of the test.

Another thing is that alloc-1.F90 seems to be transcription of
libgomp.c-c++-common/alloc-1.c into Fortran, but alloc-1.c had:
  q = (int *) omp_alloc (768, a2);
  if ((((uintptr_t) q) % 16) != 0)
    abort ();
  q[0] = 7;
  q[767 / sizeof (int)] = 8;
  r = (int *) omp_alloc (512, a2);
  if ((((uintptr_t) r) % __alignof (int)) != 0)
    abort ();
there but Fortran has:
        cq = omp_alloc (768_c_size_t, a2)
        if (mod (transfer (cq, intptr), 16_c_intptr_t) /= 0) stop 12
        call c_f_pointer (cq, q, [768 / c_sizeof (i)])
        q(1) = 7
        q(768 / c_sizeof (i)) = 8
        cr = omp_alloc (512_c_size_t, a2)
        if (mod (transfer (cr, intptr), 16_c_intptr_t) /= 0) stop 13
I'm changing the latter to 4_c_intptr_t because other spots in the
testcase do that, Fortran sadly doesn't have c_alignof, but strictly
speaking it isn't correct, __alignof (int) could be on some architectures
smaller than 4.
So probably alloc-1.F90 etc. should also have
! { dg-additional-sources alloc-7.c }
! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
and use get__alignof_int.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/102628
PR libgomp/102668
* testsuite/libgomp.c-c++-common/alloc-9.c (main): Decrease
allocation sizes from 420 to 320 and from 768 to 568.
* testsuite/libgomp.fortran/alloc-11.f90: Likewise.
* testsuite/libgomp.fortran/alloc-1.F90: Change expected alignment
for cr from 16 to 4.

2 years agovectorizer: Fix up -fsimd-cost-model= handling
Jakub Jelinek [Tue, 12 Oct 2021 07:28:10 +0000 (09:28 +0200)]
vectorizer: Fix up -fsimd-cost-model= handling

> * testsuite/libgomp.c++/scan-10.C: Add option -fvect-cost-model=cheap.

I don't think this is the right thing to do.
This just means that at some point between 2013 when -fsimd-cost-model has
been introduced and now -fsimd-cost-model= option at least partially stopped
working properly.
As documented, -fsimd-cost-model= overrides the -fvect-cost-model= setting
for OpenMP simd loops (loop->force_vectorize is true) if specified differently
from default.
In tree-vectorizer.h we have:
static inline bool
unlimited_cost_model (loop_p loop)
{
  if (loop != NULL && loop->force_vectorize
      && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
    return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
  return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
}
and use it in various places, but we also just use flag_vect_cost_model
in lots of places (and in one spot use flag_simd_cost_model, not sure if
we are sure it is a force_vectorize loop or what).

So, IMHO we should change the above inline function to
loop_cost_model and let it return the cost model and then just
reimplement unlimited_cost_model as
return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED;
and then adjust the direct uses of the flag and revert these changes.

2021-10-12  Jakub Jelinek  <jakub@redhat.com>

gcc/
* tree-vectorizer.h (loop_cost_model): New function.
(unlimited_cost_model): Use it.
* tree-vect-loop.c (vect_analyze_loop_costing): Use loop_cost_model
call instead of flag_vect_cost_model.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
(vect_prune_runtime_alias_test_list): Likewise.  Also use it instead
of flag_simd_cost_model.
gcc/testsuite/
* gcc.dg/gomp/simd-2.c: Remove option -fvect-cost-model=cheap.
* gcc.dg/gomp/simd-3.c: Likewise.
libgomp/
* testsuite/libgomp.c/scan-11.c: Remove option -fvect-cost-model=cheap.
* testsuite/libgomp.c/scan-12.c: Likewise.
* testsuite/libgomp.c/scan-13.c: Likewise.
* testsuite/libgomp.c/scan-14.c: Likewise.
* testsuite/libgomp.c/scan-15.c: Likewise.
* testsuite/libgomp.c/scan-16.c: Likewise.
* testsuite/libgomp.c/scan-17.c: Likewise.
* testsuite/libgomp.c/scan-18.c: Likewise.
* testsuite/libgomp.c/scan-19.c: Likewise.
* testsuite/libgomp.c/scan-20.c: Likewise.
* testsuite/libgomp.c/scan-21.c: Likewise.
* testsuite/libgomp.c/scan-22.c: Likewise.
* testsuite/libgomp.c++/scan-9.C: Likewise.
* testsuite/libgomp.c++/scan-10.C: Likewise.
* testsuite/libgomp.c++/scan-11.C: Likewise.
* testsuite/libgomp.c++/scan-12.C: Likewise.
* testsuite/libgomp.c++/scan-13.C: Likewise.
* testsuite/libgomp.c++/scan-14.C: Likewise.
* testsuite/libgomp.c++/scan-15.C: Likewise.
* testsuite/libgomp.c++/scan-16.C: Likewise.

2 years agoSupport reduc_{plus,smax,smin,umax,umin}_scal_v4qi.
liuhongt [Sat, 9 Oct 2021 06:34:38 +0000 (14:34 +0800)]
Support reduc_{plus,smax,smin,umax,umin}_scal_v4qi.

gcc/ChangeLog

PR target/102483
* config/i386/i386-expand.c (emit_reduc_half): Handle
V4QImode.
* config/i386/mmx.md (reduc_<code>_scal_v4qi): New expander.
(reduc_plus_scal_v4qi): Ditto.

gcc/testsuite/ChangeLog

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

2 years agoAdjust testcase for O2 vectorization enabling
liuhongt [Mon, 11 Oct 2021 02:05:03 +0000 (10:05 +0800)]
Adjust testcase for O2 vectorization enabling

This issue was observed in rs6000 specific PR102658 as well.

I've looked into it a bit, it's caused by the "conditional store replacement" which
is originally disabled without vectorization as below code.

  /* If either vectorization or if-conversion is disabled then do
     not sink any stores.  */
  if (param_max_stores_to_sink == 0
      || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize)
      || !flag_tree_loop_if_convert)
    return false;

The new change makes the innermost loop look like

for (int c1 = 0; c1 <= 1499; c1 += 1) {
  if (c1 <= 500) {
     S_10(c0, c1);
  } else {
      S_9(c0, c1);
  }
  S_11(c0, c1);
}

and can not be splitted as:

for (int c1 = 0; c1 <= 500; c1 += 1)
  S_10(c0, c1);

for (int c1 = 501; c1 <= 1499; c1 += 1)
  S_9(c0, c1);

So instead of disabling vectorization, could we just disable this cs replacement
with parameter "--param max-stores-to-sink=0"?

I tested this proposal on ppc64le, it should work as well.

2021-10-11  Kewen Lin  <linkw@linux.ibm.com>

libgomp/ChangeLog:

* testsuite/libgomp.graphite/force-parallel-8.c: Add --param max-stores-to-sink=0.

2 years agors6000: Correct several errant dg-require-effective-target
Paul A. Clarke [Tue, 12 Oct 2021 03:40:39 +0000 (22:40 -0500)]
rs6000: Correct several errant dg-require-effective-target

I misspelled the dg-require-effective-target attribute "vsx_hw" in
recent commits, causing the effected tests to fail.  Correct the spelling.

2021-10-11  Paul A. Clarke  <pc@us.ibm.com>

gcc/testsuite
* gcc.target/powerpc/pr78102.c: Fix dg-require-effective-target.
* gcc.target/powerpc/sse4_1-packusdw.c: Likewise.
* gcc.target/powerpc/sse4_1-pmaxsb.c: Likewise.
* gcc.target/powerpc/sse4_1-pmaxsd.c: Likewise.
* gcc.target/powerpc/sse4_1-pmaxud.c: Likewise.
* gcc.target/powerpc/sse4_1-pmaxuw.c: Likewise.
* gcc.target/powerpc/sse4_1-pminsb.c: Likewise.
* gcc.target/powerpc/sse4_1-pminsd.c: Likewise.
* gcc.target/powerpc/sse4_1-pminud.c: Likewise.
* gcc.target/powerpc/sse4_1-pminuw.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovsxbd.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovsxbw.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovsxwd.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxbd.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxbq.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxbw.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxdq.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxwd.c: Likewise.
* gcc.target/powerpc/sse4_1-pmovzxwq.c: Likewise.
* gcc.target/powerpc/sse4_1-pmulld.c: Likewise.
* gcc.target/powerpc/sse4_2-pcmpgtq.c: Likewise.
* gcc.target/powerpc/sse4_1-phminposuw.c: Use correct
dg-require-effective-target.

2 years agors6000: Support more SSE4 "cmp", "mul", "pack" intrinsics
Paul A. Clarke [Sun, 8 Aug 2021 20:57:20 +0000 (15:57 -0500)]
rs6000: Support more SSE4 "cmp", "mul", "pack" intrinsics

Function signatures and decorations match gcc/config/i386/smmintrin.h.

Also, copy tests for:
- _mm_cmpeq_epi64
- _mm_mullo_epi32, _mm_mul_epi32
- _mm_packus_epi32
- _mm_cmpgt_epi64 (SSE4.2)

from gcc/testsuite/gcc.target/i386.

2021-10-11  Paul A. Clarke  <pc@us.ibm.com>

gcc
* config/rs6000/smmintrin.h (_mm_cmpeq_epi64, _mm_cmpgt_epi64,
_mm_mullo_epi32, _mm_mul_epi32, _mm_packus_epi32): New.
* config/rs6000/nmmintrin.h: Copy from i386, tweak to suit.

gcc/testsuite
* gcc.target/powerpc/pr78102.c: Copy from gcc.target/i386,
adjust dg directives to suit.
* gcc.target/powerpc/sse4_1-packusdw.c: Same.
* gcc.target/powerpc/sse4_1-pcmpeqq.c: Same.
* gcc.target/powerpc/sse4_1-pmuldq.c: Same.
* gcc.target/powerpc/sse4_1-pmulld.c: Same.
* gcc.target/powerpc/sse4_2-pcmpgtq.c: Same.
* gcc.target/powerpc/sse4_2-check.h: Copy from gcc.target/i386,
tweak to suit.

2 years agors6000: Support SSE4.1 "cvt" intrinsics
Paul A. Clarke [Thu, 22 Jul 2021 19:54:33 +0000 (12:54 -0700)]
rs6000: Support SSE4.1 "cvt" intrinsics

Function signatures and decorations match gcc/config/i386/smmintrin.h.

Also, copy tests for:
- _mm_cvtepi8_epi16, _mm_cvtepi8_epi32, _mm_cvtepi8_epi64
- _mm_cvtepi16_epi32, _mm_cvtepi16_epi64
- _mm_cvtepi32_epi64,
- _mm_cvtepu8_epi16, _mm_cvtepu8_epi32, _mm_cvtepu8_epi64
- _mm_cvtepu16_epi32, _mm_cvtepu16_epi64
- _mm_cvtepu32_epi64

from gcc/testsuite/gcc.target/i386.

sse4_1-pmovsxbd.c, sse4_1-pmovsxbq.c, and sse4_1-pmovsxbw.c were
modified from using "char" types to "signed char" types, because
the default is unsigned on powerpc.

2021-10-11  Paul A. Clarke  <pc@us.ibm.com>

gcc
* config/rs6000/smmintrin.h (_mm_cvtepi8_epi16, _mm_cvtepi8_epi32,
_mm_cvtepi8_epi64, _mm_cvtepi16_epi32, _mm_cvtepi16_epi64,
_mm_cvtepi32_epi64, _mm_cvtepu8_epi16, _mm_cvtepu8_epi32,
_mm_cvtepu8_epi64, _mm_cvtepu16_epi32, _mm_cvtepu16_epi64,
_mm_cvtepu32_epi64): New.

gcc/testsuite
* gcc.target/powerpc/sse4_1-pmovsxbd.c: Copy from gcc.target/i386,
adjust dg directives to suit.
* gcc.target/powerpc/sse4_1-pmovsxbq.c: Same.
* gcc.target/powerpc/sse4_1-pmovsxbw.c: Same.
* gcc.target/powerpc/sse4_1-pmovsxdq.c: Same.
* gcc.target/powerpc/sse4_1-pmovsxwd.c: Same.
* gcc.target/powerpc/sse4_1-pmovsxwq.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxbd.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxbq.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxbw.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxdq.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxwd.c: Same.
* gcc.target/powerpc/sse4_1-pmovzxwq.c: Same.

2 years agors6000: Simplify some SSE4.1 "test" intrinsics
Paul A. Clarke [Wed, 21 Jul 2021 16:35:52 +0000 (09:35 -0700)]
rs6000: Simplify some SSE4.1 "test" intrinsics

Copy some simple redirections from i386 <smmintrin.h>, for:
- _mm_test_all_zeros
- _mm_test_all_ones
- _mm_test_mix_ones_zeros

2021-10-11  Paul A. Clarke  <pc@us.ibm.com>

gcc
* config/rs6000/smmintrin.h (_mm_test_all_zeros,
_mm_test_all_ones, _mm_test_mix_ones_zeros): Rewrite as macro.

2 years agors6000: Support SSE4.1 "min" and "max" intrinsics
Paul A. Clarke [Tue, 20 Jul 2021 16:20:43 +0000 (11:20 -0500)]
rs6000: Support SSE4.1 "min" and "max" intrinsics

Function signatures and decorations match gcc/config/i386/smmintrin.h.

Also, copy tests for _mm_min_epi8, _mm_min_epu16, _mm_min_epi32,
_mm_min_epu32, _mm_max_epi8, _mm_max_epu16, _mm_max_epi32, _mm_max_epu32
from gcc/testsuite/gcc.target/i386.

sse4_1-pmaxsb.c and sse4_1-pminsb.c were modified from using
"char" types to "signed char" types, because the default is unsigned on
powerpc.

2021-10-11  Paul A. Clarke  <pc@us.ibm.com>

gcc
* config/rs6000/smmintrin.h (_mm_min_epi8, _mm_min_epu16,
_mm_min_epi32, _mm_min_epu32, _mm_max_epi8, _mm_max_epu16,
_mm_max_epi32, _mm_max_epu32): New.

gcc/testsuite
* gcc.target/powerpc/sse4_1-pmaxsb.c: Copy from gcc.target/i386.
* gcc.target/powerpc/sse4_1-pmaxsd.c: Same.
* gcc.target/powerpc/sse4_1-pmaxud.c: Same.
* gcc.target/powerpc/sse4_1-pmaxuw.c: Same.
* gcc.target/powerpc/sse4_1-pminsb.c: Same.
* gcc.target/powerpc/sse4_1-pminsd.c: Same.
* gcc.target/powerpc/sse4_1-pminud.c: Same.
* gcc.target/powerpc/sse4_1-pminuw.c: Same.

2 years agoDaily bump.
GCC Administrator [Tue, 12 Oct 2021 00:17:02 +0000 (00:17 +0000)]
Daily bump.

2 years agoAdd obj-c++.srcman target to gcc/objcp/Makefile.
Eric Gallager [Sat, 9 Oct 2021 19:10:32 +0000 (15:10 -0400)]
Add obj-c++.srcman target to gcc/objcp/Makefile.

Closes #56604

Signed-off-by: Eric Gallager <egallager@gcc.gnu.org>
gcc/objcp/ChangeLog:
PR objc++/56604
* Make-lang.in: Add obj-c++.srcman: line.

2 years agoRevert accidental change in ipa-modref-tree.h
Jan Hubicka [Mon, 11 Oct 2021 19:58:43 +0000 (21:58 +0200)]
Revert accidental change in ipa-modref-tree.h

* ipa-modref-tree.h (struct modref_access_node): Revert
accidental change.
(struct modref_ref_node): Likewise.

2 years agolibstdc++: Add wrapper for internal uses of std::terminate
Jonathan Wakely [Fri, 8 Oct 2021 10:35:53 +0000 (11:35 +0100)]
libstdc++: Add wrapper for internal uses of std::terminate

This adds an inline wrapper for std::terminate that doesn't add the
declaration of std::terminate to namespace std. This allows the
library to terminate without including all of <exception>.

libstdc++-v3/ChangeLog:

* include/bits/atomic_timed_wait.h: Remove unused header.
* include/bits/c++config (std:__terminate): Define.
* include/bits/semaphore_base.h: Remove <exception> and use
__terminate instead of terminate.
* include/bits/std_thread.h: Likewise.
* libsupc++/eh_terminate.cc (std::terminate): Use qualified-id
to call __cxxabiv1::__terminate.

2 years agolibstdc++: Simplify std::basic_regex::assign
Jonathan Wakely [Mon, 11 Oct 2021 16:19:43 +0000 (17:19 +0100)]
libstdc++: Simplify std::basic_regex::assign

We know that if __is_contiguous_iterator is true then we have a pointer
or a __normal_iterator that wraps a pointer, so we don't need to use
std::__to_address.

libstdc++-v3/ChangeLog:

* include/bits/regex.h (basic_regex::assign(Iter, Iter)): Avoid
std::__to_address by using poitner directly or using base()
member of __normal_iterator.

2 years agolibstdc++: Fix std::numeric_limits::lowest() test for strict modes
Jonathan Wakely [Mon, 11 Oct 2021 12:28:32 +0000 (13:28 +0100)]
libstdc++: Fix std::numeric_limits::lowest() test for strict modes

This test uses std::is_integral to decide whether we are testing an
integral or floating-point type. But that fails for __int128 because
is_integral<__int128> is false in strict modes. By using
numeric_limits::is_integer instead we get the right answer for all types
that have a numeric_limits specialization.

We can also simplify the test by removing the unnecessary tag
dispatching.

libstdc++-v3/ChangeLog:

* testsuite/18_support/numeric_limits/lowest.cc: Use
numeric_limits<T>::is_integer instead of is_integral<T>::value.

2 years agolibstdc++: Add valid range assertions to std::basic_regex [PR89927]
Jonathan Wakely [Mon, 11 Oct 2021 11:08:59 +0000 (12:08 +0100)]
libstdc++: Add valid range assertions to std::basic_regex [PR89927]

This adds some debug assertions to basic_regex. They don't actually
diagnose the error in the PR yet, but I have another patch to make them
more effective.

Also change the __glibcxx_assert(false) consistency checks to include a
string literal that tells the user a bit more about why the process
aborted. We could consider adding a __glibcxx_bug or
__glibcxx_internal_error macro for this purpose, but ideally we'll never
hit such bugs anyway so it shouldn't be needed.

libstdc++-v3/ChangeLog:

PR libstdc++/89927
* include/bits/regex.h (basic_regex(const _Ch_type*, size_t)):
Add __glibcxx_requires_string_len assertion.
(basic_regex::assign(InputIterator, InputIterator)): Add
__glibcxx_requires_valid_range assertion.
* include/bits/regex_scanner.tcc (_Scanner::_M_advance())
(_Scanner::_M_scan_normal()): Use string literal in assertions.

2 years agolibstdc++: Fix std::match_results::end() for failed matches [PR102667]
Jonathan Wakely [Mon, 11 Oct 2021 08:07:15 +0000 (09:07 +0100)]
libstdc++: Fix std::match_results::end() for failed matches [PR102667]

The end() function needs to consider whether the underlying vector is
empty, not whether the match_results object is empty. That's because the
underlying vector will always contain at least three elements for a
match_results object that is "ready". It contains three extra elements
which are stored in the vector but are not considered part of sequence,
and so should not be part of the [begin(),end()) range.

libstdc++-v3/ChangeLog:

PR libstdc++/102667
* include/bits/regex.h (match_result::empty()): Optimize by
calling the base function directly.
(match_results::end()): Check _Base_type::empty() not empty().
* testsuite/28_regex/match_results/102667.C: New test.

2 years agoCommonize ipa-pta constraint generation for calls
Jan Hubicka [Mon, 11 Oct 2021 16:43:26 +0000 (18:43 +0200)]
Commonize ipa-pta constraint generation for calls

Commonize the three paths to produce constraints for function call
and makes it more flexible, so we can implement new features more easily.  Main
idea is to not special case pure and const since we can now describe all of
pure/const via their EAF flags (implicit_const_eaf_flags and
implicit_pure_eaf_flags) and info on existence of global memory loads/stores in
function which is readily available in the modref tree.

While rewriting the function, I dropped some of optimizations in the way we
generate constraints. Some of them we may want to add back, but I think the
constraint solver should be fast to get rid of them quickly, so it looks like
bit of premature optimization.

We now always produce one additional PTA variable (callescape) for things that
escape into function call and thus can be stored to parameters or global memory
(if modified). This is no longer the same as global escape in case function is
not reading global memory. It is also not same as call use, since we now
understand the fact that interposable functions may use parameter in a way that
is not releavnt for PTA (so we can not optimize out stores initializing the
memory, but we can be safe about fact that pointers stored does not escape).

Compared to previous code we now handle correctly EAF_NOT_RETURNED in all cases
(previously we did so only when all parameters had the flag) and also handle
NOCLOBBER in more cases (since we make difference between global escape and
call escape). Because I commonized code handling args and static chains, we
could now easily extend modref to also track flags for static chain and return
slot which I plan to do next.

Otherwise I put some effort into producing constraints that produce similar
solutions as before (so it is harder to debug differences). For example if
global memory is written one can simply move callescape to escape rather then
making everything escape by its own constraints, but it affects ipa-pta
testcases.

gcc/ChangeLog:

* ipa-modref-tree.h (modref_tree::global_access_p): New member
function.
* ipa-modref.c:
(implicint_const_eaf_flags,implicit_pure_eaf_flags,
ignore_stores_eaf_flags): Move to ipa-modref.h
(remove_useless_eaf_flags): Remove early exit on NOCLOBBER.
(modref_summary::global_memory_read_p): New member function.
(modref_summary::global_memory_written_p): New member function.
* ipa-modref.h (modref_summary::global_memory_read_p,
modref_summary::global_memory_written_p): Declare.
(implicint_const_eaf_flags,implicit_pure_eaf_flags,
ignore_stores_eaf_flags): move here.
* tree-ssa-structalias.c: Include ipa-modref-tree.h, ipa-modref.h
and attr-fnspec.h.
(handle_rhs_call): Rewrite.
(handle_call_arg): New function.
(determine_global_memory_access): New function.
(handle_const_call): Remove
(handle_pure_call): Remove
(find_func_aliases_for_call): Update use of handle_rhs_call.
(compute_points_to_sets): Handle global memory acccesses
selectively

gcc/testsuite/ChangeLog:

* gcc.dg/torture/ssa-pta-fn-1.c: Fix template; add noipa.
* gcc.dg/tree-ssa/pta-callused.c: Fix template.

2 years agoc++: Add testcase for already-fixed PR [PR102643]
Patrick Palka [Mon, 11 Oct 2021 16:33:30 +0000 (12:33 -0400)]
c++: Add testcase for already-fixed PR [PR102643]

Fixed with r12-1744.

PR c++/102643

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-alias11.C: New test.

2 years agodoc: improve -fsanitize=undefined description
Diane Meirowitz [Wed, 15 Sep 2021 21:03:00 +0000 (21:03 +0000)]
doc: improve -fsanitize=undefined description

gcc/ChangeLog:
* doc/invoke.texi: Add link to UndefinedBehaviorSanitizer
documentation, mention UBSAN_OPTIONS, similar to what is done
for AddressSanitizer.

2 years agoChangeLog: Remove incorrect PR reference
Jonathan Wakely [Mon, 11 Oct 2021 08:25:07 +0000 (09:25 +0100)]
ChangeLog: Remove incorrect PR reference

2 years agomiddle-end/102683 - fix .DEFERRED_INIT expansion
Richard Biener [Mon, 11 Oct 2021 12:31:59 +0000 (14:31 +0200)]
middle-end/102683 - fix .DEFERRED_INIT expansion

This avoids using an integer type for which we don't have an
approprate mode when expanding .DEFERRED_INIT to a non-memory
entity.

2021-10-11  Richard Biener  <rguenther@suse.de>

PR middle-end/102683
* internal-fn.c (expand_DEFERRED_INIT): Check for mode
availability before building an integer type for storage
purposes.

2 years agomiddle-end/101480 - overloaded global new/delete
Richard Biener [Mon, 11 Oct 2021 14:06:03 +0000 (16:06 +0200)]
middle-end/101480 - overloaded global new/delete

The following fixes the issue of ignoring side-effects on memory
from overloaded global new/delete operators by not marking them
as effectively 'const' apart from other explicitely specified
side-effects.

This will cause

FAIL: g++.dg/warn/Warray-bounds-16.C  -std=gnu++1? (test for excess errors)

because we now no longer statically see the initialization loop
never executes because the call to operator new can now clobber 'a.m'.
This seems to be an issue with the warning code and/or ranger so
I'm leaving this FAIL to be addressed as followup.

2021-10-11  Richard Biener  <rguenther@suse.de>

PR middle-end/101480
* gimple.c (gimple_call_fnspec): Do not mark operator new/delete
as const.

* g++.dg/torture/pr10148.C: New testcase.

2 years ago[Ada] Fix problematic import of type-generic GCC atomic builtin
Eric Botcazou [Fri, 8 Oct 2021 22:44:13 +0000 (00:44 +0200)]
[Ada] Fix problematic import of type-generic GCC atomic builtin

gcc/ada/

* gcc-interface/gigi.h (resolve_atomic_size): Declare.
(list_third): New inline function.
* gcc-interface/decl.c (type_for_atomic_builtin_p): New function.
(resolve_atomic_builtin): Likewise.
(gnat_to_gnu_subprog_type): Perform type resolution for most of
type-generic GCC atomic builtins and give an error for the rest.
* gcc-interface/utils2.c (resolve_atomic_size): Make public.

2 years ago[Ada] Tweak the warning about missing local raises
Eric Botcazou [Thu, 7 Oct 2021 15:34:21 +0000 (17:34 +0200)]
[Ada] Tweak the warning about missing local raises

gcc/ada/

* gcc-interface/trans.c (gnat_to_gnu) <N_Pop_Constraint_Error_Label>:
Given the warning only if No_Exception_Propagation is active.
<N_Pop_Storage_Error_Label>: Likewise.
<N_Pop_Program_Error_Label>: Likewise.

2 years ago[Ada] Fix for atomic wrongly rejected on object of discriminated type
Eric Botcazou [Tue, 28 Sep 2021 16:26:38 +0000 (18:26 +0200)]
[Ada] Fix for atomic wrongly rejected on object of discriminated type

gcc/ada/

* gcc-interface/decl.c (promote_object_alignment): Add GNU_SIZE
parameter and use it for the size of the object if not null.
(gnat_to_gnu_entity) <E_Variable>: Perform the automatic alignment
promotion for objects whose nominal subtype is of variable size.
(gnat_to_gnu_field): Adjust call to promote_object_alignment.

2 years ago[Ada] Fix incorrect size for pathological pass-by-copy parameters
Eric Botcazou [Mon, 27 Sep 2021 20:44:59 +0000 (22:44 +0200)]
[Ada] Fix incorrect size for pathological pass-by-copy parameters

gcc/ada/

* gcc-interface/decl.c (gnat_to_gnu_param): Strip padding types
only if the size does not change in the process.  Rename local
variable and add bypass for initialization procedures.

2 years ago[Ada] Runtime transition: System.Threads
Doug Rupp [Wed, 6 Oct 2021 20:03:56 +0000 (13:03 -0700)]
[Ada] Runtime transition: System.Threads

gcc/ada/

* libgnat/s-thread.ads: Fix comments.  Remove unused package
imports.
(Thread_Body_Exception_Exit): Remove Exception_Occurrence
parameter.
(ATSD): Declare type locally.
* libgnat/s-thread__ae653.adb: Fix comments.  Remove unused
package imports.  Remove package references to Stack_Limit
checking.
(Install_Handler): Remove.
(Set_Sec_Stack): Likewise.
(Thread_Body_Enter): Remove calls to Install_Handler and
Stack_Limit checking.
(Thread_Body_Exception_Exit): Remove Exception_Occurrence
parameter.
(Init_RTS): Call local Get_Sec_Stack.  Remove call to
Install_Handler.  Remove references to accessors for
Get_Sec_Stack and Set_Sec_Stack.  Remove OS check.
(Set_Sec_Stack): Remove.

2 years ago[Ada] Remove redundant guard in expansion of dispatching calls
Piotr Trojanek [Thu, 7 Oct 2021 17:59:09 +0000 (19:59 +0200)]
[Ada] Remove redundant guard in expansion of dispatching calls

gcc/ada/

* exp_ch3.adb (Make_Predefined_Primitive_Specs,
Predefined_Primitive_Bodies): Remove guard with restriction
No_Dispatching_Calls.

2 years ago[Ada] Valid postconditions incorrectly rejected.
Steve Baird [Fri, 1 Oct 2021 00:36:38 +0000 (17:36 -0700)]
[Ada] Valid postconditions incorrectly rejected.

gcc/ada/

* sem_attr.adb (Analyze_Attribute_Old_Result): Permit an
attribute reference inside a compiler-generated _Postconditions
procedure. In this case, Subp_Decl is assigned the declaration
of the enclosing subprogram.
* exp_util.adb (Insert_Actions): When climbing up the tree
looking for an insertion point, do not climb past an
N_Iterated_Component/Element_Association, since this could
result in inserting a reference to a loop parameter at a
location outside of the scope of that loop parameter. On the
other hand, be careful to preserve existing behavior in the case
of an N_Component_Association node.

2 years ago[Ada] Incorrect Dynamic_Predicate results for static arguments
Steve Baird [Mon, 4 Oct 2021 22:33:18 +0000 (15:33 -0700)]
[Ada] Incorrect Dynamic_Predicate results for static arguments

gcc/ada/

* exp_ch6.adb (Can_Fold_Predicate_Call): Do not attempt folding
if there is more than one predicate involved. Recall that
predicate aspect specification are additive, not overriding, and
that there are three different predicate
aspects (Dynamic_Predicate, Static_Predicate, and the
GNAT-defined Predicate aspect). These various ways of
introducing multiple predicates are all checked for.  A new
nested function, Augments_Other_Dynamic_Predicate, is
introduced.
* sem_ch4.adb
(Analyze_Indexed_Component_Form.Process_Function_Call): When
determining whether a name like "X (Some_Discrete_Type)" might
be interpreted as a slice, the answer should be "no" if the
type/subtype name denotes the current instance of type/subtype.

2 years ago[Ada] sigset_t is an unsigned long on RTEMS
Patrick Bernardi [Thu, 7 Oct 2021 21:19:01 +0000 (17:19 -0400)]
[Ada] sigset_t is an unsigned long on RTEMS

gcc/ada/

* libgnarl/s-osinte__rtems.ads: Change sigset_t to an unsigned
long.

2 years ago[Ada] RTEMS: use regular RTEMS API for minimum stack size calculation
Patrick Bernardi [Thu, 7 Oct 2021 15:21:24 +0000 (11:21 -0400)]
[Ada] RTEMS: use regular RTEMS API for minimum stack size calculation

gcc/ada/

* libgnat/s-parame__rtems.adb: use
_POSIX_Threads_Minimum_stack_size instead of
ada_pthread_minimum_stack_size.

2 years ago[Ada] Export No_Exception_Propagation_Active for use by gigi
Eric Botcazou [Wed, 6 Oct 2021 16:07:15 +0000 (18:07 +0200)]
[Ada] Export No_Exception_Propagation_Active for use by gigi

gcc/ada/

* fe.h (No_Exception_Propagation_Active): Declare.
* restrict.ads (No_Exception_Propagation_Active): Add WARNING line.

2 years ago[Ada] Warn about conversion with any predefined time types
Piotr Trojanek [Wed, 17 Feb 2021 22:55:59 +0000 (23:55 +0100)]
[Ada] Warn about conversion with any predefined time types

gcc/ada/

* sem_ch13.adb (Validate_Unchecked_Conversion): Simplify code
for detecting conversions with Ada.Calendar.Time type and extend
it to similar types in the Ada.Real_Time package.

2 years ago[Ada] Simplify membership tests with N_Generic_Declaration
Piotr Trojanek [Tue, 5 Oct 2021 12:12:46 +0000 (14:12 +0200)]
[Ada] Simplify membership tests with N_Generic_Declaration

gcc/ada/

* sem_ch10.adb, sem_prag.adb, sem_util.adb: Use
N_Generic_Declaration in membership tests.

2 years ago[Ada] Remove constant arguments
Etienne Servais [Wed, 29 Sep 2021 13:22:00 +0000 (15:22 +0200)]
[Ada] Remove constant arguments

gcc/ada/

* ali.adb (Get_Name): Ignore_Spaces is always False.
* bindo-graphs.adb (Set_Is_Existing_Source_Target_Relation): Val
is always True.
* cstand.adb (New_Standard_Entity): New_Node_Kind is always
N_Defininig_Identifier.
* exp_ch3.adb (Predef_Stream_Attr_Spec): For_Body is always
False.
* exp_dist.adb (Add_Parameter_To_NVList): RACW_Ctrl is always
False.
* gnatls.adb (Add_Directories): Prepend is always False.
* sem_ch10.adb, sem_ch10.ads (Load_Needed_Body): Do_Analyze is
always True.
* sem_ch3.adb, sem_ch3.ads (Process_Range_Expr_In_Decl):
R_Check_Off is always False.
* sem_elab.adb: (Info_Variable_Reference): Info_Msg is always
False, In_SPARK is always True.
(Set_Is_Traversed_Body, Set_Is_Saved_Construct,
Set_Is_Saved_Relation): Val is always True.
* treepr.adb (Visit_Descendant): No_Indent is always False.
(Print_Node): Fmt does not need such a big scope.

2 years ago[Ada] Find an interpretation for membership test with a singleton value
Etienne Servais [Tue, 21 Sep 2021 15:38:27 +0000 (17:38 +0200)]
[Ada] Find an interpretation for membership test with a singleton value

gcc/ada/

* sem_ch4.adb (Analyze_Membership_Op): Finds interpretation for
the case of a membership test with a singleton value in case of
overloading.

2 years ago[Ada] RTEMS: use hardware interrupts instead of signals for interrupt handling
Patrick Bernardi [Mon, 4 Oct 2021 21:37:50 +0000 (17:37 -0400)]
[Ada] RTEMS: use hardware interrupts instead of signals for interrupt handling

gcc/ada/

* Makefile.rtl (VxWorks): Rename s-inmaop__vxworks.adb to
s-inmaop__hwint.adb.
(RTEMS): Use s-inmaop__hwint.adb, s-intman__rtems.adb/s,
s-taprop__rtems.adb.
* libgnarl/a-intnam__rtems.ads: Remove signals definitions and
replace with Hardware_Interrupts.
* libgnarl/s-inmaop__vxworks.adb: Rename as...
* libgnarl/s-inmaop__hwint.adb: ... this.
* libgnarl/s-interr__hwint.adb: Remove unnecessary comments.
* libgnarl/s-intman__rtems.ads, libgnarl/s-intman__rtems.adb:
New files.
* libgnarl/s-osinte__rtems.adb: Add RTEMS API bindings.
(Binary_Semaphore_Create, Binary_Semaphore_Delete,
Binary_Semaphore_Obtain, Binary_Semaphore_Release,
Binary_Semaphore_Flush, Interrupt_Connect,
Interrupt_Number_To_Vector): New functions.
* libgnarl/s-osinte__rtems.ads (Num_HW_Interrupts, Signal):
Removed.
(NSIG, Interrupt_Range): New.
(Binary_Semaphore_Create, Binary_Semaphore_Delete,
Binary_Semaphore_Obtain, Binary_Semaphore_Release,
Binary_Semaphore_Flush, Interrupt_Connect,
Interrupt_Number_To_Vector): Remove Import pragma.
* libgnarl/s-taprop__rtems.adb: New file.

2 years ago[Ada] Fix internal error on fixed-point divide, multiply and scaling
Eric Botcazou [Thu, 30 Sep 2021 10:50:38 +0000 (12:50 +0200)]
[Ada] Fix internal error on fixed-point divide, multiply and scaling

gcc/ada/

* exp_fixd.adb (Get_Size_For_Value): New function returning a size
suitable for a non-negative integer value.
(Get_Type_For_Size): New function returning a standard type suitable
for a size.
(Build_Divide): Call both functions to compute the result type, but
make sure to pass a non-negative value to the first.
(Build_Multiply): Likewise.
(Do_Multiply_Fixed_Universal): Minor consistency tweak.
(Integer_Literal): Call both functions to compute the type.

2 years ago[Ada] Reorder subprogram spec and bodies in alphabetical order
Etienne Servais [Thu, 30 Sep 2021 12:27:34 +0000 (14:27 +0200)]
[Ada] Reorder subprogram spec and bodies in alphabetical order

gcc/ada/

* sem_ch4.adb (Analyze_Membership_Op): Reorder subprogram spec
and bodies in alphabetical order.

2 years ago[Ada] Rewrite extended names in derived class-wide expressions
Piotr Trojanek [Thu, 30 Sep 2021 10:54:28 +0000 (12:54 +0200)]
[Ada] Rewrite extended names in derived class-wide expressions

gcc/ada/

* exp_util.adb (Build_Class_Wide_Expression): Replace entities
of both simple and extended names.

2 years ago[Ada] Import binder globals as constant
Ghjuvan Lacambre [Wed, 29 Sep 2021 13:48:49 +0000 (15:48 +0200)]
[Ada] Import binder globals as constant

gcc/ada/

* libgnarl/s-intman__android.adb, libgnarl/s-intman__lynxos.adb,
libgnarl/s-intman__posix.adb, libgnarl/s-intman__qnx.adb,
libgnarl/s-intman__solaris.adb, libgnarl/s-intman__susv3.adb,
libgnarl/s-taprob.adb, libgnarl/s-taprop__hpux-dce.adb,
libgnarl/s-taprop__linux.adb, libgnarl/s-taprop__mingw.adb,
libgnarl/s-taprop__posix.adb, libgnarl/s-taprop__qnx.adb,
libgnarl/s-taprop__solaris.adb, libgnarl/s-taprop__vxworks.adb,
libgnarl/s-taskin.adb, libgnarl/s-tasque.adb,
libgnarl/s-tpoben.adb, libgnat/a-calend.adb,
libgnat/a-excach.adb, libgnat/a-except.adb, libgnat/a-tags.adb,
libgnat/a-textio.adb, libgnat/a-witeio.adb,
libgnat/a-ztexio.adb, libgnat/g-binenv.adb,
libgnat/s-parame.adb, libgnat/s-parame__vxworks.adb,
libgnat/s-stratt.adb, libgnat/s-trasym__dwarf.adb: Mark imported
binder globals as constant.

2 years ago[Ada] Move rewriting of boxes in aggregates from resolution to expansion
Piotr Trojanek [Wed, 29 Sep 2021 17:51:33 +0000 (19:51 +0200)]
[Ada] Move rewriting of boxes in aggregates from resolution to expansion

gcc/ada/

* exp_aggr.adb (Initialize_Record_Component): Add assertion
about one of the parameters, so that illegal attempts to
initialize record components with Empty node are detected early
on.
(Build_Record_Aggr_Code): Handle boxes in aggregate component
associations just the components with no initialization in
Build_Record_Init_Proc.
* sem_aggr.adb (Resolve_Record_Aggregate): For components that
require simple initialization carry boxes from resolution to
expansion.
* sem_util.adb (Needs_Simple_Initialization): Remove redundant
paren.

2 years ago[Ada] Simplify initialization of concurrent components
Piotr Trojanek [Wed, 29 Sep 2021 14:10:23 +0000 (16:10 +0200)]
[Ada] Simplify initialization of concurrent components

gcc/ada/

* exp_ch3.adb (Build_Init_Statements): Simplify detection of
concurrent record types.

2 years ago[Ada] Simplify detection of delayed aggregates
Piotr Trojanek [Wed, 29 Sep 2021 10:18:36 +0000 (12:18 +0200)]
[Ada] Simplify detection of delayed aggregates

gcc/ada/

* exp_aggr.adb (Is_Delayed_Aggregate): Simplify.

2 years ago[Ada] Simplify detection of record components with default initialization
Piotr Trojanek [Wed, 29 Sep 2021 10:16:38 +0000 (12:16 +0200)]
[Ada] Simplify detection of record components with default initialization

gcc/ada/

* exp_aggr.adb (Has_Default_Init_Comps): Simplify.

2 years ago[Ada] Remove redundant guard against an empty component list
Piotr Trojanek [Wed, 29 Sep 2021 10:13:17 +0000 (12:13 +0200)]
[Ada] Remove redundant guard against an empty component list

gcc/ada/

* exp_aggr.adb (Component_OK_For_Backend): Remove redundant
guard.

2 years ago[Ada] RTEMS: use default stack checking emulation package
Patrick Bernardi [Tue, 28 Sep 2021 18:00:09 +0000 (14:00 -0400)]
[Ada] RTEMS: use default stack checking emulation package

gcc/ada/

* Makefile.rtl (RTEMS): Add s-stchop.o to
EXTRA_GNATRTL_NONTASKING_OBJS, remove s-stchop__rtems.adb.
* libgnat/s-stchop__rtems.adb: Removed.

2 years ago[Ada] Do not clear Analyzed flag in expand if already set by preanalysis
Marc Poulhiès [Mon, 20 Sep 2021 14:33:30 +0000 (16:33 +0200)]
[Ada] Do not clear Analyzed flag in expand if already set by preanalysis

gcc/ada/

* expander.adb (Expand): Skip clearing of Analyzed flag if
already set for N_Real_Literal.

2 years ago[Ada] Simplify code for checks within an initialization procedure
Piotr Trojanek [Mon, 27 Sep 2021 14:37:57 +0000 (16:37 +0200)]
[Ada] Simplify code for checks within an initialization procedure

gcc/ada/

* sem_util.adb (Compile_Time_Constraint_Error): Simplify getting
the type of the first formal parameter.

2 years ago[Ada] Fix crash on array component with Default_Value
Piotr Trojanek [Mon, 27 Sep 2021 14:15:39 +0000 (16:15 +0200)]
[Ada] Fix crash on array component with Default_Value

gcc/ada/

* exp_util.adb (Inside_Init_Proc): Simplify.
* sem_aggr.adb (Resolve_Record_Aggregate): Fix style.
* sem_util.adb (Compile_Time_Constraint_Error): Guard against
calling Corresponding_Concurrent_Type with an array type entity.

2 years ago[Ada] Size of time_t in newer verions of VxWorks7
Doug Rupp [Fri, 17 Sep 2021 20:18:29 +0000 (13:18 -0700)]
[Ada] Size of time_t in newer verions of VxWorks7

gcc/ada/

* libgnat/s-parame__ae653.ads (time_t_bits): Change to
Long_Long_Integer'Size.  Add some comments to explain.

2 years agoopts: Remove AUTODETECT_VALUE usage.
Martin Liska [Fri, 8 Oct 2021 08:00:45 +0000 (10:00 +0200)]
opts: Remove AUTODETECT_VALUE usage.

gcc/ChangeLog:

* common.opt: Remove Init(2) for some options.
* toplev.c (process_options): Do not use AUTODETECT_VALUE, but
use rather OPTION_SET_P.

2 years agoRemove usage of IRA_REGION_AUTODETECT
Martin Liska [Fri, 8 Oct 2021 07:51:19 +0000 (09:51 +0200)]
Remove usage of IRA_REGION_AUTODETECT

gcc/ChangeLog:

* common.opt: Remove usage of IRA_REGION_AUTODETECT.
* flag-types.h (enum ira_region): Likewise.
* toplev.c (process_options): Use OPTION_SET_P instead of
IRA_REGION_AUTODETECT.

2 years agolibgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential.
Marcel Vollweiler [Mon, 11 Oct 2021 11:34:51 +0000 (04:34 -0700)]
libgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential.

The variable omp_atv_sequential was replaced by omp_atv_serialized in OpenMP
5.1. This was already implemented by Jakub (C/C++, commit ea82325afec) and
Tobias (Fortran, commit fff15bad1ab).

This patch adds two tests to check if omp_atv_serialized is available (one test
for C/C++ and one for Fortran). Besides that omp_atv_sequential is marked as
deprecated in C/C++ and Fortran for OpenMP 5.1.

libgomp/ChangeLog:

* allocator.c (omp_init_allocator): Replace omp_atv_sequential with
omp_atv_serialized.
* omp.h.in: Add deprecated flag for omp_atv_sequential.
* omp_lib.f90.in: Add deprecated flag for omp_atv_sequential.
* testsuite/libgomp.c-c++-common/alloc-10.c: New test.
* testsuite/libgomp.fortran/alloc-12.f90: New test.

2 years agoopenmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit
Jakub Jelinek [Mon, 11 Oct 2021 10:02:15 +0000 (12:02 +0200)]
openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit

OpenMP 5.1 adds env vars and functions to set and query new ICVs used
as fallback if thread_limit or num_teams clauses aren't specified on
teams construct.

The following patch implements those, though further work will be needed:
1) OpenMP 5.1 also changed the num_teams clause, so that it can specify
   both lower and upper limit for how many teams should be created and
   changed the meaning when only one expression is provided, instead of
   num_teams(expr) in 5.0 meaning num_teams(1:expr) in 5.1, it now means
   num_teams(expr:expr), i.e. while previously we could create 1 to expr
   teams, in 5.1 we have some low limit by default equal to the single
   expression provided and may not create fewer teams.
   For host teams (which we don't currently implement efficiently for
   NUMA hosts) we trivially satisfy it now by always honoring what the
   user asked for, but for the offloading teams I think we'll need to
   rethink the APIs; currently teams construct is just a call that returns
   and possibly lowers the number of teams; and whenever possible we try
   to evaluate num_teams/thread_limit already on the target construct
   and the GOMP_teams call just sets the number of teams to the minimum
   of provided and requested teams; for some cases e.g. where target
   is not combined with teams and num_teams expression calls some functions
   etc., we need to call those functions in the target region and so it is
   late to figure number of teams, but also hw could just limit what it
   is willing to create; in that case I'm afraid we need to run the target
   body multiple times and arrange for omp_get_team_num () returning the
   right values
2) we need to finally implement the NUMA handling for GOMP_teams_reg
3) I now realize I haven't added some testcase coverage, will do that
   incrementally
4) libgomp.texi needs updates for these new APIs, but also others like
   the allocator

2021-10-11  Jakub Jelinek  <jakub@redhat.com>

gcc/
* omp-low.c (omp_runtime_api_call): Handle omp_get_max_teams,
omp_[sg]et_teams_thread_limit and omp_set_num_teams.
libgomp/
* omp.h.in (omp_set_num_teams, omp_get_max_teams,
omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
* omp_lib.f90.in (omp_set_num_teams, omp_get_max_teams,
omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
* omp_lib.h.in (omp_set_num_teams, omp_get_max_teams,
omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
* libgomp.h (gomp_nteams_var, gomp_teams_thread_limit_var): Declare.
* libgomp.map (OMP_5.1): Export omp_get_max_teams{,_},
omp_get_teams_thread_limit{,_}, omp_set_num_teams{,_,_8_} and
omp_set_teams_thread_limit{,_,_8_}.
* icv.c (omp_set_num_teams, omp_get_max_teams,
omp_set_teams_thread_limit, omp_get_teams_thread_limit): New
functions.
* env.c (gomp_nteams_var, gomp_teams_thread_limit_var): Define.
(omp_display_env): Print OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT.
(initialize_env): Handle OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT env
vars.
* teams.c (GOMP_teams_reg): If thread_limit is not specified, use
gomp_teams_thread_limit_var as fallback if not zero.  If num_teams
is not specified, use gomp_nteams_var.
* fortran.c (omp_set_num_teams, omp_get_max_teams,
omp_set_teams_thread_limit, omp_get_teams_thread_limit): Add
ialias_redirect.
(omp_set_num_teams_, omp_set_num_teams_8_, omp_get_max_teams_,
omp_set_teams_thread_limit_, omp_set_teams_thread_limit_8_,
omp_get_teams_thread_limit_): New functions.

2 years agoIBM Z: Provide rawmemchr{qi,hi,si} expander
Stefan Schulze Frielinghaus [Mon, 11 Oct 2021 07:59:32 +0000 (09:59 +0200)]
IBM Z: Provide rawmemchr{qi,hi,si} expander

gcc/ChangeLog:

* config/s390/s390-protos.h (s390_rawmemchr): Add prototype.
* config/s390/s390.c (s390_rawmemchr): New function.
* config/s390/s390.md (rawmemchr<SINT:mode>): New expander.
* config/s390/vector.md (@vec_vfees<mode>): Basically a copy of
the pattern vfees<mode> from vx-builtins.md.
* config/s390/vx-builtins.md (*vfees<mode>): Remove.

gcc/testsuite/ChangeLog:

* gcc.target/s390/rawmemchr-1.c: New test.

2 years agoldist: Recognize strlen and rawmemchr like loops
Stefan Schulze Frielinghaus [Mon, 11 Oct 2021 07:59:13 +0000 (09:59 +0200)]
ldist: Recognize strlen and rawmemchr like loops

This patch adds support for recognizing loops which mimic the behaviour
of functions strlen and rawmemchr, and replaces those with internal
function calls in case a target provides them.  In contrast to the
standard strlen and rawmemchr functions, this patch also supports
different instances where the memory pointed to is interpreted as 8, 16,
and 32-bit sized, respectively.

gcc/ChangeLog:

* builtins.c (get_memory_rtx): Change to external linkage.
* builtins.h (get_memory_rtx): Add function prototype.
* doc/md.texi (rawmemchr<mode>): Document.
* internal-fn.c (expand_RAWMEMCHR): Define.
* internal-fn.def (RAWMEMCHR): Add.
* optabs.def (rawmemchr_optab): Add.
* tree-loop-distribution.c (find_single_drs): Change return code
behaviour by also returning true if no single store was found
but a single load.
(loop_distribution::classify_partition): Respect the new return
code behaviour of function find_single_drs.
(loop_distribution::execute): Call new function
transform_reduction_loop in order to replace rawmemchr or strlen
like loops by calls into builtins.
(generate_reduction_builtin_1): New function.
(generate_rawmemchr_builtin): New function.
(generate_strlen_builtin_1): New function.
(generate_strlen_builtin): New function.
(generate_strlen_builtin_using_rawmemchr): New function.
(reduction_var_overflows_first): New function.
(determine_reduction_stmt_1): New function.
(determine_reduction_stmt): New function.
(loop_distribution::transform_reduction_loop): New function.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/ldist-rawmemchr-1.c: New test.
* gcc.dg/tree-ssa/ldist-rawmemchr-2.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-1.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-2.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-3.c: New test.

2 years agooptions: use cl_optimization_hash.
Martin Liska [Fri, 8 Oct 2021 07:40:16 +0000 (09:40 +0200)]
options: use cl_optimization_hash.

gcc/ChangeLog:

* tree.c (cl_option_hasher::hash): Use cl_optimization_hash
and remove legacy hashing code.

2 years ago[PR/target 100316] Allow constant address for __builtin___clear_cache.
Kito Cheng [Thu, 7 Oct 2021 08:17:13 +0000 (16:17 +0800)]
[PR/target 100316] Allow constant address for __builtin___clear_cache.

__builtin___clear_cache was able to accept constant address for the
argument, but it seems no longer accept recently, and it even not
accept constant address which is hold in variable when optimization is
enable:

```
void foo3(){
  void *yy = (void*)0x1000;
  __builtin___clear_cache(yy, yy);
}
```

So this patch make BEGIN and END accept VOIDmode, like cselib_lookup_mem did per
Jim Wilson's suggestion.

```
static cselib_val *
cselib_lookup_mem (rtx x, int create)
{
  ...
  addr_mode = GET_MODE (XEXP (x, 0));
  if (addr_mode == VOIDmode)
    addr_mode = Pmode;
```

Changes v2 -> v3:
- Use gcc_assert rather than error, maybe_emit_call_builtin___clear_cache is
internal use only, and we already checked the type in other place.

Changes v1 -> v2:
- Check is CONST_INT intead of cehck mode, no new testcase, since
  constant value with other type like CONST_DOUBLE will catched by
  front-end.
e.g.
Code:
```c
void foo(){
  __builtin___clear_cache(1.11, 0);
}
```
Error message:
```
clearcache-double.c: In function 'foo':
clearcache-double.c:2:27: error: incompatible type for argument 1 of '__builtin___clear_cache'
    2 |   __builtin___clear_cache(1.11, 0);
      |                           ^~~~
      |                           |
      |                           double
clearcache-double.c:2:27: note: expected 'void *' but argument is of type 'double'
```

gcc/ChangeLog:

PR target/100316
* builtins.c (maybe_emit_call_builtin___clear_cache): Allow
CONST_INT for BEGIN and END, and use gcc_assert rather than
error.

gcc/testsuite/ChangeLog:

PR target/100316
* gcc.c-torture/compile/pr100316.c: New.

2 years agoAdjust testcase for O2 vectorization enabling.
liuhongt [Mon, 11 Oct 2021 05:14:13 +0000 (13:14 +0800)]
Adjust testcase for O2 vectorization enabling.

gcc/testsuite/ChangeLog:

PR middle-end/102669
* gnat.dg/unroll1.adb: Add -fno-tree-vectorize.

2 years agoDaily bump.
GCC Administrator [Mon, 11 Oct 2021 00:16:24 +0000 (00:16 +0000)]
Daily bump.

2 years agoFortran: handle initialization of derived type parameter arrays from scalar
Harald Anlauf [Sun, 10 Oct 2021 18:11:43 +0000 (20:11 +0200)]
Fortran: handle initialization of derived type parameter arrays from scalar

gcc/fortran/ChangeLog:

PR fortran/99348
PR fortran/102521
* decl.c (add_init_expr_to_sym): Extend initialization of
parameter arrays from scalars to handle derived types.

gcc/testsuite/ChangeLog:

PR fortran/99348
PR fortran/102521
* gfortran.dg/parameter_array_init_8.f90: New test.

2 years agovar-tracking: Fix a wrong-debug issue caused by my r10-7665 var-tracking change ...
Jakub Jelinek [Sun, 10 Oct 2021 10:13:22 +0000 (12:13 +0200)]
var-tracking: Fix a wrong-debug issue caused by my r10-7665 var-tracking change [PR102441]

Since my r10-7665-g33c45e51b4914008064d9b77f2c1fc0eea1ad060 change, we get
wrong-debug on e.g. the following testcase at -O2 -g on x86_64-linux for the
x parameter:
void bar (int *r);
int
foo (int x)
{
  int r = 0;
  bar (&r);
  return r;
}
At the start of function, we have
        subq    $24, %rsp
        leaq    12(%rsp), %rdi
instructions.  The x parameter is passed in %rdi, but isn't used in the
function and so the leaq instruction overwrites %rdi without remembering
%rdi anywhere.  Before the r10-7665 change (which was trying to fix a large
(3% for 32-bit, 1% for 64-bit x86-64) debug info/loc growth introduced with
r10-7515), the leaq insn above resulted in a MO_VAL_SET micro-operation that
said that the value of sp + 12, a cselib_sp_derived_value_p, is stored into
the %rdi register.  The r10-7665 change added a change to add_stores that
added no micro-operation for the leaq store, with the rationale that the sp
based values can be and will be always computable some other more compact
and primarily more stable way (cfa based expression like DW_OP_fbreg, that
is the same in the whole function).  That is true.  But by throwing the
micro-operation on the floor, we miss another important part of the
MO_VAL_SET, in particular that the destination of the store, %rdi in this
case, now has a different value from what it had before, so the vt_*
dataflow code thinks that even after the leaq instruction %rdi still holds
the x argument value (and changes it to DW_OP_entry_value (%rdi) only in the
middle of the call to bar).  Previously and with the patches below,
the location for x changes already at the end of leaq instruction to
DW_OP_entry_value (%rdi).

My first attempt to fix this was instead of dropping the MO_VAL_SET add
a MO_CLOBBER operation:
--- gcc/var-tracking.c.jj       2021-05-04 21:02:24.196799586 +0200
+++ gcc/var-tracking.c  2021-09-24 19:23:16.420154828 +0200
@@ -6133,7 +6133,9 @@ add_stores (rtx loc, const_rtx expr, voi
     {
       if (preserve)
        preserve_value (v);
-      return;
+      mo.type = MO_CLOBBER;
+      mo.u.loc = loc;
+      goto log_and_return;
     }

   nloc = replace_expr_with_values (oloc);
so don't track that the value lives in the loc destination, but track
that the previous value doesn't live there anymore.  That failed bootstrap
miserably, the vt_* code isn't prepared to see MO_CLOBBER of a MEM that
isn't tracked (e.g. has MEM_EXPR on it that the var-tracking code wants
to track, i.e. track_p in add_stores).  On the other side, thinking about
it more, in the most common case where a cselib_sp_derived_value_p value
is stored into the sp register (and which is the reason why PR94495
testcase got larger), dropping the micro-operation on the floor is the
right thing, because we have that cselib_sp_derived_value_p tracking, any
reads from the sp hard register will be treated as
cselib_sp_derived_value_p.
Then I've tried 3 different patches described below and in the end
what is committed is patch2.
Additionally, I've gathered statistics from cc1plus by always reverting the
var-tracking.c change after finished bootstrap/regtest and rebuilding the
stage3 var-tracking.o and cc1plus, such that it would be comparable.
dwlocstat and .debug_{info,loclists} section sizes detailed below.
patch3 uses MO_VAL_SET (i.e. essentially reversion of the r10-7665
change) when destination is not a REG_P and !track_p, otherwise if
destination is sp drops the micro-operation on the floor (i.e. no change),
otherwise adds a MO_CLOBBER.
patch1 is similar, except it checks for destination not equal to sp and
!track_p, i.e. for !track_p REG_P destinations other than sp it will use
MO_VAL_SET rather than MO_CLOBBER.
Finally, patch2, the shortest patch, uses MO_VAL_SET whenever destination
is not sp and otherwise drops the micro-operation on the floor.
All the 3 patches don't affect the PR94495 testcase, all the changes
there were caused by stores of sp based values into %rsp.

While the patch2 (and patch1 which results in exactly the same sizes)
causes the largest debug loclists/info growth from the 3, it is still quite
minor (0.651% on 64-bit and 0.114% on 32-bit) compared
to the 1% and 3% PR94495 was trying to solve, and I actually think it is the
best thing to do.  Because, if we have say
  int q[10];
  int *p = &q[0];
or similar and we load the &q[0] sp based value into some hard register,
by noting in the debug info that p lives in some hard reg for some part
of the function and a user is trying to change the p var in the debugger,
if we say it lives in some register or memory, there is some chance that
the changing of the value could work successfully (of course, nothing
is guaranteed, we don't have tracking of where each var lives at which
moment for changing purposes (i.e. what register, memory or else you need
to change in order to change behavior of the code)), while if we just say
that p's location is DW_OP_fbreg 16 DW_OP_stack_value, that is a read-only
value one can just print but not change.  Now, for stores of variable
values into the sp register, I don't think we have such an issue, you don't
want debugger to change your stack pointer when user asks to change value
of some variable whose value lives in the stack pointer, that would pretty
much always result in misbehavior of the program.
So, my preference from these 3 is patch2 and that is being committed.

64-bit cc1plus
==============
vanilla
cov%    samples cumul
0..10   1064665/37%     1064665/37%
11..20  35972/1%        1100637/38%
21..30  47969/1%        1148606/40%
31..40  45787/1%        1194393/42%
41..50  57529/2%        1251922/44%
51..60  53974/1%        1305896/46%
61..70  112055/3%       1417951/50%
71..80  79420/2%        1497371/52%
81..90  126225/4%       1623596/57%
91..100 1206682/42%     2830278/100%
  [34] .debug_info       PROGBITS        0000000000000000 2f1c74c a44949f 00      0   0  1
  [38] .debug_loclists   PROGBITS        0000000000000000 ff5d046 506e947 00      0   0  1
patch1 (same as patch2)
cov%    samples cumul
0..10   1064685/37%     1064685/37%
11..20  36011/1%        1100696/38%
21..30  47975/1%        1148671/40%
31..40  45799/1%        1194470/42%
41..50  57566/2%        1252036/44%
51..60  54011/1%        1306047/46%
61..70  112068/3%       1418115/50%
71..80  79421/2%        1497536/52%
81..90  126171/4%       1623707/57%
91..100 1206571/42%     2830278/100%
  [34] .debug_info       PROGBITS        0000000000000000 2f1c74c a448f27 00      0   0  1
  [38] .debug_loclists   PROGBITS        0000000000000000 ff608bc 52070dd 00      0   0  1
patch3
cov%    samples cumul
0..10   1064698/37%     1064698/37%
11..20  36018/1%        1100716/38%
21..30  47977/1%        1148693/40%
31..40  45804/1%        1194497/42%
41..50  57562/2%        1252059/44%
51..60  54018/1%        1306077/46%
61..70  112071/3%       1418148/50%
71..80  79424/2%        1497572/52%
81..90  126172/4%       1623744/57%
91..100 1206534/42%     2830278/100%
  [34] .debug_info       PROGBITS        0000000000000000 2f1c74c a449548 00      0   0  1
  [38] .debug_loclists   PROGBITS        0000000000000000 ff5df39 507acd8 00      0   0  1
So, size of .debug_info+.debug_loclists grows for vanilla -> patch1 (or patch2) by
0.651% and for vanilla -> patch3 by 0.020%.

32-bit cc1plus
==============
vanilla
cov%    samples cumul
0..10   1061892/37%     1061892/37%
11..20  34002/1%        1095894/39%
21..30  43513/1%        1139407/40%
31..40  41667/1%        1181074/42%
41..50  59144/2%        1240218/44%
51..60  47009/1%        1287227/45%
61..70  105069/3%       1392296/49%
71..80  72990/2%        1465286/52%
81..90  125988/4%       1591274/56%
91..100 1208726/43%     2800000/100%
  [33] .debug_info       PROGBITS        00000000 351ab10 8b1c83d 00      0   0  1
  [37] .debug_loclists   PROGBITS        00000000 ebc816e 3fe44fd 00      0   0  1
patch1 (same as patch2)
cov%    samples cumul
0..10   1061999/37%     1061999/37%
11..20  34065/1%        1096064/39%
21..30  43557/1%        1139621/40%
31..40  41690/1%        1181311/42%
41..50  59191/2%        1240502/44%
51..60  47143/1%        1287645/45%
61..70  105045/3%       1392690/49%
71..80  73021/2%        1465711/52%
81..90  125885/4%       1591596/56%
91..100 1208404/43%     2800000/100%
  [33] .debug_info       PROGBITS        00000000 351ab10 8b1c597 00      0   0  1
  [37] .debug_loclists   PROGBITS        00000000 ebca915 401ffad 00      0   0  1
patch3
cov%    samples cumul
0..10   1062006/37%     1062006/37%
11..20  34073/1%        1096079/39%
21..30  43559/1%        1139638/40%
31..40  41693/1%        1181331/42%
41..50  59189/2%        1240520/44%
51..60  47142/1%        1287662/45%
61..70  105054/3%       1392716/49%
71..80  73027/2%        1465743/52%
81..90  125874/4%       1591617/56%
91..100 1208383/43%     2800000/100%
  [33] .debug_info       PROGBITS        00000000 351ab10 8b1c690 00      0   0  1
  [37] .debug_loclists   PROGBITS        00000000 ebca40a 4020a6e 00      0   0  1
So, size of .debug_info+.debug_loclists grows for vanilla -> patch1 (or patch2) by
0.114% and for vanilla -> patch3 by 0.116%.

2021-10-10  Jakub Jelinek  <jakub@redhat.com>

PR debug/102441
* var-tracking.c (add_stores): For cselib_sp_derived_value_p values
use MO_VAL_SET if loc is not sp.

2 years agotree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"
Andrew Pinski [Sun, 10 Oct 2021 01:28:59 +0000 (01:28 +0000)]
tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

So it turns out this is kinda of a latent bug but not really latent.
In GCC 9 and 10, phi-opt would transform a?-1:0 (even for signed 1-bit integer)
to -(type)a but the type is an one bit integer which means the negation is
undefined. GCC 11 fixed the problem by checking for a?pow2cst:0 transformation
before a?-1:0 transformation.

When I added the transformations to match.pd, I had swapped the order not paying
attention and I didn't expect anything of it. Because there was no testcase failing
due to this.
Anyways this fixes the problem on the trunk by swapping the order in match.pd and
adding a comment of why the order is this way.

I will try to come up with a patch for GCC 9 and 10 series later on which fixes
the problem there too.

Note I didn't include the original testcase which requires the vectorizer and AVX-512f
as I can't figure out the right dg options to restrict it to avx-512f but I did come up
with a testcase which shows the problem and even more shows the problem with the 9/10
series as mentioned.

OK? Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/102622

gcc/ChangeLog:

* match.pd: Swap the order of a?pow2cst:0 and a?-1:0 transformations.
Swap the order of a?0:pow2cst and a?0:-1 transformations.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/bitfld-10.c: New test.

2 years agoDaily bump.
GCC Administrator [Sun, 10 Oct 2021 00:16:19 +0000 (00:16 +0000)]
Daily bump.

2 years agoFortran: accept both old and new-style relational operators in USE, ONLY
Harald Anlauf [Sat, 9 Oct 2021 19:16:32 +0000 (21:16 +0200)]
Fortran: accept both old and new-style relational operators in USE, ONLY

F2018:10.1.5.5.1(2) requires the same interpretation of old and new-style
relational operators.  As gfortran internally distinguishes between
these versions, we must match equivalent notations in
USE module, ONLY: OPERATOR(op)
statements when reading modules.

gcc/fortran/ChangeLog:

PR fortran/65454
* module.c (read_module): Handle old and new-style relational
operators when used in USE module, ONLY: OPERATOR(op).

gcc/testsuite/ChangeLog:

PR fortran/65454
* gfortran.dg/interface_operator_3.f90: New test.

2 years agotestsuite: Add missing comment for some dg-warning
Kewen Lin [Sat, 9 Oct 2021 09:17:07 +0000 (04:17 -0500)]
testsuite: Add missing comment for some dg-warning

This fixes the typos introduced by commit r12-4240.

The dg-warning format looks like:

{ dg-warning regexp
    [comment [{ target/xfail selector } [line] ]] }

Some dg-warnings such as:

{ dg-warning "\\\[-Wstringop-overflow"
    { target { i?86-*-* x86_64-*-* } } }

miss the comment field, it makes target selector not take effect.

For targets which are not { i?86-*-* x86_64-*-* }, this kind of cases
fail or pass unexpectedly.

gcc/testsuite/ChangeLog:

* c-c++-common/Wstringop-overflow-2.c: Add missing comment.
* gcc.dg/Warray-bounds-51.c: Likewise.
* gcc.dg/Warray-parameter-3.c: Likewise.
* gcc.dg/Wstringop-overflow-14.c: Likewise.
* gcc.dg/Wstringop-overflow-21.c: Likewise.
* gcc.dg/Wstringop-overflow-76.c: Likewise.

2 years agoAdjust more testcases for O2 vectorization enabling.
liuhongt [Sat, 9 Oct 2021 02:26:22 +0000 (10:26 +0800)]
Adjust more testcases for O2 vectorization enabling.

libgomp/ChangeLog:

* testsuite/libgomp.c++/scan-10.C: Add option -fvect-cost-model=cheap.
* testsuite/libgomp.c++/scan-11.C: Ditto.
* testsuite/libgomp.c++/scan-12.C: Ditto.
* testsuite/libgomp.c++/scan-13.C: Ditto.
* testsuite/libgomp.c++/scan-14.C: Ditto.
* testsuite/libgomp.c++/scan-15.C: Ditto.
* testsuite/libgomp.c++/scan-16.C: Ditto.
* testsuite/libgomp.c++/scan-9.C: Ditto.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: Ditto.
* testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: Ditto.
* testsuite/libgomp.c/scan-11.c: Ditto.
* testsuite/libgomp.c/scan-12.c: Ditto.
* testsuite/libgomp.c/scan-13.c: Ditto.
* testsuite/libgomp.c/scan-14.c: Ditto.
* testsuite/libgomp.c/scan-15.c: Ditto.
* testsuite/libgomp.c/scan-16.c: Ditto.
* testsuite/libgomp.c/scan-17.c: Ditto.
* testsuite/libgomp.c/scan-18.c: Ditto.
* testsuite/libgomp.c/scan-19.c: Ditto.
* testsuite/libgomp.c/scan-20.c: Ditto.
* testsuite/libgomp.c/scan-21.c: Ditto.
* testsuite/libgomp.c/scan-22.c: Ditto.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/pr94403.C: Add -fno-tree-vectorize
* gcc.dg/optimize-bswapsi-5.c: Ditto.
* gcc.dg/optimize-bswapsi-6.c: Ditto.
* gcc.dg/Warray-bounds-51.c: Add additional option
-mtune=generic for target x86/i?86
* gcc.dg/Wstringop-overflow-14.c: Ditto.

2 years agoopenmp: Add support for OpenMP 5.1 structured-block-sequences
Jakub Jelinek [Sat, 9 Oct 2021 08:14:36 +0000 (10:14 +0200)]
openmp: Add support for OpenMP 5.1 structured-block-sequences

Related to this is the addition of structured-block-sequence in OpenMP 5.1,
which doesn't change anything for Fortran, but for C/C++ allows multiple
statements instead of just one possibly compound around the separating
directives (section and scan).

I've also made some updates to the OpenMP 5.1 support list in libgomp.texi.

2021-10-09  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
* c-parser.c (c_parser_omp_structured_block_sequence): New function.
(c_parser_omp_scan_loop_body): Use it.
(c_parser_omp_sections_scope): Likewise.
gcc/cp/
* parser.c (cp_parser_omp_structured_block): Remove disallow_omp_attrs
argument.
(cp_parser_omp_structured_block_sequence): New function.
(cp_parser_omp_scan_loop_body): Use it.
(cp_parser_omp_sections_scope): Likewise.
gcc/testsuite/
* c-c++-common/gomp/sections1.c (foo): Don't expect errors on
multiple statements in between section directive(s).  Add testcases
for invalid no statements in between section directive(s).
* gcc.dg/gomp/sections-2.c (foo): Don't expect errors on
multiple statements in between section directive(s).
* g++.dg/gomp/sections-2.C (foo): Likewise.
* g++.dg/gomp/attrs-6.C (foo): Add testcases for multiple
statements in between section directive(s).
(bar): Add testcases for multiple statements in between scan
directive.
* g++.dg/gomp/attrs-7.C (bar): Adjust expected error recovery.
libgomp/
* libgomp.texi (OpenMP 5.1): Mention implemented support for
structured block sequences in C/C++.  Mention support for
unconstrained/reproducible modifiers on order clause.
Mention partial (C/C++ only) support of extentensions to atomics
construct.  Mention partial (C/C++ on clause only) support of
align/allocator modifiers on allocate clause.

2 years agoRefine movhfcc.
liuhongt [Fri, 8 Oct 2021 07:21:44 +0000 (15:21 +0800)]
Refine movhfcc.

For AVX512-FP16, HFmode only supports vcmpsh whose dest is mask
register, so for movhfcc, it's

vcmpsh op2, op1, %k1
vmovsh op1, op2{%k1}
mov op2, dest

gcc/ChangeLog:

PR target/102639
* config/i386/i386-expand.c (ix86_valid_mask_cmp_mode): Handle
HFmode.
(ix86_use_mask_cmp_p): Ditto.
(ix86_expand_sse_movcc): Ditto.
* config/i386/i386.md (setcc_hf_mask): New define_insn.
(movhf_mask): Ditto.
(UNSPEC_MOVCC_MASK): New unspec.
* config/i386/sse.md (UNSPEC_PCMP): Move to i386.md.

gcc/testsuite/ChangeLog:
* g++.target/i386/pr102639.C: New test.

2 years agoDaily bump.
GCC Administrator [Sat, 9 Oct 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.

2 years agolibstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725]
Jonathan Wakely [Fri, 8 Oct 2021 19:48:35 +0000 (20:48 +0100)]
libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725]

Now that std::wstring and other specializations for wchar_t are defined
unconditionally, many checks for _GLIBCXX_USE_WCHAR_T in the testsuite
are unnecessary and can be removed. Tests for iostreams, locales, regex
and filesystem::path still need to be guarded by _GLIBCXX_USE_WCHAR_T
because those components depend on libc support in <wchar.h> and other
headers.

libstdc++-v3/ChangeLog:

PR libstdc++/98725
* testsuite/18_support/numeric_limits/lowest.cc: Remove use of
_GLIBCXX_USE_WCHAR_T.
* testsuite/18_support/numeric_limits/min_max.cc: Replace use of
_GLIBCXX_USE_WCHAR_T with checks for WCHAR_MIN and WCHAR_MAX.
* testsuite/20_util/from_chars/1_neg.cc: Remove use of
_GLIBCXX_USE_WCHAR_T.
* testsuite/20_util/function_objects/searchers.cc: Likewise. Use
char_traits<wchar_t>::length instead of wcslen.
* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_arithmetic/value.cc: Likewise.
* testsuite/20_util/is_compound/value.cc: Likewise.
* testsuite/20_util/is_floating_point/value.cc: Likewise.
* testsuite/20_util/is_fundamental/value.cc: Likewise.
* testsuite/20_util/is_integral/value.cc: Likewise.
* testsuite/20_util/is_signed/value.cc: Likewise.
* testsuite/20_util/is_unsigned/value.cc: Likewise.
* testsuite/20_util/is_void/value.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs-1.cc:
Likewise.
* testsuite/20_util/make_signed/requirements/typedefs-2.cc:
Likewise.
* testsuite/20_util/make_signed/requirements/typedefs-3.cc:
Likewise.
* testsuite/20_util/make_signed/requirements/typedefs-4.cc:
Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc:
Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc:
Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs-3.cc:
Likewise.
* testsuite/20_util/to_chars/3.cc: Likewise.
* testsuite/20_util/type_identity/requirements/typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string/hash/debug.cc: Likewise.
* testsuite/21_strings/basic_string/hash/hash.cc: Likewise.
* testsuite/21_strings/basic_string/literals/types-char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string/literals/types.cc: Likewise.
* testsuite/21_strings/basic_string/literals/values-char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string/literals/values.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/64422.cc:
Likewise.
* testsuite/21_strings/basic_string/range_access/wchar_t/1.cc:
Likewise.
* testsuite/21_strings/basic_string/requirements/citerators.cc:
Likewise.
* testsuite/21_strings/basic_string/requirements/typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string_view/literals/types-char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/literals/types.cc:
Likewise.
* testsuite/21_strings/basic_string_view/literals/values-char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/literals/values.cc:
Likewise.
* testsuite/21_strings/basic_string_view/requirements/typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string_view/typedefs.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions.cc:
Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
Likewise.
* testsuite/22_locale/ctype/is/string/89728_neg.cc: Likewise.
* testsuite/25_algorithms/fill/4.cc: Likewise.
* testsuite/25_algorithms/fill_n/1.cc: Likewise.
* testsuite/experimental/functional/searchers.cc: Likewise. Use
char_traits<wchar_t>::length instead of wcslen.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
Likewise.
* testsuite/experimental/string_view/literals/types-char8_t.cc:
Likewise.
* testsuite/experimental/string_view/literals/types.cc:
Likewise.
* testsuite/experimental/string_view/literals/values-char8_t.cc:
Likewise.
* testsuite/experimental/string_view/literals/values.cc:
Likewise.
* testsuite/experimental/string_view/range_access/wchar_t/1.cc:
Likewise.
* testsuite/experimental/string_view/requirements/typedefs.cc:
Likewise.
* testsuite/experimental/string_view/typedefs.cc: Likewise.
* testsuite/ext/vstring/range_access.cc: Likewise.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/integral.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/signed_integral.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/unsigned_integral.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_arithmetic/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_compound/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_floating_point/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_fundamental/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_integral/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_signed/value.cc: Likewise.
* testsuite/tr1/4_metaprogramming/is_unsigned/value.cc:
Likewise.
* testsuite/tr1/4_metaprogramming/is_void/value.cc: Likewise.
* testsuite/tr1/6_containers/hash/24799.cc: Likewise.

2 years agolibstdc++: Define deleted wchar_t overloads unconditionally [PR 98725]
Jonathan Wakely [Fri, 8 Oct 2021 13:26:09 +0000 (14:26 +0100)]
libstdc++: Define deleted wchar_t overloads unconditionally [PR 98725]

We don't need to have <wchar.h> support in order to delete overloads
for inserting wide characters into narrow streams.

libstdc++-v3/ChangeLog:

PR libstdc++/98725
* include/std/ostream (operator<<(basic_ostream<char, Tr>&, wchar_t))
(operator<<(basic_ostream<char, Tr>&, const wchar_t*)): Always
define as deleted. Do not check _GLIBCXX_USE_WCHAR_T.

2 years agolibstdc++: Define std::wstring_convert unconditionally [PR 98725]
Jonathan Wakely [Fri, 8 Oct 2021 13:25:42 +0000 (14:25 +0100)]
libstdc++: Define std::wstring_convert unconditionally [PR 98725]

The wchar_t type is defined unconditionally for C++, so there is no
reason for std::wstring_convert and std::wbuffer_convert to be disabled
when <wchar.h> is not usable. It should be possible to use those class
templates with char16_t and char32_t even if wchar_t conversions don't
work.

libstdc++-v3/ChangeLog:

PR libstdc++/98725
* include/bits/locale_conv.h (wstring_convert, wbuffer_convert):
Define unconditionally. Do not check _GLIBCXX_USE_WCHAR_T.