Commit Graph

163084 Commits

Author SHA1 Message Date
Martin Liska 977667e6b7 gcov: Fix wrong usage of NAN in statistics (PR gcov-profile/86536).
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR gcov-profile/86536
	* gcov.c (format_gcov): Use printf format %.*f directly
        and do not handle special values.
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR gcov-profile/86536
	* gcc.misc-tests/gcov-pr86536.c: New test.

From-SVN: r262991
2018-07-26 08:50:21 +00:00
Tom de Vries 6dd580109f [libgomp, openacc, testsuite] Fix async logic in lib-12.f90
In testcase lib-12.f90, all acc_async_test calls are placed in a location
where they are not guaranteed to succeed, which explains why there's an xfail
for the lower optimization levels.

This patch fixes the problem by moving the acc_async_test calls to the correct
locations.

Reg-tested on x86_64 with nvptx accelerator.

2018-07-26  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-fortran/lib-12.f90: Move acc_async_test calls
	to correct locations.  Remove xfail.

From-SVN: r262990
2018-07-26 07:52:45 +00:00
Tom de Vries b2eb177978 [libgomp, openacc, testsuite] Fix async/wait logic in lib-13.f90
The purpose of the lib-13.f90 test-case is to test acc_wait_all_async.  The
test indeed calls acc_wait_all_async, but then subsequentlys calls
acc_wait_all, so the acc_wait_all_async functionality is not tested.
Furthermore, all acc_async_test calls are placed in a location where they are
not guaranteed to succeed, which explains why there's an xfail for the lower
optimization levels.

This patch fixes the problems by replacing acc_wait_all with an acc_wait on
the async id used for the acc_wait_all_async call, and moving the
acc_async_test calls to the correct locations.

Reg-tested on x86_64 with nvptx accelerator.

2018-07-26  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-fortran/lib-13.f90: Replace acc_wait_all with
	acc_wait.  Move acc_async_test calls to correct locations.  Remove
	xfail.

From-SVN: r262989
2018-07-26 07:52:35 +00:00
GCC Administrator a4955142f8 Daily bump.
From-SVN: r262988
2018-07-26 00:16:29 +00:00
Jonathan Wakely aea3722348 PR libstdc++/86676 another alignment fix for test
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Request
	same alignment for post-release allocation.

From-SVN: r262984
2018-07-26 00:38:17 +01:00
Joseph Myers 22f31945f7 * es.po, ja.po, sv.po: Update.
From-SVN: r262982
2018-07-25 22:37:39 +01:00
Martin Sebor 4b1f17eb93 strnlen.c: Remove DejaGnu directives ignored by the test harness.
gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/builtins/strnlen.c: Remove DejaGnu directives
	ignored by the test harness.

From-SVN: r262981
2018-07-25 14:53:42 -06:00
Jonathan Wakely 17a6321210 PR libstdc++/86676 Do not assume stack buffer is aligned
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for
	buffer being misaligned and so returned pointer not being at start.

From-SVN: r262980
2018-07-25 21:23:07 +01:00
Nicolas Koenig 0fc1c4290b re PR fortran/25829 ([F03] Asynchronous IO support)
2018-07-25  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* testsuite/libgomp.fortran/async_io_1.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_2.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_3.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_4.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_5.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_6.f90: Really commit.
	* testsuite/libgomp.fortran/async_io_7.f90: Really commit.

From-SVN: r262979
2018-07-25 19:34:33 +00:00
Nicolas Koenig b1f45884f6 re PR fortran/25829 ([F03] Asynchronous IO support)
2018-07-25  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* gfortran.texi: Add description of asynchronous I/O.
	* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
	as volatile.
	* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
	st_wait_async and change argument spec from ".X" to ".w".
	(gfc_trans_wait): Pass ID argument via reference.

2018-07-25  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* gfortran.dg/f2003_inquire_1.f03: Add write statement.
	* gfortran.dg/f2003_io_1.f03: Add wait statement.

2018-07-25  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* Makefile.am: Add async.c to gfor_io_src.
	Add async.h to gfor_io_headers.
	* Makefile.in: Regenerated.
	* gfortran.map: Add _gfortran_st_wait_async.
	* io/async.c: New file.
	* io/async.h: New file.
	* io/close.c: Include async.h.
	(st_close): Call async_wait for an asynchronous unit.
	* io/file_pos.c (st_backspace): Likewise.
	(st_endfile): Likewise.
	(st_rewind): Likewise.
	(st_flush): Likewise.
	* io/inquire.c: Add handling for asynchronous PENDING
	and ID arguments.
	* io/io.h (st_parameter_dt): Add async bit.
	(st_parameter_wait): Correct.
	(gfc_unit): Add au pointer.
	(st_wait_async): Add prototype.
	(transfer_array_inner): Likewise.
	(st_write_done_worker): Likewise.
	* io/open.c: Include async.h.
	(new_unit): Initialize asynchronous unit.
	* io/transfer.c (async_opt): New struct.
	(wrap_scalar_transfer): New function.
	(transfer_integer): Call wrap_scalar_transfer to do the work.
	(transfer_real): Likewise.
	(transfer_real_write): Likewise.
	(transfer_character): Likewise.
	(transfer_character_wide): Likewise.
	(transfer_complex): Likewise.
	(transfer_array_inner): New function.
	(transfer_array): Call transfer_array_inner.
	(transfer_derived): Call wrap_scalar_transfer.
	(data_transfer_init): Check for asynchronous I/O.
	Perform a wait operation on any pending asynchronous I/O
	if the data transfer is synchronous. Copy PDT and enqueue
	thread for data transfer.
	(st_read_done_worker): New function.
	(st_read_done): Enqueue transfer or call st_read_done_worker.
	(st_write_done_worker): New function.
	(st_write_done): Enqueue transfer or call st_read_done_worker.
	(st_wait): Document as no-op for compatibility reasons.
	(st_wait_async): New function.
	* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
	add NOTE where necessary.
	(get_gfc_unit): Likewise.
	(init_units): Likewise.
	(close_unit_1): Likewise. Call async_close if asynchronous.
	(close_unit): Use macros LOCK and UNLOCK.
	(finish_last_advance_record): Likewise.
	(newunit_alloc): Likewise.
	* io/unix.c (find_file): Likewise.
	(flush_all_units_1): Likewise.
	(flush_all_units): Likewise.
	* libgfortran.h (generate_error_common): Add prototype.
	* runtime/error.c: Include io.h and async.h.
	(generate_error_common): New function.

2018-07-25  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* testsuite/libgomp.fortran/async_io_1.f90: New test.
	* testsuite/libgomp.fortran/async_io_2.f90: New test.
	* testsuite/libgomp.fortran/async_io_3.f90: New test.
	* testsuite/libgomp.fortran/async_io_4.f90: New test.
	* testsuite/libgomp.fortran/async_io_5.f90: New test.
	* testsuite/libgomp.fortran/async_io_6.f90: New test.
	* testsuite/libgomp.fortran/async_io_7.f90: New test.


Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>

From-SVN: r262978
2018-07-25 18:48:39 +00:00
Jonathan Wakely 16d0ab7f44 Add missing header for std::max_align_t
* include/experimental/memory_resource: Include <cstddef> header.

From-SVN: r262977
2018-07-25 18:24:49 +01:00
Jakub Jelinek cf7fb52d95 cp-tree.h (enum cp_tree_index): Add CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER and...
* cp-tree.h (enum cp_tree_index): Add
	CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
	and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
	(abi_tag_identifier, aligned_identifier, begin_identifier,
	end_identifier, get__identifier, gnu_identifier,
	tuple_element_identifier, tuple_size_identifier, type_identifier,
	value_identifier, fun_identifier, closure_identifier): Define.
	* decl.c (initialize_predefined_identifiers): Initialize the above
	identifiers.
	(get_tuple_size): Use tuple_size_identifier instead of
	get_identifier ("tuple_size") and value_identifier instead of
	get_identifier ("value").
	(get_tuple_element_type): Use tuple_element_identifier instead of
	get_identifier ("tuple_element") and type_identifier instead of
	get_identifier ("type").
	(get_tuple_decomp_init): Use get__identifier instead of
	get_identifier ("get").
	* lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
	get_identifier ("_FUN").
	* parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
	instead of get_identifier ("__closure").
	(cp_parser_std_attribute): Use gnu_identifier instead of
	get_identifier ("gnu").
	(cp_parser_std_attribute_spec): Likewise.  Use aligned_identifier
	instead of get_identifier ("aligned").
	* class.c (check_abi_tags, inherit_targ_abi_tags): Use
	abi_tag_identifier instead of get_identifier ("abi_tag").

From-SVN: r262976
2018-07-25 18:47:18 +02:00
Jakub Jelinek 213f5e8acc re PR c++/85515 (Bogus suggestions from "GCC's leaky abstractions")
PR c++/85515
	* cp-tree.h (enum cp_tree_index): Add
	CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
	(for_range__identifier, for_begin__identifier, for_end__identifier,
	for_range_identifier, for_begin_identifier, for_end_identifier):
	Define.
	* decl.c (initialize_predefined_identifiers): Initialize
	for_{range,begin,end}{,_}_identifier.
	* parser.c (build_range_temp): Use for_range__identifier instead of
	get_identifier ("__for_range").
	(cp_convert_range_for): Use for_begin__identifier and
	for_end__identifier instead of get_identifier ("__for_begin") and
	get_identifier ("__for_end").
	* semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
	local symbols to "__for_{range,begin,end}".

	* g++.dg/pr85515-2.C: Add expected dg-error.
	* g++.dg/cpp0x/range-for36.C: New test.

From-SVN: r262975
2018-07-25 18:46:34 +02:00
Claudiu Zissulescu c44fa4a666 [ARC] Update default optimizations for size.
Update the list of default optimizations used for size compilations.

gcc/
2018-07-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* common/config/arc/arc-common.c (arc_option_optimization_table):
	Update default optimizations for size.

From-SVN: r262973
2018-07-25 16:31:34 +02:00
Joseph Myers 44f916dcce Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r262972
2018-07-25 15:31:18 +01:00
Claudiu Zissulescu a96377575b [ARC] Improve instruction selection for fp moves.
Improve selection of short instruction for fp-moves.

gcc/
2018-05-17  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.md (movsf_insn): Add short instruction selection.
	* config/arc/constraints.md (CfZ): New constraint.
	* config/arc/fpu.md (addssf3_fpu): Use CfZ constraint.
	(subsf3_fpu): Likewise.
	(cmpsf_fpu): Likewise.
	(cmpsf_fpu_uneq): Likewise.

From-SVN: r262971
2018-07-25 16:31:16 +02:00
Claudiu Zissulescu 3e4a5f5485 [ARC] Fix uncache attribute.
gcc/
2018-05-09  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (compact_memory_operand_p): Check for uncached
	accesses as well.
	(arc_is_uncached_mem_p): uncached applies to both the variable and
	the pointer.

testsuite/
2018-05-09  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/uncached-1.c: New test.
	* gcc.target/arc/uncached-2.c: Likewise.

From-SVN: r262970
2018-07-25 16:31:04 +02:00
Claudiu Zissulescu 8f176ba232 [ARC] Add more additional register names
gcc/
  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.h (ADDITIONAL_REGISTER_NAMES): Add additional
	register names.

From-SVN: r262969
2018-07-25 16:30:52 +02:00
David Malcolm ee50ba7793 optinfo-emit-json.cc: fix trivial memory leak
gcc/ChangeLog:
	* optinfo-emit-json.cc (class optrecord_json_writer): Convert
	field "m_scopes" from vec to auto_vec.

From-SVN: r262967
2018-07-25 14:18:22 +00:00
Martin Liska e8e3751cd8 Fix wrong declaration.
2018-07-25  Martin Liska  <mliska@suse.cz>

	* config/powerpcspe/powerpcspe-protos.h (rs6000_loop_align): Fix
        return type.

From-SVN: r262966
2018-07-25 12:16:48 +00:00
Richard Biener 9c13689e64 re PR lto/86654 (ICE in gen_member_die, at dwarf2out.c:24933)
2018-07-25  Richard Biener  <rguenther@suse.de>

	PR debug/86654
	* dwarf2out.c (dwarf2out_decl): Do not handle nested functions
	special wrt context_die late.
	(gen_subprogram_die): Re-use DIEs in local scope.

From-SVN: r262965
2018-07-25 12:10:13 +00:00
Jonathan Wakely a9d49e9681 Add new src/c++17 directory to list in acinclude.m4
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++17.
	* src/Makefile.am: Add comment.
	* src/c++17/Makefile.in: Regenerate.

From-SVN: r262964
2018-07-25 12:01:39 +01:00
Jonathan Wakely 1fba0606b8 Move std::unique_lock definition to a separate header
This will allow std::mutex and std::lock_guard to be used elsewhere in
the library without pulling in the whole of <chrono>.

Previously the whole of <bits/std_mutex.h> was conditional on the
_GLIBCXX_USE_C99_STDINT_TR1 macro, but only the std::unique_lock members
that use <chrono> facilities should depend on that. std::mutex only
needs to depend on _GLIBCXX_HAS_GTHREADS and std::lock_guard can be
defined unconditionally.

Some parts of <bits/std_mutex.h> and <mutex> are based on code in
<ext/concurrence.h> which dates from 2003. However, the std::unique_lock
implementation was added in 2008 by r135007, without using any earlier
code. Therefore the new header file has copyright years 2008-2018.

	* include/Makefile.am: Add new <bits/unique_lock.h> header.
	* include/Makefile.in: Regenerate.
	* include/bits/std_mutex.h [!_GLIBCXX_USE_C99_STDINT_TR1] (mutex)
	(lock_guard): Define independent of _GLIBCXX_USE_C99_STDINT_TR1.
	(unique_lock): Move definition to ...
	* include/bits/unique_lock.h: New header.
	[!_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock): Define unconditionally.
	[_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock(mutex_type&, time_point))
	(unique_lock(mutex_type&, duration), unique_lock::try_lock_until)
	(unique_lock::try_lock_for): Define only when <chrono> is usable.
	* include/std/condition_variable: Include <bits/unique_lock.h>.
	* include/std/mutex: Likewise.

From-SVN: r262963
2018-07-25 11:40:12 +01:00
Richard Sandiford 1978cc78c8 Add PR number
From-SVN: r262962
2018-07-25 08:42:38 +00:00
Richard Sandiford e8dce850a7 Fix ceil_log2(0) (PR 86644)
This PR shows a pathological case in which we try SLP vectorisation on
dead code.  We record that 0 bits of the result are enough to satisfy
all users (which is true), and that led to precision being 0 in:

static unsigned int
vect_element_precision (unsigned int precision)
{
  precision = 1 << ceil_log2 (precision);
  return MAX (precision, BITS_PER_UNIT);
}

ceil_log2 (0) returned 64 rather than 0, leading to 1 << 64, which is UB.

2018-07-25  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* hwint.c (ceil_log2): Fix comment.  Return 0 for 0.

From-SVN: r262961
2018-07-25 08:41:35 +00:00
Martin Liska de6c8d7f72 Limit dump_flag enum values range (PR middle-end/86645).
2018-07-25  Martin Liska  <mliska@suse.cz>

        PR middle-end/86645
	* dumpfile.c: And excluded values with TDF_ALL_VALUES.
	* dumpfile.h (enum dump_flag): Defince TDF_ALL_VALUES.

From-SVN: r262960
2018-07-25 08:04:15 +00:00
Martin Liska 5a0e12709d Explain asan parameters in params.def (PR sanitizer/79635).
2018-07-25  Martin Liska  <mliska@suse.cz>

        PR sanitizer/79635
	* params.def: Explain ASan abbreviation and provide
        a documentation link.

From-SVN: r262959
2018-07-25 08:02:53 +00:00
Martin Sebor bfb9bd47b2 PR tree-optimization/86622 - incorrect strlen of array of array plus variable offset
PR tree-optimization/86622 - incorrect strlen of array of array plus variable offset
PR tree-optimization/86532 - Wrong code due to a wrong strlen folding starting with r262522

gcc/ChangeLog:

	PR tree-optimization/86622
	PR tree-optimization/86532
	* builtins.h (string_length): Declare.
	* builtins.c (c_strlen): Correct handling of non-constant offsets.	
	(check_access): Be prepared for non-constant length ranges.
	(string_length): Make extern.
	* expr.c (string_constant): Only handle the minor non-constant
	array index.  Use string_constant to compute the length of
	a generic string constant.

gcc/testsuite/ChangeLog:

	PR tree-optimization/86622
	PR tree-optimization/86532
	* gcc.c-torture/execute/strlen-2.c: New test.
	* gcc.c-torture/execute/strlen-3.c: New test.
	* gcc.c-torture/execute/strlen-4.c: New test.

From-SVN: r262958
2018-07-24 20:11:31 -06:00
GCC Administrator ae752f020f Daily bump.
From-SVN: r262957
2018-07-25 00:16:34 +00:00
Jonathan Wakely dfaa3c47cc Add initial version of C++17 <memory_resource> header
This is missing the synchronized_pool_resource and
unsynchronized_pool_resource classes but is otherwise complete.

This is a new implementation, not based on the existing code in
<experimental/memory_resource>, but memory_resource and
polymorphic_allocator ended up looking almost the same anyway.

The constant_init kluge in src/c++17/memory_resource.cc is apparently
due to Richard Smith and ensures that the objects are constructed during
constant initialiation phase and not destroyed (because the
constant_init destructor doesn't destroy the union member and the
storage is not reused).

	* config/abi/pre/gnu.ver: Export new symbols.
	* configure: Regenerate.
	* include/Makefile.am: Add new <memory_resource> header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include <memory_resource> for C++17.
	* include/std/memory_resource: New header.
	(memory_resource, polymorphic_allocator, new_delete_resource)
	(null_memory_resource, set_default_resource, get_default_resource)
	(pool_options, monotonic_buffer_resource): Define.
	* src/Makefile.am: Add c++17 directory.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.am: Fix comment.
	* src/c++17/Makefile.am: Add makefile for new sub-directory.
	* src/c++17/Makefile.in: Generate.
	* src/c++17/memory_resource.cc: New.
	(newdel_res_t, null_res_t, constant_init, newdel_res, null_res)
	(default_res, new_delete_resource, null_memory_resource)
	(set_default_resource, get_default_resource): Define.
	* testsuite/20_util/memory_resource/1.cc: New test.
	* testsuite/20_util/memory_resource/2.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/1.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/deallocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/release.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/upstream_resource.cc:
	New test.
	* testsuite/20_util/polymorphic_allocator/1.cc: New test.
	* testsuite/20_util/polymorphic_allocator/resource.cc: New test.
	* testsuite/20_util/polymorphic_allocator/select.cc: New test.
	* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Define concrete memory resource for testing.
	(__gnu_test::default_resource_mgr): Define RAII helper for changing
	default resource.

From-SVN: r262953
2018-07-24 22:09:55 +01:00
Jonathan Wakely e874029dd9 PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators
An output iterator passed as the unused first argument to __niter_wrap
might have already been invalidated, so don't copy it.

	PR libstdc++/86658
	* include/bits/stl_algobase.h (__niter_wrap<_Iterator>): Pass unused
	parameter by reference, to avoid copying invalid iterators.
	* testsuite/25_algorithms/copy/86658.cc: New test.

From-SVN: r262952
2018-07-24 21:49:10 +01:00
Richard Sandiford ed623edb47 Avoid &LOOP_VINFO_MASKS for bb vectorisation (PR 86618)
r262589 introduced another instance of the bug fixed in r258131.

2018-07-23  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/86618
	* tree-vect-stmts.c (vectorizable_call): Don't take the address
	of LOOP_VINFO_MASKS (loop_vinfo) when loop_vinfo is null.

From-SVN: r262951
2018-07-24 18:08:19 +00:00
David Malcolm dad2580c83 Fix segfault in -fsave-optimization-record (PR tree-optimization/86636)
There are various ways that it's possible for a gimple statement to
have an UNKNOWN_LOCATION, and for that UNKNOWN_LOCATION to be wrapped
in an ad-hoc location to capture inlining information.

For such a location, LOCATION_FILE (loc) is NULL.

Various places in -fsave-optimization-record were checking for
  loc != UNKNOWN_LOCATION
and were passing LOCATION_FILE (loc) to code that assumed a non-NULL
filename, thus leading to segfaults for the above cases.

This patch updates the tests to use
  LOCATION_LOCUS (loc) != UNKNOWN_LOCATION
instead, to look through ad-hoc location wrappers, fixing the segfaults.

It also adds various assertions to the affected code.

gcc/ChangeLog:
	PR tree-optimization/86636
	* json.cc (json::object::set): Fix comment.  Add assertions.
	(json::array::append): Move here from json.h.  Add comment and an
	assertion.
	(json::string::string): Likewise.
	* json.h (json::array::append): Move to json.cc.
	(json::string::string): Likewise.
	* optinfo-emit-json.cc
	(optrecord_json_writer::impl_location_to_json): Assert that we
	aren't attempting to write out UNKNOWN_LOCATION, or an ad-hoc
	wrapper around it.  Expand the location once, rather than three
	times.
	(optrecord_json_writer::inlining_chain_to_json): Fix the check for
	UNKNOWN_LOCATION, to use LOCATION_LOCUS to look through ad-hoc
	wrappers.
	(optrecord_json_writer::optinfo_to_json): Likewise, in four
	places.  Fix some overlong lines.

gcc/testsuite/ChangeLog:
	PR tree-optimization/86636
	* gcc.c-torture/compile/pr86636.c: New test.

From-SVN: r262950
2018-07-24 16:06:58 +00:00
Matthew Malcomson 8da03df567 [GCC][AARCH64] Canonicalize aarch64 widening simd plus insns
Committed on behalf of matthew.malcomson@arm.com

2018-07-24  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/aarch64/aarch64-simd.md
	(aarch64_<ANY_EXTEND:su><ADDSUB:optab>w<mode>): Split into...
	(aarch64_<ANY_EXTEND:su>subw<mode>): ... This...
	(aarch64_<ANY_EXTEND:su>addw<mode>): ... And this.
	(aarch64_<ANY_EXTEND:su><ADDSUB:optab>w<mode>_internal): Split into...
	(aarch64_<ANY_EXTEND:su>subw<mode>_internal): ... This...
	(aarch64_<ANY_EXTEND:su>addw<mode>_internal): ... And this.
	(aarch64_<ANY_EXTEND:su><ADDSUB:optab>w2<mode>_internal): Split into...
	(aarch64_<ANY_EXTEND:su>subw2<mode>_internal): ... This...
	(aarch64_<ANY_EXTEND:su>addw2<mode>_internal): ... And this.

	* gcc.target/aarch64/vect-su-add-sub.c: New.

From-SVN: r262949
2018-07-24 15:37:52 +00:00
Jakub Jelinek ebac3c0236 re PR middle-end/86627 (Signed 128-bit division by 2 no longer expanded to RTL)
PR middle-end/86627
	* expmed.c (expand_divmod): Punt if d == HOST_WIDE_INT_MIN
	and size > HOST_BITS_PER_WIDE_INT.  For size > HOST_BITS_PER_WIDE_INT
	and abs_d == d, do the power of two handling if profitable.

	* gcc.target/i386/pr86627.c: New test.

From-SVN: r262948
2018-07-24 16:23:18 +02:00
Jonathan Wakely 337dc30754 Minor refactoring in <bit> header
* include/std/bit (__countl_zero, __countr_zero, __popcount): Use
	local variables for number of digits instead of type aliases.
	(__log2p1): Remove redundant branch also checked in __countl_zero.

From-SVN: r262947
2018-07-24 14:51:50 +01:00
Richard Biener 6ec96dcb6b match.pd: Add BIT_FIELD_REF canonicalizations.
2018-07-24  Richard Biener  <rguenther@suse.de>

	* match.pd: Add BIT_FIELD_REF canonicalizations.

From-SVN: r262946
2018-07-24 13:29:07 +00:00
Jonathan Wakely 4f3c75ba3a Reorder conditions in uses-allocator construction helper
The erased_type condition is only true for code using the Library
Fundamentals TS, so assume it's less common and only check it after
checking for convertibility.

This does mean for types using erased_type the more expensive
convertibility check is done first, but such types are rare.

	* include/bits/uses_allocator.h (__is_erased_or_convertible): Reorder
	conditions. Add comments.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error line.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise.

From-SVN: r262945
2018-07-24 14:03:25 +01:00
Jonathan Wakely 7a4be38049 Make __resource_adaptor_imp usable with C++17 memory_resource
By making the memory_resource base class a template parameter the
__resource_adaptor_imp can be used to adapt an allocator into a
std::pmr::memory_resource instead of experimental::pmr::memory_resource.

	* include/experimental/memory_resource: Adjust comments and
	whitespace.
	(__resource_adaptor_imp): Add second template parameter for type of
	memory resource base class.
	(memory_resource): Define default constructor, destructor, copy
	constructor and copy assignment operator as defaulted.

From-SVN: r262944
2018-07-24 14:03:20 +01:00
Jonathan Wakely 0568ade6f8 PR libstdc++/70966 fix lifetime bug for default resource
PR libstdc++/70966
	* include/experimental/memory_resource (__get_default_resource): Use
	placement new to create an object with dynamic storage duration.

From-SVN: r262943
2018-07-24 14:03:11 +01:00
Jakub Jelinek ffb164c7df re PR testsuite/86649 (g++.dg/tree-ssa/pr19476-1.C fails starting with r262928)
PR testsuite/86649
	* g++.dg/tree-ssa-/pr19476-1.C: Check dom2 dump instead of ccp1.
	* g++.dg/tree-ssa-/pr19476-5.C: Likewise.
	* g++.dg/tree-ssa-/pr19476-6.C: New test.
	* g++.dg/tree-ssa-/pr19476-7.C: New test.

From-SVN: r262942
2018-07-24 12:24:00 +02:00
GCC Administrator 9798833467 Daily bump.
From-SVN: r262940
2018-07-24 00:16:33 +00:00
David Edelsohn 5b3d96f24f inclhack.def (aix_unistd): New.
* inclhack.def (aix_unistd): New.
* fixincl.x: Regenerate.
* tests/base/unistd.h [AIX_UNISTD_CHECK]: New test.

From-SVN: r262936
2018-07-23 16:51:50 -04:00
Jonathan Wakely 2d6c8eea1d PR libstdc++/70940 optimize pmr::resource_adaptor for allocators using malloc
pmr::resource_adaptor can avoid allocating an oversized buffer and doing
manual alignment within that buffer when the wrapped allocator is known
to always meet the requested alignment. Specifically, if the allocator
is known to use malloc or new directly, then we can call the allocator
directly for any fundamental alignment.

	PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_common::_AlignMgr::_M_unadjust): Add assertion.
	(__resource_adaptor_common::__guaranteed_alignment): New helper to
	give maximum alignment an allocator guarantees. Specialize for known
	allocators using new and malloc.
	(__resource_adaptor_imp::do_allocate): Use __guaranteed_alignment.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Check that new and delete are called with expected sizes.

From-SVN: r262935
2018-07-23 20:40:28 +01:00
Carl Love 651a79532c re PR target/86591 (gcc.target/powerpc/builtins-1.c fails starting with r261904)
gcc/testsuite/ChangeLog:

2018-07-23  Carl Love  <cel@us.ibm.com>

	PR 86591
	* gcc.target/powerpc/altivec-1-runnable.c: Move vector double tests to
	file altivec-2-runnable.c.
	* gcc.target/powerpc/altivec-2-runnable.c: Add vector double tests.
	* gcc.target/powerpc/buitlins-1.c: Remove dg-final check for xxlor.
	Update dg-final test for __divdi3 and __udivdi3 instructions. Update
	comments for instruction generated by vec_mergeh, vec_perm, vec_round,
	vec_cts, vec_ctu, vec_cpsgn tests.

From-SVN: r262934
2018-07-23 16:16:41 +00:00
Bernd Edlinger 1544db9a61 re PR c/86617 (Volatile qualifier is ignored sometimes for unsigned char)
gcc:
2018-07-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c/86617
        * genmatch.c (dt_operand::gen_match_op): Avoid folding volatile values.

testsuite:
2018-07-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c/86617
        * gcc.dg/pr86617.c: New test.

From-SVN: r262933
2018-07-23 13:23:51 +00:00
Bernd Edlinger a353fec45a gimple-fold.c (gimple_fold_builtin_printf): Don't create a not NUL terminated STRING_CST object.
2018-07-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * gimple-fold.c (gimple_fold_builtin_printf): Don't create a not NUL
        terminated STRING_CST object.

From-SVN: r262932
2018-07-23 13:20:38 +00:00
Bernd Edlinger 723f415edc 2018-07-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
hsa-dump.c (dump_hsa_symbol): Avoid out of scope access to buf.

From-SVN: r262931
2018-07-23 12:48:48 +00:00
Segher Boessenkool 9fede15c4d rs6000: Improve vsx_init_v4si
This changes vsx_init_v4si to be an expander.  That way, no special
cases are needed anymore for special arguments: the normal RTL passes
can deal with it.


	* config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Adjust.
	* config/rs6000/rs6000-protos.h (rs6000_split_v4si_init): Delete.
	* config/rs6000/rs6000.c (rs6000_expand_vector_init): Always force
	the elements into a register.
	(rs6000_split_v4si_init_di_reg): Delete.
	(rs6000_split_v4si_init): Delete.
	* config/rs6000/vsx.md (unspec): Delete UNSPEC_VSX_VEC_INIT.
	(vsx_init_v4si): Rewrite as a define_expand.

From-SVN: r262930
2018-07-23 13:27:38 +02:00
Segher Boessenkool 268e16e89b rs6000: Generate rl*imi for memory some more
An rl<wd>imi instruction is often written like "(a << 8) | (b & 255)".
If "b" now is a byte in memory, combine will combine the load with the
masking (with 255 in the example), since that is a single instruction;
and then the rl*imi isn't combined from the remaining pieces.

This patch adds a splitter to make combine handle this case.


	* config/rs6000/rs6000.md (splitters for rldimi and rlwimi with the
	zero_extend argument from memory): New.

From-SVN: r262929
2018-07-23 13:25:28 +02:00