Commit Graph

166930 Commits

Author SHA1 Message Date
Eric Botcazou
bf7988f1e9 lib2funcs.c (__set_trampoline_parity): Replace TRAMPOLINE_SIZE with __LIBGCC_TRAMPOLINE_SIZE__.
libgcc/
	* config/visium/lib2funcs.c (__set_trampoline_parity): Replace
	TRAMPOLINE_SIZE with __LIBGCC_TRAMPOLINE_SIZE__.
gcc/
	* final.c (insn_current_reference_address): Replace test on JUMP_P
	with test on jump_to_label_p.
	* config/visium/visium-passes.def: New file.
	* config/visium/t-visium (PASSES_EXTRA): Define.
	* config/visium/visium-protos.h (make_pass_visium_reorg): Declare.
	* config/visium/visium.h (TRAMPOLINE_SIZE): Adjust.
	(TRAMPOLINE_ALIGNMENT): Define.
	* config/visium/visium.c (visium_option_override): Do not register
	the machine-specific reorg pass here.
	(visium_trampoline_init): Align the BRA insn on a 64-bit boundary
	for the GR6.
	(output_branch): Adjust threshold for long branch instruction.
	* config/visium/visium.md (cpu): Move around.
	(length): Adjust for the GR6.

From-SVN: r268931
2019-02-15 10:40:34 +00:00
Jakub Jelinek
9f53b76775 re PR other/69006 (Extraneous newline emitted between error messages in GCC 6)
PR other/69006
	PR testsuite/88920
	* lib/gcc-dg.exp: If llvm_binutils effective target, set
	allow_blank_lines to 2 during initialization.
	(dg-allow-blank-lines-in-output): Set allow_blank_lines to 1 only if
	it was previously zero.
	(gcc-dg-prune): Don't check for llvm_binutils effective target here.
	Clear allow_blank_lines afterwards whenever it was 1.
	* gdc.test/gdc-test.exp (dmd2dg): Don't call
	dg-allow-blank-lines-in-output here.
	(gdc-do-test): Set allow_blank_lines to 3 if it is 0 before running
	the tests and restore it back at the end.

From-SVN: r268930
2019-02-15 08:52:50 +01:00
Jakub Jelinek
906c376300 opts-1.c: New test.
* c-c++-common/ubsan/opts-1.c: New test.
	* c-c++-common/ubsan/opts-2.c: New test.
	* c-c++-common/ubsan/opts-3.c: New test.
	* c-c++-common/ubsan/opts-4.c: New test.

From-SVN: r268929
2019-02-15 08:51:38 +01:00
Richard Biener
4c9ed22ae0 re PR tree-optimization/89278 (ICE in gimplify_modify_expr, at gimplify.c:5821)
PR tree-optimization/89278
	* tree-loop-distribution.c: Include tree-eh.h.
	(generate_memset_builtin, generate_memcpy_builtin): Call
	rewrite_to_non_trapping_overflow on builtin->size before passing it
	to force_gimple_operand_gsi.

	* gcc.dg/pr89278.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r268927
2019-02-15 08:39:45 +01:00
Jakub Jelinek
5f88ba10e0 re PR c/89340 (ICE in function_and_variable_visibility, at ipa-visibility.c:707)
PR c/89340
	* c-decl.c (start_function): Clear TREE_PUBLIC on nested functions
	before c_decl_attributes rather than after it.

	* gcc.dg/pr89340.c: New test.
	* gcc.dg/torture/pr57036-2.c (jpgDecode_convert): Expect a warning
	that leaf attribute on nested function is useless.

From-SVN: r268926
2019-02-15 08:38:09 +01:00
Jakub Jelinek
f521d9d8ad re PR other/89342 (ICE in maybe_default_option, at opts.c:347)
PR other/89342
	* optc-save-gen.awk: Handle optimize_fast like optimize_size or
	optimize_debug.
	* opth-gen.awk: Likewise.

	* gcc.dg/pr89342.c: New test.

From-SVN: r268924
2019-02-15 08:17:24 +01:00
Ian Lance Taylor
8a9f2a6bbd compiler, runtime: harmonize types referenced by both C and Go
Compiling with LTO revealed a number of cases in the runtime and
    standard library where C and Go disagreed about the type of an object or
    function (or where Go and code generated by the compiler disagreed). In
    all cases the underlying representation was the same (e.g., uintptr vs.
    void*), so this wasn't causing actual problems, but it did result in a
    number of annoying warnings when compiling with LTO.
    
    Reviewed-on: https://go-review.googlesource.com/c/160700

From-SVN: r268923
2019-02-15 01:57:51 +00:00
Ian Lance Taylor
c8530c4109 re PR go/89168 (FAIL: cmd/go/internal/load)
PR go/89168
    libgo: change gotest to run examples with output
    
    Change the gotest script to act like "go test" and run examples that
    have "output" comments.  This is not done with full generality, but
    just enough to run the libgo tests.  Other packages should be tested
    with "go test" as usual.
    
    While we're here clean up some old bits of gotest, and only run
    TestXXX functions that are actually in *_test.go files.  The latter
    change should fix https://gcc.gnu.org/PR89168.
    
    Reviewed-on: https://go-review.googlesource.com/c/162139

From-SVN: r268922
2019-02-15 00:36:50 +00:00
Ian Lance Taylor
b90fff0cc0 go-backend.c (go_imported_unsafe): Update optimization_default_node.
* go-backend.c (go_imported_unsafe): Update
	optimization_default_node.

From-SVN: r268921
2019-02-15 00:29:41 +00:00
GCC Administrator
f97745dca5 Daily bump.
From-SVN: r268920
2019-02-15 00:16:44 +00:00
Uros Bizjak
8b131a8a7a i386.h (TARGET_SUBTARGET64_ISA_DEFAULT): Enable MMX, SSE and SSE2 by default.
* config/i386/i386.h (TARGET_SUBTARGET64_ISA_DEFAULT):
	Enable MMX, SSE and SSE2 by default.
	* config/i386/i386.c (ix86_option_override_internal): Do not
	explicitly set MMX, SSE and SSE2 flags for TARGET_64BIT here.

From-SVN: r268917
2019-02-15 00:54:25 +01:00
Jakub Jelinek
dddd0c7a5b re PR rtl-optimization/89354 (Combine pass yields wrong code with -O2 and -msse2 for 32bit target)
PR rtl-optimization/89354
	* combine.c (make_extraction): Punt if extraction_mode is narrower
	than len bits.

	* gcc.dg/pr89354.c: New test.

From-SVN: r268913
2019-02-15 00:10:47 +01:00
Uros Bizjak
bf36afbc8f ssse3-pabsb.c: Re-enable 64-bit form on AVX targets.
* gcc.target/i386/ssse3-pabsb.c: Re-enable 64-bit form on AVX targets.
	* gcc.target/i386/ssse3-pabsd.c: Ditto.
	* gcc.target/i386/ssse3-pabsw.c: Ditto.
	* gcc.target/i386/ssse3-palignr.c: Ditto.
	* gcc.target/i386/ssse3-phaddd.c: Ditto.
	* gcc.target/i386/ssse3-phaddsw.c: Ditto.
	* gcc.target/i386/ssse3-phaddw.c: Ditto.
	* gcc.target/i386/ssse3-phsubd.c: Ditto.
	* gcc.target/i386/ssse3-phsubsw.c: Ditto.
	* gcc.target/i386/ssse3-phsubw.c: Ditto.
	* gcc.target/i386/ssse3-pmaddubsw.c: Ditto.
	* gcc.target/i386/ssse3-pmulhrsw.c: Ditto.
	* gcc.target/i386/ssse3-pshufb.c: Ditto.
	* gcc.target/i386/ssse3-psignb.c: Ditto.
	* gcc.target/i386/ssse3-psignd.c: Ditto.
	* gcc.target/i386/ssse3-psignw.c: Ditto.

From-SVN: r268907
2019-02-14 22:54:36 +01:00
Janne Blomqvist
6608603212 PR 81552 Improve and document -flag-init-integer
Make the option handling code parse the -flag-init-integer value as a
C long type, allowing a larger range on systems where long is a larger
type than int.  Document the behavior.

Regtested on x86_64-pc-linux-gnu, committed as obvious.

2019-02-14  Janne Blomqvist  <jb@gcc.gnu.org>

        PR fortran/81552
        * gfortran.h (gfc_option_t): Make flag_init_integer_value a long.
        * options.c (gfc_handle_option): Use strtol instead of atoi.
        * invoke.texi: Document -finit-integer behavior in more detail

From-SVN: r268906
2019-02-14 23:33:29 +02:00
Maya Rashish
2f2b8e4054 Add netbsd support for D compiler and runtime
Merges upstream druntime fb4bda91.

2019-02-14  Maya Rashish  <coypu@sdf.org>

gcc/ChangeLog:

	* config.gcc (*-*-netbsd*): Add netbsd-d.o
	* config/netbsd-d.c: New file.
	* config/t-netbsd: Add netbsd-d.o

gcc/d/ChangeLog:

	* d-system.h: NetBSD is POSIX.

libphobos/ChangeLog:

	* configure.tgt: Add netbsd/x86 as supported target.

From-SVN: r268905
2019-02-14 21:25:39 +00:00
Ian Lance Taylor
a6c723e202 re PR go/89321 (cross build with riscv64 gccgo compilation failed due to assert in constructor_expression)
PR go/89321
    compiler: copy has_padding field from converted struct
    
    Test case is https://golang.org/cl/162617.
    
    Fixes https://gcc.gnu.org/PR89321
    
    Reviewed-on: https://go-review.googlesource.com/c/162618

From-SVN: r268904
2019-02-14 21:07:13 +00:00
Steve Ellcey
cc2593977b pcs_attribute.c: New test.
2018-02-14  Steve Ellcey  <sellcey@marvell.com>

	* gcc.target/aarch64/pcs_attribute.c: New test.

From-SVN: r268903
2019-02-14 21:05:48 +00:00
Steve Ellcey
497f281c25 aarch64.c (aarch64_attribute_table): Change affects_type_identity to true for aarch64_vector_pcs.
2018-02-14  Steve Ellcey  <sellcey@marvell.com>

	* config/aarch64/aarch64.c (aarch64_attribute_table): Change
	affects_type_identity to true for aarch64_vector_pcs.
	(aarch64_comp_type_attributes): New function.
	(TARGET_COMP_TYPE_ATTRIBUTES): New macro.

From-SVN: r268902
2019-02-14 21:04:12 +00:00
Joseph Myers
86b69c6b11 * da.po: Update.
From-SVN: r268901
2019-02-14 20:50:51 +00:00
Joseph Myers
7b7a4f894e * da.po: Update.
From-SVN: r268900
2019-02-14 20:49:37 +00:00
Harald Anlauf
14b693baa2 re PR fortran/88248 ([F18] Bogus warning about obsolescent feature: Labeled DO statement)
2019-02-14  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/88248
	* symbol.c: Move check for labeled DO statement from
	gfc_define_st_label to gfc_reference_st_label.

	PR fortran/88248
	* gfortran.dg/pr88248.f90: New test.
	* gfortran.dg/f2018_obs.f90: Updated test.

From-SVN: r268895
2019-02-14 20:24:54 +00:00
Ian Lance Taylor
26a8c34ec9 compiler: check duplicate string keys in map composite literals
Updates golang/go#28104
    
    Reviewed-on: https://go-review.googlesource.com/c/161357

From-SVN: r268891
2019-02-14 19:26:20 +00:00
Tamar Christina
a930500fc4 Arm: Fix testism in pr88850 testcase.
gcc/testsuite/ChangeLog:

	* gcc.target/arm/pr88850.c: change options to additional option.

From-SVN: r268887
2019-02-14 18:29:06 +00:00
Rainer Orth
0b6e3127e8 Provide __start_minfo/__stop_minfo for linkers that don't (PR d/87864)
libphobos:
	PR d/87864
	* configure.ac (DRTSTUFF_SPEC): New variable.
	Substitute it.
	* libdruntime/m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING):
	New automake conditional.
	* configure: Regenerate.
	* libdruntime/gcc/drtstuff.c: New file.
	* libdruntime/Makefile.am [!DRUNTIME_OS_MINFO_BRACKETING]
	(DRTSTUFF, toolexeclib_DATA): New variables.
	(gcc/drtbegin.lo, gcc/drtend.lo): New rules.
	(libgdruntime_la_LDFLAGS): Use -Wc instead of -Xcompiler.
	Add -dstartfiles -B../src -Bgcc.
	(libgdruntime_la_DEPENDENCIES): New variable.
	(unittest_static_LDFLAGS): Use -Wc instead of -Xcompiler.
	(libgdruntime_t_la_LDFLAGS): Likewise.
	(unittest_LDFLAGS): Likewise.
	* src/Makefile.am (libgphobos_la_LDFLAGS): Use -Wc instead of
	-Xcompiler.
	Add -dstartfiles -B../libdruntime/gcc.
	(unittest_static_LDFLAGS): Use -Wc instead of -Xcompiler.
	(libgphobos_t_la_LDFLAGS): Likewise.
	(unittest_LDFLAGS): Likewise.
	* libdruntime/Makefile.in, src/Makefile.in: Regenerate.
	* Makefile.in, testsuite/Makefile.in: Regenerate.
	* libdruntime/rt/sections_elf_shared.d (Minfo_Bracketing): Don't
	assert.
	* libdruntime/gcc/config.d.in (Minfo_Bracketing): Remove.
	* src/drtstuff.spec: New file.
	* src/libgphobos.spec.in (DRTSTUFF_SPEC): Substitute.
	(*lib): Only pass SPEC_PHOBOS_DEPS without -debuglib, -defaultlib,
	-nophoboslib.
	* testsuite/testsuite_flags.in <--gdcldflags> (GDCLDFLAGS): Add
	-B${BUILD_DIR}/libdruntime/gcc.

	gcc/d:
	PR d/87864
	* lang.opt (dstartfiles): New option.
	* d-spec.cc (need_spec): New variable.
	(lang_specific_driver) <OPT_dstartfiles>: Enable need_spec.
	(lang_specific_pre_link): Also load libgphobos.spec if need_spec.

	gcc/testsuite:
	PR d/87864
	* lib/gdc.exp (gdc_link_flags): Add path to drtbegin.o/drtend.o if
	present.

From-SVN: r268886
2019-02-14 17:47:49 +00:00
Jonathan Wakely
323694e9a2 Update libstdc++ documentation for C++2a implementation status
* doc/xml/manual/status_cxx2020.xml: Update P0887R1 status.
	* doc/html/*: Regenerate.

From-SVN: r268885
2019-02-14 17:46:26 +00:00
Tamar Christina
2a26aed6ad Arm: Add HF modes to ANY iterators
The iterator ANY64 are used in various general split patterns and is supposed
to contain all 64 bit modes.

For some reason the pattern has HI but not HF.  This adds HF so that general
64 bit splits are generated for these modes as well.  These are required
by various split patterns that expect them to be there.

gcc/ChangeLog:

	PR target/88850
	* config/arm/iterators.md (ANY64): Add V4HF.

gcc/testsuite/ChangeLog:

	PR target/88850
	* gcc.target/arm/pr88850-2.c: New test.
	* lib/target-supports.exp
	(check_effective_target_arm_neon_softfp_fp16_ok_nocache,
	check_effective_target_arm_neon_softfp_fp16_ok,
	add_options_for_arm_neon_softfp_fp16): New.

From-SVN: r268884
2019-02-14 17:17:20 +00:00
Jonathan Wakely
bb2a18a3a8 Update libstdc++ documentation for implementation status
* doc/xml/manual/status_cxx2017.xml: Add P0063R3 to status table.
	* doc/html/*: Regenerate.

From-SVN: r268883
2019-02-14 15:12:57 +00:00
Jonathan Wakely
b7dbc6723a DR 2586 fix value category in uses-allocator checks
Because uses-allocator construction is invariably done with a const
lvalue the __uses_alloc helper should use a const lvalue for the
is_constructible checks. Otherwise, it can detect that the type can be
constructed from an rvalue, and then an error happens when a const
lvalue is passed to the constructor instead.

Prior to LWG DR 2586 scoped_allocator_adaptor incorrectly used an rvalue
type in the is_constructible check and then used a non-const lvalue for
the actual construction. The other components using uses-allocator
construction (tuple and polymorphic_allocator) have always done so with
a const lvalue allocator, although the use of __use_alloc in our
implementation meant they behaved the same as scoped_allocator_adaptor
and incorrectly used rvalues for the is_constructible checks.

In C++20 the P0591R4 changes mean that all uses-allocator construction
is defined in terms of the new uses_allocator_construction_args
functions, which always use a const lvalue allocator.

The changes in this patch ensure that the __use_alloc helper correctly
matches the requirements in the standard, consistently using a const
lvalue allocator for the is_constructible checks and the actual
constructor arguments.

	* doc/xml/manual/intro.xml: Document LWG 2586 status.
	* include/bits/uses_allocator.h (__uses_alloc): Use const lvalue
	allocator type in is_constructible checks.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust dg-error.
	* testsuite/20_util/scoped_allocator/dr2586.cc: New test.
	* testsuite/20_util/tuple/cons/allocators.cc: Add test using
	problematic type from LWG 2586 discussion.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.

From-SVN: r268882
2019-02-14 15:08:33 +00:00
Matthew Malcomson
6461bdc48f When this testcase was introduced it failed to account for the possibility of...
When this testcase was introduced it failed to account for the possibility of
targets that do not support arm mode or that do not support the ldrd/strd
instructions.

This patch accounts for both of these by adding some
dg-require-effective-target lines to the testcase.

This patch also adds a new effective-target procedure to check a target
supports ldrd/strd.

This patch also adds a new effective-target procedure to check a target
supports arm ldrd/strd.
The check uses the 'r' constraint to ensure SP is not used so that it will work
for thumb mode code generation as well as arm mode.

Tested by running this testcase with cross compilers using "-march=armv5t",
"-mcpu=cortex-m3", "-mcpu-arm7tdmi", "-mcpu=cortex-a9 -march=armv5t" for both
arm-none-eabi and arm-none-linux-gnueabihf.
Also ran this testcase with `make check` natively.

gcc/testsuite/ChangeLog:

2019-02-14  Matthew Malcomson  <matthew.malcomson@arm.com>

	* gcc.dg/rtl/arm/ldrd-peepholes.c: Restrict testcase.
	* lib/target-supports.exp: Add procedure to check for ldrd.

From-SVN: r268881
2019-02-14 14:51:46 +00:00
Jan Hubicka
ae2341c94d re PR lto/88677 (Divergence in -O2 and -O2 -flto early opts)
PR lto/88677
Fix PR number.

From-SVN: r268880
2019-02-14 14:49:03 +00:00
Jonathan Wakely
a61ae535c3 Add std::timespec and std::timespec_get for C++17
* configure.ac: Check for C11 timespec_get function.
	* crossconfig.m4 (freebsd, linux, gnu, cygwin, solaris, netbsd)
	(openbsd): Likewise
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/c_global/ctime (timespec, timespec_get): Add to namespace
	std for C++17 and up.

From-SVN: r268879
2019-02-14 14:10:25 +00:00
Jonathan Wakely
1f4dcbf7cd LWG 2537 fix priority_queue constructors to establish invariant
This change is safe to make now (in stage 4), because the constructors
are currently incorrect and unusable (unless the supplied container
already contains a heap, in which case the new make_heap calls are
redundant but harmless).

	* doc/xml/manual/intro.xml: Document LWG 2537 status.
	* include/bits/stl_queue.h
	(priority_queue(const Compare&, const Container&, const Alloc&))
	(priority_queue(const Compare&, Container&&, const Alloc&)): Call
	make_heap.
	* testsuite/23_containers/priority_queue/dr2537.cc: New test.

From-SVN: r268878
2019-02-14 14:10:19 +00:00
Jonathan Wakely
1138a19dfe Enforce LWG DR 2566 requirement for container adaptors
Although there is no good use for stack<int, deque<double>> or similar
types with a mismatched value_type, it's possible somebody is doing that
and getting away with it currently. This patch only enforces the new
requirement for C++17 and later. During stage 1 we should consider
enforcing it for C++11 and C++14.

	* doc/xml/manual/intro.xml: Document LWG 2566 status.
	* include/bits/stl_queue.h (queue, priority_queue): Add static
	assertions to enforce LWG 2566 requirement on value_type.
	* include/bits/stl_stack.h (stack): Likewise.

From-SVN: r268877
2019-02-14 14:10:12 +00:00
Cesar Philippidis
affd7d477a Fix PR72715 "ICE in gfc_trans_omp_do, at fortran/trans-openmp.c:3164"
The OpenACC 'resolve_oacc_nested_loops' function duplicates most code of the
OpenMP 'resolve_omp_do', but didn't include the PR60127 "ICE with OpenMP and DO
CONCURRENT" (trunk r210331) changes.  (Probably the two functions should be
unified?)

The Fortran DO CONCURRENT construct is a way to tell the compiler that loop
iterations don't have any interdependencies -- which is information that would
very well be suitable for OpenACC/OpenMP loops.  There are some "details"
however, see the discussion/references in PR60127, so for the time being, make
this a compile-time error instead of an ICE.

	gcc/fortran/
	* openmp.c (resolve_oacc_nested_loops): Error on do concurrent
	loops.

	gcc/testsuite/
	* gfortran.dg/goacc/loop-3-2.f95: Error on do concurrent loops.
	* gfortran.dg/goacc/loop-3.f95: Likewise.
	* gfortran.dg/goacc/pr72715.f90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

From-SVN: r268875
2019-02-14 14:44:19 +01:00
Martin Liska
696c5b27c5 Call free_dominance_info when transformed in DCE (PR rtl-optimization/89242).
2019-02-14  Martin Liska  <mliska@suse.cz>

	PR rtl-optimization/89242
	* dce.c (delete_unmarked_insns): Call free_dominance_info we
	process a transformation.
2019-02-14  Martin Liska  <mliska@suse.cz>

	PR rtl-optimization/89242
	* g++.dg/pr89242.C: New test.

From-SVN: r268873
2019-02-14 11:30:58 +00:00
Jonathan Wakely
133342f061 PR middle-end/89303 add testcase for std::enable_shared_from_this
* testsuite/20_util/enable_shared_from_this/89303.cc: New test.

From-SVN: r268869
2019-02-14 09:40:02 +00:00
Jakub Jelinek
3c545f7491 re PR tree-optimization/89314 (ICE in wide_int_to_tree_1, at tree.c:1561)
PR tree-optimization/89314
	* fold-const.c (fold_binary_loc): Cast strlen argument to
	const char * before dereferencing it.  Formatting fixes.

	* gcc.dg/pr89314.c: New test.

From-SVN: r268868
2019-02-14 10:25:01 +01:00
Jonathan Wakely
8936f5310a Document LWG 2735 status and add test
This DR was already resolved for GCC 7.1 by the implementation of DR
2192, but we didn't have an explicit test for the behaviour that 2735
guarantees.

	* doc/xml/manual/intro.xml: Document LWG 2735 status.
	* include/bits/std_abs.h: Add comment about LWG 2735.
	* testsuite/26_numerics/headers/cstdlib/dr2735.cc: New test.

From-SVN: r268867
2019-02-14 09:07:09 +00:00
Jakub Jelinek
31de5e4d91 re PR middle-end/89284 (gcc -fsanitize=undefined inhibits -Wuninitialized)
PR middle-end/89284
	* passes.def: Swap pass_ubsan and pass_early_warn_uninitialized.

	* gcc.dg/ubsan/pr89284.c: New test.

From-SVN: r268862
2019-02-14 08:31:14 +01:00
Ian Lance Taylor
0ce1c30b22 go-gcc.cc: #include "opts.h".
* go-gcc.cc: #include "opts.h".
	(Gcc_backend::function): Compile thunks with -Os.

From-SVN: r268861
2019-02-14 01:21:03 +00:00
Ian Lance Taylor
471f9e24a6 optc-save-gen.awk: Set var_opt_hash for initial optimizations and set current index for other...
gcc/:
	* optc-save-gen.awk: Set var_opt_hash for initial optimizations
	and set current index for other optimizations.
gcc/testsuite/:
	* gcc.dg/func-attr-1.c: New test.

From-SVN: r268860
2019-02-14 00:25:40 +00:00
GCC Administrator
b6f4a7876d Daily bump.
From-SVN: r268859
2019-02-14 00:16:38 +00:00
Jonathan Wakely
329c0f891a PR libstdc++/89345 Only define std::destroying_delete for C++2a
Clang defines the __cpp_impl_destroying_delete macro unconditionally, so
that the feature is supported whenever the library type is defined. This
is incompatible with the current definition in libstdc++ because we use
constexpr and inline variables, which will give an error for older -std
modes.

This patch defines the destroying_delete_t type and destroying_delete
variable independently of the __cpp_impl_destroying_delete macro, but
only for C++2a (because the names aren't reserved for previous
standards). The __cpp_lib_destroying_delete macro is only defined when
both the library type and compiler macro are defined (i.e. when the type
can actually be used as intended).

	PR libstdc++/89345
	* include/std/version [__cpp_impl_destroying_delete]
	(__cpp_lib_destroying_delete): Only define for C++2a and later.
	* libsupc++/new [__cpp_impl_destroying_delete]
	(__cpp_lib_destroying_delete): Likewise.
	(destroying_delete_t, destroying_delete): Likewise, but define even
	when __cpp_impl_destroying_delete is not defined.
	* testsuite/18_support/destroying_delete.cc: New test.

From-SVN: r268856
2019-02-13 22:13:45 +00:00
Uros Bizjak
4d259d3bc0 sse.md (vec_set<VI4F_256_512:mode>_0): Use nonimmediate_operand as operand 2 predicate.
* config/i386/sse.md (vec_set<VI4F_256_512:mode>_0): Use
	nonimmediate_operand as operand 2 predicate.
	(vec_set<VF2_512_256:mode>_0): Ditto.
	(vec_set<VI8_AVX_AVX512F:mode>_0): Ditto.
	(*vec_concatv2si): Remove alternative 2.
	(*vec_concatv4si_0): Use vm constraint for alternative 0.
	(*vec_concatv4si_0): Remove preferred_for_speed attribute.
	(vec_concatv2di): Split alternatives 4,5,6 to ...
	(*vec_concatv2di_0) ... new pattern.

testsuite/ChangeLog:

	* gcc.target/i386/sse2-init-v2di-2.c (dg-final): Update scan string.

From-SVN: r268855
2019-02-13 22:51:41 +01:00
Marek Polacek
f83fad402e PR c++/89297 - ICE with OVERLOAD in template.
* semantics.c (finish_compound_literal): Call
	instantiate_non_dependent_expr_sfinae.

	* g++.dg/cpp0x/initlist113.C: New test.

From-SVN: r268854
2019-02-13 21:39:18 +00:00
Alexandre Oliva
10839133ce [PR86379] do not use TREE_TYPE for USING_DECL_SCOPE
It's too risky to reuse the type field for USING_DECL_SCOPE.
Language-independent parts of the compiler, such as location and
non-lvalue wrappers, happily take the TREE_TYPE of a USING_DECL as if
it was a type rather than an unrelated scope.

For better or worse, USING_DECLs use the non-common struct so we can
use the otherwise unused result field.  Adjust fallout, from uses of
TREE_TYPE that were supposed to be USING_DECL_SCOPE, to other
accidental uses of TREE_TYPE of a USING_DECL.


for  gcc/cp/ChangeLog

	PR c++/86379
	* cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
	* name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
	* search.c (protected_accessible_p): Follow USING_DECL_DECLS.
	(shared_member_p): Likewise.
	(lookup_member): Likewise.
	* decl.c (grok_special_member_properties): Skip USING_DECLs.
	* semantics.c (finish_omp_declare_simd_methods): Likewise.
	(finish_qualified_id_expr): Do not call shared_member_p with
	a dependent expr.

for  gcc/testsuite/ChangeLog

	PR c++/86379
	* g++.dg/cpp0x/pr86379.C: New.

From-SVN: r268851
2019-02-13 19:08:52 +00:00
Alexandre Oliva
60378a964a [PR87322] move cp_evaluated up to tsubst all lambda parms
A lambda capture variable initialized with a lambda expr taking more
than one parameter got us confused.

The first problem was that the parameter list was cut short during
tsubsting because we tsubsted it with cp_unevaluated_operand.  We
reset it right after, to tsubst the function body, so I've moved the
reset up so that it's in effect while processing the parameters as
well.

The second problem was that the lambda expr appeared twice, once in a
decltype that gave the capture variable its type, and once in its
initializer.  This caused us to instantiate two separate lambda exprs
and closure types, and then to flag that the lambda expr in the
initializer could not be converted to the unrelated closure type
determined for the capture variable.  Recording the tsubsted expr in
the local specialization map, and retrieving it for reuse fixed it.
However, that required some care to avoid reusing the lambda expr
across different indices in pack expansions.


for  gcc/cp/ChangeLog

	PR c++/87322
	* pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
	Move cp_evaluated resetting before signature tsubsting.
	(gen_elem_of_pack_expansion_instantiation): Separate local
	specializations per index.

for  gcc/testsuite/ChangeLog

	PR c++/87322
	* g++.dg/cpp1y/pr87322.C: New.
	* g++.dg/cpp0x/lambda/lambda-variadic5.C: Test that we
	instantiate the expected number of lambda functions.

From-SVN: r268850
2019-02-13 17:42:39 +00:00
Marek Polacek
2db698cefc re PR c++/77304 (ICE on C++ code with invalid template parameter: in gimplify_expr, at gimplify.c:11260)
PR c++/77304
	* g++.dg/cpp2a/nontype-class13.C: New test.

From-SVN: r268849
2019-02-13 16:35:44 +00:00
Wilco Dijkstra
125b98b127 [ARM] Fix Thumb-1 ldm (PR89190)
This patch fixes an ICE in the Thumb-1 LDM peepholer.  Thumb-1 LDMs
always update the base register except if the base is loaded.
The current implementation rejects LDMs where the base is not dead,
however this doesn't exclude the case where the base is loaded as
well as dead.  Fix this by explicitly checking whether the base is
loaded.  Also enable LDMs which load the first register.

    gcc/
	PR target/89190
	* config/arm/arm.c (ldm_stm_operation_p) Set
	addr_reg_in_reglist correctly for first register.
	(load_multiple_sequence): Remove dead base check.
	(gen_ldm_seq): Correctly set write_back for Thumb-1.

    testsuite/
	PR target/89190
	* gcc.target/arm/pr89190.c: New test.

From-SVN: r268848
2019-02-13 16:22:25 +00:00
David Malcolm
6174de7c40 C++ concepts: fix ICE with requires on dtors (PR c++/89036)
PR c++/89036 reports an ICE due to this assertion failing

1136	  /* A class should never have more than one destructor.  */
1137	  gcc_assert (!current_fns || via_using || !DECL_DESTRUCTOR_P (method));

on this template with a pair of dtors, with
mutually exclusive "requires" clauses:

template<typename T>
struct Y {
    ~Y() requires(true) = default;
    ~Y() requires(false) {}
};

Nathan introduced this assertion as part of:

  ca9219bf18c68a001d62ecb981bc9176b0feaf12 (aka r251340):
    2017-08-24  Nathan Sidwell  <nathan@acm.org>
       Conversion operators kept on single overload set

which, amongst other changes to add_method had this:
     /* A class should never have more than one destructor.  */
  -  if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
  -    return false;
  +  gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method));

The following patch drops the assertion (I already had to generalize
the assertion in r268041 to fix PR c++/88699).

gcc/cp/ChangeLog:
	PR c++/89036
	* class.c (add_method): Drop destructor assertion.

gcc/testsuite/ChangeLog:
	PR c++/89036
	* g++.dg/concepts/pr89036.C: New test.

From-SVN: r268847
2019-02-13 15:48:37 +00:00