Commit Graph

176858 Commits

Author SHA1 Message Date
Jakub Jelinek 3d8d5ddb53 c++: Try to complete decomp types [PR95328]
Two years ago Paolo has added the
  else if (processing_template_decl && !COMPLETE_TYPE_P (type))
    pedwarn (...);
lines into cp_finish_decomp.  For type dependent decl we punt much earlier,
but even for types which aren't type dependent COMPLETE_TYPE_P might be
false as this testcase shows, so this patch tries to complete_type first
(the reason for writing it that way is that it is then followed by another
else if and if complete_type returns error_mark_node, we shouldn't report
anything, as a bug should have been reported already.

2020-05-28  Jakub Jelinek  <jakub@redhat.com>

	PR c++/95328
	* decl.c (cp_finish_decomp): Call complete_type before checking
	COMPLETE_TYPE_P.

	* g++.dg/cpp1z/decomp53.C: New test.
2020-05-28 23:40:54 +02:00
Harald Anlauf 5c715e6a29 PR fortran/95373 - ICE in build_reference_type, at tree.c:7942
The use of KIND, LEN, RE, and IM inquiry references for applicable intrinsic
types is valid only for suffienctly new Fortran standards.  Add appropriate
check.

2020-05-28  Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
	PR fortran/95373
	* primary.c (is_inquiry_ref): Check validity of inquiry
	references against selected Fortran standard.

gcc/testsuite/
	PR fortran/95373
	* gfortran.dg/pr95373_1.f90: New test.
	* gfortran.dg/pr95373_2.f90: New test.
2020-05-28 22:32:59 +02:00
Harald Anlauf 6ce3d791df PR fortran/95104 - Segfault on a legal WAIT statement
The initial commit for this PR uncovered a latent issue with unit locking
in the Fortran run-time library.  Add check for valid unit.

2020-05-28  Harald Anlauf  <anlauf@gmx.de>

libgfortran/
	PR libfortran/95104
	* io/unit.c (unlock_unit): Guard by check for NULL pointer.
2020-05-28 21:53:17 +02:00
Jason Merrill 7b599b9f9a c++: Immediately deduce auto member [PR94926].
In r9-297 I was trying to be more flexible and treat static data members of
class templates more like variable templates, where the type need not be
determined until the variable is instantiated, but I suppose that in a class
the types of all the non-template members need to be determined at the time
of class instantiation.

gcc/cp/ChangeLog:

	PR c++/94926
	* decl.c (cp_finish_decl): Revert r9-297 change.
	(check_static_variable_definition): Likewise.
	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
	* pt.c (instantiate_decl): Return early on type error.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/pr86648.C: Expect error.
	* g++.dg/cpp1z/static2.C: Expect error.
	* g++.dg/cpp0x/nsdmi16.C: New test.
2020-05-28 14:58:16 -04:00
Nicolás Bértolo c83027f32d jit: port libgccjit to Windows
2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

/ChangeLog:
	* configure.ac: Don't require --enable-host-shared when building
	for Mingw.
	* configure: Regenerate.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/ChangeLog:
	* Makefile.in: don't look for libiberty in the "pic" subdirectory
	when building for Mingw. Add dependency on xgcc with the proper
	extension.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/c/ChangeLog:
	* Make-lang.in: Remove extra slash.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/jit/ChangeLog:
	* Make-lang.in: Remove extra slash. Build libgccjit.dll and its
	import library in Windows.
	* config-lang.in: Update comment about --enable-host-shared.
	* jit-w32.h: New file.
	* jit-w32.c: New file.
	(print_last_error): New function that prints the error
	string corresponding to GetLastError().
	(get_TOKEN_USER_current_user): Helper function used for getting
	the SID belonging to the current user.
	(create_directory_for_current_user): Helper function to create
	a directory with permissions such that only the current user can
	access it.
	(win_mkdtemp): Create a temporary directory using Windows APIs.
	* jit-playback.c: Do not chmod files in Windows. Use LoadLibrary,
	FreeLibrary and GetProcAddress instead of libdl.
	* jit-result.h, jit-result.c: Introduce result::handle_t to
	abstract over the types used for dynamic library handles.
	* jit-tempdir.c: Do not use mkdtemp() in Windows, use
	win_mkdtemp().
2020-05-28 14:43:58 -04:00
Jeff Law ccf4e86dc0 Finish prior patch
* config/h8300/logical.md (bclrhi_msx): Remove pattern.
2020-05-28 12:37:34 -06:00
Jeff Law f04f2fcd3d Fix incorrect code generation with bit insns on H8/SX.
* config/h8300/logical.md (HImode H8/SX bit-and splitter): Don't
	make a nonzero adjustment to the memory offset.
	(b<ior,xor>hi_msx): Turn into a splitter.
2020-05-28 12:28:56 -06:00
Eric Botcazou 2815558a2d Fix off-by-one error in previous commit
The bitregion_end field points to the next bit after the region.

gcc/ChangeLog
	* gimple-ssa-store-merging.c (merged_store_group::can_be_merged_into):
	Fix off-by-one error.
2020-05-28 19:31:56 +02:00
Marek Polacek 4833c1adc3 c++: Fix initlist-array12.C
* g++.dg/cpp0x/initlist-array12.C: Fix the definition of
	initializer_list for ilp32 target.
2020-05-28 11:20:57 -04:00
Marek Polacek 1b1932a4f3 c++: Fix tmplattr10.C
This test uses C++11 features so should only run in c++11.

	* g++.dg/ext/tmplattr10.C: Only run in c++11.
2020-05-28 11:05:07 -04:00
H.J. Lu 125e0ff350 Revert "Add missing ChangeLog entry for r11-694"
This reverts commit 7e58fe0e4c.
2020-05-28 07:36:15 -07:00
H.J. Lu 7e58fe0e4c Add missing ChangeLog entry for r11-694 2020-05-28 07:13:46 -07:00
H.J. Lu 4d80ebea98 gcc.dg/builtin-bswap-10.c: Check "! int128"
Check "! int128" instead of ilp32 since ILP32 targets can support int128.

gcc/testsuite/

	* gcc.dg/builtin-bswap-10.c: Check "! int128" instead of ilp32
2020-05-28 07:07:13 -07:00
Mark Eggleston 3ea6977d0f Fortran : "type is( real(kind(1.)) )" spurious syntax error PR94397
Based on a patch in the comments of the PR. That patch fixed this
problem but caused the test cases for PR93484 to fail. It has been
changed to reduce initialisation expressions if the expression is
not EXPR_VARIABLE and not EXPR_CONSTANT.

2020-05-28  Steven G. Kargl  <kargl@gcc.gnu.org>
	    Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran/

	PR fortran/94397
	* match.c (gfc_match_type_spec): New variable ok initialised
	to true. Set ok with the return value of gfc_reduce_init_expr
	called only if the expression is not EXPR_CONSTANT and is not
	EXPR_VARIABLE. Add !ok to the check for type not being integer
	or the rank being greater than zero.

2020-05-28  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

	PR fortran/94397
	* gfortran.dg/pr94397.F90: New test.
2020-05-28 13:24:04 +01:00
Richard Sandiford 59a3d73d50 aarch64: Fix missed shrink-wrapping opportunity
wb_candidate1 and wb_candidate2 exist for two overlapping cases:
when we use an STR or STP with writeback to allocate the frame,
and when we set up a frame chain record (either using writeback
allocation or not).

However, aarch64_layout_frame was leaving these fields with
legitimate register numbers even if we decided to do neither
of those things.  This prevented those registers from being
shrink-wrapped, even though we were otherwise treating them
as normal saves and restores.

The case this patch handles isn't the common case, so it might
not be worth going out of our way to optimise it.  But I think
the patch actually makes the output of aarch64_layout_frame more
consistent.

2020-05-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64.h (aarch64_frame): Add a comment above
	wb_candidate1 and wb_candidate2.
	* config/aarch64/aarch64.c (aarch64_layout_frame): Invalidate
	wb_candidate1 and wb_candidate2 if we decided not to use them.

gcc/testsuite/
	* gcc.target/aarch64/shrink_wrap_1.c: New test.
2020-05-28 13:18:13 +01:00
Richard Sandiford 1ccbfffb0f aarch64: Fix segfault in aarch64_expand_epilogue [PR95361]
The stack frame for the function in the testcase consisted of two
SVE save slots.  Both saves had been shrink-wrapped, but for different
blocks, meaning that the stack allocation and deallocation were
separate from the saves themselves.  Before emitting the deallocation,
we tried to attach a REG_CFA_DEF_CFA note to the preceding instruction,
to redefine the CFA in terms of the stack pointer.  But in this case
there was no preceding instruction.

This in practice only happens for SVE because:

(a) We don't try to shrink-wrap wb_candidate* registers even when
    we've decided to treat them as normal saves and restores.
    I have a fix for that.

(b) Even with (a) fixed, we're (almost?) guaranteed to emit
    a stack tie for frames that are 64k or larger, so we end
    up hanging the REG_CFA_DEF_CFA note on that instead.

We should only need to redefine the CFA if it was previously
defined in terms of the frame pointer.  In other cases the CFA
should already be defined in terms of the stack pointer,
so redefining it is unnecessary but usually harmless.

2020-05-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR testsuite/95361
	* config/aarch64/aarch64.c (aarch64_expand_epilogue): Assert that
	we have at least some CFI operations when using a frame pointer.
	Only redefine the CFA if we have CFI operations.

gcc/testsuite/
	PR testsuite/95361
	* gcc.target/aarch64/sve/pr95361.c: New test.
2020-05-28 13:18:12 +01:00
Richard Biener 00cd573897 remove obsolete code from SLP invariant costing
This removes handling of !SLP_TREE_VECTYPE from invariant costing.
The single caller guards against this case already.

2020-05-28  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_prologue_cost_for_slp): Remove
	case for !SLP_TREE_VECTYPE.
	(vect_slp_analyze_node_operations): Adjust.
2020-05-28 13:19:41 +02:00
Richard Biener e31cd607e9 Code generate externals/invariants during the SLP graph walk
This generates vector defs for externals and invariants during the SLP
walk rather than as part of getting vectorized defs when vectorizing
the users.  This is a requirement to make sharing of external/invariant
nodes be reflected in actual code generation.

This temporarily adds a SLP_TREE_VEC_DEFS vector alongside the
SLP_TREE_VEC_STMTS one.  Eventually the latter can go away.

2020-05-27  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (_slp_tree::vec_defs): Add.
	(SLP_TREE_VEC_DEFS): Likewise.
	* tree-vect-slp.c (_slp_tree::_slp_tree): Adjust.
	(_slp_tree::~_slp_tree): Likewise.
	(vect_mask_constant_operand_p): Remove unused function.
	(vect_get_constant_vectors): Rename to...
	(vect_create_constant_vectors): ... this.  Take the
	invariant node as argument and code generate it.  Remove
	dead code, remove temporary asserts.  Pass a NULL stmt_info
	to vect_init_vector.
	(vect_get_slp_defs): Simplify.
	(vect_schedule_slp_instance): Code-generate externals and
	invariants using vect_create_constant_vectors.
2020-05-28 12:25:15 +02:00
Richard Biener b0aae85bd6 make vect_finish_stmt_generation work w/o stmt_vec_info
This makes the call chain below vec_init_vector happy with a NULL
stmt_vec_info which is used as "context".

2020-05-27  Richard Biener  <rguenther@suse.de>

	* tree-vect-stmts.c (vect_finish_stmt_generation_1):
	Conditionalize stmt_info use, assert the new stmt cannot throw
	when not specified.
	(vect_finish_stmt_generation): Adjust assert.
2020-05-28 12:25:15 +02:00
Richard Biener 09df85393c tree-optimization/95273 - more vectorizable_shift massaging
Covering all bases in vectorizable_shift is hard - this makes sure
to appropriately handle the case of PR95356 without breaking others.

2020-05-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95273
	PR tree-optimization/95356
	* tree-vect-stmts.c (vectorizable_shift): Adjust when and to
	what we set the vector type of the shift operand SLP node
	again.

	* gcc.target/i386/pr95356.c: New testcase.
2020-05-28 11:54:50 +02:00
Andrea Corallo dd019ef073 arm: Fix unwanted fall-throughs in arm.c
gcc/ChangeLog

2020-05-28  Andrea Corallo  <andrea.corallo@arm.com>

	* config/arm/arm.c (mve_vector_mem_operand): Fix unwanted
	fall-throughs.
2020-05-28 11:29:25 +02:00
Pierre-Marie de Rodat a634157de1 gcc-changelog: enhance handling of renamings
So far, we expect from a commit that renames a file to contain a
changelog entry only for the new name. For example, after the following
commit:

   $ git move foo bar
   $ git commit

We expect the following changelog:

   * bar: Renamed from foo.

Git does not keep track of renamings, only file deletions and additions.
The display of patches then uses heuristics (with config-dependent
parameters) to try to match deleted and added files in the same commit.
It is thus brittle to rely on this information.

This commit modifies changelog processing so that renames are considered
as a deletion of a file plus an addition of another file. The following
changelog is now expected for the above example:

   * foo: Move...
   * bar: Here.

contrib/

	* gcc-changelog/git_email.py (GitEmail.__init__): Interpret file
	renamings as a file deletion plus a file addition.
	* gcc-changelog/git_repository.py (parse_git_revisions):
	Likewise.
	* gcc-changelog/test_email.py: New testcase.
	* gcc-changelog/test_patches.txt: New testcase.
2020-05-28 11:14:44 +02:00
Martin Liska 48e872db11
Add documentation for missing params.
The patch fixes various issues spotted by check-params-in-docs.py
script. I'm going to install the patch.

gcc/ChangeLog:

	PR web/95380
	* doc/invoke.texi: Add missing params, remove max-once-peeled-insns and
	rename ipcp-unit-growth to ipa-cp-unit-growth.
2020-05-28 11:03:01 +02:00
Martin Liska 467adc05ba
Fix check-params-in-docs.py for --help=param.
contrib/ChangeLog:

	* check-params-in-docs.py: Update to new format
	of help.  Apply flake8 corrections.
2020-05-28 10:36:48 +02:00
Martin Liska eb78da45ab
mklog: support renaming of files
contrib/ChangeLog:

	* mklog.py: Support renaming of files.
	One needs unidiff 0.6.0+.
	* test_mklog.py: Test it.
2020-05-28 10:27:09 +02:00
liuhongt 4a948703db Fix nonconforming memory_operand for vpmovq{d,w,b}/vpmovd{w,b}/vpmovwb.
According to Intel SDM, VPMOVQB xmm1/m16 {k1}{z}, xmm2 has 16-bit
memory_operand instead of 128-bit one which existed in current
implementation. Also for other vpmov instructions which have
memory_operand narrower than 128bits.

2020-05-25  Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog

	* config/i386/sse.md (*avx512vl_<code>v2div2qi2_store_1): Rename
	from *avx512vl_<code>v2div2qi_store and refine memory size of
	the pattern.
	(*avx512vl_<code>v2div2qi2_mask_store_1): Ditto.
	(*avx512vl_<code><mode>v4qi2_store_1): Ditto.
	(*avx512vl_<code><mode>v4qi2_mask_store_1): Ditto.
	(*avx512vl_<code><mode>v8qi2_store_1): Ditto.
	(*avx512vl_<code><mode>v8qi2_mask_store_1): Ditto.
	(*avx512vl_<code><mode>v4hi2_store_1): Ditto.
	(*avx512vl_<code><mode>v4hi2_mask_store_1): Ditto.
	(*avx512vl_<code>v2div2hi2_store_1): Ditto.
	(*avx512vl_<code>v2div2hi2_mask_store_1): Ditto.
	(*avx512vl_<code>v2div2si2_store_1): Ditto.
	(*avx512vl_<code>v2div2si2_mask_store_1): Ditto.
	(*avx512f_<code>v8div16qi2_store_1): Ditto.
	(*avx512f_<code>v8div16qi2_mask_store_1): Ditto.
	(*avx512vl_<code>v2div2qi2_store_2): New define_insn_and_split.
	(*avx512vl_<code>v2div2qi2_mask_store_2): Ditto.
	(*avx512vl_<code><mode>v4qi2_store_2): Ditto.
	(*avx512vl_<code><mode>v4qi2_mask_store_2): Ditto.
	(*avx512vl_<code><mode>v8qi2_store_2): Ditto.
	(*avx512vl_<code><mode>v8qi2_mask_store_2): Ditto.
	(*avx512vl_<code><mode>v4hi2_store_2): Ditto.
	(*avx512vl_<code><mode>v4hi2_mask_store_2): Ditto.
	(*avx512vl_<code>v2div2hi2_store_2): Ditto.
	(*avx512vl_<code>v2div2hi2_mask_store_2): Ditto.
	(*avx512vl_<code>v2div2si2_store_2): Ditto.
	(*avx512vl_<code>v2div2si2_mask_store_2): Ditto.
	(*avx512f_<code>v8div16qi2_store_2): Ditto.
	(*avx512f_<code>v8div16qi2_mask_store_2): Ditto.
	* config/i386/i386-builtin-types.def: Adjust builtin type.
	* config/i386/i386-expand.c: Ditto.
	* config/i386/i386-builtin.def: Adjust builtin.
	* config/i386/avx512fintrin.h: Ditto.
	* config/i386/avx512vlbwintrin.h: Ditto.
	* config/i386/avx512vlintrin.h: Ditto.
2020-05-28 16:06:04 +08:00
Richard Biener 07d77cc239 testsuite/95363 - fix gcc.dg/vect/bb-slp-pr95271.c for ilp32
This fixes the testcase to avoid out of bound shifts on ilp32 targets.

2020-05-28  Richard Biener  <rguenther@suse.de>

	PR testsuite/95363
	* gcc.dg/vect/bb-slp-pr95271.c: Fix on ilp32 targets.
2020-05-28 09:50:35 +02:00
Martin Liska 17d1594bfe
gcov-tool: Flexible endian adjustment for merging coverage data
gcc/ChangeLog:
2020-05-27  Dong JianQiang  <dongjianqiang2@huawei.com>

	PR gcov-profile/95332
	* gcov-io.c (gcov_var::endian): Move field.
	(from_file): Add IN_GCOV_TOOL check.
	* gcov-io.h (gcov_magic): Ditto.

libgcc/ChangeLog:
2020-05-27  Dong JianQiang  <dongjianqiang2@huawei.com>

	PR gcov-profile/95332
	* libgcov-util.c (read_gcda_file): Call gcov_magic.
	* libgcov.h (gcov_magic): Disable GCC poison.
2020-05-28 08:18:21 +02:00
GCC Administrator 61f3b60556 Daily bump. 2020-05-28 04:23:50 +00:00
Alexandre Oliva a728ec6b8b outputs.exp: no lto, linker default output, cdtor temps, empty args
This patch fixes various issues in the testsuite that came up after
the dump/aux output revamp, namely:

- many outputs.exp tests used -flto without checking that LTO was
supported, getting lots of failures.  With this patch, we test for LTO
support, and skip -flto tests on platforms that do not support it.

- some linkers error out if an output file is not named, and the
a.{out,exe} construct that we used throughout outputs.exp to match the
default linker output would trigger a bug in tcl globbing.  With this
patch, we detect the default linker output early.  If none is found,
we arrange to pass -o a.out explicitly in tests that used to test the
default linker output.  We now look for the detected default, or for
explicitly-specified output.

- collect2 will leave <execname>.cdtor.* files behind in -save-temps
tests.  Ignore them.

- The prepending of -Wl, to file names in ldflags et al was done in a
way that introduced empty arguments when consecutive blanks appeared
in these board configuration knobs.  Skip the empty strings between
consecutive blanks to avoid this problem.


gcc/testsuite/ChangeLog:

	* lib/gcc-defs.exp: Avoid introducing empty arguments between
	consecutive blanks in board linking options.
	* gcc.misc-tests/outputs.exp: Likewise.  Document
	-gsplit-dwarf testing, skip LTO tests if -flto is not
	supported, detect the default linker output name, cope with
	the need for an explicit executable output.
2020-05-27 23:16:52 -03:00
Max Filippov b764155086 gcc: xtensa: delegitimize UNSPEC_PLT
This fixes 'non-delegitimized UNSPEC 3 found in variable location' notes
issued when building libraries which interferes with running tests.

2020-05-27  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
	* config/xtensa/xtensa.c (xtensa_delegitimize_address): New
	function.
	(TARGET_DELEGITIMIZE_ADDRESS): New macro.
2020-05-27 18:42:37 -07:00
Eric Botcazou fe7ebef7fe Add support for __builtin_bswap128
This patch introduces a new builtin named __builtin_bswap128 on targets
where TImode is supported, i.e. 64-bit targets only in practice.  The
implementation simply reuses the existing double word path in optab, so
no routine is added to libgcc (which means that you get two calls to
_bswapdi2 in the worst case).

gcc/ChangeLog:

	* builtin-types.def (BT_UINT128): New primitive type.
	(BT_FN_UINT128_UINT128): New function type.
	* builtins.def (BUILT_IN_BSWAP128): New GCC builtin.
	* doc/extend.texi (__builtin_bswap128): Document it.
	* builtins.c (expand_builtin): Deal with BUILT_IN_BSWAP128.
	(is_inexpensive_builtin): Likewise.
	* fold-const-call.c (fold_const_call_ss): Likewise.
	* fold-const.c (tree_call_nonnegative_warnv_p): Likewise.
	* tree-ssa-ccp.c (evaluate_stmt): Likewise.
	* tree-vect-stmts.c (vect_get_data_ptr_increment): Likewise.
	(vectorizable_call): Likewise.
	* optabs.c (expand_unop): Always use the double word path for it.
	* tree-core.h (enum tree_index): Add TI_UINT128_TYPE.
	* tree.h (uint128_type_node): New global type.
	* tree.c (build_common_tree_nodes): Build it if TImode is supported.

gcc/testsuite/ChangeLog:

	* gcc.dg/builtin-bswap-10.c: New test.
	* gcc.dg/builtin-bswap-11.c: Likewise.
	* gcc.dg/builtin-bswap-12.c: Likewise.
	* gcc.target/i386/builtin-bswap-5.c: Likewise.
2020-05-28 00:33:04 +02:00
Jonathan Wakely bbaec68c86 libstdc++: Fix atomic<FP>::load (PR 95282)
PR libstdc++/95282
	* include/bits/atomic_base.h (__atomic_impl::load): Add
	cv-qualifiers to parameter so that _Tp is deduced as the
	unqualified type.
	* testsuite/29_atomics/atomic_float/95282.cc: New test.
2020-05-27 22:55:21 +01:00
Jonathan Wakely 6c2582c040 libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)
The bug report is that transform_view's sentinel<false> cannot be
compared to its iterator<true>.  The comparison is supposed to use
operator==(iterator<Const>, sentinel<Const>) after converting
sentinel<false> to sentinel<true>. However, the operator== is a hidden
friend so is not a candidate when comparing iterator<true> with
sentinel<false>. The required conversion would only happen if we'd found
the operator, but we can't find the operator until after the conversion
happens.

A new LWG issue has been reported, but not yet assigned a number.  The
solution suggested by Casey Carter is to make the hidden friends of the
sentinel types work with iterators of any const-ness, so that no
conversions are required.

Patrick Palka observed that join_view has a similar problem and a
similar fix is used for its sentinel.

	PR libstdc++/95322
	* include/std/ranges (transform_view::_Sentinel): Allow hidden
	friends to work with _Iterator<true> and _Iterator<false>.
	(join_view::_Sentinel): Likewise.
	* testsuite/std/ranges/adaptors/95322.cc: New test.
2020-05-27 22:08:15 +01:00
Jonathan Wakely 979e89a9a9 libstdc++: Fix std::reverse_iterator comparisons (PR 94354)
The std::reverse_iterator comparisons have always been implemented only
in terms of equality and less than. In C++98 that made no difference for
reasonable code, because when the underlying operators are the same type
they are required to support all comparisons anyway.

But since LWG 280 it's possible to compare reverse_iterator<X> and
reverse_iterator<Y>, and comparisons between X and Y might not support
the full set of equality and relational operators. This means that it
matters whether we implement operator!= as x.base() != y.base() or
!(x.base() == y.base()), and the current implementation is
non-conforming.

This was already fixed in GCC 10.1 for C++20, this change also fixes it
for all other -std modes.

	PR libstdc++/94354
	* include/bits/stl_iterator.h (reverse_iterator): Fix comparison
	operators to use the correct operations on the underlying
	iterators.
	* testsuite/24_iterators/reverse_iterator/rel_ops.cc: New test.
2020-05-27 21:58:56 +01:00
Uros Bizjak 1852a26b92 i386: Fix V2SF horizontal add/subtract insns
PFPNACC insn is incorrectly modelled to perform addition and subtraction
of two operands, but in reality it performs horizontal addition and
subtraction:

Instruction: PFPNACC dest,src

Description:
dest[31:0] <- dest[31:0] - dest[63:32];
dest[63:32] <- src[31:0] + src[63:32];

Also, it is not possible to directly replace PFACC with HADDPS and PFNACC
with HSUBPS, because operands in the second word do not match.

PFACC does:

dest[31..0] <- dest[31..0] + dest[63..32];
dest[63..32] <- src[31..0] + src [63..32];

while HADDPS does:

dest[31..0] <-  dest[31..0]  +  dest[63..32];
dest[63..32] <- dest[127..96] + dest[95..64];
dest[95..64] <- src [31..0]  +  src [64..32];
dest[127:96] <- src [127..96] + src [95..64];

2020-05-27  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	* config/i386/mmx.md (*mmx_haddv2sf3): Remove SSE alternatives.
	(mmx_hsubv2sf3): Ditto.
	(mmx_haddsubv2sf3): New expander.
	(*mmx_haddsubv2sf3): Rename from mmx_addsubv2sf3. Correct
	RTL template to model horizontal subtraction and addition.
	* config/i386/i386-builtin.def (IX86_BUILTIN_PFPNACC):
	Update for rename.
2020-05-27 21:46:49 +02:00
Harald Anlauf c949ec9c4e PR fortran/95090 - ICE: identifier overflow
For long module name, derive type and component name, the generated
name-mangled symbol did not fit into a buffer when coarrays were
enabled.  Provide sufficiently large temporary.

2020-05-27  Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
	PR fortran/95090
	* iresolve.c (gfc_get_string): Enlarge temporary for
	name-mangling.

gcc/testsuite/
	PR fortran/95090
	* gfortran.dg/pr95090.f90: New test.
2020-05-27 21:20:24 +02:00
Uros Bizjak 7d014acc1e i386: Remove %q modifier from two pmov insn templates [PR95355]
2020-05-27  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/95355
	* config/i386/sse.md
	(<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>):
	Remove %q operand modifier from insn template.
	(avx512f_<code>v8hiv8di2<mask_name>): Ditto.

gcc/testsuite/ChangeLog:
	PR target/95355
	* gcc.target/i386/pr95355.c: New test.
2020-05-27 21:02:51 +02:00
David Malcolm c98bd673ef jit: use deep unsharing of trees [PR 95314]
PR jit/95314 reports a internal error inside verify_gimple, which
turned out to be due to reusing the result of
gcc_jit_lvalue_get_address in several functions, leading to tree nodes
shared between multiple function bodies.

This patch fixes the issue by adopting the "Deep unsharing" strategy
described in the comment in gimplify.c preceding mostly_copy_tree_r:
to mark all of the jit "frontend"'s expression tree nodes with
TREE_VISITED, and to set LANG_HOOKS_DEEP_UNSHARING, so that "they are
unshared on the first reference within functions when the regular
unsharing algorithm runs".

gcc/jit/ChangeLog:
	PR jit/95314
	* dummy-frontend.c (LANG_HOOKS_DEEP_UNSHARING): Define to be true.
	* jit-playback.h (gcc::jit::playback::rvalue): Mark tree node with
	TREE_VISITED.

gcc/testsuite/ChangeLog:
	PR jit/95314
	* jit.dg/all-non-failing-tests.h: Add test-pr95314-rvalue-reuse.c.
	* jit.dg/test-pr95314-rvalue-reuse.c: New test.
2020-05-27 14:26:08 -04:00
David Malcolm ac43b32ce2 jit: fix libgccjit.info entry [PR 91330]
2020-05-27  Tom Tromey  <tromey@gcc.gnu.org>

gcc/jit/ChangeLog:
	PR jit/91330
	* docs/conf.py (texinfo_documents): Set description.
	* docs/_build/texinfo/libgccjit.texi: Regenerate.
2020-05-27 14:25:28 -04:00
Jason Merrill 6efa97ea1d c++: Handle multiple aggregate overloads [PR95319].
Here, when considering the two 'insert' overloads, we look for aggregate
conversions from the same initializer-list to B<3> or
initializer_list<B<3>>.  But since my fix for reshape_init overhead on the
PR14179 testcase we reshaped the initializer-list directly, leading to an
error when we then tried to reshape it differently for the second overload.

gcc/cp/ChangeLog:

	PR c++/95319
	* decl.c (reshape_init_array_1): Don't reuse in overload context.

gcc/testsuite/ChangeLog:

	PR c++/95319
	* g++.dg/cpp0x/initlist-array12.C: New test.
2020-05-27 13:56:56 -04:00
Mark Eggleston a7fd43c38f Fortran : ICE in gfc_trans_label_assign PR50392
A function may contain an assigned goto.  If the the return variable
is an integer a statement can be assigned to it.  Prior to this fix
this resulted in an ICE.

2020-05-27  Tobias Burnus  <tobias@codesourcery.com>

gcc/fortran/

	PR fortran/50392
	* trans-decl.c (gfc_get_symbol_decl): Remove unnecessary block
	delimiters.  Add auxiliary variables if a label is assigned to
	a return variable. (gfc_gat_fake_result): If the symbol has an
	assign attribute set declaration from the symbol's backend
	declaration.

2020-05-27  Mark Eggleston  <markeggleston@gnu.gcc.org>

gcc/testsuite/

	PR fortran/50392
	* gfortran.dg/pr50392.f: New test.
2020-05-27 15:46:23 +01:00
Uros Bizjak 240198fe08 i386: Implement V2SF shuffles
2020-05-27  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	* config/i386/mmx.md (mmx_pswapdsf2): Add SSE alternatives.
	Enable insn pattern for TARGET_MMX_WITH_SSE.
	(*mmx_movshdup): New insn pattern.
	(*mmx_movsldup): Ditto.
	(*mmx_movss): Ditto.
	* config/i386/i386-expand.c (ix86_vectorize_vec_perm_const):
	Handle E_V2SFmode.
	(expand_vec_perm_movs): Handle E_V2SFmode.
	(expand_vec_perm_even_odd): Ditto.
	(expand_vec_perm_broadcast_1): Assert that E_V2SFmode
	is already handled by standard shuffle patterns.

gcc/testsuite/ChangeLog:
	* gcc.target/i386/vperm-v2sf.c: New test.
2020-05-27 16:32:10 +02:00
Jason Merrill 6c66c69204 c++: operator<=> and -Wzero-as-null-pointer-constant [PR95242]
In C++20, if there is no viable operator< available, lhs < rhs gets
rewritten to (lhs <=> rhs) < 0, where operator< for the comparison
categories is intended to accept literal 0 on the RHS but not other
integers.  We don't want this to produce a warning from
-Wzero-as-null-pointer-constant.

gcc/cp/ChangeLog:

	* call.c (build_new_op_1): Suppress
	warn_zero_as_null_pointer_constant across comparison of <=> result
	to 0.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/spaceship-synth2.C: Add
	-Wzero-as-null-pointer-constant.
2020-05-27 10:05:57 -04:00
Jason Merrill 7e7d9fcff5 c++: Fix stdcall attribute in template. [PR95222]
Another case that breaks with my fix for PR90750: we shouldn't move type
attributes in TYPENAME context either, as there's no decl for them to move
to.

gcc/cp/ChangeLog:

	PR c++/95222
	* decl.c (grokdeclarator): Don't shift attributes in TYPENAME
	context.

gcc/testsuite/ChangeLog:

	PR c++/95222
	* g++.dg/ext/tmplattr10.C: New test.
2020-05-27 10:05:36 -04:00
Nathan Sidwell ac9face8d2 c++: Revert alias template change [pr95263]
Turns out templates are more complicated than you think, even when you
know they are more complicated than you think.  Reverting this change.

	PR c++/95263
	* pt.c (lookup_template_class_1): Restore alias template mutation.
2020-05-27 09:58:48 -04:00
Richard Biener 6c8e16aea8 tree-optimization/95295 - fix sinking after path merging in new SM code
This fixes a missed sinking of remat stores across unrelated stores
after merging from different paths.

2020-05-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95295
	* tree-ssa-loop-im.c (sm_seq_valid_bb): Fix sinking after
	merging stores from paths.

	* gcc.dg/torture/pr95295-3.c: New testcase.
2020-05-27 14:56:43 +02:00
Jonathan Wakely 116e3cfc7b libstdc++: Add new testcase for comparison category types
Comparing a comparison category type to anything except a literal 0 is
undefined. This verifies that at least some misuses are diagnosed at
compile time.

	* testsuite/18_support/comparisons/categories/zero_neg.cc: New test.
2020-05-27 13:14:17 +01:00
Richard Biener 764ef40ba1 tree-optimization/95356 - fix vectorizable_shift vector types
This makes sure to always use the same vector type for the shift
operand as for the shifted operand.

2020-05-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95356
	* tree-vect-stmts.c (vectorizable_shift): Adjust vector
	type for the shift operand.
2020-05-27 14:14:11 +02:00
Richard Biener a5d8d86e8a tree-optimization/95335 - fix SLP nodes dropped to invariant
When we drop a SLP node to invariant because we cannot vectorize it
we have to make sure to revisit it in the users.

2020-05-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95335
	* tree-vect-slp.c (vect_slp_analyze_node_operations): Reset
	lvisited for nodes made external.

	* gcc.dg/vect/bb-slp-pr95335.c: New testcase.
2020-05-27 13:08:22 +02:00