Commit Graph

183991 Commits

Author SHA1 Message Date
David Malcolm
5e33e5b042 analyzer: support reverse direction in shortest-paths.h
This patch generalizes shortest-path.h so that it can be used to
find the shortest path from each node to a given target node (on top
of the existing support for finding the shortest path from a given
origin node to each node).

I've marked this as "analyzer" as this is the only code using
shortest-paths.h.

This patch is required by followup work to fix PR analyzer/96374.

gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc (epath_finder::epath_finder):
	Update shortest_paths init for new param.

gcc/ChangeLog:
	* digraph.cc (selftest::test_shortest_paths): Update
	shortest_paths init for new param.  Add test of
	SPS_TO_GIVEN_TARGET.
	* shortest-paths.h (enum shortest_path_sense): New.
	(shortest_paths::shortest_paths): Add "sense" param.
	Update for renamings.  Generalize to use "sense" param.
	(shortest_paths::get_shortest_path): Rename param.
	(shortest_paths::m_sense): New field.
	(shortest_paths::m_prev): Rename...
	(shortest_paths::m_best_edge): ...to this.
	(shortest_paths::get_shortest_path): Update for renamings.
	Conditionalize flipping of path on sense of traversal.
2021-03-11 17:45:10 -05:00
David Malcolm
3f958348e7 analyzer: gracefully handle impossible paths in shortest-paths.h
This bulletproofs the shortest_paths code against unreachable nodes,
gracefully handling them, rather than failing an assertion.

I've marked this as "analyzer" as this is the only code using
shortest-paths.h.

This patch is required by followup work to fix PR analyzer/96374.

gcc/ChangeLog:
	* digraph.cc (selftest::test_shortest_paths): Add test coverage
	for paths from B and C.
	* shortest-paths.h (shortest_paths::shortest_paths): Handle
	unreachable nodes, rather than asserting.
2021-03-11 17:43:39 -05:00
Patrick Palka
c4f8e568aa libstdc++: Add a fallback 128-bit integer class type and use it
This implements a minimal integer class type that emulates 128-bit
unsigned arithmetic using a pair of 64-bit integers, which the
floating-point std::to_chars implementation then uses as a drop-in
replacement for unsigned __int128 on targets that lack the latter.
After this patch, we now fully support formatting of large long double
types on such targets.

Since Ryu performs 128-bit division/modulus only by 2, 5 and 10, this
integer class type supports only these divisors rather than general
division/modulus.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc: Simplify the file as if
	__SIZEOF_INT128__ is always defined.
	[!defined __SIZEOF_INT128__]: Include "uint128_t.h".  Define
	a base-10 to_chars overload for the uint128_t class type.
	* src/c++17/uint128_t.h: New file.
	* testsuite/20_util/to_chars/long_double.cc: No longer expect an
	execution FAIL on targets that have a large long double type
	but lack __int128.
2021-03-11 17:02:27 -05:00
Patrick Palka
349adff208 libstdc++: Remove Ryu's uint128_t aliases
This makes Ryu consistently use the uint128_t alias that's defined in
floating_to_chars.cc.

libstdc++-v3/ChangeLog:

	* src/c++17/ryu/LOCAL_PATCHES: Update.
	* src/c++17/ryu/d2s_intrinsics.h: Don't define uint128_t.
	* src/c++17/ryu/generic_128.h: Likewise.
	* src/c++17/ryu/ryu_generic_128.h (struct floating_decimal_128):
	Use uint128_t instead of __uint128_t.
	(generic_binary_to_decimal): Likewise.
2021-03-11 16:59:15 -05:00
Patrick Palka
60097beb32 libstdc++: Add a LOCAL_PATCHES file to Ryu source directory
This file keeps track of the local modifications we've made to our
copy of Ryu.

libstdc++-v3/ChangeLog:

	* src/c++17/ryu/LOCAL_PATCHES: New file.
2021-03-11 16:58:28 -05:00
Patrick Palka
a38fa1b31f libstdc++: Factor out uses of __int128 into a type alias
Since Ryu has the alias uint128_t for this same purpose, it seems best
for us to use this name as well, so as to minimize the amount of local
modifications we'd need to make to our copy of Ryu.  (In a subsequent
patch, we're going to remove Ryu's aliases so that it uses this one
defined in floating_to_chars.cc.)

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (uint128_t): New conditionally
	defined alias of unsigned __int128.
	(floating_type_traits_binary128::mantissa_t): Use uint128_t
	instead of unsigned __int128.
	(floating_type_traits<long double>::mantissa_t)
	[LONG_DOUBLE_KIND == LDK_IBM128]: Likewise.
	(get_ieee_repr): Likewise.  Make casts from uint_t to mantissa_t
	and uint32_t explicit.  Simplify the extraction of mantissa,
	exponent and sign bit.
2021-03-11 16:57:49 -05:00
David Edelsohn
26ed5a28b1 aix: Use lcomm for TLS static data.
GCC on AIX generates thread local uninitialized data in the common section,
which could conflict with another module.

This patch changes the code generation to place static uninitialized
thread local data into the local common section specified with .lcomm.
This change also removes the need to create a file-local name for the TBSS
data.

gcc/ChangeLog:

2021-03-11  David Edelsohn  <dje.gcc@gmail.com>

	PR target/99094
	* config/rs6000/rs6000.c (rs6000_xcoff_file_start): Don't create
	xcoff_tbss_section_name.
	* config/rs6000/xcoff.h (ASM_OUTPUT_TLS_COMMON): Use .lcomm.
	* xcoffout.c (xcoff_tbss_section_name): Delete.
	* xcoffout.h (xcoff_tbss_section_name): Delete.
2021-03-11 16:57:24 -05:00
Nathan Sidwell
5f27a9f90d c++: Fix unhiding friend with imports [PR 99248]
This was a simple thinko about which object held the reference to the
binding vector.  I also noticed stale code in the tree dumper, as I
recently removed the flags from a lazy number.

	PR c++/99248
	gcc/cp/
	* name-lookup.c (lookup_elaborated_type_1): Access slot not bind
	when there's a binding vector.
	* ptree.c (cxx_print_xnode): Lazy flags are no longer a thing.
	gcc/testsuite/
	* g++.dg/modules/pr99248.h: New.
	* g++.dg/modules/pr99248_a.H: New.
	* g++.dg/modules/pr99248_b.H: New.
2021-03-11 13:13:12 -08:00
Jonathan Wakely
5643f6f396 libstdc++: Make barrier::arrival_token a move-only class type
The standard only specifies that barrier::arrival_token is a move
constructible and move assignable type. We originally used a scoped enum
type, but that means we do not diagnose non-portable code that makes
copies of arrival tokens (or compares them for equality, or uses them as
keys in map!) This wraps the enum in a move-only class type, so that
users are forced to pass it correctly.

The move constructor and move assignment operator of the new class do
not zero out the moved-from token, as that would add additional
instructions. That means that passing a moved-from token will work with
our implementation, despite being a bug in the user code. We could
consider doing that zeroing out in debug mode.

libstdc++-v3/ChangeLog:

	* include/std/barrier (barrier::arrival_token): New move-only
	class that encapsulates the underlying token value.
2021-03-11 17:52:57 +00:00
Jonathan Wakely
9dacc828bf libstdc++: Fix find_type helper to work consistently
The find_type helper function sometimes results in "class X::name" and
lookup for that fails. For more details see "Problem 1" in
https://gcc.gnu.org/pipermail/libstdc++/2021-March/052132.html and the
example at https://sourceware.org/bugzilla/show_bug.cgi?id=27510#c2

This patch replaces typ.unqualified() with typ.tag, which is never
qualified, and will never include the 'class' or 'struct' keywords.
Using the .tag attribute should be safe here because we know we are
looking at a class type and we've already used strip_typedefs().

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (find_type): Use tag attribute
	instead of unqualified() method.
2021-03-11 17:52:56 +00:00
Jonathan Wakely
15825b17cf libstdc++: Use acq_rel memory ordering [PR 99537]
As Lewis Baker wrote in the PR:

> The 'fetch_sub()' operation in _M_release_ownership() should be using
> memory_order::acq_rel instead of memory_order::release. The use of
> 'release' only is insufficient as it does not synchronise with any
> corresponding 'acquire' operation.

> With the current implementation, it's possible that a prior write to
> one of the _M_value or _M_head data-members by a thread releasing the
> second-to-last reference might not be visible to another thread that
> releases the last reference and frees the memory, resulting in
> potential write to freed memory.

This simply changes the memory order to acq_rel as suggested.

libstdc++-v3/ChangeLog:

	PR libstdc++/99537
	* include/std/stop_token (_Stop_state_t::_M_release_ownership):
	Use acq_rel memory ordering.
2021-03-11 17:52:56 +00:00
Jonathan Wakely
8cfb387388 libstdc++: Handle EPERM for filesystem access errors on MacOS [PR 99537]
Contrary to what POSIX says, some directory operations on MacOS can fail
with EPERM instead of EACCES, so we need to handle both.

libstdc++-v3/ChangeLog:

	PR libstdc++/99537
	* src/c++17/fs_dir.cc (recursive_directory_iterator): Use new
	helper function to check for permission denied errors.
	* src/filesystem/dir.cc (recursive_directory_iterator):
	Likewise.
	* src/filesystem/dir-common.h (is_permission_denied_error): New
	helper function.
2021-03-11 17:52:56 +00:00
Jonathan Wakely
67e3976606 libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536]
This avoids a false positive -Wmaybe-uninitialized warning, by
initializing _M_saved on construction.

libstdc++-v3/ChangeLog:

	PR libstdc++/99536
	* include/bits/random.h (normal_distribution): Use
	default-initializer for _M_saved and _M_saved_available.
2021-03-11 17:52:55 +00:00
Nathan Sidwell
edc61d34eb c++: template partial instantiation mismatch [PR 99528]
This turned out to be an existing problem, which had been hidden by
other bugs.  Templated members of templated classes can end up
instantiating the template itself, and we were not handling the
mergeableness of that correctly.

	PR c++/99528
	gcc/cp/
	* module.cc (enum merge_kind): Delete MK_type_tmpl_spec,
	MK_decl_tmpl_spec.
	(trees_in::decl_value): Adjust add_mergeable_specialization call.
	(trees_out::get_merge_kind): Adjust detecting a partial template
	instantiation.
	(trees_out::key_mergeable): Adjust handling same.
	(trees_in::key_mergeabvle): Likewise.
	gcc/testsuite/
	* g++.dg/modules/pr99528.h: New.
	* g++.dg/modules/pr99528_a.H: New.
	* g++.dg/modules/pr99528_b.H: New.
	* g++.dg/modules/pr99528_c.C: New.
2021-03-11 09:49:39 -08:00
Jeff Law
52db241345 MAINTAINERS updates for ex-ImgTec employees
/
	* MAINTAINERS: Update entries for a few ex-ImgTec employees
2021-03-11 09:28:50 -07:00
Martin Liska
04638a813c Add -fprofile-reproducible=parallel-runs to STAGEfeedback_CFLAGS to Makefile.tpl.
ChangeLog:

	* Makefile.tpl: The change was done Makefile.in which
	is generated file.
2021-03-11 16:18:56 +01:00
Richard Biener
3b938c64f7 testsuite/98245 - adjust dump scanning of gcc.dg/vect/bb-slp-46.c
Checking the number of pluses is unreliable since the vector size
isn't known.  Instead see that the unwanted scalar compute is not
there.

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

	PR testsuite/98245
	* gcc.dg/vect/bb-slp-46.c: Scan for the scalar compute
	instead of verifying the total number of adds.
2021-03-11 14:25:16 +01:00
Richard Biener
aa0d8a3e28 testsuite/97494 - XFAIL gcc.dg/vect/pr97428.c on !vect_hw_misalign
While we could at least vectorize it on targets which support
re-alignment tokens we fail to do this because of imperfections in
alignment analysis.  XFAIL when the HW cannot deal with misaligned
vector accesses for now.

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

	PR testsuite/97494
	* gcc.dg/vect/pr97428.c: XFAIL on !vect_hw_misalign.
2021-03-11 14:11:08 +01:00
Richard Biener
f6c1d026c3 testsuite/97494 - XFAIL gcc.dg/vect/vect-complex-5.c on !vect_hw_misalign
This is a missed optimization due to bogus alignment analysis.

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

	PR testsuite/97494
	* gcc.dg/vect/vect-complex-5.c: XFAIL on !vect_hw_misalign.
2021-03-11 14:03:55 +01:00
Richard Biener
9d4ad8570c testsuite/97494 - amend gcc.dg/vect/slp-21.c
As reported in the PR all powerpc64 targets fail

FAIL: gcc.dg/vect/slp-21.c scan-tree-dump-times vect "vectorizing stmts using SLP" 2

because like on arm we now vectorize 4 opportunities.  This adjusts
the testcase to follow the arm example.

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

	PR testsuite/97494
	* gcc.dg/vect/slp-21.c: Adjust for powerpc64*-*-*.
2021-03-11 13:30:56 +01:00
Richard Biener
b08c978f2e tree-optimization/99523 - missing SSA decls in dumps
This makes sure to dump SSA names without identifier in the
declaration part of a function dump.  While we dump the
anonymous variable decls the SSA names referencing them appear
without a clear reference as to what anonymous variable is used
(_3 vs. D.1234).

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

	PR tree-optimization/99523
	* tree-cfg.c (dump_function_to_file): Dump SSA names
	w/o identifier to the decls section as well, not only those
	without a VAR_DECL.
2021-03-11 12:36:37 +01:00
Jakub Jelinek
070ab283d1 icf: Check return type of internal fn calls [PR99517]
The following testcase is miscompiled, because IPA-ICF considers the two
functions identical.  They aren't, the types of the .VEC_CONVERT call
lhs is different.  But for calls to internal functions, there is no
fntype nor callee with a function type to compare, so all we compare
is just the ifn, arguments and some call flags.

The following patch fixes it by checking the internal fn calls like e.g. gimple
assignments where the type of the lhs is checked too.

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

	PR ipa/99517
	* ipa-icf-gimple.c (func_checker::compare_gimple_call): For internal
	function calls with lhs fail if the lhs don't have compatible types.

	* gcc.target/i386/avx2-pr99517-1.c: New test.
	* gcc.target/i386/avx2-pr99517-2.c: New test.
2021-03-11 10:59:18 +01:00
Hans-Peter Nilsson
aa27696b79 cris: define HARD_FRAME_POINTER_REGNUM
Beware, tm.texi doesn't tell the whole story: a defined
HARD_FRAME_POINTER_REGNUM (different to FRAME_POINTER_REGNUM) is
supposed to make work easier for reload, being able to easily
tell actual frame-pointer-related addresses from those that
happen to use the same register or something to that effect.

On reasonable code the performance effect is barely measurable.

Looking at libgcc changes for -march=v10, the effect (where
noticeable) is mostly indeterminate churn.  Instances where it's
not just insns moved around at no obvious effect: one more insn
for addvdi3, subvdi3; two insns more in floatdisf; three insns
shorter fixunsdfdi.  Some of those seem related to pairing r8
with r9.  The only effect on coremark is an infinitesimal
positive effect from a three(!) cycles total (from the 15 calls)
faster execution paths in vfprintf_r.  Local microbenchmarks
give similar results.  With that in mind and not forgetting that
expectations in the register allocator and reload leaning
towards HARD_FRAME_POINTER_REGNUM defined (and different to)
FRAME_POINTER_REGNUM or to wit, "all the kids do it", why not.
Note that the offset at elimination really is 0.

gcc:
	* config/cris/cris.h (HARD_FRAME_POINTER_REGNUM): Define.
	Change FRAME_POINTER_REGNUM to correspond to a new faked
	register faked_fp, part of GENNONACR_REGS like faked_ap.
	(CRIS_FAKED_REGS_CONTENTS): New helper macro.
	(FIRST_PSEUDO_REGISTER, FIXED_REGISTERS, CALL_USED_REGISTERS):
	(REG_ALLOC_ORDER, REG_CLASS_CONTENTS, REGNO_OK_FOR_BASE_P)
	(ELIMINABLE_REGS, REGISTER_NAMES): Adjust accordingly.
	* config/cris/cris.md (CRIS_FP_REGNUM): Renumber to new faked
	register.
	(CRIS_REAL_FP_REGNUM): New constant.
	* config/cris/cris.c (cris_reg_saved_in_regsave_area): Check
	for HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM.
	(cris_initial_elimination_offset): Handle elimination changes
	to HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM
	and add one from FRAME_POINTER_REGNUM to
	HARD_FRAME_POINTER_REGNUM.
	(cris_expand_prologue, cris_expand_epilogue): Emit code for
	hard_frame_pointer_rtx instead of frame_pointer_rtx.
2021-03-11 03:43:48 +01:00
GCC Administrator
e980085206 Daily bump. 2021-03-11 00:16:37 +00:00
David Edelsohn
4fa6356be1 aix: align double complex
AIX word-aligns floating point doubles.  This behavior also extends to
double _Complex, which had been overlooked when compiler support for
double _Complex was added.

This patch adds DCmode to the modes whose alignment is adjusted and
adds a testcase to confirm the correct alignment.

gcc/ChangeLog:

2021-03-10  David Edelsohn  <dje.gcc@gmail.com>

	PR target/99492
	* config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Add check for DCmode.
	* config/rs6000/rs6000.c (rs6000_special_round_type_align): Same.

gcc/testsuite/ChangeLog:

2021-03-10  David Edelsohn  <dje.gcc@gmail.com>

	PR target/99492
	* gcc.target/powerpc/pr99492.c: New testcase.
2021-03-10 18:52:50 -05:00
Harald Anlauf
8c21bc6646 PR fortran/99205 - Out of memory with undefined character length
A character variable appearing as a data statement object cannot
be automatic, thus it shall have constant length.

gcc/fortran/ChangeLog:

	PR fortran/99205
	* data.c (gfc_assign_data_value): Reject non-constant character
	length for lvalue.
	* trans-array.c (gfc_conv_array_initializer): Restrict loop to
	elements which are defined to avoid NULL pointer dereference.

gcc/testsuite/ChangeLog:

	PR fortran/99205
	* gfortran.dg/data_char_4.f90: New test.
	* gfortran.dg/data_char_5.f90: New test.
2021-03-10 22:59:50 +01:00
Vladimir N. Makarov
d38bbb8511 [PR99422] LRA: Don't check unknown constraint, use X for empty constraint
Using CONSTRAINT__UNKNOWN was a bad idea, although it triggered a lot
hidden bugs.  It is better to use X instead of empty constraint.

gcc/ChangeLog:

	PR target/99422
	* lra-constraints.c (process_address_1): Don't check unknown
	constraint, use X for empty constraint.
2021-03-10 16:15:51 -05:00
Segher Boessenkool
8f316f41ce rs6000: Fix pr98959 testcase
It needs the int128 selector because it uses __int128, and the lp64
selector is the best we can do for -mcmodel=.

2021-03-10  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
	* gcc.target/powerpc/pr98959.c: Add int128 and lp64 selectors.
2021-03-10 20:26:28 +00:00
Tobias Burnus
9dcc2edfa6 Fortran: Fix wording in intrinsic.texi's MIN
gcc/fortran/ChangeLog:

	* intrinsic.texi (MIN): Correct 'maximum' to 'minimum'.
2021-03-10 21:24:18 +01:00
Nathan Sidwell
1f428775ac c++: ICE do to GC leakage [PR 99423]
My reworking of pending-entity loading introduced a GC problem.  The
post-load processing needs to inhibit GCs (that would otherwise occur
in clone_decl).  That wasn't happening on one code path, leading to
dangling pointers in the active call frames.

	PR c++/99423
	gcc/cp/
	* module.cc (post_load_processing): Assert not gcable.
	(laxy_load_pendings): Extend no-gc region around
	post_load_processing.
	gcc/testsuite/
	* g++.dg/modules/pr99423_a.H: New.
	* g++.dg/modules/pr99423_b.H: New.
2021-03-10 12:12:00 -08:00
David Malcolm
44fd4dc0b6 analyzer: factor out new class feasibility_state
As preparatory work for a fix to PR analyzer/96374, this patch
moves the core state-update logic from the loop in
exploded_path::feasible_p into a new class feasibility_state.

No functional change intended.

gcc/analyzer/ChangeLog:
	PR analyzer/96374
	* engine.cc (exploded_path::feasible_p): Move "snodes_visited" and
	"model" locals into a new class feasibility_state.  Move heart
	of per-edge processing into
	feasibility_state::maybe_update_for_edge.
	(feasibility_state::feasibility_state): New.
	(feasibility_state::maybe_update_for_edge): New, based on loop
	body in exploded_path::feasible_p.
	* exploded-graph.h (class feasibility_state): New.
2021-03-10 12:02:07 -05:00
David Malcolm
6b78729186 committed: analyzer: remove duplicated vfuncs
Implement dyn_cast_callgraph_superedge once in callgraph_superedge,
rather than twice in the two subclasses.

Spotted whilst working on a patch for call summaries.

gcc/analyzer/ChangeLog:
	* supergraph.h
	(callgraph_superedge::dyn_cast_callgraph_superedge): New.
	(call_superedge::dyn_cast_callgraph_superedge): Delete.
	(return_superedge::dyn_cast_callgraph_superedge): Delete.
2021-03-10 12:00:34 -05:00
Jakub Jelinek
5bf998275a testsuite: Fix up pr99305.C test on unsigned_char targets [PR99498]
On unsigned_char targets, the cast stmt to unsigned char is obviously
not needed (and shouldn't be there).  But it doesn't hurt to test
the rest also on targets where char is unsigned.

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

	PR tree-optimization/99305
	PR testsuite/99498
	* g++.dg/opt/pr99305.C: Don't expect cast to unsigned char on
	unsigned_char effective targets.
2021-03-10 17:40:25 +01:00
John David Anglin
71dc5ae574 Add options to link with libatomic in various tests.
libstdc++-v3/ChangeLog:

	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Add options to
	link with libatomic.
	* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/30_threads/barrier/arrive.cc: Likewise.
	* testsuite/30_threads/barrier/arrive_and_drop.cc: Likewise.
	* testsuite/30_threads/barrier/arrive_and_wait.cc: Likewise.
	* testsuite/30_threads/barrier/completion.cc: Likewise.
	* testsuite/30_threads/latch/3.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire_for.cc: Likewise.
	* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
2021-03-10 16:01:12 +00:00
Nathan Sidwell
b97af562b5 c++: Propagate assembler name from local-externs [PR 99508]
This is another place where our one-true-decl representation breaks
down.  The fix here propagates the assembly name to the ns-scope
alias.  that fixes the reported problem but changes the behaviour when
the user has explicitly declared the entity in its namespace.
However, we didn't handle that case 'correctly' anyway before.
Previously we'd also ignore the explicitly specified assembler name,
now we propagate it.  It's not clear to me what the desired semantics
would be in decorating just one of the local extern declarations this
way.  I don't think we can really do better without propagating this
aliasing property into the middle end (which is also needed for some
constexpr handling, see PR97306).  I tried that before and it turned
into a rat-hole.

	PR c++/99508
	gcc/cp/
	* decl.c (make_rtl_for_nonlocal_decl): Propagate local-extern's
	assembler name to the ns alias.
	gcc/testsuite/
	* g++.dg/ext/pr99508.C: New.
2021-03-10 07:50:32 -08:00
Jonathan Wakely
47cca0288d libstdc++: Fix headers that can't be used as header units [PR 99413]
This adds missing includes to internal library headers which get
included from more than one other header, so that they can be compiled
as a stand-alone header unit.

For existing use cases these includes are no-ops because they're already
done by the header that includes these files. For compiling them as a
header unit, this ensures that they include what they use.

libstdc++-v3/ChangeLog:

	PR libstdc++/99413
	* include/bits/align.h: Include debug/assertions.h.
	* include/bits/codecvt.h: Include bits/c++config.h.
	* include/bits/enable_special_members.h: Likewise.
	* include/bits/erase_if.h: Likewise.
	* include/bits/functional_hash.h: Include <type_traits>.
	* include/bits/invoke.h: Include bits/move.h.
	* include/bits/ostream_insert.h: Include bits/exception_defines.h.
	* include/bits/parse_numbers.h: Include <type_traits>.
	* include/bits/predefined_ops.h: Include bits/c++config.h.
	* include/bits/range_access.h: Include bits/stl_iterator.h.
	* include/bits/stl_bvector.h: Do not include bits/stl_vector.h.
	* include/bits/stl_iterator.h: Include bits/stl_iterator_base_types.h.
	* include/bits/stl_uninitialized.h: Include bits/stl_algobase.h.
	* include/bits/uniform_int_dist.h: Include bits/concept_check.h.
	* include/bits/unique_lock.h: Include bits/std_mutex.h.
	* include/debug/assertions.h: Include bits/c++config.h.
2021-03-10 15:27:41 +00:00
Jonathan Wakely
dddd011113 libstdc++: Implement LWG 3530 for concept-constrained comparisons
The proposed resolution for this library issue simplifies the
constraints for compare_three_way, ranges::equal_to, ranges::less etc.
so that they do not work with types which are convertible to pointers
but which fail to meet the usual syntactic requirements for the
comparisons.

This affects the example in PR libstdc++/93628 but doesn't fix the
problem described in that report.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_cmp.h (__eq_builtin_ptr_cmp): Remove.
	(ranges::equal_to, ranges::not_equal_to): Do not constrain
	with __eq_builtin_ptr_cmp.
	(ranges::less, ranges::greater, ranges::less_equal)
	(ranges::greater_equal): Do not constrain with
	__less_builtin_ptr_cmp.
	* libsupc++/compare (compare_three_way): Do not constrain with
	__3way_builtin_ptr_cmp.
	* testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc: Moved to...
	* testsuite/18_support/comparisons/object/lwg3530.cc: ...here.
	* testsuite/20_util/function_objects/range.cmp/lwg3530.cc: New test.
2021-03-10 15:27:06 +00:00
Alex Coplan
b6073c9faa aarch64: Fix typo in aarch64.c comment
This fixes a typo in the description of
aarch64_vfp_is_call_or_return_candidate.

gcc/ChangeLog:

	* config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate):
	Fix typo in comment describing "is_ha" argument.
2021-03-10 15:11:16 +00:00
John David Anglin
cb33c7276a Add LRA target selector.
gcc/ChangeLog:

	* doc/sourcebuild.texi: Document LRA target selector.

gcc/testsuite/ChangeLog:

	PR testsuite/99292
	* lib/target-supports.exp (check_effective_target_lra): New.
	* gcc.c-torture/compile/asmgoto-2.c: Use LRA target selector.
	* gcc.c-torture/compile/asmgoto-5.c: Likewise.
	* gcc.c-torture/compile/pr98096.c: Likewise.
	* gcc.dg/pr97954.c: Likewise.
2021-03-10 14:59:49 +00:00
David Malcolm
46b52b4ae1 analyzer: remove some no-longer-needed -Wno-analyzer-too-complex
A couple of analyzer testcases no longer have state explosions; updating
them accordingly in case they regress.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/pr94047.c: Remove "-Wno-analyzer-too-complex".
	* gcc.dg/analyzer/zlib-2.c: Likewise.
2021-03-10 08:54:02 -05:00
David Malcolm
c4a36bb1e1 docs: add interactive vs batch distinction to UX guidelines
gcc/ChangeLog:
	* doc/ux.texi: Add subsection contrasting interactive versus
	batch usage of GCC.
2021-03-10 08:49:29 -05:00
Joel Hutton
3fbac260fc [testsuite] Fix target selector for pr99102.c
The target selector should explicitly choose 256 bit hardware as
explicit 256 bit compiler options are used to trigger the bug.

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/pr99102.c: Fix target selector.
2021-03-10 13:28:46 +00:00
Joel Hutton
99d5299376 [Vect] Fix mask check on Scatter loads/stores
Previously, IFN_MASK_SCATTER_STORE was used if 'loop_masks' was
non-null, but the mask used is 'final_mask'. This caused a bug where
a 'MASK_STORE' was vectorized into a 'SCATTER_STORE' instead of a
'MASK_SCATTER_STORE'. This fixes PR target/99102.

gcc/ChangeLog:

	PR target/99102
	* tree-vect-stmts.c (vectorizable_store): Fix scatter store mask
	check condition.
	(vectorizable_load): Fix gather load mask check condition.

gcc/testsuite/ChangeLog:

	PR target/99102
	* gcc.dg/vect/pr99102.c: New test.
2021-03-10 12:26:21 +00:00
Richard Biener
6ceb712e26 tree-optimization/99510 - fix type reuse of build_aligned_type
The fix for PR94775 added more strict checking for type reuse
to check_aligned_type, specifically matching TYPE_USER_ALIGN.
But then build_aligned_type sets TYPE_USER_ALIGN on the built
variant so if the type we build an aligned variant for does not
have TYPE_USER_ALIGN we'll never re-use the newly created aligned
variant.  This results in ~35000 identical variants being created
for polyhedron doduc.

The following instead checks that the candidate has TYPE_USER_ALIGN set.

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

	PR tree-optimization/99510
	* tree.c (check_aligned_type): Check that the candidate
	has TYPE_USER_ALIGN set instead of matching with the
	original type.
2021-03-10 13:13:51 +01:00
Eric Botcazou
47403a0eef Do not assume that __float128 exists
The code in build_round_expr implicitly assumes that __float128 exists,
which is *not* the common case among 64-bit architectures since the
"long double" type is generally already 128-bit for them.

gcc/fortran/
	PR fortran/96983
	* trans-intrinsic.c (build_round_expr): Do not implicitly assume
	that __float128 is the 128-bit floating-point type.
2021-03-10 12:32:03 +01:00
Eric Botcazou
1c3c12b0a6 Fix ICE on atomic enumeration type with LTO
This is a strange regression whereby an enumeration type declared as
atomic (or volatile) incorrectly triggers the ODR machinery for its
values in LTO mode.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity): Build a TYPE_STUB_DECL
	for the main variant of an enumeration type declared as volatile.
gcc/testsuite/
	* gnat.dg/specs/lto25.ads: New test.
2021-03-10 12:32:03 +01:00
Eric Botcazou
da7343a6f4 Fix miscompilation of Ada runtime on 64-bit SPARC
Returning a REGMODE_NATURAL_SIZE of 4 for DFmode in 64-bit mode is
just asking for trouble because sub-word SUBREGs are always treated
differently than the others, in particular by the register allocator.

gcc/
	* config/sparc/sparc.c (sparc_regmode_natural_size): Return 4 for
	float and vector integer modes only if the mode is not larger.
2021-03-10 12:32:03 +01:00
Jonathan Wakely
e7afb82c35 libstdc++: Uncomment more parts of <chrono> synopsis test
libstdc++-v3/ChangeLog:

	* testsuite/std/time/syn_c++20.cc: Enable synopsis checks for
	C++20 calendar types.
2021-03-10 11:14:27 +00:00
Hans-Peter Nilsson
5987d8a79c cris: define DWARF_FRAME_REGISTERS
When DWARF_FRAME_REGISTERS isn't defined, the default is
FIRST_PSEUDO_REGISTER which means that if you add faked
registers to the port, used for frame-context related
elimination, room is allocated for them in the register
context used for frame-unwinding, which is wasteful because
they're eliminated before the final form of the code that is
emitted.

Stopping after MOF saves two register slots in the unwind
contest, compared to the current default.  For regular C
programming this is uninteresting, but defining
DWARF_FRAME_REGISTERS now also avoids the need to remember
to define it later, when twiddling with additional faked
registers (alternatively suffering churn from comparing
differences in unwind context).  As expected, no effect on
test-results, coremark or local (C-specific)
microbenchmarks.

gcc:
	* config/cris/cris.h (DWARF_FRAME_REGISTERS): Define.
2021-03-10 04:01:30 +01:00
GCC Administrator
8dc225d311 Daily bump. 2021-03-10 00:16:43 +00:00