Jonathan Wakely [Fri, 10 Jan 2020 15:27:39 +0000 (15:27 +0000)]
libstdc++: Make istreambuf_iterator base class consistent (PR92285)
Since LWG 445 was implemented for GCC 4.7, the std::iterator base class
of std::istreambuf_iterator changes type depending on the -std mode
used. This creates an ABI incompatibility between different -std modes.
This change ensures the base class always has the same type. This makes
layout for C++98 compatible with the current -std=gnu++14 default, but
no longer compatible with C++98 code from previous releases. In practice
this is unlikely to cause real problems, because it only affects the
layout of types with two std::iterator base classes, one of which comes
from std::istreambuf_iterator. Such types are expected to be vanishingly
rare.
PR libstdc++/92285
* include/bits/streambuf_iterator.h (istreambuf_iterator): Make type
of base class independent of __cplusplus value.
[__cplusplus < 201103L] (istreambuf_iterator::reference): Override the
type defined in the base class
* testsuite/24_iterators/istreambuf_iterator/92285.cc: New test.
* testsuite/24_iterators/istreambuf_iterator/requirements/
base_classes.cc: Adjust expected base class for C++98.
Tobias Burnus [Fri, 10 Jan 2020 15:08:41 +0000 (16:08 +0100)]
OpenACC – support "if" + "if_present" clauses with "host_data"
2020-01-10 Gergö Barany <gergo@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Julian Brown <julian@codesourcery.com>
Tobias Burnus <tobias@codesourcery.com>
gcc/c/
* c-parser.c (OACC_HOST_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_IF
and PRAGMA_OACC_CLAUSE_IF_PRESENT.
gcc/cp/
* parser.c (OACC_HOST_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_IF
and PRAGMA_OACC_CLAUSE_IF_PRESENT.
gcc/fortran/
* openmp.c (OACC_HOST_DATA_CLAUSES): Add PRAGMA_OACC_CLAUSE_IF
and PRAGMA_OACC_CLAUSE_IF_PRESENT.
gcc/
* omp-low.c (lower_omp_target): Use GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT
if PRAGMA_OACC_CLAUSE_IF_PRESENT exist.
gcc/testsuite/
* c-c++-common/goacc/host_data-1.c: Added tests of if and if_present
clauses on host_data.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
include/
* gomp-constants.h (enum gomp_map_kind): New enumeration constant
GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT.
[AArch64] Tighten mode checks in aarch64_builtin_vectorized_function
aarch64_builtin_vectorized_function checked vectors based on the
number of elements and the element mode. This doesn't interact
well with fixed-length 128-bit SVE, where SVE modes can have those
same properties. (And we can't just use the built-ins for SVE because
the types use a different ABI. SVE handles this kind of thing using
optabs instead.)
2020-01-10 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64-builtins.c
(aarch64_builtin_vectorized_function): Check for specific vector modes,
rather than checking the number of elements and the element mode.
Use get_related_vectype_for_scalar_type for reduction indices
The related_vector_mode series missed this case in
vect_create_epilog_for_reduction, where we want to create the
unsigned integer equivalent of another vector. Without it we
could mix SVE and Advanced SIMD vectors in the same operation.
This showed up on existing tests when testing with fixed-length
-msve-vector-bits=128.
2020-01-10 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
get_related_vectype_for_scalar_type rather than build_vector_type
to create the index type for a conditional reduction.
Fix gather/scatter check when updating a vector epilogue loop
update_epilogue_loop_vinfo applies SSA renmaing to the DR_REF of a
gather or scatter, so that vect_check_gather_scatter continues to work.
However, we sometimes also rely on vect_check_gather_scatter when
using gathers and scatters to implement strided accesses.
This showed up on existing tests when testing with fixed-length
-msve-vector-bits=128.
2020-01-10 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-loop.c (update_epilogue_loop_vinfo): Update DR_REF
for any type of gather or scatter, including strided accesses.
Andre Vieira [Fri, 10 Jan 2020 13:33:10 +0000 (13:33 +0000)]
[vect] Keep track of DR_OFFSET advance in dr_vec_info rather than data_reference
gcc/ChangeLog:
2020-01-10 Andre Vieira <andre.simoesdiasvieira@arm.com>
* tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Use
get_dr_vinfo_offset
* tree-vect-loop.c (update_epilogue_loop_vinfo): Remove orig_drs_init
parameter and its use to reset DR_OFFSET's.
(vect_transform_loop): Remove orig_drs_init argument.
* tree-vect-loop-manip.c (vect_update_init_of_dr): Update the offset
member of dr_vec_info rather than the offset of the associated
data_reference's innermost_loop_behavior.
(vect_update_init_of_dr): Pass dr_vec_info instead of data_reference.
(vect_do_peeling): Remove orig_drs_init parameter and its construction.
* tree-vect-stmts.c (check_scan_store): Replace use of DR_OFFSET with
get_dr_vinfo_offset.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
Richard Biener [Fri, 10 Jan 2020 11:23:53 +0000 (11:23 +0000)]
re PR tree-optimization/93199 (Compile time hog in sink_clobbers)
2020-01-10 Richard Biener <rguenther@suse.de>
PR middle-end/93199
* tree-eh.c (sink_clobbers): Move clobbers to out-of-IL
sequences to avoid walking them again for secondary opportunities.
(pass_lower_eh_dispatch::execute): Instead actually insert
them here.
Richard Biener [Fri, 10 Jan 2020 10:49:57 +0000 (10:49 +0000)]
re PR tree-optimization/93199 (Compile time hog in sink_clobbers)
2020-01-10 Richard Biener <rguenther@suse.de>
PR middle-end/93199
* tree-eh.c (redirect_eh_edge_1): Avoid some work if possible.
(cleanup_all_empty_eh): Walk landing pads in reverse order to
avoid quadraticness.
Martin Jambor [Fri, 10 Jan 2020 10:01:33 +0000 (11:01 +0100)]
IPA-CP: Access param_ipa_sra_max_replacements through opt_for_fn
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipa_sra_max_replacements): Mark as Optimization.
* ipa-sra.c (pull_accesses_from_callee): New parameter caller, use it
to get param_ipa_sra_max_replacements.
(param_splitting_across_edge): Pass the caller to
pull_accesses_from_callee.
Martin Jambor [Fri, 10 Jan 2020 10:00:05 +0000 (11:00 +0100)]
IPA-CP: Always access param_ipcp_unit_growth through opt_for_fn
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipcp_unit_growth): Mark as Optimization.
* ipa-cp.c (max_new_size): Removed.
(orig_overall_size): New variable.
(get_max_overall_size): New function.
(estimate_local_effects): Use it. Adjust dump.
(decide_about_value): Likewise.
(ipcp_propagate_stage): Do not calculate max_new_size, just store
orig_overall_size. Adjust dump.
(ipa_cp_c_finalize): Clear orig_overall_size instead of max_new_size.
Martin Jambor [Fri, 10 Jan 2020 09:57:59 +0000 (10:57 +0100)]
IPA-CP: Always access param_ipa_max_agg_items through opt_for_fn
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipa_max_agg_items): Mark as Optimization
* ipa-cp.c (merge_agg_lats_step): New parameter max_agg_items, use
instead of param_ipa_max_agg_items.
(merge_aggregate_lattices): Extract param_ipa_max_agg_items from
optimization info for the callee.
Previously if the only names defined by _test packages were examples,
the gotest script would emit an incorrect _testmain.go file.
I worked around that by marking the example_test.go files +build ignored.
This CL changes the gotest script to handle this case correctly,
and removes the now-unnecessary build tags.
Jonathan Wakely [Thu, 9 Jan 2020 21:31:55 +0000 (21:31 +0000)]
libstdc++: Fix <ext/pointer.h> incompatibilities with C++20
The equality operators for _ExtPtr_allocator are defined as non-const
member functions, which causes ambiguities in C++20 due to the
synthesized operator!= candidates. They should always have been const.
The _Pointer_adapter class template has both value_type and element_type
members, which makes readable_traits<_Pointer_adapter<T>> ambiguous. The
intended workaround is to add a specialization of readable_traits.
* include/ext/extptr_allocator.h (_ExtPtr_allocator::operator==)
(_ExtPtr_allocator::operator!=): Add missing const qualifiers.
* include/ext/pointer.h (readable_traits<_Pointer_adapter<S>>): Add
partial specialization to disambiguate the two constrained
specializations.
Thomas Koenig [Thu, 9 Jan 2020 20:57:33 +0000 (20:57 +0000)]
Save typespec for empty array constructor.
2020-01-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/65428
* array.c (empty_constructor): New variable.
(empty_ts): New variable.
(expand_constructor): Save typespec in empty_ts.
Unset empty_constructor if there is an element.
(gfc_expand_constructor): Initialize empty_constructor
and empty_ts. If there was no explicit constructor
type and the constructor is empty, take the type from
empty_ts.
2020-01-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/65428
* gfortran.dg/zero_sized_11.f90: New test.
Jonathan Wakely [Thu, 9 Jan 2020 16:50:51 +0000 (16:50 +0000)]
libstdc++: Fix undefined behaviour in random dist serialization (PR93205)
The deserialization functions for random number distributions fail to
check the stream state before using the extracted values. In some cases
this leads to using indeterminate values to resize a vector, and then
filling that vector with indeterminate values.
No values that affect control flow should be used without checking that a
good value was read from the stream.
Additionally, where reasonable to do so, defer modifying any state in
the distribution until all values have been successfully read, to avoid
modifying some of the distribution's parameters and leaving others
unchanged.
PR libstdc++/93205
* include/bits/random.h (operator>>): Check stream operation succeeds.
* include/bits/random.tcc (operator<<): Remove redundant __ostream_type
typedefs.
(operator>>): Remove redundant __istream_type typedefs. Check stream
operations succeed.
(__extract_params): New function to fill a vector from a stream.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line.
compiler: don't add composite literal keys to package bindings
Adding composite literal keys to package bindings gets confusing when
it is combined with dot imports. The test case showing the resulting
compilation failure is https://golang.org/cl/213899.
Fix this by adding a new expression type to hold composite literal keys.
We shouldn't see it during lowering if it is a struct field name,
because Composite_literal_expression::do_traverse skips struct field names.
Or, it should, but that didn't quite work with pointer types so it had to
be tweaked.
This lets us remove the code that recorded whether an Unknown_expression
is a composite literal key.
I'd made WHILERW and WHILEWR use separate patterns from the SVE
WHILE instructions, but they're similar enough that we can use
a single pattern. This means that we also get the flag-related
patterns "for free".
2020-01-09 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/iterators.md (SVE_WHILE): Add UNSPEC_WHILERW
and UNSPEC_WHILEWR.
(while_optab_cmp): Handle them.
* config/aarch64/aarch64-sve.md
(*while_<while_optab_cmp><GPI:mode><PRED_ALL:mode>_ptest): Make public
and add a "@" marker.
* config/aarch64/aarch64-sve2.md (check_<raw_war>_ptrs<mode>): Use it
instead of gen_aarch64_sve2_while_ptest.
(@aarch64_sve2_while<cmp_op><GPI:mode><PRED_ALL:mode>_ptest): Delete.
[AArch64] Rename SVE shape "unary_count" to "unary_to_uint"
The SVE ACLE shape names use "_int" and "_uint" for arguments that are
signed-integer or unsigned-integer variants of the main vector type.
With SVE2 this variation also becomes common for return values,
which the main SVE2 patch handles using "_to_int" and "_to_uint".
This patch renames the existing unary_count shape to match the
new scheme.
2020-01-09 Richard Sandiford <richard.sandiford@arm.com>
meant that we overloaded "optab" to be "qadd" for both SQADD and
UQADD. Most other "optab" entries are instead the full optab name,
which for these patterns would be "ssadd" and "usadd" respectively.
(Unfortunately, the optabs don't extend to vectors yet, something
that would be good to fix in GCC 11.)
This patch therefore does what the comment implies and uses
q<addsub> to distinguish qadd and qsub instead.
2020-01-09 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/iterators.md (addsub): New code attribute.
* config/aarch64/aarch64-simd.md (aarch64_<su_optab><optab><mode>):
Re-express as...
(aarch64_<su_optab>q<addsub><mode>): ...this, making the same change
in the asm string and attributes. Fix indentation.
* config/aarch64/aarch64-sve.md (@aarch64_<su_optab><optab><mode>):
Re-express as...
(@aarch64_sve_<optab><mode>): ...this.
* config/aarch64/aarch64-sve-builtins.h
(function_expander::expand_signed_unpred_op): Delete.
* config/aarch64/aarch64-sve-builtins.cc
(function_expander::expand_signed_unpred_op): Likewise.
(function_expander::map_to_rtx_codes): If the optab isn't defined,
try using code_for_aarch64_sve instead.
* config/aarch64/aarch64-sve-builtins-base.cc (svqadd_impl): Delete.
(svqsub_impl): Likewise.
(svqadd, svqsub): Use rtx_code_function instead.
/* Ignore internal functions without direct optabs,
those are expanded specially and aggregate_value_p
on their result might result in undesirable warnings
with some backends. */
&& (!gimple_call_internal_p (stmt)
|| direct_internal_fn_p (gimple_call_internal_fn (stmt)))
&& aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
gimple_call_fndecl (stmt)))
But what the comment says applies to directly-mapped internal functions
too, since they're only used if the target supports them without a
libcall.
This was triggering an ICE on the attached testcase. The svld3 call
is folded to an IFN_LOAD_LANES, which returns an array of vectors with
VNx48QImode. Since no such return type can exist in C, the target hook
was complaining about an unexpected use of SVE modes. (And we want to
keep asserting for that, so that we don't accidentally define an ABI for
an unexpected corner case.)
2020-01-09 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-nrv.c (pass_return_slot::execute): Handle all internal
functions the same way, rather than singling out those that
aren't mapped directly to optabs.
gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/nrv_1.c: New test.
One problem with adding an N-bit vector extension to an existing
architecture is to decide how N-bit vectors should be passed to
functions and returned from functions. Allowing all N-bit vector
types to be passed in registers breaks backwards compatibility,
since N-bit vectors could be used (and emulated) before the vector
extension was added. But always passing N-bit vectors on the
stack would be inefficient for things like vector libm functions.
For SVE we took the compromise position of predefining new SVE vector
types that are distinct from all existing vector types, including
GNU-style vectors. The new types are passed and returned in an
efficient way while existing vector types are passed and returned
in the traditional way. In the right circumstances, the two types
are inter-convertible.
The C frontend maintains this distinction, using VIEW_CONVERT_EXPR
to convert from one type to the other. However, the distinction can
be lost during gimple, which treats two vector types with the same
mode, number of elements, and element type as equivalent. And for
most targets that's the right thing to do.
This patch therefore adds a hook that lets the target choose
whether such vector types are indeed equivalent.
Note that the new tests fail for -mabi=ilp32 in the same way as other
ACLE-based tests. I'm still planning to fix that as a follow-on.
2020-01-09 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.def (compatible_vector_types_p): New target hook.
* hooks.h (hook_bool_const_tree_const_tree_true): Declare.
* hooks.c (hook_bool_const_tree_const_tree_true): New function.
* doc/tm.texi.in (TARGET_COMPATIBLE_VECTOR_TYPES_P): New hook.
* doc/tm.texi: Regenerate.
* gimple-expr.c: Include target.h.
(useless_type_conversion_p): Use targetm.compatible_vector_types_p.
* config/aarch64/aarch64.c (aarch64_compatible_vector_types_p): New
function.
(TARGET_COMPATIBLE_VECTOR_TYPES_P): Define.
* config/aarch64/aarch64-sve-builtins.cc (gimple_folder::convert_pred):
Use the original predicate if it already has a suitable type.
gcc/testsuite/
* gcc.target/aarch64/sve/pcs/gnu_vectors_1.c: New test.
* gcc.target/aarch64/sve/pcs/gnu_vectors_2.c: Likewise.
This prevents the vtables and RTTI from being emitted in every object
file that uses memory_resource and monotonic_buffer_resource.
Objects compiled by GCC 9.1 or 9.2 will contain inline definitions of
the destructors, vtable and RTTI, but this is harmless. The inline
definitions have identical effects to the ones that are now defined in
libstdc++.so so it doesn't matter if the inline ones are used instead of
calling the symbols exported from the runtime library.
PR libstdc++/93208
* config/abi/pre/gnu.ver: Add new exports.
* include/std/memory_resource (memory_resource::~memory_resource()):
Do not define inline.
(monotonic_buffer_resource::~monotonic_buffer_resource()): Likewise.
* src/c++17/memory_resource.cc (memory_resource::~memory_resource()):
Define.
(monotonic_buffer_resource::~monotonic_buffer_resource()): Define.
* testsuite/20_util/monotonic_buffer_resource/93208.cc: New test.
Martin Jambor [Thu, 9 Jan 2020 12:21:48 +0000 (13:21 +0100)]
Make cgraph_edge::resolve-speculation static
2020-01-09 Martin Jambor <mjambor@suse.cz>
* cgraph.h (cgraph_edge): Make remove, set_call_stmt, make_direct,
resolve_speculation and redirect_call_stmt_to_callee static. Change
return type of set_call_stmt to cgraph_edge *.
* auto-profile.c (afdo_indirect_call): Adjust call to
redirect_call_stmt_to_callee.
* cgraph.c (cgraph_edge::set_call_stmt): Make return cgraph-edge *,
make the this pointer explicit, adjust self-recursive calls and the
call top make_direct. Return the resulting edge.
(cgraph_edge::remove): Make this pointer explicit.
(cgraph_edge::resolve_speculation): Likewise, adjust call to remove.
(cgraph_edge::make_direct): Likewise, adjust call to
resolve_speculation.
(cgraph_edge::redirect_call_stmt_to_callee): Likewise, also adjust
call to set_call_stmt.
(cgraph_update_edges_for_call_stmt_node): Update call to
set_call_stmt and remove.
* cgraphclones.c (cgraph_node::set_call_stmt_including_clones):
Renamed edge to master_edge. Adjusted calls to set_call_stmt.
(cgraph_node::create_edge_including_clones): Moved "first" definition
of edge to the block where it was used. Adjusted calls to
set_call_stmt.
(cgraph_node::remove_symbol_and_inline_clones): Adjust call to
cgraph_edge::remove.
* cgraphunit.c (walk_polymorphic_call_targets): Adjusted calls to
make_direct and redirect_call_stmt_to_callee.
* ipa-fnsummary.c (redirect_to_unreachable): Adjust calls to
resolve_speculation and make_direct.
* ipa-inline-transform.c (inline_transform): Adjust call to
redirect_call_stmt_to_callee.
(check_speculations_1):: Adjust call to resolve_speculation.
* ipa-inline.c (resolve_noninline_speculation): Adjust call to
resolve-speculation.
(inline_small_functions): Adjust call to resolve_speculation.
(ipa_inline): Likewise.
* ipa-prop.c (ipa_make_edge_direct_to_target): Adjust call to
make_direct.
* ipa-visibility.c (function_and_variable_visibility): Make iteration
safe with regards to edge removal, adjust calls to
redirect_call_stmt_to_callee.
* ipa.c (walk_polymorphic_call_targets): Adjust calls to make_direct
and redirect_call_stmt_to_callee.
* multiple_target.c (create_dispatcher_calls): Adjust call to
redirect_call_stmt_to_callee
(redirect_to_specific_clone): Likewise.
* tree-cfgcleanup.c (delete_unreachable_blocks_update_callgraph):
Adjust calls to cgraph_edge::remove.
* tree-inline.c (copy_bb): Adjust call to set_call_stmt.
(redirect_all_calls): Adjust call to redirect_call_stmt_to_callee.
(expand_call_inline): Adjust call to cgraph_edge::remove.
Martin Sebor [Thu, 9 Jan 2020 11:59:41 +0000 (11:59 +0000)]
PR middle-end/93200 - spurious -Wstringop-overflow due to assignment vectorization to multiple members
PR middle-end/93200 - spurious -Wstringop-overflow due to assignment vectorization to multiple members
PR fortran/92956 - 'libgomp.fortran/examples-4/async_target-2.f90' fails with offloading due to bogus -Wstringop-overflow warning
gcc/testsuite/ChangeLog:
PR middle-end/93200
* gcc.dg/Wstringop-overflow-30.c: New test.
Jakub Jelinek [Thu, 9 Jan 2020 08:18:51 +0000 (09:18 +0100)]
re PR target/93141 (Missed optimization : Use of adc when checking overflow)
PR target/93141
* config/i386/i386.md (subv<mode>4): Use SWIDWI iterator instead of
SWI. Use <general_hilo_operand> instead of <general_operand>. Use
CONST_SCALAR_INT_P instead of CONST_INT_P.
(*subv<mode>4_1): Rename to ...
(subv<mode>4_1): ... this.
(*subv<dwi>4_doubleword, *addv<dwi>4_doubleword_1): New
define_insn_and_split patterns.
(*subv<mode>4_overflow_1, *addv<mode>4_overflow_2): New define_insn
patterns.
* gcc.target/i386/pr93141-1.c: Add tests with constants that have MSB
of the low half of the constant set.
* gcc.target/i386/pr93141-2.c: New test.
David Malcolm [Thu, 9 Jan 2020 01:39:45 +0000 (01:39 +0000)]
vec.h: add auto_delete_vec
This patch adds a class auto_delete_vec<T>, a subclass of auto_vec <T *>
that deletes all of its elements on destruction; it's used in many
places in the analyzer patch kit.
This is a crude way for a vec to "own" the objects it points to
and clean up automatically (essentially a workaround for not being able
to use unique_ptr, due to C++98).
gcc/ChangeLog:
* vec.c (class selftest::count_dtor): New class.
(selftest::test_auto_delete_vec): New test.
(selftest::vec_c_tests): Call it.
* vec.h (class auto_delete_vec): New class template.
(auto_delete_vec<T>::~auto_delete_vec): New dtor.
Jim Wilson [Thu, 9 Jan 2020 01:04:45 +0000 (01:04 +0000)]
RISC-V: Disable use of TLS copy relocs.
Musl and lld don't support TLS copy relocs, and don't want to add support
for this feature which is unique to RISC-V. Only GNU ld and glibc support
them. In the pasbi discussion, people have pointed out various problems
with using them, so we are deprecating them. There doesn't seem to be an
ABI break from dropping them so this patch modifies gcc to stop creating
them. I'm using an ifdef for now in case a problem turns up and the code
has to be re-enabled. The plan is to add an initial to local exec
relaxation as a replacement, though this has not been defined or
implemented yet.
gcc/
* config/riscv/riscv.c (riscv_legitimize_tls_address): Ifdef out
use of TLS_MODEL_LOCAL_EXEC when not pic.
Jason Merrill [Wed, 8 Jan 2020 20:31:20 +0000 (15:31 -0500)]
PR c++/91369 - constexpr destructor and member initializer.
Previously it didn't matter whether we looked through a TARGET_EXPR in
constexpr evaluation, but now that we have constexpr destructors it does.
On IRC I mentioned the idea of clearing TARGET_EXPR_CLEANUP in
digest_nsdmi_init, but since this initialization is expressed by an
INIT_EXPR, it's better to handle all INIT_EXPR, not just those for a member
initializer.
* constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
when not preevaluating.
David Malcolm [Wed, 8 Jan 2020 18:45:26 +0000 (18:45 +0000)]
hash-map-tests.c: fix memory leak
This commit makes "make selftest-valgrind" clean by fixing this leak:
4 bytes in 1 blocks are definitely lost in loss record 1 of 734
at 0x483AB1A: calloc (vg_replace_malloc.c:762)
by 0x261DBE0: xcalloc (xmalloc.c:162)
by 0x2538C46: selftest::test_map_of_strings_to_int() (hash-map-tests.c:87)
by 0x253ABD2: selftest::hash_map_tests_c_tests() (hash-map-tests.c:307)
by 0x24A885B: selftest::run_tests() (selftest-run-tests.c:65)
by 0x1373D80: toplev::run_self_tests() (toplev.c:2339)
by 0x1373FA7: toplev::main(int, char**) (toplev.c:2421)
by 0x2550EFF: main (main.c:39)
Jonathan Wakely [Wed, 8 Jan 2020 16:44:45 +0000 (16:44 +0000)]
libstdc++: Fix error handling in filesystem::remove_all (PR93201)
When recursing into a directory, any errors that occur while removing a
directory entry are ignored, because the subsequent increment of the
directory iterator clears the error_code object.
This fixes that bug by checking the result of each recursive operation
before incrementing. This is a change in observable behaviour, because
previously other directory entries would still be removed even if one
(or more) couldn't be removed due to errors. Now the operation stops on
the first error, which is what the code intended to do all along. The
standard doesn't specify what happens in this case (because the order
that the entries are processed is unspecified anyway).
It also improves the error reporting so that the name of the file that
could not be removed is included in the filesystem_error exception. This
is done by introducing a new helper type for reporting errors with
additional context and a new function that uses that type. Then the
overload of std::filesystem::remove_all that throws an exception can use
the new function to ensure any exception contains the additional
information.
For std::experimental::filesystem::remove_all just fix the bug where
errors are ignored.
PR libstdc++/93201
* src/c++17/fs_ops.cc (do_remove_all): New function implementing more
detailed error reporting for remove_all. Check result of recursive
call before incrementing iterator.
(remove_all(const path&), remove_all(const path&, error_code&)): Use
do_remove_all.
* src/filesystem/ops.cc (remove_all(const path&, error_code&)): Check
result of recursive call before incrementing iterator.
* testsuite/27_io/filesystem/operations/remove_all.cc: Check errors
are reported correctly.
* testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
Jakub Jelinek [Wed, 8 Jan 2020 15:59:20 +0000 (16:59 +0100)]
re PR target/93187 (ICE in extract_insn, at recog.c:2294)
PR target/93187
* config/i386/i386.md (*stack_protect_set_2_<mode> peephole2,
*stack_protect_set_3 peephole2): Also check that the second
insns source is general_operand.
Jakub Jelinek [Wed, 8 Jan 2020 15:58:20 +0000 (16:58 +0100)]
re PR target/93174 (ICE building glibc __sha512_process_block for i686)
PR target/93174
* config/i386/i386.md (addcarry<mode>_0): Use nonimmediate_operand
predicate for output operand instead of register_operand.
(addcarry<mode>, addcarry<mode>_1): Likewise. Add alternative with
memory destination and non-memory operands[2].
Richard Biener [Wed, 8 Jan 2020 14:30:44 +0000 (14:30 +0000)]
re PR tree-optimization/93199 (Compile time hog in sink_clobbers)
2020-01-08 Richard Biener <rguenther@suse.de>
PR middle-end/93199
* tree-eh.c (sink_clobbers): Update virtual operands for
the first and last stmt only. Add a dry-run capability.
(pass_lower_eh_dispatch::execute): Perform clobber sinking
after CFG manipulations and in RPO order to catch all
secondary opportunities reliably.
PR target/93182
* config/avr/avr.opt (-nodevicespecs): New driver option.
* config/avr/driver-avr.c (avr_devicespecs_file): Only issue
"-specs=device-specs/..." if that option is not set.
* doc/invoke.texi (AVR Options) <-nodevicespecs>: Document.
arm: Fix rmprofile multilibs when architecture includes +mp or +sec (PR target/93188)
When only the rmprofile multilibs are built, compiling for armv7-a
should select the generic v7 multilibs. This used to work before +sec
and +mp were added to the architecture options but it was broken by
that update. This patch fixes those variants and adds some tests to
ensure that they remain fixed ;-)
PR target/93188
* config/arm/t-multilib (MULTILIB_MATCHES): Add rules to match
armv7-a{+mp,+sec,+mp+sec} to appropriate armv7 multilib variants
when only building rm-profile multilibs.
* gcc.target/arm/multilib.exp: Add new tests for rm-profile only.
Thomas Rodgers [Wed, 8 Jan 2020 03:00:40 +0000 (03:00 +0000)]
Rename condition_variable_any wait* methods to match current draft standard
2020-01-07 Thomas Rodgers <trodgers@redhat.com>
* include/std/condition_variable
(condition_variable_any::wait_on): Rename to match current draft
standard.
(condition_variable_any::wait_on_until): Likewise.
(condition_variable_any::wait_on_for): Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc:
Adjust tests to account for renamed methods.
Feng Xue [Wed, 8 Jan 2020 02:55:00 +0000 (02:55 +0000)]
Find matched aggregate lattice for self-recursive CP (PR ipa/93084)
2020-01-08 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/93084
* ipa-cp.c (self_recursively_generated_p): Find matched aggregate
lattice for a value to check.
(propagate_vals_across_arith_jfunc): Add an assertion to ensure
finite propagation in self-recursive scc.
2020-01-08 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/93084
* gcc.dg/ipa/ipa-clone-3.c: New test.
compiler: fix loopdepth tracking in array slicing expression in escape analysis
In the gc compiler, for slicing an array, its AST has an implicit
address operation node. There isn't such node in the gofrontend
AST. During the escape analysis, we create a fake node to mimic
the gc compiler's behavior. For the fake node, the loopdepth was
not tracked correctly, causing miscompilation. Since this is an
address operation, do the same thing as we do for the address
operator.
This avoids generating a write barrier for code that appears in the
Go1.14beta1 runtime package in (*pageAlloc).sysGrow:
s.summary[l] = s.summary[l][:needIdxLimit]
Andrew Stubbs [Tue, 7 Jan 2020 15:27:50 +0000 (15:27 +0000)]
[amdgcn] Add more modes for vector comparisons
2020-01-07 Andrew Stubbs <ams@codesourcery.com>
gcc/
* config/gcn/gcn-valu.md (VEC_1REG_INT_ALT): Delete iterator.
(VEC_ALLREG_ALT): New iterator.
(VEC_ALLREG_INT_MODE): New iterator.
(VCMP_MODE): New iterator.
(VCMP_MODE_INT): New iterator.
(vec_cmpu<mode>di): Use VCMP_MODE_INT.
(vec_cmp<u>v64qidi): New define_expand.
(vec_cmp<mode>di_exec): Use VCMP_MODE.
(vec_cmpu<mode>di_exec): New define_expand.
(vec_cmp<u>v64qidi_exec): New define_expand.
(vec_cmp<mode>di_dup): Use VCMP_MODE.
(vec_cmp<mode>di_dup_exec): Use VCMP_MODE.
(vcond<VEC_ALL1REG_MODE:mode><VEC_1REG_ALT:mode>): Rename ...
(vcond<VEC_ALLREG_MODE:mode><VEC_ALLREG_ALT:mode>): ... to this.
(vcond<VEC_ALL1REG_MODE:mode><VEC_1REG_ALT:mode>_exec): Rename ...
(vcond<VEC_ALLREG_MODE:mode><VEC_ALLREG_ALT:mode>_exec): ... to this.
(vcondu<VEC_ALL1REG_MODE:mode><VEC_1REG_INT_ALT:mode>): Rename ...
(vcondu<VEC_ALLREG_MODE:mode><VEC_ALLREG_INT_MODE:mode>): ... to this.
(vcondu<VEC_ALL1REG_MODE:mode><VEC_1REG_INT_ALT:mode>_exec): Rename ...
(vcondu<VEC_ALLREG_MODE:mode><VEC_ALLREG_INT_MODE:mode>_exec): ... to
this.
* config/gcn/gcn.c (print_operand): Fix 8 and 16 bit suffixes.
* config/gcn/gcn.md (expander): Add sign_extend and zero_extend.
Jason Merrill [Tue, 7 Jan 2020 15:05:25 +0000 (10:05 -0500)]
PR c++/47877 - -fvisibility-inlines-hidden and member templates.
DECL_VISIBILITY_SPECIFIED is also true if an enclosing scope has explicit
visibility, and we don't want that to override -fvisibility-inlines-hidden.
So check for the attribute specifically on the function, like we already do
for template argument visibility restriction.
* decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
explicit class visibility for a template.