Backport of RISC-V support for libffi go closures
* src/riscv/ffi.c (ffi_call_go, ffi_prep_go_closure): New
functions.
(ffi_call_int): Renamed from ffi_call.
(ffi_call_asm, ffi_closure_inner): Adjust interface.
* src/riscv/ffitarget.h (FFI_GO_CLOSURES): Define.
* src/riscv/sysv.S (ffi_go_closure_asm): New function.
(ffi_closure_asm, ffi_call_asm): Update for adjusted interfaces.
From-SVN: r263550
* config/i386/i386.c (expand_vec_perm_movs): New method matching movs
patterns.
(expand_vec_perm_1): Try the new method.
* gcc.target/i386/sse2-movs.c: New test.
From-SVN: r263549
As explained in the PR, there's no reason to call the nothrow delete,
we can just use the normal one.
PR libstdc++/86954
* include/bits/stl_tempbuf.h (return_temporary_buffer): Use
non-placement delete.
From-SVN: r263542
2018-08-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/86116
* interface.c (compare_type): Remove a CLASS/TYPE check.
(compare_type_characteristics): New function that behaves like the old
'compare_type'.
(gfc_check_dummy_characteristics, gfc_check_result_characteristics):
Call 'compare_type_characteristics' instead of 'compare_type'.
2018-08-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/86116
* gfortran.dg/generic_34.f90: New test case.
From-SVN: r263540
Define a class using std::mutex for when std::atomic<memory_resource*>
cannot be used to implement the default memory resource.
When std::mutex constructor is not constexpr the constant_init trick
won't work, so just define a global and use init_priority for it. The
compiler warns about using reserved priority, so put the definition in a
header file using #pragma GCC system_header to suppress the warning.
PR libstdc++/86846
* src/c++17/default_resource.h: New file, defining default_res.
* src/c++17/memory_resource.cc [ATOMIC_POINTER_LOCK_FREE != 2]
(atomic_mem_res): Define alternative for atomic<memory_resource*>
using a mutex instead of atomics.
From-SVN: r263536
[ios::failure] p2: "When throwing ios_base::failure exceptions,
implementations should provide values of ec that identify the specific
reason for the failure."
This adds a new overload of __throw_ios_failure that can be passed
errno, to store error_code(errno, system_category()) in the exception
object.
PR libstdc++/85343
* acinclude.m4 (libtool_VERSION): Bump version.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add new symbol version.
Export new symbol.
* configure: Regenerate.
* doc/xml/manual/abi.xml: Document new versions.
* include/bits/fstream.tcc (basic_filebuf<C, T>::underflow)
(basic_filebuf<C, T>::xsgetn): Pass errno to __throw_ios_failure.
* include/bits/functexcept.h (__throw_ios_failure(const char*, int)):
Declare new overload.
* src/c++11/cxx11-ios_failure.cc (__ios_failure): Add new constructor
and static member function.
(__throw_ios_failure(const char*, int)): Define.
* src/c++98/ios_failure.cc [!_GLIBCXX_USE_DUAL_ABI]
(__throw_ios_failure(const char*, int)): Define.
* testsuite/util/testsuite_abi.cc: Update known and latest versions.
From-SVN: r263535
Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself. When such an iterator is copied, the
copy incorrectly retains pointers to the original.
This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced. An alternative would be to adjust the pointers so
they refer to the buffer in the copy.
2018-08-14 Jeremy Sawicki <jeremy-gcc@sawicki.us>
* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
(_Rope_iterator::operator=(const _Rope_iterator&)): Ensure
copied/assigned rope iterators don't retain pointers to the iterator
they were copied/assigned from.
* testsuite/ext/rope/7.cc: New.
From-SVN: r263534
* gcc/pretty-print.c (eat_esc_sequence): Swap the foreground and background
colors if the COMMON_LVB_REVERSE_VIDEO flag is set, and clear it thereafter,
as it only works for DBCS.
From-SVN: r263531
The getentropy function, found on Linux, OpenBSD, and recently also
FreeBSD, can be used to get random bytes to initialize the PRNG. It
is similar to the traditional way of reading from /dev/urandom, but
being a system call rather than a special file, it doesn't suffer from
problems like running out of file descriptors, or failure when running
in a container where /dev/urandom may not be available.
Regtested on x86_64-pc-linux-gnu, Ok for trunk?
2018-08-13 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac: Check for getentropy.
* intrinsics/random.c (getosrandom): Use getentropy if available.
* config.h.in: Regenerated.
* configure: Regenerated.
From-SVN: r263522
After the combine 2-2 changes, this testcase does not have a ZERO_EXTEND
in the intermediate code, but an AND instead.
gcc/testsuite/
* gcc.target/powerpc/pr56605.c: The generated code can have an AND
instead of a ZERO_EXTEND.
From-SVN: r263521
[gcc]
2018-07-06 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc/config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add support
for folding vec_perm.
From-SVN: r263520
[gcc]
2018-08-13 Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000.c (rs6000_gimple_fold_builtin):
Add support for gimple-folding of vec_pack() and vec_unpack()
intrinsics.
From-SVN: r263519
* libsupc++/new_opa.cc (operator new(size_t, align_val_t)): Use
__is_pow2 to check for valid alignment. Avoid branching when rounding
size to multiple of alignment.
From-SVN: r263515
* include/Makefile.am: Install <bit> and <version> for freestanding.
* include/Makefile.in: Regenerate.
* testsuite/17_intro/freestanding.cc: Check for <bit> and <version>.
From-SVN: r263514
This reverts commit r263461 / 2e920cd849b3cf0a72df4f172e27676a3e70b73f
because aligned_alloc is not defined for baremetal newlib targets, see
https://gcc.gnu.org/ml/libstdc++/2018-08/msg00065.html
Revert
2018-08-10 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR target/85904
* configure.ac: Define HAVE_ALIGNED_ALLOC if building for
Newlib.
* configure: Regenerate.
From-SVN: r263513
[gcc]
2018-08-13 Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000.c (rs6000_builtin_valid_without_lhs): Add
vec_xst variants to the list.
(rs6000_gimple_fold_builtin): Add support for folding unaligned
vector loads and stores.
From-SVN: r263512
P0806R2 - Deprecate implicit capture of this via [=]
* lambda.c (add_default_capture): Formatting fixes. Warn about
deprecated implicit capture of this via [=].
* g++.dg/cpp2a/lambda-this1.C: New test.
* g++.dg/cpp2a/lambda-this2.C: New test.
* g++.dg/cpp2a/lambda-this3.C: New test.
From-SVN: r263508
The CUDA driver API starting version 6.5 offers a set of runtime functions to
calculate several occupancy-related measures, as a replacement for the occupancy
calculator spreadsheet.
This patch adds a heuristic for default runtime launch geometry, based on the
new runtime function cuOccupancyMaxPotentialBlockSize.
Build on x86_64 with nvptx accelerator and ran libgomp testsuite.
2018-08-13 Cesar Philippidis <cesar@codesourcery.com>
Tom de Vries <tdevries@suse.de>
PR target/85590
* plugin/cuda/cuda.h (CUoccupancyB2DSize): New typedef.
(cuOccupancyMaxPotentialBlockSize): Declare.
* plugin/cuda-lib.def (cuOccupancyMaxPotentialBlockSize): New
CUDA_ONE_CALL_MAYBE_NULL.
* plugin/plugin-nvptx.c (CUDA_VERSION < 6050): Define
CUoccupancyB2DSize and declare
cuOccupancyMaxPotentialBlockSize.
(nvptx_exec): Use cuOccupancyMaxPotentialBlockSize to set the
default num_gangs and num_workers when the driver supports it.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
From-SVN: r263505
2018-08-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/66679
* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Class array
elements are returned as references to the data element. Get
the class expression by stripping back the references. Use this
for the element size.
2018-08-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/66679
* gfortran.dg/transfer_class_3.f90: New test.
From-SVN: r263499
2018-08-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/86906
* resolve.c (resolve_fl_variable_derived): Check if the derived
type is use associated before checking for the host association
error.
2018-08-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/86906
* gfortran.dg/use_rename_9.f90: New test.
From-SVN: r263494
PR tree-optimization/86835
* tree-ssa-math-opts.c (insert_reciprocals): Even when inserting
new_stmt after def_gsi, make sure to insert new_square_stmt after
that stmt, not 2 stmts before it.
* gcc.dg/pr86835.c: New test.
From-SVN: r263487
Ensure that nothrow versions of new and delete call the ordinary
versions of new or delete, instead of calling malloc or free directly.
These files are all compiled with -std=gnu++14 so can use noexcept and
nullptr to make the code more readable.
PR libstdc++/68210
* doc/xml/manual/intro.xml: Document LWG 206 change.
* libsupc++/del_op.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opa.cc: Likewise.
* libsupc++/del_opant.cc: Likewise.
* libsupc++/del_opnt.cc: Likewise. Call operator delete(ptr) instead
of free(ptr).
* libsupc++/del_ops.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opsa.cc: Likewise.
* libsupc++/del_opva.cc: Likewise.
* libsupc++/del_opvant.cc: Likewise.
* libsupc++/del_opvnt.cc: Likewise. Call operator delete[](ptr)
instead of operator delete(ptr).
* libsupc++/del_opvs.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opvsa.cc: Likewise.
* libsupc++/new_op.cc: Use __builtin_expect in check for zero size.
* libsupc++/new_opa.cc: Use nullptr instead of literal 0.
* libsupc++/new_opant.cc: Likewise. Replace _GLIBCXX_USE_NOEXCEPT
with noexcept.
* libsupc++/new_opnt.cc: Likewise. Call operator new(sz) instead of
malloc(sz).
* libsupc++/new_opvant.cc: Use nullptr and noexcept.
* libsupc++/new_opvnt.cc: Likewise. Call operator new[](sz) instead of
operator new(sz, nothrow).
* testsuite/18_support/new_nothrow.cc: New test.
From-SVN: r263478
2018-08-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/57160
* invoke.texi (frontend-optimize): Mention short-circuiting.
* options.c (gfc_post_options): Disable -ffrontend-optimize with -Og.
* resolve.c (resolve_operator): Warn about short-circuiting only with
-ffrontend-optimize.
* trans-expr.c (gfc_conv_expr_op): Use short-circuiting operators only
with -ffrontend-optimize. Without that flag, make sure that both
operands are evaluated.
2018-08-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/57160
* gfortran.dg/actual_pointer_function_1.f90: Fix invalid test case.
* gfortran.dg/inline_matmul_23.f90: Add option "-ffrontend-optimize".
* gfortran.dg/short_circuiting_2.f90: New test case.
* gfortran.dg/short_circuiting_3.f90: New test case.
From-SVN: r263471