Jakub Jelinek [Wed, 5 Jun 2019 12:19:00 +0000 (14:19 +0200)]
backport: re PR libgomp/90641 (libgomp.c-c++-common/lastprivate-conditional-1.c etc FAIL)
Backported from mainline
2019-05-27 Jakub Jelinek <jakub@redhat.com>
PR libgomp/90641
* work.c (gomp_init_work_share): Instead of aligning final ordered
value to multiples of long long alignment, align to that the
first part (ordered team ids) and if inline_ordered_team_ids
is not on a long long alignment boundary within the structure,
use __alignof__ (long long) - 1 pad size always.
* loop.c (GOMP_loop_start): Fix *mem computation if
inline_ordered_team_ids is not aligned on long long alignment boundary
within the structure.
* loop-ull.c (GOMP_loop_ull_start): Likewise.
* sections.c (GOMP_sections2_start): Likewise.
Jakub Jelinek [Wed, 5 Jun 2019 12:18:23 +0000 (14:18 +0200)]
backport: re PR libgomp/90585 (libgomp hsa plugin ftbfs in the x32 multilib variant)
Backported from mainline
2019-05-24 Jakub Jelinek <jakub@redhat.com>
PR libgomp/90585
* plugin/plugin-hsa.c (print_kernel_dispatch, run_kernel): Use PRIu64
macro instead of "lu".
(release_kernel_dispatch): Likewise. Cast shadow->debug to uintptr_t
before casting to void *.
Jonathan Wakely [Mon, 3 Jun 2019 22:31:45 +0000 (23:31 +0100)]
PR libstdc++/90700 Fix constructor constraint for std::tuple
* include/std/tuple
(tuple(allocator_arg_t, const A&, const tuple<UTypes...>&)): Fix
value category of template argument to _TC::_NonNestedTuple.
* testsuite/20_util/tuple/cons/90700.cc: New test.
Jonathan Wakely [Thu, 30 May 2019 10:34:44 +0000 (11:34 +0100)]
Backport libstdc++ documentation updates from mainline
* doc/xml/manual/status_cxx2017.xml: Fix typo in documentation of
implementation-defined support for [fs.conform.9945].
* doc/xml/manual/status_cxx2020.xml: Add feature-test macro for
P0811R3. Change status of P1353R0.
* doc/html/*: Regenerate.
Jakub Jelinek [Wed, 29 May 2019 15:55:12 +0000 (17:55 +0200)]
re PR fortran/90329 (Incompatibility between gfortran and C lapack calls)
PR fortran/90329
* lto-streamer.h (LTO_minor_version): Bump to 1.
Backported from mainline
2019-05-29 Jakub Jelinek <jakub@redhat.com>
PR fortran/90329
* lang.opt (fbroken-callers): Remove.
(ftail-call-workaround, ftail-call-workaround=): New options.
* gfortran.h (struct gfc_namespace): Add implicit_interface_calls.
* interface.c (gfc_procedure_use): Set implicit_interface_calls
for calls to implicit interface procedures.
* trans-decl.c (create_function_arglist): Use flag_tail_call_workaround
instead of flag_broken_callers. If it is not 2, also require
sym->ns->implicit_interface_calls.
* invoke.texi (fbroken-callers): Remove documentation.
(ftail-call-workaround, ftail-call-workaround=): Document.
2019-05-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/90329
* invoke.texi: Document -fbroken-callers.
* lang.opt: Add -fbroken-callers.
* trans-decl.c (create_function_arglist): Only set
DECL_HIDDEN_STRING_LENGTH if flag_broken_callers is set.
2019-05-16 Jakub Jelinek <jakub@redhat.com>
PR fortran/90329
* tree-core.h (struct tree_decl_common): Document
decl_nonshareable_flag for PARM_DECLs.
* tree.h (DECL_HIDDEN_STRING_LENGTH): Define.
* calls.c (expand_call): Don't try tail call if caller
has any DECL_HIDDEN_STRING_LENGTH PARM_DECLs that are or might be
passed on the stack and callee needs to pass any arguments on the
stack.
* tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use
else if instead of series of mutually exclusive ifs. Handle
DECL_HIDDEN_STRING_LENGTH for PARM_DECLs.
* tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise.
* trans-decl.c (create_function_arglist): Set
DECL_HIDDEN_STRING_LENGTH on hidden string length PARM_DECLs if
len is constant.
Jakub Jelinek [Wed, 29 May 2019 09:35:34 +0000 (11:35 +0200)]
re PR bootstrap/90543 (Build failure on MINGW for gcc-9.1.0)
PR bootstrap/90543
* optc-save-gen.awk: In cl_optimization_print, use correct condition
for var_opt_string printing. In cl_optimization_print_diff, print
(null) instead of invoking undefined behavior if one of the
var_opt_string pointers is NULL and use && instead of first || in the
guarding condition. For var_target_other options, handle const char *
target variables similarly to const char * optimize node variables.
Jonathan Wakely [Tue, 28 May 2019 20:48:31 +0000 (21:48 +0100)]
PR libstdc++/90634 reduce allocations in filesystem::path construction
Backport from mainline
2019-05-28 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90634
* include/experimental/bits/fs_path.h (path::path(path&&)): Only call
_M_split_cmpts() for a path with multiple components.
(path::_S_is_dir_sep()): Add missing 'static' keyword to function.
* src/filesystem/path.cc (path::_M_split_cmpts()): Count number of
components and reserve space in vector. Return early when there is
only one component.
* testsuite/27_io/filesystem/path/construct/90634.cc: New test.
* testsuite/experimental/filesystem/path/construct/90634.cc: New test.
Eric Botcazou [Tue, 28 May 2019 08:25:45 +0000 (08:25 +0000)]
trans.c (lvalue_required_for_attribute_p): Return 0 for 'Size too.
* gcc-interface/trans.c (lvalue_required_for_attribute_p): Return 0
for 'Size too.
(Identifier_to_gnu): Use the actual subtype for a reference to a
packed array in a return statement.
(Attribute_to_gnu) <Attr_Size>: Do not strip VIEW_CONVERT_EXPRs from
the prefix in every case.
Eric Botcazou [Tue, 28 May 2019 07:40:07 +0000 (07:40 +0000)]
decl.c (components_to_record): Set a name on the type created for the REP part, if any.
* gcc-interface/decl.c (components_to_record): Set a name on the type
created for the REP part, if any.
* gcc-interface/utils.c (finish_record_type): Only take the maximum
when merging sizes for a variant part at offset 0.
(merge_sizes): Rename has_rep parameter into max.
Eric Botcazou [Mon, 27 May 2019 11:44:05 +0000 (11:44 +0000)]
trans.c (Call_to_gnu): Do not initialize the temporary created out of addressability concerns if...
* gcc-interface/trans.c (Call_to_gnu): Do not initialize the temporary
created out of addressability concerns if it's for the _Init parameter
of an initialization procedure.
Eric Botcazou [Mon, 27 May 2019 11:07:05 +0000 (11:07 +0000)]
trans.c (Identifier_to_gnu): Minor tweaks.
* gcc-interface/trans.c (Identifier_to_gnu): Minor tweaks.
(gnat_to_gnu): Do not convert the result if it is a reference to an
unconstrained array used as the prefix of an attribute reference that
requires an lvalue.
Eric Botcazou [Mon, 27 May 2019 10:48:48 +0000 (10:48 +0000)]
trans.c (Gigi_Types_Compatible): New predicate.
* gcc-interface/trans.c (Gigi_Types_Compatible): New predicate.
(Identifier_to_gnu): Use it to assert that the type of the identifier
and that of its entity are compatible for gigi. Rename a couple of
local variables and separate the processing of the result type.
re PR target/90530 (Invalid SUBREG insn generated by reload)
PR target/90530
* config/pa/pa.c (pa_can_change_mode_class): Accept mode changes from
DImode to SImode in floating-point registers on 64-bit target.
* config/pa/pa.md (umulsidi3): Change nonimmediate_operand to
register_operand in xmpyu patterns.
Jonathan Wakely [Fri, 24 May 2019 16:09:28 +0000 (17:09 +0100)]
PR libstdc++/85965 move is_invocable assertions again
This is another attempt to reduce how often the assertions are
evaluated, so that code which doesn't try to use the function objects
doesn't need them to be invocable.
For _Rb_tree we access the _M_key_compare object directly, so can't put
the assertions in an accessor function for it. However, every invocation
of _M_key_compare is accompanied by a use of _S_key, so the assertions
can be put in there. For _Hashtable there are member functions that are
consistently used to obtain a hash code or test for equality, so the
assertions can go in those members.
Backport from mainline
2019-05-17 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/85965
* include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static
assertions from the destructor.
* include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code):
Move static_assert for hash function to here.
(_Hash_table_base::_M_equals): Move static_assert for equality
predicate to here.
* include/bits/stl_tree.h (_Rb_tree::_S_key(_Const_Link_type)): Move
assertions here. Access the value directly instead of calling _S_value.
(_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to
_S_key(_Const_Link_type).
* testsuite/23_containers/set/85965.cc: Check construction,
destruction, assignment and size() do not trigger the assertions.
* testsuite/23_containers/unordered_set/85965.cc: Likewise.
* testsuite/23_containers/map/48101_neg.cc: Call find and adjust
expected errors.
* testsuite/23_containers/multimap/48101_neg.cc: Likewise.
* testsuite/23_containers/multiset/48101_neg.cc: Likewise.
* testsuite/23_containers/set/48101_neg.cc: Likewise.
* testsuite/23_containers/unordered_map/48101_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/48101_neg.cc: Likewise.
Jonathan Wakely [Thu, 23 May 2019 14:18:18 +0000 (15:18 +0100)]
Make any_cast compare typeinfo as well as function pointers
It's possible for the function pointer comparison to fail even though
the type is correct, because the function could be defined multiple
times with different addresses when shared libraries are in use.
Retain the function pointer check for the common case where the check
succeeds, but compare typeinfo (if RTTI is enabled) if the first check
fails.
Backport from mainline
2019-05-23 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/any (__any_caster): Use RTTI if comparing
addresses fails, to support non-unique addresses in shared libraries.
* include/std/any (__any_caster): Likewise.
* testsuite/experimental/any/misc/any_cast_neg.cc: Use 0 for dg-error
line number.
Jonathan Wakely [Thu, 23 May 2019 14:18:13 +0000 (15:18 +0100)]
PR libstdc++/90220 fix experimental::any_cast for non-object types
This corresponds to the fixes done for std::any_cast, but has to be done
without if-constexpr. The dummy specialization of _Manager_internal<_Op>
is used to avoid instantiating the real _Manager_internal<T>::_S_manage
function just to compare its address.
Backport from mainline
2019-05-23 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90220
* include/experimental/any (__any_caster): Constrain to only be
callable for object types. Use remove_cv_t instead of decay_t.
If the type decays or isn't copy constructible, compare the manager
function to a dummy specialization.
(__any_caster): Add overload constrained for non-object types.
(any::_Manager_internal<_Op>): Add dummy specialization.
* testsuite/experimental/any/misc/any_cast.cc: Test function types
and array types.
Jonathan Wakely [Wed, 22 May 2019 22:36:21 +0000 (23:36 +0100)]
PR libstdc++/90557 fix path assignment that alters source
Backport from mainline
2019-05-22 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90557
* src/c++17/fs_path.cc (path::_List::operator=(const _List&)): Fix
reversed arguments to uninitialized_copy_n.
* testsuite/27_io/filesystem/path/assign/copy.cc: Check that source
is unchanged by copy assignment.
* testsuite/util/testsuite_fs.h (compare_paths): Use std::equal to
compare path components.
Janne Blomqvist [Mon, 20 May 2019 17:43:05 +0000 (20:43 +0300)]
libfortran/90038 Use posix_spawn, reap dead children when wait=.false.
Backport from trunk.
When using posix_spawn or fork to launch a child process, the parent
needs to wait for the child, otherwise the dead child is left as a
zombie process. For this purpose one can install a signal handler for
SIGCHLD.
2019-05-20 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/90038
* intrinsics/execute_command_line (sigchld_handler): New function.
(execute_command_line): Install handler for SIGCHLD.
* configure.ac: Check for presence of sigaction and waitpid.
* config.h.in: Regenerated.
* configure: Regenerated.
fork() semantics can be problematic. Most unix style OS'es have
posix_spawn which can be used to replace fork + exec in many cases.
For more information see
e.g. https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.pdf
This replaces the one use of fork in libgfortran with posix_spawn.
Jonathan Wakely [Mon, 20 May 2019 13:02:10 +0000 (14:02 +0100)]
PR c++/90532 Ensure __is_constructible(T[]) is false
An array of an unknown bound is an incomplete type, so no object of such
a type can be constructed. This means __is_constructible should always
be false for an array of unknown bound.
This patch also changes the std::is_default_constructible trait to use
std::is_constructible, which now gives the right answer for arrays of
unknown bound.
gcc/cp:
Backported from mainline
2019-05-20 Jonathan Wakely <jwakely@redhat.com>
PR c++/90532 Ensure __is_constructible(T[]) is false
* method.c (is_xible_helper): Return error_mark_node for construction
of an array of unknown bound.
gcc/testsuite:
Backported from mainline
2019-05-20 Jonathan Wakely <jwakely@redhat.com>
PR c++/90532 Ensure __is_constructible(T[]) is false
* g++.dg/ext/90532.C: New test.
libstdc++-v3:
Backported from mainline
2019-05-20 Jonathan Wakely <jwakely@redhat.com>
Jakub Jelinek [Fri, 17 May 2019 19:53:48 +0000 (21:53 +0200)]
backport: omp-low.c (lower_rec_input_clauses): If OMP_CLAUSE_IF has non-constant expression...
Backported from mainline
2019-05-16 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lower_rec_input_clauses): If OMP_CLAUSE_IF
has non-constant expression, force sctx.lane and use two
argument IFN_GOMP_SIMD_LANE instead of single argument.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Don't DCE
two argument IFN_GOMP_SIMD_LANE without lhs.
* tree-vectorizer.h (struct _loop_vec_info): Add simd_if_cond
member.
(LOOP_VINFO_SIMD_IF_COND, LOOP_REQUIRES_VERSIONING_FOR_SIMD_IF_COND):
Define.
(LOOP_REQUIRES_VERSIONING): Or in
LOOP_REQUIRES_VERSIONING_FOR_SIMD_IF_COND.
* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
simd_if_cond.
(vect_analyze_loop_2): Punt if LOOP_VINFO_SIMD_IF_COND is constant 0.
* tree-vect-loop-manip.c (vect_loop_versioning): Add runtime check
from simd if clause if needed.
* gcc.dg/vect/vect-simd-1.c: New test.
* gcc.dg/vect/vect-simd-2.c: New test.
* gcc.dg/vect/vect-simd-3.c: New test.
* gcc.dg/vect/vect-simd-4.c: New test.
Jakub Jelinek [Fri, 17 May 2019 19:52:55 +0000 (21:52 +0200)]
backport: omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set max_vf to 1.
Backported from mainline
2019-05-15 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set
max_vf to 1.
* omp-expand.c (expand_omp_simd): For if (0) or simdlen (1) clear
safelen_int and set loop->dont_vectorize.
Jakub Jelinek [Fri, 17 May 2019 19:52:06 +0000 (21:52 +0200)]
backport: re PR debug/90197 (Cannot step through simple loop at -O -g)
Backported from mainline
2019-05-15 Jakub Jelinek <jakub@redhat.com>
PR debug/90197
* cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
before the condition (or if missing or constant non-zero at the end
of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
if any. Don't call protected_set_expr_location on incr if it already
has a location.
Jakub Jelinek [Fri, 17 May 2019 19:51:32 +0000 (21:51 +0200)]
backport: re PR tree-optimization/90385 (ICE: tree check: expected ssa_name, have real_cst in transform_to_exit_first_loop_alt, at tree-parloops.c:1772)
Backported from mainline
2019-05-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/90385
* tree-parloops.c (try_create_reduction_list): Punt on non-SSA_NAME
arguments of the exit phis.
Jakub Jelinek [Fri, 17 May 2019 19:48:25 +0000 (21:48 +0200)]
backport: re PR tree-optimization/90303 (ICE in hash_odr_name with fastcall attribute starting with r267359)
Backported from mainline
2019-05-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/90303
* ipa-devirt.c (obj_type_ref_class, get_odr_type): Don't use
TYPE_CANONICAL for TYPE_STRUCTURAL_EQUALITY_P types in !in_lto_p mode.
Richard Biener [Fri, 17 May 2019 08:10:58 +0000 (08:10 +0000)]
backport: [multiple changes]
2019-05-17 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-05-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/90316
* tree-ssa-alias.h (get_continuation_for_phi): Take walking
limit by reference.
(walk_non_aliased_vuses): Take walking limit argument.
* tree-ssa-alias.c (maybe_skip_until): Take limit and abort
walking if it is reached instead of just counting.
(get_continuation_for_phi): Likewise.
(walk_non_aliased_vuses): Likewise, instead of leaving counter
limiting to the callback.
* tree-ssa-sccvn.c (vn_reference_lookup_2): Adjust.
(vn_reference_lookup_3): Likewise.
(vn_reference_lookup_pieces): Likewise.
(vn_reference_lookup): Likewise.
* tree-ssa-pre.c (translate_vuse_through_block): Limit walking.
* tree-ssa-scopedtables.c (vuse_eq): Adjust.
(avail_exprs_stack::lookup_avail_expr): Likewise.
2019-05-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/90316
* tree-ssa-alias.c (maybe_skip_until): Pass in target BB,
compute target on demand.
(get_continuation_for_phi): Remove code walking stmts to
get to a target virtual operand which could end up being
quadratic.
Jonathan Wakely [Thu, 16 May 2019 23:00:26 +0000 (00:00 +0100)]
PR libstdc++/90299 make filesystem::absolute overloads consistent
In this implementation it is an error to pass the empty path to absolute,
because the empty path doesn't represent any file in the filesystem so
the function cannot meet its postcondition.
Currently the absolute(const path&, error_code&) overload reports an
error for the empty path, but using errc::no_such_file_or_directory, and
the other overload does not report an error. This patch makes them
consistntly report an errc::invalid_argument error for the empty path.
Backport from mainline
2019-05-04 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90299
* src/c++17/fs_ops.cc (absolute(const path&)): Report an error if the
argument is an empty path.
(absolute(const path&, error_code&)): Use invalid_argument as error
code instead of no_such_file_or_directory.
* testsuite/27_io/filesystem/operations/absolute.cc: Check handling
of non-existent paths and empty paths with both overloads of absolute.
Backport from mainline
2019-05-16 Jonathan Wakely <jwakely@redhat.com>
Jonathan Wakely [Wed, 15 May 2019 19:38:42 +0000 (20:38 +0100)]
Fix filesystem::path tests
The root_path.cc test had some debugging macros left in accidentally, so
didn't FAIL correctly if an assertion failed.
The string-char8_t.cc tests didn't compile on Windows.
Backport from mainline
2019-04-30 Jonathan Wakely <jwakely@redhat.com>
* testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove
macros accidentally left in.
* testsuite/27_io/filesystem/path/native/string-char8_t.cc: Remove
unnecessary -lstdc++fs option. Fix test for mingw.
* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
Fix test for mingw.
Jonathan Wakely [Wed, 15 May 2019 19:34:59 +0000 (20:34 +0100)]
PR libstdc++/90454.cc path construction from void*
Make the filesystem::path constructors SFINAE away for void* arguments,
instead of giving an error due to iterator_traits<void*>::reference.
Backport from mainline
2019-05-13 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90454.cc path construction from void*
* include/bits/fs_path.h (path::_Path): Use remove_pointer so that
pointers to void are rejected as well as void.
* include/experimental/bits/fs_path.h (path::_Path): Likewise.
* testsuite/27_io/filesystem/path/construct/80762.cc: Also check
pointers to void.
* testsuite/experimental/filesystem/path/construct/80762.cc: Likewise.
Li Jia He [Wed, 15 May 2019 05:20:02 +0000 (05:20 +0000)]
Fix a typo in two_value_replacement function
2019-05-15 Li Jia He <helijia@linux.ibm.com>
Backport from mainline.
2019-05-07 Li Jia He <helijia@linux.ibm.com>
* tree-ssa-phiopt.c (two_value_replacement): Fix a typo in parameter
detection.
* gcc.dg/tree-ssa/pr37508.c: Add the no-ssa-phiopt option to skip phi
optimization.
* gcc.dg/tree-ssa/pr88676-2.c: New testcase.
Iain Sandoe [Tue, 14 May 2019 17:41:36 +0000 (17:41 +0000)]
darwin, testsuite, backport fixes for PR 81058
2019-05-14 Iain Sandoe <iain@sandoe.co.uk>
Backport from mainline.
2019-05-11 Iain Sandoe <iain@sandoe.co.uk>
PR testsuite/81058
* gcc.target/i386/avx512bw-vpmovswb-1.c: Use regular data section
for variables on Darwin, rather than common.
* gcc.target/i386/avx512bw-vpmovuswb-1.c: Likewise.
* gcc.target/i386/avx512bw-vpmovwb-1.c: Likewise.