]> gcc.gnu.org Git - gcc.git/log
gcc.git
2 years agoFortran: error recovery on rank mismatch of array and its initializer
Harald Anlauf [Sat, 6 Nov 2021 18:42:01 +0000 (19:42 +0100)]
Fortran: error recovery on rank mismatch of array and its initializer

gcc/fortran/ChangeLog:

PR fortran/102715
* decl.c (add_init_expr_to_sym): Reject rank mismatch between
array and its initializer.

gcc/testsuite/ChangeLog:

PR fortran/102715
* gfortran.dg/pr68019.f90: Adjust error message.
* gfortran.dg/pr102715.f90: New test.

(cherry picked from commit df2135e88a8f78c853b35246ad426b01b6d08378)

2 years agoFortran: fix simplification of array-valued parameter expressions
Harald Anlauf [Fri, 5 Nov 2021 22:48:20 +0000 (23:48 +0100)]
Fortran: fix simplification of array-valued parameter expressions

gcc/fortran/ChangeLog:

PR fortran/102817
* expr.c (simplify_parameter_variable): Copy shape of referenced
subobject when simplifying.

gcc/testsuite/ChangeLog:

PR fortran/102817
* gfortran.dg/pr102817.f90: New test.

(cherry picked from commit bcf3728abe8488882922005166d3065fc5fdfea1)

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.

(cherry picked from commit 74ccca380cde5e79e082d39214b306a90ded0344)

2 years agoDaily bump.
GCC Administrator [Sun, 7 Nov 2021 00:18:02 +0000 (00:18 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 6 Nov 2021 00:18:03 +0000 (00:18 +0000)]
Daily bump.

2 years agoSupport TI mode and soft float on PA64
John David Anglin [Fri, 5 Nov 2021 16:09:08 +0000 (16:09 +0000)]
Support TI mode and soft float on PA64

This change implements TI mode on PA64.  Various new patterns are
added to pa.md.  The libgcc build needed modification to build both
DI and TI routines.  We also need various softfp routines to
convert to and from TImode.

I added full softfp for the -msoft-float option.  At the moment,
this doesn't completely eliminate all use of the floating-point
co-processor.  For this, libgcc needs to be built with -msoft-mult.
The floating-point exception support also needs a soft option.

2021-11-05  John David Anglin  <danglin@gcc.gnu.org>

PR libgomp/96661

gcc/ChangeLog:

* config/pa/pa-modes.def: Add OImode integer type.
* config/pa/pa.c (pa_scalar_mode_supported_p): Allow TImode
for TARGET_64BIT.
* config/pa/pa.h (MIN_UNITS_PER_WORD) Define to MIN_UNITS_PER_WORD
to UNITS_PER_WORD if IN_LIBGCC2.
* config/pa/pa.md (addti3, addvti3, subti3, subvti3, negti2,
negvti2, ashlti3, shrpd_internal): New patterns.
Change some multi instruction types to multi.

libgcc/ChangeLog:

* config.host (hppa*64*-*-linux*): Revise tmake_file.
(hppa*64*-*-hpux11*): Likewise.
* config/pa/sfp-exceptions.c: New.
* config/pa/sfp-machine.h: New.
* config/pa/t-dimode: New.
* config/pa/t-softfp-sfdftf: New.

2 years agoSpeed up jump table switch detection.
Martin Liska [Fri, 13 Aug 2021 15:22:35 +0000 (17:22 +0200)]
Speed up jump table switch detection.

PR tree-optimization/100393

gcc/ChangeLog:

* tree-switch-conversion.c (group_cluster::dump): Use
  get_comparison_count.
(jump_table_cluster::find_jump_tables): Pre-compute number of
comparisons and then decrement it. Cache also max_ratio.
(jump_table_cluster::can_be_handled): Change signature.
* tree-switch-conversion.h (get_comparison_count): New.

(cherry picked from commit c517cf2e685e2903b591d63c1034ff9726cb3822)

2 years agogcc: vx-common.h: fix test for VxWorks7
Rasmus Villemoes [Tue, 2 Nov 2021 10:43:57 +0000 (11:43 +0100)]
gcc: vx-common.h: fix test for VxWorks7

The macro TARGET_VXWORKS7 is always defined (see vxworks-dummy.h).
Thus we need to test its value, not its definedness.

Fixes aca124df (define NO_DOT_IN_LABEL only in vxworks6).

gcc/ChangeLog:

* config/vx-common.h: Test value of TARGET_VXWORKS7 rather
than definedness.

(cherry picked from commit 44d0243a247dd1280265c649dab26e9486ffa015)

2 years agoDaily bump.
GCC Administrator [Fri, 5 Nov 2021 00:18:08 +0000 (00:18 +0000)]
Daily bump.

2 years agox86: Check leal/addl gcc.target/i386/amxtile-3.c for x32
H.J. Lu [Thu, 4 Nov 2021 14:37:18 +0000 (07:37 -0700)]
x86: Check leal/addl gcc.target/i386/amxtile-3.c for x32

Check leal and addl for x32 to fix:

FAIL: gcc.target/i386/amxtile-3.c scan-assembler addq[ \\t]+\\$12
FAIL: gcc.target/i386/amxtile-3.c scan-assembler leaq[ \\t]+4
FAIL: gcc.target/i386/amxtile-3.c scan-assembler leaq[ \\t]+8

* gcc.target/i386/amxtile-3.c: Check leal/addl for x32.

(cherry picked from commit fbe58ba97aff3270877d7fd5600c17687b85964c)

2 years agoi386: Fix wrong result for AMX-TILE intrinsic when parsing expression.
Hongyu Wang [Wed, 3 Nov 2021 05:58:52 +0000 (13:58 +0800)]
i386: Fix wrong result for AMX-TILE intrinsic when parsing expression.

_tile_loadd, _tile_stored, _tile_streamloadd intrinsics are defined by
macro, so the parameters should be wrapped by parentheses to accept
expressions.

gcc/ChangeLog:

* config/i386/amxtileintrin.h (_tile_loadd_internal): Add
parentheses to base and stride.
(_tile_stream_loadd_internal): Likewise.
(_tile_stored_internal): Likewise.

gcc/testsuite/ChangeLog:
* gcc.target/i386/amxtile-3.c: New test.

2 years agoDaily bump.
GCC Administrator [Thu, 4 Nov 2021 00:18:09 +0000 (00:18 +0000)]
Daily bump.

2 years agoranger: Fix `-Werror' build error with `ranger_cache::push_poor_value'
Maciej W. Rozycki [Wed, 3 Nov 2021 22:07:04 +0000 (22:07 +0000)]
ranger: Fix `-Werror' build error with `ranger_cache::push_poor_value'

Remove a commit 86534c07a390 ("Disable poor value processing in ranger
cache.") regression that caused GCC not to build anymore if `-Werror'
has been enabled:

.../gcc/gimple-range-cache.cc: In member function 'bool ranger_cache::push_poor_value(basic_block, tree)':
.../gcc/gimple-range-cache.cc:850:44: error: unused parameter 'bb' [-Werror=unused-parameter]
  850 | ranger_cache::push_poor_value (basic_block bb, tree name)
      |                                ~~~~~~~~~~~~^~
.../gcc/gimple-range-cache.cc:850:53: error: unused parameter 'name' [-Werror=unused-parameter]
  850 | ranger_cache::push_poor_value (basic_block bb, tree name)
      |                                                ~~~~~^~~~

To keep the change to the minimum mark the parameters reported unused.

gcc/
* gimple-range-cache.cc (ranger_cache::push_poor_value): Mark
parameters unused.

2 years ago[PR102842] Consider all outputs in generation of matching reloads
Vladimir N. Makarov [Tue, 26 Oct 2021 18:03:42 +0000 (14:03 -0400)]
[PR102842] Consider all outputs in generation of matching reloads

Without considering all output insn operands (not only processed
before), in rare cases LRA can use the same hard register for
different outputs of the insn on different assignment subpasses.  The
patch fixes the problem.

gcc/ChangeLog:

PR rtl-optimization/102842
* lra-constraints.c (match_reload): Ignore out in checking values
of outs.
(curr_insn_transform): Collect outputs before doing reloads of operands.

gcc/testsuite/ChangeLog:

PR rtl-optimization/102842
* g++.target/arm/pr102842.C: New test.

2 years agoipa/102714 - IPA SRA eliding volatile
Richard Biener [Wed, 13 Oct 2021 07:13:36 +0000 (09:13 +0200)]
ipa/102714 - IPA SRA eliding volatile

The following fixes the volatileness check of IPA SRA which was
looking at the innermost reference when checking TREE_THIS_VOLATILE
but the reference to check is the outermost one.

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

PR ipa/102714
* ipa-sra.c (ptr_parm_has_nonarg_uses): Fix volatileness
check.

* gcc.dg/ipa/pr102714.c: New testcase.

(cherry picked from commit 23cd18c60c8188e3d68eda721cdb739199e85e5b)

2 years agoDaily bump.
GCC Administrator [Wed, 3 Nov 2021 00:18:12 +0000 (00:18 +0000)]
Daily bump.

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

2 years agolibstdc++: Fix range access for empty std::valarray [PR103022]
Jonathan Wakely [Mon, 1 Nov 2021 11:06:51 +0000 (11:06 +0000)]
libstdc++: Fix range access for empty std::valarray [PR103022]

The std::begin and std::end overloads for std::valarray are defined in
terms of std::addressof(v[0]) which is undefined for an empty valarray.

libstdc++-v3/ChangeLog:

PR libstdc++/103022
* include/std/valarray (begin, end): Do not dereference an empty
valarray. Add noexcept and [[nodiscard]].
* testsuite/26_numerics/valarray/range_access.cc: Check empty
valarray. Check iterator properties. Run as well as compiling.
* testsuite/26_numerics/valarray/range_access2.cc: Likewise.
* testsuite/26_numerics/valarray/103022.cc: New test.

(cherry picked from commit 91bac9fed5d082f0b180834110ebc0f46f97599a)

2 years agoDaily bump.
GCC Administrator [Mon, 1 Nov 2021 00:17:51 +0000 (00:17 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 31 Oct 2021 00:18:04 +0000 (00:18 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 30 Oct 2021 00:18:11 +0000 (00:18 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 29 Oct 2021 00:18:11 +0000 (00:18 +0000)]
Daily bump.

2 years agoUpdate documentation of %X spec
Eric Botcazou [Thu, 28 Oct 2021 13:51:14 +0000 (15:51 +0200)]
Update documentation of %X spec

%X
Output the accumulated linker options specified by -Wl or a ‘%x’ spec string

The part about -Wl has been obsolete for 27 years, since this change:

Author: Torbjorn Granlund <tege@gnu.org>
Date:   Thu Oct 27 18:04:25 1994 +0000

    (process_command): Handle -Wl, and -Xlinker similar to -l,

    i.e., preserve their order with respect to linker input files.

Technically speaking, the arguments of -l, -Wl and -Xlinker are input files.

gcc/
* doc/invoke.texi (%X): Remove obsolete reference to -Wl.

2 years agoDaily bump.
GCC Administrator [Thu, 28 Oct 2021 00:18:23 +0000 (00:18 +0000)]
Daily bump.

2 years agoFortran: do not restrict PDT KIND and LEN type parameters to default integer
Harald Anlauf [Tue, 26 Oct 2021 18:54:41 +0000 (20:54 +0200)]
Fortran: do not restrict PDT KIND and LEN type parameters to default integer

gcc/fortran/ChangeLog:

PR fortran/102917
* decl.c (match_attr_spec): Remove invalid integer kind checks on
KIND and LEN attributes of PDTs.

gcc/testsuite/ChangeLog:

PR fortran/102917
* gfortran.dg/pdt_4.f03: Adjust testcase.

(cherry picked from commit cfcb27cfcb1d32b8cf7bc463cc1fc5cacae8d199)

2 years agoFix warnings building linux-atomic.c and fptr.c on hppa64-linux
John David Anglin [Wed, 27 Oct 2021 18:01:40 +0000 (18:01 +0000)]
Fix warnings building linux-atomic.c and fptr.c on hppa64-linux

The file fptr.c is specific to 32-bit hppa-linux and should not be
included in LIB2ADD on hppa64-linux.

There is a builtin type mismatch in linux-atomic.c using the type
long long unsigned int for 64-bit atomic operations on hppa64-linux.

2021-10-27  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

* config.host (hppa*64*-*-linux*): Don't add pa/t-linux to
tmake_file.
* config/pa/linux-atomic.c: Define u8, u16 and u64 types.
Use them in FETCH_AND_OP_2, OP_AND_FETCH_2, COMPARE_AND_SWAP_2,
SYNC_LOCK_TEST_AND_SET_2 and SYNC_LOCK_RELEASE_1 macros.
* config/pa/t-linux64 (LIB1ASMSRC): New define.
(LIB1ASMFUNCS): Revise.
(HOST_LIBGCC2_CFLAGS): Add "-DLINUX=1".

2 years agosra: Fix corner case of total scalarization with virtual inheritance (PR 102505)
Martin Jambor [Wed, 27 Oct 2021 17:15:33 +0000 (19:15 +0200)]
sra: Fix corner case of total scalarization with virtual inheritance (PR 102505)

PR 102505 is a situation where of SRA takes its initial top-level
access size from a get_ref_base_and_extent called on a COMPONENT_REF,
and thus derived frm the FIELD_DECL, which however does not include a
virtual base.  Total scalarization then goes on traversing the type,
which however has virtual base past the non-virtual bits, tricking SRA
to create sub-accesses outside of the supposedly encompassing
accesses, which in turn triggers the verifier within the pass.

The patch below fixes that by failing total scalarization when this
situation is detected.

This backport also has commit f217e87972a2a207e793101fc05cfc9dd095c678
squashed into it in order to avoid PR 102886 that the fix introduced
on trunk.

gcc/ChangeLog:

2021-10-20  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/102505
* tree-sra.c (totally_scalarize_subtree): Check that the
encountered field fits within the acces we would like to put it
in.

gcc/testsuite/ChangeLog:

2021-10-20  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/102505
* g++.dg/torture/pr102505.C: New test.

(cherry picked from commit 701ee067807b80957c65bd7ff94b6099a27181de)

2 years agoDaily bump.
GCC Administrator [Wed, 27 Oct 2021 00:18:10 +0000 (00:18 +0000)]
Daily bump.

2 years agogcc/configure: Check for powerpc64le*-*-freebsd*
Piotr Kubaj [Sat, 16 Oct 2021 02:09:05 +0000 (04:09 +0200)]
gcc/configure: Check for powerpc64le*-*-freebsd*

Only powerpc64-unknown-freebsd was checked for.

Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
gcc/
* configure.ac: Treat powerpc64*-*-freebsd* the same as
powerpc64-*-freebsd*.
* configure: Regenerate.

(cherry picked from commit a9ef07fe5899fc5998395cdbf96e00af372cfb0b)

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

2 years agoDaily bump.
GCC Administrator [Mon, 25 Oct 2021 00:18:08 +0000 (00:18 +0000)]
Daily bump.

2 years agoRevise -mdisable-fpregs option and add new -msoft-mult option
John David Anglin [Sun, 24 Oct 2021 17:55:25 +0000 (17:55 +0000)]
Revise -mdisable-fpregs option and add new -msoft-mult option

The behavior of the -mdisable-fpregs is confusing in that it doesn't
disable the use of the floating-point registers in all situations.
The -msoft-float disables the use of the floating-point registers in
all situations.  The Linux kernel only needs to disable use of the
xmpyu instruction to avoid using the floating-point registers.

This change revises the -mdisable-fpregs option to disable the use of
the floating-point registers in all situations.  It is now equivalent
to the -msoft-float option.  A new -msoft-mult option is added to
disable use of the xmpyu instruction.  The libgcc library can be
compiled with the -msoft-mult option to avoid using hardware integer
multiplication.

2021-10-24  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa-d.c (pa_d_handle_target_float_abi): Don't check
TARGET_DISABLE_FPREGS.
* config/pa/pa.c (fix_range): Use MASK_SOFT_FLOAT instead of
MASK_DISABLE_FPREGS.
(hppa_rtx_costs): Don't check TARGET_DISABLE_FPREGS.  Adjust
cost of hardware integer multiplication.
(pa_conditional_register_usage): Don't check TARGET_DISABLE_FPREGS.
* config/pa/pa.h (INT14_OK_STRICT): Likewise.
* config/pa/pa.md: Don't check TARGET_DISABLE_FPREGS. Check
TARGET_SOFT_FLOAT in patterns that use xmpyu instruction.
* config/pa/pa.opt (mdisable-fpregs): Change target mask to
SOFT_FLOAT.  Revise comment.
(msoft-float): New option.

2 years agoDon't use 'G' constraint in integer move patterns
John David Anglin [Sun, 24 Oct 2021 16:40:12 +0000 (16:40 +0000)]
Don't use 'G' constraint in integer move patterns

The 'G' constraint only matches a float zero.

2021-10-24  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md: Don't use 'G' constraint in integer move patterns.

2 years agoDaily bump.
GCC Administrator [Sun, 24 Oct 2021 00:18:04 +0000 (00:18 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 23 Oct 2021 00:18:10 +0000 (00:18 +0000)]
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 22 Oct 2021 00:18:04 +0000 (00:18 +0000)]
Daily bump.

2 years agox86: Document -fcf-protection requires i686 or newer
H.J. Lu [Thu, 21 Oct 2021 16:45:14 +0000 (09:45 -0700)]
x86: Document -fcf-protection requires i686 or newer

PR target/98667
* doc/invoke.texi: Document -fcf-protection requires i686 or
new.

(cherry picked from commit 1373066a46d8d47abd97e46a005aef3b3dbfe94a)

2 years agoDaily bump.
GCC Administrator [Thu, 21 Oct 2021 00:17:57 +0000 (00:17 +0000)]
Daily bump.

2 years agoAvoid exception propagation during bootstrap
Arnaud Charlet [Wed, 20 Oct 2021 08:23:40 +0000 (10:23 +0200)]
Avoid exception propagation during bootstrap

This addresses PR ada/100486, which is the bootstrap failure of GCC 11 for
32-bit Windows in the MSYS setup.  The PR shows that we cannot rely on
exception propagation being operational during the bootstrap, at least on
the 11 branch, so fix this by removing the problematic raise statement.

gcc/ada/
PR ada/100486
* sem_prag.adb (Check_Valid_Library_Unit_Pragma): Do not raise an
exception as part of the bootstrap.

2 years agoc++: Fix up push_local_extern_decl_alias error recovery [PR102642]
Jakub Jelinek [Wed, 20 Oct 2021 06:38:58 +0000 (08:38 +0200)]
c++: Fix up push_local_extern_decl_alias error recovery [PR102642]

My recent push_local_extern_decl_alias change broke error-recovery,
do_pushdecl can return error_mark_node and set_decl_tls_model can't be
called on that.  There are other code paths that store error_mark_node
into DECL_LOCAL_DECL_ALIAS, with the intent to differentiate the cases
where we haven't yet tried to push it into the namespace scope (NULL)
and one where we have tried it but it failed (error_mark_node), but looking
around, there are other spots where we call functions or do processing
which doesn't tolerate error_mark_node.

So, the first hunk with the testcase fixes the testcase, the others
fix what I've spotted and the fix was easy to figure out (there are I think
3 other spots mainly for function multiversioning).

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

PR c++/102642
* name-lookup.c (push_local_extern_decl_alias): Don't call
set_decl_tls_model on error_mark_node.
* decl.c (make_rtl_for_nonlocal_decl): Don't call
set_user_assembler_name on error_mark_node.
* parser.c (cp_parser_oacc_declare): Ignore DECL_LOCAL_DECL_ALIAS
if it is error_mark_node.
(cp_parser_omp_declare_target): Likewise.

* g++.dg/tls/pr102642.C: New test.

(cherry picked from commit 424945258d1778617b5d3d5273f6e1c10e718f80)

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

2 years agolibstdc++: Fix doxygen generation to work with relative paths
Jonathan Wakely [Tue, 19 Oct 2021 15:00:13 +0000 (16:00 +0100)]
libstdc++: Fix doxygen generation to work with relative paths

In r12-826 I tried to remove some redundant steps from the doxygen
build, but they are needed when configure is run as a relative path. The
use of pwd is to resolve the relative path to an absolute one.

libstdc++-v3/ChangeLog:

* doc/Makefile.am (stamp-html-doxygen, stamp-html-doxygen)
(stamp-latex-doxygen, stamp-man-doxygen): Fix recipes for
relative ${top_srcdir}.
* doc/Makefile.in: Regenerate.

(cherry picked from commit 04d392e8430ca66a3f12b7db4f3cb84788269a48)

2 years agoFortran: Fix CLASS conversion check [PR102745]
Tobias Burnus [Mon, 18 Oct 2021 07:49:05 +0000 (09:49 +0200)]
Fortran: Fix CLASS conversion check [PR102745]

PR fortran/102745
gcc/fortran/ChangeLog
* intrinsic.c (gfc_convert_type_warn): Fix checks by checking CLASS
and do typcheck in correct order for type extension.
* misc.c (gfc_typename): Print proper not internal CLASS type name.

gcc/testsuite/ChangeLog
* gfortran.dg/class_72.f90: New.

(cherry picked from commit 017665f63047ce47b087b0b283548a60e5abf3d2)

2 years agoDaily bump.
GCC Administrator [Tue, 19 Oct 2021 00:18:06 +0000 (00:18 +0000)]
Daily bump.

2 years agoi386: Fix ICE in ix86_print_opreand_address [PR 102761]
Uros Bizjak [Mon, 18 Oct 2021 15:03:28 +0000 (17:03 +0200)]
i386: Fix ICE in ix86_print_opreand_address [PR 102761]

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

PR target/102761

gcc/ChangeLog:

* config/i386/i386.c (ix86_print_operand_address):
Error out for non-address_operand asm operands.

gcc/testsuite/ChangeLog:

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

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.

(cherry picked from commit 4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d)

2 years agoopenmp: Fix up handling of OMP_PLACES=threads(1)
Jakub Jelinek [Fri, 15 Oct 2021 14:25:25 +0000 (16:25 +0200)]
openmp: Fix up handling of OMP_PLACES=threads(1)

When writing the places-*.c tests, I've noticed that we mishandle threads
abstract name with specified num-places if num-places isn't a multiple of
number of hw threads in a core.  It then happily ignores the maximum count
and overwrites for the remaining hw threads in a core further places that
haven't been allocated.

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

* config/linux/affinity.c (gomp_affinity_init_level_1): For level 1
after creating count places clean up and return immediately.
* testsuite/libgomp.c/places-6.c: New test.
* testsuite/libgomp.c/places-7.c: New test.
* testsuite/libgomp.c/places-8.c: New test.

(cherry picked from commit 4764049dd620affcd3e2658dc7f03a6616370a29)

2 years agoamdgcn: fix up offload debug linking with LLVM 13
Andrew Stubbs [Wed, 13 Oct 2021 10:53:42 +0000 (11:53 +0100)]
amdgcn: fix up offload debug linking with LLVM 13

Between LLVM 9 and LLVM 13 the attribute works differently in several ways,
and this needs to be allowed for in GCC and mkoffload independently.

This patch fixes up mkoffload when debug info is enabled, which is made more
complicated because the configure tests checks whether the attribute option
is accepted silently, but does not check if the assembler actually sets the
ELF flags for that attribute, and mkoffload needs to mimick that behaviour
exactly. The patch therefore removes some of the conditionals.

gcc/ChangeLog:

* config/gcn/gcn-hsa.h (S_FIJI): Set unconditionally.
(S_900): Likewise.
(S_906): Likewise.
* config/gcn/gcn.c: Hard code SRAM ECC settings for old architectures.
* config/gcn/mkoffload.c (ELFABIVERSION_AMDGPU_HSA): Rename to ...
(ELFABIVERSION_AMDGPU_HSA_V3): ... this.
(ELFABIVERSION_AMDGPU_HSA_V4): New.
(SET_SRAM_ECC_UNSUPPORTED): New.
(copy_early_debug_info): Create elf flags to match the other objects.
(main): Just let the attribute flags pass through.

(cherry picked from commit f3d64372d777d7d6068df8167b6751c289963e85)

2 years agoamdgcn: Fix assembler version incompatibility
Andrew Stubbs [Thu, 30 Sep 2021 16:50:33 +0000 (17:50 +0100)]
amdgcn: Fix assembler version incompatibility

This is another case of the global_load instruction format changing in LLVM
(because they fixed a bug).  The configure test is already in place to detect
what is needed.

gcc/ChangeLog:

* config/gcn/gcn-valu.md (gather<mode>_insn_2offsets<exec>): Apply
HAVE_GCN_ASM_GLOBAL_LOAD_FIXED.
(scatter<mode>_insn_2offsets<exec_scatter>): Likewise.

(cherry picked from commit 81c362c7c2bccd72d798bf7ea6c74d4b1cc3931f)

2 years agoamdgcn: Implement -msram-ecc=any
Andrew Stubbs [Tue, 28 Sep 2021 15:26:09 +0000 (16:26 +0100)]
amdgcn: Implement -msram-ecc=any

The option was already there, but just an alias for -msram-ecc=on.  Now that
LLVM13 supports HSACOv4 and the new ELF flags I can implement the option
properly.

The "any" option is the default in order to ensure that library files work
whichever way the user wants, which means we won't need multilibs to support
the different SRAM ECC hardware configurations.

gcc/ChangeLog:

* config/gcn/gcn-hsa.h (SRAMOPT): Include the whole option string.
Adjust for new -msram-ecc=any behaviour.
(ASM_SPEC): Adjust -mxnack and -msram-ecc usage.
* config/gcn/gcn.c (output_file_start): Implement -msram-ecc=any.
* config/gcn/mkoffload.c (EF_AMDGPU_XNACK): Rename to ...
(EF_AMDGPU_XNACK_V3): ... this.
(EF_AMDGPU_SRAM_ECC): Rename to ...
(EF_AMDGPU_SRAM_ECC_V3): ... this.
(EF_AMDGPU_FEATURE_XNACK_V4): New.
(EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4): New.
(EF_AMDGPU_FEATURE_XNACK_ANY_V4): New.
(EF_AMDGPU_FEATURE_XNACK_OFF_V4): New.
(EF_AMDGPU_FEATURE_XNACK_ON_V4): New.
(EF_AMDGPU_FEATURE_SRAMECC_V4): New.
(EF_AMDGPU_FEATURE_SRAMECC_UNSUPPORTED_V4): New.
(EF_AMDGPU_FEATURE_SRAMECC_ANY_V4): New.
(EF_AMDGPU_FEATURE_SRAMECC_OFF_V4): New.
(EF_AMDGPU_FEATURE_SRAMECC_ON_V4): New.
(SET_XNACK_ON): New.
(SET_XNACK_OFF): New.
(TEST_XNACK): New.
(SET_SRAM_ECC_ON): New.
(SET_SRAM_ECC_ANY): New.
(SET_SRAM_ECC_OFF): New.
(TEST_SRAM_ECC_ANY): New.
(TEST_SRAM_ECC_ON): New.
(main): Implement HSACOv4 and -msram-ecc=any.

(cherry picked from commit 205dafb6edeca08419f4a5976be79bf7c86fd9a1)

2 years agoamdgcn: Support LLVM 13 assembler syntax
Andrew Stubbs [Sat, 16 Oct 2021 16:41:39 +0000 (18:41 +0200)]
amdgcn: Support LLVM 13 assembler syntax

The LLVM devs have changed the assembler architecture attribute names on both
CLI and in the ".amdgcn_target" directive, and changed the attribute syntax
inside the directive, without keeping any backwards compatibility. :-(

This patch improves our configure tests to detect what dialect to use, what
attributes are valid, and adjusts the specs to match.

gcc/ChangeLog:

* config.in: Regenerate.
* config/gcn/gcn-hsa.h (X_FIJI): New macro.
(X_900): New macro.
(X_906): New macro.
(X_908): New macro.
(A_FIJI): Rename to ...
(S_FIJI): ... this.
(A_900): Rename to ...
(S_900): ... this.
(A_906): Rename to ...
(S_906): ... this.
(A_908): Rename to ...
(S_908): ... this.
(SRAMOPT): New macro.
(ASM_SPEC): Adjust xnack option usage.
* config/gcn/gcn.c (output_file_start): Adjust amdgcn_target usage.
* configure: Regenerate.
* configure.ac: Detect LLVM assembler dialect.

(cherry picked from commit 6ca03ca35a58ebf9792aa8a08adf00b6fd3e0015)

2 years agoamdgcn: Mark s_mulk_i32 as clobbering SCC
Julian Brown [Mon, 28 Jun 2021 13:58:52 +0000 (06:58 -0700)]
amdgcn: Mark s_mulk_i32 as clobbering SCC

The s_mulk_i32 instruction sets the SCC status register according to
whether the multiplication overflows, but that is not currently modelled
in the GCN backend.  AFAIK this is a latent bug and hasn't been noticed
"in the wild", but it should be fixed.

2021-06-29  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn.md (mulsi3): Make s_mulk_i32 variant clobber SCC.

(cherry picked from commit 5c127c4cac308429cba483a2ac4e175c2ab26165)

2 years agoamdgcn: Fix attributes for LLVM-12 [PR 100208]
Andrew Stubbs [Tue, 27 Jul 2021 14:40:21 +0000 (15:40 +0100)]
amdgcn: Fix attributes for LLVM-12 [PR 100208]

This should work for a wider range of LLVM 12 variants now.
More work required for LLVM 13 though.

gcc/ChangeLog:

PR target/100208
* config.in: Regenerate.
* config/gcn/gcn-hsa.h (A_FIJI): New define.
(A_900): New define.
(A_906): New define.
(A_908): New define.
(ASM_SPEC): Use A_FIJI, A_900, A_906 and A_908.
* config/gcn/gcn.c (output_file_start): Adjust attributes according
to the assembler capabilities.
* config/gcn/mkoffload.c (main): Likewise.
* configure: Regenerate.
* configure.ac: Add tests for LLVM assembler attribute features.

2 years agoamdgcn: Add -mxnack and -msram-ecc [PR 100208]
Andrew Stubbs [Thu, 8 Jul 2021 14:47:53 +0000 (15:47 +0100)]
amdgcn: Add -mxnack and -msram-ecc [PR 100208]

gcc/ChangeLog:

PR target/100208
* config/gcn/gcn-hsa.h (DRIVER_SELF_SPECS): New.
(ASM_SPEC): Set -mattr for xnack and sram-ecc.
* config/gcn/gcn-opts.h (enum sram_ecc_type): New.
* config/gcn/gcn-valu.md: Add a warning comment.
* config/gcn/gcn.c (gcn_option_override): Add "sorry" for -mxnack.
(output_file_start): Add xnack and sram-ecc state to ".amdgcn_target".
* config/gcn/gcn.md: Add a warning comment.
* config/gcn/gcn.opt: Add -mxnack and -msram-ecc.
* config/gcn/mkoffload.c (EF_AMDGPU_MACH_AMDGCN_GFX908): Remove
SRAM-ECC flag.
(EF_AMDGPU_XNACK): New.
(EF_AMDGPU_SRAM_ECC): New.
(elf_flags): New.
(copy_early_debug_info): Use elf_flags.
(main): Handle -mxnack and -msram-ecc options.
* doc/invoke.texi: Document -mxnack and -msram-ecc.

gcc/testsuite/ChangeLog:

PR target/100208
* gcc.target/gcn/sram-ecc-1.c: New test.
* gcc.target/gcn/sram-ecc-2.c: New test.
* gcc.target/gcn/sram-ecc-3.c: New test.
* gcc.target/gcn/sram-ecc-4.c: New test.
* gcc.target/gcn/sram-ecc-5.c: New test.
* gcc.target/gcn/sram-ecc-6.c: New test.
* gcc.target/gcn/sram-ecc-7.c: New test.
* gcc.target/gcn/sram-ecc-8.c: New test.

(cherry picked from commit aad32a00b7d2b64ae158b2b167768a9ae3e20f6e)

2 years agogcc/configure.ac: fix register issue for global_load assembler functions
Marcel Vollweiler [Fri, 18 Jun 2021 11:50:36 +0000 (04:50 -0700)]
gcc/configure.ac: fix register issue for global_load assembler functions

gcc/ChangeLog:

* config.in: Regenerate.
* config/gcn/gcn.c (print_operand_address): Fix for global_load assembler
functions.
* configure: Regenerate.
* configure.ac: Fix for global_load assembler functions.

(cherry picked from commit cfa1f8226f275447015e2cb3fb0d876133e6509b)

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

2 years agoFortran: fix order of checks for the SHAPE intrinsic
Harald Anlauf [Thu, 14 Oct 2021 18:18:14 +0000 (20:18 +0200)]
Fortran: fix order of checks for the SHAPE intrinsic

gcc/fortran/ChangeLog:

PR fortran/102716
* check.c (gfc_check_shape): Reorder checks so that invalid KIND
arguments can be detected.

gcc/testsuite/ChangeLog:

PR fortran/102716
* gfortran.dg/shape_10.f90: New test.

(cherry picked from commit 1b115daf62d94337b3d0b2962b0bbbf005a450e0)

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

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

2 years agoConsistently use "rG" constraint for copy instruction in move patterns
John David Anglin [Fri, 15 Oct 2021 14:51:22 +0000 (14:51 +0000)]
Consistently use "rG" constraint for copy instruction in move patterns

2021-10-15  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md: Consistently use "rG" constraint for copy
instruction in move patterns.

2 years agoDaily bump.
GCC Administrator [Fri, 15 Oct 2021 00:18:36 +0000 (00:18 +0000)]
Daily bump.

2 years ago[PR102627] Use at least natural mode during splitting hard reg live range
Vladimir N. Makarov [Fri, 8 Oct 2021 14:16:09 +0000 (10:16 -0400)]
[PR102627] Use at least natural mode during splitting hard reg live range

In the PR test case SImode was used to split live range of cx on x86-64
because it was the biggest mode for this hard reg in the function.  But
all 64-bits of cx contain structure members.  We need always to use at least
natural mode of hard reg in splitting to fix this problem.

gcc/ChangeLog:

PR rtl-optimization/102627
* lra-constraints.c (split_reg): Use at least natural mode of hard reg.

gcc/testsuite/ChangeLog:

PR rtl-optimization/102627
* gcc.target/i386/pr102627.c: New test.

2 years agolibstdc++: Fix non-default constructors for hash containers [PR101583]
Jonathan Wakely [Thu, 22 Jul 2021 17:49:57 +0000 (18:49 +0100)]
libstdc++: Fix non-default constructors for hash containers [PR101583]

When I added the new mixin to _Hashtable, I forgot to explicitly
construct it in each non-default constructor. That means you can't
use any constructors unless all three of the hash function, equality
function, and allocator are all default constructible.

libstdc++-v3/ChangeLog:

PR libstdc++/101583
* include/bits/hashtable.h (_Hashtable): Replace mixin with
_Enable_default_ctor. Construct it explicitly in all
non-forwarding, non-defaulted constructors.
* testsuite/23_containers/unordered_map/cons/default.cc: Check
non-default constructors can be used.
* testsuite/23_containers/unordered_set/cons/default.cc:
Likewise.

(cherry picked from commit 8ed6cfbbee74ec9e03f2558b9c36f61dd7d4dcfd)

2 years agoFix TARGET_SOFT_FLOAT patterns in pa.md
John David Anglin [Thu, 14 Oct 2021 00:58:33 +0000 (00:58 +0000)]
Fix TARGET_SOFT_FLOAT patterns in pa.md

2021-10-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md (cbranchsf4): Disable if TARGET_SOFT_FLOAT.
(cbranchdf4): Likewise.
Add missing move patterns for TARGET_SOFT_FLOAT.

2 years agoDaily bump.
GCC Administrator [Thu, 14 Oct 2021 00:18:17 +0000 (00:18 +0000)]
Daily bump.

2 years agolibstdc++: Rename files with the wrong extensions
Jonathan Wakely [Wed, 13 Oct 2021 21:31:51 +0000 (22:31 +0100)]
libstdc++: Rename files with the wrong extensions

libstdc++-v3/ChangeLog:

* testsuite/27_io/filesystem/path/construct/102592.C: Moved to...
* testsuite/27_io/filesystem/path/construct/102592.cc: ...here.
* testsuite/28_regex/match_results/102667.C: Moved to...
* testsuite/28_regex/match_results/102667.cc: ...here.

(cherry picked from commit ce55693604813c5be7d23260f1fd276cf5a48f8f)

2 years agolibstdc++: Fix dangling string_view in filesystem::path [PR102592]
Jonathan Wakely [Wed, 13 Oct 2021 16:02:59 +0000 (17:02 +0100)]
libstdc++: Fix dangling string_view in filesystem::path [PR102592]

When creating a path from a pair of non-contiguous iterators we pass the
iterators to _S_convert(Iter, Iter). That function passes the iterators
to __string_from_range to get a contiguous sequence of characters, and
then calls _S_convert(const C*, const C*) to perform the encoding
conversions. If the value type, C, is char8_t, then no conversion is
needed and the _S_convert<char8_t>(const char8_t*, const char8_t*)
specialization casts the pointer to const char* and returns a
std::string_view that refs to the char8_t sequence. However, that
sequence is owned by the std::u8string rvalue returned by
__string_from_range, which goes out of scope when _S_convert(Iter, Iter)
returns. That means the std::string_view is dangling and we get
undefined behaviour when parsing it as a path.

The same problem does not exist for the path members taking a "Source"
argument, because those functions all convert a non-contiguous range
into a basic_string<C> immediately, using __effective_range(__source).
That means that the rvalue string returned by that function is still in
scope for the full expression, so the string_view does not dangle.

The solution for the buggy functions is to do the same thing, and call
__string_from_range immediately, so that the returned rvalue is still in
scope for the lifetime of the string_view returned by _S_convert. To
avoid reintroducing the same problem, remove the _S_convert(Iter, Iter)
overload that calls __string_from_range and returns a dangling view.

libstdc++-v3/ChangeLog:

PR libstdc++/102592
* include/bits/fs_path.h (path::path(Iter, Iter, format))
(path::append(Iter, Iter), path::concat(Iter, Iter)): Call
__string_from_range directly, instead of two-argument overload
of _S_convert.
(path::_S_convert(Iter, Iter)): Remove.
* testsuite/27_io/filesystem/path/construct/102592.C: New test.

(cherry picked from commit 85b24e32dc27ec2e70b853713e0713cbc1ff08c3)

2 years agolibstdc++: Add noexcept-specifier to basic_string_view(It, End)
Jonathan Wakely [Wed, 14 Jul 2021 10:03:17 +0000 (11:03 +0100)]
libstdc++: Add noexcept-specifier to basic_string_view(It, End)

This adds a conditional noexcept to the C++20 constructor. The
std::to_address call cannot throw, so only taking the difference of the
two iterators can throw.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/std/string_view (basic_string_view(It, End)): Add
noexcept-specifier.
* testsuite/21_strings/basic_string_view/cons/char/range.cc:
Check noexcept-specifier. Also check construction without CTAD.

(cherry picked from commit f9c2ce1dae270d8d5dc261a57a21f96a1da5ea2d)

2 years agoDarwin, X86, config: Adjust 'as' command lines [PR100340].
Iain Sandoe [Sat, 31 Jul 2021 15:29:03 +0000 (16:29 +0100)]
Darwin, X86, config: Adjust 'as' command lines [PR100340].

Versions of the assembler using clang from XCode 12.5/12.5.1
have a bug which produces different code layout between debug and
non-debug input, leading to a compare fail for default configure
parameters.

This is a workaround fix to disable the optimisation that is
responsible for the bug.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/100340 - Bootstrap fails with Clang 12.0.5 (XCode 12.5)

PR target/100340

gcc/ChangeLog:

* config.in: Regenerate.
* config/i386/darwin.h (EXTRA_ASM_OPTS): New
(ASM_SPEC): Pass options to disable branch shortening where
needed.
* configure: Regenerate.
* configure.ac: Detect versions of 'as' that support the
optimisation which has the bug.

(cherry picked from commit 743b8dd6fd757e997eb060d70fd4ae8e04fb56cd)

2 years agoAdd support for 32-bit hppa targets in muldi3 expander
John David Anglin [Wed, 13 Oct 2021 15:45:39 +0000 (15:45 +0000)]
Add support for 32-bit hppa targets in muldi3 expander

2021-10-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md (muldi3): Add support for inlining 64-bit
multiplication on 32-bit PA 1.1 and 2.0 targets.

2 years agolibstdc++: Fix various bugs in ranges_algo.h [PR100187, ...]
Patrick Palka [Wed, 28 Apr 2021 03:21:19 +0000 (23:21 -0400)]
libstdc++: Fix various bugs in ranges_algo.h [PR100187, ...]

This fixes some bugs with our ranges algorithms in uncommon situations,
such as when the return type of a predicate is a non-copyable class type
that's implicitly convertible to bool (PR100187), when a comparison
predicate isn't invocable as an rvalue (PR100237), and when the return
type of a projection function is non-copyable (PR100249).

This also fixes PR100287, which reports that we're moving __first twice
when constructing with it an empty subrange in ranges::partition.

libstdc++-v3/ChangeLog:

PR libstdc++/100187
PR libstdc++/100237
PR libstdc++/100249
PR libstdc++/100287
* include/bits/ranges_algo.h (__search_n_fn::operator()): Give
the __value_comp lambda an explicit bool return type.
(__is_permutation_fn::operator()): Give the __proj_scan local
variable auto&& return type.  Give the __comp_scan lambda an
explicit bool return type.
(__remove_fn::operator()): Give the __pred lambda an explicit
bool return type.
(__partition_fn::operator()): Don't std::move __first twice
when returning an empty subrange.
(__min_fn::operator()): Don't std::move __comp.
(__max_fn::operator()): Likewise.
(__minmax_fn::operator()): Likewise.

(cherry picked from commit d91e7eab3a2c3957c2220ad71e62d9fc78cccb9b)

2 years agoDarwin, D: Fix bootstrap when target does not support -Bstatic/dynamic.
Iain Sandoe [Tue, 5 Oct 2021 18:54:30 +0000 (19:54 +0100)]
Darwin, D: Fix bootstrap when target does not support -Bstatic/dynamic.

This fixes a bootstrap fail because saw_static_libcxx was unused for
targets without support for -Bstatic/dynamic.

The fix applied pushes the -static-libstdc++ back onto the command
line, which allows a target to substitute a static version of the
c++ standard library using specs.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/d/ChangeLog:

* d-spec.cc (lang_specific_driver): Push the -static-libstdc++
option back onto the command line for targets without support
for -Bstatic/dynamic.

(cherry picked from commit e24760533b62bb7068e63eb8da49dbca2837d38d)

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

2 years agolibstdc++: Fix ip::tcp::resolver test failure on Solaris
Jonathan Wakely [Tue, 31 Aug 2021 12:08:23 +0000 (13:08 +0100)]
libstdc++: Fix ip::tcp::resolver test failure on Solaris

Solaris 11 does not have "http" in /etc/services, which causes this test
to fail. Try some other services until we find one that works.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Try other service if "http" fails.

(cherry picked from commit 48b20d46f9597a4b1e19e0e2d4a0c68d056d7662)

2 years agolibstdc++: Make Networking TS headers more portable [PR100285]
Jonathan Wakely [Thu, 26 Aug 2021 11:06:55 +0000 (12:06 +0100)]
libstdc++: Make Networking TS headers more portable [PR100285]

Add more preprocessor conditions to check for constants being defined
before using them, so that the Networking TS headers can be compiled on
a wider range of platforms.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/100285
* configure.ac: Check for O_NONBLOCK.
* configure: Regenerate.
* include/experimental/internet: Include <ws2tcpip.h> for
Windows.  Use preprocessor conditions around more constants.
* include/experimental/socket: Use preprocessor conditions
around more constants.
* testsuite/experimental/net/internet/resolver/base.cc: Only use
constants when the corresponding C macro is defined.
* testsuite/experimental/net/socket/basic_socket.cc: Likewise.
* testsuite/experimental/net/socket/socket_base.cc: Likewise.
Make preprocessor checks more fine-grained.

2 years agolibstdc++: fix is_default_constructible for hash containers [PR 100863]
Jonathan Wakely [Tue, 20 Jul 2021 14:20:41 +0000 (15:20 +0100)]
libstdc++: fix is_default_constructible for hash containers [PR 100863]

The recent change to _Hashtable_ebo_helper for this PR broke the
is_default_constructible trait for a hash container with a non-default
constructible allocator. That happens because the constructor needs to
be user-provided in order to initialize the member, and so is not
defined as deleted when the type is not default constructible.

By making _Hashtable derive from _Enable_special_members we can ensure
that the default constructor for the std::unordered_xxx containers is
deleted when it would be ill-formed. This makes the trait give the
correct answer.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/100863
* include/bits/hashtable.h (_Hashtable): Conditionally delete
default constructor by deriving from _Enable_special_members.
* testsuite/23_containers/unordered_map/cons/default.cc: New test.
* testsuite/23_containers/unordered_set/cons/default.cc: New test.

(cherry picked from commit 89ec3b67dbe856a447d068b053bc19559f136f43)

2 years agolibstdc++: Value-initialize objects held by EBO helpers [PR 100863]
Jonathan Wakely [Wed, 2 Jun 2021 11:34:48 +0000 (12:34 +0100)]
libstdc++: Value-initialize objects held by EBO helpers [PR 100863]

The allocator, hash function and equality function should all be
value-initialized by the default constructor of an unordered container.
Do it in the EBO helper, so we don't have to get it right in multiple
places.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/100863
PR libstdc++/65816
* include/bits/hashtable_policy.h (_Hashtable_ebo_helper):
Value-initialize subobject.
* testsuite/23_containers/unordered_map/allocator/default_init.cc:
Remove XFAIL.
* testsuite/23_containers/unordered_set/allocator/default_init.cc:
Remove XFAIL.

(cherry picked from commit f8f0193b5b83f6e85d65015e79c803295baf5166)

2 years agolibstdc++: Allow lualatex to be used for Doxygen PDF
Jonathan Wakely [Fri, 14 May 2021 13:19:50 +0000 (14:19 +0100)]
libstdc++: Allow lualatex to be used for Doxygen PDF

This allows the Doxygen PDF to be built using lualatex instead of
pdflatex, which solves a problem with pdflatex running out of memory
sometimes. This is done by adding a --latex_cmd option to the
run_doxygen script, which then sets the specified command in the
generated user.cfg file used by Doxygen. The makefile is adjusted to
pass --latex_cmd=$(LATEX_CMD) to the script, so using running make with
LATEX_CMD=lualatex will override the default.

Additionally, this does some refactoring of the doc/Makefile.am rules
and the run_doxygen script.

libstdc++-v3/ChangeLog:

* doc/Makefile.am: Simplify doxygen recipes and use --latex_cmd.
* doc/Makefile.in: Regenerate.
* doc/doxygen/user.cfg.in (LATEX_CMD_NAME): Add placeholder
value.
* scripts/run_doxygen (print_usage): Always print to stdout and
do not exit.
(fail): New function for exiting on error.
(parse_options): Handle --latex_cmd. Do not treat --help the
same as errors. Simplify handling of required arguments.

(cherry picked from commit e3b6d3a887fc0df09ea742c9c5a5acbc27c11ea7)

2 years agolibstdc++: Reduce output of 'make doc-pdf-doxygen'
Jonathan Wakely [Wed, 28 Apr 2021 13:49:28 +0000 (14:49 +0100)]
libstdc++: Reduce output of 'make doc-pdf-doxygen'

Use '@' to prevent Make from echoing the recipe, so that users don't see
this every time:

  if [ -f ${doxygen_pdf} ]; then
    mv ${doxygen_pdf} ${api_pdf} ;
    echo ":: PDF file is ${api_pdf}";
  else
    echo "... error";
    grep -F 'LaTeX Error' ${doxygen_outdir}/latex/refman.log;
    grep -F 'TeX capacity exceeded, sorry' ${doxygen_outdir}/latex/refman.log;
    exit 12;
  fi

The presence of the "error" strings in the output makes it look like an
error happened. By suppressing the echoing user's will only see "error"
if the 'else' branch is taken.

libstdc++-v3/ChangeLog:

* doc/Makefile.am (stamp-pdf-doxygen): Improve comment about
dealing with errors. Use '@' to prevent shell command being
echoed.
* doc/Makefile.in: Regenerate.

(cherry picked from commit 43a35b26e2fd2fab9c0c3ebac67e3a6c439daef4)

2 years agolibstdc++: Add warnings for some C++23 deprecations
Jonathan Wakely [Wed, 9 Jun 2021 09:11:00 +0000 (10:11 +0100)]
libstdc++: Add warnings for some C++23 deprecations

LWG 3036 deprecates std::pmr::polymorphic_allocator<T>::destroy in
favour of the equivalent member of std::allocator_traits.

LWG 3170 deprecates std::allocator<T>::is_always_equal in favour of
the equivalent member of std::allocator_traits.

This also updates a comment to note that we support the LWG 3541 change
(even before the issue was opened).

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/allocator.h (allocator::is_always_equal): Deprecate.
* include/bits/iterator_concepts.h (indirectly_readable_traits):
Add LWG issue number to comment.
* include/std/memory_resource (polymorphic_allocator::release):
Deprecate.
* testsuite/20_util/allocator/requirements/typedefs.cc: Add
dg-warning for deprecation. Also check std::allocator<void>.

(cherry picked from commit 5bfcfe3087eb05b76395c9efbfc1abbf3f9e1a03)

2 years agolibstdc++: Fix 17_intro/names.cc failures on Solaris
Jonathan Wakely [Tue, 31 Aug 2021 09:25:53 +0000 (10:25 +0100)]
libstdc++: Fix 17_intro/names.cc failures on Solaris

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* testsuite/17_intro/names.cc: Undefine some more names used
by Solaris system headers.

(cherry picked from commit 69b09c5599b201ac039db564c303f7b20d87e0df)

2 years agolibstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]
Jonathan Wakely [Wed, 25 Aug 2021 15:42:49 +0000 (16:42 +0100)]
libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]

This function claims to remove a single character at index p, but it
actually removes p+1 characters beginning at p. So r.erase(0) removes
the first character, but r.erase(1) removes the second and third, and
r.erase(2) removes the second, third and fourth. This is not a useful
API.

The overload is present in the SGI STL <stl_rope.h> header that we
imported, but it isn't documented in the API reference. The erase
overloads that are documented are:

erase(const iterator& p)
erase(const iterator& f, const iterator& l)
erase(size_type i, size_type n);

Having an erase(size_type p) overload that erases a single character (as
the comment says it does) might be useful, but would be inconsistent
with std::basic_string::erase(size_type p = 0, size_type n = npos),
which erases from p to the end of the string when called with a single
argument.

Since the function isn't part of the documented API, doesn't do what it
claims to do (or anything useful) and "fixing" it would leave it
inconsistent with basic_string, I'm just removing that overload.

libstdc++-v3/ChangeLog:

PR libstdc++/102048
* include/ext/rope (rope::erase(size_type)): Remove broken
function.

(cherry picked from commit 2cd229dec8d6716938de5052479d059d306969da)

2 years agolibstdc++: Skip filesystem tests that depend on permissions [PR90787]
Jonathan Wakely [Fri, 20 Aug 2021 13:51:06 +0000 (14:51 +0100)]
libstdc++: Skip filesystem tests that depend on permissions [PR90787]

Tests that depend on filesystem permissions FAIL if run on Windows or as
root. Add a helper function to detect those cases, so the tests can skip
those checks gracefully.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/90787
* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
Use new __gnu_test::permissions_are_testable() function.
* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
Likewise.
* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
* testsuite/27_io/filesystem/operations/remove.cc: Likewise.
* testsuite/27_io/filesystem/operations/remove_all.cc: Likewise.
* testsuite/27_io/filesystem/operations/status.cc: Likewise.
* testsuite/27_io/filesystem/operations/symlink_status.cc:
Likewise.
* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
Likewise.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Likewise.
* testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc:
Likewise.
* testsuite/experimental/filesystem/operations/exists.cc:
Likewise.
* testsuite/experimental/filesystem/operations/is_empty.cc:
Likewise.
* testsuite/experimental/filesystem/operations/remove.cc:
Likewise.
* testsuite/experimental/filesystem/operations/remove_all.cc:
Likewise.
* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
Likewise.
* testsuite/util/testsuite_fs.h (__gnu_test::permissions_are_testable):
New function to guess whether testing permissions will work.

(cherry picked from commit 29b2fd371f18169141e20b90effa7205db68fb11)

2 years agolibstdc++: Add missing std::move to ranges::copy/move/reverse_copy [PR101599]
Patrick Palka [Mon, 2 Aug 2021 19:30:15 +0000 (15:30 -0400)]
libstdc++: Add missing std::move to ranges::copy/move/reverse_copy [PR101599]

In passing, this also renames the template parameter _O2 to _Out2 in
ranges::partition_copy and uglifies two of its function parameters,
out_true and out_false.

PR libstdc++/101599

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__reverse_copy_fn::operator()):
Add missing std::move in return statement.
(__partition_copy_fn::operator()): Rename templtae parameter
_O2 to _Out2.  Uglify function parameters out_true and out_false.
* include/bits/ranges_algobase.h (__copy_or_move): Add missing
std::move to recursive call that unwraps a __normal_iterator
output iterator.
* testsuite/25_algorithms/copy/constrained.cc (test06): New test.
* testsuite/25_algorithms/move/constrained.cc (test05): New test.

(cherry picked from commit 14d8a5ae472ca5743016f37da2dd4770d83dea21)

2 years agolibstdc++: Fix up implementation of LWG 3533 [PR101589]
Patrick Palka [Mon, 2 Aug 2021 19:30:13 +0000 (15:30 -0400)]
libstdc++: Fix up implementation of LWG 3533 [PR101589]

In r12-569 I accidentally applied the LWG 3533 change to
elements_view::iterator::base instead to elements_view::base.

This patch corrects this, and also applies the corresponding LWG 3533
change to lazy_split_view::inner-iter::base now that we implement P2210.

PR libstdc++/101589

libstdc++-v3/ChangeLog:

* include/std/ranges (lazy_split_view::_InnerIter::base): Make
the const& overload unconstrained and return a const reference
as per LWG 3533.  Make unconditionally noexcept.
(elements_view::base): Revert accidental r12-569 change.
(elements_view::_Iterator::base): Make the const& overload
unconstrained and return a const reference as per LWG 3533.
Make unconditionally noexcept.

(cherry picked from commit 4414057186b227edf5b5efa527732bfcdf39d575)

2 years agolibstdc++: Add missing std::move to join_view::iterator ctor [PR101483]
Patrick Palka [Mon, 2 Aug 2021 19:30:10 +0000 (15:30 -0400)]
libstdc++: Add missing std::move to join_view::iterator ctor [PR101483]

PR libstdc++/101483

libstdc++-v3/ChangeLog:

* include/std/ranges (join_view::_Iterator::_Iterator): Add
missing std::move.

(cherry picked from commit 0e1bb3c88c7bd624bc34d6cebe3df9532f1858f0)

2 years agolibstdc++: Define split_view::_InnerIter::base as per P2210
Patrick Palka [Sun, 20 Jun 2021 16:38:35 +0000 (12:38 -0400)]
libstdc++: Define split_view::_InnerIter::base as per P2210

libstdc++-v3/ChangeLog:

* include/std/ranges (split_view::_InnerIter::base): Define as
per P2210.

(cherry picked from commit 85a594f7dc8ea5c765e136f162debb668139ebd4)

2 years agolibstdc++: Implement LWG 3555 changes to transform/elements_view
Patrick Palka [Sat, 19 Jun 2021 00:33:31 +0000 (20:33 -0400)]
libstdc++: Implement LWG 3555 changes to transform/elements_view

libstdc++-v3/ChangeLog:

* include/std/ranges (transform_view::_Iterator::_S_iter_concept):
Consider _Base instead of _Vp as per LWG 3555.
(elements_view::_Iterator::_S_iter_concept): Likewise.

(cherry picked from commit bc046a60cfdd7145fd1e644184ced04d89feb871)

2 years agolibstdc++: Implement LWG 3553 changes to split_view
Patrick Palka [Sat, 19 Jun 2021 00:50:22 +0000 (20:50 -0400)]
libstdc++: Implement LWG 3553 changes to split_view

libstdc++-v3/ChangeLog:

* include/std/ranges (split_view::_OuterIter::value_type::begin):
Remove the non-const overload, and remove the copyable constraint
on the const overload as per LWG 3553.

(cherry picked from commit 15736576df739fdcc5e795961dae30c7b0c87967)

2 years agolibstdc++: Implement LWG 3546 changes to common_iterator
Patrick Palka [Sat, 19 Jun 2021 00:50:13 +0000 (20:50 -0400)]
libstdc++: Implement LWG 3546 changes to common_iterator

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h
(__detail::__common_iter_use_postfix_proxy): Add
move_constructible constraint as per LWG 3546.
(common_iterator::__postfix_proxy): Adjust initializer of
_M_keep as per LWG 3546.

(cherry picked from commit 4123650bd0ae53153142949ab5305eb48ec86390)

2 years agolibstdc++: Implement LWG 3557 change to convertible_to
Patrick Palka [Fri, 18 Jun 2021 15:51:33 +0000 (11:51 -0400)]
libstdc++: Implement LWG 3557 change to convertible_to

libstdc++-v3/ChangeLog:

* include/std/concepts (convertible_to): Just use declval as per
LWG 3557.

(cherry picked from commit 83faf7eacd2081a373afb6069fd923c2dc497271)

2 years agolibstdc++: Move ranges algos used by <ranges> into ranges_util.h
Patrick Palka [Fri, 18 Jun 2021 02:44:41 +0000 (22:44 -0400)]
libstdc++: Move ranges algos used by <ranges> into ranges_util.h

The <ranges> header defines simplified copies of some ranges algorithms
in order to avoid including the entirety of ranges_algo.h.  A subsequent
patch is going to want to use ranges::search in <ranges> as well, and
that algorithm is more complicated compared to the other copied ones.

So rather than additionally copying ranges::search into <ranges>, this
patch splits out all the ranges algos used by <ranges> (including
ranges::search) from ranges_algo.h to ranges_util.h, and deletes the
simplified copies in <ranges>.  This seems like the best place to
put these algorithms, as ranges_util.h is currently included only from
<ranges> and ranges_algo.h.

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__find_fn, find, __find_if_fn)
(find_if, __find_if_not_fn, find_if_not, _in_in_result)
(__mismatch_fn, mismatch, __search_fn, search): Move to ...
* include/bits/ranges_util.h: ... here.
* include/std/ranges (__detail::find, __detail::find_if)
(__detail::find_if_not, __detail::mismatch): Remove.
(filter_view): Use ranges::find_if instead.
(drop_while_view): Use ranges::find_if_not instead.
(split_view): Use ranges::find and ranges::mismatch instead.

(cherry picked from commit 2786064d91f46cbdb35a543a883155a3982b9478)

2 years agolibstdc++: Implement LWG 3490 change to drop_while_view::begin()
Patrick Palka [Fri, 21 May 2021 04:05:18 +0000 (00:05 -0400)]
libstdc++: Implement LWG 3490 change to drop_while_view::begin()

libstdc++-v3/ChangeLog:

PR libstdc++/100606
* include/std/ranges (drop_while_view::begin): Assert the
precondition added by LWG 3490.

(cherry picked from commit 11784fe27d879a10dc8a79212c37f50d4f7146f3)

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

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<.

(cherry picked from commit 727137d6ca6d3d401a0c1b4df6b9aae8b97dacd5)

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.

(cherry picked from commit 7481021364e75ba583972e15ed421a53988368ea)

2 years agolibstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535]
Jonathan Wakely [Tue, 5 Oct 2021 08:32:11 +0000 (09:32 +0100)]
libstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535]

libstdc++-v3/ChangeLog:

PR c++/102535
* testsuite/20_util/is_trivially_constructible/value.cc: Adjust
expected value for C++20.

(cherry picked from commit 7646847df71e57edca5ec5b8c3c3dc4550dcb49d)

2 years agolibstdc++: Move test that depends on wchar_t I/O to wchar_t sub-directory
Jonathan Wakely [Fri, 8 Oct 2021 23:50:04 +0000 (00:50 +0100)]
libstdc++: Move test that depends on wchar_t I/O to wchar_t sub-directory

This fixes a FAIL when --disable-wchar_t is used.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/close/81256.cc: Moved to...
* testsuite/27_io/basic_filebuf/close/wchar_t/81256.cc: ...here.

(cherry picked from commit cfeff094e6410844d2324193610cb7a512d67713)

2 years agolibstdc++: Ensure std::span and std::string_view are trivially copyable (P2251R1)
Jonathan Wakely [Tue, 5 Oct 2021 15:38:42 +0000 (16:38 +0100)]
libstdc++: Ensure std::span and std::string_view are trivially copyable (P2251R1)

The recently approved P2251R1 paper requires these types to be trivially
copyable. They always have been in libstdc++, but add tests to check it.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string_view/requirements/trivially_copyable.cc:
New test.
* testsuite/23_containers/span/trivially_copyable.cc: New test.

(cherry picked from commit 1f51e9af7b615838424214e6aaea0de793cb10fe)

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.

(cherry picked from commit 45ba5426c129993704a73e6ace4016eaa950d7ee)

2 years agolibstdc++: Fix move construction of std::tuple with array elements [PR101960]
Jonathan Wakely [Thu, 19 Aug 2021 10:48:40 +0000 (11:48 +0100)]
libstdc++: Fix move construction of std::tuple with array elements [PR101960]

An array member cannot be direct-initialized in a ctor-initializer-list,
so use the base class' move constructor, which does the right thing for
both arrays and non-arrays.

This constructor could be defaulted, but that would make it trivial for
some specializations, which would change the argument passing ABI. Do
that for the versioned namespace only.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/101960
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Use base
class' move constructor. Define as defaulted for versioned
namespace.
* testsuite/20_util/tuple/cons/101960.cc: New test.

(cherry picked from commit 0187e0d7360f327f88d8b2294668669306ae4630)

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