Commit Graph

166487 Commits

Author SHA1 Message Date
Marek Polacek 52af30719f re PR c++/88744 (class non-type template parameters doesn't work with default template parameters)
PR c++/88744
	* g++.dg/cpp2a/nontype-class12.C: New test.

From-SVN: r267744
2019-01-08 23:54:47 +00:00
Jonathan Wakely 416f555930 Pretty printer test fixes and improvements
Test that StdUniquePtrPrinter correctly prints std::unique_ptr objects
using the old layout, prior to the PR libstdc++/77990 changes.

The printer test for a valueless std::variant started to fail because
the PR libstdc++/87431 fix meant it no longer became valueless. Change
the test to use a type that is not trivially copyable, so that the
exception causes it to become valueless.

	* testsuite/libstdc++-prettyprinters/compat.cc: Test printer support
	for old std::unique_ptr layout.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Fix std::variant test
	to become valueless. Add filesystem::path tests.

From-SVN: r267743
2019-01-08 23:15:49 +00:00
Jonathan Wakely d942bc80e4 PR libstdc++/87855 fix optional for types with non-trivial copy/move
When the contained value is not trivially copy (or move) constructible
the union's copy (or move) constructor will be deleted, and so the
_Optional_payload delegating constructors are invalid. G++ fails to
diagnose this because it incorrectly performs copy elision in the
delegating constructors. Clang does diagnose it (llvm.org/PR40245).

The solution is to avoid performing any copy (or move) when the
contained value's copy (or move) constructor isn't trivial. Instead the
contained value can be constructed by calling _M_construct. This is OK,
because the relevant constructor doesn't need to be constexpr when the
contained value isn't trivially copy (or move) constructible.

Additionally, this patch removes a lot of code duplication in the
_Optional_payload partial specializations and the _Optional_base partial
specialization, by hoisting it into common base classes.

The Python pretty printer for std::optional needs to be adjusted to
support the new layout. Retain support for the old layout, and add a
test to verify that the support still works.

	PR libstdc++/87855
	* include/std/optional (_Optional_payload_base): New class template
	for common code hoisted from _Optional_payload specializations. Use
	a template for the union, to allow a partial specialization for
	types with non-trivial destructors. Add constructors for in-place
	initialization to the union.
	(_Optional_payload(bool, const _Optional_payload&)): Use _M_construct
	to perform non-trivial copy construction, instead of relying on
	non-standard copy elision in a delegating constructor.
	(_Optional_payload(bool, _Optional_payload&&)): Likewise for
	non-trivial move construction.
	(_Optional_payload): Derive from _Optional_payload_base and use it
	for everything except the non-trivial assignment operators, which are
	defined as needed.
	(_Optional_payload<false, C, M>): Derive from the specialization
	_Optional_payload<true, false, false> and add a destructor.
	(_Optional_base_impl::_M_destruct, _Optional_base_impl::_M_reset):
	Forward to corresponding members of _Optional_payload.
	(_Optional_base_impl::_M_is_engaged, _Optional_base_impl::_M_get):
	Hoist common members from _Optional_base.
	(_Optional_base): Make all members and base class public.
	(_Optional_base::_M_get, _Optional_base::_M_is_engaged): Move to
	_Optional_base_impl.
	* python/libstdcxx/v6/printers.py (StdExpOptionalPrinter): Add
	support for new std::optional layout.
	* testsuite/libstdc++-prettyprinters/compat.cc: New test.

From-SVN: r267742
2019-01-08 23:00:46 +00:00
Marek Polacek 96e768c3fe PR c++/88538 - braced-init-list in template-argument-list.
* parser.c (cp_parser_template_argument): Handle braced-init-list when
	in C++20.

	* g++.dg/cpp2a/nontype-class11.C: New test.

From-SVN: r267741
2019-01-08 22:33:04 +00:00
Jakub Jelinek 7e55f2d868 re PR rtl-optimization/79593 (Poor/Worse code generation for FPU on versions after 6)
PR rtl-optimization/79593
	* config/i386/i386.md (reg = mem; mem = reg): New define_peephole2.

From-SVN: r267740
2019-01-08 23:29:56 +01:00
Jakub Jelinek 524abb0957 re PR target/88457 (ICE: Max. number of generated reload insns per insn is achieved (90))
PR target/88457
	* gcc.target/powerpc/pr88457.c: Remove -m32, -c and -mcpu=e300c3 from
	dg-options.  Require ppc_cpu_supports_hw effective target instead of
	powerpc64*-*-*.

From-SVN: r267739
2019-01-08 22:36:21 +01:00
Jakub Jelinek 8a6b263a82 rs6000.c (rs6000_delegitimize_address): Delegitimize UNSPEC_FUSION_GPR to its argument.
* config/rs6000/rs6000.c (rs6000_delegitimize_address): Delegitimize
	UNSPEC_FUSION_GPR to its argument.  Formatting fixes.

From-SVN: r267738
2019-01-08 22:35:38 +01:00
Janus Weil 903ecc6c2a re PR fortran/88047 (ICE in gfc_find_vtab, at fortran/class.c:2843)
2019-01-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/88047
	* class.c (gfc_find_vtab): For polymorphic typespecs, the components of
	the class container may not be available (in case of invalid code).

2019-01-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/88047
	* gfortran.dg/class_69.f90: New test case.

From-SVN: r267735
2019-01-08 20:29:01 +01:00
Eric Botcazou 6976bc87f1 re PR bootstrap/88721 (-Wmaybe-uninitialized warnings in sparc.c)
PR bootstrap/88721
	* config/sparc/sparc.c (function_arg_slotno): Set *PPREGNO & *PPADDING
	to -1 on entry.

	PR debug/88723
	* config/sparc/sparc.c (sparc_delegitimize_address): Deal with naked
	UNSPECs and UNSPEC_MOVE_GOTDATA specifically.

From-SVN: r267734
2019-01-08 19:09:52 +00:00
H.J. Lu 53ef4e3a94 x86: Don't generate vzeroupper if caller passes AVX/AVX512 registers
There is no need to generate vzeroupper if caller passes arguments in
AVX/AVX512 registers.

Tested on i686 and x86-64 with and without --with-arch=native.

gcc/

	PR target/88717
	* config/i386/i386.c (ix86_avx_u128_mode_exit): Call
	ix86_avx_u128_mode_entry.

gcc/testsuite/

	PR target/88717
	* gcc.target/i386/pr88717.c: New test.

From-SVN: r267732
2019-01-08 09:40:18 -08:00
Marek Polacek e01ffb47c6 PR c++/88548 - this accepted in static member functions.
* parser.c (cp_debug_parser): Adjust printing of
	local_variables_forbidden_p.
	(cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
	(cp_parser_primary_expression): When checking
	local_variables_forbidden_p, use THIS_FORBIDDEN or
	LOCAL_VARS_FORBIDDEN.
	(cp_parser_lambda_body): Update the type of
	local_variables_forbidden_p.  Set it to 0 rather than false.
	(cp_parser_condition): Adjust call to cp_parser_declarator.
	(cp_parser_explicit_instantiation): Likewise.
	(cp_parser_init_declarator): Likewise.
	(cp_parser_declarator): New parameter.  Use it.
	(cp_parser_direct_declarator): New parameter.  Use it to set
	local_variables_forbidden_p.  Adjust call to cp_parser_declarator.
	(cp_parser_type_id_1): Adjust call to cp_parser_declarator.
	(cp_parser_parameter_declaration): Likewise.
	(cp_parser_default_argument): Update the type of
	local_variables_forbidden_p.  Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
	rather than true.
	(cp_parser_member_declaration): Tell cp_parser_declarator if we saw
	'static' or 'friend'.
	(cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
	(cp_parser_late_parsing_default_args): Update the type of
	local_variables_forbidden_p.  Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
	rather than true.
	(cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
	(cp_parser_objc_class_ivars): Likewise.
	(cp_parser_objc_struct_declaration): Likewise.
	(cp_parser_omp_for_loop_init): Likewise.
	* parser.h (cp_parser): Change the type of local_variables_forbidden_p
	to unsigned char.
	(LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
	Define.

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

From-SVN: r267731
2019-01-08 17:37:51 +00:00
Martin Liska 5a5474ba24 Use proper type in linear transformation in tree-switch-conversion (PR tree-optimization/88753).
2019-01-08  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/88753
	* tree-switch-conversion.c (switch_conversion::build_one_array):
	Come up with local variable constructor.  Convert first to
	type of constructor values.
2019-01-08  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/88753
	* gcc.dg/tree-ssa/pr88753.c: New test.

From-SVN: r267728
2019-01-08 14:45:28 +00:00
Jonathan Wakely 9f5391ee95 PR libstdc++/88066 use <> for includes not ""
Using #include "..." to include a header in the same directory fails if
the user compiles with -I-, so always use something like <bits/...> for
internal headers.

I haven't added tests for this, because dg-options adds options to the
end, and the position of -I- matters (if it's at the end then the tests
won't find any headers in the build tree, as they're specified by -I
options earlier in the flags). It's been manually tested though.

	PR libstdc++/88066
	* include/bits/locale_conv.h: Use <> for includes not "".
	* include/ext/random: Likewise.
	* include/ext/vstring.h: Likewise.

From-SVN: r267726
2019-01-08 13:25:19 +00:00
Richard Biener e5ab5ae072 re PR middle-end/86554 (Incorrect code generation with signed/unsigned comparison)
2019-01-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86554
	* tree-ssa-sccvn.c (eliminate_dom_walker, rpo_elim,
	rpo_avail): Move earlier.
	(visit_nary_op): When value-numbering to expressions
	with different overflow behavior make sure there's an
	available expression on the path.

	* gcc.dg/torture/pr86554-1.c: New testcase.
	* gcc.dg/torture/pr86554-2.c: Likewise.

From-SVN: r267725
2019-01-08 13:05:47 +00:00
Rainer Orth e93bfd2de5 Fix libstdc++.so link on Solaris with C++17 std::basic_string member functions
* config/abi/pre/gnu.ver (GLIBCXX_3.4): Tighten existing patterns.
	(GLIBCXX_3.4.21): Likewise.

From-SVN: r267723
2019-01-08 12:04:38 +00:00
Paolo Carlini 50f9dff283 thread1.C: Tweak expected error #line 13 to cover target variance.
2019-01-08  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/diagnostic/thread1.C: Tweak expected error #line 13 to
	cover target variance.

From-SVN: r267722
2019-01-08 11:52:46 +00:00
Richard Biener eb4a91451a re PR fortran/88611 (ICE in eliminate_stmt, at tree-ssa-sccvn.c:5011)
2019-01-08  Richard Biener  <rguenther@suse.de>

	PR fortran/88611
	* trans-expr.c (gfc_conv_initializer): For ISOCBINDING_NULL_*
	directly build the expected GENERIC tree.

	* gfortran.dg/pr88611.f90: New testcase.

From-SVN: r267721
2019-01-08 10:46:04 +00:00
Sam Tebbs efac62a3d1 [PATCH 2/3][GCC][AARCH64] Add new -mbranch-protection option to combine pointer signing and BTI
gcc/ChangeLog:

2019-01-08  Sam Tebbs  <sam.tebbs@arm.com>

	* config/aarch64/aarch64.c (BRANCH_PROTECT_STR_MAX,
	aarch64_parse_branch_protection,
	struct aarch64_branch_protect_type,
	aarch64_handle_no_branch_protection,
	aarch64_handle_standard_branch_protection,
	aarch64_validate_mbranch_protection,
	aarch64_handle_pac_ret_protection,
	aarch64_handle_attr_branch_protection,
	accepted_branch_protection_string,
	aarch64_pac_ret_subtypes,
	aarch64_branch_protect_types,
	aarch64_handle_pac_ret_leaf): Define.
	(aarch64_override_options_after_change_1, aarch64_override_options):
	Add check for accepted_branch_protection_string.
	(aarch64_option_save): Save accepted_branch_protection_string.
	(aarch64_option_restore): Save accepted_branch_protection_string.
	* config/aarch64/aarch64.c (aarch64_attributes): Add branch-protection.
	* config/aarch64/aarch64.opt: Add mbranch-protection. Deprecate
	msign-return-address.
	* doc/invoke.texi: Add mbranch-protection.

gcc/testsuite/Changelog:

2019-01-08  Sam Tebbs  <sam.tebbs@arm.com>

	* gcc.target/aarch64/(return_address_sign_1.c,
	return_address_sign_2.c, return_address_sign_3.c (__attribute__)):
	Change option to -mbranch-protection.
	* gcc.target/aarch64/(branch-protection-option.c,
	branch-protection-option-2.c, branch-protection-attr.c,
	branch-protection-attr-2.c): New file.

From-SVN: r267717
2019-01-08 10:31:11 +00:00
Jonathan Wakely 35724e5154 PR libstdc++/88749 fix build failure in src/filesystem/ops.cc
PR libstdc++/88749
	* src/filesystem/ops.cc (last_write_time): Fix preprocessor condition
	to match the one that controls whether utimbuf and utime are declared.

From-SVN: r267705
2019-01-08 10:18:54 +00:00
Pierre-Marie de Rodat 1d005accea [Ada] Bump copyright years to 2019
From-SVN: r267683
2019-01-08 09:54:04 +00:00
Justin Squirek 713125282e [Ada] Revert recent changes in the generation of deps in ali files
Following the discovery of regressions in GPRbuild, this reverts both
r263100 and r264608:

2019-01-08  Justin Squirek  <squirek@adacore.com>

	Revert:

	2018-07-31  Justin Squirek  <squirek@adacore.com>

	gcc/ada/

		* lib-writ.adb (Write_With_Lines): Modfiy the generation
		of dependencies within ali files so that source unit
		bodies are properly listed even if said bodies are
		missing.  Perform legacy behavior in GNATprove mode.
		* lib-writ.ads: Modify documentation to reflect current
		behavior.

	and:

	2018-09-26  Justin Squirek  <squirek@adacore.com>

	gcc/ada/

		* lib-writ.adb, lib-writ.ads (Write_With_Lines): Add
		documentation and an extra conditional check for RCI
		units so that generated ali files will list the spec
		only instead of a body when a body is not found.

From-SVN: r267680
2019-01-08 09:52:32 +00:00
Paolo Carlini 30fa2068a3 decl.c (start_decl): Improve permerror location.
/cp
2019-01-08  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (start_decl): Improve permerror location.

/testsuite
2019-01-08  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/diagnostic/out-of-class-redeclaration.C: New.

From-SVN: r267675
2019-01-08 09:41:36 +00:00
Iain Sandoe e32ba3f7ab teststuite - avoid parts of builtin-has-attribute tests requireing alias support.
2019-01-08  Iain Sandoe  <iain@sandoe.co.uk>

gcc/testsuite/

	* c-c++-common/builtin-has-attribute-3.c: Skip tests requiring symbol
	alias support.
	* c-c++-common/builtin-has-attribute-4.c: Likewise.
	Append match for warning that ‘protected’ attribute is not supported.

From-SVN: r267674
2019-01-08 09:26:29 +00:00
Iain Sandoe 2e81e6e929 testsuite - Require alias support for three tests.
2019-01-08  Iain Sandoe  <iain@sandoe.co.uk>

gcc/testsuite/

	* gcc.dg/Wmissing-attributes.c: Require alias support.
	* gcc.dg/attr-copy-2.c: Likewise.
	* gcc.dg/attr-copy-5.c: Likewise.

From-SVN: r267673
2019-01-08 09:15:34 +00:00
Jonathan Wakely ff0425cdeb re PR c++/88554 (Segfault ICE when falling off the end of a reference-returning friend operator)
PR c++/88554
	* decl.c (finish_function): For -Wreturn-type don't add a return *this;
	fixit hint if current_class_ref is NULL.  Use a single if instead of
	two nested ones.

	* g++.dg/warn/Wreturn-type-11.C: New test.

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

From-SVN: r267672
2019-01-08 09:57:58 +01:00
David Malcolm 44e813ecd1 Fix jit test case (PR jit/88747)
Amongst other changes, r266077 updated value_range_base::dump so
that it additionally prints the type.  This broke an assertion within
the jit testsuite, in jit.dg/test-sum-of-squares.c, which was checking
for:
  ": [-INF, n_"
but was now getting:
  ": signed int [-INF, n_"

The test is merely intended as a simple verification that we can read
dump files via gcc_jit_context_enable_dump.

This patch loosens the requirements on the dump so that it should work
with either version of value_range_base::dump.

gcc/testsuite/ChangeLog:
	PR jit/88747
	* jit.dg/test-sum-of-squares.c (verify_code): Update expected vrp
	dump to reflect r266077.

From-SVN: r267671
2019-01-08 01:39:09 +00:00
GCC Administrator ddb45008f2 Daily bump.
From-SVN: r267670
2019-01-08 00:16:40 +00:00
Jakub Jelinek c4581bbfb4 re PR c/88701 (Internal compiler error for valid program using compound literal with variably modified type.)
PR c/88701
	* c-decl.c (build_compound_literal): If not TREE_STATIC, only pushdecl
	if current_function_decl is non-NULL.

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

From-SVN: r267667
2019-01-07 23:55:48 +01:00
Alan Modra 2d8d93c783 genattrtab bit-rot, and if_then_else in values
This patch started off just by adding if_then_else support in
write_attr_value to be able to write a saner expression for powerpc
tls_gdld_nomark length.  Then I noticed bit-rot in functions used to
calculate insn_default_length, insn_min_length, and length_unit_log
(which are used by the shorten_branches pass).  These functions
don't handle a const_int length value and return an "unknown" status
that isn't used, or in the case of or_attr_value, doesn't need to be
used.  min_attr_value also attempts to return INT_MAX for the
unhandled rtl case, but this can get lost in recursive calls.  I fixed
that problem by returning INT_MIN instead, and translating that to
INT_MAX in the only caller of min_attr_value.

	PR target/88614
	* genattrtab.c (max_attr_value, min_attr_value, or_attr_value):
	Delete "unknownp" parameter.  Adjust callers.  Handle
	CONST_INT, PLUS, MINUS, and MULT.
	(attr_value_aligned): Renamed from or_attr_value.
	(min_attr_value): Return INT_MIN for unhandled rtl case..
	(min_fn): ..and translate to INT_MAX here.
	(write_length_unit_log): Modify to cope without "unknown".
	(write_attr_value): Handle IF_THEN_ELSE.

From-SVN: r267666
2019-01-08 09:24:40 +10:30
Joseph Myers 65c5b1eb85 Fix diagnostics for never-defined inline and nested functions (PR c/88720, PR c/88726).
Bugs 88720 and 88726 report issues where a function is declared inline
in an inner scope, resulting in spurious diagnostics about it being
declared but never defined when that scope is left (possibly in some
cases also wrongly referring to the function as a nested function).
These are regressions that were introduced with the support for C99
inline semantics in 4.3 (they don't appear with 4.2; it's possible
some aspects of the bugs might have been introduced later than 4.3).

For the case of functions being wrongly referred to as nested,
DECL_EXTERNAL was not the right condition for a function being
non-nested; TREE_PUBLIC is appropriate for the case of non-nested
functions with external linkage, while !b->nested means this is the
outermost scope in which the function was declared and so avoids
catching the case of a file-scope static being redeclared inline
inside a function.

For the non-nested, external-linkage case, the code attempts to avoid
duplicate diagnostics by diagnosing only when scope != external_scope,
but actually scope == external_scope is more appropriate, as it's only
when the file and external scopes are popped that the code can
actually tell whether a function ended up being defined, and all such
functions will appear in the (GCC-internal) external scope.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

	PR c/88720
	PR c/88726
gcc/c:
	* c-decl.c (pop_scope): Use TREE_PUBLIC and b->nested to determine
	whether a function is nested, not DECL_EXTERNAL.  Diagnose inline
	functions declared but never defined only for external scope, not
	for other scopes.

gcc/testsuite:
	* gcc.dg/inline-40.c, gcc.dg/inline-41.c: New tests.

From-SVN: r267665
2019-01-07 22:39:43 +00:00
Joseph Myers c3336d9b13 * es.po: Update.
From-SVN: r267663
2019-01-07 22:32:55 +00:00
Paolo Carlini 2c86a5741f decl.c (start_decl): Improve two error_at locations.
/cp
2019-01-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (start_decl): Improve two error_at locations.
	(expand_static_init): Likewise.

/testsuite
2019-01-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/diagnostic/constexpr1.C: New.
	* g++.dg/diagnostic/thread1.C: Likewise.

From-SVN: r267662
2019-01-07 22:28:30 +00:00
Ian Lance Taylor 33a5d8ccb5 runtime: in doscanstackswitch, set gp->m before gogo
This is following CL 156038. doscanstackswitch uses the same
    mechanism of switching goroutines as getTraceback, and so has
    the same problem as described in issue golang/go#29448. This CL
    applies the same fix.
    
    Reviewed-on: https://go-review.googlesource.com/c/156697

From-SVN: r267661
2019-01-07 22:07:26 +00:00
Ian Lance Taylor fdcef314bc compiler: move slice construction to callers of makeslice
This is the gccgo version of https://golang.org/cl/141822:
    
        Only return a pointer p to the new slices backing array from makeslice.
        Makeslice callers then construct sliceheader{p, len, cap} explictly
        instead of makeslice returning the slice.
    
    This change caused the GCC backend to break the runtime/pprof test by
    merging together the identical functions allocateReflectTransient and
    allocateTransient2M.  This caused the traceback to be other than
    expected.  Fix that by making the functions not identical.
    
    This is a step toward updating libgo to the Go1.12beta1 release.
    
    Reviewed-on: https://go-review.googlesource.com/c/155937

From-SVN: r267660
2019-01-07 21:44:06 +00:00
Ian Lance Taylor 575eb8f58b runtime: in getTraceback, set gp->m before gogo
Currently, when collecting a traceback for another goroutine,
    getTraceback calls gogo(gp) switching to gp, which will resume in
    mcall, which will call gtraceback, which will set up gp->m. There
    is a gap between setting the current running g to gp and setting
    gp->m. If a profiling signal arrives in between, sigtramp will
    see a non-nil gp with a nil m, and will seg fault. Fix this by
    setting up gp->m first.
    
    Fixes golang/go#29448.
    
    Reviewed-on: https://go-review.googlesource.com/c/156038

From-SVN: r267658
2019-01-07 20:12:39 +00:00
Thomas Koenig 419af57c13 re PR fortran/45424 ([F08] Add IS_CONTIGUOUS intrinsic)
2019-01-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
	Harald Anlauf <anlauf@gmx.de>
	Tobias Burnus <burnus@gcc.gnu.org>

	PR fortran/45424
	* check.c (gfc_check_is_contiguous): New function.
	* expr.c (gfc_is_not_contiguous): New function.
	* gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_CONTIGUOUS.
	Add prototype for gfc_is_not_contiguous.
	* intrinsic.c (do_ts29113_check): Add GFC_ISYM_IS_CONTIGUOUS.
	(add_function): Add is_contiguous.
	* intrinsic.h: Add prototypes for gfc_check_is_contiguous,
	gfc_simplify_is_contiguous and gfc_resolve_is_contiguous.
	* intrinsic.texi: Add IS_CONTIGUOUS.
	* iresolve.c (gfc_resolve_is_contiguous): New function.
	* simplify.c (gfc_simplify_is_contiguous): New function.
	* trans-decl.c (gfor_fncecl_is_contiguous0): New variable.
	(gfc_build_intrinsic_function_decl): Add it.
	* trans-intrinsic.c (gfc_conv_intrinsic_is_contiguous): New
	function.
	(gfc_conv_intrinsic_function): Handle GFC_ISYM_IS_CONTIGUOUS.

2019-01-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
	Harald Anlauf <anlauf@gmx.de>
	Tobias Burnus <burnus@gcc.gnu.org>

	PR fortran/45424
	* Makefile.am: Add intrinsics/is_contiguous.c.
	* Makefile.in: Regenerated.
	* gfortran.map: Add _gfortran_is_contiguous0.
	* intrinsics/is_contiguous.c: New file.
	* libgfortran.h: Add prototype for is_contiguous0.

2019-01-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
	Harald Anlauf <anlauf@gmx.de>
	Tobias Burnus <burnus@gcc.gnu.org>

	* gfortran.dg/is_contiguous_1.f90: New test.
	* gfortran.dg/is_contiguous_2.f90: New test.
	* gfortran.dg/is_contiguous_3.f90: New test.


Co-Authored-By: Harald Anlauf <anlauf@gmx.de>
Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org>

From-SVN: r267657
2019-01-07 19:30:28 +00:00
Marek Polacek 25a34b0236 PR c++/88741 - wrong error with initializer-string.
* decl.c (cp_complete_array_type): Strip any location wrappers.

	* g++.dg/init/array50.C: New test.

From-SVN: r267656
2019-01-07 19:25:41 +00:00
Richard Sandiford cc770199de Fix IFN_MASK_STORE handling of IFN_GOMP_SIMD_LANE
The IFN_GOMP_SIMD_LANE handling in vectorizable_store tries to use MEM_REF
offsets to maintain pointer disambiguation info.  This patch makes sure
that we don't try to do the same optimisation for IFN_MASK_STOREs, which
have no similar offset argument.

The patch fixes libgomp.c-c++-common/pr66199-*.c for SVE.  Previously
we had an ncopies==2 store and stored both halves to the same address.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-stmts.c (vectorizable_store): Don't use the dataref_offset
	optimization for masked stores.

From-SVN: r267654
2019-01-07 18:53:44 +00:00
Bernd Edlinger 08c35030c7 re PR c++/88261 (ICE: verify_gimple failed (error: non-trivial conversion at assignment))
PR c++/88261
        PR c++/69338
        PR c++/69696
        PR c++/69697
        * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
        * typeck2.c (digest_init_r): Raise an error for non-static
        initialization of a flexible array member.
        (process_init_constructor, massage_init_elt,
        process_init_constructor_array, process_init_constructor_record,
        process_init_constructor_union, process_init_constructor): Add the
        flags parameter and pass it thru.
        (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
        digest_init_flags for static decls.

gcc/testsuite:
2019-01-07  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c++/88261
        PR c++/69338
        PR c++/69696
        PR c++/69697
        * gcc.dg/array-6.c: Move from here ...
        * c-c++-common/array-6.c: ... to here and add some more test coverage.
        * g++.dg/pr69338.C: New test.
        * g++.dg/pr69697.C: Likewise.
        * g++.dg/ext/flexary32.C: Likewise.
        * g++.dg/ext/flexary3.C: Adjust test.
        * g++.dg/ext/flexary12.C: Likewise.
        * g++.dg/ext/flexary13.C: Likewise.
        * g++.dg/ext/flexary15.C: Likewise.
        * g++.dg/warn/Wplacement-new-size-1.C: Likewise.
        * g++.dg/warn/Wplacement-new-size-2.C: Likewise.
        * g++.dg/warn/Wplacement-new-size-6.C: Likewise.

From-SVN: r267653
2019-01-07 17:08:51 +00:00
Richard Sandiford 18fd43b952 Fix ICE in get_initial_defs_for_reduction (PR 88567)
The use of "j" in:

	      init = permute_results[number_of_vectors - j - 1];

was out-of-sync with the new flat loop structure.  Now that all that
reversing is gone, we can just use the result of duplicate_and_interleave
directly.

The other cases shouldn't be affected by postponing the insertion
of ctor_seq, since gimple_build* appends to the seq without clearing
it first (unlike some of the gimplify routines).

The ICE is already covered by gcc.dg/vect/pr63379.c.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR middle-end/88567
	* tree-vect-loop.c (get_initial_defs_for_reduction): Pass the
	output vector directly to duplicate_and_interleave instead of
	going through a temporary.  Postpone insertion of ctor_seq to
	the end of the loop.

From-SVN: r267652
2019-01-07 16:00:52 +00:00
Jonathan Wakely e002afaa8e PR libstdc++/87787 avoid undefined null args to memcpy and memmove
The C++ char_traits and ctype APIs do not disallow null pointer
arguments, so we need explicit checks to ensure we don't forward null
pointers to memcpy or memmove.

	PR libstdc++/87787
	* include/bits/char_traits.h (char_traits::move): Do not pass null
	pointers to memmove.
	* include/bits/locale_facets.h
	(ctype<char>::widen(const char*, const char*, char*)): Do not
	pass null pointers to memcpy.
	(ctype<char>::narrow(const char*, const char*, char, char*)):
	Likewise.
	(ctype<char>::do_widen(const char*, const char*, char*)):
	Likewise.
	(ctype<char>::do_narrow(const char*, const char*, char, char*)):
	Likewise.

From-SVN: r267651
2019-01-07 14:58:44 +00:00
Richard Earnshaw a58fe3c5ca Investigating PR target/86891 revealed a number of issues with the way the...
Investigating PR target/86891 revealed a number of issues with the way
the AArch64 backend was handing overflow detection patterns.  Firstly,
expansion for signed and unsigned types is not the same as in one form
the overflow is detected via the C flag and in the other it is done
via the V flag in the PSR.  Secondly, particular care has to be taken
when describing overflow of signed types: the comparison has to be
performed conceptually on a value that cannot overflow and compared to
a value that might have overflowed.

It became apparent that some of the patterns were simply unmatchable
(they collapse to NEG in the RTL rather than subtracting from zero)
and a number of patterns were overly restrictive in terms of the
immediate constants that they supported.  I've tried to address all of
these issues as well.

gcc:

	PR target/86891
	* config/aarch64/aarch64.c (aarch64_expand_subvti): New parameter
	unsigned_p.  Handle signed and unsigned overflow correction as
	required.
	* config/aarch64/aarch64-protos.h (aarch64_expand_subvti): Update
	prototype.
	* config/aarch64/aarch64.md (addv<mode>4): Use aarch64_plus_operand
	for operand 2.
	(add<mode>3_compareV_imm): Make this callable for expanding.
	(subv<GPI:mode>4): Use register_operand for operand 1.  Use
	aarch64_plus_operand for operand 2.
	(subv<GPI:mode>_insn): New insn pattern.
	(subv<GPI:mode>_imm): Likewise.
	(negv<GPI:mode>3): New expand pattern.
	(negv<GPI:mode>_insn): New insn pattern.
	(negv<GPI:mode>_cmp_only): Likewise.
	(cmpv<GPI:mode>_insn): Likewise.
	(subvti4): Use register_operand for operand 1.  Update call to
	aarch64_expand_subvti.
	(usubvti4): Likewise.
	(negvti3): New expand pattern.
	(negdi_carryout): New insn pattern.
	(negvdi_carryinV): New insn pattern.
	(sub<mode3>_compare1_imm): Delete named insn pattern, make anonymous
	version the named version.
	(peepholes to convert to sub<mode3>_compare1_imm): Adjust order of
	operands.
	(usub<GPI:mode>3_carryinC, usub<GPI:mode>3_carryinC_z1): New insn
	patterns.
	(usub<GPI:mode>3_carryinC_z2, usub<GPI:mode>3_carryinC): New insn
	patterns.
	(sub<mode>3_carryinCV, sub<mode>3_carryinCV_z1_z2): Delete.
	(sub<mode>3_carryinCV_z1, sub<mode>3_carryinCV_z2): Delete.
	(sub<mode>3_carryinCV): Delete.
	(sub<GPI:mode>3_carryinV): New expand pattern.
	sub<mode>3_carryinV, sub<mode>3_carryinV_z2): New insn patterns.

testsuite:

	* gcc.target/aarch64/subs_compare_2.c: Make '#' immediate prefix
	optional in scan pattern.

From-SVN: r267650
2019-01-07 14:49:00 +00:00
Richard Biener df35e0bde1 tree-ssa-uncprop.c (ssa_equip_hash_traits): Remove in favor of tree_operand_hash.
2019-01-07  Richard Biener  <rguenther@suse.de>

	* tree-ssa-uncprop.c (ssa_equip_hash_traits): Remove in favor
	of tree_operand_hash.

From-SVN: r267649
2019-01-07 14:34:06 +00:00
Jonathan Wakely f0f1121b40 Update documentation for C++17 filesystem library
* doc/xml/manual/spine.xml: Update copyright years.
	* doc/xml/manual/status_cxx2017.xml: Adjust note about -lstdc++fs.
	* doc/xml/manual/using.xml: Remove requirement to link with -lstdc++fs
	for C++17 filesystem library.
	* doc/html/*: Regenerate.

From-SVN: r267648
2019-01-07 12:46:40 +00:00
Jonathan Wakely cf4b581f2e Fix build for systems without POSIX truncate
Older versions of newlib do not provide truncate so add a configure
check for it, and provide a fallback definition.

There were also some missing exports in the linker script, which went
unnoticed because there are no tests for some functions. A new link-only
test checks that every filesystem operation function is defined by the
library.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Order patterns for filesystem operations
	alphabetically and add missing entries for copy_symlink,
	hard_link_count, rename, and resize_file.
	* configure: Regenerate.
	* src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is
	used unconditionally.
	* src/filesystem/ops-common.h (__gnu_posix::truncate)
	[!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only
	supports truncating to zero length.
	* testsuite/27_io/filesystem/operations/all.cc: New test.
	* testsuite/27_io/filesystem/operations/resize_file.cc: New test.

From-SVN: r267647
2019-01-07 12:38:51 +00:00
Richard Sandiford f4bf2aabe3 [2/2] PR88598: Optimise reduc (bit_and)
This patch folds certain reductions of X & CST to X[I] & CST[I] if I is
the only nonzero element of CST.  This includes the motivating case in
which CST[I] is -1.

We could do the same for REDUC_MAX on unsigned types, but I wasn't sure
that that special case was worth it.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/88598
	* tree.h (single_nonzero_element): Declare.
	* tree.c (single_nonzero_element): New function.
	* match.pd: Fold certain reductions of X & CST to X[I] & CST[I]
	if I is the only nonzero element of CST.

gcc/testsuite/
	PR tree-optimization/88598
	* gcc.dg/vect/pr88598-1.c: New test.
	* gcc.dg/vect/pr88598-2.c: Likewise.
	* gcc.dg/vect/pr88598-3.c: Likewise.
	* gcc.dg/vect/pr88598-4.c: Likewise.
	* gcc.dg/vect/pr88598-5.c: Likewise.
	* gcc.dg/vect/pr88598-6.c: Likewise.

From-SVN: r267646
2019-01-07 12:17:10 +00:00
Richard Sandiford 46c66a46aa [1/2] PR88598: Optimise x * { 0 or 1, 0 or 1, ... }
The PR has:

    vect__6.24_42 = vect__5.23_41 * { 0.0, 1.0e+0, 0.0, 0.0 };

which for -fno-signed-zeros -fno-signaling-nans can be simplified to:

    vect__6.24_42 = vect__5.23_41 & { 0, -1, 0, 0 };

I deliberately didn't handle COMPLEX_CST or CONSTRUCTOR in
initializer_each_zero_or_onep since there are no current use cases.

The patch also makes (un)signed_type_for handle floating-point types.
I tried to audit all callers and the few that handle null returns would
be unaffected.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/88598
	* tree.h (initializer_each_zero_or_onep): Declare.
	* tree.c (initializer_each_zero_or_onep): New function.
	(signed_or_unsigned_type_for): Handle float types too.
	(unsigned_type_for, signed_type_for): Update comments accordingly.
	* match.pd: Fold x * { 0 or 1, 0 or 1, ...} to
	x & { 0 or -1, 0 or -1, ... }.

gcc/testsuite/
	PR tree-optimization/88598
	* gcc.dg/pr88598-1.c: New test.
	* gcc.dg/pr88598-2.c: Likewise.
	* gcc.dg/pr88598-3.c: Likewise.
	* gcc.dg/pr88598-4.c: Likewise.
	* gcc.dg/pr88598-5.c: Likewise.

From-SVN: r267645
2019-01-07 12:16:30 +00:00
Jonathan Wakely 3340164d5d Replace outdated references to x86_64-unknown-linux-gnu in docs
* doc/install.texi: Replace references to x86_64-unknown-linux-gnu
	with x86_64-pc-linux-gnu.

From-SVN: r267643
2019-01-07 10:32:30 +00:00
Tom de Vries 6e723923df [nvptx] Force vl32 if calling vector-partitionable routines
With PTX_MAX_VECTOR_LENGTH set to larger than PTX_WARP_SIZE, routines can be
called from offloading regions with vector-size set to larger than warp size.
OTOH, vector-partitionable routines assume warp-sized vector length.

Detect if we're calling a vector-partitionable routine from an offloading
region, and if so, fall back to warp-sized vector length in that region.

2019-01-07  Tom de Vries  <tdevries@suse.de>

	PR target/85486
	* config/nvptx/nvptx.c (has_vector_partitionable_routine_calls_p): New
	function.
	(nvptx_goacc_validate_dims): Force vl32 if calling vector-partitionable
	routines.

From-SVN: r267640
2019-01-07 10:01:49 +00:00
Jakub Jelinek d471bdec41 sse.md (vec_extract<mode><ssehalfvecmodelower>): Use V_256_512 iterator instead of V_512 and TARGET_AVX instead of...
* config/i386/sse.md (vec_extract<mode><ssehalfvecmodelower>): Use
	V_256_512 iterator instead of V_512 and TARGET_AVX instead of
	TARGET_AVX512F as condition.

From-SVN: r267639
2019-01-07 10:52:29 +01:00