Commit Graph

185328 Commits

Author SHA1 Message Date
Jakub Jelinek
5d3a05456d 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 424945258d)
2021-10-20 08:46:05 +02:00
GCC Administrator
2b4adfe47f Daily bump. 2021-10-20 00:18:20 +00:00
Jonathan Wakely
e8dd7ce5d2 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 04d392e843)
2021-10-19 16:40:48 +01:00
Tobias Burnus
3de82c6c36 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 017665f630)
2021-10-19 10:42:05 +02:00
GCC Administrator
164044da34 Daily bump. 2021-10-19 00:18:06 +00:00
Uros Bizjak
e9c3a7243b 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.
2021-10-18 23:01:33 +02:00
Kito Cheng
aa827fa170 [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 4e5bc4e450)
2021-10-19 00:04:57 +08:00
Jakub Jelinek
2e6c780e1e 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 4764049dd6)
2021-10-18 17:40:22 +02:00
Andrew Stubbs
cc84160c5f 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 f3d64372d7)
2021-10-18 08:10:44 +02:00
Andrew Stubbs
23ced2dc83 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 81c362c7c2)
2021-10-18 08:10:44 +02:00
Andrew Stubbs
9120e8c402 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 205dafb6ed)
2021-10-18 08:10:44 +02:00
Andrew Stubbs
0eb56ebc05 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 6ca03ca35a)
2021-10-18 08:10:44 +02:00
Julian Brown
5b85107d3c 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 5c127c4cac)
2021-10-18 08:10:44 +02:00
Andrew Stubbs
92aed72a73 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.
2021-10-18 08:10:44 +02:00
Andrew Stubbs
9552afb2ae 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 aad32a00b7)
2021-10-18 08:10:44 +02:00
Marcel Vollweiler
e85d6ef1c4 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 cfa1f8226f)
2021-10-18 08:10:43 +02:00
GCC Administrator
64b2bd684f Daily bump. 2021-10-18 00:18:01 +00:00
Harald Anlauf
d97dbf60dd 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 1b115daf62)
2021-10-17 20:55:26 +02:00
GCC Administrator
e08da31310 Daily bump. 2021-10-17 00:17:54 +00:00
GCC Administrator
1b44508321 Daily bump. 2021-10-16 00:17:58 +00:00
John David Anglin
92a12b93ed 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.
2021-10-15 14:51:22 +00:00
GCC Administrator
6a936be4ad Daily bump. 2021-10-15 00:18:36 +00:00
Vladimir N. Makarov
99d21577f8 [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.
2021-10-14 12:10:58 -04:00
Jonathan Wakely
3bf56cdf5e 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 8ed6cfbbee)
2021-10-14 09:01:03 +01:00
John David Anglin
b4c0226e7b 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.
2021-10-14 00:58:33 +00:00
GCC Administrator
f3c81b3acf Daily bump. 2021-10-14 00:18:17 +00:00
Jonathan Wakely
c706d5c3b8 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 ce55693604)
2021-10-14 00:36:48 +01:00
Jonathan Wakely
9ef31bab15 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 85b24e32dc)
2021-10-13 21:54:20 +01:00
Jonathan Wakely
3eac45a2a1 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 f9c2ce1dae)
2021-10-13 21:54:20 +01:00
Iain Sandoe
8b333df948 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 743b8dd6fd)
2021-10-13 20:59:03 +01:00
John David Anglin
b707ac10d5 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.
2021-10-13 15:45:39 +00:00
Patrick Palka
cb261f0e8f 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 d91e7eab3a)
2021-10-13 09:32:37 -04:00
Iain Sandoe
28f91cc71b 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 e24760533b)
2021-10-13 10:02:04 +01:00
GCC Administrator
5f88afa1a2 Daily bump. 2021-10-13 00:18:09 +00:00
Jonathan Wakely
6d51766a55 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 48b20d46f9)
2021-10-12 20:40:38 +01:00
Jonathan Wakely
b7e73951fd 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.
2021-10-12 20:40:37 +01:00
Jonathan Wakely
10c0df1048 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 89ec3b67db)
2021-10-12 20:40:37 +01:00
Jonathan Wakely
573c2ffd3c 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 f8f0193b5b)
2021-10-12 20:40:37 +01:00
Jonathan Wakely
4407f0d739 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 e3b6d3a887)
2021-10-12 20:40:37 +01:00
Jonathan Wakely
496f712946 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 43a35b26e2)
2021-10-12 20:40:37 +01:00
Jonathan Wakely
bf0c732dd5 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 5bfcfe3087)
2021-10-12 20:40:37 +01:00
Jonathan Wakely
f8e3747891 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 69b09c5599)
2021-10-12 20:40:36 +01:00
Jonathan Wakely
a1dc688940 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 2cd229dec8)
2021-10-12 20:40:36 +01:00
Jonathan Wakely
cec047eaeb 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 29b2fd371f)
2021-10-12 20:40:36 +01:00
Patrick Palka
e22db02874 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 14d8a5ae47)
2021-10-12 13:56:15 -04:00
Patrick Palka
d187dfbd03 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 4414057186)
2021-10-12 13:55:05 -04:00
Patrick Palka
58873a5658 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 0e1bb3c88c)
2021-10-12 13:54:16 -04:00
Patrick Palka
565602a23a 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 85a594f7dc)
2021-10-12 13:52:21 -04:00
Patrick Palka
f6c5489475 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 bc046a60cf)
2021-10-12 13:51:51 -04:00
Patrick Palka
01e1cadac2 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 15736576df)
2021-10-12 13:51:31 -04:00