Richard Sandiford [Thu, 8 Apr 2021 14:00:04 +0000 (15:00 +0100)]
testsuite: Fix Advanced SIMD failures for SVE
This patch just adds some missing +nosve directives to Advanced
SIMD vectorisation tests.
gcc/testsuite/
* gcc.target/aarch64/asimd-mull-elem.c: Add +nosve.
* gcc.target/aarch64/pr98772.c: Likewise.
* gcc.target/aarch64/simd/vect_su_add_sub.c: Likewise.
Richard Sandiford [Thu, 8 Apr 2021 14:00:03 +0000 (15:00 +0100)]
testsuite: Fix sve/mul_2.c failures
Some sve/mul_2.c tests were failing because we'd (reasonably)
decided to use shifts and adds instead of MULs for some simple
negative constants. We'd already needed to avoid that when
picking positive constants, so this patch does the same thing
for the negative ones.
gcc/testsuite/
* gcc.target/aarch64/sve/mul_2.c: Adjust negative constants to avoid
conversion to shifts and adds.
Jonathan Wakely [Thu, 8 Apr 2021 13:48:23 +0000 (14:48 +0100)]
maintainer-scripts: Disable multilib when generating libstdc++ docs
This allows the docs to be generated on hosts without the necessary
files present for multilib support.
maintainer-scripts/ChangeLog:
* generate_libstdcxx_web_docs: Add --disable-multilib to
configure command.
Jonathan Wakely [Thu, 8 Apr 2021 13:47:47 +0000 (14:47 +0100)]
libstdc++: Fix Doxygen warning about ambiguous file name
libstdc++-v3/ChangeLog:
* include/std/string_view: Adjust Doxygen @file comment.
David Malcolm [Thu, 8 Apr 2021 13:46:03 +0000 (09:46 -0400)]
analyzer: fix leak false +ves due to maybe-clobbered regions [PR99042,PR99774]
Prior to this patch, program_state::detect_leaks worked by finding all
live svalues in the old state and in the new state, and calling
on_svalue_leak for each svalue that has changed from being live to
not being live.
PR analyzer/99042 and PR analyzer/99774 both describe false leak
diagnostics from -fanalyzer (a false FILE * leak in git, and a false
malloc leak in qemu, respectively).
In both cases the root cause of the false leak diagnostic relates to
svalues no longer being explicitly bound in the store due to regions
being conservatively clobbered, due to an unknown function being
called, or due to a write through a pointer that could alias the
region, respectively.
We have a transition from an svalue being explicitly live to not
being explicitly live - but only because the store is being
conservative, clobbering the binding. The leak detection is looking
for transitions from "definitely live" to "not definitely live",
when it should be looking for transitions from "definitely live"
to "definitely not live".
This patch introduces a new class to temporarily capture information
about svalues that were explicitly live, but for which a region bound
to them got clobbered for conservative reasons. This new
"uncertainty_t" class is passed around to capture the data long enough
for use in program_state::detect_leaks, where it is used to only
complain about svalues that were definitely live and are now both
not definitely live *or* possibly-live i.e. definitely not-live.
The class also captures for which svalues we can't meaningfully track
sm-state anymore, and resets the svalues back to the "start" state.
Together, these changes fix the false leak reports.
gcc/analyzer/ChangeLog:
PR analyzer/99042
PR analyzer/99774
* engine.cc
(impl_region_model_context::impl_region_model_context): Add
uncertainty param and use it to initialize m_uncertainty.
(impl_region_model_context::get_uncertainty): New.
(impl_sm_context::get_fndecl_for_call): Add NULL for new
uncertainty param when constructing impl_region_model_context.
(impl_sm_context::get_state): Likewise.
(impl_sm_context::set_next_state): Likewise.
(impl_sm_context::warn): Likewise.
(exploded_node::on_stmt): Add uncertainty param
and use it when constructing impl_region_model_context.
(exploded_node::on_edge): Add uncertainty param and pass
to on_edge call.
(exploded_node::detect_leaks): Create uncertainty_t and pass to
impl_region_model_context.
(exploded_graph::get_or_create_node): Create uncertainty_t and
pass to prune_for_point.
(maybe_process_run_of_before_supernode_enodes): Create
uncertainty_t and pass to impl_region_model_context.
(exploded_graph::process_node): Create uncertainty_t instances and
pass around as needed.
* exploded-graph.h
(impl_region_model_context::impl_region_model_context): Add
uncertainty param.
(impl_region_model_context::get_uncertainty): New decl.
(impl_region_model_context::m_uncertainty): New field.
(exploded_node::on_stmt): Add uncertainty param.
(exploded_node::on_edge): Likewise.
* program-state.cc (sm_state_map::on_liveness_change): Get
uncertainty from context and use it to unset sm-state from
svalues as appropriate.
(program_state::on_edge): Add uncertainty param and use it when
constructing impl_region_model_context. Fix indentation.
(program_state::prune_for_point): Add uncertainty param and use it
when constructing impl_region_model_context.
(program_state::detect_leaks): Get any uncertainty from ctxt and
use it to get maybe-live svalues for dest_state, rather than
definitely-live ones; use this when determining which svalues
have leaked.
(selftest::test_program_state_merging): Create uncertainty_t and
pass to impl_region_model_context.
* program-state.h (program_state::on_edge): Add uncertainty param.
(program_state::prune_for_point): Likewise.
* region-model-impl-calls.cc (call_details::get_uncertainty): New.
(region_model::impl_call_memcpy): Pass uncertainty to
mark_region_as_unknown call.
(region_model::impl_call_memset): Likewise.
(region_model::impl_call_strcpy): Likewise.
* region-model-reachability.cc (reachable_regions::handle_sval):
Also add sval to m_mutable_svals.
* region-model.cc (region_model::on_assignment): Pass any
uncertainty from ctxt to the store::set_value call.
(region_model::handle_unrecognized_call): Get any uncertainty from
ctxt and use it to record mutable svalues at the unknown call.
(region_model::get_reachable_svalues): Add uncertainty param and
use it to mark any maybe-bound svalues as being reachable.
(region_model::set_value): Pass any uncertainty from ctxt to the
store::set_value call.
(region_model::mark_region_as_unknown): Add uncertainty param and
pass it on to the store::mark_region_as_unknown call.
(region_model::update_for_call_summary): Add uncertainty param and
pass it on to the region_model::mark_region_as_unknown call.
* region-model.h (call_details::get_uncertainty): New decl.
(region_model::get_reachable_svalues): Add uncertainty param.
(region_model::mark_region_as_unknown): Add uncertainty param.
(region_model_context::get_uncertainty): New vfunc.
(noop_region_model_context::get_uncertainty): New vfunc
implementation.
* store.cc (dump_svalue_set): New.
(uncertainty_t::dump_to_pp): New.
(uncertainty_t::dump): New.
(binding_cluster::clobber_region): Pass NULL for uncertainty to
remove_overlapping_bindings.
(binding_cluster::mark_region_as_unknown): Add uncertainty param
and pass it to remove_overlapping_bindings.
(binding_cluster::remove_overlapping_bindings): Add uncertainty param.
Use it to record any svalues that were in clobbered bindings.
(store::set_value): Add uncertainty param. Pass it to
binding_cluster::mark_region_as_unknown when handling symbolic
regions.
(store::mark_region_as_unknown): Add uncertainty param and pass it
to binding_cluster::mark_region_as_unknown.
(store::remove_overlapping_bindings): Add uncertainty param and
pass it to binding_cluster::remove_overlapping_bindings.
* store.h (binding_cluster::mark_region_as_unknown): Add
uncertainty param.
(binding_cluster::remove_overlapping_bindings): Likewise.
(store::set_value): Likewise.
(store::mark_region_as_unknown): Likewise.
gcc/testsuite/ChangeLog:
PR analyzer/99042
PR analyzer/99774
* gcc.dg/analyzer/pr99042.c: New test.
* gcc.dg/analyzer/pr99774-1.c: New test.
* gcc.dg/analyzer/pr99774-2.c: New test.
Iain Buclaw [Tue, 14 Apr 2020 07:29:10 +0000 (09:29 +0200)]
d: Update language attribute support, and implement gcc.attributes
D attribute support has been updated to have a baseline parity with the
LLVM D compiler's own `ldc.attributes'.
The handler that extracts GCC attributes from a list of UDAs has been
improved to take care of some mistakes that could have been warnings.
UDAs attached to field variables are also now processed for any GCC
attributes attached to them.
The following new attributes have been added to the D front-end:
- @attribute("alloc_size")
- @attribute("used")
- @attribute("optimize")
- @attribute("restrict")
- @attribute("cold")
- @attribute("noplt")
- @attribute("target_clones")
- @attribute("no_icf")
- @attribute("noipa")
- @attribute("symver")
With convenience aliases in a new `gcc.attributes' module to match
the same naming convention as `ldc.attributes':
- @allocSize()
- @assumeUsed
- @fastmath
- @naked
- @restrict
- @cold
- @noplt
- @optStrategy()
- @polly
- @section()
- @target()
- @weak
The old gcc.attribute module has been deprecated, along with the removal
of the following attribute handlers:
- @attribute("alias"): Has been superseded by `pragma(mangle)'.
- @attribute("forceinline"): Renamed to always_inline.
gcc/d/ChangeLog:
* d-attribs.cc: Include fold-const.h and opts.h.
(attr_noreturn_exclusions): Add alloc_size.
(attr_const_pure_exclusions): Likewise.
(attr_inline_exclusions): Add target_clones.
(attr_noinline_exclusions): Rename forceinline to always_inline.
(attr_target_exclusions): New array.
(attr_target_clones_exclusions): New array.
(attr_alloc_exclusions): New array.
(attr_cold_hot_exclusions): New array.
(d_langhook_common_attribute_table): Add new D attribute handlers.
(build_attributes): Update to look for gcc.attributes. Issue warning
if not given a struct literal. Handle void initialized arguments.
(handle_always_inline_attribute): Remove function.
(d_handle_noinline_attribute): Don't extract TYPE_LANG_FRONTEND.
(d_handle_forceinline_attribute): Rename to...
(d_handle_always_inline_attribute): ...this. Remove special handling.
(d_handle_flatten_attribute): Don't extract TYPE_LANG_FRONTEND.
(d_handle_target_attribute): Likewise. Warn about empty arguments.
(d_handle_target_clones_attribute): New function.
(optimize_args): New static variable.
(parse_optimize_options): New function.
(d_handle_optimize_attribute): New function.
(d_handle_noclone_attribute): Don't extract TYPE_LANG_FRONTEND.
(d_handle_alias_attribute): Remove function.
(d_handle_noicf_attribute): New function.
(d_handle_noipa_attribute): New function.
(d_handle_section_attribute): Call the handle_generic_attribute target
hook after performing target independent processing.
(d_handle_symver_attribute): New function.
(d_handle_noplt_attribute): New function.
(positional_argument): New function.
(d_handle_alloc_size_attribute): New function.
(d_handle_cold_attribute): New function.
(d_handle_restrict_attribute): New function.
(d_handle_used_attribute): New function.
* decl.cc (gcc_attribute_p): Update to look for gcc.attributes.
(get_symbol_decl): Update decl source location of old prototypes to
the new declaration being merged.
* types.cc (layout_aggregate_members): Apply user defined attributes
on fields.
libphobos/ChangeLog:
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
gcc/attributes.d.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/gcc/attribute.d: Deprecate module, publicly import
gcc.attributes.
* libdruntime/gcc/deh.d: Update imports.
* libdruntime/gcc/attributes.d: New file.
gcc/testsuite/ChangeLog:
* gdc.dg/gdc108.d: Update test.
* gdc.dg/gdc142.d: Likewise.
* gdc.dg/pr90136a.d: Likewise.
* gdc.dg/pr90136b.d: Likewise.
* gdc.dg/pr90136c.d: Likewise.
* gdc.dg/pr95173.d: Likewise.
* gdc.dg/attr_allocsize1.d: New test.
* gdc.dg/attr_allocsize2.d: New test.
* gdc.dg/attr_alwaysinline1.d: New test.
* gdc.dg/attr_cold1.d: New test.
* gdc.dg/attr_exclusions1.d: New test.
* gdc.dg/attr_exclusions2.d: New test.
* gdc.dg/attr_flatten1.d: New test.
* gdc.dg/attr_module.d: New test.
* gdc.dg/attr_noclone1.d: New test.
* gdc.dg/attr_noicf1.d: New test.
* gdc.dg/attr_noinline1.d: New test.
* gdc.dg/attr_noipa1.d: New test.
* gdc.dg/attr_noplt1.d: New test.
* gdc.dg/attr_optimize1.d: New test.
* gdc.dg/attr_optimize2.d: New test.
* gdc.dg/attr_optimize3.d: New test.
* gdc.dg/attr_optimize4.d: New test.
* gdc.dg/attr_restrict1.d: New test.
* gdc.dg/attr_section1.d: New test.
* gdc.dg/attr_symver1.d: New test.
* gdc.dg/attr_target1.d: New test.
* gdc.dg/attr_targetclones1.d: New test.
* gdc.dg/attr_used1.d: New test.
* gdc.dg/attr_used2.d: New test.
* gdc.dg/attr_weak1.d: New test.
* gdc.dg/imports/attributes.d: New test.
Martin Liska [Thu, 8 Apr 2021 13:20:04 +0000 (15:20 +0200)]
Fix wrong assert in branch_changer.py.
maintainer-scripts/ChangeLog:
* branch_changer.py: Fix wrongly converted assert.
Martin Liska [Thu, 8 Apr 2021 12:45:01 +0000 (14:45 +0200)]
Modernize branch_changer.py script.
maintainer-scripts/ChangeLog:
* branch_changer.py: Modernize and fix flake8 issues.
* setup.cfg: New file.
Jason Merrill [Thu, 8 Apr 2021 05:03:28 +0000 (01:03 -0400)]
c++: improve specialization mismatch diagnostic [PR94529]
We were telling users they needed more template<> to specialize a member
template in a testcase with no member templates. Only produce that message
if we actually see a member template, and also always print the candidates.
gcc/cp/ChangeLog:
PR c++/94529
* pt.c (determine_specialization): Improve diagnostic.
gcc/testsuite/ChangeLog:
PR c++/94529
* g++.dg/template/mem-spec2.C: New test.
Marek Polacek [Wed, 7 Apr 2021 20:44:24 +0000 (16:44 -0400)]
c++: Fix ICE with unexpanded parameter pack [PR99844]
In explicit17.C, we weren't detecting an unexpanded parameter pack in
explicit(bool), so we crashed on a TEMPLATE_PARM_INDEX in constexpr.
I noticed the same is true for noexcept(), but only since my patch to
implement delayed parsing of noexcept. Previously, we would detect the
unexpanded pack in push_template_decl but now the noexcept expression
has not yet been parsed, so we need to do it a bit later.
gcc/cp/ChangeLog:
PR c++/99844
* decl.c (build_explicit_specifier): Call
check_for_bare_parameter_packs.
* except.c (build_noexcept_spec): Likewise.
gcc/testsuite/ChangeLog:
PR c++/99844
* g++.dg/cpp2a/explicit16.C: Use c++20.
* g++.dg/cpp0x/noexcept66.C: New test.
* g++.dg/cpp2a/explicit17.C: New test.
Jonathan Wakely [Thu, 8 Apr 2021 11:18:01 +0000 (12:18 +0100)]
libstdc++: Remove bogus ChangeLog entry
Jonathan Wakely [Thu, 8 Apr 2021 09:50:57 +0000 (10:50 +0100)]
libstdc++: Make std::is_scoped_enum work with incomplete types
Tim Song pointed out that using __underlying_type is ill-formed for
incomplete enumeration types, and is_scoped_enum doesn't require a
complete type. This changes the trait to check for conversion to int
instead of to the underlying type.
In order to give the correct result when the trait is used in the
enumerator-list of an incomplete type the partial specialization for
enums has an additional check that fails for incomplete types. This
assumes that an incompelte enumeration type must be an unscoped
enumeration, and so the primary template (with a std::false_type base
characteristic) can be used. This isn't necessarily true, but it is not
currently possible to refer to a scoped enumeration type before its type
is complete (PR c++/89025).
It should be possible to use requires(remove_cv_t<_Tp> __t) in the
partial specialization's assignablility check, but that currently gives
an ICE (PR c++/99968) so there is an extra partial specialization of
is_scoped_enum<const _Tp> to handle const types.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_scoped_enum<T>): Constrain partial
specialization to not match incomplete enum types. Use a
requires-expression instead of instantiating is_convertible.
(is_scoped_enum<const T>): Add as workaround for PR c++/99968.
* testsuite/20_util/is_scoped_enum/value.cc: Check with
incomplete types and opaque-enum-declarations.
Alex Coplan [Thu, 8 Apr 2021 08:36:57 +0000 (09:36 +0100)]
arm: Various MVE vec_duplicate fixes [PR99647]
This patch fixes various issues with vec_duplicate in the MVE patterns.
Currently there are two patterns named *mve_mov<mode>. The second of
these is really a vector duplicate rather than a move, so I've renamed
it accordingly.
As it stands, there are several issues with this pattern:
1. The MVE_types iterator has an entry for TImode, but
vec_duplicate:TI is invalid.
2. The mode of the operand to vec_duplicate is SImode, but it should
vary according to the vector mode iterator.
3. The second alternative of this pattern is bogus: it allows matching
symbol_refs (the cause of the PR) and const_ints (which means that it
matches (vec_duplicate (const_int ...)) which is non-canonical: such
rtxes should be const_vectors instead and handled by the main vector
move pattern).
This patch fixes all of these issues, and removes the redundant
*mve_vec_duplicate<mode> pattern.
gcc/ChangeLog:
PR target/99647
* config/arm/iterators.md (MVE_vecs): New.
(V_elem): Also handle V2DF.
* config/arm/mve.md (*mve_mov<mode>): Rename to ...
(*mve_vdup<mode>): ... this. Remove second alternative since
vec_duplicate of const_int is not canonical RTL, and we don't
want to match symbol_refs.
(*mve_vec_duplicate<mode>): Delete (pattern is redundant).
gcc/testsuite/ChangeLog:
PR target/99647
* gcc.c-torture/compile/pr99647.c: New test.
Xionghu Luo [Wed, 7 Apr 2021 05:29:32 +0000 (00:29 -0500)]
Improve rtx insn vec output
print_rtl will dump the rtx_insn from current until LAST. But it is only
useful to see the particular insn that called by print_rtx_insn_vec,
Let's call print_rtl_single to display that insn in the gcse and store-motion
pass dump.
2021-04-07 Xionghu Luo <luoxhu@linux.ibm.com>
gcc/ChangeLog:
* fold-const.c (fold_single_bit_test): Fix typo.
* print-rtl.c (print_rtx_insn_vec): Call print_rtl_single
instead.
GCC Administrator [Thu, 8 Apr 2021 00:16:44 +0000 (00:16 +0000)]
Daily bump.
Jason Merrill [Wed, 7 Apr 2021 20:42:44 +0000 (16:42 -0400)]
c++: friend with redundant qualification [PR41723]
Different code paths were correctly choosing to look up D directly, since C
is the current instantiation, but here we decided to try to make it a
typename type, leading to confusion. Fixed by using dependent_scope_p as we
do elsewhere.
gcc/cp/ChangeLog:
PR c++/41723
* parser.c (cp_parser_class_name): Check dependent_scope_p.
gcc/testsuite/ChangeLog:
PR c++/41723
* g++.dg/template/friend71.C: New test.
Jason Merrill [Wed, 7 Apr 2021 19:38:07 +0000 (15:38 -0400)]
c++: base template friend [PR52625]
Here we were mistakenly treating the injected-class-name as a partial
specialization.
gcc/cp/ChangeLog:
PR c++/52625
* pt.c (maybe_process_partial_specialization): Check
DECL_SELF_REFERENCE_P.
gcc/testsuite/ChangeLog:
PR c++/52625
* g++.dg/template/friend70.C: New test.
Jason Merrill [Wed, 7 Apr 2021 18:55:48 +0000 (14:55 -0400)]
c++: using overloaded with local decl [PR92918]
The problem here was that the lookup for 'impl' when parsing the template
only found the using-declaration, not the member function declaration.
This happened because when trying to add the member function declaration,
push_class_level_binding_1 saw that the current binding was a USING_DECL and
the new value is an overload, and decided to just return success.
That 'return true' dates back to r69921. In
https://gcc.gnu.org/pipermail/gcc-patches/2003-July/110632.html Nathan
mentions that we only push dependent USING_DECLs, which is no longer the
case; now that we retain more USING_DECLs, handling this case like the other
overloaded function cases seems like the obvious solution.
gcc/cp/ChangeLog:
PR c++/92918
* name-lookup.c (push_class_level_binding_1): Do overload a new
function with a previous using-declaration.
gcc/testsuite/ChangeLog:
PR c++/92918
* g++.dg/lookup/using66.C: New test.
Richard Sandiford [Wed, 7 Apr 2021 18:46:37 +0000 (19:46 +0100)]
testsuite: Fix many UNRESOLVEDs for gcc.dg/vect
It turns out that, on targets that use testglue, many gcc.dg/vect
scan-dump tests became UNRESOLVED after the change to the dump
file naming scheme.
The problem is that, when creating an executable, we normally name
the dump file after both the executable and the source file name.
However, as an exception, we name it after only the source file
name if:
(a) there is only one source file name and
(b) the source file and the executable have the same basename
Both (a) and (b) are normally true when building executables from
gcc.dg/vect. But (a) is not true when linking against testglue.
The harness was therefore looking for a dump file based only on the
source file name while the compiler was producing a dump file that
contained both names.
We get around this for dg-additional-sources using:
# This option restores naming of aux and dump output files
# after input files when multiple input files are named,
# instead of getting them combined with the output name.
lappend options "additional_flags=-dumpbase \"\""
This patch does the same thing for executables that are linked
against testglue. This removes over 2400 UNRESOLVEDs from an
armeb-eabi test run, but in so doing introduces FAILs for some
tests that were previously skipped.
gcc/testsuite/
* lib/gcc.exp (gcc_target_compile): Add -dumpbase ""
when building an executable with testglue.
Jonathan Wakely [Wed, 7 Apr 2021 15:05:42 +0000 (16:05 +0100)]
libstdc++: Fix filesystem::path construction from COW string [PR 99805]
Calling the non-const data() member on a COW string makes it "leaked",
possibly resulting in reallocating the string to ensure a unique owner.
The path::_M_split_cmpts() member parses its _M_pathname string using
string_view objects and then calls _M_pathname.data() to find the offset
of each string_view from the start of the string. However because
_M_pathname is non-const that will cause a COW string to reallocate if
it happens to be shared with another string object. This results in the
offsets calculated for each component being wrong (i.e. undefined)
because the string views no longer refer to substrings of the
_M_pathname member. The fix is to use the parse.offset(c) member which
gets the offset safely.
The bug only happens for the path(string_type&&) constructor and only
for COW strings. When constructed from an lvalue string the string's
contents are copied rather than just incrementing the refcount, so
there's no reallocation when calling the non-const data() member. The
testsuite changes check the lvalue case anyway, because we should
probably change the deep copying to just be a refcount increment (by
adding a path(const string_type&) constructor or an overload for
__effective_range(const string_type&), for COW strings only).
libstdc++-v3/ChangeLog:
PR libstdc++/99805
* src/c++17/fs_path.cc (path::_M_split_cmpts): Do not call
non-const member on _M_pathname, to avoid copy-on-write.
* testsuite/27_io/filesystem/path/decompose/parent_path.cc:
Check construction from strings that might be shared.
Richard Sandiford [Wed, 7 Apr 2021 14:21:56 +0000 (15:21 +0100)]
vect: Restore variable-length SLP permutes [PR97513]
Many of the gcc.target/sve/slp-perm*.c tests started failing
after the introduction of separate SLP permute nodes.
This patch adds variable-length support using a similar
technique to vect_transform_slp_perm_load.
As there, the idea is to detect when every permute mask vector
is the same and can be generated using a regular stepped sequence.
We can easily handle those cases for variable-length, but still
need to restrict the general case to constant-length.
Again copying vect_transform_slp_perm_load, the idea is to distinguish
the two cases regardless of whether the length is variable or not,
partly to increase testing coverage and partly because it avoids
generating redundant trees.
Doing this means that we can also use SLP for the two-vector
permute in pr88834.c, which we couldn't before VEC_PERM_EXPR
nodes were introduced. The patch therefore makes pr88834.c
check that we don't regress back to not using SLP and adds
pr88834_ld3.c to check for the original problem in the PR.
gcc/
PR tree-optimization/97513
* tree-vect-slp.c (vect_add_slp_permutation): New function,
split out from...
(vectorizable_slp_permutation): ...here. Detect cases in which
all VEC_PERM_EXPRs are guaranteed to have the same stepped
permute vector and only generate one permute vector for that case.
Extend that case to handle variable-length vectors.
gcc/testsuite/
* gcc.target/aarch64/sve/pr88834.c: Expect the vectorizer to use SLP.
* gcc.target/aarch64/sve/pr88834_ld3.c: New test.
Richard Sandiford [Wed, 7 Apr 2021 14:21:55 +0000 (15:21 +0100)]
vect: Don't split store groups if we have IFN_STORE_LANES [PR99873]
As noted in the PR, we were no longer using ST3 for the testcase and
instead stored each lane individually. This is because we'd split
the store group during SLP and couldn't recover when SLP failed.
However, we can also get better code with ST3 and ST4 even if SLP would
have succeeded, such as for vect-complex-5.c. I'm not sure exactly
where the cut-off point is, but it seems reasonable to allow the split
if either of the new groups would operate on full vectors *within*
rather than across scalar loop iterations.
E.g. on a Cortex-A57, pr99873_3.c performs better using ST4 while
pr99873_2.c performs better with SLP.
Another factor is that SLP can handle smaller iteration counts than
IFN_STORE_LANES can, but we don't have the infrastructure to choose
reliably based on that.
gcc/
PR tree-optimization/99873
* tree-vect-slp.c (vect_slp_prefer_store_lanes_p): New function.
(vect_build_slp_instance): Don't split store groups that could
use IFN_STORE_LANES.
gcc/testsuite/
* gcc.dg/vect/slp-21.c: Only expect 2 of the loops to use SLP
if IFN_STORE_LANES is available.
* gcc.dg/vect/vect-complex-5.c: Expect no loops to use SLP if
IFN_STORE_LANES is available.
* gcc.target/aarch64/pr99873_1.c: New test.
* gcc.target/aarch64/pr99873_2.c: Likewise.
* gcc.target/aarch64/pr99873_3.c: Likewise.
* gcc.target/aarch64/sve/pr99873_1.c: Likewise.
* gcc.target/aarch64/sve/pr99873_2.c: Likewise.
* gcc.target/aarch64/sve/pr99873_3.c: Likewise.
Jakub Jelinek [Wed, 7 Apr 2021 13:51:15 +0000 (15:51 +0200)]
varasm: Fix up constpool alias handling [PR99872]
Last year, I have added in r11-2944-g0106300f6c3f7bae5eb1c46dbd45aa07c94e1b15
(aka PR54201 fix) code to find bitwise duplicates in constant pool and output
them as aliases instead of duplicating the data.
Unfortunately this broke mingw32 -m32.
On most targets, ASM_GENERATE_INTERNAL_LABEL with "LC" emits something like
*.LC123 and the targets don't add user label prefixes, so the aliases
that we print should be something like
.set .LC5, .LC6
or
.set .LC5, .LC6 + 8
and I wasn't sure if ASM_OUTPUT_DEF can handle the * and therefore I have
stripped it.
But, on mingw32 -m32, ASM_GENERATE_INTERNAL_LABEL with "LC" emits
*LC123 and the target has user label prefixes, which means what I wrote
results in
LC6:
...
.set _LC5, _LC6
which results in unresolved symbols. I went through the ASM_OUTPUT_DEF
definitions of all targets and all of them use assemble_name twice under
the hood (with various differences on what they print before, in between or
after those names). And assemble_name handles the name encoding properly,
so if we pass it ASM_OUTPUT_DEF (..., "*.LC123", "*.LC456+16") it will
emit .LC123 and .LC456+16 and if we pass it "*LC789", it will emit
LC789.
2021-04-07 Jakub Jelinek <jakub@redhat.com>
PR target/99872
* varasm.c (output_constant_pool_contents): Don't strip name encoding
from XSTR (desc->sym, 0) or from label before passing those to
ASM_OUTPUT_DEF.
Richard Biener [Wed, 7 Apr 2021 11:17:05 +0000 (13:17 +0200)]
tree-optimization/99954 - fix loop distribution memcpy classification
This fixes bogus classification of a copy as memcpy. We cannot use
plain dependence analysis to decide between memcpy and memmove when
it computes no dependence. Instead we have to try harder later which
the patch does for the gcc.dg/tree-ssa/ldist-24.c testcase by resorting
to tree-affine to compute the difference between src and dest and
compare against the copy size.
2021-04-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/99954
* tree-loop-distribution.c: Include tree-affine.h.
(generate_memcpy_builtin): Try using tree-affine to prove
non-overlap.
(loop_distribution::classify_builtin_ldst): Always classify
as PKIND_MEMMOVE.
* gcc.dg/torture/pr99954.c: New testcase.
Richard Biener [Wed, 7 Apr 2021 11:21:23 +0000 (13:21 +0200)]
testsuite/99955 - fix may_alias declaration of vector
This fixes the order of the type attributes to preserve may_alias
for the vector type.
2021-04-07 Richard Biener <rguenther@suse.de>
PR testsuite/99955
* gcc.c-torture/execute/pr92618.c: Move may_alias attributes
last.
Richard Biener [Wed, 7 Apr 2021 08:02:07 +0000 (10:02 +0200)]
tree-optimization/99947 - avoid v.safe_push (v[0])
This avoids (again) the C++ pitfall of pushing a reference to
sth being reallocated.
2021-04-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/99947
* tree-vect-loop.c (vectorizable_induction): Pre-allocate
steps vector to avoid pushing elements from the reallocated
vector.
* gcc.dg/torture/pr99947.c: New testcase.
Richard Biener [Wed, 7 Apr 2021 07:09:09 +0000 (09:09 +0200)]
Add debug_vn_reference_ops helper
This factors out a helper to dump VN reference operands, sth that
proves useful in debugging VN issues.
2021-04-07 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.h (print_vn_reference_ops): Declare.
* tree-ssa-pre.c (print_pre_expr): Factor out VN reference operand
printing...
* tree-ssa-sccvn.c (print_vn_reference_ops): ... into this new
function.
(debug_vn_reference_ops): New.
Bin Cheng [Wed, 7 Apr 2021 02:24:32 +0000 (10:24 +0800)]
tree-optimization/98736 - use programing order preserved RPO in ldist
Tree loop distribution uses RPO to build reduced dependence graph,
it's important that RPO preserves the original programing order.
Though it usually does so, when distributing loop nest, exit BB can
be placed before some loop BBs while after loop header. This patch
fixes the issue by calling rev_post_order_and_mark_dfs_back_seme.
gcc/ChangeLog:
PR tree-optimization/98736
* tree-loop-distribution.c
* (loop_distribution::bb_top_order_init):
Compute RPO with programing order preserved by calling function
rev_post_order_and_mark_dfs_back_seme.
gcc/testsuite/ChangeLog:
PR tree-optimization/98736
* gcc.c-torture/execute/pr98736.c: New test.
Marek Polacek [Wed, 7 Apr 2021 02:17:33 +0000 (22:17 -0400)]
c++: Add test for Core issue 1376 [PR52202]
As Jens says in the PR, we handle this correctly.
gcc/testsuite/ChangeLog:
PR c++/52202
* g++.dg/cpp0x/rv-life.C: New test.
GCC Administrator [Wed, 7 Apr 2021 00:16:39 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Tue, 6 Apr 2021 22:41:14 +0000 (22:41 +0000)]
Update gcc de.po.
* de.po: Update.
Joseph Myers [Tue, 6 Apr 2021 22:32:29 +0000 (22:32 +0000)]
Update gcc sv.po.
* sv.po: Update.
Jason Merrill [Tue, 6 Apr 2021 19:13:02 +0000 (15:13 -0400)]
c++: access checking in aggregate initialization [PR96673]
We were deferring access checks while parsing B<int>{}, didn't adjust that
when we went to instantiate the default member initializer for B::c,
deferred access checking for C::C, and then checked it after parsing
B<int>{}, back in the main() context which has no access. We need to do the
access checks in the class context of the DMI.
I tried fixing this in push_to/pop_from_top_level, but that caused several
regressions.
gcc/cp/ChangeLog:
PR c++/96673
* init.c (get_nsdmi): Don't defer access checking.
gcc/testsuite/ChangeLog:
PR c++/96673
* g++.dg/cpp1y/nsdmi-aggr13.C: New test.
Jason Merrill [Tue, 6 Apr 2021 05:21:05 +0000 (01:21 -0400)]
c++: C++17 constexpr static data member linkage [PR99901]
C++17 makes constexpr static data members implicitly inline variables. In
C++14, a subsequent out-of-class declaration is the definition. We want to
continue emitting a symbol for such a declaration in C++17 mode, for ABI
compatibility with C++14 code that wants to refer to it.
Normally I'd distinguish in- and out-of-class declarations by looking at
DECL_IN_AGGR_P, but we never set DECL_IN_AGGR_P on inline variables. I
think that's wrong, but don't want to mess with it so close to release.
Conveniently, we already have a test for in-class declaration earlier in the
function.
gcc/cp/ChangeLog:
PR c++/99901
* decl.c (cp_finish_decl): mark_needed an implicitly inline
static data member with an out-of-class redeclaration.
gcc/testsuite/ChangeLog:
PR c++/99901
* g++.dg/cpp1z/inline-var9.C: New test.
Iain Buclaw [Tue, 6 Apr 2021 11:12:54 +0000 (13:12 +0200)]
d: Fix missing call to va_end in getMatchError [PR99917]
Reviewed-on: https://github.com/dlang/dmd/pull/12380
gcc/d/ChangeLog:
PR d/99917
* dmd/MERGE: Merge upstream dmd
d16195406.
Iain Buclaw [Tue, 23 Jun 2020 08:46:52 +0000 (10:46 +0200)]
d: Use Array::find to get index of element
gcc/d/ChangeLog:
* d-codegen.cc (build_frame_type): Use Array::find to get index of
element.
Iain Buclaw [Wed, 3 Jun 2020 09:51:12 +0000 (11:51 +0200)]
d: Increment gaggedWarnings if warning or deprecation message was suppressed
gcc/d/ChangeLog:
* d-diagnostic.cc (vwarning): Increment gaggedWarnings if warning
message was suppressed.
(vdeprecation): Likewise for deprecation messages.
Iain Buclaw [Mon, 5 Apr 2021 12:05:28 +0000 (14:05 +0200)]
d: Merge upstream dmd
5cc71ff83, druntime
1134b710
D front-end changes:
- Fix ICEs that occurred when using opaque enums.
- Update `pragma(printf)' checking code to work on 16-bit targets.
Phobos change:
- Don't compile in argTypes code on AArch64
Reviewed-on: https://github.com/dlang/dmd/pull/12378
https://github.com/dlang/druntime/pull/3431
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
5cc71ff83.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
1134b710.
Jonathan Wakely [Tue, 6 Apr 2021 13:41:29 +0000 (14:41 +0100)]
libstdc++: Add nodiscard attribute to cast-like functions
Add [[nodiscard]] to functions that are effectively just a static_cast,
as per P2351. Also add it to std::addressof.
libstdc++-v3/ChangeLog:
* include/bits/move.h (forward, move, move_if_noexcept)
(addressof): Add _GLIBCXX_NODISCARD.
* include/bits/ranges_cmp.h (identity::operator()): Add
nodiscard attribute.
* include/c_global/cstddef (to_integer): Likewise.
* include/std/bit (bit_cast): Likewise.
* include/std/utility (as_const, to_underlying): Likewise.
Jonathan Wakely [Tue, 6 Apr 2021 15:34:48 +0000 (16:34 +0100)]
libstdc++: Clarify static_assert message
libstdc++-v3/ChangeLog:
* include/bits/move.h (forward): Change static_assert message
to be unambiguous about what must be true.
* testsuite/20_util/forward/c_neg.cc: Adjust dg-error.
* testsuite/20_util/forward/f_neg.cc: Likewise.
Jonathan Wakely [Tue, 6 Apr 2021 15:24:06 +0000 (16:24 +0100)]
libstdc++: Fix Doxygen warnings
libstdc++-v3/ChangeLog:
* include/bits/alloc_traits.h: Use markdown for code font.
* include/bits/basic_string.h: Fix @param names.
* include/bits/max_size_type.h: Remove period after @file.
* include/bits/regex.h: Fix duplicate @retval names, and rename.
* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add
group open to match existing group close.
* include/ext/pb_ds/priority_queue.hpp: Add blank line before group
open.
Jonathan Wakely [Tue, 6 Apr 2021 14:52:19 +0000 (15:52 +0100)]
libstdc++: Fix doxygen markup for group close commands
A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by
Doxygen, so doesn't close a @{ group. A "///" comment needs to be used.
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h: Fix doxygen group close.
* include/bits/basic_ios.h: Likewise.
* include/bits/forward_list.h: Likewise.
* include/bits/fs_dir.h: Likewise.
* include/bits/fs_ops.h: Likewise.
* include/bits/fs_path.h: Likewise.
* include/bits/functional_hash.h: Likewise.
* include/bits/gslice.h: Likewise.
* include/bits/gslice_array.h: Likewise.
* include/bits/hashtable_policy.h: Likewise.
* include/bits/indirect_array.h: Likewise.
* include/bits/locale_classes.h: Likewise.
* include/bits/locale_facets.h: Likewise.
* include/bits/locale_facets_nonio.h: Likewise.
* include/bits/mask_array.h: Likewise.
* include/bits/refwrap.h: Likewise.
* include/bits/regex.h: Likewise.
* include/bits/regex_automaton.h: Likewise.
* include/bits/regex_compiler.h: Likewise.
* include/bits/regex_constants.h: Likewise.
* include/bits/regex_error.h: Likewise.
* include/bits/regex_executor.h: Likewise.
* include/bits/regex_scanner.h: Likewise.
* include/bits/shared_ptr.h: Likewise.
* include/bits/shared_ptr_atomic.h: Likewise.
* include/bits/shared_ptr_base.h: Likewise.
* include/bits/slice_array.h: Likewise.
* include/bits/specfun.h: Likewise.
* include/bits/std_function.h: Likewise.
* include/bits/std_mutex.h: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_iterator.h: Likewise.
* include/bits/stl_iterator_base_types.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_numeric.h: Likewise.
* include/bits/stl_pair.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_uninitialized.h: Likewise.
* include/bits/stream_iterator.h: Likewise.
* include/bits/streambuf_iterator.h: Likewise.
* include/bits/unique_ptr.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/decimal/decimal: Likewise.
* include/experimental/any: Likewise.
* include/experimental/array: Likewise.
* include/experimental/bits/fs_dir.h: Likewise.
* include/experimental/bits/fs_fwd.h: Likewise.
* include/experimental/bits/fs_ops.h: Likewise.
* include/experimental/bits/fs_path.h: Likewise.
* include/experimental/buffer: Likewise.
* include/experimental/internet: Likewise.
* include/experimental/optional: Likewise.
* include/experimental/propagate_const: Likewise.
* include/experimental/socket: Likewise.
* include/ext/pb_ds/assoc_container.hpp: Likewise.
* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp:
Likewise.
* include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise.
* include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise.
* include/ext/pb_ds/detail/types_traits.hpp: Likewise.
* include/ext/pb_ds/exception.hpp: Likewise.
* include/ext/pb_ds/priority_queue.hpp: Likewise.
* include/ext/pb_ds/tag_and_trait.hpp: Likewise.
* include/ext/random: Likewise.
* include/std/any: Likewise.
* include/std/atomic: Likewise.
* include/std/bitset: Likewise.
* include/std/chrono: Likewise.
* include/std/complex: Likewise.
* include/std/condition_variable: Likewise.
* include/std/fstream: Likewise.
* include/std/future: Likewise.
* include/std/iostream: Likewise.
* include/std/istream: Likewise.
* include/std/mutex: Likewise.
* include/std/numeric: Likewise.
* include/std/ostream: Likewise.
* include/std/ratio: Likewise.
* include/std/shared_mutex: Likewise.
* include/std/stdexcept: Likewise.
* include/std/streambuf: Likewise.
* include/std/system_error: Likewise.
* include/std/thread: Likewise.
* include/std/valarray: Likewise.
* include/std/variant: Likewise.
* include/tr1/cmath: Likewise.
* include/tr1/regex: Likewise.
* include/tr2/dynamic_bitset: Likewise.
* libsupc++/atomic_lockfree_defines.h: Likewise.
* libsupc++/exception: Likewise.
* libsupc++/exception.h: Likewise.
* libsupc++/exception_ptr.h: Likewise.
* libsupc++/nested_exception.h: Likewise.
libstdc++-v3/ChangeLog:
* include/tr1/regex:
Vladimir N. Makarov [Wed, 31 Mar 2021 17:26:30 +0000 (13:26 -0400)]
[PR99781] Update correctly reg notes in LRA for multi-registers and set up biggest mode safely
The PR is about incorrect use of partial_subreg_p for unordered modes.
I found 2 places of dangerous comparing unordered modes in LRA. The
patch removes dangerous use of paradoxical_subreg_p and
partial_subreg_p in split_reg and process_bb_lives. The both places
used them to solve PR77761 long time ago. But the problem was also
fixed by later patches too (if there is no hard reg explicitly, it
have VOIDmode and we use natural mode to split hard reg live,
otherwise we use the biggest explicitly used mode for hard reg
splitting). The PR also says about inaccurate update of reg notes in
LRA. It happens for reg notes which refer for multi-registers. The
patch also fixes this issue.
gcc/ChangeLog:
PR target/99781
* lra-constraints.c (split_reg): Don't check paradoxical_subreg_p.
* lra-lives.c (clear_sparseset_regnos, regnos_in_sparseset_p): New
functions.
(process_bb_lives): Don't update biggest mode of hard reg for
implicit in multi-register group. Use the new functions for
updating dead_set and unused_set by register notes.
gcc/testsuite/ChangeLog:
PR target/99781
* g++.target/aarch64/sve/pr99781.C: New.
Xianmiao Qu [Tue, 6 Apr 2021 12:19:15 +0000 (20:19 +0800)]
C-SKY: Describe ck802 bypass accurately.
Fix the following warning:
insn-automata.c: In function ‘int maximal_insn_latency(rtx_insn*)’:
insn-automata.c:679:37: warning: array subscript -1 is below array bounds of ‘const unsigned char [19]’ [-Warray-bounds]
679 | return default_latencies[insn_code];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
insn-automata.c:397:30: note: while referencing ‘default_latencies’
397 | static const unsigned char default_latencies[] =
|
gcc/
* config/csky/csky_pipeline_ck802.md : Use insn reservation name
instead of *.
H.J. Lu [Fri, 12 Mar 2021 00:56:26 +0000 (16:56 -0800)]
x86: Update memcpy/memset inline strategies for Skylake family CPUs
Simply memcpy and memset inline strategies to avoid branches for
Skylake family CPUs:
1. With MOVE_RATIO and CLEAR_RATIO == 17, GCC will use integer/vector
load and store for up to 16 * 16 (256) bytes when the data size is
fixed and known.
2. Inline only if data size is known to be <= 256.
a. Use "rep movsb/stosb" with simple code sequence if the data size
is a constant.
b. Use loop if data size is not a constant.
3. Use memcpy/memset libray function if data size is unknown or > 256.
On Cascadelake processor with -march=native -Ofast -flto,
1. Performance impacts of SPEC CPU 2017 rate are:
500.perlbench_r 0.17%
502.gcc_r -0.36%
505.mcf_r 0.00%
520.omnetpp_r 0.08%
523.xalancbmk_r -0.62%
525.x264_r 1.04%
531.deepsjeng_r 0.11%
541.leela_r -1.09%
548.exchange2_r -0.25%
557.xz_r 0.17%
Geomean -0.08%
503.bwaves_r 0.00%
507.cactuBSSN_r 0.69%
508.namd_r -0.07%
510.parest_r 1.12%
511.povray_r 1.82%
519.lbm_r 0.00%
521.wrf_r -1.32%
526.blender_r -0.47%
527.cam4_r 0.23%
538.imagick_r -1.72%
544.nab_r -0.56%
549.fotonik3d_r 0.12%
554.roms_r 0.43%
Geomean 0.02%
2. Significant impacts on eembc benchmarks are:
eembc/idctrn01 9.23%
eembc/nnet_test 29.26%
gcc/
* config/i386/x86-tune-costs.h (skylake_memcpy): Updated.
(skylake_memset): Likewise.
(skylake_cost): Change CLEAR_RATIO to 17.
* config/i386/x86-tune.def (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB):
Replace m_CANNONLAKE, m_ICELAKE_CLIENT, m_ICELAKE_SERVER,
m_TIGERLAKE and m_SAPPHIRERAPIDS with m_SKYLAKE and m_CORE_AVX512.
gcc/testsuite/
* gcc.target/i386/memcpy-strategy-9.c: New test.
* gcc.target/i386/memcpy-strategy-10.c: Likewise.
* gcc.target/i386/memcpy-strategy-11.c: Likewise.
* gcc.target/i386/memset-strategy-7.c: Likewise.
* gcc.target/i386/memset-strategy-8.c: Likewise.
* gcc.target/i386/memset-strategy-9.c: Likewise.
Richard Biener [Tue, 6 Apr 2021 11:20:44 +0000 (13:20 +0200)]
tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs
This adds a relevancy check before trying to set the vector def of
a backedge in an unvectorized PHI.
2021-04-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/99880
* tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only
set vectorized defs of relevant PHIs.
* gcc.dg/torture/pr99880.c: New testcase.
Nathan Sidwell [Tue, 6 Apr 2021 12:04:28 +0000 (05:04 -0700)]
c++: Simplify va_arg test
The va_arg scans are just too brittle. Let's not be that picky. We
have other tested builtins that are less brittle now anyway.
gcc/testsuite/
* g++.dg/modules/builtin-3_a.C: Remove dump scans.
* g++.dg/modules/builtin-3_b.C: Remove dump scans.
Nathan Sidwell [Tue, 6 Apr 2021 12:03:03 +0000 (05:03 -0700)]
libcody: Remove FSF license
Apparently this was never needed.
libcody/
* LICENSE.gcc: Delete.
Jakub Jelinek [Tue, 6 Apr 2021 10:44:51 +0000 (12:44 +0200)]
testsuite: Fix up pr96573.c on aarch64 [PR96573]
On Thu, Apr 01, 2021 at 02:16:55PM +0100, Alex Coplan via Gcc-patches wrote:
> FYI, I'm seeing the new test failing on aarch64:
>
> PASS: gcc.dg/pr96573.c (test for excess errors)
> FAIL: gcc.dg/pr96573.c scan-tree-dump optimized "__builtin_bswap"
The vectorizer in the aarch64 case manages to emit a VEC_PERM_EXPR instead
(which is just as efficient).
So, do we want to go for the following (and/or perhaps also restrict the test to
a couple of targets where it works? In my last distro build it failed only
on aarch64-linux, while armv7hl-linux-gnueabi and
{i686,x86_64,powerpc64le,s390x}-linux were fine)?
2021-04-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96573
* gcc.dg/pr96573.c: Instead of __builtin_bswap accept also
VEC_PERM_EXPR with bswapping permutation.
Richard Biener [Tue, 6 Apr 2021 09:21:47 +0000 (11:21 +0200)]
tree-optimization/99924 - visit permute nodes again when partitioning
Since SLP graph partitioning works on scalar stmts (because it's done
for costing) we have to make sure to visit permute nodes multiple
times since they will not pull partitions together.
2021-04-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/99924
* tree-vect-slp.c (vect_bb_partition_graph_r): Do not mark
nodes w/o scalar stmts as visited.
* gfortran.dg/vect/pr99924.f90: New testcase.
Jakub Jelinek [Tue, 6 Apr 2021 09:46:32 +0000 (11:46 +0200)]
testsuite: Fix up g++.dg/ext/vector40.C test
The test FAILs on i686-linux due to -Wpsabi diagnostics.
2021-04-06 Jakub Jelinek <jakub@redhat.com>
PR c++/97900
* g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options.
Alex Coplan [Tue, 6 Apr 2021 08:06:27 +0000 (09:06 +0100)]
arm: Fix PCS for SFmode -> SImode libcalls [PR99748]
This patch fixes PR99748 which shows us trying to pass the argument to
__aeabi_f2iz in the VFP register s0 when the library function is
expecting to use the GPR r0. It also fixes the __aeabi_f2uiz case which
was broken in the same way.
For the testcase in the PR, here is the code we generate before the
patch (with -mfloat-abi=hard -march=armv8.1-m.main+mve -O0):
main:
push {r7, lr}
sub sp, sp, #8
add r7, sp, #0
mov r3, #
1065353216
str r3, [r7, #4] @ float
vldr.32 s0, [r7, #4]
bl __aeabi_f2iz
mov r3, r0
cmp r3, #1
[...]
This becomes:
main:
push {r7, lr}
sub sp, sp, #8
add r7, sp, #0
mov r3, #
1065353216
str r3, [r7, #4] @ float
ldr r0, [r7, #4] @ float
bl __aeabi_f2iz
mov r3, r0
cmp r3, #1
[...]
after the patch. We see a similar change for the same testcase with a
cast to unsigned instead of int.
gcc/ChangeLog:
PR target/99748
* config/arm/arm.c (arm_libcall_uses_aapcs_base): Also use base
PCS for [su]fix_optab.
Jason Merrill [Tue, 6 Apr 2021 02:50:44 +0000 (22:50 -0400)]
c++: mangling of lambdas in default args [PR91241]
In this testcase, the parms remembered in LAMBDA_EXPR_EXTRA_SCOPE are no
longer the parms of the FUNCTION_DECL they have as their DECL_CONTEXT, so we
were mangling both lambdas as parm #0. But since the parms are numbered
from right to left we don't need to need to find them in the FUNCTION_DECL,
we can measure their own DECL_CHAIN.
gcc/cp/ChangeLog:
PR c++/91241
* mangle.c (write_compact_number): Add sanity check.
(write_local_name): Use list_length for parm number.
gcc/testsuite/ChangeLog:
PR c++/91241
* g++.dg/abi/lambda-defarg1.C: New test.
Patrick Palka [Tue, 6 Apr 2021 03:35:56 +0000 (23:35 -0400)]
c++: placeholder type constraint in structured binding [PR99899]
In this PR, we're crashing because the constraint handling inside
do_auto_deduction doesn't expect to see an adc_decomp_type context.
This patch fixes this by treating adc_decomp_type like adc_variable_type
or adc_return_type during placeholder type constraint checking.
Meanwhile, I noticed we weren't checking constraints at all when binding
an array via a structured binding, since do_auto_deduction would exit
early and bypass the constraint check. This patch fixes this by
replacing the early exit with an appropriate setup of the 'targs'
vector.
gcc/cp/ChangeLog:
PR c++/99899
* pt.c (do_auto_deduction): Don't exit early when deducing the
array type of a structured binding. Also handle adc_decomp_type
during constraint checking.
gcc/testsuite/ChangeLog:
PR c++/99899
* g++.dg/cpp2a/concepts-placeholder7.C: New test.
* g++.dg/cpp2a/concepts-placeholder8.C: New test.
GCC Administrator [Tue, 6 Apr 2021 00:16:43 +0000 (00:16 +0000)]
Daily bump.
Jason Merrill [Mon, 5 Apr 2021 20:22:51 +0000 (16:22 -0400)]
c++: -Wunused, constant, and generic lambda [PR96311]
We never called mark_use for a return value in a function with dependent
return type. In that situation we don't know if the use is as an rvalue or
lvalue, but we can use mark_exp_read instead.
gcc/cp/ChangeLog:
PR c++/96311
* typeck.c (check_return_expr): Call mark_exp_read in dependent
case.
gcc/testsuite/ChangeLog:
PR c++/96311
* g++.dg/cpp1y/lambda-generic-Wunused.C: New test.
Jason Merrill [Mon, 5 Apr 2021 19:50:48 +0000 (15:50 -0400)]
c++: reinterpret_cast from prvalue to rvalue ref [PR98440]
In r260622 I allowed this under the general principle that [basic.lval]
"Whenever a prvalue appears as an operand of an operator that expects a
glvalue for that operand, the temporary materialization conversion (7.3.4)
is applied to convert the expression to an xvalue." But
[expr.reinterpret.cast] specifically excludes creating a temporary in this
case.
gcc/cp/ChangeLog:
PR c++/98440
* typeck.c (build_reinterpret_cast_1): Don't perform
temporary materialization.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error.
* g++.dg/cpp0x/reinterpret_cast2.C: Adjust message.
* g++.old-deja/g++.jason/rvalue3.C: Likewise.
Jason Merrill [Mon, 5 Apr 2021 18:26:03 +0000 (14:26 -0400)]
c++: enum in generic lambda in template [PR95317]
Here we weren't instantiating the enumerators because the arglist still had
the template parameter for the generic lambda, so looking one up failed. We
need to instantiate if the non-lambda enclosing scope is non-dependent.
gcc/cp/ChangeLog:
PR c++/95317
* pt.c (lookup_template_class_1): Do tsubst_enum when
tsubsting a generic lambda.
gcc/testsuite/ChangeLog:
PR c++/95317
* g++.dg/cpp1y/lambda-generic-enum1.C: New test.
Jason Merrill [Mon, 5 Apr 2021 15:34:48 +0000 (11:34 -0400)]
c++: lambda in DMI in class template [PR95870]
Here enclosing_instantiation_of was failing to find a match because otctx is
struct S<T> and current_function_decl is S<int>::S(), so the latter has more
function contexts, and we end up trying to compare S() to NULL_TREE.
After spending a bit of time working on establishing the correspondence in
this case (class <=> constructor), it occurred to me that we could just use
DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
redeclared. Since we're so close to release, for now I'm only doing this
for the case that was failing before.
gcc/cp/ChangeLog:
PR c++/95870
* pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION if
there is no enclosing non-lambda function.
gcc/testsuite/ChangeLog:
PR c++/95870
* g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.
Eric Botcazou [Mon, 5 Apr 2021 17:49:56 +0000 (19:49 +0200)]
Fix small regression with -fdump-ada-spec
When the enumeration constants of an enumeration type are defined by
explicit values, the binding generated by -fdump-ada-spec does not use
an enumeration type on the Ada side, because the set of allowed values
in C/C++ is larger than the set of allowed values in Ada, but instead
use an integer subtype and defines a set of explicit constants, which
used to be of this subtype but were changed to the base type at some
point. This reinstates the subtype for them.
gcc/c-family/
* c-ada-spec.c (is_simple_enum): Minor tweaks.
(dump_ada_enum_type): Add TYPE and PARENT parameters. For non-simple
enumeral types use again the type name for the enumeration constants.
(dump_ada_node): Adjust call to dump_ada_enum_type.
(dump_nested_type): Likewise.
Michael Meissner [Mon, 5 Apr 2021 17:30:40 +0000 (13:30 -0400)]
Honor --disable-decimal-float on PowerPC Decimal/Float128 conversions
This patch fixes the problem that the Decimal <-> Float128 conversions
were built even if the user configured GCC with --disable-decimal-float.
libgcc/
2021-04-05 Florian Weimer <fweimer@redhat.com>
* config/rs6000/t-float128 (fp128_ppc_funcs): Add decimal floating
point functions for $(decimal_float) only.
Co-Authored-By: Michael Meissner <meissner@linux.ibm.com>
Nathan Sidwell [Mon, 5 Apr 2021 14:51:28 +0000 (07:51 -0700)]
c++: Unneeded export query [PR 99380]
This problem got introduced fixing a module numbering problem. When
preprocessing a header unit, we don't need to send an EXPORT query
unless we're also determining dependencies, or the mapper asked us
to. Sadly the testsuite isn't set up to test this kind of subtlety.
I manually did that with stdin/stdout.
PR c++/99380
gcc/cp/
* module.cc (name_pending_imports): Drop 'atend' parm. Don't
query export when not needed.
(preprocess_module, preprocessed_module): Adjust.
David Malcolm [Mon, 5 Apr 2021 14:51:46 +0000 (10:51 -0400)]
analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906]
gcc/analyzer/ChangeLog:
PR analyzer/99906
* analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL
dereference on calls with zero arguments.
* sm-malloc.cc (malloc_state_machine::on_stmt): When handling
__attribute__((nonnull)), only call get_diagnostic_tree if the
result will be used.
gcc/testsuite/ChangeLog:
PR analyzer/99906
* gcc.dg/analyzer/pr99906.c: New test.
David Malcolm [Mon, 5 Apr 2021 14:48:01 +0000 (10:48 -0400)]
analyzer: fix apparent hang with -fanalyzer-verbosity=0 [PR analyzer/99886]
The analyzer appeared to enter an infinite loop on malloc-1.c
when -fanalyzer-verbosity=0 was used. In fact, it was slowly
counting from 0 to 0xffffffff.
Root cause is looping up to effectively ((unsigned)0) - 1 in
diagnostic_manager::consolidate_conditions when there are no events
in the path.
Fixed by the following, which uses signed integers when subtracting
from path->num_events () when simplifying checker_paths.
gcc/analyzer/ChangeLog:
PR analyzer/99886
* diagnostic-manager.cc
(diagnostic_manager::prune_interproc_events): Use signed integers
when subtracting one from path->num_events ().
(diagnostic_manager::consolidate_conditions): Likewise. Convert
next_idx to a signed int.
gcc/testsuite/ChangeLog:
PR analyzer/99886
* gcc.dg/analyzer/pr99886.c: New test.
Jason Merrill [Mon, 5 Apr 2021 03:32:32 +0000 (23:32 -0400)]
c++: extern template and static data member [PR99066]
'extern template' should mean that the relevant symbols are never emitted.
But in this case we were assuming that DECL_EXTERNAL was already set on the
variable, so we just needed to clear DECL_NOT_REALLY_EXTERN. Since
DECL_EXTERNAL was not set, we emitted a definition of npos.
gcc/cp/ChangeLog:
PR c++/99066
* pt.c (mark_decl_instantiated): Set DECL_EXTERNAL.
gcc/testsuite/ChangeLog:
PR c++/99066
* g++.dg/cpp0x/extern_template-6.C: New test.
Jason Merrill [Sun, 4 Apr 2021 05:01:56 +0000 (01:01 -0400)]
c++: constexpr if and nested generic lambda [PR99201]
When building up *_EXTRA_ARGS for a constexpr if or pack expansion, we need
to walk into the body of a lambda to find all the local_specializations that
we need to remember, like we do in find_parameter_packs_r.
gcc/cp/ChangeLog:
PR c++/99201
* pt.c (class el_data): Add visited field.
(extract_local_specs): Pass it to cp_walk_tree.
(extract_locals_r): Walk into the body of a lambda.
gcc/testsuite/ChangeLog:
PR c++/99201
* g++.dg/cpp1z/constexpr-if-lambda4.C: New test.
Jason Merrill [Fri, 2 Apr 2021 09:45:02 +0000 (05:45 -0400)]
c++: Fix print-tree for TEMPLATE_DECL
The if allows TEMPLATE_DECL, but then checking DECL_MODULE_IMPORT_P crashes
on TEMPLATE_DECL. Fixed by stripping TEMPLATE_DECL first.
gcc/cp/ChangeLog:
* ptree.c (cxx_print_decl): Check DECL_MODULE_IMPORT_P on
template result.
Iain Buclaw [Sun, 14 Mar 2021 21:51:56 +0000 (22:51 +0100)]
d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914)
The default linkage of templates in the D language is now DECL_WEAK
instead of DECL_ONE_ONLY, if supported. This better matches the
expected override semantics of template symbols compiled to object code.
For example:
module rt.config;
template rt_flag()
{
pragma(mangle, "rt_flag") __gshared bool rt_flag = true;
}
module main;
extern(C) __gshared bool rt_flag = false;
The above currently does not succeed in linking due to there being
multiple definitions of `rt_flag' in different sections that aren't
considered mergeable.
The compiler flag enabling toggling of this has been given a clearer
named `-fweak-templates', which distinguishes itself from G++ `-fweak',
which is intended only for testing.
gcc/d/ChangeLog:
PR d/99914
* d-lang.cc (d_init): Disable flag_weak_templates if no support for
weak or one-only symbols.
* d-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro.
(DECL_INSTANTIATED): New macro.
(d_comdat_linkage): Remove declaration.
(d_linkonce_linkage): Remove declaration.
(set_linkage_for_decl): New declaration.
* decl.cc (DeclVisitor::visit (StructDeclaration *)): Replace call to
d_linkonce_linkage with setting DECL_INSTANTIATED.
(DeclVisitor::visit (ClassDeclaration *)): Likewise.
(DeclVisitor::visit (EnumDeclaration *)): Likewise.
(DeclVisitor::visit (InterfaceDeclaration *)): Remove call to
d_linkonce_linkage.
(get_symbol_decl): Call set_linkage_for_decl instead of
d_linkonce_linkage.
(d_finish_decl): Call set_linkage_for_decl.
(d_comdat_linkage): Made function static. Only set DECL_COMDAT for
DECL_INSTANTIATED decls.
(d_linkonce_linkage): Remove function.
(d_weak_linkage): New function.
(set_linkage_for_decl): New function.
* gdc.texi (Runtime Options): Rename -fno-weak to -fno-weak-templates,
update documentation of option.
* lang.opt (fweak): Rename option to ...
(fweak-templates): ... this. Update help string.
* modules.cc (get_internal_fn): Add Prot parameter. Set generated
function flag.
(build_internal_fn): Update call to get_internal_fn.
(build_dso_cdtor_fn): Likewise.
(register_moduleinfo): Call d_finish_decl on dso_slot_node and
dso_initialized_node.
* typeinfo.cc (TypeInfoVisitor::internal_reference): Call
set_linkage_for_decl instead of d_comdat_linkage.
(TypeInfoDeclVisitor::visit (TypeInfoDeclaration *)): Remove calls to
d_linkonce_linkage and d_comdat_linkage.
(get_cpp_typeinfo_decl): Likewise.
gcc/testsuite/ChangeLog:
PR d/99914
* gdc.dg/pr99914.d: New test.
Sandra Loosemore [Mon, 5 Apr 2021 00:55:46 +0000 (17:55 -0700)]
Trivial testsuite fixes for nios2-elf.
nios2-elf defaults to -fno-delete-null-pointer-checks, which causes
failures in tests that assume the option is enabled. Make the
dependence explicit.
2021-04-04 Sandra Loosemore <sandra@codesourcery.com>
gcc/testsuite/
* gcc.dg/ipa/propmalloc-4.c: Add -fdelete-null-pointer-checks.
* gcc.dg/tree-ssa/evrp11.c: Likewise.
GCC Administrator [Mon, 5 Apr 2021 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Jason Merrill [Sat, 3 Apr 2021 20:17:29 +0000 (16:17 -0400)]
c++: array new initialized from a call [PR99643]
Here the get_foo() call results in a TARGET_EXPR, which we strip in
massage_init_elt, but then when build_vec_init tries to use it to initialize
the array element we crash because build_aggr_init expects a class rvalue to
have a TARGET_EXPR. So don't strip it.
The stripping was added in r206639 for PR59659, so I checked that removing
it didn't significantly increase compile time or memory usage for that
testcase; compile time was unaffected, memory usage increased by 0.00004%.
gcc/cp/ChangeLog:
PR c++/99643
* typeck2.c (massage_init_elt): Don't strip TARGET_EXPR.
gcc/testsuite/ChangeLog:
PR c++/99643
* g++.dg/cpp0x/initlist-new5.C: New test.
GCC Administrator [Sun, 4 Apr 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Fri, 2 Apr 2021 11:29:22 +0000 (13:29 +0200)]
d: Merge upstream dmd
3b808e838, druntime
483bc129, phobos
f89dc217a
D front-end changes:
- Explicit package visibility attribute is now always applied to
introducing scopes.
- Added `__traits(totype, string)' to convert mangled type string to an
existing type.
- Printf-like and scanf-like functions are now detected by prefixing
them with `pragma(printf)' for printf-like functions or
`pragma(scanf)' for scanf-like functions.
- Added `__c_wchar_t', `__c_complex_float', `__c_complex_double', and
`__c_complex_real' types for interfacing with C and C++.
- Template alias parameters can now be instantiated with basic types,
such as `int` or `void function()`.
- Mixins can now be used as types in the form `mixin(string) var'.
- Mixin expressions can take an argument list, same as `pragma(msg)'.
- Implement DIP1034, add `typeof(*null)' types to represent `noreturn'.
- `pragma(msg)' can print expressions of type `void'.
- It is now an error to use private variables selectively imported from
other modules. Due to a bug, some imported private members were
visible from other modules, violating the specification.
- Added new syntax to declare an alias to a function type using the
`alias' syntax based on the assignment operator.
- Function literals can now return a value by reference.
Phobos changes:
- Synchronize C bindings with the latest port fixes in upstream druntime.
- Added alias for a `noreturn' type in object.d
- Make use of the new `pragma(printf)' and `pragma(scanf)' pragmas, fix
all code that got flagged as being incorrect.
- Fixed code that relied on bugs in the D import package system.
Reviewed-on: https://github.com/dlang/dmd/pull/12339
https://github.com/dlang/druntime/pull/3422
https://github.com/dlang/phobos/pull/7932
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
3b808e838.
* Make-lang.in (D_FRONTEND_OBJS): Add d/chkformat.o.
* d-codegen.cc (build_struct_literal): Handle special enums.
* d-convert.cc (convert_expr): Handle noreturn type.
(convert_for_condition): Likewise.
* d-target.cc (Target::_init): Set type for wchar_t.
(TargetCPP::derivedClassOffset): New method.
(Target::libraryObjectMonitors): New method.
* decl.cc (get_symbol_decl): Set TREE_THIS_VOLATILE for functions of
type noreturn.
* toir.cc (IRVisitor::visit (ReturnStatement *)): Handle returning
noreturn types.
* types.cc (TypeVisitor::visit (TypeNoreturn *)): New method.
(TypeVisitor::visit (TypeEnum *)): Handle special enums.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
483bc129.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
core/sys/darwin/fcntl.d.
(DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/unistd.d.
(DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/stdc/malloc.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos
f89dc217a.
* src/Makefile.am (PHOBOS_DSOURCES): Add std/regex/internal/tests2.d.
* src/Makefile.in: Regenerate.
* testsuite/libphobos.exceptions/chain.d: Fix format arguments.
* testsuite/libphobos.exceptions/line_trace.d: Likewise.
Alexandre Oliva [Sat, 3 Apr 2021 22:54:39 +0000 (19:54 -0300)]
initialize pr94314-3.C counter
The int counter in the main loop was uninitialized, so we might end up
looping a very large number of times before completing successfully.
I suspect that was unintended, so I'm adding a zero initializer.
for gcc/testsuite/ChangeLog
* g++.dg/pr94314-3.C: Zero-initialize main loop counter.
Alexandre Oliva [Sat, 3 Apr 2021 22:54:37 +0000 (19:54 -0300)]
silence expected psabi warning in ipa-sra-19 on ppc-vxworks
The default CPU for our ppc-vx7r2 toolchain has no support for altivec
or vsx, so an ABI without vector support is selected. The selected
calling conventions do not cover passing or returning vector types, so
-Wpsabi warns about such uses.
powerpc-ibm-aix* already silences these warnings with -Wno-psabi;
this patch extends that to powerpc-wrs-vxworks* too.
for gcc/testsuite/ChangeLog
* gcc.dg/ipa/ipa-sra-19.c: Extend -Wno-psabi to ppc-vx7r2.
Marek Polacek [Fri, 2 Apr 2021 21:11:32 +0000 (17:11 -0400)]
c++: GC during late parsing collects live data [PR91416]
Coming back to
<https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527699.html>:
This is a crash that points to a GC problem. Consider this test:
__attribute__ ((unused)) struct S {
S() { }
} s;
We're parsing a simple-declaration. While parsing the decl specs, we parse
the attribute, which means creating a TREE_LIST using ggc_alloc_*.
A function body is a complete-class context so when parsing the
member-specification of this class-specifier, we parse the bodies of the
functions we'd queued in cp_parser_late_parsing_for_member. This then
leads to this call chain:
cp_parser_function_definition_after_declarator -> expand_or_defer_fn ->
expand_or_defer_fn_1 -> maybe_clone_body -> expand_or_defer_fn ->
cgraph_node::finalize_function -> ggc_collect.
In this test, the ggc_collect call collects the TREE_LIST we had
allocated, and a crash duly ensues.
I couldn't do what Richard suggested, that is, attach the attribute list
to struct S, because we don't pass decl_specs from cp_parser_type_specifier
down to cp_parser_class_specifier. Therefore I've attempted to do "push the
decl_specifiers onto a vec that is a GC root", except I couldn't really push
the decl_specifiers, because first I'd have to mark cp_decl_specifier_seq with
GTY(()) and even that wouldn't be enough for me to be able to create
static GTY(()) vec<cp_decl_specifier_seq *, va_gc>
But here we only care about cp_decl_specifier_seq::attributes, so the
patch is just this. I've also extended the test so now we test a nested
class too.
gcc/cp/ChangeLog:
PR c++/91416
* parser.c: Create a GC root for attributes in a decl specifier.
(cp_parser_type_specifier): Push/pop ->attributes onto/from it.
gcc/testsuite/ChangeLog:
PR c++/91416
* g++.dg/other/gc7.C: New test.
Iain Sandoe [Sat, 3 Apr 2021 09:07:48 +0000 (10:07 +0100)]
Darwin : Fix out-of-bounds access to df_regs_ever_live.
During changes made for LRA (or, perhaps, even before) we omitted
a check that the current register we are working on is a hard reg
before we tried to note its liveness.
A stage 1 built with fsanitize=address catches this, as does any
attempt to build master with clang and -std=c++11.
gcc/ChangeLog:
* config/darwin.c (machopic_legitimize_pic_address): Check
that the current pic register is one of the hard reg set
before setting liveness.
Iain Sandoe [Sat, 3 Apr 2021 09:04:12 +0000 (10:04 +0100)]
Darwin : Fix whitespace and delete unused code (NFC).
Fix some incorrect indenting and remove two cases where we had
code '#if 0'-d out.
gcc/ChangeLog:
* config/darwin.c (machopic_legitimize_pic_address): Fix
whitespace, remove unused code.
Paul Thomas [Sat, 3 Apr 2021 11:49:50 +0000 (12:49 +0100)]
Fortran: Fix ICE on wrong code [PR99818].
2021-04-03 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran/ChangeLog
PR fortran/99818
* interface.c (compare_parameter): The codimension attribute is
applied to the _data field of class formal arguments.
gcc/testsuite/ChangeLog
PR fortran/99818
* gfortran.dg/coarray_48.f90: New test.
Jakub Jelinek [Sat, 3 Apr 2021 08:08:08 +0000 (10:08 +0200)]
bswap: Fix up bswap_view_convert after the recent change [PR99882]
Martin reported that my recent change to allow pointer types in bswap
broke valgrind. The bswap_view_convert function used for the initialization
of vector CONSTRUCTOR from the identity or byte-swapped pieces unfortunately
didn't handle pointer types. The following patch handles it there.
2021-04-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/99882
* gimple-ssa-store-merging.c (bswap_view_convert): Handle val with
pointer type.
* gcc.dg/pr99882.c: New test.
Jakub Jelinek [Sat, 3 Apr 2021 08:07:09 +0000 (10:07 +0200)]
dse: Fix up hard reg conflict checking in replace_read [PR99863]
Since PR37922 fix RTL DSE has hard register conflict checking
in replace_read, so that if the replacement sequence sets (or typically just
clobbers) some hard register (usually condition codes) we verify that
hard register is not live.
Unfortunately, it compares the hard reg set clobbered/set by the sequence
(regs_set) against the currently live hard register set, but it then
emits the insn sequence not at the current insn position, but before
store_insn->insn.
So, we should not compare against the current live hard register set,
but against the hard register live set at the point of the store insn.
Fortunately, we already have that remembered in store_insn->fixed_regs_live.
In addition to bootstrapping/regtesting this patch on x86_64-linux and
i686-linux, I've also added statistics gathering and it seems the only
place where we end up rejecting the replace_read is the newly added
testcase (the PR37922 is no longer effective at that) and fixed_regs_live
has been always non-NULL at the if (store_insn->fixed_regs_live) spot.
Rather than having there an assert, I chose to just keep regs_set
as is, which means in that hypothetical case where fixed_regs_live wouldn't
be computed for some store we'd still accept sequences that don't
clobber/set any hard registers and just punt on those that clobber/set
those.
2021-04-03 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/99863
* dse.c (replace_read): Drop regs_live argument. Instead of
regs_live, use store_insn->fixed_regs_live if non-NULL,
otherwise punt if insns sequence clobbers or sets any hard
registers.
* gcc.target/i386/pr99863.c: New test.
Jakub Jelinek [Sat, 3 Apr 2021 08:05:32 +0000 (10:05 +0200)]
rs6000: Fix up libgcc ABI when built with --with-long-double-format=ieee [PR97653]
__floatunditf and __fixtfdi and a couple of other libgcc{.a,_s.so}
entrypoints for backwards compatibility should mean IBM double double
handling (i.e. IFmode), gcc emits such calls for that format and
form IEEE long double emits *kf* instead.
When gcc is configured without --with-long-double-format=ieee ,
everything is fine, but when it is not, we need to compile those
libgcc sources with -mno-gnu-attribute -mabi=ibmlongdouble.
The following snippet in libgcc/config/rs6000/t-linux was attempting
to ensure that, and for some routines it works fine (e.g. for _powitf2).
But, due to 4 different types of bugs it doesn't work for most of those
functions, which means that in --with-long-double-format=ieee
configured gcc those *tf* entrypoints instead handle the long double
arguments as if they were KFmode.
The bugs are:
1) the first few objs properly use $(objext) as suffix, but
several other contain a typo and use $(object) instead,
which is a variable that isn't set to anything, so we don't
add .o etc. extensions
2) while unsigned fix are properly called _fixuns*, unsigned float
are called _floatun* (without s), but the var was using there
the extra s and so didn't match
3) the variable didn't cover any of the TF <-> TI conversions,
only TF <-> DI conversions
4) nothing in libgcc_s.so was handled, as those object files are
called *_s.o rather than *.o and IBM128_SHARED_OBJS used wrong
syntax of the GNU make substitution reference, which should be
$(var:a=b) standing for $(patsubst a,b,$(var)) but it used
$(var:a:b) instead
2021-04-03 Jakub Jelinek <jakub@redhat.com>
PR target/97653
* config/rs6000/t-linux (IBM128_STATIC_OBJS): Fix spelling, use
$(objext) instead of $(object). Use _floatunditf instead of
_floatunsditf. Add tf <-> ti conversion objects.
(IBM128_SHARED_OBJS): Use proper substitution reference syntax.
Jakub Jelinek [Sat, 3 Apr 2021 08:03:15 +0000 (10:03 +0200)]
rs6000: Avoid -fpatchable-function-entry* regressions on powerpc64 be [PR98125]
The SECTION_LINK_ORDER changes broke powerpc64-linux ELFv1. Seems
that the assembler/linker relies on the symbol mentioned for the
"awo" section to be in the same section as the symbols mentioned in
the relocations in that section (i.e. labels for the patchable area
in this case). That is the case for most targets, including powerpc-linux
32-bit or powerpc64 ELFv2 (that one has -fpatchable-function-entry*
support broken for other reasons and it doesn't seem to be a regression).
But it doesn't work on powerpc64-linux ELFv1.
We emit:
.section ".opd","aw"
.align 3
_Z3foov:
.quad .L._Z3foov,.TOC.@tocbase,0
.previous
.type _Z3foov, @function
.L._Z3foov:
.section __patchable_function_entries,"awo",@progbits,_Z3foov
.align 3
.8byte .LPFE1
.section .text._Z3foov,"axG",@progbits,_Z3foov,comdat
.LPFE1:
nop
.LFB0:
.cfi_startproc
and because _Z3foov is in the .opd section rather than the function text
section, it doesn't work.
I'm afraid I don't know what exactly should be done, whether e.g.
it could use
.section __patchable_function_entries,"awo",@progbits,.L._Z3foov
instead, or whether the linker should be changed to handle it as is, or
something else.
But because we have a P1 regression that didn't see useful progress over the
4 months since it has been filed and we don't really have much time, below
is an attempt to do a targetted reversion of H.J's patch, basically act as
if HAVE_GAS_SECTION_LINK_ORDER is never true for powerpc64-linux ELFv1,
but for 32-bit or 64-bit ELFv2 keep working as is.
This would give us time to resolve it for GCC 12 properly.
2021-04-03 Jakub Jelinek <jakub@redhat.com>
PR testsuite/98125
* targhooks.h (default_print_patchable_function_entry_1): Declare.
* targhooks.c (default_print_patchable_function_entry_1): New function,
copied from default_print_patchable_function_entry with an added flags
argument.
(default_print_patchable_function_entry): Rewritten into a small
wrapper around default_print_patchable_function_entry_1.
* config/rs6000/rs6000.c (TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY):
Redefine.
(rs6000_print_patchable_function_entry): New function.
* g++.dg/pr93195a.C: Skip on powerpc*-*-* 64-bit.
Jason Merrill [Sat, 3 Apr 2021 05:07:36 +0000 (01:07 -0400)]
c++: NRV in lambda in template [PR91217]
tsubst_lambda_expr was producing a function with two blocks that claimed to
be the outermost block in the function body, one from the call to
start_lambda_function in tsubst_lambda_expr, and one from tsubsting the
block added by start_lambda_function when we first parsed the lambda. This
messed with the named return value optimization, which only works for
variables in the outermost block.
gcc/cp/ChangeLog:
PR c++/91217
* pt.c (tsubst_lambda_expr): Skip the body block from
DECL_SAVED_TREE.
gcc/testsuite/ChangeLog:
PR c++/91217
* g++.dg/opt/nrv20.C: New test.
Jason Merrill [Fri, 2 Apr 2021 21:07:12 +0000 (17:07 -0400)]
c++: PMF template parm and noexcept [PR90664]
The constexpr code only wants to preserve PTRMEM_CST in conversions if the
conversions are only qualification conversions; dropping noexcept counts as
a qualification adjustment in overload resolution, so let's include it here.
gcc/cp/ChangeLog:
PR c++/90664
* cvt.c (can_convert_qual): Check fnptr_conv_p.
gcc/testsuite/ChangeLog:
PR c++/90664
* g++.dg/cpp1z/noexcept-type24.C: New test.
Jason Merrill [Fri, 2 Apr 2021 18:49:15 +0000 (14:49 -0400)]
c++: dependent attribute on parameter [PR97900]
We were copying attributes from the template to the instantiation without
considering that they might be dependent. To make sure that the new parms
have the appropriate properties for the code pattern, let's just regenerate
them.
gcc/cp/ChangeLog:
PR c++/97900
* pt.c (regenerate_decl_from_template): tsubst_decl
the parms.
gcc/testsuite/ChangeLog:
PR c++/97900
* g++.dg/ext/vector40.C: New test.
GCC Administrator [Sat, 3 Apr 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Patrick Palka [Fri, 2 Apr 2021 23:46:24 +0000 (19:46 -0400)]
c++: placeholder type constraint inside range-for [PR99869]
In the testcase below, during ahead-of-time deduction of a constrained
auto inside a range-based for loop, we trip over an assert within
do_auto_deduction which expects the deduction context to be
adc_return_type or adc_variable_type, but do_range_for_auto_deduction
calls do_auto_deduction with the context defaulted to adc_unspecified.
We could safely relax the assert to also accept adc_unspecified, but it
seems the deduction context should really be adc_variable_type here.
gcc/cp/ChangeLog:
PR c++/99869
* parser.c (do_range_for_auto_deduction): Pass adc_variable_type
to do_auto_deduction.
gcc/testsuite/ChangeLog:
PR c++/99869
* g++.dg/cpp2a/concepts-placeholder6.C: New test.
Patrick Palka [Fri, 2 Apr 2021 23:47:09 +0000 (19:47 -0400)]
c++: Refine check for CTAD placeholder [PR99586]
In the below testcase, during finish_compound_literal for A<B{V}>{},
type_uses_auto finds and returns the CTAD placeholder for B{V}, which
tricks us into attempting CTAD on A<B{V}>{} and leads to bogus errors.
AFAICT 'type' will always be a bare 'auto' in the CTAD case so we don't
need to look deeply to find it; checking template_placeholder_p instead
should suffice here.
gcc/cp/ChangeLog:
PR c++/99586
* semantics.c (finish_compound_literal): Check
template_placeholder_p instead of type_uses_auto.
gcc/testsuite/ChangeLog:
PR c++/99586
* g++.dg/cpp2a/nontype-class42.C: New test.
Jason Merrill [Fri, 2 Apr 2021 15:05:46 +0000 (11:05 -0400)]
c++: lambda pack init-capture within generic lambda
We represent the type of a pack init-capture as auto... with packs from the
initializer stuck into PACK_EXPANSION_PARAMETER_PACKS so that expanding it
produces the right number of elements. But when partially instantiating the
auto..., we were changing PACK_EXPANSION_PARAMETER_PACKS to refer to only
the auto itself. Fixed thus.
gcc/cp/ChangeLog:
PR c++/97938
* cp-tree.h (PACK_EXPANSION_AUTO_P): New.
* lambda.c (add_capture): Set it.
* pt.c (tsubst_pack_expansion): Handle it.
gcc/testsuite/ChangeLog:
PR c++/97938
* g++.dg/cpp2a/lambda-pack-init6.C: New test.
Nathan Sidwell [Fri, 2 Apr 2021 13:28:29 +0000 (06:28 -0700)]
c++: header unit purview [PR 99283]
This case occurs due to some equivocation about module_purview.
Header-unit building is treated as a module-purview, but we should not
treat entities imported from that as module purview. (header units
were not a thing when I started). The testcase didn't understand we
had a local textual definition, but it was (incorrectly) marked as
module-purview, because we'd read in a declaration from a header unit
too.
gcc/cp/
* cp-tree.h (lang_decl_base): Correct module flag comment.
* module.cc (trees_in::assert_definition): Break out
not_tmpl var.
(trees_out::lang_decl_bools): Do not write purview for header units.
gcc/testsuite/
* g++.dg/modules/pr99283-6_d.H: New.
* g++.dg/modules/pr99283-7-swap.h: New.
* g++.dg/modules/pr99283-7-traits.h: New.
* g++.dg/modules/pr99283-7_a.H: New.
* g++.dg/modules/pr99283-7_b.H: New.
* g++.dg/modules/pr99283-7_c.C: New.
* g++.dg/modules/pr99283-7_d.H: New.
Eric Botcazou [Fri, 2 Apr 2021 08:44:49 +0000 (10:44 +0200)]
Minor tweak to description of fdelete-dead-exceptions
gcc/
* doc/invoke.texi (fdelete-dead-exceptions): Minor tweak.
Eric Botcazou [Fri, 2 Apr 2021 08:44:08 +0000 (10:44 +0200)]
Skip couple of Go tests on 32-bit SPARC
Since they are already skipped on other 32-bit architectures.
gcc/testsuite/
* go.test/test/fixedbugs/issue6036.go: Skip on sparc.
* go.test/test/fixedbugs/issue22200b.go: Likewise.
Jakub Jelinek [Fri, 2 Apr 2021 08:07:50 +0000 (10:07 +0200)]
testsuite: Fix up gcc.target/i386/pr99726.c test [PR99726]
-m32 shouldn't be used in gcc.target/i386/ testcases, people do
test with -m32/-m64 to get 32-bit compilation tested.
And, -floop-nest-optimize is a graphite optimization, so might not
be enabled in all gcc builds.
2021-04-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/99726
* gcc.target/i386/pr99726.c: Remove -m32 from dg-options. Move
-floop-nest-optimize to dg-additional-options guarded on fgraphite
effective target.
GCC Administrator [Fri, 2 Apr 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.
David Malcolm [Thu, 1 Apr 2021 22:22:52 +0000 (18:22 -0400)]
analyzer: record per-enode saved_diagnostics
Various places iterate through all of the saved_diagnostics to find
just the ones that are at a given enode. This patch adds a per-enode
record of the diagnostics that are at each node, to save iterating
through all of the diagnostics each time.
gcc/analyzer/ChangeLog:
* diagnostic-manager.cc (diagnostic_manager::add_diagnostic): Make
enode param non-constant, and call add_diagnostic on it. Add
enode index to log message.
(diagnostic_manager::add_diagnostic): Make enode param
non-constant.
* diagnostic-manager.h (diagnostic_manager::add_diagnostic):
Likewise for both decls.
* engine.cc
(impl_region_model_context::impl_region_model_context): Likewise
for enode_for_diag.
(impl_sm_context::impl_sm_context): Likewise.
(impl_sm_context::m_enode_for_diag): Likewise.
(exploded_node::dump_dot): Don't pass the diagnostic manager
to dump_saved_diagnostics.
(exploded_node::dump_saved_diagnostics): Drop param. Iterate
directly through all saved diagnostics for the enode, rather
than all saved diagnostics in the diagnostic_manager and
filtering.
(exploded_node::on_stmt): Make non-const.
(exploded_node::on_edge): Likewise.
(exploded_node::on_longjmp): Likewise.
(exploded_node::detect_leaks): Likewise.
(exploded_graph::get_or_create_node): Make enode_for_diag param
non-const.
(exploded_graph_annotator::print_enode): Iterate
directly through all saved diagnostics for the enode, rather
than all saved diagnostics in the diagnostic_manager and
filtering.
* exploded-graph.h
(impl_region_model_context::impl_region_model_context): Make
enode_for_diag param non-constant.
(impl_region_model_context::m_enode_for_diag): Likewise.
(exploded_node::dump_saved_diagnostics): Drop param.
(exploded_node::on_stmt): Make non-const.
(exploded_node::on_edge): Likewise.
(exploded_node::on_longjmp): Likewise.
(exploded_node::detect_leaks): Likewise.
(exploded_node::add_diagnostic): New.
(exploded_node::get_num_diagnostics): New.
(exploded_node::get_saved_diagnostic): New.
(exploded_node::m_saved_diagnostics): New.
(exploded_graph::get_or_create_node): Make enode_for_diag param
non-constant.
* feasible-graph.cc (feasible_node::dump_dot): Drop
diagnostic_manager from call to dump_saved_diagnostics.
* program-state.cc (program_state::on_edge): Convert enode param
to non-const pointer.
(program_state::prune_for_point): Likewise for enode_for_diag
param.
* program-state.h (program_state::on_edge): Convert enode param
to non-const pointer.
(program_state::prune_for_point): Likewise for enode_for_diag
param.
Marek Polacek [Thu, 1 Apr 2021 14:42:43 +0000 (10:42 -0400)]
c++: GC collects live data when synthesizing operator== [PR99831]
Here we crash in reshape_init because we're accessing ggc_freed
& poisoned data: since r277865 in defaulted_late_check we call
synthesize_method here:
if (kind == sfk_comparison)
{
/* If the function was declared constexpr, check that the definition
qualifies. Otherwise we can define the function lazily. */
if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn))
synthesize_method (fn);
return;
}
which in this test triggers when we're processing the string<"a">{} in
the static_assert. First, we create a CONSTRUCTOR for the "{}" in
cp_parser_functional_cast, then we call finish_compound_literal which
calls complete_type and that results in garbage collection, which then
frees the CONSTRUCTOR {} we created when parsing the braced-list in
string<"a">{} -- at this point, it's not referenced by anything.
(That's not the case for 'type' in finish_compound_literal: the symbol
table contains a node for operator==, so ggc_mark_roots goes and marks
the fn decl, its type, its arguments etc., as used, so we don't collect
it.)
We could just bump function_depth around the new call to synthesize_method
to prevent GC.
gcc/cp/ChangeLog:
PR c++/99831
* method.c (defaulted_late_check): ++ and -- function_depth around
the call to synthesize_method.
* pt.c: Remove the saved_trees global.
gcc/testsuite/ChangeLog:
PR c++/99831
* g++.dg/other/gc6.C: New test.
Jason Merrill [Thu, 1 Apr 2021 19:17:40 +0000 (15:17 -0400)]
c++: variadic lambda noexcept-specifier [PR99583]
The tree-walk looking for parameter packs didn't find this one because we
weren't stepping into TYPE_RAISES_EXCEPTIONS.
gcc/cp/ChangeLog:
PR c++/99583
PR c++/99584
* tree.c (cp_walk_subtrees) [FUNCTION_TYPE]: Walk into
TYPE_RAISES_EXCEPTIONS.
gcc/testsuite/ChangeLog:
PR c++/99583
* g++.dg/cpp0x/lambda/lambda-variadic12.C: New test.
Iain Sandoe [Tue, 30 Mar 2021 13:56:39 +0000 (14:56 +0100)]
modules : Make sure we include <map> in system.h.
It appears that many targets include the map header transitively in
other std headers included from system.h. However there are some
editions of clang/libc++ in Xcode that do not, which results in a
bootstrap fail - since when resolver.h is included there is then a
conflict in declaring abort().
The fix is to ensure that map is pulled in by system.h and before
resolver.h is included. As a precautionary measure and to alert
anyone perhaps adding another header to resolver.h this patch also
gates the direct includes there on !IN_GCC.
c++tools/ChangeLog:
* resolver.h: Do not include std headers directly when
building in GCC.
gcc/cp/ChangeLog:
* mapper-client.cc (INCLUDE_MAP): New; require map to be
included from system.h.
* mapper-resolver.cc (INCLUDE_MAP): Likewise.
Jason Merrill [Wed, 31 Mar 2021 21:48:50 +0000 (17:48 -0400)]
c++: Add ABI version for PR98481 fix
The PR98481 fix corrects an ABI regression in GCC 10, but we don't want to
introduce an ABI change in the middle of the GCC 10 cycle. This patch
introduces ABI v15 for the fix, which will be available but not default in
GCC 10.3; the broken behavior remains in ABI v14. Compatibility aliases
will not be generated for this change.
gcc/ChangeLog:
PR c++/98481
* common.opt: Document v15 and v16.
gcc/c-family/ChangeLog:
PR c++/98481
* c-opts.c (c_common_post_options): Bump latest_abi_version.
gcc/cp/ChangeLog:
PR c++/98481
* mangle.c (write_expression): Adjust.
* class.c (find_abi_tags_r): Disable PR98481 fix for ABI v14.
(mark_abi_tags_r): Likewise.
gcc/testsuite/ChangeLog:
PR c++/98481
* g++.dg/abi/abi-tag24a.C: New test.
* g++.dg/abi/macro0.C: Adjust expected value.