David Malcolm [Thu, 11 Mar 2021 22:45:10 +0000 (17:45 -0500)]
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.
David Malcolm [Thu, 11 Mar 2021 22:43:39 +0000 (17:43 -0500)]
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.
Patrick Palka [Thu, 11 Mar 2021 22:02:27 +0000 (17:02 -0500)]
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.
Patrick Palka [Thu, 11 Mar 2021 21:59:15 +0000 (16:59 -0500)]
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.
Patrick Palka [Thu, 11 Mar 2021 21:58:28 +0000 (16:58 -0500)]
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.
Patrick Palka [Thu, 11 Mar 2021 21:57:49 +0000 (16:57 -0500)]
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.
David Edelsohn [Thu, 11 Mar 2021 16:41:24 +0000 (11:41 -0500)]
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.
Nathan Sidwell [Thu, 11 Mar 2021 21:06:36 +0000 (13:06 -0800)]
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.
Jonathan Wakely [Thu, 11 Mar 2021 16:57:20 +0000 (16:57 +0000)]
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.
Jonathan Wakely [Thu, 11 Mar 2021 16:48:32 +0000 (16:48 +0000)]
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.
Jonathan Wakely [Thu, 11 Mar 2021 16:44:57 +0000 (16:44 +0000)]
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.
Jonathan Wakely [Thu, 11 Mar 2021 16:43:51 +0000 (16:43 +0000)]
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.
Jonathan Wakely [Thu, 11 Mar 2021 16:43:51 +0000 (16:43 +0000)]
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.
Nathan Sidwell [Thu, 11 Mar 2021 13:39:11 +0000 (05:39 -0800)]
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.
Jeff Law [Thu, 11 Mar 2021 16:28:50 +0000 (09:28 -0700)]
MAINTAINERS updates for ex-ImgTec employees
/
* MAINTAINERS: Update entries for a few ex-ImgTec employees
Martin Liska [Thu, 11 Mar 2021 15:17:41 +0000 (16:17 +0100)]
Add -fprofile-reproducible=parallel-runs to STAGEfeedback_CFLAGS to Makefile.tpl.
ChangeLog:
* Makefile.tpl: The change was done Makefile.in which
is generated file.
Richard Biener [Thu, 11 Mar 2021 13:25:16 +0000 (14:25 +0100)]
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.
Richard Biener [Thu, 11 Mar 2021 13:11:08 +0000 (14:11 +0100)]
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.
Richard Biener [Thu, 11 Mar 2021 13:03:55 +0000 (14:03 +0100)]
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.
Richard Biener [Thu, 11 Mar 2021 12:30:56 +0000 (13:30 +0100)]
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*-*-*.
Richard Biener [Thu, 11 Mar 2021 09:09:43 +0000 (10:09 +0100)]
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.
Jakub Jelinek [Thu, 11 Mar 2021 09:59:18 +0000 (10:59 +0100)]
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.
Hans-Peter Nilsson [Thu, 11 Mar 2021 02:38:34 +0000 (03:38 +0100)]
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.
GCC Administrator [Thu, 11 Mar 2021 00:16:37 +0000 (00:16 +0000)]
Daily bump.
David Edelsohn [Tue, 9 Mar 2021 22:52:36 +0000 (17:52 -0500)]
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.
Harald Anlauf [Wed, 10 Mar 2021 21:59:50 +0000 (22:59 +0100)]
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.
Vladimir N. Makarov [Wed, 10 Mar 2021 21:15:08 +0000 (16:15 -0500)]
[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.
Segher Boessenkool [Wed, 10 Mar 2021 20:19:39 +0000 (20:19 +0000)]
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.
Tobias Burnus [Wed, 10 Mar 2021 20:24:18 +0000 (21:24 +0100)]
Fortran: Fix wording in intrinsic.texi's MIN
gcc/fortran/ChangeLog:
* intrinsic.texi (MIN): Correct 'maximum' to 'minimum'.
Nathan Sidwell [Wed, 10 Mar 2021 20:07:24 +0000 (12:07 -0800)]
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.
David Malcolm [Wed, 10 Mar 2021 17:02:07 +0000 (12:02 -0500)]
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.
David Malcolm [Wed, 10 Mar 2021 17:00:34 +0000 (12:00 -0500)]
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.
Jakub Jelinek [Wed, 10 Mar 2021 16:40:25 +0000 (17:40 +0100)]
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.
John David Anglin [Wed, 10 Mar 2021 16:01:12 +0000 (16:01 +0000)]
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.
Nathan Sidwell [Wed, 10 Mar 2021 15:39:51 +0000 (07:39 -0800)]
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.
Jonathan Wakely [Wed, 10 Mar 2021 15:27:41 +0000 (15:27 +0000)]
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.
Jonathan Wakely [Wed, 10 Mar 2021 15:27:06 +0000 (15:27 +0000)]
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.
Alex Coplan [Wed, 10 Mar 2021 15:11:16 +0000 (15:11 +0000)]
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.
John David Anglin [Wed, 10 Mar 2021 14:57:01 +0000 (14:57 +0000)]
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.
David Malcolm [Wed, 10 Mar 2021 13:54:02 +0000 (08:54 -0500)]
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.
David Malcolm [Wed, 10 Mar 2021 13:49:29 +0000 (08:49 -0500)]
docs: add interactive vs batch distinction to UX guidelines
gcc/ChangeLog:
* doc/ux.texi: Add subsection contrasting interactive versus
batch usage of GCC.
Joel Hutton [Wed, 10 Mar 2021 13:28:46 +0000 (13:28 +0000)]
[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.
Joel Hutton [Wed, 10 Mar 2021 12:22:45 +0000 (12:22 +0000)]
[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.
Richard Biener [Wed, 10 Mar 2021 10:57:21 +0000 (11:57 +0100)]
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.
Eric Botcazou [Wed, 10 Mar 2021 11:05:53 +0000 (12:05 +0100)]
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.
Eric Botcazou [Wed, 10 Mar 2021 11:04:25 +0000 (12:04 +0100)]
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.
Eric Botcazou [Wed, 10 Mar 2021 11:02:14 +0000 (12:02 +0100)]
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.
Jonathan Wakely [Wed, 10 Mar 2021 11:14:17 +0000 (11:14 +0000)]
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.
Hans-Peter Nilsson [Wed, 10 Mar 2021 02:54:16 +0000 (03:54 +0100)]
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.
GCC Administrator [Wed, 10 Mar 2021 00:16:43 +0000 (00:16 +0000)]
Daily bump.
Vladimir N. Makarov [Tue, 9 Mar 2021 22:18:58 +0000 (17:18 -0500)]
IRA: Process digital constraints containing more one digit
gcc/ChangeLog:
* ira.c (ira_setup_alts, ira_get_dup_out_num): Process digital
constraints > 9.
* ira-lives.c (single_reg_class): Ditto.
Sebastian Huber [Tue, 9 Mar 2021 18:32:26 +0000 (19:32 +0100)]
RTEMS: Fix -Werror builds
Fix build errors due to warnings such as:
gcc/config/v850/rtems.h:43: error: "RTEMS_STARTFILE_SPEC" redefined [-Werror]
43 | #define RTEMS_STARTFILE_SPEC ""
The problem was that "gcc/config/rtems.h" was included before the
architecture-specific "gcc/config/*/rtems.h" header file on some
architectures.
gcc/
* config.gcc (aarch64-*-rtems*): Include general rtems.h after
the architecture-specific rtems.h.
(aarch64-*-rtems*): Likewise.
(arm*-*-rtems*): Likewise.
(epiphany-*-rtems*): Likewise.
(riscv*-*-rtems*): Likewise.
Jakub Jelinek [Tue, 9 Mar 2021 18:13:11 +0000 (19:13 +0100)]
phiopt: Fix up conditional_replacement [PR99305]
Before my PR97690 changes, conditional_replacement would not set neg
when the nonzero arg was boolean true.
I've simplified the testing, so that it first finds the zero argument
and then checks the other argument for all the handled cases
(1, -1 and 1 << X, where the last case is what the patch added support for).
But, unfortunately I've placed the integer_all_onesp test first.
For unsigned precision 1 types such as bool integer_all_onesp, integer_onep
and integer_pow2p can all be true and the code set neg to true in that case,
which is undesirable.
The following patch tests integer_pow2p first (which is trivially true
for integer_onep too and tree_log2 in that case gives shift == 0)
and only if that isn't the case, integer_all_onesp.
2021-03-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/99305
* tree-ssa-phiopt.c (conditional_replacement): Test integer_pow2p
before integer_all_onesp instead of vice versa.
* g++.dg/opt/pr99305.C: New test.
Segher Boessenkool [Wed, 3 Mar 2021 20:34:32 +0000 (20:34 +0000)]
rs6000: Fix check_effective_target_sqrt_insn (PR99352)
The previous version returned true for all PowerPC. This is incorrect.
We only support floating point square root instructions if a) we support
floating point instructions at all, and b) we have _ARCH_PPCSQ defined.
2020-03-09 Segher Boessenkool <segher@kernel.crashing.org>
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_powerpc_sqrt): New.
(check_effective_target_sqrt_insn): Use it.
Richard Earnshaw [Tue, 9 Mar 2021 17:02:53 +0000 (17:02 +0000)]
arm: fix bootstrap failure following automatic mode selection patch
Fix a signed vs unsigned comparison in last change.
gcc:
* common/config/arm/arm-common.c (arm_config_default): Change type
of 'i' to unsigned.
Vladimir N. Makarov [Tue, 9 Mar 2021 15:57:21 +0000 (10:57 -0500)]
[PR99454] LRA: Process separately 'g' and digital constraints > 9 in process_address_1
gcc/ChangeLog:
PR target/99454
* lra-constraints.c (process_address_1): Process constraint 'g'
separately and digital constraints containing more one digit.
gcc/testsuite/ChangeLog:
PR target/99454
* gcc.target/i386/pr99454.c: New.
Mikael Pettersson [Tue, 9 Mar 2021 15:58:56 +0000 (08:58 -0700)]
Re: [PATCH v2] fix Ada bootstrap on Cygwin64 (PR bootstrap/94918)
gcc/ada/
* raise-gcc.c: On Cygwin include mingw32.h to prevent
windows.h from including x86intrin.h or emmintrin.h.
Jakub Jelinek [Tue, 9 Mar 2021 15:44:27 +0000 (16:44 +0100)]
c++: Fix coroutines on targetm.cxx.cdtor_return_this targets [PR99459]
The r11-7528 build_co_await changes broke coroutines on arm*-linux-gnuabi,
2780 ^FAIL.*coroutines/ in total.
The problem is that arm is targetm.cxx.cdtor_return_this target where
both ctors and dtors in the ABI return this pointer rather than
void, and build_new_method_call_1 does:
else if (call != error_mark_node
&& DECL_DESTRUCTOR_P (cand->fn)
&& !VOID_TYPE_P (TREE_TYPE (call)))
/* An explicit call of the form "x->~X()" has type
"void". However, on platforms where destructors
return "this" (i.e., those where
targetm.cxx.cdtor_returns_this is true), such calls
will appear to have a return value of pointer type
to the low-level call machinery. We do not want to
change the low-level machinery, since we want to be
able to optimize "delete f()" on such platforms as
"operator delete(~X(f()))" (rather than generating
"t = f(), ~X(t), operator delete (t)"). */
call = build_nop (void_type_node, call);
The new code in build_co_await relies on build_special_member_call
returned expression being a CALL_EXPR, but due to the build_nop
in there it is a NOP_EXPR around the CALL_EXPR. It can't be stripped
with STRIP_NOPS because void has different mode from the pointer mode.
2021-03-09 Jakub Jelinek <jakub@redhat.com>
PR c++/99459
* coroutines.cc (build_co_await): Look through NOP_EXPRs in
build_special_member_call return value to find the CALL_EXPR.
Simplify.
Nick Clifton [Tue, 9 Mar 2021 15:29:23 +0000 (15:29 +0000)]
Fix building the RX port of gcc.
* config/rx/rx.h (DBX_DEBUGGING_INFO): Define.
(DWARF"_DEBUGGING_INFO): Define.
Eric Botcazou [Tue, 9 Mar 2021 15:20:53 +0000 (16:20 +0100)]
Assorted testsuite fixes
First, gcc.dg/array-quals-1.c does not pass if the compiler is configured
with --enable-default-pie because the sections change, so force -fno-pie.
Second, replace *-*-solaris* with sparc*-*-* for gfortran.dg/pr95690.f90
because this depends on the architecture rather than the OS. Third force
SRA to trigger on Aarch64 (like PowerPC) for gnat.dg/opt39.adb.
gcc/testsuite/
* gcc.dg/array-quals-1.c: Pass -fno-pie if supported.
* gcc.dg/loop-9.c: Likewise.
* gfortran.dg/pr95690.f90: Replace *-*-solaris* with sparc*-*-*.
* gnat.dg/opt39.adb: Pass --param option for Aarch64 too.
Eric Botcazou [Tue, 9 Mar 2021 15:12:22 +0000 (16:12 +0100)]
Fix internal error on lambda function
This boils down to the RTL expander trying to take the address of a DECL
whose RTX is a register.
gcc/
PR c++/90448
* calls.c (initialize_argument_information): When the argument
is passed by reference, do not make a copy in a thunk only if
the argument is already in memory. Remove redundant test for
the case of callee copy.
Vladimir N. Makarov [Tue, 9 Mar 2021 14:05:05 +0000 (09:05 -0500)]
[PR99454] LRA: Process 0..9 constraints in process_address_1
We need to process 0..9 constraints to fetch the right op constraint in
the function. Also 0..9 constraints gives unknown class constraint
class which can result in skipping address normalization for memory in asm.
gcc/ChangeLog:
PR target/99454
* lra-constraints.c (process_address_1): Process 0..9 constraints
in process_address_1.
Andreas Krebbel [Tue, 9 Mar 2021 10:45:31 +0000 (11:45 +0100)]
IBM Z: arch14 fix option string used for Binutils
gcc/ChangeLog:
* config/s390/s390.c (struct s390_processor processor_table):
Binutils name string must not be empty.
Jakub Jelinek [Tue, 9 Mar 2021 13:14:09 +0000 (14:14 +0100)]
testsuite: Fix up pr98920.c on non-glibc or old glibc targets [PR98920]
Not all OSes have regex.h and not all OSes that do have REG_STARTEND macro support.
Conditionalize the test on that.
2021-03-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/98920
* c-c++-common/asan/pr98920.c: Only include regex.h if the header
exists. If REG_STARTEND macro isn't defined, just return 0 from main
instead of the actual test.
Nathan Sidwell [Tue, 9 Mar 2021 13:08:09 +0000 (05:08 -0800)]
c++: Clarify note about -fmodules-ts [PR 99472]
This clarifies that c++2[03] intentionally does not enable
c++20 modules.
PR c++/99472
gcc/cp/
* parser.c (cp_parser_diagnose_invalid_type_name): Clarify
that C++20 does not yet imply modules.
Claudiu Zissulescu [Tue, 9 Mar 2021 10:32:20 +0000 (12:32 +0200)]
arc: Remove orphan function.
Remove unused function.
gcc/
2021-03-09 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_attr_type): Remove function.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Martin Liska [Mon, 8 Mar 2021 11:56:06 +0000 (12:56 +0100)]
i386: Properly set ix86_isa_flags
gcc/ChangeLog:
PR target/99464
* config/i386/i386-options.c (ix86_option_override_internal):
Set isa_flags for OPTS argument and not for the global
global_options.
gcc/testsuite/ChangeLog:
PR target/99464
* gcc.target/i386/pr99464.c: New test.
Aaron Sawdey [Tue, 9 Mar 2021 04:18:03 +0000 (22:18 -0600)]
Checked in non-final version of patch in commit
9433c844c8bcf0166567943b45576ceeeee0b131
Not sure what I did but this corrects it to the version that I tested
and that Segher approved.
gcc/ChangeLog
* config/rs6000/predicates.md (ds_form_mem_operand): Check
in correct code.
Joel Brobecker [Tue, 9 Mar 2021 02:59:37 +0000 (23:59 -0300)]
add powerpc_vsx_ok requirement to undef-bool tests
These tests use -mvsx in their dg-options lists, so they are only
applicable if the -mvsx option is supported by the compiler.
for gcc/testsuite/ChangeLog
* gcc.target/powerpc/undef-bool-2.c: Add
dg-require-effective-target powerpc_vsx_ok directive.
* g++.dg/ext/undef-bool-1.C: Add dg-require-effective-target
powerpc_vsx_ok directive.
Aaron Sawdey [Sun, 7 Mar 2021 20:47:31 +0000 (14:47 -0600)]
Tighten predicates for p10 ld/cmpi fusion
PR99070 is caused by a fusion pattern matching that the individual
instructions do not match when it is split later. In this case the
ld+cmpi patterns were allowing a d-form load address, which the split
condition would rightly split, however that left us with something that
could not be matched by a ds-form ld instruction, hence the ICE. This
only happened if the target cpu was not power10 -- if we were targeting
power10 then a prefixed pld instruction would get generated because that
can handle d-form. However this is not optimal code either.
So the solution is a new predicate (ds_form_mem_operand) that only
accepts what we can take as for a ds-form load. Then a small
modification of the genfusion.pl script changes the relevant
ld+cmpi patterns to use the new predicate.
gcc/ChangeLog
PR target/99070
* config/rs6000/predicates.md (ds_form_mem_operand) New
predicate.
* config/rs6000/genfusion.pl (gen_ld_cmpi_p10) Use
ds_form_mem_operand in ld/lwa patterns.
* config/rs6000/fusion.md: Regenerate file.
Ian Lance Taylor [Mon, 8 Mar 2021 21:58:14 +0000 (13:58 -0800)]
runtime: cast SIGSTKSZ to uintptr
In newer versions of glibc it is long, which causes a signed
comparison warning.
Fixes PR go/99458
GCC Administrator [Tue, 9 Mar 2021 00:16:57 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Mon, 8 Mar 2021 23:47:58 +0000 (23:47 +0000)]
Update cpplib eo.po.
* eo.po: Update.
Joseph Myers [Mon, 8 Mar 2021 23:47:01 +0000 (23:47 +0000)]
Update gcc de.po, sv.po.
* de.po, sv.po: Update.
Jeff Law [Mon, 8 Mar 2021 22:32:54 +0000 (15:32 -0700)]
Adjust my email address to a personal one
* MAINTAINERS: Update my email address
Harald Anlauf [Mon, 8 Mar 2021 20:59:20 +0000 (21:59 +0100)]
PR fortran/49278 - ICE when combining DATA with default initialization
A variable with the PARAMETER attribute may not appear in a DATA statement.
gcc/fortran/ChangeLog:
PR fortran/49278
* data.c (gfc_assign_data_value): Reject variable with PARAMETER
attribute in DATA statement.
gcc/testsuite/ChangeLog:
PR fortran/49278
* gfortran.dg/parameter_data.f90: New test.
Martin Sebor [Mon, 8 Mar 2021 20:37:21 +0000 (13:37 -0700)]
PR middle-end/98266 - bogus array subscript is partly outside array bounds on virtual inheritance
gcc/ChangeLog:
PR middle-end/98266
* gimple-array-bounds.cc (inbounds_vbase_memaccess_p): New function.
(array_bounds_checker::check_array_bounds): Call it.
gcc/testsuite/ChangeLog:
PR middle-end/98266
* g++.dg/warn/Warray-bounds-15.C: New test.
* g++.dg/warn/Warray-bounds-18.C: New test.
* g++.dg/warn/Warray-bounds-19.C: New test.
* g++.dg/warn/Warray-bounds-20.C: New test.
* g++.dg/warn/Warray-bounds-21.C: New test.
Martin Sebor [Mon, 8 Mar 2021 20:28:52 +0000 (13:28 -0700)]
PR middle-end/97631 - bogus "writing one too many bytes" warning for memcpy with strlen argument
gcc/ChangeLog:
PR middle-end/97631
* tree-ssa-strlen.c (maybe_warn_overflow): Test rawmem.
(handle_builtin_stxncpy_strncat): Rename locals. Determine
destination size from allocation calls. Issue a more appropriate
kind of warning.
(handle_builtin_memcpy): Pass true as rawmem to maybe_warn_overflow.
(handle_builtin_memset): Same.
gcc/testsuite/ChangeLog:
PR middle-end/97631
* c-c++-common/Wstringop-overflow.c: Remove unexpected warnings.
Add an xfail.
* c-c++-common/Wstringop-truncation.c: Add expected warnings.
* gcc.dg/Wstringop-overflow-10.c: Also enable -Wstringop-truncation.
* gcc.dg/Wstringop-overflow-66.c: New test.
* gcc.dg/tree-ssa/strncpy-2.c: Adjust expected warning.
Marek Polacek [Mon, 8 Mar 2021 20:26:58 +0000 (15:26 -0500)]
c++: Add test for PR96268.
This works since the recent r11-7102, but we didn't have a test for
a template-argument context.
gcc/testsuite/ChangeLog:
PR c++/96268
* g++.dg/cpp2a/nontype-class41.C: New test.
Nathan Sidwell [Mon, 8 Mar 2021 19:55:26 +0000 (11:55 -0800)]
C++: Enable c++2b module mode [PR 99436]
This adds support for c++23 mode to modules, and enables such testing.
PR c++/99436
gcc/cp/
* name-lookup.c (get_cxx_dialect_name): Add cxx23.
gcc/testsuite/
* g++.dg/modules/modules.exp (MOD_STD_LIST): Add 2b.
Nathan Sidwell [Mon, 8 Mar 2021 18:37:03 +0000 (10:37 -0800)]
c++: Poor diagnostic in header-unit [PR 99468]
We didn't specifically check for a module-decl inside a header unit.
That leads to a confusing diagostic. Fixed thusly.
gcc/cp/
* lex.c (module_token_filter::resume): Ignore module-decls inside
header-unit.
* parser.c (cp_parser_module_declaration): Reject in header-unit.
gcc/testsuite/
* g++.dg/modules/pr99468.H: New.
Peter Bergner [Mon, 8 Mar 2021 18:20:41 +0000 (12:20 -0600)]
rs6000: Fix invalid splits when using Altivec style addresses [PR98959]
The rs6000_emit_le_vsx_* functions assume they are not passed an Altivec
style "& ~16" address. However, some of our expanders and splitters do
not verify we do not have an Altivec style address before calling those
functions, leading to an ICE. The solution here is to guard the expanders
and splitters to ensure we do not call them if we're given an Altivec style
address.
2021-03-08 Peter Bergner <bergner@linux.ibm.com>
gcc/
PR target/98959
* config/rs6000/rs6000.c (rs6000_emit_le_vsx_permute): Add an assert
to ensure we do not have an Altivec style address.
* config/rs6000/vsx.md (*vsx_le_perm_load_<mode>): Disable if passed
an Altivec style address.
(*vsx_le_perm_store_<mode>): Likewise.
(splitters after *vsx_le_perm_store_<mode>): Likewise.
(vsx_load_<mode>): Disable special expander if passed an Altivec
style address.
(vsx_store_<mode>): Likewise.
gcc/testsuite/
PR target/98959
* gcc.target/powerpc/pr98959.c: New test.
Nathan Sidwell [Mon, 8 Mar 2021 18:01:21 +0000 (10:01 -0800)]
c++: Incorrect specialization hash table [PR 99285]
Class template partial specializations need to be in the
specialization hash, but not all of them. This defers adding
streamed-in entities to the hash table, in the same way I deferred
adding the instantiation and specialization lists for 99170.
PR c++/99285
gcc/cp/
* cp-tree.h (match_mergeable_specialization)
(add_mergeable_specialization): Adjust parms.
* module.cc (trees_in::decl_value): Adjust
add_mergeable_specialization calls.
(trees_out::key_mergeable): Adjust match_mergeable_specialization
calls.
(specialization_add): Likewise.
* pt.c (match_mergeable_specialization): Do not insert.
(add_mergeable_specialization): Add to hash table here.
gcc/testsuite/
* g++.dg/modules/pr99285_a.H: New.
* g++.dg/modules/pr99285_b.H: New.
Kyrylo Tkachov [Mon, 8 Mar 2021 15:05:21 +0000 (15:05 +0000)]
aarch64: Fix PR99437 - tighten shift predicates for narrowing shift patterns
In this bug combine forms the (R)SHRN(2) instructions with an invalid shift amount.
The intrinsic expanders for these patterns validate the right shift amount but if the
final patterns end up being matched by combine (or other RTL passes I suppose) they
still let the wrong const_vector through.
This patch tightens up the predicates for the instructions involved by using predicates
for the right shift amount const_vectors.
gcc/ChangeLog:
PR target/99437
* config/aarch64/predicates.md (aarch64_simd_shift_imm_vec_qi): Define.
(aarch64_simd_shift_imm_vec_hi): Likewise.
(aarch64_simd_shift_imm_vec_si): Likewise.
(aarch64_simd_shift_imm_vec_di): Likewise.
* config/aarch64/aarch64-simd.md (aarch64_shrn<mode>_insn_le): Use
predicate from above.
(aarch64_shrn<mode>_insn_be): Likewise.
(aarch64_rshrn<mode>_insn_le): Likewise.
(aarch64_rshrn<mode>_insn_be): Likewise.
(aarch64_shrn2<mode>_insn_le): Likewise.
(aarch64_shrn2<mode>_insn_be): Likewise.
(aarch64_rshrn2<mode>_insn_le): Likewise.
(aarch64_rshrn2<mode>_insn_be): Likewise.
gcc/testsuite/ChangeLog:
PR target/99437
* gcc.target/aarch64/simd/pr99437.c: New test.
Martin Liska [Mon, 8 Mar 2021 14:52:03 +0000 (15:52 +0100)]
libsanitizer: cherry-pick
ad294e572bc5c16f9dc420cc994322de6ca3fbfb
libsanitizer/ChangeLog:
PR sanitizer/98920
* asan/asan_interceptors.cpp (COMMON_INTERCEPT_FUNCTION_VER):
Cherry pick.
(COMMON_INTERCEPT_FUNCTION_VER_UNVERSIONED_FALLBACK): Likewise.
* asan/asan_interceptors.h (ASAN_INTERCEPT_FUNC_VER_UNVERSIONED_FALLBACK): Likewise.
* sanitizer_common/sanitizer_common_interceptors.inc
(COMMON_INTERCEPT_FUNCTION_GLIBC_VER_MIN): Likewise.
(INIT_REGEX): Likewise.
* tsan/tsan_interceptors_posix.cpp (COMMON_INTERCEPT_FUNCTION_VER_UNVERSIONED_FALLBACK):
Likewise.
gcc/testsuite/ChangeLog:
PR sanitizer/98920
* c-c++-common/asan/pr98920.c: New test.
Vladimir N. Makarov [Mon, 8 Mar 2021 14:24:57 +0000 (09:24 -0500)]
[PR99422] LRA: Skip modifiers when processing memory address.
Function process_address_1 can wrongly look at constraint modifiers
instead of the 1st constraint itself. The patch solves the problem.
gcc/ChangeLog:
PR target/99422
* lra-constraints.c (skip_contraint_modifiers): New function.
(process_address_1): Use it before lookup_constraint call.
Martin Liska [Mon, 8 Mar 2021 11:08:37 +0000 (12:08 +0100)]
i386: Enable UINTR and HRESET for -march that supports it
gcc/ChangeLog:
PR target/99463
* config/i386/i386-options.c (ix86_option_override_internal):
Enable UINTR and HRESET for -march that supports it.
gcc/testsuite/ChangeLog:
PR target/99463
* gcc.target/i386/pr99463-2.c: New test.
* gcc.target/i386/pr99463.c: New test.
Ilya Leoshkevich [Thu, 10 Dec 2020 14:43:59 +0000 (15:43 +0100)]
IBM Z: Fix usage of "f" constraint with long doubles
After switching the s390 backend to store long doubles in vector
registers, "f" constraint broke when used with the former: long doubles
correspond to TFmode, which in combination with "f" corresponds to
hard regs %v0-%v15, however, asm users expect a %f0-%f15 pair.
Fix by using TARGET_MD_ASM_ADJUST hook to convert TFmode values to
FPRX2mode and back.
gcc/ChangeLog:
2020-12-14 Ilya Leoshkevich <iii@linux.ibm.com>
* config/s390/s390.c (f_constraint_p): New function.
(s390_md_asm_adjust): Implement TARGET_MD_ASM_ADJUST.
(TARGET_MD_ASM_ADJUST): Likewise.
gcc/testsuite/ChangeLog:
2020-12-14 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/vector/long-double-asm-commutative.c: New
test.
* gcc.target/s390/vector/long-double-asm-earlyclobber.c: New
test.
* gcc.target/s390/vector/long-double-asm-in-out.c: New test.
* gcc.target/s390/vector/long-double-asm-inout.c: New test.
* gcc.target/s390/vector/long-double-asm-matching.c: New test.
* gcc.target/s390/vector/long-double-asm-regmem.c: New test.
* gcc.target/s390/vector/long-double-volatile-from-i64.c: New
test.
Tobias Burnus [Mon, 8 Mar 2021 12:05:48 +0000 (13:05 +0100)]
tree-nested: Update assert for Fortran module vars [PR97927]
gcc/ChangeLog:
PR fortran/97927
* tree-nested.c (convert_local_reference_stmt): Avoid calling
lookup_field_for_decl for Fortran module (= namespace context).
gcc/testsuite/ChangeLog:
PR fortran/97927
* gfortran.dg/module_variable_3.f90: New test.
Andreas Krebbel [Mon, 8 Mar 2021 11:49:22 +0000 (12:49 +0100)]
IBM Z: Fix vcond-shift.c testcase.
Due to a common code change the comparison in the testcase is emitted
via vec_cmp instead of vcond. The testcase checks for an optimization
currently only available via vcond.
Fixed by implementing the same optimization also in
s390_expand_vec_compare.
gcc/ChangeLog:
* config/s390/s390.c (s390_expand_vec_compare): Implement <0
comparison with arithmetic right shift.
(s390_expand_vcond): No need for a force_reg anymore.
s390_vec_compare will do it.
* config/s390/vector.md ("vec_cmp<mode><tointvec>"): Accept also
immediate operands.
GCC Administrator [Mon, 8 Mar 2021 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Sun, 7 Mar 2021 09:27:28 +0000 (10:27 +0100)]
i386: Fix some -mavx512vl -mno-avx512bw bugs [PR99321]
As I wrote in the mail with the previous PR99321 fix, we have various
bugs where we emit instructions that need avx512bw and avx512vl
ISAs when compiling with -mavx512vl -mno-avx512bw.
Without the following patch, the attached testcase fails with:
/tmp/ccW4PsfG.s: Assembler messages:
/tmp/ccW4PsfG.s:9: Error: unsupported instruction `vpaddb'
/tmp/ccW4PsfG.s:20: Error: unsupported instruction `vpaddb'
/tmp/ccW4PsfG.s:31: Error: unsupported instruction `vpaddw'
/tmp/ccW4PsfG.s:42: Error: unsupported instruction `vpaddw'
/tmp/ccW4PsfG.s:53: Error: unsupported instruction `vpsubb'
/tmp/ccW4PsfG.s:64: Error: unsupported instruction `vpsubb'
/tmp/ccW4PsfG.s:75: Error: unsupported instruction `vpsubw'
/tmp/ccW4PsfG.s:86: Error: unsupported instruction `vpsubw'
/tmp/ccW4PsfG.s:97: Error: unsupported instruction `vpmullw'
/tmp/ccW4PsfG.s:108: Error: unsupported instruction `vpmullw'
/tmp/ccW4PsfG.s:133: Error: unsupported instruction `vpminub'
/tmp/ccW4PsfG.s:144: Error: unsupported instruction `vpminuw'
/tmp/ccW4PsfG.s:155: Error: unsupported instruction `vpminuw'
/tmp/ccW4PsfG.s:166: Error: unsupported instruction `vpminsb'
/tmp/ccW4PsfG.s:177: Error: unsupported instruction `vpminsb'
/tmp/ccW4PsfG.s:202: Error: unsupported instruction `vpminsw'
/tmp/ccW4PsfG.s:227: Error: unsupported instruction `vpmaxub'
/tmp/ccW4PsfG.s:238: Error: unsupported instruction `vpmaxuw'
/tmp/ccW4PsfG.s:249: Error: unsupported instruction `vpmaxuw'
/tmp/ccW4PsfG.s:260: Error: unsupported instruction `vpmaxsb'
/tmp/ccW4PsfG.s:271: Error: unsupported instruction `vpmaxsb'
/tmp/ccW4PsfG.s:296: Error: unsupported instruction `vpmaxsw'
We already have Yw constraint which is equivalent to v for
-mavx512bw -mavx512vl and to nothing otherwise, per discussions
this patch changes it to stand for x otherwise. As it is an
undocumented internal constraint, hopefully it won't affect
any inline asm in the wild.
For the instructions that need both we need to use Yw and
v for modes that don't need that.
2021-03-07 Jakub Jelinek <jakub@redhat.com>
PR target/99321
* config/i386/constraints.md (Yw): Use SSE_REGS if TARGET_SSE
but TARGET_AVX512BW or TARGET_AVX512VL is not set. Adjust description
and comment.
* config/i386/sse.md (v_Yw): New define_mode_attr.
(*<insn><mode>3, *mul<mode>3<mask_name>, *avx2_<code><mode>3,
*sse4_1_<code><mode>3<mask_name>): Use <v_Yw> instead of v
in constraints.
* config/i386/mmx.md (mmx_pshufw_1, *vec_dupv4hi): Use Yw instead of
xYw in constraints.
* lib/target-supports.exp
(check_effective_target_assembler_march_noavx512bw): New effective
target.
* gcc.target/i386/avx512vl-pr99321-1.c: New test.
GCC Administrator [Sun, 7 Mar 2021 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Patrick Palka [Sat, 6 Mar 2021 22:09:07 +0000 (17:09 -0500)]
c++: Fix constexpr evaluation of pre-increment when !lval [PR99287]
Here, during cxx_eval_increment_expression (with lval=false) of
++__first where __first is &"mystr"[0], we correctly update __first
to &"mystr"[1] but we end up returning &"mystr"[0] + 1 instead of
&"mystr"[1]. This unreduced return value inhibits other pointer
arithmetic folding during later constexpr evaluation, which ultimately
causes the constexpr evaluation to fail.
It turns out the simplification of &"mystr"[0] + 1 to &"mystr"[1]
is performed by cxx_fold_pointer_plus_expression, not by fold_build2.
So we perform this simplification during constexpr evaluation of
the temporary MODIFY_EXPR (during which we assign to __first the
simplified value), but then we return 'mod' which has only been folded
via fold_build2 and hasn't gone through cxx_fold_pointer_plus_expression.
This patch fixes this by updating 'mod' with the result of the
MODIFY_EXPR evaluation appropriately, so that it captures any additional
folding of the expression when !lval. We now need to be wary of this
evaluation failing and returning e.g. the MODIFY_EXPR or NULL_TREE; it
seems checking *non_constant_p should cover our bases here and is
generally prudent.
gcc/cp/ChangeLog:
PR c++/99287
* constexpr.c (cxx_eval_increment_expression): Pass lval when
evaluating the MODIFY_EXPR, and update 'mod' with the result of
this evaluation. Check *non_constant_p afterwards. For prefix
ops, just return 'mod'.
gcc/testsuite/ChangeLog:
PR c++/99287
* g++.dg/cpp2a/constexpr-99287.C: New test.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Julian Brown [Sat, 6 Mar 2021 19:07:26 +0000 (19:07 +0000)]
middle-end: Pretty-print address space of aggregates
This patch adds printing of "<address-space-N>" markers for aggregates
in non-default address spaces.
gcc/
* tree-pretty-print.c (dump_generic_node): Emit non-generic
address space info for aggregates.
Iain Buclaw [Sat, 6 Mar 2021 17:18:44 +0000 (18:18 +0100)]
d: Don't set default flag_complex_method.
D doesn't need C99-like requirements for complex multiply and divide,
the default set by common.opt is sufficient enough.
gcc/d/ChangeLog:
* d-lang.cc (d_init_options_struct): Don't set default
flag_complex_method.
Jakub Jelinek [Sat, 6 Mar 2021 15:22:27 +0000 (16:22 +0100)]
libgcov: Fix build on Darwin [PR99406]
As reported, bootstrap currently fails on older Darwin because MAP_ANONYMOUS
is not defined.
The following is what gcc/system.h does, so I think it should work for
libgcov.
2021-03-06 Jakub Jelinek <jakub@redhat.com>
PR gcov-profile/99406
* libgcov.h (MAP_FAILED, MAP_ANONYMOUS): If HAVE_SYS_MMAN_H is
defined, define these macros if not defined already.
Jakub Jelinek [Sat, 6 Mar 2021 10:11:30 +0000 (11:11 +0100)]
libstdc++: Improve std::rot[lr] [PR99396]
As can be seen on:
unsigned char f1 (unsigned char x, int y) { return std::rotl (x, y); }
unsigned char f2 (unsigned char x, int y) { return std::rotr (x, y); }
unsigned short f3 (unsigned short x, int y) { return std::rotl (x, y); }
unsigned short f4 (unsigned short x, int y) { return std::rotr (x, y); }
unsigned int f5 (unsigned int x, int y) { return std::rotl (x, y); }
unsigned int f6 (unsigned int x, int y) { return std::rotr (x, y); }
unsigned long int f7 (unsigned long int x, int y) { return std::rotl (x, y); }
unsigned long int f8 (unsigned long int x, int y) { return std::rotr (x, y); }
unsigned long long int f9 (unsigned long long int x, int y) { return std::rotl (x, y); }
unsigned long long int f10 (unsigned long long int x, int y) { return std::rotr (x, y); }
//unsigned __int128 f11 (unsigned __int128 x, int y) { return std::rotl (x, y); }
//unsigned __int128 f12 (unsigned __int128 x, int y) { return std::rotr (x, y); }
constexpr auto a = std::rotl (1234U, 0);
constexpr auto b = std::rotl (1234U, 5);
constexpr auto c = std::rotl (1234U, -5);
constexpr auto d = std::rotl (1234U, -__INT_MAX__ - 1);
the current <bit> definitions of std::__rot[lr] aren't pattern recognized
as rotates, they are too long/complex for that, starting with signed modulo,
special case for 0 and different cases for positive and negative.
For types with power of two bits the following patch adds definitions that
the compiler can pattern recognize and turn e.g. on x86_64 into ro[lr][bwlq]
instructions. For weirdo types like unsigned __int20 etc. it keeps the
current definitions.
2021-03-06 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/99396
* include/std/bit (__rotl, __rotr): Add optimized variants for power of
two _Nd which the compiler can pattern match the rotates.
Patrick Palka [Sat, 6 Mar 2021 05:07:43 +0000 (00:07 -0500)]
c++: Fix tsubsting member variable template-id [PR96330]
This makes tsubst_copy appropriately handle a variable template-id, which
in turn fixes tsubsting a COMPONENT_REF whose member operand is known at
parse time to be a variable template-id, as in the initialization of 'x'
in the first testcase. Previously, we rejected this testcase with the
error "foo_t::bar<T> is not a function template", issued from
lookup_template_fuction.
We were already properly handling the analagous case where the object
operand of the COMPONENT_REF is dependent (and so the member operand is
a dependent template name), but there doesn't seems to be existing test
coverage for this, hence the second testcase below.
gcc/cp/ChangeLog:
PR c++/96330
* pt.c (tsubst_copy) <case TEMPLATE_ID_EXPR>: Rename local
variable 'fn' to 'tmpl'. Handle a variable template-id by
calling lookup_template_variable.
gcc/testsuite/ChangeLog:
PR c++/96330
* g++.dg/cpp1y/var-templ68.C: New test.
* g++.dg/cpp1y/var-templ68a.C: New test.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Patrick Palka [Sat, 6 Mar 2021 05:07:35 +0000 (00:07 -0500)]
c++: adc_unify deduction with constrained auto [PR99365]
My recent r11-7454 changed the way do_auto_deduction handles constrained
placeholders during template argument deduction (context == adc_unify)
when processing_template_decl != 0. Before the patch, we would just
ignore the constraints on the placeholder, and return the deduced type.
After the patch, we now punt and return the original placeholder type
While this change fixed instances where we'd prematurely resolve a
constrained placeholder return or variable type with non-dependent
initializer at template parse time (such as PR96444), it broke the
adc_unify callers that rely on the previous behavior.
This patch restores the previous behavior during adc_unify deduction
while retaining the new behavior only during adc_variable_type or
adc_return_type deduction.
We additionally now need to pass the outer template arguments to
do_auto_deduction during unify, for sake of constraint checking.
But we want to avoid substituting these outer arguments into type
when the caller has already done so, so this patch adds a
TEMPLATE_TYPE_LEVEL check to do_auto_deduction to that effect.
This above is enough to fix partial specialization of non-nested
templates with constrained 'auto' template parameters, but it doesn't
fix the nested template case, ultimately because
most_specialized_partial_spec passes only the innermost template
arguments to get_partial_spec_bindings, and so outer_targs during
do_auto_deduction (called from unify) contains only the innermost
template arguments, and this breaks satisfaction. Fixing this properly
is perhaps too risky at this stage, so this patch adds a hack to
do_auto_deduction to compensate for callers that don't supply all outer
template arguments. The goal of this hack is to ensure placeholder type
constraint checking continues to work whenever it worked before
r11-7454, namely whenever the constraint is non-dependent.
Finally, this patch allows do_auto_deduction to resolve a constrained
placeholder type ahead of time (at template parse time), as long as the
constraint is non-dependent.
gcc/cp/ChangeLog:
PR c++/99365
* pt.c (unify) <case TEMPLATE_TYPE_PARM>: Pass targs as
outer_targs to do_auto_deduction.
(placeholder_type_constraint_dependent_p): Define.
(do_auto_deduction): When processing_template_decl != 0
and context is adc_unify and we have constraints, pretend the
constraints are satisfied instead of punting. Otherwise don't
punt unless placeholder_type_constraint_dependent_p holds.
Add some clarifying sanity checks. Add a hack to add missing
outermost template levels to outer_args before checking
satisfaction. Don't substitute outer_targs into type if it's
already been done.
gcc/testsuite/ChangeLog:
PR c++/99365
* g++.dg/cpp2a/concepts-partial-spec9.C: New test.
* g++.dg/cpp2a/concepts-placeholder4.C: New test.