The old version of _Sp_counted_ptr_inplace::_M_get_deleter (up to GCC
8.2.0) expects to be passed a real std::typeinfo object, so mixing that
with the new definition of the __shared_ptr constructor (which always
passes the fake tag) leads to accessing the fake object as a real
std::typeinfo. Instead of trying to make it safe to mix the old and new
definitions, just stop using that function. By passing a reference to
__shared_ptr::_M_ptr to the __shared_count constructor it can be set
directly, without needing to obtain the pointer via the _M_get_deleter
back-channel. This avoids a virtual dispatch (which fixes PR 87514).
This means that code built against new libstdc++ headers doesn't use
_M_get_deleter at all, and so make_shared works the same whether RTTI is
enabled or not.
Also change _M_get_deleter so that it checks for a real type_info object
even when RTTI is disabled, by calling a library function. Unless
libstdc++ itself is built without RTTI that library function will be
able to test if it's the right type_info. This means the new definition
of _M_get_deleter can handle both the fake type_info tag and a real
type_info object, even if built without RTTI.
If linking to objects built against older versions of libstdc++ then if
all objects use -frtti or all use -fno-rtti, then the caller of
_M_get_deleter and the definition of _M_get_deleter will be consistent
and it will work. If mixing -frtti with -fno-rtti it can still fail if
the linker picks an old definition of _M_get_deleter and an old
__shared_ptr constructor that are incompatible. In that some or all
objects might need to be recompiled.
PR libstdc++/87514
PR libstdc++/87520
PR libstdc++/88782
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export new symbol.
* include/bits/shared_ptr.h
(shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...))
(allocate_shared): Change to use new tag type.
* include/bits/shared_ptr_base.h (_Sp_make_shared_tag::_S_eq):
Declare new member function.
(_Sp_alloc_shared_tag): Define new type.
(_Sp_counted_ptr_inplace): Declare __shared_count<_Lp> as a friend.
(_Sp_counted_ptr_inplace::_M_get_deleter) [!__cpp_rtti]: Use
_Sp_make_shared_tag::_S_eq to check type_info.
(__shared_count(Ptr, Deleter),__shared_count(Ptr, Deleter, Alloc)):
Constrain to prevent being called with _Sp_alloc_shared_tag.
(__shared_count(_Sp_make_shared_tag, const _Alloc&, Args&&...)):
Replace constructor with ...
(__shared_count(Tp*&, _Sp_alloc_shared_tag<_Alloc>, Args&&...)): Use
reference parameter so address of the new object can be returned to
the caller. Obtain the allocator from the tag type.
(__shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...)): Replace
constructor with ...
(__shared_ptr(_Sp_alloc_shared_tag<Alloc>, Args&&...)): Pass _M_ptr
to the __shared_count constructor.
(__allocate_shared): Change to use new tag type.
* src/c++11/shared_ptr.cc (_Sp_make_shared_tag::_S_eq): Define.
From-SVN: r268086
In my patch for CWG issue 2267, I changed reference_binding to clear
CONSTRUCTOR_IS_DIRECT_INIT on the argument init-list. But that breaks if
there's another candidate for which CONSTRUCTOR_IS_DIRECT_INIT is correct.
So instead, let's encode in the conversion that we want to override the
flag.
* call.c (reference_binding): Don't modify EXPR. Set
need_temporary_p on the ck_user conversion for a temporary.
(convert_like_real): Check it.
From-SVN: r268085
Reviewed-on: https://go-review.googlesource.com/c/158019
gotools/:
* Makefile.am (go_cmd_vet_files): Update for Go1.12beta2 release.
(GOTOOLS_TEST_TIMEOUT): Increase to 600.
(check-runtime): Export LD_LIBRARY_PATH before computing GOARCH
and GOOS.
(check-vet): Copy golang.org/x/tools into check-vet-dir.
* Makefile.in: Regenerate.
gcc/testsuite/:
* go.go-torture/execute/names-1.go: Stop using debug/xcoff, which
is no longer externally visible.
From-SVN: r268084
The memory store instructions (stfs[u][x], stxssp[x]) can result in
garbage if the value to be stored isn't already a valid single
precision floating point number. So we cannot use this here.
PR target/88892
* config/rs6000/rs6000.md (*movsi_from_df): Allow only register
operands.
From-SVN: r268083
It is wrong to use -m32 in dg-options. { target ia32 } should be used
instead. Also add -fno-pic to g++.target/i386/pr88587.C since it is
invalid with PIC.
PR middle-end/88587
* g++.target/i386/pr88587.C (dg-do): Add { target ia32 }.
(dg-options): Replace -m32 with -fno-pic.
* gcc.target/i386/mvc13.c (dg-do): Add { target ia32 }.
(dg-options): Remove -m32.
From-SVN: r268079
2019-01-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/88903
* tree-vect-stmts.c (vectorizable_shift): Verify we see all
scalar stmts a SLP shift amount is composed of when detecting
shifts by scalars.
* gcc.dg/vect/pr88903-1.c: New testcase.
* gcc.dg/vect/pr88903-2.c: Likewise.
From-SVN: r268076
Most armv7-a implementations support a number of basic extensions to
the architecture which are not particularly important to the compiler,
but can matter if code contains inline assembly. This patch adds
support for these extensions, based on the capabilities that GAS
already provides for the appropriate CPUs. For the purposes of
multilib selection we ignore these extensions entirely and map the
extended architecture versions down to the base versions we have
already support for.
gcc:
PR target/88799
* config/arm/arm-cpus.in (mp): New feature.
(sec): New feature.
(fgroup ARMv7ve): Add mp and sec features.
(arch armv7-a): Add options to allow mp and sec extensions.
(cpu generic-armv7-a): Add options to allow mp and sec extensions.
(cpu cortex-a5, cpu cortex-7, cpu cortex-a9): Add mp and sec
extenstions to the base architecture.
(cpu cortex-a8): Add sec extension to the base architecture.
(cpu marvell-pj4): Add mp and sec extensions to the base architecture.
* config/arm/t-aprofile (MULTILIB_MATCHES): Map all armv7-a arch
variants down to the base v7-a varaint.
* config/arm/t-multilib (v7_a_arch_variants): New variable.
* doc/invoke.texi (ARM Options): Add +mp and +sec to the list
of permitted extensions for -march=armv7-a and for
-mcpu=generic-armv7-a.
testsuite:
* gcc.target/arm/multilib.exp (config "aprofile"): Add tests for
mp and sec extensions to armv7-a.
From-SVN: r268072
2019-01-18 Martin Liska <mliska@suse.cz>
* libgcov-driver.c (gcov_version_string): New function.
(gcov_version): Convert version integer into string.
From-SVN: r268069
PR tree-optimization/86214
* tree-inline.h (struct copy_body_data): Add
add_clobbers_to_eh_landing_pads member.
* tree-inline.c (add_clobbers_to_eh_landing_pad): New function.
(copy_edges_for_bb): Call it if EH edge destination is <
id->add_clobbers_to_eh_landing_pads. Fix a comment typo.
(expand_call_inline): Set id->add_clobbers_to_eh_landing_pads
if flag_stack_reuse != SR_NONE and clear it afterwards.
* g++.dg/opt/pr86214-1.C: New test.
* g++.dg/opt/pr86214-2.C: New test.
From-SVN: r268067
Copy code example for fetch and nand from "Legacy __sync Built-in
Functions for Atomic Memory Access" to "Built-in Functions for Memory
Model Aware Atomic Operations".
gcc/
* doc/extend.texi (Built-in Functions for Memory Model Aware
Atomic Operations): Document atomic fetch and nand.
From-SVN: r268062
2019-01-18 Martin Liska <mliska@suse.cz>
Richard Biener <rguenther@suse.de>
PR middle-end/88587
* cgraph.h (create_version_clone_with_body): Add new argument
with attributes.
* cgraphclones.c (cgraph_node::create_version_clone): Add
DECL_ATTRIBUTES to a newly created decl. And call
valid_attribute_p so that proper cl_target_optimization_node
is set for the newly created declaration.
* multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES
for declaration.
(expand_target_clones): Do not call valid_attribute_p, it must
be already done.
* tree-inline.c (copy_decl_for_dup_finish): Reset mode for
vector types.
2019-01-18 Martin Liska <mliska@suse.cz>
PR middle-end/88587
* g++.target/i386/pr88587.C: New test.
* gcc.target/i386/mvc13.c: New test.
Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r268060
My patch for 64372 removed a bogus lvalue-rvalue conversion for one arm of a
?: expression where the other arm is a throw. But we still need to require
any overload to be resolved, even though we aren't getting that from
decay_conversion anymore.
* pt.c (resolve_nondeduced_context_or_error): Split out from...
* typeck.c (decay_conversion): ...here.
* call.c (build_conditional_expr_1): Use it.
From-SVN: r268058
The StackGrowsDown version being turned off for hppa targets.
After other fixes in the compiler, this allows core.thread unittests to
all pass, as well as the garbage collector to work correctly.
Backported from upstream druntime 2.084.
Reviewed-on: https://github.com/dlang/druntime/pull/2410
From-SVN: r268056
PR target/88734
* config/aarch64/arm_neon.h: Fix #pragma GCC target syntax - replace
(("..."))) with ("..."). Use arch=armv8.2-a+sha3 instead of
arch=armv8.2-a+crypto for vsha512hq_u64 etc. intrinsics.
From-SVN: r268049
PR middle-end/88273 - [8/9 Regression] warning: 'memcpy' offset [-527, -529]
is out of the bounds [0, 16]
gcc/ChangeLog:
PR middle-end/88273
* gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range):
Handle anti-ranges the same as no range at all.
gcc/testsuite/ChangeLog:
PR middle-end/88273
* gcc.dg/Warray-bounds-38.c: New test.
From-SVN: r268048
* c-typeck.c (digest_init): Revised the error message produced for
ill-formed cases of array initialization with a string literal.
(error_init): Make variadic.
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r268047
When we partially instantiate the constexpr if, we walk through its body to
see what it uses from the enclosing local_specializations. That walk was
overlooking the use of 'count' in the captures of the innermost lambda,
because we weren't walking into the capture list.
* tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
From-SVN: r268046
PR c++/88699 reports an ICE within this assertion in add_method:
gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method));
when adding an overloaded operator to a class via a using_decl, due to
DECL_DESTRUCTOR_P requiring a FUNCTION_DECL, but "method" being a
USING_DECL.
This patch weakens the assertion to avoid testing DECL_DESTRUCTOR_P
for the case where "via_using" is true, fixing the ICE.
gcc/cp/ChangeLog:
PR c++/88699
* class.c (add_method): Don't use DECL_DESTRUCTOR_P on
USING_DECLs.
gcc/testsuite/ChangeLog:
PR c++/88699
* g++.dg/template/pr88699.C: New test.
From-SVN: r268041
* src/c++17/fs_ops.cc
(equivalent(const path&, const path&, error_code&))
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use GetFileInformationByHandle to
compare files instead of relying on incomplete info returned by stat.
From-SVN: r268036
PR libstdc++/88884
* src/c++17/fs_ops.cc (absolute(const path&, error_code&)): Do nothing
if the path is already absolute.
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Normalize root-directory.
[!_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Pass error_code to current_path.
From-SVN: r268035
On Windows stat("foo/bar/../.") will resolve to "foo" even if that is a
non-directory and "foo/bar" does not exist. This is the expected
behaviour and consistent with boost::filesystem, so don't try to correct
it. The only unwanted behaviour is that stat("baz/") fails due to a
mingw bug (fixed in mingw-w64 v6.0.0) so add a workaround.
PR libstdc++/88881
* src/c++17/fs_ops.cc (canonical(const path&, error_code&))
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Normalize path, to match behaviour
of filesystem::exists.
(create_directories(const path&, error_code&)): Add assertions.
(status(const path&, error_code&)) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]:
Add workaround for bug in _wstat for paths with trailing slash.
* testsuite/27_io/filesystem/operations/create_directories.cc: Adjust
for expected behaviour on mingw.
* testsuite/experimental/filesystem/operations/create_directories.cc:
Likewise.
* testsuite/27_io/filesystem/operations/temp_directory_path.cc: Use
"TMP" instead of "TMPDIR" and clean environment before each test. Do
not test permissions on mingw targets.
From-SVN: r268034
Add test-case to verify that libbacktrace can read debug info that was
compressed with dwz.
2019-01-17 Tom de Vries <tdevries@suse.de>
PR libbacktrace/82857
* configure.ac (DWZ): Set with AC_CHECK_PROG.
(HAVE_DWZ): Set with AM_CONDITIONAL.
* configure: Regenerate.
* Makefile.am (TESTS): Add btest_dwz.
* Makefile.in: Regenerate.
From-SVN: r268032
Handle DW_FORM_GNU_ref_alt which references the .debug_info section in the
.gnu_debugaltlink file.
2019-01-17 Tom de Vries <tdevries@suse.de>
PR libbacktrace/82857
* dwarf.c (enum attr_val_encoding): Add ATTR_VAL_REF_ALT_INFO.
(read_attribute): Handle DW_FORM_GNU_ref_alt using
ATTR_VAL_REF_ALT_INFO.
(read_referenced_name_from_attr): Handle DW_FORM_GNU_ref_alt.
From-SVN: r268031
Add a function that finds the unit given an offset into .debug_info.
2019-01-17 Tom de Vries <tdevries@suse.de>
* dwarf.c (struct unit): Add low_offset and high_offset fields.
(struct unit_vector): New type.
(struct dwarf_data): Add units and units_counts fields.
(find_unit): New function.
(find_address_ranges): Add and handle unit_tag parameter.
(build_address_map): Add and handle units_vec parameter.
(build_dwarf_data): Pass units_vec to build_address_map. Store resulting
units vector.
From-SVN: r268030
The GCN toolchain must use the LLVM assembler and linker because there's no
binutils port. The LLVM tools do not have the same diagnostic style as
binutils, so the "blank line(s) in output" tests are inappropriate (and very
noisy).
The LLVM tools also have different command line options, so it's not possible
to autodetect object formats in the same way.
This patch addresses both issues.
2019-01-17 Andrew Stubbs <ams@codesourcery.com>
gcc/
* doc/sourcebuild.texi: Document dg-require-effective-target
llvm_binutils and offload_gcn.
gcc/testsuite/
* lib/file-format.exp (gcc_target_object_format): Handle AMD GCN.
* lib/gcc-dg.exp (gcc-dg-prune): Ignore blank lines from the LLVM
linker.
* lib/target-supports.exp (check_effective_target_llvm_binutils): New.
From-SVN: r268027
The GCN/HSA loader ignores the load address and uses a random location, so we
build all GCN binaries as PIE, by default.
This patch makes the necessary testsuite adjustments to make this work
correctly.
2019-01-17 Andrew Stubbs <ams@codesourcery.com>
gcc/testsuite/
* gcc.dg/graphite/scop-19.c: Check pie_enabled.
* gcc.dg/pic-1.c: Disable on amdgcn.
* gcc.dg/pic-2.c: Disable on amdgcn.
* gcc.dg/pic-3.c: Disable on amdgcn.
* gcc.dg/pic-4.c: Disable on amdgcn.
* gcc.dg/pie-3.c: Disable on amdgcn.
* gcc.dg/pie-4.c: Disable on amdgcn.
* gcc.dg/uninit-19.c: Check pie_enabled.
* lib/target-supports.exp (check_effective_target_pie): Add amdgcn.
From-SVN: r268026