platform/upstream/gcc.git
3 years agoc++: "perfect" implicitly deleted move [PR100644]
Jason Merrill [Tue, 18 May 2021 16:06:36 +0000 (12:06 -0400)]
c++: "perfect" implicitly deleted move [PR100644]

Here we were ignoring the template constructor because the implicit move
constructor had all perfect conversions.  But CWG1402 says that an
implicitly deleted move constructor is ignored by overload resolution; we
implement that instead by preferring any other candidate in joust, to get
better diagnostics, but that means we need to handle that case here as well.

gcc/cp/ChangeLog:

PR c++/100644
* call.c (perfect_candidate_p): An implicitly deleted move
is not perfect.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/implicit-delete1.C: New test.

3 years agoanalyzer: fix missing leak after call to strsep [PR100615]
David Malcolm [Tue, 18 May 2021 16:29:58 +0000 (12:29 -0400)]
analyzer: fix missing leak after call to strsep [PR100615]

PR analyzer/100615 reports a missing leak diagnostic.
The issue is that the code calls strsep which the analyzer doesn't
have special knowledge of, and so conservatively assumes that it
could free the pointer, so drops malloc state for it.

Properly "teaching" the analyzer about strsep would require it
to support bifurcating state at a call, which is currently fiddly to
do, so for now this patch notes that strsep doesn't affect the
malloc state machine, allowing the analyzer to correctly detect the leak.

gcc/analyzer/ChangeLog:
PR analyzer/100615
* sm-malloc.cc: Include "analyzer/function-set.h".
(malloc_state_machine::on_stmt): Call unaffected_by_call_p and
bail on the functions it recognizes.
(malloc_state_machine::unaffected_by_call_p): New.

gcc/testsuite/ChangeLog:
PR analyzer/100615
* gcc.dg/analyzer/pr100615.c: New test.

3 years agoi386: Implement 4-byte vector support [PR100637]
Uros Bizjak [Tue, 18 May 2021 15:25:54 +0000 (17:25 +0200)]
i386: Implement 4-byte vector support [PR100637]

Add infrastructure, logic and arithmetic support for 4-byte vectors.
These can be used with SSE2 targets, where movd instructions from/to
XMM registers are available.  x86_64 ABI passes 4-byte vectors in
integer registers, so also add logic operations with integer registers.

2021-05-18  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/100637
* config/i386/i386.h (VALID_SSE2_REG_MODE):
Add V4QI and V2HI modes.
(VALID_INT_MODE_P): Ditto.
* config/i386/mmx.md (VI_32): New mode iterator.
(mmxvecsize): Handle V4QI and V2HI.
(Yv_Yw): Ditto.
(mov<VI_32:mode>): New expander.
(*mov<mode>_internal): New insn pattern.
(movmisalign<VI_32:mode>): New expander.
(neg<VI_32:mode>): New expander.
(<plusminus:insn><VI_32:mode>3): New expander.
(*<plusminus:insn><VI_32:mode>3): New insn pattern.
(mulv2hi3): New expander.
(*mulv2hi3): New insn pattern.
(one_cmpl<VI_32:mode>2): New expander.
(*andnot<VI_32:mode>3): New insn pattern.
(<any_logic:code><VI_32:mode>3): New expander.
(*<any_logic:code><VI_32:mode>3): New insn pattern.

gcc/testsuite/

PR target/100637
* gcc.target/i386/pr100637-1b.c: New test.
* gcc.target/i386/pr100637-1w.c: Ditto.

* gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq.
* gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq.
* gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb.
* gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for
pmovsxbd and pmovsxwq.
* gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for
pmovzxbd and pmovzxwq.

3 years agoconfig: delete unused sim macros
Mike Frysinger [Wed, 12 May 2021 04:26:17 +0000 (00:26 -0400)]
config: delete unused sim macros

Nothing in gcc or binutils or gdb or anything anywhere uses these.

config/

* acinclude.m4 (CYG_AC_PATH_SIM, CYG_AC_PATH_DEVO): Delete.

3 years agoFortran/OpenMP: Add missing EXEC_OMP_DEPOBJ case val [PR100642]
Tobias Burnus [Tue, 18 May 2021 14:40:45 +0000 (16:40 +0200)]
Fortran/OpenMP: Add missing EXEC_OMP_DEPOBJ case val [PR100642]

PR fortran/100642

gcc/fortran/ChangeLog:

* openmp.c (omp_code_to_statement): Add missing EXEC_OMP_DEPOBJ.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc-gomp/depobj.f90: New test.

3 years agolibstdc++: Fix access issue in elements_view::_Sentinel [PR100631]
Patrick Palka [Tue, 18 May 2021 14:21:27 +0000 (10:21 -0400)]
libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]

In the earlier commit r12-854 I forgot to also rewrite the other operator-
overload in terms of the split-out member function _M_distance_from.

libstdc++-v3/ChangeLog:

PR libstdc++/100631
* include/std/ranges (elements_view::_Sentinel::operator-): Use
_M_distance_from in the other operator- overload too.
* testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.

3 years agoi386: Fix <any_extend:insn>v4qiv4di2 expander
Uros Bizjak [Tue, 18 May 2021 13:56:22 +0000 (15:56 +0200)]
i386: Fix <any_extend:insn>v4qiv4di2 expander

Fix a mode mismatch.

2021-05-18  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
* config/i386/sse.md (<any_extend:insn>v4qiv4di2):
Fix a mode mismatch with operand 1.

3 years agoi386: Fix split_double_mode with paradoxical subreg [PR100626]
Uros Bizjak [Tue, 18 May 2021 13:45:54 +0000 (15:45 +0200)]
i386: Fix split_double_mode with paradoxical subreg [PR100626]

split_double_mode calls simplify_gen_subreg, which fails for the
high half of the paradoxical subreg.  Return temporary register
instead of NULL RTX in this case.

2021-05-18  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/100626
* config/i386/i386-expand.c (split_double_mode): Return
temporary register when simplify_gen_subreg fails with
the high half od the paradoxical subreg.

3 years agoAvoid setting TREE_ADDRESSABLE on stack vars during RTL expansion
Richard Biener [Mon, 17 May 2021 14:35:38 +0000 (16:35 +0200)]
Avoid setting TREE_ADDRESSABLE on stack vars during RTL expansion

This avoids setting TREE_ADDRESSABLE on variables we want to force to
the stack.  Instead track those in a temporary bitmap and force
stack expansion that way, leaving TREE_ADDRESSABLE alone, not
pessimizing future alias queries.

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

* cfgexpand.c (expand_one_var): Pass in forced_stack_var
and honor it when expanding.
(expand_used_vars_for_block): Pass through forced_stack_var.
(expand_used_vars): Likewise.
(discover_nonconstant_array_refs_r): Set bits in
forced_stack_vars instead of marking vars TREE_ADDRESSABLE.
(avoid_type_punning_on_regs): Likewise.
(discover_nonconstant_array_refs): Likewise.
(pass_expand::execute): Create and pass down forced_stack_var
bitmap.  For parameters and returns temporarily set
TREE_ADDRESSABLE when expand_function_start.

3 years ago[libgomp, testsuite] Don't shadow global 'offload_targets' variable
Thomas Schwinge [Mon, 27 Apr 2020 06:22:36 +0000 (08:22 +0200)]
[libgomp, testsuite] Don't shadow global 'offload_targets' variable

See local 'offload_targets' variable in
'libgomp/testsuite/lib/libgomp.exp:libgomp_check_effective_target_offload_target'
vs. global 'libgomp/testsuite/libgomp-test-support.exp.in:offload_targets'
variable.

libgomp/
* testsuite/lib/libgomp.exp
(check_effective_target_offload_target_nvptx): Don't shadow global
'offload_targets' variable.

3 years ago'libgomp.c-c++-common/reduction-{5,6}.c': Restrict '-latomic' to nvptx offloading...
Thomas Schwinge [Mon, 17 May 2021 06:05:40 +0000 (08:05 +0200)]
'libgomp.c-c++-common/reduction-{5,6}.c': Restrict '-latomic' to nvptx offloading compilation

Fix-up for recent commit 33b647956caa977d1ae489f9baed9cef70b4f382
"OpenMP: Fix SIMT for complex/float reduction with && and ||"; see
commit d42088e453042f4f8ba9190a7e29efd937ea2181 "Avoid -latomic for amdgcn
offloading".

libgomp/
* testsuite/libgomp.c-c++-common/reduction-5.c: Restrict
'-latomic' to nvptx offloading compilation.
* testsuite/libgomp.c-c++-common/reduction-6.c: Likewise.

3 years ago'libgomp.c/target-44.c': Restrict '-latomic' to nvptx offloading compilation
Thomas Schwinge [Mon, 17 May 2021 06:05:40 +0000 (08:05 +0200)]
'libgomp.c/target-44.c': Restrict '-latomic' to nvptx offloading compilation

Fix-up for recent commit f87990a2a8fc9e20d30462a0a4c9047582af0cd9
"[openmp, simt] Disable SIMT for user-defined reduction"; see commit
d42088e453042f4f8ba9190a7e29efd937ea2181 "Avoid -latomic for amdgcn
offloading".

libgomp/
* testsuite/libgomp.c/target-44.c: Restrict '-latomic' to nvptx
offloading compilation.

3 years agoAdd 'dg-note', 'dg-lto-note'
Thomas Schwinge [Thu, 6 May 2021 09:59:42 +0000 (11:59 +0200)]
Add 'dg-note', 'dg-lto-note'

That's 'dg-message "note: [...]"' with a twist: inhibit default notes pruning,
such that "if 'dg-note' is used at least once in a testcase, [notes] are not
pruned and instead must *all* be handled explicitly".

The rationale is that either you're not interested in notes at all (default
behavior of pruning all notes), but often, when you're interested in one note,
you're in fact interested in all notes, and especially interested if
*additional* notes appear over time, as GCC evolves.

gcc/testsuite/
* lib/gcc-dg.exp: Implement 'dg-note'.
* lib/prune.exp: Likewise.
* gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and
'dg-prune-output "note: ".
* gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use
'dg-note', match up additional notes, one class of them with
XFAILed 'dg-bogus'.
* lib/lto.exp: Implement 'dg-lto-note'.
* g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional
notes.
* g++.dg/lto/odr-1_1.C: Likewise.
* g++.dg/lto/odr-2_1.C: Likewise.
libstdc++-v3/
* testsuite/lib/prune.exp: Add note about 'dg-note'.
gcc/
* doc/sourcebuild.texi: Document 'dg-note'.

3 years agogcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598]
Tobias Burnus [Tue, 18 May 2021 09:56:05 +0000 (11:56 +0200)]
gcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598]

BUILD_CFLAGS is set by configure; by default, BUILD_CFLAGS = $(ALL_CFLAGS)
is used. The latter contains (see gcc/Makefile.in) $(CFLAGS-$@), which is used
to pass .o-file specific flags to the compiler.
For cross builds, BUILD_CFLAGS is constructed in configure{,.ac} and missed
the $(CFLAGS-$@) - despite the comment above ALL_CFLAGS that configure.ac
might have to kept in sync.

gcc/ChangeLog:

PR other/100598
* configure: Regenerate.
* configure.ac (BUILD_CFLAG, BUILD_CXXFLAGS): Add $(CFLAGS-$@).

3 years ago[OMP] Tighten 'is_gimple_omp_oacc'
Thomas Schwinge [Fri, 7 May 2021 08:13:49 +0000 (10:13 +0200)]
[OMP] Tighten 'is_gimple_omp_oacc'

No overall change in behavior.

gcc/
* gimple.h (is_gimple_omp_oacc): Tighten.
* omp-low.c (check_omp_nesting_restrictions): Adjust.

3 years agooperand scanner TLC
Richard Biener [Tue, 18 May 2021 09:33:29 +0000 (11:33 +0200)]
operand scanner TLC

This applies some TLC to mark_address_taken which ends up setting
TREE_ADDRESSABLE on nodes where it doesn't have any semantics.
It also does work (incomplete) that get_base_address already does,
likewise we'll never get WITH_SIZE_EXPR in this context and thus
get_base_address never fails.

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

* tree-ssa-operands.c (mark_address_taken): Simplify.

3 years agostartswith: Fix offloading targets.
Martin Liska [Tue, 18 May 2021 09:17:56 +0000 (11:17 +0200)]
startswith: Fix offloading targets.

gcc/ChangeLog:

* config/gcn/mkoffload.c (STR): Redefine.
* config/i386/intelmic-mkoffload.c (STR): Likewise.
* config/nvptx/mkoffload.c (STR): Likewise.

3 years agogcc-changelog: Remove use of non-strict mode
Jonathan Wakely [Tue, 18 May 2021 09:08:50 +0000 (10:08 +0100)]
gcc-changelog: Remove use of non-strict mode

contrib/ChangeLog:

* gcc-changelog/git_email.py: Remove use of non-strict mode.

3 years agoUse startswith in targets.
Martin Liska [Fri, 19 Mar 2021 09:21:35 +0000 (10:21 +0100)]
Use startswith in targets.

gcc/ChangeLog:

* common/config/aarch64/aarch64-common.c (aarch64_parse_extension):
Use startswith function instead of strncmp.
* common/config/bfin/bfin-common.c (bfin_handle_option): Likewise.
* common/config/riscv/riscv-common.c (riscv_subset_list::parse): Likewise.
* config/aarch64/aarch64-sve-builtins-shapes.cc (parse_type): Likewise.
* config/aarch64/aarch64.c (aarch64_process_one_target_attr): Likewise.
* config/alpha/alpha.c (alpha_elf_section_type_flags): Likewise.
* config/arm/aarch-common.c (arm_md_asm_adjust): Likewise.
* config/arm/arm.c (arm_file_start): Likewise.
(arm_valid_target_attribute_rec): Likewise.
(thumb1_md_asm_adjust): Likewise.
* config/arm/driver-arm.c (host_detect_local_cpu): Likewise.
* config/avr/avr.c (STR_PREFIX_P): Likewise.
(avr_set_current_function): Likewise.
(avr_handle_addr_attribute): Likewise.
(avr_asm_output_aligned_decl_common): Likewise.
(avr_asm_named_section): Likewise.
(avr_section_type_flags): Likewise.
(avr_asm_select_section): Likewise.
* config/c6x/c6x.c (c6x_in_small_data_p): Likewise.
(c6x_section_type_flags): Likewise.
* config/darwin-c.c (darwin_cfstring_ref_p): Likewise.
(darwin_objc_declare_unresolved_class_reference): Likewise.
(darwin_objc_declare_class_definition): Likewise.
* config/darwin.c (indirect_data): Likewise.
(darwin_encode_section_info): Likewise.
(darwin_objc2_section): Likewise.
(darwin_objc1_section): Likewise.
(machopic_select_section): Likewise.
(darwin_globalize_label): Likewise.
(darwin_label_is_anonymous_local_objc_name): Likewise.
(darwin_asm_named_section): Likewise.
(darwin_asm_output_dwarf_offset): Likewise.
* config/frv/frv.c (frv_string_begins_with): Likewise.
(frv_in_small_data_p): Likewise.
* config/gcn/mkoffload.c (STR): Likewise.
(main): Likewise.
* config/i386/i386-builtins.c (get_builtin_code_for_version): Likewise.
* config/i386/i386-options.c (ix86_option_override_internal): Likewise.
* config/i386/i386.c (x86_64_elf_section_type_flags): Likewise.
(ix86_md_asm_adjust): Likewise.
* config/i386/intelmic-mkoffload.c (STR): Likewise.
* config/i386/winnt.c (i386_pe_asm_named_section): Likewise.
(i386_pe_file_end): Likewise.
* config/ia64/ia64.c (ia64_in_small_data_p): Likewise.
(ia64_section_type_flags): Likewise.
* config/mips/driver-native.c (host_detect_local_cpu): Likewise.
* config/mips/mips.c (mips_handle_interrupt_attr): Likewise.
(mips16_stub_function_p): Likewise.
(mips_function_rodata_section): Likewise.
* config/msp430/msp430.c (msp430_mcu_name): Likewise.
(msp430_function_section): Likewise.
(msp430_section_type_flags): Likewise.
(msp430_expand_helper): Likewise.
* config/nios2/nios2.c (nios2_small_section_name_p): Likewise.
(nios2_valid_target_attribute_rec): Likewise.
* config/nvptx/mkoffload.c (process): Likewise.
(STR): Likewise.
* config/pa/som.h: Likewise.
* config/pdp11/pdp11.c (pdp11_output_ident): Likewise.
* config/riscv/riscv.c (riscv_elf_select_rtx_section): Likewise.
* config/rs6000/rs6000.c (VTABLE_NAME_P): Likewise.
(rs6000_inner_target_options): Likewise.
* config/s390/driver-native.c (s390_host_detect_local_cpu): Likewise.
* config/sparc/driver-sparc.c (host_detect_local_cpu): Likewise.
* config/vax/vax.c (vax_output_int_move): Likewise.
* config/vms/vms-ld.c (startswith): Likewise.
(process_args): Likewise.
(main): Likewise.
* config/vms/vms.c: Likewise.

3 years agoregcprop: Avoid DCE of asm goto [PR100590]
Jakub Jelinek [Tue, 18 May 2021 08:26:45 +0000 (10:26 +0200)]
regcprop: Avoid DCE of asm goto [PR100590]

The following testcase ICEs, because copyprop_hardreg_forward_1 decides
to DCE asm goto with REG_UNUSED notes (because the output is unused and
asm isn't volatile).  But that DCE just removes the asm goto, leaving
a bb with two successors and no insn at the end that would allow that.

The following patch makes sure we drop that way only INSNs and not
JUMP_INSNs or CALL_INSNs.

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

PR rtl-optimization/100590
* regcprop.c (copyprop_hardreg_forward_1): Only DCE dead sets if
they are NONJUMP_INSN_P.

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

3 years agofunction: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]
Jakub Jelinek [Tue, 18 May 2021 08:10:17 +0000 (10:10 +0200)]
function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]

Last year I've added cgraph_node::get_create calls for the dummy
functions used for -fdump-passes, so that it interacts well with pass
disabling/enabling which is cgraph uid based.
Unfortunately, as the following testcase shows, when assembler hash
is present, that wants to compute DECL_ASSEMBLER_NAME and the C++ FE
is unprepared to handle it on the dummy functions which don't have
DECL_NAME etc.
The following patch fixes it by setting up a dummy DECL_ASSEMBLER_NAME
on these, so that the FEs don't need to compute it.

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

PR c++/100580
* function.c (push_dummy_function): Set DECL_ARTIFICIAL and
DECL_ASSEMBLER_NAME on the fn_decl.

* g++.dg/other/pr100580.C: New test.

3 years agophiopt: Optimize partial_ordering spaceship >= 0 -ffinite-math-only [PR94589]
Jakub Jelinek [Tue, 18 May 2021 08:08:51 +0000 (10:08 +0200)]
phiopt: Optimize partial_ordering spaceship >= 0 -ffinite-math-only [PR94589]

As mentioned earlier, spaceship_replacement didn't optimize partial_ordering
>= 0 comparisons, because the possible values are -1, 0, 1, 2 and the
>= comparison is implemented as (res & 1) == res to choose the 0 and 1
cases from that.  As we optimize that only with -ffinite-math-only, the
2 case is assumed not to happen and my earlier match.pd change optimizes
(res & 1) == res into (res & ~1) == 0, so this patch pattern matches
that case and handles it like res >= 0.

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

PR tree-optimization/94589
* tree-ssa-phiopt.c (spaceship_replacement): Pattern match
phi result used in (res & ~1) == 0 comparison as res >= 0 as
res == 2 would be UB with -ffinite-math-only.

* g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12.

3 years agogenversion should depend on DATESTAMP
Martin Liska [Tue, 18 May 2021 07:37:29 +0000 (09:37 +0200)]
genversion should depend on DATESTAMP

gcc/ChangeLog:

* Makefile.in: genversion.o should depend on DATESTAMP.

3 years agoarc: Fix typo in negv2si2 pattern
Claudiu Zissulescu [Tue, 18 May 2021 07:54:38 +0000 (10:54 +0300)]
arc: Fix typo in negv2si2 pattern

gcc/
2021-05-18  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/simdext.md (negv2si2): Remove round bracket.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
3 years agoFix gcc.target/i386/pr100582.c with AVX512
Richard Biener [Tue, 18 May 2021 06:48:57 +0000 (08:48 +0200)]
Fix gcc.target/i386/pr100582.c with AVX512

Which generates vpblendmb.

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

gcc/testsuite/
* gcc.target/i386/pr100582.c: Adjust for AVX512.

3 years agoc/100522 - avoid invalid GIMPLE in GIMPLE parsing
Richard Biener [Tue, 18 May 2021 06:41:43 +0000 (08:41 +0200)]
c/100522 - avoid invalid GIMPLE in GIMPLE parsing

This plugs a few easy holes avoiding ICEs down the route.

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

PR c/100522
gcc/c/
* gimple-parser.c (c_parser_gimple_postfix_expression_after_primary):
Diagnose calls to non-functions.
(c_parser_gimple_statement): Diagnose unexpected assignment RHS.

gcc/testsuite/
* gcc.dg/gimplefe-error-10.c: New testcase.

3 years agoc/100547 - reject overly large vector_size attributes
Richard Biener [Wed, 12 May 2021 07:20:17 +0000 (09:20 +0200)]
c/100547 - reject overly large vector_size attributes

This rejects a number of vector components that does not fit an 'int'
which is an internal limitation of RTVEC.  This requires adjusting
gcc.dg/attr-vector_size.c which checks for much larger
supported vectors.  Note that the RTVEC limitation is a host specific
limitation (unless we change this 'int' to int32_t), but should be
32bits in practice everywhere.

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

PR c/100547
gcc/c-family/
* c-attribs.c (type_valid_for_vector_size): Reject too large nunits.
Reword existing nunit diagnostic.

gcc/testsuite/
* gcc.dg/pr100547.c: New testcase.
* gcc.dg/attr-vector_size.c: Adjust.

3 years agoIBM Z: Support vector _Bool language extension
Andreas Krebbel [Tue, 18 May 2021 06:51:08 +0000 (08:51 +0200)]
IBM Z: Support vector _Bool language extension

_Bool needs to be defined as macro in order to trigger the
context-sensitive macro expansion mechanism.

gcc/ChangeLog:

* config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define
_Bool as macro expanding to _Bool.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zvector/vec-_Bool.c: New test.

3 years agoPR100281 C++: Fix SImode pointer handling
Andreas Krebbel [Tue, 27 Apr 2021 08:09:06 +0000 (10:09 +0200)]
PR100281 C++: Fix SImode pointer handling

The problem appears to be triggered by two locations in the front-end
where non-POINTER_SIZE pointers aren't handled right now.

1. An assertion in strip_typedefs is triggered because the alignment
of the types don't match. This in turn is caused by creating the new
type with build_pointer_type instead of taking the type of the
original pointer into account.

2. An assertion in cp_convert_to_pointer is triggered which expects
the target type to always have POINTER_SIZE.

gcc/cp/ChangeLog:

PR c++/100281
* cvt.c (cp_convert_to_pointer): Use the size of the target
pointer type.
* tree.c (cp_build_reference_type): Call
cp_build_reference_type_for_mode with VOIDmode.
(cp_build_reference_type_for_mode): Rename from
cp_build_reference_type.  Add MODE argument and invoke
build_reference_type_for_mode.
(strip_typedefs): Use build_pointer_type_for_mode and
cp_build_reference_type_for_mode for pointers and references.

gcc/ChangeLog:

PR c++/100281
* tree.c (build_reference_type_for_mode)
(build_pointer_type_for_mode): Pick pointer mode if MODE argument
is VOIDmode.
(build_reference_type, build_pointer_type): Invoke
build_*_type_for_mode with VOIDmode.

gcc/testsuite/ChangeLog:

PR c++/100281
* g++.target/s390/pr100281-1.C: New test.
* g++.target/s390/pr100281-2.C: New test.

3 years agolibstdc++: Fix up semiregular-box partial specialization [PR100475]
Patrick Palka [Tue, 18 May 2021 04:28:44 +0000 (00:28 -0400)]
libstdc++: Fix up semiregular-box partial specialization [PR100475]

This makes the in-place constructor of our partial specialization of
__box for already-semiregular types perform direct-non-list-initialization
(in accordance with the specification of the primary template), and
additionally makes the member function data() use std::__addressof.

libstdc++-v3/ChangeLog:

PR libstdc++/100475
* include/std/ranges (__box::__box): Use non-list-initialization
in member initializer list of in-place constructor of the
partial specialization for semiregular types.
(__box::operator->): Use std::__addressof.
* testsuite/std/ranges/adaptors/detail/semiregular_box.cc
(test02): New test.
* testsuite/std/ranges/single_view.cc (test04): New test.

3 years agolibstdc++: Fix condition for memoizing reverse_view::begin() [PR100621]
Patrick Palka [Tue, 18 May 2021 04:26:25 +0000 (00:26 -0400)]
libstdc++: Fix condition for memoizing reverse_view::begin() [PR100621]

A range being a random access range isn't a sufficient condition for
ranges::next(iter, sent) to have constant time complexity -- it must
also have a sized sentinel.  This adjusts the memoization condition for
reverse_view accordingly.

libstdc++-v3/ChangeLog:

PR libstdc++/100621
* include/std/ranges (reverse_view::_S_needs_cached_begin):
Set to true if the underlying non-common random-access range
doesn't have a sized sentinel.

3 years agolibstdc++: Fix miscellaneous issues with elements_view::_Sentinel [PR100631]
Patrick Palka [Tue, 18 May 2021 04:26:07 +0000 (00:26 -0400)]
libstdc++: Fix miscellaneous issues with elements_view::_Sentinel [PR100631]

libstdc++-v3/ChangeLog:

PR libstdc++/100631
* include/std/ranges (elements_view::_Iterator): Also befriend
_Sentinel<!_Const>.
(elements_view::_Sentinel::_M_equal): Templatize.
(elements_view::_Sentinel::_M_distance_from): Split out from ...
(elements_view::_Sentinel::operator-): ... here.  Depend on
_Base2 instead of _Base in the return type.
* testsuite/std/ranges/adaptors/elements.cc (test06, test07):
New tests.

3 years agoDaily bump.
GCC Administrator [Tue, 18 May 2021 00:16:40 +0000 (00:16 +0000)]
Daily bump.

3 years agoOnce a range becomes constant, make it invariant.
Andrew MacLeod [Mon, 17 May 2021 19:53:39 +0000 (15:53 -0400)]
Once a range becomes constant, make it invariant.

Once a range is forced to a constant globally, simply make it invariant.
Unify this with the code which makes non-zero pointer ranges invariant.

gcc/
PR tree-optimization/100512
* gimple-range-cache.cc (ranger_cache::set_global_range): Mark const
and non-zero pointer ranges as invariant.
* gimple-range.cc (gimple_ranger::range_of_stmt): Remove pointer
processing from here.

gcc/testsuite/
PR tree-optimization/100512
* gcc.dg/pr100512.c: New.

3 years agoMAINTAINERS: Add myself for write after approval
Serge Belyshev [Mon, 17 May 2021 20:54:34 +0000 (23:54 +0300)]
MAINTAINERS: Add myself for write after approval

ChangeLog:

2021-05-17  Serge Belyshev  <belyshev@depni.sinp.msu.ru>

* MAINTAINERS (Write After Approval): Add myself.

3 years agoopenmp: Notify team barrier of pending tasks in omp_fulfill_event
Kwok Cheung Yeung [Fri, 14 May 2021 16:59:11 +0000 (09:59 -0700)]
openmp: Notify team barrier of pending tasks in omp_fulfill_event

The team barrier should be notified of any new tasks that become runnable
as the result of a completing task, otherwise the barrier threads might
not resume processing available tasks, resulting in a hang.

2021-05-17  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgomp/
* task.c (omp_fulfill_event): Call gomp_team_barrier_set_task_pending
if new tasks generated.
* testsuite/libgomp.c-c++-common/task-detach-13.c: New.

3 years agoc++: Fix diagnostic for binding lvalue reference to volatile rvalue [PR 100635]
Jonathan Wakely [Mon, 17 May 2021 09:53:56 +0000 (10:53 +0100)]
c++: Fix diagnostic for binding lvalue reference to volatile rvalue [PR 100635]

The current diagnostic assumes the reference binding fails because the
reference is non-const, but it can also fail if the rvalue is volatile.

Use the current diagnostic for non-const cases, and a modified
diagnostic otherwise.

gcc/cp/ChangeLog:

PR c++/100635
* call.c (convert_like_internal): Print different diagnostic if
the lvalue reference is const.

gcc/testsuite/ChangeLog:

* g++.dg/conversion/pr100635.C: New test.

3 years agoPR fortran/98411 - Pointless warning for static variables
Harald Anlauf [Mon, 17 May 2021 19:35:38 +0000 (21:35 +0200)]
PR fortran/98411 - Pointless warning for static variables

Variables with explicit SAVE attribute cannot end up on the stack.
There is no point in checking whether they should be moved off the
stack to static storage.

gcc/fortran/ChangeLog:

PR fortran/98411
* trans-decl.c (gfc_finish_var_decl): Add check for explicit SAVE
attribute.

gcc/testsuite/ChangeLog:

PR fortran/98411
* gfortran.dg/pr98411.f90: New test.

3 years agolibstdc++: Fix wrong thread waking on notify [PR100334]
Thomas Rodgers [Mon, 17 May 2021 18:41:26 +0000 (11:41 -0700)]
libstdc++: Fix wrong thread waking on notify [PR100334]

Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100334

libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop
until value change observed.
(__waiter_base::_M_laundered): New member.
(__waiter_base::_M_notify): Check _M_laundered to determine
whether to wake one or all.
(__detail::__atomic_compare): Return true if call to
__builtin_memcmp() == 0.
(__waiter_base::_S_do_spin_v): Adjust predicate.
* testsuite/29_atomics/atomic/wait_notify/100334.cc: New
test.

3 years ago[nvptx] Handle memmodel for atomic ops
Tom de Vries [Mon, 17 May 2021 08:11:52 +0000 (10:11 +0200)]
[nvptx] Handle memmodel for atomic ops

The atomic ops in nvptx.md have memmodel arguments, which are currently
ignored.

Handle these, fixing test-case fails libgomp.c-c++-common/reduction-{5,6}.c
on volta.

Tested libgomp on x86_64-linux with nvptx accelerator.

gcc/ChangeLog:

2021-05-17  Tom de Vries  <tdevries@suse.de>

PR target/100497
* config/nvptx/nvptx-protos.h (nvptx_output_atomic_insn): Declare
* config/nvptx/nvptx.c (nvptx_output_barrier)
(nvptx_output_atomic_insn): New function.
(nvptx_print_operand): Add support for 'B'.
* config/nvptx/nvptx.md: Use nvptx_output_atomic_insn for atomic
insns.

3 years agolibstdc++: Fix filesystem::path constraints for volatile [PR 100630]
Jonathan Wakely [Mon, 17 May 2021 10:54:06 +0000 (11:54 +0100)]
libstdc++: Fix filesystem::path constraints for volatile [PR 100630]

The constraint check for filesystem::path construction uses
decltype(__is_path_src(declval<Source>())) which mean it considers
conversion from an rvalue.  When Source is a volatile-qualified type
it cannot use is_path_src(const Unknown&) because a const lvalue
reference can only bind to a non-volatile rvalue.

Since the relevant path members all have a const Source& parameter,
the constraint should be defined in terms of declval<const Source&>(),
not declval<Source>(). This avoids the problem of volatile-qualified
rvalues, because we no longer use an rvalue at all.

libstdc++-v3/ChangeLog:

PR libstdc++/100630
* include/experimental/bits/fs_path.h (__is_constructible_from):
Test construction from a const lvalue, not an rvalue.
* testsuite/27_io/filesystem/path/construct/100630.cc: New test.
* testsuite/experimental/filesystem/path/construct/100630.cc:
New test.

3 years agolibstdc++: diagnose some misuses of [locale.convenience] functions [PR 89728]
Antony Polukhin [Mon, 17 May 2021 13:58:28 +0000 (14:58 +0100)]
libstdc++: diagnose some misuses of [locale.convenience] functions [PR 89728]

This patch provides better diagnostics for common misuse of
[locale.convenience] functions with std::string as a character type.

libstdc++-v3/ChangeLog:

PR libstdc++/89728
* include/bits/locale_facets.h (ctype<basic_string<C,T,A>>):
Declare (but do not define) partial specialization.
* testsuite/22_locale/ctype/is/string/89728_neg.cc: New test.

3 years agolibstdc++: Fix std::jthread assertion and re-enable skipped test
Jonathan Wakely [Mon, 17 May 2021 13:55:22 +0000 (14:55 +0100)]
libstdc++: Fix std::jthread assertion and re-enable skipped test

libstdc++-v3/ChangeLog:

* include/std/thread (jthread::_S_create): Fix static assert
message.
* testsuite/30_threads/jthread/95989.cc: Re-enable test.
* testsuite/30_threads/jthread/jthread.cc: Do not require
pthread effective target.
* testsuite/30_threads/jthread/2.cc: Moved to...
* testsuite/30_threads/jthread/version.cc: ...here.

3 years agoBail in bounds_of_var_in_loop if scev returns NULL.
Aldy Hernandez [Thu, 13 May 2021 20:09:58 +0000 (16:09 -0400)]
Bail in bounds_of_var_in_loop if scev returns NULL.

Both initial_condition_in_loop_num and evolution_part_in_loop_num
can return NULL.  This patch exits if either one is NULL.  Presumably
this didn't happen before, because adjust_range_with_scev was called
far less frequently than in ranger, which can call it for every PHI.

gcc/ChangeLog:

PR tree-optimization/100349
* vr-values.c (bounds_of_var_in_loop): Bail if scev returns
  NULL.

gcc/testsuite/ChangeLog:

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

3 years agoAArch64: Have -mcpu=native and -march=native enable extensions when CPU is unknown
Tamar Christina [Mon, 17 May 2021 14:22:39 +0000 (15:22 +0100)]
AArch64: Have -mcpu=native and -march=native enable extensions when CPU is unknown

Currently when using -mcpu=native or -march=native on a CPU that is unknown to
the compiler the compiler currently just used -march=armv8-a and enables none
of the extensions.

To make this a bit more useful this patch changes it to still use -march=armv8.a
but to enable the extensions.  We still cannot do tuning but at least if using
this on a future SVE core the compiler will at the very least enable SVE etc.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (DEFAULT_ARCH): New.
(host_detect_local_cpu): Use it.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/info_16: New test.
* gcc.target/aarch64/cpunative/info_17: New test.
* gcc.target/aarch64/cpunative/native_cpu_16.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_17.c: New test.

3 years agoDocs: add 2 missing dots.
Martin Liska [Mon, 17 May 2021 14:24:11 +0000 (16:24 +0200)]
Docs: add 2 missing dots.

gcc/ChangeLog:

* doc/invoke.texi: Add 2 missing dots.

3 years agoc/100625 - avoid building invalid labels in the GIMPLE FE
Richard Biener [Mon, 17 May 2021 12:47:08 +0000 (14:47 +0200)]
c/100625 - avoid building invalid labels in the GIMPLE FE

When duplicate labes are diagnosed, avoid building a GIMPLE_LABEL.

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

PR c/100625
gcc/c/
* gimple-parser.c (c_parser_gimple_label): Avoid building
a GIMPLE label with NULL label decl.

gcc/testsuite/
* gcc.dg/gimplefe-error-9.c: New testcase.

3 years agoIBM Z: Avoid bash-specific substitution in configure
Marius Hillenbrand [Wed, 12 May 2021 11:59:19 +0000 (13:59 +0200)]
IBM Z: Avoid bash-specific substitution in configure

Fix a bootstrap error observed on NetBSD.

2021-05-17  Marius Hillenbrand  <mhillen@linux.ibm.com>

gcc/ChangeLog:

PR bootstrap/100552
* configure.ac: Replace pattern substitution with call to sed.
* configure: Regenerate.

3 years agomiddle-end/100582 - fix array_at_struct_end_p for vector indexing
Richard Biener [Mon, 17 May 2021 11:56:14 +0000 (13:56 +0200)]
middle-end/100582 - fix array_at_struct_end_p for vector indexing

Vector indexing leaves us with ARRAY_REFs of VIEW_CONVERT_EXPRs,
sth which array_at_struct_end_p considers a array-at-struct-end
even when there's an underlying decl visible.  The following fixes
the latter.

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

PR middle-end/100582
* tree.c (array_at_struct_end_p): Get to the base of the
reference before looking for the underlying decl.

* gcc.target/i386/pr100582.c: New testcase.

3 years agoImprove message for wrong number of alternatives.
Joern Rennecke [Mon, 17 May 2021 12:44:49 +0000 (13:44 +0100)]
Improve message for wrong number of alternatives.

gcc/
* genoutput.c (validate_insn_alternatives) Make "wrong number of
alternatives" message more specific, and remove assumption on where
the problem is.

3 years agoarm: Auto-vectorization for MVE: add __fp16 support to VCMP
Christophe Lyon [Mon, 17 May 2021 12:31:58 +0000 (12:31 +0000)]
arm: Auto-vectorization for MVE: add __fp16 support to VCMP

This patch adds __fp16 support to the previous patch that added vcmp
support with MVE. For this we update existing expanders to use VDQWH
iterator, and add a new expander vcond<VH_cvtto><mode>.  In the
process we need to create suitable iterators, and update v_cmp_result
as needed.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/iterators.md (V16): New iterator.
(VH_cvtto): New iterator.
(v_cmp_result): Added V4HF and V8HF support.
* config/arm/vec-common.md (vec_cmp<mode><v_cmp_result>): Use VDQWH.
(vcond<mode><mode>): Likewise.
(vcond_mask_<mode><v_cmp_result>): Likewise.
(vcond<VH_cvtto><mode>): New expander.

gcc/testsuite/
* gcc.target/arm/simd/mve-compare-3.c: New test with GCC vectors.
* gcc.target/arm/simd/mve-vcmp-f16.c: New test for
auto-vectorization.
* gcc.target/arm/armv8_2-fp16-arith-1.c: Adjust since we now
vectorize float16_t vectors.

3 years agoarm: Auto-vectorization for MVE: vcmp
Christophe Lyon [Mon, 17 May 2021 12:29:42 +0000 (12:29 +0000)]
arm: Auto-vectorization for MVE: vcmp

Since MVE has a different set of vector comparison operators from
Neon, we have to update the expansion to take into account the new
ones, for instance 'NE' for which MVE does not require to use 'EQ'
with the inverted condition.

Conversely, Neon supports comparisons with #0, MVE does not.

For:
typedef long int vs32 __attribute__((vector_size(16)));
vs32 cmp_eq_vs32_reg (vs32 a, vs32 b) { return a == b; }

we now generate:
cmp_eq_vs32_reg:
vldr.64 d4, .L123       @ 8     [c=8 l=4]  *mve_movv4si/8
vldr.64 d5, .L123+8
vldr.64 d6, .L123+16    @ 9     [c=8 l=4]  *mve_movv4si/8
vldr.64 d7, .L123+24
vcmp.i32  eq, q0, q1    @ 7     [c=16 l=4]  mve_vcmpeqq_v4si
vpsel q0, q3, q2        @ 15    [c=8 l=4]  mve_vpselq_sv4si
bx      lr      @ 26    [c=8 l=4]  *thumb2_return
.L124:
.align  3
.L123:
.word   0
.word   0
.word   0
.word   0
.word   1
.word   1
.word   1
.word   1

For some reason emit_move_insn (zero, CONST0_RTX (cmp_mode)) produces
a pair of vldr instead of vmov.i32, qX, #0

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/arm-protos.h (arm_expand_vector_compare): Update
prototype.
* config/arm/arm.c (arm_expand_vector_compare): Add support for
MVE.
(arm_expand_vcond): Likewise.
* config/arm/iterators.md (supf): Remove VCMPNEQ_S, VCMPEQQ_S,
VCMPEQQ_N_S, VCMPNEQ_N_S.
(VCMPNEQ, VCMPEQQ, VCMPEQQ_N, VCMPNEQ_N): Remove.
* config/arm/mve.md (@mve_vcmp<mve_cmp_op>q_<mode>): Add '@' prefix.
(@mve_vcmp<mve_cmp_op>q_f<mode>): Likewise.
(@mve_vcmp<mve_cmp_op>q_n_f<mode>): Likewise.
(@mve_vpselq_<supf><mode>): Likewise.
(@mve_vpselq_f<mode>"): Likewise.
* config/arm/neon.md (vec_cmp<mode><v_cmp_result): Enable for MVE
and move to vec-common.md.
(vec_cmpu<mode><mode>): Likewise.
(vcond<mode><mode>): Likewise.
(vcond<V_cvtto><mode>): Likewise.
(vcondu<mode><v_cmp_result>): Likewise.
(vcond_mask_<mode><v_cmp_result>): Likewise.
* config/arm/unspecs.md (VCMPNEQ_U, VCMPNEQ_S, VCMPEQQ_S)
(VCMPEQQ_N_S, VCMPNEQ_N_S, VCMPEQQ_U, CMPEQQ_N_U, VCMPNEQ_N_U)
(VCMPGEQ_N_S, VCMPGEQ_S, VCMPGTQ_N_S, VCMPGTQ_S, VCMPLEQ_N_S)
(VCMPLEQ_S, VCMPLTQ_N_S, VCMPLTQ_S, VCMPCSQ_N_U, VCMPCSQ_U)
(VCMPHIQ_N_U, VCMPHIQ_U): Remove.
* config/arm/vec-common.md (vec_cmp<mode><v_cmp_result): Moved
from neon.md.
(vec_cmpu<mode><mode>): Likewise.
(vcond<mode><mode>): Likewise.
(vcond<V_cvtto><mode>): Likewise.
(vcondu<mode><v_cmp_result>): Likewise.
(vcond_mask_<mode><v_cmp_result>): Likewise. Added unsafe math
condition.

gcc/testsuite
* gcc.target/arm/simd/mve-compare-1.c: New test with GCC vectors.
* gcc.target/arm/simd/mve-compare-2.c: New test with GCC vectors.
* gcc.target/arm/simd/mve-compare-scalar-1.c: New test with GCC
vectors.
* gcc.target/arm/simd/mve-vcmp-f32.c: New test for
auto-vectorization.
* gcc.target/arm/simd/mve-vcmp.c: New test for auto-vectorization.

3 years agoFix ICE [PR target/100549]
liuhongt [Thu, 13 May 2021 05:08:16 +0000 (13:08 +0800)]
Fix ICE [PR target/100549]

When arg0 is same as arg1 in __builtin_ia32_pcmpgtw,
gimple_build (&stmts, GT_EXPR, cmp_type, arg0, arg1) will simplify the
comparison to vector constant 0, no stmts is generated, which causes
ICE in gsi_insert_before (gsi, stmts, GSI_SAME_STMT). So use
gsi_insert_seq_before instead which will handle NULL seq.

gcc/ChangeLog:

PR target/100549
* config/i386/i386.c (ix86_gimple_fold_builtin): Use
gsi_insert_seq_before instead.

gcc/testsuite/ChangeLog:

PR target/100549
* gcc.target/i386/pr100549.c: New test.

3 years agotestsuite/arm: Add mve-vadd-scalar-1.c test
Christophe Lyon [Mon, 17 May 2021 12:02:40 +0000 (12:02 +0000)]
testsuite/arm: Add mve-vadd-scalar-1.c test

This patch adds a test for the scalar mode of vadd, precisely noting
that we do not yet use the T2 variants of vadd, which take a scalar as
final argument.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/simd/mve-vadd-scalar-1.c: New.

3 years agotestsuite/arm: Add mve-vadd-1.c test
Christophe Lyon [Mon, 17 May 2021 12:00:07 +0000 (12:00 +0000)]
testsuite/arm: Add mve-vadd-1.c test

Support for vadd has been present for a while, but it was lacking a
test.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/simd/mve-vadd-1.c: New.

3 years agotestsuite/arm: Factorize and increase coverage in mve-sub_1.c
Christophe Lyon [Mon, 17 May 2021 11:59:01 +0000 (11:59 +0000)]
testsuite/arm: Factorize and increase coverage in mve-sub_1.c

Use a template macro to factorize the existing test functions.

This patch also adds a version to check subtraction with __fp16 type.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/simd/mve-vsub_1.c: Factorize and add __fp16 test.

3 years agotestsuite/arm: Improve mve-vshr.c
Christophe Lyon [Mon, 17 May 2021 11:57:30 +0000 (11:57 +0000)]
testsuite/arm: Improve mve-vshr.c

Vector right shifts by immediate use vshr, while right shifts by
vectors instead use vneg and vshl.

This patch adds the corresponding scan-assembler-times that were
missing.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/simd/mve-vshr.c: Add more scan-assembler-times.

3 years agotestsuite/arm: Fix and rename arm_qbit_ok into arm_sat_ok effective-target
Christophe Lyon [Mon, 17 May 2021 11:53:14 +0000 (11:53 +0000)]
testsuite/arm: Fix and rename arm_qbit_ok into arm_sat_ok effective-target

The acle/saturation.c test uses __[su]sat() and
__saturation_occurred() intrinsics but __[su]sat() are defined in
acle.h if __ARM_FEATURE_SAT true, while __saturation_occurred()
depends on __ARM_FEATURE_QBIT.

QBIT is a v5te feature, while SAT is available since v6, so the test
really needs __ARM_FEATURE_SAT, to have both available.

This patch renames arm_qbit_ok into arm_sat_ok and checks
__ARM_FEATURE_SAT. It updates acle/saturation.c accordingly.

This enables the test to pass on arm-eabi with default cpu/fpu/mode,
where arm_qbit previously used -march=armv5te instead of armv6 now.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* doc/sourcebuild.texi (arm_qbit_ok): Rename into...
(arm_sat_ok): ...this.

gcc/testsuite/
* gcc.target/arm/acle/saturation.c: Use arm_sat_ok effective
target.
* lib/target-supports.exp
(check_effective_target_arm_qbit_ok_nocache): Rename into...
(check_effective_target_arm_sat_ok_nocache): ... this. Check
__ARM_FEATURE_SAT and use armv6.

3 years agoOpenMP/Fortran: Reject nonintrinsic assignments in OMP WORKSHARE [PR100633]
Tobias Burnus [Mon, 17 May 2021 11:20:27 +0000 (13:20 +0200)]
OpenMP/Fortran: Reject nonintrinsic assignments in OMP WORKSHARE [PR100633]

PR fortran/100633

gcc/fortran/ChangeLog:

* resolve.c (gfc_resolve_code): Reject nonintrinsic assignments in
OMP WORKSHARE.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/workshare-59.f90: New test.

3 years agolibstdc++: Allow lualatex to be used for Doxygen PDF
Jonathan Wakely [Fri, 14 May 2021 13:19:50 +0000 (14:19 +0100)]
libstdc++: Allow lualatex to be used for Doxygen PDF

This allows the Doxygen PDF to be built using lualatex instead of
pdflatex, which solves a problem with pdflatex running out of memory
sometimes. This is done by adding a --latex_cmd option to the
run_doxygen script, which then sets the specified command in the
generated user.cfg file used by Doxygen. The makefile is adjusted to
pass --latex_cmd=$(LATEX_CMD) to the script, so using running make with
LATEX_CMD=lualatex will override the default.

Additionally, this does some refactoring of the doc/Makefile.am rules
and the run_doxygen script.

libstdc++-v3/ChangeLog:

* doc/Makefile.am: Simplify doxygen recipes and use --latex_cmd.
* doc/Makefile.in: Regenerate.
* doc/doxygen/user.cfg.in (LATEX_CMD_NAME): Add placeholder
value.
* scripts/run_doxygen (print_usage): Always print to stdout and
do not exit.
(fail): New function for exiting on error.
(parse_options): Handle --latex_cmd. Do not treat --help the
same as errors. Simplify handling of required arguments.

3 years agoAvoid outputting corrupt string constructor when host/target chars mismatch.
Joern Rennecke [Mon, 17 May 2021 09:57:23 +0000 (10:57 +0100)]
Avoid outputting corrupt string constructor when host/target chars mismatch.

* c-common.c (braced_list_to_string): Return CTOR unchanged
if host and target character sizes don't match.

3 years agoLTO: merge -flto=foo both from IL and linker cmdline
Martin Liska [Thu, 13 May 2021 11:41:17 +0000 (13:41 +0200)]
LTO: merge -flto=foo both from IL and linker cmdline

gcc/ChangeLog:

* lto-wrapper.c (merge_flto_options): Factor out a new function.
(merge_and_complain): Use it.
(run_gcc): Merge also linker command line -flto=foo argument
with IL files.

3 years agotestsuite: Require openmp effective-target for PR100515
Christophe Lyon [Mon, 17 May 2021 09:25:43 +0000 (09:25 +0000)]
testsuite: Require openmp effective-target for PR100515

The related test uses -fopenmp, which is not supported by newlib-based
targets such as arm-eabi or aarch64-elf.

Requiring the openmp effective-target makes the test unsupported
rather than failed.

2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>

PR debug/100515
gcc/testsuite
* gcc.dg/debug/dwarf2/pr100515.c: Require openmp effective-target.

3 years agoUpdate mpfr version to 3.1.6
Richard Biener [Mon, 17 May 2021 06:51:03 +0000 (08:51 +0200)]
Update mpfr version to 3.1.6

This updates the mpfr version to 3.1.6 which is the last bugfix
release from the 3.1.x series and avoids printing the version
is buggy but acceptable from our configury.

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

contrib/ChangeLog:
* download_prerequisites: Update mpfr version to 3.1.6.
* prerequisites.md5: Update.
* prerequisites.sha512: Likewise.

3 years agoRevert "download_prerequisites: update MPFR version to recommended"
Richard Biener [Mon, 17 May 2021 06:45:10 +0000 (08:45 +0200)]
Revert "download_prerequisites: update MPFR version to recommended"

This reverts commit fe108dad32f521c4f924a397f11c63f86519e183.

3 years agoDaily bump.
GCC Administrator [Mon, 17 May 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.

3 years agotestsuite: Silence psabi warning
David Edelsohn [Sat, 15 May 2021 19:24:56 +0000 (15:24 -0400)]
testsuite: Silence psabi warning

* g++.dg/ext/attrib63.C: Add -Wno-psabi option.

3 years agotestsuite: Require fsanitize support on the target.
David Edelsohn [Fri, 14 May 2021 16:45:59 +0000 (12:45 -0400)]
testsuite: Require fsanitize support on the target.

* g++.dg/warn/uninit-pr93100.C: Require fsantize support.

3 years agoarm: remove error in CPP_SPEC when -mlittle-endian and -mbig-endian are used together
Christophe Lyon [Sun, 16 May 2021 13:48:21 +0000 (13:48 +0000)]
arm: remove error in CPP_SPEC when -mlittle-endian and -mbig-endian are used together

arm.h has had this error message since 1997, but it is no longer
needed since option parsing has been improved: -mXXX-endian is handled
via arm.opt and updates the BIG_END mask. So, the last
instance of -mXXX-endian on the command line wins.

Tested on many arm* configurations, with no impact on the testsuite results.

2021-05-16  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/arm.h (CPP_SPEC): Remove error message about
-mlittle-endian/-mbig-endian conflict.

3 years agotestsuite/arm: Improve unsigned-float.c
Christophe Lyon [Sun, 16 May 2021 13:46:06 +0000 (13:46 +0000)]
testsuite/arm: Improve unsigned-float.c

The test requires an FPU, so use -march=armv7-a+fp -mfpu=auto instead
of -march=armv7-a.

We also remove dg-require-effective-target arm_fp_ok, but keep
dg-add-options arm_fp: this enables the test to pass on arm-eabi
configured with default cpu/fpu/mode.

dg-require-effective-target arm_fp_ok fails on such a configuration
for lack of FPU, since dg-options are not taken into account by
dg-require-effective-target.

Add -march=armv7-a+fp -mfpu=auto is sufficient for arm_fp options to
be acceptable.

This enables the test to pass on all the arm-eabi configurations I'm
testing, as well as arm-linux-gnueabi when forcing -march=armv5t.

2021-05-16  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/unsigned-float.c: Remove arm_fp_ok, adjust
dg-options.

3 years agoDaily bump.
GCC Administrator [Sun, 16 May 2021 00:16:37 +0000 (00:16 +0000)]
Daily bump.

3 years agors6000: Add ROP tests
Bill Schmidt [Thu, 13 May 2021 18:33:35 +0000 (13:33 -0500)]
rs6000: Add ROP tests

2021-05-13  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/testsuite/
* gcc.target/powerpc/rop-1.c: New.
* gcc.target/powerpc/rop-2.c: New.
* gcc.target/powerpc/rop-3.c: New.
* gcc.target/powerpc/rop-4.c: New.
* gcc.target/powerpc/rop-5.c: New.

3 years agors6000: Conditionally define __ROP_PROTECT__
Bill Schmidt [Thu, 13 May 2021 18:10:10 +0000 (13:10 -0500)]
rs6000: Conditionally define __ROP_PROTECT__

2021-05-13  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
__ROP_PROTECT__ if -mrop-protect is selected.

3 years agors6000: Emit ROP-mitigation instructions in prologue and epilogue
Bill Schmidt [Fri, 14 May 2021 19:25:25 +0000 (14:25 -0500)]
rs6000: Emit ROP-mitigation instructions in prologue and epilogue

2021-05-14  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-internal.h (rs6000_stack): Add
rop_hash_save_offset and rop_hash_size.
* config/rs6000/rs6000-logue.c (rs6000_stack_info): Compute
rop_hash_size and rop_hash_save_offset.
(debug_stack_info): Dump rop_hash_save_offset and rop_hash_size.
(rs6000_emit_prologue): Emit hashst[p] in prologue.
(rs6000_emit_epilogue): Emit hashchk[p] in epilogue.
* config/rs6000/rs6000.md (unspec): Add UNSPEC_HASHST and
UNSPEC_HASHCHK.
(hashst): New define_insn.
(hashchk): Likewise.

3 years agors6000: Add -mrop-protect and -mprivileged flags
Bill Schmidt [Fri, 14 May 2021 19:15:55 +0000 (14:15 -0500)]
rs6000: Add -mrop-protect and -mprivileged flags

2021-05-14  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Disable shrink wrap when inserting ROP-protect instructions.
* config/rs6000/rs6000.opt (mrop-protect): New option.
(mprivileged): Likewise.
* doc/invoke.texi: Document mrop-protect and mprivileged.

3 years agoreorg.c (fill_slots_from_thread): Reinstate code typoed out in "Remove CC0".
Hans-Peter Nilsson [Fri, 14 May 2021 23:26:17 +0000 (01:26 +0200)]
reorg.c (fill_slots_from_thread): Reinstate code typoed out in "Remove CC0".

The typo here, is obviously mistaken removal of lines next
to a line that was validly removed.  Targets affected are
those with a delay-slot *and* defining TARGET_FLAGS_REGNUM.
In-tree, a git-grep says the only ones matching are CRIS,
h8300 and visium.  The code removal has the effect of
wrong-code, not reverting the effect of r11-2814.

I'm "guessing" it was the effect of an incorrect conflict
resolution in preparatory work for the r12-440 /
bd1cd0d0e0fe / "Remove CC0" commit, when rebasing a related
branch, and not testing any of the affected targets.  Either
way, the effect was a btest-gcc.sh state of "regress-1152"
for cris-elf.  FWIW, I wrote the removed code (sans the
validly removed cc0 line), a part of what was committed at
2020-08-24 as 0e6c51de8ec47 / r11-2814.

This commit gets cris-elf test-results back to a sane state
(tested at 0ffdbc85d9a6 / r12-761).

gcc:
* reorg.c (fill_slots_from_thread): Reinstate code typoed out in
"Remove CC0".

3 years agoRevert "tree-sra: Avoid refreshing into const base decls (PR 100453)"
Martin Jambor [Sat, 15 May 2021 08:11:12 +0000 (10:11 +0200)]
Revert "tree-sra: Avoid refreshing into const base decls (PR 100453)"

This reverts commit ca9bb74a5f856ccdceb4797f18b0a4ac8f49d069.
...because of Ada issues I did not catch with original testing.

gcc/ChangeLog:

2021-05-12  Martin Jambor  <mjambor@suse.cz>

Revert:
        PR tree-optimization/100453
* tree-sra.c (sra_modify_assign): All const base accesses do not
need refreshing, not just those from decl_pool.
(sra_modify_assign): Do not refresh into a const base decl.

gcc/testsuite/ChangeLog:

2021-05-12  Martin Jambor  <mjambor@suse.cz>

Revert:
        PR tree-optimization/100453
* gcc.dg/tree-ssa/pr100453.c: New test.

3 years agoregcprop: Fix another cprop_hardreg bug [PR100342]
Jakub Jelinek [Sat, 15 May 2021 08:12:11 +0000 (10:12 +0200)]
regcprop: Fix another cprop_hardreg bug [PR100342]

On Tue, Jan 19, 2021 at 04:10:33PM +0000, Richard Sandiford via Gcc-patches wrote:
> Ah, ok, thanks for the extra context.
>
> So AIUI the problem when recording xmm2<-di isn't just:
>
>  [A] partial_subreg_p (vd->e[sr].mode, GET_MODE (src))
>
> but also that:
>
>  [B] partial_subreg_p (vd->e[sr].mode, vd->e[vd->e[sr].oldest_regno].mode)
>
> For example, all registers in this sequence can be part of the same chain:
>
>     (set (reg:HI R1) (reg:HI R0))
>     (set (reg:SI R2) (reg:SI R1)) // [A]
>     (set (reg:DI R3) (reg:DI R2)) // [A]
>     (set (reg:SI R4) (reg:SI R[0-3]))
>     (set (reg:HI R5) (reg:HI R[0-4]))
>
> But:
>
>     (set (reg:SI R1) (reg:SI R0))
>     (set (reg:HI R2) (reg:HI R1))
>     (set (reg:SI R3) (reg:SI R2)) // [A] && [B]
>
> is problematic because it dips below the precision of the oldest regno
> and then increases again.
>
> When this happens, I guess we have two choices:
>
> (1) what the patch does: treat R3 as the start of a new chain.
> (2) pretend that the copy occured in vd->e[sr].mode instead
>     (i.e. copy vd->e[sr].mode to vd->e[dr].mode)
>
> I guess (2) would need to be subject to REG_CAN_CHANGE_MODE_P.
> Maybe the optimisation provided by (2) compared to (1) isn't common
> enough to be worth the complication.
>
> I think we should test [B] as well as [A] though.  The pass is set
> up to do some quite elaborate mode changes and I think rejecting
> [A] on its own would make some of the other code redundant.
> It also feels like it should be a seperate “if” or “else if”,
> with its own comment.

Unfortunately, we now have a testcase that shows that testing also [B]
is a problem (unfortunately now latent on the trunk, only reproduces
on 10 and 11 branches).

The comment in the patch tries to list just the interesting instructions,
we have a 64-bit value, copy low 8 bit of those to another register,
copy full 64 bits to another register and then clobber the original register.
Before that (set (reg:DI r14) (const_int ...)) we have a chain
DI r14, QI si, DI bp , that instruction drops the DI r14 from that chain, so
we have QI si, DI bp , si being the oldest_regno.
Next DI si is copied into DI dx.  Only the low 8 bits of that are defined,
the rest is unspecified, but we would add DI dx into that same chain at the
end, so QI si, DI bp, DI dx [*].  Next si is overwritten, so the chain is
DI bp, DI dx.  And then we see (set (reg:DI dx) (reg:DI bp)) and remove it
as redundant, because we think bp and dx are already equivalent, when in
reality that is true only for the lowpart 8 bits.
I believe the [*] marked step above is where the bug is.

The committed regcprop.c (copy_value) change (but only committed to
trunk/11, not to 10) added
  else if (partial_subreg_p (vd->e[sr].mode, GET_MODE (src))
           && partial_subreg_p (vd->e[sr].mode,
                                vd->e[vd->e[sr].oldest_regno].mode))
    return;
and while the first partial_subreg_p call returns true, the second one
doesn't; before the (set (reg:DI r14) (const_int ...)) insn it would be
true and we'd return, but as that reg got clobbered, si became the oldest
regno in the chain and so vd->e[vd->e[sr].oldest_regno].mode is QImode
and vd->e[sr].mode is QImode too, so the second partial_subreg_p is false.
But as the testcase shows, what is the oldest_regno in the chain is
something that changes over time, so relying on it for anything is
problematic, something could have a different oldest_regno and later
on get a different oldest_regno (perhaps with different mode) because
the oldest_regno got overwritten and it can change both ways.

The following patch effectively implements your (2) above.

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

PR rtl-optimization/100342
* regcprop.c (copy_value): When copying a source reg in a wider
mode than it has recorded for the value, adjust recorded destination
mode too or punt if !REG_CAN_CHANGE_MODE_P.

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

3 years agoDaily bump.
GCC Administrator [Sat, 15 May 2021 00:16:27 +0000 (00:16 +0000)]
Daily bump.

3 years agoFortran/OpenMP: Support 'omp parallel master'
Tobias Burnus [Fri, 14 May 2021 17:21:47 +0000 (19:21 +0200)]
Fortran/OpenMP: Support 'omp parallel master'

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_omp_node, show_code_node): Handle
EXEC_OMP_PARALLEL_MASTER.
* frontend-passes.c (gfc_code_walker): Likewise.
* gfortran.h (enum gfc_statement): Add ST_OMP_PARALLEL_MASTER and
ST_OMP_END_PARALLEL_MASTER.
(enum gfc_exec_op): Add EXEC_OMP_PARALLEL_MASTER..
* match.h (gfc_match_omp_parallel_master): Handle it.
* openmp.c (gfc_match_omp_parallel_master, resolve_omp_clauses,
omp_code_to_statement, gfc_resolve_omp_directive): Likewise.
* parse.c (decode_omp_directive, case_exec_markers,
gfc_ascii_statement, parse_omp_structured_block,
parse_executable): Likewise.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise.
* st.c (gfc_free_statement): Likewise.
* trans-openmp.c (gfc_trans_omp_parallel_master,
gfc_trans_omp_workshare, gfc_trans_omp_directive): Likewise.
* trans.c (trans_code): Likewise.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/parallel-master.f90: New test.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/parallel-master-1.f90: New test.
* gfortran.dg/gomp/parallel-master-2.f90: New test.

3 years agoFortran/OpenMP: Handle implicit SAVE for variables in main
Tobias Burnus [Fri, 14 May 2021 17:19:26 +0000 (19:19 +0200)]
Fortran/OpenMP: Handle implicit SAVE for variables in main

gcc/fortran/ChangeLog:

* resolve.c (resolve_symbol): Handle implicit SAVE of main-program
for vars in 'omp threadprivate' and 'omp declare target'.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/implicit-save.f90: New test.

3 years agoc++: simplify enclosing_instantiation_of [PR95870]
Jason Merrill [Mon, 5 Apr 2021 15:47:50 +0000 (11:47 -0400)]
c++: simplify enclosing_instantiation_of [PR95870]

Comparing DECL_SOURCE_LOCATION like the GCC 11 patch for PR 95870 will also
work for user-defined functions, if we update their location when
instantiating.  Another option would be to use LAMBDA_EXPR_REGEN_INFO for
lambdas, but this way is even simpler.

gcc/cp/ChangeLog:

PR c++/95870
* pt.c (enclosing_instantiation_of): Just compare
DECL_SOURCE_LOCATION.
(regenerate_decl_from_template): Copy DECL_SOURCE_LOCATION.

3 years agointl: add comments to _, N_, and G_
Jason Merrill [Fri, 14 May 2021 00:53:50 +0000 (20:53 -0400)]
intl: add comments to _, N_, and G_

gcc/ChangeLog:

* intl.h: Add comments.

3 years agoaarch64: Make sqdmlal2 patterns match canonical RTL
Kyrylo Tkachov [Fri, 14 May 2021 09:05:42 +0000 (10:05 +0100)]
aarch64: Make sqdmlal2 patterns match canonical RTL

The sqdmlal2 patterns are hidden beneath the SBINQOPS iterator and unfortunately they don't match
canonical RTL because the simple accumulate operand comes in the first arm of the SS_PLUS.
This patch splits the SS_PLUS and SS_MINUS forms with the SS_PLUS operands set up to match
the canonical form, where the complex operand comes first.

gcc/ChangeLog:

* config/aarch64/aarch64-simd.md
(aarch64_sqdml<SBINQOPS:as>l2_lane<mode>_internal): Split into...
(aarch64_sqdmlsl2_lane<mode>_internal): ... This...
(aarch64_sqdmlal2_lane<mode>_internal): ... And this.
(aarch64_sqdml<SBINQOPS:as>l2_laneq<mode>_internal): Split into ...
(aarch64_sqdmlsl2_laneq<mode>_internal): ... This...
(aarch64_sqdmlal2_laneq<mode>_internal): ... And this.
(aarch64_sqdml<SBINQOPS:as>l2_n<mode>_internal): Split into...
(aarch64_sqdmlsl2_n<mode>_internal): ... This...
(aarch64_sqdmlal2_n<mode>_internal): ... And this.

3 years agotestsuite: Add testcase for already fixed PR [PR95226]
Jakub Jelinek [Fri, 14 May 2021 14:29:49 +0000 (16:29 +0200)]
testsuite: Add testcase for already fixed PR [PR95226]

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

PR c++/95226
* g++.dg/cpp1y/pr95226.C: New test.

3 years agotestsuite: Add testcase for already fixed PR [PR94616]
Jakub Jelinek [Fri, 14 May 2021 13:34:12 +0000 (15:34 +0200)]
testsuite: Add testcase for already fixed PR [PR94616]

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

PR c++/94616
* g++.dg/cpp0x/pr94616.C: New test.

3 years agotestsuite: Add testcase for already fixed PR [PR90019]
Jakub Jelinek [Fri, 14 May 2021 12:56:28 +0000 (14:56 +0200)]
testsuite: Add testcase for already fixed PR [PR90019]

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

PR c++/90019
* g++.dg/cpp0x/sfinae68.C: New test.

3 years agoCleanup temp files in libphobos unittest at src/std/process.d
Bernd Edlinger [Fri, 14 May 2021 05:10:59 +0000 (07:10 +0200)]
Cleanup temp files in libphobos unittest at src/std/process.d

2021-05-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* src/std/process.d (unittest): Remove tmpname on exit.
* src/MERGE: Merge upstream phobos 63f4caa90.

3 years agotestsuite: Add testcase for already fixed PR [PR88872]
Jakub Jelinek [Fri, 14 May 2021 11:24:12 +0000 (13:24 +0200)]
testsuite: Add testcase for already fixed PR [PR88872]

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

* g++.dg/cpp1y/pr88872.C: New test.

3 years agoarm/PR66791: Replace calls to vtst builtin with it's boolean logic equivalent.
prathamesh.kulkarni [Fri, 14 May 2021 10:33:43 +0000 (16:03 +0530)]
arm/PR66791: Replace calls to vtst builtin with it's boolean logic equivalent.

gcc/ChangeLog:

2021-05-14  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR target/66791
* config/arm/arm_neon.h (vtst_s8): Replace call to vtst builtin with it's
boolean logic equivalent.
(vtst_s16): Likewise.
(vtst_s32): Likewise.
(vtst_u8): Likewise.
(vtst_u16): Likewise.
(vtst_u32): Likewise.
(vtst_p8): Likewise.
(vtst_p16): Likewise.
(vtstq_s8): Likewise.
(vtstq_s16): Likewise.
(vtstq_s32): Likewise.
(vtstq_u8): Likewise.
(vtstq_u16): Likewise.
(vtstq_u32): Likewise.
(vtstq_p8): Likewise.
(vtstq_p16): Likewise.

* config/arm/arm_neon_builtins.def: Remove entry for vtst.
* config/arm/neon.md (neon_vtst<mode>): Remove pattern.

3 years agoFix my name in ChangeLog files.
Martin Liska [Fri, 14 May 2021 10:14:22 +0000 (12:14 +0200)]
Fix my name in ChangeLog files.

3 years agoTSAN: add new test
Michael de Lang [Fri, 14 May 2021 10:09:45 +0000 (12:09 +0200)]
TSAN: add new test

gcc/testsuite/ChangeLog:

* g++.dg/tsan/pthread_cond_clockwait.C: New test.

3 years agodownload_prerequisites: update MPFR version to recommended
Martin Liska [Fri, 14 May 2021 10:00:19 +0000 (12:00 +0200)]
download_prerequisites: update MPFR version to recommended

contrib/ChangeLog:

* download_prerequisites: Use version 4.1.0.

3 years agoopts: add Warning keyword for 2 options
Martin Liska [Fri, 14 May 2021 09:40:58 +0000 (11:40 +0200)]
opts: add Warning keyword for 2 options

gcc/c-family/ChangeLog:

* c.opt: Add Warning keyword for 2 options.

3 years agoClosing of 8 branch.
Jakub Jelinek [Fri, 14 May 2021 09:24:08 +0000 (11:24 +0200)]
Closing of 8 branch.

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

contrib/
* gcc-changelog/git_update_version.py: Remove releases/gcc-8 from
active_refs.
maintainer-scripts/
* crontab: Stop doing gcc-8 snapshots.

3 years agoaarch64: Merge sqdmlal2 and sqdmlsl2 expanders
Kyrylo Tkachov [Wed, 12 May 2021 09:52:51 +0000 (10:52 +0100)]
aarch64: Merge sqdmlal2 and sqdmlsl2 expanders

The various sqdmlal2 and sqdmlsl2 expanders perform almost identical functions and can be
merged using code iterators and attributes to reduce the code in the MD file.
No behavioural change is expected.

gcc/ChangeLog:

* config/aarch64/aarch64-simd.md (aarch64_sqdmlal2<mode>): Merge into...
(aarch64_sqdml<SBINQOPS:as>l2<mode>): ... This.
(aarch64_sqdmlsl2<mode>): Delete.
(aarch64_sqdmlal2_lane<mode>): Merge this...
(aarch64_sqdmlsl2_lane<mode>): ... And this...
(aarch64_sqdml<SBINQOPS:as>l2_lane<mode>): ... Into this.
(aarch64_sqdmlal2_laneq<mode>): Merge this...
(aarch64_sqdmlsl2_laneq<mode>): ... And this...
(aarch64_sqdml<SBINQOPS:as>l2_laneq<mode>): ... Into this.
(aarch64_sqdmlal2_n<mode>): Merge this...
(aarch64_sqdmlsl2_n<mode>): ... And this...
(aarch64_sqdml<SBINQOPS:as>l2_n<mode>): ... Into this.

3 years agoPort gnat-style to Sphinx.
Martin Liska [Mon, 10 May 2021 13:51:12 +0000 (15:51 +0200)]
Port gnat-style to Sphinx.

gcc/ada/ChangeLog:

* doc/Makefile: Add gnat-style target.
* doc/share/conf.py: Likewise.
* doc/gnat-style.rst: New file.

3 years agogcc-changelog: detect Co-Authored-By before ChangeLog entries
Martin Liska [Fri, 14 May 2021 08:44:33 +0000 (10:44 +0200)]
gcc-changelog: detect Co-Authored-By before ChangeLog entries

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Support Co-Authored-By before
a first ChangeLog entry.

3 years agolibsanitizer: cherry-pick from upstream
H.J. Lu [Fri, 14 May 2021 01:23:55 +0000 (18:23 -0700)]
libsanitizer: cherry-pick from upstream

cherry-pick:

72797dedb720 [sanitizer] Use size_t on g_tls_size to fix build on x32

3 years agoc++: Check attributes on friend declarations [PR99032]
Marek Polacek [Fri, 30 Apr 2021 01:38:14 +0000 (21:38 -0400)]
c++: Check attributes on friend declarations [PR99032]

This patch implements [dcl.attr.grammar]/5: "If an attribute-specifier-seq
appertains to a friend declaration ([class.friend]), that declaration shall
be a definition."

This restriction applies to C++11-style attributes as well as GNU
attributes with the exception that we allow GNU attributes that require
a type, such as vector_size to continue accepting code as in attrib63.C.
There are various forms of friend declarations, we have friend
templates, C++11 extended friend declarations, and so on.  In some cases
we already ignore the attribute and warn that it was ignored.  But
certain cases weren't diagnosed, and with this patch we'll give a hard
error.  I tried hard not to emit both a warning and error and I think it
worked out.

Jason provided the cp_parser_decl_specifier_seq hunk to detect using
standard attributes in the middle of decl-specifiers, which is invalid.

Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/ChangeLog:

PR c++/99032
* cp-tree.h (any_non_type_attribute_p): Declare.
* decl.c (grokdeclarator): Diagnose when an attribute appertains to
a friend declaration that is not a definition.
* decl2.c (any_non_type_attribute_p): New.
* parser.c (cp_parser_decl_specifier_seq): Diagnose standard attributes
in the middle of decl-specifiers.
(cp_parser_elaborated_type_specifier): Diagnose when an attribute
appertains to a friend declaration that is not a definition.
(cp_parser_member_declaration): Likewise.

gcc/testsuite/ChangeLog:

PR c++/99032
* g++.dg/cpp0x/friend7.C: New test.
* g++.dg/cpp0x/gen-attrs-4.C: Add dg-error.
* g++.dg/cpp0x/gen-attrs-39-1.C: Likewise.
* g++.dg/cpp0x/gen-attrs-74.C: New test.
* g++.dg/ext/attrib63.C: New test.