Commit Graph

188384 Commits

Author SHA1 Message Date
Aldy Hernandez 257fd0333f Add gimple_ranger::debug.
I'm trying to add one debug() for each dump() to the dumping aids.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range.cc (gimple_ranger::debug): New.
	* gimple-range.h (class gimple_ranger): Add debug.
2021-09-30 08:08:50 +02:00
Aldy Hernandez 64dd46dbc6 Plug memory leak in hybrid_threader.
Tested on x86-64 Linux.

gcc/ChangeLog:

	PR middle-end/102519
	* tree-vrp.c (hybrid_threader::~hybrid_threader): Free m_query.
2021-09-30 08:08:50 +02:00
GCC Administrator d238146e41 Daily bump. 2021-09-30 00:16:20 +00:00
Indu Bhagat d6a87d96d7 debug/102507: ICE in btf_finalize when compiling with -gbtf
Fix the free up of btf_var_ids hash_map in btf_finalize ().

gcc/ChangeLog:

	PR debug/102507
	* btfout.c (GTY): Add GTY (()) albeit for cosmetic only purpose.
	(btf_finalize): Empty the hash_map btf_var_ids.
2021-09-29 13:27:19 -07:00
Jonathan Wakely cd5448f6c5 MAINTAINERS: Add myself to DCO section
ChangeLog:

	* MAINTAINERS: Add myself to DCO section.
2021-09-29 21:02:30 +01:00
Aldy Hernandez 24e30f485b [PR102501] Adjust jump threading testcases for ppc64* and others.
I really don't know what to do here.  This is a bit of whack-o-mole.
The IL is sufficiently different for various architectures that any
tweak can cause the number of jump threads to vary.

For the pr7745-2.c testcase, we have less threading candidates because 2
of them now cross loop boundaries.  Interestingly, this test matches
"Jumps threaded", not threads registered, so the block copier can
drop threads at copying time adding further confusion.

For example, we can register N threads, but the old copier can cancel
N-M threads while updating the CFG for a variety of different reasons
(removed edges, threading through loop exits, etc).  This makes the
"Registering jump threads" not to match the total number of threads this
test checks for with "Jumps threaded".

The pr66752-3.c test OTOH, is just a matter of thread4 eliminating the
"if".  I had erroneously thought it would always be eliminated by
thread3, but we really don't care where it gets cleaned up.  All we know
is that DCE can't depend on the early threaders doing this work, because
it may cross loop boundaries.  I've chosen thread4 arbitrarily, but we
could just as easily pick the ".optimized" dump.

Sorry, I'm really at my wits end here.  I don't see any clean path
forward, except rewrite these tests as gimple IL.  They're close to useless
as they sit.

gcc/testsuite/ChangeLog:

	PR testsuite/102501
	* gcc.dg/tree-ssa/pr66752-3.c: Adjust.
	* gcc.dg/tree-ssa/pr77445-2.c: Adjust.
2021-09-29 20:27:53 +02:00
Aldy Hernandez 77731cb8f3 Avoid CFG updates in VRP threader if nothing changed.
There is no need to update the CFG or SSAs if nothing has changed in VRP
threading.

gcc/ChangeLog:

	* tree-vrp.c (thread_through_all_blocks): Return bool.
	(execute_vrp_threader): Return TODO_* flags.
	(pass_data_vrp_threader): Set todo_flags_finish to 0.
2021-09-29 20:27:53 +02:00
Aldy Hernandez 48c97c62c9 Use a separate TV_* timer for the VRP threader.
There seems to be a memory consumption issue on 32 bit hosts after the
hybrid threader patchset.  I'm having a hard time reproducing, and in
the process I've noticed that the threader is using the TV_TREE_VRP
timer.  Having a distinct one could help diagnose this and other
issues going forward.

gcc/ChangeLog:

	* timevar.def (TV_TREE_VRP_THREADER): New.
	* tree-vrp.c: Use TV_TREE_VRP_THREADER for VRP threader pass.
2021-09-29 20:27:52 +02:00
Harald Anlauf 5e2adfeed2 Fortran: fix error recovery for invalid constructor
gcc/fortran/ChangeLog:

	PR fortran/102520
	* array.c (expand_constructor): Do not dereference NULL pointer.

gcc/testsuite/ChangeLog:

	PR fortran/102520
	* gfortran.dg/pr102520.f90: New test.
2021-09-29 20:11:53 +02:00
David Faust a672a22582 bpf: correct extra_headers
The BPF CO-RE support (commit 8bdabb3754)
mistakenly overwrote bpf-*-* extra_headers in config.gcc, causing
bpf-helpers.h to not be installed. The redefinition with coreout.h is
unneeded, so delete it.

gcc/ChangeLog:

	* config.gcc (bpf-*-*): Do not overwrite extra_headers.
2021-09-29 10:47:42 -07:00
Jeff Law 86304da55f Fix more testsuite fallout from computed goto changes
gcc/testsuite
	* gcc.c-torture/compile/920831-1.c: Fix computed goto types.
	* gcc.c-torture/compile/pr27863.c: Likewise.
2021-09-29 11:21:42 -04:00
Jonathan Wright 3caf7f87b1 aarch64: Fix type qualifiers for qtbl1 and qtbx1 Neon builtins
Fix type qualifiers for qtbl1 and qtbx1 Neon builtins and remove
casts from the Neon intrinsic function bodies that use these
builtins.

gcc/ChangeLog:

2021-09-23  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-builtins.c (TYPES_BINOP_PPU): Define
	new type qualifier enum.
	(TYPES_TERNOP_SSSU): Likewise.
	(TYPES_TERNOP_PPPU): Likewise.
	* config/aarch64/aarch64-simd-builtins.def: Define PPU, SSU,
	PPPU and SSSU builtin generator macros for qtbl1 and qtbx1
	Neon builtins.
	* config/aarch64/arm_neon.h (vqtbl1_p8): Use type-qualified
	builtin and remove casts.
	(vqtbl1_s8): Likewise.
	(vqtbl1q_p8): Likewise.
	(vqtbl1q_s8): Likewise.
	(vqtbx1_s8): Likewise.
	(vqtbx1_p8): Likewise.
	(vqtbx1q_s8): Likewise.
	(vqtbx1q_p8): Likewise.
	(vtbl1_p8): Likewise.
	(vtbl2_p8): Likewise.
	(vtbx2_p8): Likewise.
2021-09-29 15:29:39 +01:00
Jonathan Wakely f38cd3bdb4 libstdc++: Implement std::regex_constants::multiline (LWG 2503)
This implements LWG 2503, which allows ^ and $ to match line terminator
characters, rather than only matching the beginning and end of the
entire input. The multiline option is only valid for ECMAScript, but
for other grammars we ignore it rather than throwing an exception.

This is related to PR libstdc++/102480, which incorrectly said that
ECMAscript should match the beginning of a line when match_prev_avail
is used. I think that's only supposed to happen when multiline is used.

The new regex_constants::multiline and basic_regex::multiline constants
are not defined for strict -std=c++11 and -std=c++14 modes, but
regex_constants::__multiline is always defined, so that the
implementation can use it internally.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (basic_regex::multiline): Define constant
	for C++17.
	* include/bits/regex_constants.h (regex_constants::multiline):
	Define constant for C++17.
	(regex_constants::__multiline): Define duplicate constant for
	internal use in C++11 and C++14.
	* include/bits/regex_executor.h (_Executor::_M_match_multiline()):
	New member function.
	(_Executor::_M_is_line_terminator(_CharT)): New member function.
	(_Executor::_M_at_begin(), _Executor::_M_at_end()): Use new
	member functions to support multiline matches.
	* testsuite/28_regex/algorithms/regex_match/multiline.cc: New test.
2021-09-29 13:48:19 +01:00
Jonathan Wakely 9ca4c42a3b libstdc++: Check for invalid syntax_option_type values in <regex>
The standard says that it is invalid for more than one grammar element
to be set in a value of type regex_constants::syntax_option_type. This
adds a check in the regex compiler andthrows an exception if an invalid
value is used.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex_compiler.h (_Compiler::_S_validate): New
	function.
	* include/bits/regex_compiler.tcc (_Compiler::_Compiler): Use
	_S_validate to check flags.
	* include/bits/regex_error.h (_S_grammar): New error code for
	internal use.
	* testsuite/28_regex/basic_regex/ctors/grammar.cc: New test.
2021-09-29 13:48:15 +01:00
Jonathan Wakely b701e1f8f6 libstdc++: std::basic_regex should treat '\0' as an ordinary char [PR84110]
When the input sequence contains a _CharT(0) character, the strchr call
in _Scanner<_CharT>::_M_scan_normal() will search for '\0' and so return
a pointer to the terminating null at the end of the string. This makes
the scanner think it's found a special character. Because it doesn't
match any of the actual special characters, we fall off the end of the
function (or assert in debug mode).

We should check for a null character explicitly and either treat it as
an ordinary character (for the ECMAScript grammar) or an error (for all
others). I'm not 100% sure that's right, but it seems consistent with
the POSIX RE rules where a '\0' means the end of the regex pattern or
the end of the sequence being matched.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/84110
	* include/bits/regex_error.h (regex_constants::_S_null): New
	error code for internal use.
	* include/bits/regex_scanner.tcc (_Scanner::_M_scan_normal()):
	Check for null character.
	* testsuite/28_regex/basic_regex/84110.cc: New test.
2021-09-29 13:48:11 +01:00
Jonathan Wakely b59be1adba libstdc++: Simplify std::basic_regex construction and assignment
Introduce a new _M_compile function which does the common work needed by
all constructors and assignment. Call that directly to avoid multiple
levels of constructor delegation or calls to basic_regex::assign
overloads.

For assignment, there is no need to construct a std::basic_string if we
already have a contiguous sequence of the correct character type, and no
need to construct a temporary basic_regex when assigning from an
existing basic_regex.

Also define the copy and move assignment operators as defaulted, which
does the right thing without constructing a temporary and swapping it.
Copying or moving the shared_ptr member cannot fail, so they can be
noexcept. The assign(const basic_regex&) and assign(basic_regex&&)
member can then be defined in terms of copy or move assignment.

The new _M_compile function takes pointer arguments, so the caller has
to convert arbitrary iterator ranges into a contiguous sequence of
characters. With that simplification, the __compile_nfa helpers are not
needed and can be removed.

This also fixes a bug where construction from a contiguous sequence with
the wrong character type would fail to compile, rather than converting
the elements to the regex character type.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (__detail::__is_contiguous_iter): Move
	here from <bits/regex_compiler.h>.
	(basic_regex::_M_compile): New function to compile an NFA from
	a regular expression string.
	(basic_regex::basic_regex): Use _M_compile instead of delegating
	to other constructors.
	(basic_regex::operator=(const basic_regex&)): Define as
	defaulted.
	(basic_regex::operator=(initializer_list<C>)): Use _M_compile.
	(basic_regex::assign(const basic_regex&)): Use copy assignment.
	(basic_regex::assign(basic_regex&&)): Use move assignment.
	(basic_regex::assign(const C*, flag_type)): Use _M_compile
	instead of constructing a temporary string.
	(basic_regex::assign(const C*, size_t, flag_type)): Likewise.
	(basic_regex::assign(const basic_string<C,T,A>&, flag_type)):
	Use _M_compile instead of constructing a temporary basic_regex.
	(basic_regex::assign(InputIter, InputIter, flag_type)): Avoid
	constructing a temporary string for contiguous iterators of the
	right value type.
	* include/bits/regex_compiler.h (__is_contiguous_iter): Move to
	<bits/regex.h>.
	(__enable_if_contiguous_iter, __disable_if_contiguous_iter)
	(__compile_nfa): Remove.
	* testsuite/28_regex/basic_regex/assign/exception_safety.cc: New
	test.
	* testsuite/28_regex/basic_regex/ctors/char/other.cc: New test.
2021-09-29 13:48:02 +01:00
Richard Biener b34fa88bec testsuite/102517 - fix FAIL of gcc.dg/pr78408-1.c with OImode availability
This fixes the testcase which looks for variants of memcpy after
memset folding which is disturbed when we expand the memcpy inline
earlier which in fact performs the desired optimization but makes
the dump file not match.  For the ease of testing the following
adjusts the smaller structure size to be no longer power-of-two
which avoids the inline expansion.

2021-09-29  Richard Biener  <rguenther@suse.de>

	PR testsuite/102517
	* gcc.dg/pr78408-1.c: Make S not power-of-two size.
2021-09-29 14:35:13 +02:00
Richard Biener 4c77310816 Fix peeling for alignment with negative step
The following fixes a regression causing us to no longer peel
negative step loops for alignment.  With dr_misalignment now
applying the bias for negative step we have to do the reverse
when adjusting the misalignment for peeled DRs.

2021-09-29  Richard Biener  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_dr_misalign_for_aligned_access):
	New helper.
	(vect_update_misalignment_for_peel): Use it to update
	misaligned to the value necessary for an aligned access.
	(vect_get_peeling_costs_all_drs): Likewise.
	(vect_enhance_data_refs_alignment): Likewise.

	* gcc.target/i386/vect-alignment-peeling-1.c: New testcase.
	* gcc.target/i386/vect-alignment-peeling-2.c: Likewise.
2021-09-29 13:46:39 +02:00
Kyrylo Tkachov a459ee44c0 aarch64: Improve size heuristic for cpymem expansion
Similar to my previous patch for setmem this one does the same for the cpymem expansion.
We count the number of ops emitted and compare it against the alternative of just calling
the library function when optimising for size.
For the code:
void
cpy_127 (char *out, char *in)
{
  __builtin_memcpy (out, in, 127);
}

void
cpy_128 (char *out, char *in)
{
  __builtin_memcpy (out, in, 128);
}

we now emit a call to memcpy (with an extra MOV-immediate instruction for the size) instead of:
cpy_127(char*, char*):
        ldp     q0, q1, [x1]
        stp     q0, q1, [x0]
        ldp     q0, q1, [x1, 32]
        stp     q0, q1, [x0, 32]
        ldp     q0, q1, [x1, 64]
        stp     q0, q1, [x0, 64]
        ldr     q0, [x1, 96]
        str     q0, [x0, 96]
        ldr     q0, [x1, 111]
        str     q0, [x0, 111]
        ret
cpy_128(char*, char*):
        ldp     q0, q1, [x1]
        stp     q0, q1, [x0]
        ldp     q0, q1, [x1, 32]
        stp     q0, q1, [x0, 32]
        ldp     q0, q1, [x1, 64]
        stp     q0, q1, [x0, 64]
        ldp     q0, q1, [x1, 96]
        stp     q0, q1, [x0, 96]
        ret

which is a clear code size win. Speed optimisation heuristics remain unchanged.

2021-09-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/aarch64.c (aarch64_expand_cpymem): Count number of
	emitted operations and adjust heuristic for code size.

2021-09-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gcc.target/aarch64/cpymem-size.c: New test.
2021-09-29 11:21:45 +01:00
Kyrylo Tkachov 8f95e3c04d aarch64: Improve size optimisation heuristic for setmem expansion
This patch adjusts the setmem expansion in the backend to track the number of ops it generates
for the DUP + STR/STP inline sequences. This way we can compare the size/complexity of the sequence
against alternatives, notably just returning "false" and thus just emitting a call to memset.

The simple heuristic change here is that if we were going to emit more than 4 operations then
we shouldn't bother and just call memset. The number 4 is chosen because in the worst case for memset
we need to emit 4 instructions: 3 to move the arguments into the right registers and 1 for the call.

The speed optimisation decisions are not affected, though I do want to extend these expansions in a later
patch and I'd like to reuse this ops counting logic there. In any case this patch should make sense on its own.

For the code:
void __attribute__((__noinline__))
set127byte (int64_t *src, int c)
{
  __builtin_memset (src, c, 127);
}

void __attribute__((__noinline__))
set128byte (int64_t *src, int c)
{
  __builtin_memset (src, c, 128);
}

when optimising for size we now get just an immediate move + a call to memset (2 instructions) where before we'd have generated:
set127byte(long*, int):
        dup     v0.16b, w1
        str     q0, [x0, 96]
        stp     q0, q0, [x0]
        stp     q0, q0, [x0, 32]
        stp     q0, q0, [x0, 64]
        str     q0, [x0, 111]
        ret
set128byte(long*, int):
        dup     v0.16b, w1
        stp     q0, q0, [x0]
        stp     q0, q0, [x0, 32]
        stp     q0, q0, [x0, 64]
        stp     q0, q0, [x0, 96]
        ret

which is clearly undesirable for -Os.

I've adjusted the recently-added gcc.target/aarch64/memset-strict-align-1.c testcase to use a bigger struct
and switch to speed optimisation as with this patch we'll just call memset rather than expanding inline.
That is the right decision for size optimisation (the resulting code is indeed shorter).
With -O2 and the new struct size we still try the SIMD expansion and still trigger the path that the testcase is supposed to exercise.

2021-09-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/aarch64.c (aarch64_expand_setmem): Count number of
	emitted operations and adjust heuristic for code size.

2021-09-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gcc.target/aarch64/memset-corner-cases-2.c: New test.
	* gcc.target/aarch64/memset-strict-align-1.c: Adjust.
2021-09-29 11:00:14 +01:00
Jakub Jelinek d3e7bb15e2 openmp: Disallow reduction with var private in containing parallel even on scope [PR102504]
The standard has a restriction:
"A list item that appears in a reduction clause of a scope construct must be
shared in the parallel region to which a corresponding scope region binds."
similar to the restriction for worksharing constructs, but we were checking
it only on worksharing constructs and not for scope and ICEd later on during
omp expansion.

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

	PR middle-end/102504
	* gimplify.c (gimplify_scan_omp_clauses): Use omp_check_private even
	in OMP_SCOPE clauses, not just on worksharing construct clauses.

	* c-c++-common/gomp/scope-4.c: New test.
2021-09-29 10:17:52 +02:00
Andrew Pinski c6dbe7a56d Fix some testcases after my computed goto patch
For some reason I did not see these failures in my testing.
Sorry about that.  Anyways this fixes the testcases by
adding a cast to __INTPTR_TYPE__ and then a cast to void*.

Committed after testing them on x86_64-linux-gnu.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/compile/920826-1.c: Fix computed goto.
	* gcc.c-torture/compile/pr27863.c: Likewise.
	* gcc.c-torture/compile/pr70190.c: Likewise.
	* gcc.dg/torture/pr89135.c: Likewise.
	* gcc.dg/torture/pr90071.c: Likewise.
	* gcc.dg/vect/bb-slp-pr97709.c: Likewise.
2021-09-29 08:04:15 +00:00
Richard Biener 2da5ec9851 Avoid memcpy inline expansion in gcc.dg/out-of-bounds-1.c
This avoids inline expansion to preserve the warning by making
the memcpy size a non-power-of-two as suggested by Martin Sebor.

2021-09-29  Richard Biener  <rguenther@suse.de>

	* gcc.dg/out-of-bounds-1.c: Make memcpied size not power-of-two.
2021-09-29 08:07:42 +02:00
GCC Administrator fd1334791e Daily bump. 2021-09-29 00:16:26 +00:00
Geng Qi 68c081bb43 RISC-V: Pattern name fix mul*3_highpart -> smul*3_highpart.
No known code changes, just fixes an inconsistency that was noticed.

	gcc/
	* config/riscv/riscv.md	(mulv<mode>4): Call gen_smul<mode>3_highpart.
	(<u>mulditi3): Call <su>muldi3_highpart.
	(<u>muldi3_highpart): Rename to <su>muldi3_highpart.
	(<u>mulsidi3): Call <su>mulsi3_highpart.
	(<u>mulsi3_highpart): Rename to <su>mulsi3_highpart.
2021-09-28 16:31:49 -07:00
Patrick Palka daa762f01d c++: ttp matching with constrained auto parm [PR99909]
Here, when unifying TT with S, processing_template_decl is unset, and
this foils the dependence checks in do_auto_deduction for avoiding
checking constraints on an auto when the initializer is dependent.

This patch fixes this by making sure processing_template_decl is set
around the call to unify from coerce_template_template_parms; this seems
sensible because we're unifying one set of template parameters with
another, so we're dealing with templated trees throughout.

	PR c++/99909

gcc/cp/ChangeLog:

	* pt.c (coerce_template_template_parms): Keep
	processing_template_decl set around the call to unify as well.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-ttp3.C: New test.
2021-09-28 17:26:20 -04:00
Jonathan Wakely 2fcfc7d668 libstdc++: Fix return values for atomic wait on futex
This fixes a logic error in the futex-based timed wait.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/atomic_timed_wait.h (__platform_wait_until_impl):
	Return false for ETIMEDOUT and true otherwise.
2021-09-28 21:27:04 +01:00
François Dumont 26c09ae12d libstdc++: Fix 48631_neg test in _GLIBCXX_INLINE_VERSION mode
libstdc++-v3/ChangeLog:

	* testsuite/20_util/default_delete/48631_neg.cc: Adapt dg-prune-output message
	to also match message with '__8' in it.
2021-09-28 22:09:48 +02:00
Andrew Pinski e12f66d96f c: [PR32122] Require pointer types for computed gotos
So GCC has always accepted non-pointer types in computed gotos but
that was wrong based on the documentation:
Any expression of type void * is allowed.

So this fixes the problem by requiring the type to
be a pointer type.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

	PR c/32122

gcc/c/ChangeLog:

	* c-parser.c (c_parser_statement_after_labels): Pass
	the c_expr instead of the tree to c_finish_goto_ptr.
	* c-typeck.c (c_finish_goto_ptr): Change the second
	argument type to c_expr.
	* c-tree.h (c_finish_goto_ptr): Likewise.
	Error out if the expression was not of a pointer type.

gcc/testsuite/ChangeLog:

	* gcc.dg/comp-goto-5.c: New test.
	* gcc.dg/comp-goto-6.c: New test.
2021-09-28 20:01:14 +00:00
Jonathan Wakely c44c5f3d9f libstdc++: Remove obfuscating typedefs in <regex>
There is no benefit to using _SizeT instead of size_t, and IterT tells
you less about the type than const _CharT*. This removes some unhelpful
typedefs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex_automaton.h (_NFA_base::_SizeT): Remove.
	* include/bits/regex_compiler.h (_Compiler::_IterT): Remove.
	* include/bits/regex_compiler.tcc: Likewise.
	* include/bits/regex_scanner.h (_Scanner::_IterT): Remove.
	* include/bits/regex_scanner.tcc: Likewise.
2021-09-28 20:38:58 +01:00
Jonathan Wakely b5f276b8c7 libstdc++: Tweaks to <regex> to avoid warnings
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex_compiler.tcc: Add line break in empty while
	statement.
	* include/bits/regex_executor.tcc: Avoid unused parameter
	warning.
2021-09-28 20:38:58 +01:00
Jonathan Wakely df0dd04b78 libstdc++: Add noexcept to functions in <regex>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (basic_regex, swap): Add noexcept to
	non-throwing functions.
	* include/bits/regex_automaton.h (_State_base, _State)
	(_NFA_base): Likewise.
	* include/bits/regex_compiler.h (_Compiler): Likewise.
	* include/bits/regex_error.h (regex_error::code()): Likewise.
	* include/bits/regex_scanner.h (_Scanner): Likewise.
2021-09-28 20:38:57 +01:00
Jonathan Wakely aeaea265ce libstdc++: Define macro before it is first checked
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
	Define before first attempt to check it.
2021-09-28 20:30:59 +01:00
Iain Sandoe bec11673c4 Darwin, D : Add .d suffix to the list for invoking dsymutil.
Recognise .d for D source files on the command line.  This will
trigger an invocation of dsymutil when a D source is present.

gcc/ChangeLog:

	* config/darwin.h (DSYMUTIL_SPEC): Recognize D sources.
2021-09-28 20:29:21 +01:00
Jonathan Wakely 07fbdd7bda libstdc++: Skip container adaptor tests that fail concept checks
As an extension, our container adaptors SFINAE away the default
constructor if the adapted sequence container is not default
constructible. When _GLIBCXX_CONCEPT_CHECKS is defined we enforce that
the sequence is default constructible, so the tests for the extension
fail. This disables the relevant parts of the tests.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc:
	Do not check non-default constructible sequences when
	_GLIBCXX_CONCEPT_CHECKS is defined.
	* testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely b701f46ea6 libstdc++: Skip tests that fail with _GLIBCXX_CONCEPT_CHECKS
The extension that allows implicitly rebinding a container's allocator
is not allowed when _GLIBCXX_CONCEPT_CHECKS is defined, so skip the
tests for that extension.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/deque/requirements/explicit_instantiation/3.cc:
	Do not test implicit allocator rebinding when _GLIBCXX_CONCEPT_CHECKS
	is defined.
	* testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc:
	Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely afffc96a52 libstdc++: Fix concept checks for iterators
This adds some additional checks the the C++98-style concept checks for
iterators, and removes some bogus checks for mutable iterators. Instead
of requiring that the result of dereferencing a mutable iterator is
assignable (which is a property of the value type, not required for the
iterator) check that the reference type is a non-const reference to the
value type.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/boost_concept_check.h (_ForwardIteratorConcept)
	(_BidirectionalIteratorConcept, _RandomAccessIteratorConcept):
	Check result types of iterator operations.
	(_Mutable_ForwardIteratorConcept): Check that iterator's
	reference type is a reference to its value type.
	(_Mutable_BidirectionalIteratorConcept): Do not require the
	value type to be assignable.
	(_Mutable_RandomAccessIteratorConcept): Likewise.
	* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error
	line number.
2021-09-28 20:22:51 +01:00
Jonathan Wakely 5f1db7627f libstdc++: Improve types used as iterators in testsuite
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/25_algorithms/copy/34595.cc: Add missing operation
	for type used as an iterator.
	* testsuite/25_algorithms/unique_copy/check_type.cc: Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely 4000d722e6 libstdc++: Fix tests that use invalid types in ordered containers
Types used in ordered containers need to be comparable, or the container
needs to use a custom comparison function. These tests fail when
_GLIBCXX_CONCEPT_CHECKS is defined, because the element types aren't
comparable.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_nothrow_swappable/value.h: Use custom
	comparison function for priority_queue of type with no
	relational operators.
	* testsuite/20_util/is_swappable/value.h: Likewise.
	* testsuite/24_iterators/output/concept.cc: Add operator< to
	type used in set.
2021-09-28 20:22:51 +01:00
Jonathan Wakely 45a8cd2569 libstdc++: Fix _OutputIteratorConcept checks in algorithms
The _OutputIteratorConcept should be checked using the correct value
category. The std::move_backward and std::copy_backward algorithms
should use _OutputIteratorConcept instead of _ConvertibleConcept.

In order to use the correct value category, the concept should use a
function that returns _ValueT instead of using an lvalue data member.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/boost_concept_check.h (_OutputIteratorConcept):
	Use a function to preserve value category of the type.
	* include/bits/stl_algobase.h (copy, move, fill_n): Use a
	reference as the second argument for _OutputIteratorConcept.
	(copy_backward, move_backward): Use _OutputIteratorConcept
	instead of _ConvertibleConcept.
2021-09-28 20:22:50 +01:00
Jonathan Wakely 82626be2d6 libstdc++: Specialize std::pointer_traits<__normal_iterator<I,C>>
This allows std::__to_address to be used with __normal_iterator in
C++11/14/17 modes. Without the partial specialization the deduced
pointer_traits::element_type is incorrect, and so the return type of
__to_address is wrong.

A similar partial specialization is probably needed for
__gnu_debug::_Safe_iterator.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (pointer_traits): Define partial
	specialization for __normal_iterator.
	* testsuite/24_iterators/normal_iterator/to_address.cc: New test.
2021-09-28 20:22:50 +01:00
Iain Sandoe b12d6e7989 Darwin, PPC : Fix R13 for PPC64.
We have a somewhat unusual situation in that for PPC64, R13 is
both reserved and callee-saved (it is used internally by the
pthreads implementation to contain pthread_self).

So add R13 to the fixed regs, but also keep it in the callee-
saved set.

gcc/ChangeLog:

	* config/rs6000/darwin.h (FIXED_R13): Add for PPC64.
	(FIRST_SAVED_GP_REGNO): Save from R13 even when it is one
	of the fixed regs.
2021-09-28 20:16:05 +01:00
Iain Sandoe 45f775f5f8 libgcc, X86, Darwin: Export cpu_model and indicator.
These two symbols have been emitted since 4.8, but were not added
to the Darwin exports, so we have been using the ones from libgcc.a.

Added to libgcc_s now.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/libgcc-darwin.ver: Add Symbols for
	__cpu_model, __cpu_indicator_init.
2021-09-28 20:02:48 +01:00
Iain Sandoe fae627162d coroutines: Only set parm copy guard vars if we have exceptions [PR 102454].
For coroutines, we make copies of the original function arguments into
the coroutine frame.  Normally, these are destroyed on the proper exit
from the coroutine when the frame is destroyed.

However, if an exception is thrown before the first suspend point is
reached, the cleanup has to happen in the ramp function.  These cleanups
are guarded such that they are only applied to any param copies actually
made.

The ICE is caused by an attempt to set the guard variable when there are
no exceptions enabled (the guard var is not created in this case).

Fixed by checking for flag_exceptions in this case too.

While touching this code paths, also clean up the synthetic names used
when a function parm is unnamed.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR c++/102454

gcc/cp/ChangeLog:

	* coroutines.cc (analyze_fn_parms): Clean up synthetic names for
	unnamed function params.
	(morph_fn_to_coro): Do not try to set a guard variable for param
	DTORs in the ramp, unless we have exceptions active.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr102454.C: New test.
2021-09-28 19:53:59 +01:00
Jonathan Wakely a11052d98d libstdc++: Improve std::forward static assert message
The previous message told you something was wrong, but not why it
happened or why it's bad. This changes it to explain that the function
is being misused.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/move.h (forward(remove_reference_t<T>&&)):
	Improve text of static_assert.
	* testsuite/20_util/forward/c_neg.cc: Adjust dg-error.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
2021-09-28 17:30:05 +01:00
Jonathan Wakely f2b7f56a15 libstdc++: Fix mismatched noexcept-specifiers in filesystem::path [PR102499]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102499
	* include/bits/fs_path.h (path::begin, path::end): Add noexcept
	to declarations, to match definitions.
2021-09-28 17:30:05 +01:00
Kyrylo Tkachov e159c0aa10 aarch64: Add command-line support for Armv8.7-a
This patch adds support for -march=armv8.7-a in GCC.
It adds the +ls64 extension that's included in this architecture revision.
Currently this is just the command-line option and +ls64 allows the relevant instructions
to be used in inline assembly. The ACLE defines some intrinsics for them but those can be
added separately later (together with the appropriate __ARM_FEATURE_* predefine).

2021-09-28  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/aarch64/aarch64.h (AARCH64_FL_LS64): Define
	(AARCH64_FL_V8_7): Likewise.
	(AARCH64_FL_FOR_ARCH8_7): Likewise.
	* config/aarch64/aarch64-arches.def (armv8.7-a): Define.
	* config/aarch64/aarch64-option-extensions.def (ls64): Define.
	* doc/invoke.texi: Document the above.
2021-09-28 16:13:26 +01:00
Aldy Hernandez 0400ca17f3 Improve jump threading dump output.
In analyzing PR102511, it has become abundantly clear that we need
better debugging aids for the jump threader solver.  Currently
debugging these issues is a nightmare if you're not intimately
familiar with the code.  This patch attempts to improve this.

First, I'm enabling path solver dumps with TDF_THREADING.  None of the
available TDF_* flags are a good match, and using TDF_DETAILS would blow
up the dump file, since both threaders continually call the solver to
try out candidates.  This will allow dumping path solver details without
having to resort to hacking the source.

I am also dumping the current registered_jump_thread dbg counter used
by the registry, in the solver.  That way narrowing down a problematic
thread can then be examined by -fdump-*-threading and looking at the
solver details surrounding the appropriate counter (which the dbgcnt
also dumps to the dump file).

You still need knowledge of the solver to debug these issues, but at
least now it's not entirely opaque.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* dbgcnt.c (dbg_cnt_counter): New.
	* dbgcnt.h (dbg_cnt_counter): New.
	* dumpfile.c (dump_options): Add entry for TDF_THREADING.
	* dumpfile.h (enum dump_flag): Add TDF_THREADING.
	* gimple-range-path.cc (DEBUG_SOLVER): Use TDF_THREADING.
	* tree-ssa-threadupdate.c (dump_jump_thread_path): Dump out
	debug counter.
2021-09-28 15:55:29 +02:00
Tobias Burnus 1f0a57bd54 libgomp: Only check for 2*sizeof(void*) int type with Fortran [PR96661]
The depend type is a struct with two pointer members for C/C++ - but for
Fortran OpenMP requires an integer type with kind = omp_depend_kind. Thus,
libgomp's configure checks that an integer type/kind with size 2*sizeof(void*)
is available. However, this integer type/kind is not needed when building without
Fortran support. Thus, only check this when Fortran is enabled.

libgomp/
	PR libgomp/96661
	* configure.ac: Only check for int-type = 2*size_t support when
	building with Fortran support.
	* configure: Regenerate.
2021-09-28 15:15:47 +02:00
Ilya Leoshkevich 92cdd338fd reassoc: Test rank biasing
Add both positive and negative tests.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/reassoc-46.c: New test.
	* gcc.dg/tree-ssa/reassoc-46.h: Common code for new tests.
	* gcc.dg/tree-ssa/reassoc-47.c: New test.
	* gcc.dg/tree-ssa/reassoc-48.c: New test.
	* gcc.dg/tree-ssa/reassoc-49.c: New test.
	* gcc.dg/tree-ssa/reassoc-50.c: New test.
	* gcc.dg/tree-ssa/reassoc-51.c: New test.
2021-09-28 14:58:23 +02:00