Commit Graph

183276 Commits

Author SHA1 Message Date
Nathan Sidwell
6606b852bf driver: error for nonexistent linker inputs [PR 98943]
We used to check all unknown input files, even when passing them to a
compiler.  But that caused problems.  However, not erroring out on
non-existent would-be-linker inputs confuses configure machinery that
probes the compiler to see if it accepts various inputs.  This
restores the access check for things that are thought to be linker
input files, when we're not linking.  (If we are linking, we presume
the linker will error out on its own accord.)

	PR driver/98943
	gcc/
	* gcc.c (driver::maybe_run_linker): Check for input file
	accessibility if not linking.
	gcc/testsuite/
	* c-c++-common/pr98943.c: New.
2021-02-05 05:32:34 -08:00
Richard Biener
63538886d1 tree-optimization/98855 - redo BB vectorization costing
The following attempts to account for the fact that BB vectorization
regions now can span multiple loop levels and that an unprofitable
inner loop vectorization shouldn't be offsetted by a profitable
outer loop vectorization to make it overall profitable.

For now I've implemented a heuristic based on the premise that
vectorization should be profitable even if loops may not be entered
or if they iterate any number of times.  Especially the first
assumption then requires that stmts directly belonging to loop A
need to be costed separately from stmts belonging to another loop
which also simplifies the implementation.

On x86 the added testcase has in the outer loop

t.c:38:20: note: Cost model analysis for part in loop 1:
  Vector cost: 56
  Scalar cost: 192

and the inner loop

t.c:38:20: note: Cost model analysis for part in loop 2:
  Vector cost: 132
  Scalar cost: 48

and thus the vectorization is considered not profitable
(note the same would happen in case the 2nd cost were for
a loop outer to the 1st costing).

Future enhancements may consider static knowledge of whether
a loop is always entered which would allow some inefficiency
in the vectorization of its loop header.  Likewise stmts only
reachable from a loop exit can be treated this way.

2021-02-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98855
	* tree-vectorizer.h (add_stmt_cost): New overload.
	* tree-vect-slp.c (li_cost_vec_cmp): New.
	(vect_bb_slp_scalar_cost): Cost individual loop regions
	separately.  Account for the scalar instance root stmt.

	* g++.dg/vect/slp-pr98855.cc: New testcase.
2021-02-05 14:03:00 +01:00
Tom de Vries
4ede02a5f2 debug: fix switch lowering debug info
gcc/ChangeLog:

	PR debug/98656
	* tree-switch-conversion.c (jump_table_cluster::emit): Add loc
	argument.
	(bit_test_cluster::emit): Reuse location_t for newly created
	gswitch statement.
	(switch_decision_tree::try_switch_expansion): Preserve
	location_t.
	* tree-switch-conversion.h: Change function signatures.
2021-02-05 13:26:00 +01:00
Jakub Jelinek
37876976b0 i386: Fix up TARGET_QIMODE_MATH for many AMD CPU tunings [PR98957]
As written in the PR, TARGET_QIMODE_MATH was meant to be set for all
tunings and it was the case for GCC <= 7, but as the number of
PROCESSOR_* enumerators grew, some AMD tunings (which are at the end
of the list) over time got enumerators with values >= 32 and
TARGET_QIMODE_MATH became disabled for them, in GCC 8 for 2
tunings, in GCC 9 for 7 tunings, in GCC 10 for 8 tunings, and
on the trunk for 11 tunings.

The following patch fixes it by using uhwis rather than uints
and gives them also symbolic names.

2021-02-05  Jakub Jelinek  <jakub@redhat.com>

	PR target/98957
	* config/i386/i386-options.c (m_NONE, m_ALL): Define.
	* config/i386/x86-tune.def (X86_TUNE_BRANCH_PREDICTION_HINTS,
	X86_TUNE_PROMOTE_QI_REGS): Use m_NONE instead of 0U.
	(X86_TUNE_QIMODE_MATH): Use m_ALL instead of ~0U.
2021-02-05 10:39:03 +01:00
Jakub Jelinek
b229baa75c c++: Fix ICE with structured binding initialized to incomplete array [PR97878]
We ICE on the following testcase, for incomplete array a on auto [b] { a }; without
giving any kind of diagnostics, with auto [c] = a; during error-recovery.
The problem is that we get too far through check_initializer and e.g.
store_init_value -> constexpr stuff can't deal with incomplete array types.

As the type of the structured binding artificial variable is always deduced,
I think it is easiest to diagnose this early, even if they have array types
we'll need their deduced type to be complete rather than just its element
type.

2021-02-05  Jakub Jelinek  <jakub@redhat.com>

	PR c++/97878
	* decl.c (check_array_initializer): For structured bindings, require
	the array type to be complete.

	* g++.dg/cpp1z/decomp54.C: New test.
2021-02-05 10:22:07 +01:00
Kyrylo Tkachov
d9bb52150d aarch64: Reimplement vget_high* intrinsics
Similar to the vget_low* intrinsics we should just use a proper vec_select rather than
going through V2DI subregs.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (get_high): Define builtin.
	* config/aarch64/aarch64-simd.md (aarch64_get_high<mode>): Define.
	* config/aarch64/arm_neon.h (__GET_HIGH): Delete.
	(vget_high_f16): Reimplement using new builtin.
	(vget_high_f32): Likewise.
	(vget_high_f64): Likewise.
	(vget_high_p8): Likewise.
	(vget_high_p16): Likewise.
	(vget_high_p64): Likewise.
	(vget_high_s8): Likewise.
	(vget_high_s16): Likewise.
	(vget_high_s32): Likewise.
	(vget_high_s64): Likewise.
	(vget_high_u8): Likewise.
	(vget_high_u16): Likewise.
	(vget_high_u32): Likewise.
	(vget_high_u64): Likewise.
2021-02-05 09:17:57 +00:00
Kyrylo Tkachov
b6e7a74987 aarch64: Reimplement vget_low* intrinsics
We can do better on the vget_low* intrinsics.
Currently they reinterpret their argument into a V2DI vector and extract the low "lane",
reinterpreting that back into the shorter vector.
This is functionally correct and generates a sequence of subregs and a vec_select that, by itself,
gets optimised away eventually.
However it's bad when we want to use the result in a other SIMD operations.
Then the subreg-vec_select-subreg combo blocks many combine patterns.

This patch reimplements them to emit a proper low vec_select from the start.
It generates much cleaner RTL and allows for more aggressive combinations, particularly
with the patterns that Jonathan has been pushing lately.

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def (get_low): Define builtin.
	* config/aarch64/aarch64-simd.md (aarch64_get_low<mode>): Define.
	* config/aarch64/arm_neon.h (__GET_LOW): Delete.
	(vget_low_f16): Reimplement using new builtin.
	(vget_low_f32): Likewise.
	(vget_low_f64): Likewise.
	(vget_low_p8): Likewise.
	(vget_low_p16): Likewise.
	(vget_low_p64): Likewise.
	(vget_low_s8): Likewise.
	(vget_low_s16): Likewise.
	(vget_low_s32): Likewise.
	(vget_low_s64): Likewise.
	(vget_low_u8): Likewise.
	(vget_low_u16): Likewise.
	(vget_low_u32): Likewise.
	(vget_low_u64): Likewise.
2021-02-05 08:14:07 +00:00
Kito Cheng
072f20c555 PR target/98878 - Incorrect multilib list for riscv*-rtems
- Multi-lib only check the default argument is appeared in the multilib
   flag list, but we didn't check the case that the flag is required but
   default argument didn't provide.

 - For example riscv*-rtems has a multilib set:

     rv32imafd/ilp32d;@march=rv32imafd@mabi=ilp32d

   And when we set the default argument of arch to rv32imafdc and ABI to
   ilp32d, gcc will check the ilp32d is matched, but it didn't check
   rv32imafd is not provided by default arguments, so it should not
   reuse default library.

 - The side effcet of this patch is csky-elf target will increase the
   number of multilib from 54 to 59, but it's because genmultilib didn't
   know the default argument for multilib, so I think it could be
   improved in future.

gcc/ChangeLog:

	* gcc.c (print_multilib_info): Check all required argument is provided
	by default arg.
2021-02-05 14:26:16 +08:00
liuhongt
8d0737d8f4 Fix ICE: Don't generate integer mask comparision for 128/256-bits vector when op_true/op_false are NULL or constm1_rtx/const0_rtx [PR98537]
avx512vl-pr92686-vpcmp-{1,2,intelasm-1}.c are used to guard code
generation of integer mask comparison, but for vector comparison to
vector dest, integer mask comparison is disliked, so delete these
useless tests.

gcc/ChangeLog:

	PR target/98537
	* config/i386/i386-expand.c (ix86_expand_sse_cmp): Don't
	generate integer mask comparison for 128/256-bits vector when
	op_true/op_false is NULL_RTX or CONSTM1_RTX/CONST0_RTX. Also
	delete redundant !maskcmp condition.
	(ix86_expand_int_vec_cmp): Ditto but no redundant deletion
	here.
	(ix86_expand_sse_movcc): Delete definition of maskcmp, add the
	condition directly to if (maskcmp), add extra check for
	cmpmode, it should be MODE_INT.
	(ix86_expand_fp_vec_cmp): Pass NULL to ix86_expand_sse_cmp's
	parameters op_true/op_false.
	(ix86_use_mask_cmp_p): New.

gcc/testsuite/ChangeLog:

	PR target/98537
	* g++.target/i386/avx512bw-pr98537-1.C: New test.
	* g++.target/i386/avx512vl-pr98537-1.C: New test.
	* g++.target/i386/avx512vl-pr98537-2.C: New test.
	* gcc.target/i386/avx512vl-pr88547-1.c: Adjust testcase,
	integer mask comparison should not be generated.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-1.c: Remove.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-2.c: Ditto.
	* gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c: Ditto.
2021-02-05 09:59:36 +08:00
liuhongt
b80fefd626 Enable X86_TUNE_AVX256_UNALIGNED_{LOAD,STORE}_OPTIMAL in generic tune.
gcc/ChangeLog:

	PR target/98172
	* config/i386/x86-tune.def (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL):
	Remove m_GENERIC from ~list.
	(X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL): Ditto.
2021-02-05 09:56:49 +08:00
GCC Administrator
a19dd5e644 Daily bump. 2021-02-05 00:16:23 +00:00
Julian Brown
b2d84e9f9c openacc: Tests for character types in derived-type mappings
This patch adds some tests for character types that are components of
derived types used in OpenACC data-movement clauses.

gcc/testsuite/
	* gfortran.dg/goacc/derived-chartypes-1.f90: New test.
	* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
	* gfortran.dg/goacc/derived-chartypes-3.f90: Likewise.
	* gfortran.dg/goacc/derived-chartypes-4.f90: Likewise.
2021-02-04 15:06:56 -08:00
Julian Brown
9a4d32f85c openacc: Allow strided arrays in update directives
OpenACC 3.0 ("2.14.4. Update Directive") states:

  Noncontiguous subarrays may appear. It is implementation-specific
  whether noncontiguous regions are updated by using one transfer for
  each contiguous subregion, or whether the non-contiguous data is
  packed, transferred once, and unpacked, or whether one or more larger
  subarrays (no larger than the smallest contiguous region that contains
  the specified subarray) are updated.

This patch relaxes some conditions in the Fortran front-end so that
strided accesses are permitted for update directives.

gcc/fortran/
	* openmp.c (resolve_omp_clauses): Omit OpenACC update in
	contiguity check and stride-specified error.

gcc/testsuite/
	* gfortran.dg/goacc/array-with-dt-2.f90: New test.

libgomp/
	* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test.
2021-02-04 15:06:22 -08:00
Julian Brown
f743fe2316 openacc: Use class_pointer instead of pointer attribute for class types
Elsewhere in the Fortran front-end, the class_pointer attribute is
used for BT_CLASS entities instead of the pointer attribute. This patch
follows suit for OpenACC. I couldn't actually come up with a test case
where this makes a difference (i.e., where "class_pointer" and "pointer"
have different values at this point in the code), but this may nonetheless
fix a latent bug.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
	for BT_CLASS.
2021-02-04 15:05:50 -08:00
Julian Brown
cff6e8db88 openacc: Dereference BT_CLASS data pointers but not BT_DERIVED pointers
The stanza in gfc_trans_omp_clauses that handles derived type members
that are themselves derived type pointers or class pointers now adds
an explicit dereference only for the latter. The former is already
dereferenced transparently in gfc_conv_component_ref.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Fix dereferencing for
	BT_DERIVED members.

gcc/testsuite/
	* gfortran.dg/goacc/derived-classtypes-1.f95: New test.
2021-02-04 15:05:14 -08:00
Jakub Jelinek
0b34dbc0a2 testsuite: Fix up pr25376.c on powerpc64-linux and array-quals-1.c on powerpc-linux [PR98325]
The following patch fixes the pr25376.c testcase on powerpc64-linux
and array-quals-1.c on powerpc-linux.
Previously it failed like:
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?a1\$ (found a1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?b1\$ (found b1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?c1\$ (found c1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?d1\$ (found d1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p\$ (found p) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p1\$ (found p1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q\$ (found q) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q1\$ (found q1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r\$ (found r) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r1\$ (found r1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s\$ (found s) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s1\$ (found s1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t\$ (found t) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t1\$ (found t1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found .L.simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)

The problem with pr25376.c testcase are the ELFv1 function descriptors,
        .section        my_named_section,"ax",@progbits
        .align 2
        .globl simple
        .section        ".opd","aw"
        .align 3
simple:
        .quad   .L.simple,.TOC.@tocbase,0
        .previous
        .type   simple, @function
.L.simple:

so the simple symbol is found in the .opd section rather than in the
my_named_section the test attempts to verify for that symbol.
This patch deals it with two changes, the last two hunks in scanasm.exp
teach it about the behavior of .previous directive and the first hunk
for powerpc if symbol is in .opd section will try section in which the
.L.symbol label is instead.

The array-quals-1.c test fails because on powerpc-linux the symbols
are emitted into .sdata section rather than one of the expected ones.

2021-02-04  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/98325
	* lib/scanasm.exp (dg-scan-symbol-section): For powerpc*-*-* targets if
	$section is .opd, look at .L.$symbol_name's section.
	(parse_section_section_of_symbols): Handle .previous directive.
	* gcc.dg/array-quals-1.c: Allow .sdata section.
2021-02-04 23:42:09 +01:00
Iain Buclaw
c1d56e6a73 d: Merge upstream dmd 46133f761, druntime 0fd4364c
D front-end changes:

 - Backported built-in function handling from upstream.

 - Added new intrinsic `byteswap(ushort)`.

Druntime changes:

 - Update intrinsic modules core.bitop, core.checkedint, core.simd,
   core.vararg, and core.volatile.

 - Backport platform-specific fixes for runtime modules core.cpuid,
   core.internal.traits, and rt.lifetime.

 - Backport openbsd fixes for core.stdc.stdio.

 - Backport solaris fixes for core.sys.posix.locale, and
   core.thread.osthread (PR98910).

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 46133f761.
	* d-builtins.cc (d_build_builtins_module): Set builtins as BUILTINgcc.
	(maybe_set_builtin_1): Likewise.
	* d-frontend.cc (eval_builtin): Adjust condition for early return.
	* intrinsics.cc (maybe_set_intrinsic): Set intrinsics as BUILTINgcc.
	(maybe_expand_intrinsic): Add case for INTRINSIC_BSWAP16.
	* intrinsics.def (INTRINSIC_BT): Update signature.
	(INTRINSIC_BT64): Likewise.
	(INTRINSIC_BSWAP16): New intrinsic.
	(INTRINSIC_VLOAD8): Update module.
	(INTRINSIC_VLOAD16): Likewise.
	(INTRINSIC_VLOAD32): Likewise.
	(INTRINSIC_VLOAD64): Likewise.
	(INTRINSIC_VSTORE8): Likewise.
	(INTRINSIC_VSTORE16): Likewise.
	(INTRINSIC_VSTORE32): Likewise.
	(INTRINSIC_VSTORE64): Likewise.
	(INTRINSIC_ADDS): Update signature.
	(INTRINSIC_ADDSL): Likewise.
	(INTRINSIC_ADDU): Likewise.
	(INTRINSIC_ADDUL): Likewise.
	(INTRINSIC_SUBS): Likewise.
	(INTRINSIC_SUBSL): Likewise.
	(INTRINSIC_SUBU): Likewise.
	(INTRINSIC_SUBUL): Likewise.
	(INTRINSIC_MULS): Likewise.
	(INTRINSIC_MULSL): Likewise.
	(INTRINSIC_MULU): Likewise.
	(INTRINSIC_MULUI): Likewise.
	(INTRINSIC_MULUL): Likewise.
	(INTRINSIC_NEGS): Likewise.
	(INTRINSIC_NEGSL): Likewise.

libphobos/ChangeLog:

	PR d/98910
	* libdruntime/MERGE: Merge upstream druntime 0fd4364c.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/volatile.d.
	* libdruntime/Makefile.in: Regenerate.
	* testsuite/libphobos.allocations/tls_gc_integration.d: Update test.

gcc/testsuite/ChangeLog:

	* gdc.dg/intrinsics.d: Update test.
2021-02-04 23:04:48 +01:00
Martin Sebor
ce5720447c PR c/97882 - Segmentation Fault on improper redeclaration of function
gcc/c/ChangeLog:

	PR c/97882
	* c-decl.c (locate_old_decl): Add type to diagnostic output.
	(diagnose_mismatched_decls): Same.
	(start_function): Introduce temporaries for better readability.
	* c-typeck.c (comptypes_internal): Only consider complete enum
	types in comparisons with integers.

gcc/testsuite/ChangeLog:

	PR c/97882
	* gcc.dg/decl-8.c: Adjust text of expected diagnostic.
	* gcc.dg/label-decl-4.c: Same.
	* gcc.dg/mismatch-decl-1.c: Same.
	* gcc.dg/old-style-then-proto-1.c: Same.
	* gcc.dg/parm-mismatch-1.c: Same.
	* gcc.dg/pr35445.c: Same.
	* gcc.dg/redecl-11.c: Same.
	* gcc.dg/redecl-12.c: Same.
	* gcc.dg/redecl-13.c: Same.
	* gcc.dg/redecl-15.c: Same.
	* gcc.dg/tls/thr-init-1.c: Same.
	* objc.dg/id-1.m: Same.
	* objc.dg/tls/diag-3.m: Same.
	* gcc.dg/pr97882.c: New test.
	* gcc.dg/qual-return-7.c: New test.
	* gcc.dg/qual-return-8.c: New test.
2021-02-04 14:53:38 -07:00
Jason Merrill
4e7c24d97d c++: Empty args for variadic concept [PR98717]
Nice when fixing a bug is as easy as removing incorrect checks.

gcc/cp/ChangeLog:

	PR c++/98717
	* constraint.cc (build_concept_check_arguments): Remove assert.
	(build_concept_check): Allow empty args.

gcc/testsuite/ChangeLog:

	PR c++/98717
	* g++.dg/cpp2a/concepts-variadic3.C: New test.
2021-02-04 15:43:43 -05:00
David Malcolm
65c1cb3589 diagnostics: fix excessive range-printing involving macros [PR97932]
PR c/97932 describes a bug in which diagnostic_show_locus prints most
of a source file.

The issue is that it prints a range in which the start and end locations
are part of the same macro map, but the start location is for a token in
the definition of the macro, whereas the end location is for a token in
an argument of the macro.

This patch extends compatible_locations_p to require that range-printing
of macro maps requires the location to either be both for the definition
of the macro, or both for the arguments of the macro (not one of each),
fixing the issue.

gcc/ChangeLog:
	PR c/97932
	* diagnostic-show-locus.c (compatible_locations_p): Require
	locations in the same macro map to be either both from the
	macro definition, or both from the macro arguments.

gcc/testsuite/ChangeLog:
	PR c/97932
	* gcc.dg/pr97932.c: New test.
2021-02-04 15:20:59 -05:00
emsr
26fd3bf75b Correct date value of the __cpp_size_t_suffix macro.
The value of __cpp_size_t_suffix is 202011 not 202006.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.c (c_cpp_builtins): __cpp_size_t_suffix=202011L.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/feat-cxx2b.C: __cpp_size_t_suffix == 202011.
2021-02-04 14:10:18 -05:00
Jakub Jelinek
e91f9da579 c++, libcpp: Use make_signed_t<size_t> in the 1z diagnostics
The following patch uses make_signed_t<size_t> instead of
make_signed<size_t>::type in the diagnostics, because the former is shorter.
It is true that one can't use make_signed<size_t>::type in C++11 code (which
is why I haven't changed it in the testcase which is c++11 effective
target), but the message talks about C++23 and make_signed_t is a C++14 and
later feature, so I think it is fine.

2021-02-04  Jakub Jelinek  <jakub@redhat.com>

	* expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
	make_signed<size_t>::type in the diagnostics.

	* g++.dg/warn/Wsize_t-literals.C: Expect make_signed_t<size_t> instead
	of make_signed<size_t>::type in the diagnostics.
2021-02-04 18:30:45 +01:00
Tom Greenslade (thomgree)
e6cc142ad9 c++: fix string literal member initializer bug [PR90926]
build_aggr_conv did not correctly handle string literal member initializers.
Extended can_convert_array to handle this case. For the additional check of
compatibility of character types, factored out code from digest_init_r into
a new function.

gcc/cp/ChangeLog:

	PR c++/90926
	* call.c (can_convert_array): Extend to handle all valid aggregate
	initializers of an array; including by string literals, not just by
	brace-init-list.
	(build_aggr_conv): Call can_convert_array more often, not just in
	brace-init-list case.
	* typeck2.c (array_string_literal_compatible_p): New function.
	(digest_init_r): call array_string_literal_compatible_p
	* cp-tree.h: (array_string_literal_compatible_p): Declare.

gcc/testsuite/ChangeLog:

	PR c++/90926
	* g++.dg/cpp1y/nsdmi-aggr12.C: New test.
2021-02-04 10:46:39 -05:00
Jonathan Wright
aa652fb2a0 aarch64: Use RTL builtins for [su]mull_high_lane[q] intrinsics
Rewrite [su]mull_high_lane[q] Neon intrinsics to use RTL builtins
rather than inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-02-03  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add
	[su]mull_hi_lane[q] builtin generator macros.
	* config/aarch64/aarch64-simd.md
	(aarch64_<su>mull_hi_lane<mode>_insn): Define.
	(aarch64_<su>mull_hi_lane<mode>): Define.
	(aarch64_<su>mull_hi_laneq<mode>_insn): Define.
	(aarch64_<su>mull_hi_laneq<mode>): Define.
	* config/aarch64/arm_neon.h (vmull_high_lane_s16): Use RTL
	builtin instead of inline asm.
	(vmull_high_lane_s32): Likewise.
	(vmull_high_lane_u16): Likewise.
	(vmull_high_lane_u32): Likewise.
	(vmull_high_laneq_s16): Likewise.
	(vmull_high_laneq_s32): Likewise.
	(vmull_high_laneq_u16): Likewise.
	(vmull_high_laneq_u32): Liekwise.
2021-02-04 13:57:36 +00:00
Jonathan Wright
1d6228454c aarch64: Use RTL builtins for [su]mull_high_n intrinsics
Rewrite [su]mull_high_n Neon intrinsics to use RTL builtins rather
than inline assembly code, allowing for better scheduling and
optimization.

gcc/ChangeLog:

2021-02-03  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add [su]mull_hi_n
	builtin generator macros.
	* config/aarch64/aarch64-simd.md
	(aarch64_<su>mull_hi_n<mode>_insn): Define.
	(aarch64_<su>mull_hi_n<mode>): Define.
	* config/aarch64/arm_neon.h (vmull_high_n_s16): Use RTL builtin
	instead of inline asm.
	(vmull_high_n_s32): Likewise.
	(vmull_high_n_u16): Likewise.
	(vmull_high_n_u32): Likewise.
2021-02-04 13:56:50 +00:00
Richard Biener
7002a33d1b tree-optimization/98855 - fix some vectorizer cost issues
This fixes us not costing vectorized bswap for SLP as well as
avoiding biasing to the vectorized side when costing single-argument
PHIs.  Instead we assume coalescing here and cost them with zero cost
for both the scalar and vectorized code.

This doesn't fix the PR on its own.

2021-02-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98855
	* tree-vect-loop.c (vectorizable_phi): Do not cost
	single-argument PHIs.
	* tree-vect-slp.c (vect_bb_slp_scalar_cost): Likewise.
	* tree-vect-stmts.c (vectorizable_bswap): Also perform
	costing for SLP operation.
2021-02-04 13:02:09 +01:00
Tobias Burnus
f0e618faeb Fortran: OpenMP/OpenACC diagnose substring rejections better
gcc/fortran/ChangeLog:

	* openmp.c (resolve_omp_clauses): Explicitly diagnose
	substrings as not permitted.

gcc/testsuite/ChangeLog:

	* gfortran.dg/goacc/substring.f90: New test.
	* gfortran.dg/gomp/substring.f90: New test.
2021-02-04 12:32:59 +01:00
Martin Liska
5eb792e7a1 doc: mention -mprefer-vector-width in target attrs
gcc/ChangeLog:

	* doc/extend.texi: Mention -mprefer-vector-width in target
	attributes.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/prefer-vector-width-attr.c: New test.
2021-02-04 10:42:10 +01:00
Jason Merrill
787f3ebf00 c++: No aggregate CTAD with explicit dguide [PR98802]
In my implementation of P2082R1 I missed this piece: the aggregate deduction
candidate is not generated if the class has user-written deduction guides.

gcc/cp/ChangeLog:

	PR c++/98802
	* pt.c (do_class_deduction): No aggregate guide if any_dguides_p.

gcc/testsuite/ChangeLog:

	PR c++/98802
	* g++.dg/cpp1z/class-deduction78.C: New test.
2021-02-03 22:03:40 -05:00
Jason Merrill
7b258ac7af c++: subst failure in attribute argument [PR95192]
Another SFINAE issue: we weren't propagating substitution failure in
attributes back up.  And tsubst_function_decl needs to check substitution
before register_specialization.  I thought about moving the other error
returns up as well, but they aren't SFINAE cases, so they can stay where
they are.

This change caused pr84630.C to stop giving an error; this was because
partial instantiation of the lambda failed silently, and before the change
that meant error_mark_node passed to decl_attributes, which complained about
there being an argument at all.  With the change the partial instantiation
fails, but no error was ever given, because push_template_decl silently
failed if current_template_parms wasn't set.  So let's set c_t_p
appropriately.  lambda-uneval13.C is a valid testcase to exercise this.

gcc/cp/ChangeLog:

	PR c++/95192
	* pt.c (tsubst_attribute): Handle error.
	(apply_late_template_attributes): Return false on error.
	(tsubst_function_decl): Check its return value.
	(tsubst_decl): Likewise.
	(push_template_decl): Assert current_template_parms.
	(tsubst_template_decl): Set current_template_parms.

gcc/testsuite/ChangeLog:

	PR c++/95192
	* g++.dg/cpp0x/pr84630.C: Call b().
	* g++.dg/cpp2a/lambda-uneval13.C: New test.
	* g++.dg/ext/attr-expr1.C: New test.
2021-02-03 21:38:33 -05:00
GCC Administrator
9faaa80776 Daily bump. 2021-02-04 00:16:32 +00:00
Jakub Jelinek
ac16f4327f libcpp: Fix up -fdirectives-only preprocessing [PR98882]
GCC 11 ICEs on all -fdirectives-only preprocessing when the files don't end
with a newline.

The problem is in the assertion, for empty TUs buffer->cur == buffer->rlimit
and so buffer->rlimit[-1] access triggers UB in the preprocessor, for
non-empty TUs it refers to the last character in the file, which can be
anything.
The preprocessor adds a '\n' character (or '\r', in particular if the
user file ends with '\r' then it adds another '\r' rather than '\n'), but
that is added after the limit, i.e. at buffer->rlimit[0].

Now, if the routine handles occassional bumping of pos to buffer->rlimit + 1,
I think it is just the assert that needs changing, usually we read from *pos
if pos < limit and then e.g. if it is '\r', look at the following character
(which could be one of those '\n' or '\r' at buffer->rlimit[0]).  There is
also the case where for '\\' before the limit we read following character
and if it is '\n', do one thing, if it is '\r' read another character.
But in that case if '\\' was the last char in the TU, the limit char will be
'\n', so we are ok.

2021-02-03  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/98882
	* lex.c (cpp_directive_only_process): Don't assert that rlimit[-1]
	is a newline, instead assert that rlimit[0] is either newline or
	carriage return.  When seeing '\\' followed by '\r', check limit
	before accessing pos[1].

	* gcc.dg/cpp/pr98882.c: New test.
2021-02-03 23:18:05 +01:00
Jeff Law
34215a7a3a Fix typo in Fortran manual
gcc/fortran:
	* intrinsic.texi (ANINT): Fix typo.
2021-02-03 15:01:19 -07:00
Iain Buclaw
b1a207c6df libphobos: Merge upstream druntime 9d0c8364, phobos 9d575282e.
Druntime changes:

 - Add platform-specific bindings for stdlib.h and sys/syctl.h.

 - Add darwin bindings for mach/dyld.h.

 - Fix solaris bindings for locale.h (PR98910).

 - Remove deprecated bindings from the module headers.

Phobos changes:

 - Backport platform-specific fixes for std.conv, std.datetime,
   std.exception, std.experimental.allocator, std.file, std.math,
   std.parallelism, std.socket, std.stdio, and std.system.

Reviewed-on: https://github.com/dlang/druntime/pull/3363
	     https://github.com/dlang/phobos/pull/7784

libphobos/ChangeLog:

	PR d/98910
	* libdruntime/MERGE: Merge upstream druntime 9d0c8364.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
	  core/internal/attributes.d
	(DRUNTIME_DSOURCES_BIONIC): Add core/sys/bionic/stdlib.d.
	(DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/stdlib.d, and
	core/sys/darwin/sys/sysctl.d.
	(DRUNTIME_DSOURCES_DRAGONFLYBSD): Add
	core/sys/dragonflybsd/stdlib.d, and
	core/sys/dragonflybsd/sys/sysctl.d.
	(DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/stdlib.d, and
	core/sys/freebsd/sys/sysctl.d.
	(DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/stdlib.d, and
	core/sys/netbsd/sys/sysctl.d.
	(DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/stdlib.d, and
	core/sys/openbsd/sys/sysctl.d.
	(DRUNTIME_DSOURCES_SOLARIS): Add core/sys/solaris/stdlib.d.
	* libdruntime/Makefile.in: Regenerate.
	* src/MERGE: Merge upstream phobos 9d575282e.
2021-02-03 22:06:42 +01:00
Marek Polacek
b52a1dfe12 c++: Mark member functions as const [PR98951]
These member functions look like they could be marked const, since
they don't modify any (non-mutable) class members.

	PR c++/98951
	* call.c (struct z_candidate): Mark rewritten and reversed as const.
	(struct NonPublicField): Mark operator() as const.
	(struct NonTrivialField): Likewise.
2021-02-03 13:24:40 -05:00
Jason Merrill
5c62e4f255 c++: Fix alias comparison [PR98926]
The comparison of dependent aliases wasn't working here because
processing_template_decl wasn't set, so dependent_alias_template_spec_p was
always returning false.

gcc/cp/ChangeLog:

	PR c++/98926
	PR c++/98570
	* pt.c (spec_hasher::equal): Set processing_template_decl.
	* Make-lang.in (check-g++-strict-gc): Add --param
	hash-table-verification-limit=10000.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-dr1558.C: Pass --param
	hash-table-verification-limit=10000.
2021-02-03 12:50:18 -05:00
Martin Sebor
5c3d388aee PR tree-optimization/98937 - pointer_query cache leaks
gcc/ChangeLog:

	PR tree-optimization/98937
	* tree-ssa-strlen.c (strlen_dom_walker::~strlen_dom_walker): Define.
	Flush pointer_query cache.
2021-02-03 10:23:53 -07:00
Ed Smith-Rowland
1f69e63cfc c++: Implement C++23 P0330 - Literal Suffixes for ptrdiff_t and size_t.
Integer literal suffixes for signed size ('z') and unsigned size
(some permutation od 'zu') are provided as a language addition.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_size_t_suffix.
	* c-lex.c (interpret_integer): Set node type for size literal.

libcpp/ChangeLog:

	* expr.c (interpret_int_suffix): Detect 'z' integer suffix.
	(cpp_classify_number): Compat warning for use of 'z' suffix.
	* include/cpplib.h (struct cpp_options): New flag.
	(enum cpp_warning_reason): New flag.
	(CPP_N_USERDEF): Comment C++0x -> C++11.
	(CPP_N_SIZE_T): New flag for cpp_classify_number.
	* init.c (cpp_set_lang): Initialize new flag.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/udlit-shadow-neg.C: Test for 'z' and 'zu' shadowing.
	* g++.dg/cpp23/feat-cxx2b.C: New test.
	* g++.dg/cpp23/size_t-literals.C: New test.
	* g++.dg/warn/Wsize_t-literals.C: New test.
2021-02-03 12:12:31 -05:00
Ian Lance Taylor
530203d6e3 libgo: install new 1.16 packages
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/289069
2021-02-03 08:47:28 -08:00
Jakub Jelinek
c926940f52 testsuite: Add test for already fixed PR [PR97804]
This testcase got fixed with the PR98463
r11-6895-g94ff4c9dd98f39280fba22d1ad0958fb25a5363b fix.

2021-02-03  Jakub Jelinek  <jakub@redhat.com>

	PR c++/97804
	* g++.dg/cpp2a/no_unique_address11.C: New test.
2021-02-03 17:16:40 +01:00
Jonathan Wakely
a6f08be383 libstdc++: Fix incorrect test for std::error_code comparisons
The tests for std::error_code comparisons assumed that a default
constructed object uses std::generic_category(). That's true for a
default constructed std::error_condition, but not std::error_code.

Fix the three-way comparisons to correctly depend on the result of
comparing the categories, and add another test for comparing two objects
with the same category and different values.

libstdc++-v3/ChangeLog:

	* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
	Add comparison with same category and different values.
	* testsuite/19_diagnostics/error_code/operators/less.cc:
	Likewise. Fix comparison involving different categories.
	* testsuite/19_diagnostics/error_code/operators/three_way.cc:
	Likewise.
	* testsuite/19_diagnostics/error_condition/operators/less.cc:
	Add comment.
	* testsuite/19_diagnostics/error_condition/operators/three_way.cc:
	Likewise.
2021-02-03 15:49:36 +00:00
yaozhongxiao
5988765741 libstdc++: Improve "find_first/last_set" for NEON
The find_first_set and find_last_set method is not optimal for neon, it
needs to be improved by synthesized with horizontal adds(vaddv) which
will reduce the generated assembly code. In the following cases,
vaddvq_s16 will generate 2 instructions but vpadd_s16 will generate 4
instructions:

 # vaddvq_s16
    vaddvq_s16(__asint);
    //  addv    h0, v1.8h
    //  smov    w1, v0.h[0]
 # vpadd_s16
    vpaddq_s16(vpaddq_s16(vpaddq_s16(__asint, __zero), __zero), __zero)[0]
    // addp v1.8h,v1.8h,v2.8h
    // addp v1.8h,v1.8h,v2.8h
    // addp v1.8h,v1.8h,v2.8h
    // smov    w1, v1.h[0]
 #

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_neon.h: Replace repeated vpadd
	calls with a single vaddv for aarch64.
2021-02-03 15:49:30 +00:00
Matthias Kretz
3de9bd16c9 libstdc++: Work around test failures using -mno-tree-vrp
This is necessary to avoid failures resulting from PR98834.

libstdc++-v3/ChangeLog:

	* testsuite/Makefile.am: Warn about the workaround. Add
	-fno-tree-vrp to CXXFLAGS passed to the check_simd script.
	Improve initial user feedback from make check-simd.
	* testsuite/Makefile.in: Regenerated.
2021-02-03 15:49:30 +00:00
Matthias Kretz
4b940ccee1 libstc++: Implement hmin and hmax
From 9.7.4 in Parallelism TS 2. For some reason I overlooked these two
functions. Implement them via call to _S_reduce.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h: Add __detail::_Minimum and
	__detail::_Maximum to use them as _BinaryOperation to _S_reduce.
	Add hmin and hmax overloads for simd and const_where_expression.
	* include/experimental/bits/simd_scalar.h
	(_SimdImplScalar::_S_reduce): Make unused _BinaryOperation
	parameter const-ref to allow calling _S_reduce with an rvalue.
	* testsuite/experimental/simd/tests/reductions.cc: Add tests for
	hmin and hmax. Since the compiler statically determined that all
	tests pass, repeat the test after a call to make_value_unknown.
2021-02-03 15:49:30 +00:00
Matthias Kretz
af60e4bd4b libstdc++: Improve test codegen for interpreting assembly
In many failure cases it is helpful to inspect the instructions leading
up to the test failure. After this change the location is easier to find
and the branch after failure is easier to find.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/bits/verify.h (verify): Add
	instruction pointer data member. Ensure that the `if (m_failed)`
	branch is always inlined into the calling code. The body of the
	conditional can still be a function call. Move the get_ip call
	into the verify ctor to simplify the ctor calls.
	(COMPARE): Don't mention the use of all_of for reduction of a
	simd_mask. It only distracts from the real issue.
2021-02-03 15:49:30 +00:00
Matthias Kretz
8f7ad98651 libstdc++: Support timeout and timeout-factor options
libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/driver.sh: Abstract reading test
	options into read_src_option function. Read skip, only,
	expensive, and xfail via read_src_option. Add timeout and
	timeout-factor options and adjust timeout variable accordingly.
	* testsuite/experimental/simd/tests/loadstore.cc: Set
	timeout-factor 2.
2021-02-03 15:49:30 +00:00
Matthias Kretz
ec384c5690 libstdc++: Abort test after 1000 lines of output
Handle overly large output by aborting the log and thus the test. This
is a similar condition to a timeout.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/driver.sh: When handling the pipe
	to log (and on verbose to stdout) count the lines. If it exceeds
	1000 log the issue and exit 125, which is then handled as a
	failure.
2021-02-03 15:49:30 +00:00
Matthias Kretz
b83a52fe07 libstdc++: Skip testing hypot3 for long double on PPC
std::hypot(a, b, c) is imprecise and makes this test fail even though
the failure is unrelated to simd.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/hypot3_fma.cc: Add skip:
	markup for long double on powerpc64*.
2021-02-03 15:49:30 +00:00
Matthias Kretz
81c2c32de9 libstdc++: Fix mask reduction of simd_mask<double> on POWER7
POWER7 does not support __vector long long reductions, making the
generic _S_popcount implementation ill-formed. Specializing _S_popcount
for PPC allows optimization and avoids the issue.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h: Add __have_power10vec
	conditional on _ARCH_PWR10.
	* include/experimental/bits/simd_builtin.h: Forward declare
	_MaskImplPpc and use it as _MaskImpl when __ALTIVEC__ is
	defined.
	(_MaskImplBuiltin::_S_some_of): Call _S_popcount from the
	_SuperImpl for optimizations and correctness.
	* include/experimental/bits/simd_ppc.h: Add _MaskImplPpc.
	(_MaskImplPpc::_S_popcount): Implement via vec_cntm for POWER10.
	Otherwise, for >=int use -vec_sums divided by a sizeof factor.
	For <int use -vec_sums(vec_sum4s(...)) to sum all mask entries.
2021-02-03 15:49:30 +00:00
Matthias Kretz
71f9b9bd0a libstdc++: Immediate feedback with -v
libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/driver.sh: Remove executable on
	SIGINT. Process compiler and test executable output: In verbose
	mode print messages immediately, limited to 1000 lines and
	breaking long lines to below $COLUMNS (or 1024 if not set).
	Communicating the exit status of the compiler / test with the
	necessary pipe is done via a message through stdout/-in.
2021-02-03 15:49:29 +00:00