]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agoipa/96291: don't crash on unoptimized lto functions
Sergei Trofimovich [Sat, 25 Jul 2020 18:26:50 +0000 (19:26 +0100)] 
ipa/96291: don't crash on unoptimized lto functions

In PR ipa/96291 the test contained an SCC with one
unoptimized function. This tricked ipa-cp into NULL dereference.

has_undead_caller_from_outside_scc_p() did not take into account
that unoptimized funtions don't have IPA summary analysis. And
dereferenced NULL pointer causing an ICE.

gcc/
PR ipa/96291
* ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider
unoptimized callers as undead.

gcc/testsuite/
PR ipa/96291
* gcc.dg/lto/pr96291_0.c: New testcase.
* gcc.dg/lto/pr96291_1.c: Support file.
* gcc.dg/lto/pr96291_2.c: Likewise.
* gcc.dg/lto/pr96291.h: Likewise.

(cherry picked from commit cbf10ac51c0b889e930f260a3d1fb601332befdf)

4 years agobpf: remove trailing whitespaces from source files
Jose E. Marchesi [Wed, 12 Aug 2020 14:56:07 +0000 (16:56 +0200)] 
bpf: remove trailing whitespaces from source files

This patch is a little cleanup that removes trailing whitespaces from
the bpf backend source files.

(cherry pick of commit e87c540fe43e29663140ed67b98ee437c25696bb)

2020-08-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.md: Remove trailing whitespaces.
* config/bpf/constraints.md: Likewise.
* config/bpf/predicates.md: Likewise.

gcc/testsuite/
* gcc.target/bpf/diag-funargs-2.c: Remove trailing whitespaces.
* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
* gcc.target/bpf/helper-sock-ops-cb-flags-set.c
* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
* gcc.target/bpf/helper-strtoul.c: Likewise.
* gcc.target/bpf/helper-strtol.c: Likewise.
* gcc.target/bpf/helper-sock-map-update.c: Likewise.
* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
* gcc.target/bpf/helper-sk-release.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-skb-change-head.c: Likewise.
* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
* gcc.target/bpf/helper-set-hash.c: Likewise.
* gcc.target/bpf/helper-setsockopt.c: Likewise.
* gcc.target/bpf/helper-redirect-map.c: Likewise.
* gcc.target/bpf/helper-rc-repeat.c: Likewise.
* gcc.target/bpf/helper-rc-keydown.c: Likewise.
* gcc.target/bpf/helper-probe-read-str.c: Likewise.
* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
* gcc.target/bpf/helper-override-return.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
* gcc.target/bpf/helper-get-local-storage.c: Likewise.
* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-getsockopt.c: Likewise.
* gcc.target/bpf/diag-funargs-3.c: Likewise.

4 years agobpf: more flexible support for kernel helpers
Jose E. Marchesi [Wed, 12 Aug 2020 14:55:49 +0000 (16:55 +0200)] 
bpf: more flexible support for kernel helpers

This patch changes the existing support for BPF kernel helpers to be
more flexible, in two main ways.

First, there is no longer a hardcoded list of kernel helpers defined
in the compiler internals.  This is replaced by a new target-specific
attribute `kernel_helper' that the user can use to define her own
helpers, annotating function prototypes.

Second, following feedback from the kernel hackers, the pre-defined
helpers in the distributed bpf-helpers.h are no longer available
conditionally depending on the kernel version used in -mkernel.  The
command-line option stays for now, as it may be useful for other
things.

Target tests and documentation updated.

(cherry pick of commit af30b83b50953fbbe671d93d44ea6ac2f7a50ce9)

2020-08-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf-helpers.h (KERNEL_HELPER): Define.
(KERNEL_VERSION): Remove.
* config/bpf/bpf-helpers.def: Delete.
* config/bpf/bpf.c (bpf_handle_fndecl_attribute): New function.
(bpf_attribute_table): Define.
(bpf_helper_names): Delete.
(bpf_helper_code): Likewise.
(enum bpf_builtins): Adjust to new helpers mechanism.
(bpf_output_call): Likewise.
(bpf_init_builtins): Likewise.
(bpf_init_builtins): Likewise.
* doc/extend.texi (BPF Function Attributes): New section.
(BPF Kernel Helpers): Delete section.

gcc/testsuite/
* gcc.target/bpf/helper-bind.c: Adjust to new kernel helpers
mechanism.
* gcc.target/bpf/helper-bpf-redirect.c: Likewise.
* gcc.target/bpf/helper-clone-redirect.c: Likewise.
* gcc.target/bpf/helper-csum-diff.c: Likewise.
* gcc.target/bpf/helper-csum-update.c: Likewise.
* gcc.target/bpf/helper-current-task-under-cgroup.c: Likewise.
* gcc.target/bpf/helper-fib-lookup.c: Likewise.
* gcc.target/bpf/helper-get-cgroup-classid.c: Likewise.
* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-get-current-comm.c: Likewise.
* gcc.target/bpf/helper-get-current-pid-tgid.c: Likewise.
* gcc.target/bpf/helper-get-current-task.c: Likewise.
* gcc.target/bpf/helper-get-current-uid-gid.c: Likewise.
* gcc.target/bpf/helper-get-hash-recalc.c: Likewise.
* gcc.target/bpf/helper-get-listener-sock.c: Likewise.
* gcc.target/bpf/helper-get-local-storage.c: Likewise.
* gcc.target/bpf/helper-get-numa-node-id.c: Likewise.
* gcc.target/bpf/helper-get-prandom-u32.c: Likewise.
* gcc.target/bpf/helper-get-route-realm.c: Likewise.
* gcc.target/bpf/helper-get-smp-processor-id.c: Likewise.
* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
* gcc.target/bpf/helper-get-stack.c: Likewise.
* gcc.target/bpf/helper-get-stackid.c: Likewise.
* gcc.target/bpf/helper-getsockopt.c: Likewise.
* gcc.target/bpf/helper-ktime-get-ns.c: Likewise.
* gcc.target/bpf/helper-l3-csum-replace.c: Likewise.
* gcc.target/bpf/helper-l4-csum-replace.c: Likewise.
* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
* gcc.target/bpf/helper-map-delete-elem.c: Likewise.
* gcc.target/bpf/helper-map-lookup-elem.c: Likewise.
* gcc.target/bpf/helper-map-peek-elem.c: Likewise.
* gcc.target/bpf/helper-map-pop-elem.c: Likewise.
* gcc.target/bpf/helper-map-push-elem.c: Likewise.
* gcc.target/bpf/helper-map-update-elem.c: Likewise.
* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-pop-data.c: Likewise.
* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
* gcc.target/bpf/helper-msg-push-data.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-hash.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
* gcc.target/bpf/helper-override-return.c: Likewise.
* gcc.target/bpf/helper-perf-event-output.c: Likewise.
* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
* gcc.target/bpf/helper-perf-event-read.c: Likewise.
* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
* gcc.target/bpf/helper-probe-read-str.c: Likewise.
* gcc.target/bpf/helper-probe-read.c: Likewise.
* gcc.target/bpf/helper-probe-write-user.c: Likewise.
* gcc.target/bpf/helper-rc-keydown.c: Likewise.
* gcc.target/bpf/helper-rc-pointer-rel.c: Likewise.
* gcc.target/bpf/helper-rc-repeat.c: Likewise.
* gcc.target/bpf/helper-redirect-map.c: Likewise.
* gcc.target/bpf/helper-set-hash-invalid.c: Likewise.
* gcc.target/bpf/helper-set-hash.c: Likewise.
* gcc.target/bpf/helper-setsockopt.c: Likewise.
* gcc.target/bpf/helper-sk-fullsock.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-hash.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
* gcc.target/bpf/helper-sk-release.c: Likewise.
* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-skb-change-head.c: Likewise.
* gcc.target/bpf/helper-skb-change-proto.c: Likewise.
* gcc.target/bpf/helper-skb-change-tail.c: Likewise.
* gcc.target/bpf/helper-skb-change-type.c: Likewise.
* gcc.target/bpf/helper-skb-ecn-set-ce.c: Likewise.
* gcc.target/bpf/helper-skb-get-tunnel-key.c: Likewise.
* gcc.target/bpf/helper-skb-get-tunnel-opt.c: Likewise.
* gcc.target/bpf/helper-skb-get-xfrm-state.c: Likewise.
* gcc.target/bpf/helper-skb-load-bytes-relative.c: Likewise.
* gcc.target/bpf/helper-skb-load-bytes.c: Likewise.
* gcc.target/bpf/helper-skb-pull-data.c: Likewise.
* gcc.target/bpf/helper-skb-set-tunnel-key.c: Likewise.
* gcc.target/bpf/helper-skb-set-tunnel-opt.c: Likewise.
* gcc.target/bpf/helper-skb-store-bytes.c: Likewise.
* gcc.target/bpf/helper-skb-under-cgroup.c: Likewise.
* gcc.target/bpf/helper-skb-vlan-pop.c: Likewise.
* gcc.target/bpf/helper-skb-vlan-push.c: Likewise.
* gcc.target/bpf/helper-skc-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-sock-hash-update.c: Likewise.
* gcc.target/bpf/helper-sock-map-update.c: Likewise.
* gcc.target/bpf/helper-sock-ops-cb-flags-set.c: Likewise.
* gcc.target/bpf/helper-spin-lock.c: Likewise.
* gcc.target/bpf/helper-spin-unlock.c: Likewise.
* gcc.target/bpf/helper-strtol.c: Likewise.
* gcc.target/bpf/helper-strtoul.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
* gcc.target/bpf/helper-tail-call.c: Likewise.
* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
* gcc.target/bpf/helper-tcp-sock.c: Likewise.
* gcc.target/bpf/helper-trace-printk.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-tail.c: Likewise.
* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.

4 years agobpf: do not save/restore callee-saved registers in function prolog/epilog
Jose E. Marchesi [Wed, 12 Aug 2020 14:55:30 +0000 (16:55 +0200)] 
bpf: do not save/restore callee-saved registers in function prolog/epilog

BPF considers that every call to a function allocates a fresh set of
registers that are available to the callee, of which the first five
may have bee initialized with the function arguments.  This is
implemented by both interpreter and JIT in the Linux kernel.

This is enforced by the kernel BPF verifier, which will reject any
code in which non-initialized registers are accessed before being
written.  Consequently, the spill instructions generated in function
prologue were causing the verifier to reject our compiled programs.

This patch makes GCC to not save/restore callee-saved registers in
function prologue/epilogue, unless xBPF mode is enabled.

(cherry pick of commit 98456a64b0b5c20eeb8f964c7718072ba9b0e568)

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
callee saved registers only in xBPF.
(bpf_expand_prologue): Save callee saved registers only in xBPF.
(bpf_expand_epilogue): Likewise for restoring.
* doc/invoke.texi (eBPF Options): Document this is activated by
-mxbpf.

gcc/testsuite/
* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
* gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.

4 years agobpf: add support for the -mxbpf option
Jose E. Marchesi [Wed, 12 Aug 2020 14:54:53 +0000 (16:54 +0200)] 
bpf: add support for the -mxbpf option

This patch adds support for a new option -mxbpf.  This tells GCC to
generate code for an expanded version of BPF that relaxes some of the
restrictions imposed by BPF.

(cherry pick of 51e10276d6792f67f1d88d90f299e7ac1b1f1f24)

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.opt (mxbpf): New option.
* doc/invoke.texi (Option Summary): Add -mxbpf.
(eBPF Options): Document -mxbbpf.

4 years agotestsuite: Fix gcc.target/arm/stack-protector-1.c for Cortex-M
Christophe Lyon [Wed, 12 Aug 2020 09:22:38 +0000 (09:22 +0000)] 
testsuite: Fix gcc.target/arm/stack-protector-1.c for Cortex-M

The stack-protector-1.c test fails when compiled for Cortex-M:
- for Cortex-M0/M1, str r0, [sp #-8]! is not supported
- for Cortex-M3/M4..., the assembler complains that "use of r13 is
  deprecated"

This patch replaces the str instruction with
     sub   sp, sp, #8
     str r0, [sp]
and removes the check for r13, which is unlikely to leak the canary
value.

2020-08-11  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/stack-protector-1.c: Adapt code to Cortex-M
restrictions.

(cherry picked from commit 6606fdc0aad85cbca1bb58e1b2ffe05611aabd7a)

4 years agotestsuite: Fix gcc.target/arm/multilib.exp use of gcc_opts
Christophe Lyon [Wed, 12 Aug 2020 08:59:22 +0000 (08:59 +0000)] 
testsuite: Fix gcc.target/arm/multilib.exp use of gcc_opts

This patch fixes an incorrect parameter passing for $gcc_opts, which
produces a DejaGnu error: (DejaGnu) proc "gcc_opts" does not exist.

2020-08-12  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/multilib.exp: Fix parameter passing for gcc_opts.

(cherry picked from commit 73d2b6d4a3f0db82b2bfaba6c275412e5830680d)

4 years agoDaily bump.
GCC Administrator [Wed, 12 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

4 years agolibstdc++: Disable net tests that depend on threads [PR 89760]
Jonathan Wakely [Tue, 11 Aug 2020 15:55:01 +0000 (16:55 +0100)] 
libstdc++: Disable net tests that depend on threads [PR 89760]

libstdc++-v3/ChangeLog:

PR libstdc++/89760
* testsuite/experimental/net/execution_context/make_service.cc:
Add dg-require-gthreads.
* testsuite/experimental/net/executor/1.cc: Likewise.
* testsuite/experimental/net/headers.cc: Likewise.
* testsuite/experimental/net/internet/address/v4/comparisons.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/cons.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/creation.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/members.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/base.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
Likewise.
* testsuite/experimental/net/socket/basic_socket.cc: Likewise.
* testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.

4 years agoc++: abbreviated function template friend matching [PR96106]
Patrick Palka [Thu, 30 Jul 2020 02:06:36 +0000 (22:06 -0400)] 
c++: abbreviated function template friend matching [PR96106]

In the below testcase, duplicate_decls wasn't merging the tsubsted
friend declaration for 'void add(auto)' with its definition, because
reduce_template_parm_level (during tsubst_friend_function) lost the
DECL_VIRTUAL_P flag on the auto's invented template parameter, which
caused template_heads_equivalent_p to deem the two template heads as not
equivalent in C++20 mode.

This patch makes reduce_template_parm_level carry over the
DECL_VIRTUAL_P flag from the original TEMPLATE_PARM_DECL.

gcc/cp/ChangeLog:

PR c++/96106
* pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
from the original TEMPLATE_PARM_DECL to the new lowered one.

gcc/testsuite/ChangeLog:

PR c++/96106
* g++.dg/concepts/abbrev7.C: New test.

(cherry picked from commit f31dd9beb95f4beda1d2bd5c0526c42d0ce455c4)

4 years agoThis patch fixes PR96312. Cures a used uninitialized warning.
Paul Thomas [Mon, 10 Aug 2020 05:22:22 +0000 (06:22 +0100)] 
This patch fixes PR96312. Cures a used uninitialized warning.

2020-08-10  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/96312
* trans-expr.c (fcncall_realloc_result): Only compare shapes if
lhs was allocated..

gcc/testsuite/
PR fortran/96312
* gfortran.dg/pr96312.f90: New test.

(cherry picked from commit abb276d0eca218e62e5ed50babf12ff544250759)

4 years agoc++: constraints and explicit instantiation [PR96164]
Patrick Palka [Thu, 30 Jul 2020 02:06:33 +0000 (22:06 -0400)] 
c++: constraints and explicit instantiation [PR96164]

When considering to instantiate a member of a class template as part of
an explicit instantiation of the class template, we need to first check
the member's constraints before proceeding with the instantiation of the
member.

gcc/cp/ChangeLog:

PR c++/96164
* constraint.cc (constraints_satisfied_p): Return true if
!flags_concepts.
* pt.c (do_type_instantiation): Update a paragraph taken from
[temp.explicit] to reflect the latest specification.  Don't
instantiate a member with unsatisfied constraints.

gcc/testsuite/ChangeLog:

PR c++/96164
* g++.dg/cpp2a/concepts-explicit-inst5.C: New test.

(cherry picked from commit dc3d1e181445fafbbd146eb355a750c41c338794)

4 years agoDaily bump.
GCC Administrator [Tue, 11 Aug 2020 00:17:18 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Use _wstat64 for Windows [PR 95749]
Jonathan Wakely [Mon, 10 Aug 2020 11:04:27 +0000 (12:04 +0100)] 
libstdc++: Use _wstat64 for Windows [PR 95749]

In order to handle large files on Windows we need to use stat API with
64-bit st_size member.

libstdc++-v3/ChangeLog:

PR libstdc++/95749
* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(stat_type): Change to __stat64.
(stat): Use _wstat64.

(cherry picked from commit 9939be5758b52ed2fe1a7e56b94ce6d0f4d81580)

4 years agoUsing UNSPEC for vector compare to mask register.
liuhongt [Mon, 20 Jul 2020 02:13:58 +0000 (10:13 +0800)] 
Using UNSPEC for vector compare to mask register.

For rtx like (eq:HI (V8SI 90) (V8SI 91)), cse will take it as a
boolean value and try to do some optimization. But it is not true for
vector compare, also other places in rtl passes hold the same
assumption.

2020-07-20  Hongtao Liu  <hongtao.liu@intel.com>

gcc/
PR target/96243
* config/i386/i386-expand.c (ix86_expand_sse_cmp): Refine for
maskcmp.
(ix86_expand_mask_vec_cmp): Change prototype.
* config/i386/i386-protos.h (ix86_expand_mask_vec_cmp): Change prototype.
* config/i386/i386.c (ix86_print_operand): Remove operand
modifier 'I'.
* config/i386/sse.md
(*<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>): Deleted.
(*<avx512>_cmp<mode>3<mask_scalar_merge_name>): Ditto.
(*<avx512>_ucmp<mode>3<mask_scalar_merge_name>): Ditto.
(*<avx512>_ucmp<mode>3<mask_scalar_merge_name>,
avx512f_maskcmp<mode>3): Ditto.

gcc/testsuite
* gcc.target/i386/pr92865-1.c: Adjust testcase.

4 years agoFill up {,un}compression stats for ZSTD in LTO.
Martin Liska [Wed, 20 May 2020 12:39:21 +0000 (14:39 +0200)] 
Fill up {,un}compression stats for ZSTD in LTO.

* lto-compress.c (lto_compression_zstd): Fill up
num_compressed_il_bytes.
(lto_uncompression_zstd): Likewise for num_uncompressed_il_bytes here.

(cherry picked from commit 053dc901e0227bb62b65f3a8d7a9deccb61dffa1)

4 years agors6000: MMA built-ins reject typedefs of MMA types
Peter Bergner [Sat, 8 Aug 2020 16:54:48 +0000 (11:54 -0500)] 
rs6000: MMA built-ins reject typedefs of MMA types

We do not allow conversions between the MMA types and other types.
However, we are being too strict in not matching MMA types with
typdefs of those types.  Use TYPE_CANONICAL to see through the
types to their canonical types before comparing them.

2020-08-08  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96530
* config/rs6000/rs6000.c (rs6000_invalid_conversion): Use canonical
types for type comparisons.  Refactor code to simplify it.

gcc/testsuite/
PR target/96530
* gcc.target/powerpc/pr96530.c: New test.

(cherry picked from commit e2882e76089cecdc268d0835c54cabfa80b5b0be)

4 years agoDaily bump.
GCC Administrator [Mon, 10 Aug 2020 00:17:05 +0000 (00:17 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 9 Aug 2020 00:17:08 +0000 (00:17 +0000)] 
Daily bump.

4 years agors6000: Don't ICE when spilling an MMA accumulator
Peter Bergner [Thu, 6 Aug 2020 15:03:03 +0000 (10:03 -0500)] 
rs6000: Don't ICE when spilling an MMA accumulator

When we spill an accumulator that has a known zero value, LRA will emit
a new (set (reg:PXI ...) 0) insn, but it does not use the mma_xxsetaccz
pattern to do it, leading to an unrecognized insn ICE.  The solution here
is to move the xxsetaccz instruction into the movpxi pattern and have the
xxsetaccz pattern call the move pattern.

2020-08-06  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96446
* config/rs6000/mma.md (*movpxi): Add xxsetaccz generation.
Disable split for zero constant source operand.
(mma_xxsetaccz): Change to define_expand.  Call gen_movpxi.

gcc/testsuite/
PR target/96446
* gcc.target/powerpc/pr96446.c: New test.

(cherry picked from commit 9c376d1c166e7c8b10bba6f1675d2471ffe8447f)

4 years agoDaily bump.
GCC Administrator [Sat, 8 Aug 2020 00:17:07 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Fix ambiguous comparisons in __gnu_debug::bitset [PR 96303]
Jonathan Wakely [Fri, 7 Aug 2020 19:29:11 +0000 (20:29 +0100)] 
libstdc++: Fix ambiguous comparisons in __gnu_debug::bitset [PR 96303]

With -pedantic the debug mode bitset has an ambiguous equality
comparison operator, because it tries to compare the non-debug base to
the debug object. The base object can be converted to another debug
bitset, making the same operator== a candidate again.

The fix is to do the comparison on both base objects, so the operator
for the derived type isn't a candidate.

For the inequality operator the same change should be done, but that
operator can be removed entirely for C++20 because it can be synthesized
by the compiler.

I don't think either equality or inequality operators are really needed,
because the public _GLIBCXX_STD_C::bitset base class cam always be
compared using its own comparison operators. I'm not changing that here
though.

libstdc++-v3/ChangeLog:

PR libstdc++/96303
* include/debug/bitset (bitset::operator==): Call _M_base() on
right operand.
(bitset::operator!=): Likewise, but don't define it at all when
default comparisons are supported by the compiler.
* testsuite/23_containers/bitset/operations/96303.cc: New test.

(cherry picked from commit de1e3b8795e507c3cfa5b62984272628ca62a9bd)

4 years agoAArch64: Fix hwasan failure in readline.
Tamar Christina [Mon, 3 Aug 2020 11:03:17 +0000 (12:03 +0100)] 
AArch64: Fix hwasan failure in readline.

My previous fix added an unchecked call to fgets in the new function readline.
fgets can fail when there's an error reading the file in which case it returns
NULL.  It also returns NULL when the next character is EOF.

The EOF case is already covered by the existing code but the error case isn't.
This fixes it by returning the empty string on error.

Also I now use strnlen instead of strlen to make sure we never read outside the
buffer.

This was flagged by Matthew Malcomson during his hwasan work.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (readline): Check return value fgets.

(cherry picked from commit 341573406b392f4d57e052ce22f80e85a7c479e9)

4 years agoAArch64: Add test for -mcpu=native
Tamar Christina [Fri, 17 Jul 2020 12:13:12 +0000 (13:13 +0100)] 
AArch64: Add test for -mcpu=native

This adds some tests to the GCC testsuite for testing the
-mcpu=native code.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/aarch64-cpunative.exp: New test.
* gcc.target/aarch64/cpunative/info_0: New test.
* gcc.target/aarch64/cpunative/info_1: New test.
* gcc.target/aarch64/cpunative/info_10: New test.
* gcc.target/aarch64/cpunative/info_11: New test.
* gcc.target/aarch64/cpunative/info_12: New test.
* gcc.target/aarch64/cpunative/info_13: New test.
* gcc.target/aarch64/cpunative/info_14: New test.
* gcc.target/aarch64/cpunative/info_15: New test.
* gcc.target/aarch64/cpunative/info_2: New test.
* gcc.target/aarch64/cpunative/info_3: New test.
* gcc.target/aarch64/cpunative/info_4: New test.
* gcc.target/aarch64/cpunative/info_5: New test.
* gcc.target/aarch64/cpunative/info_6: New test.
* gcc.target/aarch64/cpunative/info_7: New test.
* gcc.target/aarch64/cpunative/info_8: New test.
* gcc.target/aarch64/cpunative/info_9: New test.
* gcc.target/aarch64/cpunative/native_cpu_0.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_1.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_10.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_11.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_12.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_13.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_14.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_15.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_2.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_3.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_4.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_5.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_6.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_7.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_8.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_9.c: New test.

(cherry picked from commit 8bc83ee378e1cac65d75752b5137ec35d9e1aca1)

4 years agoTestuite: Document environment setting directives
Tamar Christina [Fri, 17 Jul 2020 12:12:46 +0000 (13:12 +0100)] 
Testuite: Document environment setting directives

This document some of the existing DejaGnu directives to modify
environment variables before test or compiler invocations.

gcc/ChangeLog:

* doc/sourcebuild.texi (dg-set-compiler-env-var,
dg-set-target-env-var): Document.

(cherry picked from commit 7c4491e33d1be16bfb85d448862a8b956d35e4d8)

4 years agoTestsuite: Make it easier to debug environment setting functions
Tamar Christina [Fri, 17 Jul 2020 12:12:23 +0000 (13:12 +0100)] 
Testsuite: Make it easier to debug environment setting functions

This adds verbose output to dg-set-compiler-env-var and dg-set-target-env-var
so you can actually see what they're setting when you add -v -v.

gcc/testsuite/ChangeLog:

* lib/gcc-dg.exp (dg-set-compiler-env-var, dg-set-target-env-var): Add
verbose output.

(cherry picked from commit e410cbff5d5a408b7c64a0c426951afc2a24df93)

4 years agoArm: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:12:00 +0000 (13:12 +0100)] 
Arm: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using these are added later on.

gcc/ChangeLog:

* config/arm/driver-arm.c (host_detect_local_cpu): Add GCC_CPUINFO.

(cherry picked from commit 34a6c43487caf3a2a0ec9c7c79c526d116abc8b9)

4 years agoAArch64: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:10:53 +0000 (13:10 +0100)] 
AArch64: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using this are added later on.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (host_detect_local_cpu):
Add GCC_CPUINFO.

(cherry picked from commit 55f6addc0c102eab2bf19d94de3ce52f9de0ab91)

4 years agoAArch64: Fix bugs in -mcpu=native detection.
Tamar Christina [Fri, 17 Jul 2020 12:10:28 +0000 (13:10 +0100)] 
AArch64: Fix bugs in -mcpu=native detection.

This patch fixes a couple of issues in AArch64's -mcpu=native processing:

The buffer used to read the lines from /proc/cpuinfo is 128 bytes long.  While
this was enough in the past with the increase in architecture extensions it is
no longer enough.   It results in two bugs:

1) No option string longer than 127 characters is correctly parsed.  Features
   that are supported are silently ignored.

2) It incorrectly enables features that are not present on the machine:
  a) It checks for substring matching instead of full word matching.  This makes
     it incorrectly detect sb support when ssbs is provided instead.
  b) Due to the truncation at the 127 char border it also incorrectly enables
     features due to the full feature being cut off and the part that is left
     accidentally enables something else.

This breaks -mcpu=native detection on some of our newer system.

The patch fixes these issues by reading full lines up to the \n in a string.
This gives us the full feature line.  Secondly it creates a set from this string
to:

 1) Reduce matching complexity from O(n*m) to O(n*logm).
 2) Perform whole word matching instead of substring matching.

To make this code somewhat cleaner I also changed from using char* to using
std::string and std::set.

Note that I have intentionally avoided the use of ifstream and stringstream
to make it easier to backport.  I have also not change the substring matching
for the initial line classification as I cannot find a documented cpuinfo format
which leads me to believe there may be kernels out there that require this which
may be why the original code does this.

I also do not want this to break if the kernel adds a new line that is long and
indents the file by two tabs to keep everything aligned.  In short I think an
imprecise match is the right thing here.

Test for this is added as the last thing in this series as it requires some
changes to be made to be able to test this.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (INCLUDE_SET): New.
(parse_field): Use std::string.
(split_words, readline, find_field): New.
(host_detect_local_cpu): Fix truncation issues.

(cherry picked from commit b399f3c6425f6c33b64e813899cbd589288ef716)

4 years agoarm: Clear canary value after stack_protect_test [PR96191]
Richard Sandiford [Fri, 7 Aug 2020 11:15:02 +0000 (12:15 +0100)] 
arm: Clear canary value after stack_protect_test [PR96191]

The stack_protect_test patterns were leaving the canary value in the
temporary register, meaning that it was often still in registers on
return from the function.  An attacker might therefore have been
able to use it to defeat stack-smash protection for a later function.

gcc/
PR target/96191
* config/arm/arm.md (arm_stack_protect_test_insn): Zero out
operand 2 after use.
* config/arm/thumb1.md (thumb1_stack_protect_test_insn): Likewise.

gcc/testsuite/
* gcc.target/arm/stack-protector-1.c: New test.
* gcc.target/arm/stack-protector-2.c: Likewise.

(cherry picked from commit 6a3f3e08723063ea2dadb7ddf503f02972a724e2)

4 years agoaarch64: Clear canary value after stack_protect_test [PR96191]
Richard Sandiford [Fri, 7 Aug 2020 11:15:01 +0000 (12:15 +0100)] 
aarch64: Clear canary value after stack_protect_test [PR96191]

The stack_protect_test patterns were leaving the canary value in the
temporary register, meaning that it was often still in registers on
return from the function.  An attacker might therefore have been
able to use it to defeat stack-smash protection for a later function.

gcc/
PR target/96191
* config/aarch64/aarch64.md (stack_protect_test_<mode>): Set the
CC register directly, instead of a GPR.  Replace the original GPR
destination with an extra scratch register.  Zero out operand 3
after use.
(stack_protect_test): Update accordingly.

gcc/testsuite/
PR target/96191
* gcc.target/aarch64/stack-protector-1.c: New test.
* gcc.target/aarch64/stack-protector-2.c: Likewise.

(cherry picked from commit fe1a26429038d7cd17abc53f96a6f3e2639b605f)

4 years agoDaily bump.
GCC Administrator [Fri, 7 Aug 2020 00:17:07 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Fix unnecessary allocations in read_symlink [PR 96484]
Jonathan Wakely [Thu, 6 Aug 2020 17:44:50 +0000 (18:44 +0100)] 
libstdc++: Fix unnecessary allocations in read_symlink [PR 96484]

libstdc++-v3/ChangeLog:

PR libstdc++/96484
* src/c++17/fs_ops.cc (fs::read_symlink): Return an error
immediately for non-symlinks.
* src/filesystem/ops.cc (fs::read_symlink): Likewise.

(cherry picked from commit 6a13a4e3f29fc4ce5eff96d74ba965c9fdc02184)

4 years agotree-optimization/96483 - fix ICE in PRE with POLY_INT_CST
Richard Biener [Thu, 6 Aug 2020 10:16:05 +0000 (12:16 +0200)] 
tree-optimization/96483 - fix ICE in PRE with POLY_INT_CST

This adds a missing case for PRE expression re-materialization.

2020-08-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96483
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
POLY_INT_CST.

(cherry picked from commit 1f4c8afa1b2dac97f2ee78eacafe6eee246a4dae)

5 years agoDaily bump.
GCC Administrator [Thu, 6 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Wed, 5 Aug 2020 00:17:17 +0000 (00:17 +0000)] 
Daily bump.

5 years agoBackport prefixed instruction tests from master branch.
Michael Meissner [Tue, 4 Aug 2020 20:28:58 +0000 (16:28 -0400)] 
Backport prefixed instruction tests from master branch.

gcc/testsuite/
2020-08-04  Michael Meissner  <meissner@linux.ibm.com>
    David Edelsohn  <dje.gcc@gmail.com>

* gcc.target/powerpc/prefix-add.c: Backport from 2020-06-27 and
2020-06-26 changes.
* gcc.target/powerpc/prefix-di-constant.c: Backport.
* gcc.target/powerpc/prefix-ds-dq.c: Backport.
* gcc.target/powerpc/prefix-large-dd.c: Backport.
* gcc.target/powerpc/prefix-large-df.c: Backport.
* gcc.target/powerpc/prefix-large-di.c: Backport.
* gcc.target/powerpc/prefix-large-hi.c: Backport.
* gcc.target/powerpc/prefix-large-kf.c: Backport.
* gcc.target/powerpc/prefix-large-qi.c: Backport.
* gcc.target/powerpc/prefix-large-sd.c: Backport.
* gcc.target/powerpc/prefix-large-sf.c: Backport.
* gcc.target/powerpc/prefix-large-si.c: Backport.
* gcc.target/powerpc/prefix-large-udi.c: Backport.
* gcc.target/powerpc/prefix-large-uhi.c: Backport.
* gcc.target/powerpc/prefix-large-uqi.c: Backport.
* gcc.target/powerpc/prefix-large-usi.c: Backport.
* gcc.target/powerpc/prefix-large-v2df.c: Backport.
* gcc.target/powerpc/prefix-large.h: Backport.
* gcc.target/powerpc/prefix-no-update.c: Backport.
* gcc.target/powerpc/prefix-pcrel-dd.c: Backport.
* gcc.target/powerpc/prefix-pcrel-df.c: Backport.
* gcc.target/powerpc/prefix-pcrel-di.c: Backport.
* gcc.target/powerpc/prefix-pcrel-hi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-kf.c: Backport.
* gcc.target/powerpc/prefix-pcrel-qi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-sd.c: Backport.
* gcc.target/powerpc/prefix-pcrel-sf.c: Backport.
* gcc.target/powerpc/prefix-pcrel-si.c: Backport.
* gcc.target/powerpc/prefix-pcrel-udi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-uhi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-uqi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-usi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-v2df.c: Backport.
* gcc.target/powerpc/prefix-pcrel.h: Backport.
* gcc.target/powerpc/prefix-si-constant.c: Backport.
* gcc.target/powerpc/prefix-stack-protect.c: Backport.

5 years agoc++: Template keyword following :: [PR96082]
Marek Polacek [Tue, 4 Aug 2020 13:35:25 +0000 (09:35 -0400)] 
c++: Template keyword following :: [PR96082]

In r9-4235 I tried to make sure that the template keyword follows
a nested-name-specifier.  :: is a valid nested-name-specifier, so
I also have to check 'globalscope' before giving the error.

gcc/cp/ChangeLog:

PR c++/96082
* parser.c (cp_parser_elaborated_type_specifier): Allow
'template' following ::.

gcc/testsuite/ChangeLog:

PR c++/96082
* g++.dg/template/template-keyword3.C: New test.

(cherry picked from commit 97def1f34c134d78d4423e9ac3e9b262417ea390)

5 years agodoc: Add @cindex to symver attribute
Jakub Jelinek [Tue, 4 Aug 2020 16:16:23 +0000 (18:16 +0200)] 
doc: Add @cindex to symver attribute

When looking at the symver attr documentation in html, I found there is no
name to refer to for it.

2020-08-04  Jakub Jelinek  <jakub@redhat.com>

* doc/extend.texi (symver): Add @cindex for symver function attribute.

(cherry picked from commit 73b7cb6dfcad1b3e7538ddc2b40cc327d2fe501a)

5 years agoaarch64: Mitigate SLS for BLR instruction
Matthew Malcomson [Thu, 9 Jul 2020 08:11:59 +0000 (09:11 +0100)] 
aarch64: Mitigate SLS for BLR instruction

This patch introduces the mitigation for Straight Line Speculation past
the BLR instruction.

This mitigation replaces BLR instructions with a BL to a stub which uses
a BR to jump to the original value.  These function stubs are then
appended with a speculation barrier to ensure no straight line
speculation happens after these jumps.

When optimising for speed we use a set of stubs for each function since
this should help the branch predictor make more accurate predictions
about where a stub should branch.

When optimising for size we use one set of stubs for all functions.
This set of stubs can have human readable names, and we are using
`__call_indirect_x<N>` for register x<N>.

When BTI branch protection is enabled the BLR instruction can jump to a
`BTI c` instruction using any register, while the BR instruction can
only jump to a `BTI c` instruction using the x16 or x17 registers.
Hence, in order to ensure this transformation is safe we mov the value
of the original register into x16 and use x16 for the BR.

As an example when optimising for size:
a
    BLR x0
instruction would get transformed to something like
    BL __call_indirect_x0
where __call_indirect_x0 labels a thunk that contains
__call_indirect_x0:
    MOV X16, X0
    BR X16
    <speculation barrier>

The first version of this patch used local symbols specific to a
compilation unit to try and avoid relocations.
This was mistaken since functions coming from the same compilation unit
can still be in different sections, and the assembler will insert
relocations at jumps between sections.

On any relocation the linker is permitted to emit a veneer to handle
jumps between symbols that are very far apart.  The registers x16 and
x17 may be clobbered by these veneers.
Hence the function stubs cannot rely on the values of x16 and x17 being
the same as just before the function stub is called.

Similar can be said for the hot/cold partitioning of single functions,
so function-local stubs have the same restriction.

This updated version of the patch never emits function stubs for x16 and
x17, and instead forces other registers to be used.

Given the above, there is now no benefit to local symbols (since they
are not enough to avoid dealing with linker intricacies).  This patch
now uses global symbols with hidden visibility each stored in their own
COMDAT section.  This means stubs can be shared between compilation
units while still avoiding the PLT indirection.

This patch also removes the `__call_indirect_x30` stub (and
function-local equivalent) which would simply jump back to the original
location.

The function-local stubs are emitted to the assembly output file in one
chunk, which means we need not add the speculation barrier directly
after each one.
This is because we know for certain that the instructions directly after
the BR in all but the last function stub will be from another one of
these stubs and hence will not contain a speculation gadget.
Instead we add a speculation barrier at the end of the sequence of
stubs.

The global stubs are emitted in COMDAT/.linkonce sections by
themselves so that the linker can remove duplicates from multiple object
files.  This means they are not emitted in one chunk, and each one must
include the speculation barrier.

Another difference is that since the global stubs are shared across
compilation units we do not know that all functions will be targeting an
architecture supporting the SB instruction.
Rather than provide multiple stubs for each architecture, we provide a
stub that will work for all architectures -- using the DSB+ISB barrier.

This mitigation does not apply for BLR instructions in the following
places:
- Some accesses to thread-local variables use a code sequence with a BLR
  instruction.  This code sequence is part of the binary interface between
  compiler and linker. If this BLR instruction needs to be mitigated, it'd
  probably be best to do so in the linker. It seems that the code sequence
  for thread-local variable access is unlikely to lead to a Spectre Revalation
  Gadget.
- PLT stubs are produced by the linker and each contain a BLR instruction.
  It seems that at most only after the last PLT stub a Spectre Revalation
  Gadget might appear.

Testing:
  Bootstrap and regtest on AArch64
    (with BOOT_CFLAGS="-mharden-sls=retbr,blr")
  Used a temporary hack(1) in gcc-dg.exp to use these options on every
  test in the testsuite, a slight modification to emit the speculation
  barrier after every function stub, and a script to check that the
  output never emitted a BLR, or unmitigated BR or RET instruction.
  Similar on an aarch64-none-elf cross-compiler.

1) Temporary hack emitted a speculation barrier at the end of every stub
function, and used a script to ensure that:
  a) Every RET or BR is immediately followed by a speculation barrier.
  b) No BLR instruction is emitted by compiler.

(cherry-picked from 96b7f495f9269d5448822e4fc28882edb35a58d7)

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm):
New declaration.
* config/aarch64/aarch64.c (aarch64_regno_regclass): Handle new
stub registers class.
(aarch64_class_max_nregs): Likewise.
(aarch64_register_move_cost): Likewise.
(aarch64_sls_shared_thunks): Global array to store stub labels.
(aarch64_sls_emit_function_stub): New.
(aarch64_create_blr_label): New.
(aarch64_sls_emit_blr_function_thunks): New.
(aarch64_sls_emit_shared_blr_thunks): New.
(aarch64_asm_file_end): New.
(aarch64_indirect_call_asm): New.
(TARGET_ASM_FILE_END): Use aarch64_asm_file_end.
(TARGET_ASM_FUNCTION_EPILOGUE): Use
aarch64_sls_emit_blr_function_thunks.
* config/aarch64/aarch64.h (STB_REGNUM_P): New.
(enum reg_class): Add STUB_REGS class.
(machine_function): Introduce `call_via` array for
function-local stub labels.
* config/aarch64/aarch64.md (*call_insn, *call_value_insn): Use
aarch64_indirect_call_asm to emit code when hardening BLR
instructions.
* config/aarch64/constraints.md (Ucr): New constraint
representing registers for indirect calls.  Is GENERAL_REGS
usually, and STUB_REGS when hardening BLR instruction against
SLS.
* config/aarch64/predicates.md (aarch64_general_reg): STUB_REGS class
is also a general register.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c: New test.
* gcc.target/aarch64/sls-mitigation/sls-miti-blr.c: New test.

5 years agoaarch64: Introduce SLS mitigation for RET and BR instructions
Matthew Malcomson [Thu, 9 Jul 2020 08:11:59 +0000 (09:11 +0100)] 
aarch64: Introduce SLS mitigation for RET and BR instructions

Instructions following RET or BR are not necessarily executed.  In order
to avoid speculation past RET and BR we can simply append a speculation
barrier.

Since these speculation barriers will not be architecturally executed,
they are not expected to add a high performance penalty.

The speculation barrier is to be SB when targeting architectures which
have this enabled, and DSB SY + ISB otherwise.

We add tests for each of the cases where such an instruction was seen.

This is implemented by modifying each machine description pattern that
emits either a RET or a BR instruction.  We choose not to use something
like `TARGET_ASM_FUNCTION_EPILOGUE` since it does not affect the
`indirect_jump`, `jump`, `sibcall_insn` and `sibcall_value_insn`
patterns and we find it preferable to implement the functionality in the
same way for every pattern.

There is one particular case which is slightly tricky.  The
implementation of TARGET_ASM_TRAMPOLINE_TEMPLATE uses a BR which needs
to be mitigated against.  The trampoline template is used *once* per
compilation unit, and the TRAMPOLINE_SIZE is exposed to the user via the
builtin macro __LIBGCC_TRAMPOLINE_SIZE__.
In the future we may implement function specific attributes to turn on
and off hardening on a per-function basis.
The fixed nature of the trampoline described above implies it will be
safer to ensure this speculation barrier is always used.

Testing:
  Bootstrap and regtest done on aarch64-none-linux
  Used a temporary hack(1) to use these options on every test in the
  testsuite and a script to check that the output never emitted an
  unmitigated RET or BR.

1) Temporary hack was a change to the testsuite to always use
`-save-temps` and run a script on the assembly output of those
compilations which produced one to ensure every RET or BR is immediately
followed by a speculation barrier.

(cherry picked from be178ecd5ac1fe1510d960ff95c66d0ff831afe1)

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch64_sls_barrier): New.
* config/aarch64/aarch64.c (aarch64_output_casesi): Emit
speculation barrier after BR instruction if needs be.
(aarch64_trampoline_init): Handle ptr_mode value & adjust size
of code copied.
(aarch64_sls_barrier): New.
(aarch64_asm_trampoline_template): Add needed barriers.
* config/aarch64/aarch64.h (AARCH64_ISA_SB): New.
(TARGET_SB): New.
(TRAMPOLINE_SIZE): Account for barrier.
* config/aarch64/aarch64.md (indirect_jump, *casesi_dispatch,
simple_return, *do_return, *sibcall_insn, *sibcall_value_insn):
Emit barrier if needs be, also account for possible barrier using
"sls_length" attribute.
(sls_length): New attribute.
(length): Determine default using any non-default sls_length
value.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c: New test.
* gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c:
New test.
* gcc.target/aarch64/sls-mitigation/sls-mitigation.exp: New file.
* lib/target-supports.exp (check_effective_target_aarch64_asm_sb_ok):
New proc.

5 years agoaarch64: New Straight Line Speculation (SLS) mitigation flags
Matthew Malcomson [Thu, 9 Jul 2020 08:11:58 +0000 (09:11 +0100)] 
aarch64: New Straight Line Speculation (SLS) mitigation flags

Here we introduce the flags that will be used for straight line speculation.

The new flag introduced is `-mharden-sls=`.
This flag can take arguments of `none`, `all`, or a comma seperated list of one
or more of `retbr` or `blr`.
`none` indicates no special mitigation of the straight line speculation
vulnerability.
`all` requests all mitigations currently implemented.
`retbr` requests that the RET and BR instructions have a speculation barrier
inserted after them.
`blr` requests that BLR instructions are replaced by a BL to a function stub
using a BR with a speculation barrier after it.

Setting this on a per-function basis using attributes or the like is not
enabled, but may be in the future.

(cherry-picked from a9ba2a9b77bec7eacaf066801f22d1c366a2bc86)

gcc/ChangeLog:

2020-06-02  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/aarch64/aarch64-protos.h (aarch64_harden_sls_retbr_p):
New.
(aarch64_harden_sls_blr_p): New.
* config/aarch64/aarch64.c (enum aarch64_sls_hardening_type):
New.
(aarch64_harden_sls_retbr_p): New.
(aarch64_harden_sls_blr_p): New.
(aarch64_validate_sls_mitigation): New.
(aarch64_override_options): Parse options for SLS mitigation.
* config/aarch64/aarch64.opt (-mharden-sls): New option.
* doc/invoke.texi: Document new option.

5 years agoaarch64: Add missing clobber for fjcvtzs
Andrea Corallo [Wed, 29 Jul 2020 17:04:40 +0000 (19:04 +0200)] 
aarch64: Add missing clobber for fjcvtzs

gcc/ChangeLog

2020-07-30  Andrea Corallo  <andrea.corallo@arm.com>

* config/aarch64/aarch64.md (aarch64_fjcvtzs): Add missing
clobber.
* doc/sourcebuild.texi (aarch64_fjcvtzs_hw) Document new
target supports option.

gcc/testsuite/ChangeLog

2020-07-30  Andrea Corallo  <andrea.corallo@arm.com>

* gcc.target/aarch64/acle/jcvt_2.c: New testcase.
* lib/target-supports.exp
(check_effective_target_aarch64_fjcvtzs_hw): Add new check for
FJCVTZS hw.

(cherry picked from commit d2b86e14c14020f3e119ab8f462e2a91bd7d46e5)

5 years agoveclower: Don't ICE on .VEC_CONVERT calls with no lhs [PR96426]
Jakub Jelinek [Tue, 4 Aug 2020 09:33:18 +0000 (11:33 +0200)] 
veclower: Don't ICE on .VEC_CONVERT calls with no lhs [PR96426]

.VEC_CONVERT is a const internal call, so normally if the lhs is not used,
we'd DCE it far before getting to veclower, but with -O0 (or perhaps
-fno-tree-dce and some other -fno-* options) it can happen.
But as the internal fn needs the lhs to know the type to which the
conversion is done (and I think that is a reasonable representation, having
some magic another argument and having to create constants with that type
looks overkill to me), we just should DCE those calls ourselves.
During veclower, we can't really remove insns, as the callers would be
upset, so this just replaces it with a GIMPLE_NOP.

2020-08-04  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/96426
* tree-vect-generic.c (expand_vector_conversion): Replace .VEC_CONVERT
call with GIMPLE_NOP if there is no lhs.

* gcc.c-torture/compile/pr96426.c: New test.

(cherry picked from commit 95f5a3258dd8a9584f2b10304f79441ef2d4c64c)

5 years agogimple-fold: Fix ICE in maybe_canonicalize_mem_ref_addr on debug stmt [PR96354]
Jakub Jelinek [Tue, 4 Aug 2020 09:31:44 +0000 (11:31 +0200)] 
gimple-fold: Fix ICE in maybe_canonicalize_mem_ref_addr on debug stmt [PR96354]

In debug stmts, we are less strict about what is and what is not accepted
there, so this patch just punts on optimization of a debug stmt rather than
ICEing.

2020-08-04  Jakub Jelinek  <jakub@redhat.com>

PR debug/96354
* gimple-fold.c (maybe_canonicalize_mem_ref_addr): Add IS_DEBUG
argument.  Return false instead of gcc_unreachable if it is true and
get_addr_base_and_unit_offset returns NULL.
(fold_stmt_1) <case GIMPLE_DEBUG>: Adjust caller.

* g++.dg/opt/pr96354.C: New test.

(cherry picked from commit fabe0ede9db9fa95832b2329d3d6156711905e20)

5 years agoDaily bump.
GCC Administrator [Tue, 4 Aug 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agoaarch64: Fix up __aarch64_cas16_acq_rel fallback
Jakub Jelinek [Mon, 3 Aug 2020 20:55:28 +0000 (22:55 +0200)] 
aarch64: Fix up __aarch64_cas16_acq_rel fallback

As mentioned in the PR, the fallback path when LSE is unavailable writes
incorrect registers to the memory if the previous content compares equal
to x0, x1 - it writes copy of x0, x1 from the start of function, but it
should write x2, x3.

2020-08-03  Jakub Jelinek  <jakub@redhat.com>

PR target/96402
* config/aarch64/lse.S (__aarch64_cas16_acq_rel): Use x2, x3 instead
of x(tmp0), x(tmp1) in STXP arguments.

* gcc.target/aarch64/pr96402.c: New test.

(cherry picked from commit 90b43856fdff7d96d93d22970eca8a86c56e0ddc)

5 years agocpp: Do not use @dots for ... tokens in code examples
Jonathan Wakely [Mon, 3 Aug 2020 20:16:50 +0000 (21:16 +0100)] 
cpp: Do not use @dots for ... tokens in code examples

This prevents a ... token in code examples from being turned into a
single HORIZONTAL ELLIPSIS glyph (e.g. via the HTML &hellip; entity).

gcc/ChangeLog:

* doc/cpp.texi (Variadic Macros): Use the exact ... token in
code examples.

(cherry picked from commit 2ac7fe2769890fe4c146da9cfa6d0eabb185d7db)

5 years agotestsuite: Add -Wno-psabi to gcc.dg/pr96377-[12].c
Richard Sandiford [Mon, 3 Aug 2020 15:33:11 +0000 (16:33 +0100)] 
testsuite: Add -Wno-psabi to gcc.dg/pr96377-[12].c

2020-08-03  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
* gcc.dg/pr96377-1.c: Add -Wno-psabi.
* gcc.dg/pr96377-2.c: Likewise.

(cherry picked from commit 401070d8b4e90d4363b6566836c94ec7b6f9c5a2)

5 years agodoc: Add missing comma after octeontx2f95mm
Richard Sandiford [Mon, 3 Aug 2020 13:03:26 +0000 (14:03 +0100)] 
doc: Add missing comma after octeontx2f95mm

gcc/
* doc/invoke.texi: Add missing comma after octeontx2f95mm entry.

(cherry picked from commit 749abaa755faf47968a9d8817deb8de19e685bbc)

5 years agoaarch64: Add A64FX machine model
Qian Jianhua [Mon, 3 Aug 2020 13:03:25 +0000 (14:03 +0100)] 
aarch64: Add A64FX machine model

This patch add support for Fujitsu A64FX, as the first step of adding
A64FX machine model.

A64FX is used in FUJITSU Supercomputer PRIMEHPC FX1000,
PRIMEHPC FX700, and supercomputer Fugaku.
The official microarchitecture information of A64FX can be read at
https://github.com/fujitsu/A64FX.

2020-08-03  Qian jianhua  <qianjh@cn.fujitsu.com>

gcc/
* config/aarch64/aarch64-cores.def (a64fx): New core.
* config/aarch64/aarch64-tune.md: Regenerated.
* config/aarch64/aarch64.c (a64fx_prefetch_tune, a64fx_tunings): New.
* doc/invoke.texi: Add a64fx to the list.

(cherry picked from commit 02f21aea0679c5cac094a3f575e839d44cb57a39)

5 years agoc: Fix bogus vector initialisation error [PR96377]
Richard Sandiford [Mon, 3 Aug 2020 08:48:36 +0000 (09:48 +0100)] 
c: Fix bogus vector initialisation error [PR96377]

One of the problems in this PR was that if we had:

  vector_type1 array[] = { vector_value1 };

process_init_element would only treat vector_value1 as initialising
a vector_type1 if they had the same TYPE_MAIN_VARIANT.  This has
several problems:

(1) It gives confusing error messages if the vector types are
    incompatible.  (Tested by gcc.dg/pr96377-1.c.)

(2) It means that we reject code that should be valid with
    -flax-vector-conversions.  (Tested by gcc.dg/pr96377-2.c.)

(3) On arm and aarch64 targets, it means that we reject some
    initializers that mix Advanced SIMD and standard GNU vectors.
    These vectors have traditionally had different TYPE_MAIN_VARIANTs
    because they have different mangling schemes.  (Tested by
    gcc.dg/pr96377-[3-6].c.)

(4) It means that we reject SVE initializers that should be valid.
    (Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.)

(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject:

      arm_neon_type1 array[] = { k ^ arm_neon_value1 };

    because applying the binary operator to arm_neon_value1 strips
    the "Advanced SIMD type" attributes that were added in that patch.
    Stripping the attributes is problematic for other reasons though,
    so that still needs to be fixed separately.

g++.target/aarch64/sve/gnu_vectors_[34].C already pass.

gcc/c/
PR c/96377
* c-typeck.c (process_init_element): Split test for whether to
recurse into a record, union or array into...
(initialize_elementwise_p): ...this new function.  Don't recurse
into a vector type if the initialization value is also a vector.

gcc/testsuite/
PR c/96377
* gcc.dg/pr96377-1.c: New test.
* gcc.dg/pr96377-2.c: Likewise.
* gcc.dg/pr96377-3.c: Likewise.
* gcc.dg/pr96377-4.c: Likewise.
* gcc.dg/pr96377-5.c: Likewise.
* gcc.dg/pr96377-6.c: Likewise.
* gcc.target/aarch64/pr96377-1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise.

(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae)

5 years agolibsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
Rainer Orth [Mon, 3 Aug 2020 07:45:04 +0000 (09:45 +0200)] 
libsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86

The latest Solaris 11.4/x86 update uncovered a libsanitizer bug that
caused one test to FAIL for 32-bit:

+FAIL: c-c++-common/asan/null-deref-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c -O2 -flto -flto-partition=none
output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -Os  output pattern test

I've identified the problem and the fix has just landed in upstream
llvm-project:

https://reviews.llvm.org/D83664

Tested on i386-pc-solaris2.11 and x86_64-pc-linux.gnu.

libsanitizer:
* sanitizer_common/sanitizer_linux.cpp: Cherry-pick llvm-project
revision f0e9b76c3500496f8f3ea7abe6f4bf801e3b41e7.

5 years agoDaily bump.
GCC Administrator [Mon, 3 Aug 2020 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Sun, 2 Aug 2020 00:16:53 +0000 (00:16 +0000)] 
Daily bump.

5 years agod: Fix ICE in expand_intrinsic_vaarg
Iain Buclaw [Thu, 16 Jul 2020 16:34:18 +0000 (18:34 +0200)] 
d: Fix ICE in expand_intrinsic_vaarg

Both intrinsics did not handle the case where the va_list object comes
from a ref parameter.

gcc/d/ChangeLog:

PR d/96140
* intrinsics.cc (expand_intrinsic_vaarg): Handle ref parameters as
arguments to va_arg().
(expand_intrinsic_vastart): Handle ref parameters as arguments to
va_start().

gcc/testsuite/ChangeLog:

PR d/96140
* gdc.dg/pr96140.d: New test.

(cherry picked from commit dfc420f8d4492dbf5f45df4fecf93cb9645c0d7b)

5 years agoDaily bump.
GCC Administrator [Sat, 1 Aug 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDo not allocate huge array in output_in_order.
Martin Liska [Thu, 30 Jul 2020 07:24:40 +0000 (09:24 +0200)] 
Do not allocate huge array in output_in_order.

We noticed that when analyzing LTRANS memory peak that happens right
after the start:
https://gist.github.com/marxin/223890df4d8d8e490b6b2918b77dacad

In case of chrome, we have symtab->order == 200M, so we allocate
16B * 200M = 3.2GB.

gcc/ChangeLog:

* cgraph.h: Remove leading empty lines.
* cgraphunit.c (enum cgraph_order_sort_kind): Remove
ORDER_UNDEFINED.
(struct cgraph_order_sort): Add constructors.
(cgraph_order_sort::process): New.
(cgraph_order_cmp): New.
(output_in_order): Simplify and push nodes to vector.

(cherry picked from commit 8bd062e8ad44e70be04108232e1ef597fc3b3e3e)

5 years agoDaily bump.
GCC Administrator [Fri, 31 Jul 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agoTune memcpy and memset for Zen cores.
Martin Liska [Mon, 1 Jun 2020 11:21:40 +0000 (13:21 +0200)] 
Tune memcpy and memset for Zen cores.

Based on the collected numbers in PR95435, I suggest the following
tuning changes:

gcc/ChangeLog:

PR target/95435
* config/i386/x86-tune-costs.h: Use libcall for large sizes for
-m32. Start using libcall from 128+ bytes.

(cherry picked from commit dc65aba7a4725d1b464c8c64a5f739ee910e8943)

5 years agoRe-format zen memcpy/memset costs.
Martin Liska [Mon, 1 Jun 2020 09:21:33 +0000 (11:21 +0200)] 
Re-format zen memcpy/memset costs.

The patch improves readability of the memcpy and memset
expansion strategies.

gcc/ChangeLog:

* config/i386/x86-tune-costs.h: Change code formatting.

(cherry picked from commit da346efd27eca48a8fe2e07d7e18b2c77ead0e2d)

5 years agoDaily bump.
GCC Administrator [Thu, 30 Jul 2020 00:16:57 +0000 (00:16 +0000)] 
Daily bump.

5 years agoUpdate gcc ja.po, sv.po.
Joseph Myers [Wed, 29 Jul 2020 19:33:28 +0000 (19:33 +0000)] 
Update gcc ja.po, sv.po.

* ja.po, sv.po: Update.

5 years agopreprocessor: Teach traditional about has_include [PR95889]
Tiziano Müller [Wed, 29 Jul 2020 14:28:23 +0000 (07:28 -0700)] 
preprocessor: Teach traditional about has_include [PR95889]

Traditional cpp (used by fortran) didn;t know about the new
__has_include__ implementation.  Hey, since when did traditional cpp
grow __has_include__? That wasn't in knr!

libcpp/
* init.c (builtin_array): Add xref comment.
* traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
gcc/testsuite/
* c-c++-common/cpp/has-include-1-traditional.c: New.

5 years agoFortran : Don't warn for LOGICAL kind conversion PR96319
Mark Eggleston [Mon, 27 Jul 2020 14:28:50 +0000 (15:28 +0100)] 
Fortran  : Don't warn for LOGICAL kind conversion PR96319

LOGICAL values will always fit regardless of kind so there
is no need for warnings.

2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran/

PR fortran/96319
* intrinsic.c (gfc_convert_type_warn):  Add check for
LOGICAL type so that warnings are not output.

2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/96319
* gfortran.dg/pr96319.f90: New test.

(cherry picked from commit 6af8284719d151087a1c1e4da210cc5a9fa4a478)

5 years agogcc-changelog: fix combining of arguments.
Martin Liska [Wed, 29 Jul 2020 12:13:42 +0000 (14:13 +0200)] 
gcc-changelog: fix combining of arguments.

contrib/ChangeLog:

2020-07-29  Martin Liska  <mliska@suse.cz>

* git-backport.py: fix how are ChangeLog paths combined.

5 years agoopenacc: Deep copy attach/detach should not affect reference counts
Julian Brown [Thu, 18 Jun 2020 12:11:08 +0000 (05:11 -0700)] 
openacc: Deep copy attach/detach should not affect reference counts

Attach and detach operations are not supposed to affect structural or
dynamic reference counts for OpenACC. Previously they did so, which led to
subtle problems in some circumstances. We can avoid reference-counting
attach/detach operations by extending and slightly repurposing the
do_detach field in target_var_desc. It is now called is_attach to better
reflect its new role.

2020-07-27  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
* libgomp.h (struct target_var_desc): Rename do_detach field to
is_attach.
* oacc-mem.c (goacc_exit_datum_1): Add assert.  Don't set finalize for
GOMP_MAP_FORCE_DETACH. Update checking to use is_attach field.
(goacc_enter_data_internal): Don't affect reference counts
for attach mappings.
(goacc_exit_data_internal): Don't affect reference counts for detach
mappings.
* target.c (gomp_map_vars_existing): Don't affect reference counts for
attach mappings.
(gomp_map_vars_internal): Set renamed is_attach flag unconditionally to
mark attach mappings.
(gomp_unmap_vars_internal): Use is_attach flag to prevent affecting
reference count for attach mappings.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Mark
test as shouldfail.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Adjust to fail
gracefully in no-finalize mode.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit bc4ed079dc09a62168699227a794ac52a5b6f6a4)

5 years agoopenacc: Remove unnecessary detach finalization
Julian Brown [Thu, 2 Jul 2020 21:18:20 +0000 (14:18 -0700)] 
openacc: Remove unnecessary detach finalization

The call to gomp_detach_pointer in gomp_unmap_vars_internal does not
need to force finalization, and doing so may mask mismatched pointer
attachments/detachments. This patch removes the forcing.

2020-07-16  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
* target.c (gomp_unmap_vars_internal): Remove unnecessary forcing of
finalization for detach operation.
* testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c:
New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit 25bce75c77ec5617c78173d837d3b664c0f20968)

5 years agocoroutines: Correct frame capture of compiler temps [PR95591+4].
Iain Sandoe [Sun, 19 Jul 2020 17:39:21 +0000 (18:39 +0100)] 
coroutines: Correct frame capture of compiler temps [PR95591+4].

When a full expression contains a co_await (or co_yield), this means
that it might be suspended; which would destroy temporary variables
(on a stack for example).  However the language guarantees that such
temporaries are live until the end of the expression.

In order to preserve this, we 'promote' temporaries where necessary
so that they are saved in the coroutine frame (which allows them to
remain live potentially until the frame is destroyed).  In addition,
sub-expressions that produce control flow (such as TRUTH_AND/OR_IF
or COND_EXPR) must be handled specifically to ensure that await
expressions are properly expanded.

This patch corrects two mistakes in which we were (a) failing to
promote some temporaries and (b) we we failing to sequence DTORs for
the captures properly. This manifests in a number of related (but not
exact duplicate) PRs.

The revised code collects the actions into one place and maps all the
control flow into one form - a benefit of this is that co_returns are
now expanded earlier (which provides an opportunity to address PR95517
in some future patch).

We replace a statement that contains await expression(s) with a bind
scope that has a variable list describing the temporaries that have
been 'promoted' and a statement list that contains a series of cleanup
expressions for each of those.  Where we encounter nested conditional
expressions, these are wrapped in a try-finally block with a guard var
for each sub-expression variable that needs a DTOR.  The guards are all
declared and initialized to false before the first conditional sub-
expression.  The 'finally' block contains a series of if blocks (one
per guard variable) enclosing the relevant DTOR.

Variables listed in a bind scope in this manner are automatically moved
to a coroutine frame version by existing code (so we re-use that rather
than having a separate mechanism).

gcc/cp/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* coroutines.cc (struct coro_ret_data): Delete.
(coro_maybe_expand_co_return): Delete.
(co_return_expander): Delete.
(expand_co_returns): Delete.
(co_await_find_in_subtree): Remove unused name.
(build_actor_fn): Remove unused parm, remove handling
for co_return expansion.
(register_await_info): Demote duplicate info message to a
warning.
(coro_make_frame_entry): Move closer to use site.
(struct susp_frame_data): Add fields for final suspend label
and a flag to indicate await expressions with initializers.
(captures_temporary): Delete.
(register_awaits): Remove unused code, update comments.
(find_any_await): New.
(tmp_target_expr_p): New.
(struct interesting): New.
(find_interesting_subtree): New.
(struct var_nest_node): New.
(flatten_await_stmt): New.
(handle_nested_conditionals): New.
(process_conditional): New.
(replace_statement_captures): Rename to...
(maybe_promote_temps): ... this.
(maybe_promote_captured_temps): Delete.
(analyze_expression_awaits): Check for await expressions with
initializers.  Simplify handling for truth-and/or-if.
(expand_one_truth_if): Simplify (map cases that need expansion
to COND_EXPR).
(await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
handling for truth-and/or-if expressions.
(register_local_var_uses): Ensure that we create names in the
implementation namespace.
(morph_fn_to_coro): Add final suspend label to suspend frame
callback data and remove it from the build_actor_fn call.

gcc/testsuite/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* g++.dg/coroutines/pr95591.C: New test.
* g++.dg/coroutines/pr95599.C: New test.
* g++.dg/coroutines/pr95823.C: New test.
* g++.dg/coroutines/pr95824.C: New test.

(cherry picked from commit 0f66b8486cea8668020e4bd48f261b760cb579be)

5 years agocoroutines: co_returns are statements, not expressions.
Iain Sandoe [Sun, 26 Jul 2020 14:09:39 +0000 (15:09 +0100)] 
coroutines: co_returns are statements, not expressions.

This corrects an error in the CO_RETURN_EXPR tree
class.

gcc/cp/ChangeLog:

* cp-tree.def (CO_RETURN_EXPR): Correct the class
to use tcc_statement.

(cherry picked from commit 608832716e27ca356ee38d14ae30b3ab525884ea)

5 years agoDaily bump.
GCC Administrator [Wed, 29 Jul 2020 00:16:54 +0000 (00:16 +0000)] 
Daily bump.

5 years agoexpr: build string_constant only for a char type
Martin Liska [Mon, 27 Jul 2020 10:30:24 +0000 (12:30 +0200)] 
expr: build string_constant only for a char type

gcc/ChangeLog:

PR tree-optimization/96058
* expr.c (string_constant): Build string_constant only
for a type that has same precision as char_type_node
and is an integral type.

(cherry picked from commit 7355a9408b990cdd20db91e2e1ba0b03e801d6a6)

5 years agoexpander: Fix ICE in maybe_warn_rdwr_sizes [PR96335]
Jakub Jelinek [Tue, 28 Jul 2020 09:08:29 +0000 (11:08 +0200)] 
expander: Fix ICE in maybe_warn_rdwr_sizes [PR96335]

The following testcase ICEs in maybe_warn_rdwr_sizes.  The problem is that
the caller uses its fndecl and fntype variables to fill up rdwr_map, and
the fntype in that case is a prototype with the access attribute and all
the checks needed for that performed.  But the maybe_warn_rdwr_sizes
function tries to rediscover fndecl/fntype itself and does it differently
from how the caller did (for fndecl get_callee_fndecl and fntype from that
FUNCTION_DECL, otherwise sets fntype to CALL_EXPR_FN's type).

On the testcase, get_callee_fndecl does find a FUNCTION_DECL because
it does STRIP_NOPS in between.

Instead of trying to rediscover those, this patch just passes them down,
like is done in several other functions.

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

PR middle-end/96335
* calls.c (maybe_warn_rdwr_sizes): Add FNDECL and FNTYPE arguments,
instead of trying to rediscover them in the body.
(initialize_argument_information): Adjust caller.

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

(cherry picked from commit f9264b9008386ac3b5c795472c222fa524b127b0)

5 years agoDaily bump.
GCC Administrator [Tue, 28 Jul 2020 00:17:01 +0000 (00:17 +0000)] 
Daily bump.

5 years agoUpdate gcc .po files.
Joseph Myers [Mon, 27 Jul 2020 22:53:40 +0000 (22:53 +0000)] 
Update gcc .po files.

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

5 years agoAllow --with-cpu=power10
Aaron Sawdey [Tue, 23 Jun 2020 18:12:52 +0000 (13:12 -0500)] 
Allow --with-cpu=power10

Update config.gcc so that we can use --with-cpu=power10.
Also remove "future" from the 64-bit check as Segher suggests.

* config.gcc: Identify power10 as a 64-bit processor and as valid
for --with-cpu and --with-tune.

(cherry picked from commit 71237df0a0b7f0f10cebedcd114fae7ad2aaebcb)

5 years agoUse vec::reserve before vec_safe_grow_cleared is called
Martin Liska [Fri, 24 Jul 2020 12:33:27 +0000 (14:33 +0200)] 
Use vec::reserve before vec_safe_grow_cleared is called

gcc/ChangeLog:

PR lto/45375
* symbol-summary.h: Call vec_safe_reserve before grow is called
in order to grow to a reasonable size.
* vec.h (vec_safe_reserve): Add missing function for vl_ptr
type.

(cherry picked from commit 7f5c0f328eced560a204bb8e3eae0d45795dd235)

5 years agoFortran : ICE in gfc_check_pointer_assign PR95612
Mark Eggleston [Thu, 11 Jun 2020 10:05:40 +0000 (11:05 +0100)] 
Fortran  : ICE in gfc_check_pointer_assign PR95612

Output an error if the right hand value is a zero sized array or
does not have a symbol tree otherwise continue checking.

2020-07-27  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95612
* expr.c (gfc_check_pointer_assigb): Output an error if
rvalue is a zero sized array or output an error if rvalue
doesn't have a symbol tree.

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

gcc/testsuite/

PR fortran/95612
* gfortran.dg/pr95612.f90: New test.

(cherry picked from commit 81072bab8d1e48ee83d9711dcb559ea1e019b351)

5 years agoDaily bump.
GCC Administrator [Mon, 27 Jul 2020 00:16:54 +0000 (00:16 +0000)] 
Daily bump.

5 years agoFortran : ICE in gfc_check_reshape PR95585
Mark Eggleston [Thu, 11 Jun 2020 05:42:36 +0000 (06:42 +0100)] 
Fortran  : ICE in gfc_check_reshape PR95585

Issue an error where an array is used before its definition
instead of an ICE.

2020-07-26  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95585
* check.c (gfc_check_reshape): Add check for a value when
the symbol has an attribute flavor FL_PARAMETER.

2020-07-26  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95585
* gfortran.dg/pr95585.f90: New test.

(cherry picked from commit d9aed5f1ccffc019ddf980e349caa3d092755cb4)

5 years agoDaily bump.
GCC Administrator [Sun, 26 Jul 2020 00:16:51 +0000 (00:16 +0000)] 
Daily bump.

5 years agoPR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.
Dominique d'Humieres [Fri, 24 Jul 2020 18:27:53 +0000 (20:27 +0200)] 
PR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.

The switch between FMT_E and FMT_F is based on the absolute value.
Set r=0 for rounding toward zero and r = 1 otherwise.
If (exp_d - m) == 1 there is no rounding needed.

libgfortran/ChangeLog:

PR fortran/93567
* io/write_float.def (determine_en_precision): Fix switch between
FMT_E and FMT_F.

gcc/testsuite/ChangeLog:

PR fortran/93567
* gfortran.dg/round_3.f08: Add test cases.

(cherry picked from commit aa7e7eff5ec165dc8463a0e74309801b15d1feda)

5 years agoPR 93592 - Invalid UP/DOWN rounding with EN descriptor.
Dominique d'Humieres [Fri, 24 Jul 2020 18:07:12 +0000 (20:07 +0200)] 
PR 93592 - Invalid UP/DOWN rounding with EN descriptor.

The fix is obvious (I have added a comment). The tests are probably
an overkill, but it does not hurt.

libgfortran/ChangeLog:

PR fortran/93592
* io/write_float.def (build_float_string): Do not reset
  nbefore for FMT_F and FMT_EN.

gcc/testsuite/ChangeLog:

PR fortran/93592
* gfortran.dg/fmt_en.f90: Adjust test.
* gfortran.dg/fmt_en_rd.f90: New test.
* gfortran.dg/fmt_en_rn.f90: New test.
* gfortran.dg/fmt_en_ru.f90: New test.
* gfortran.dg/fmt_en_rz.f90: New test.

(cherry picked from commit 05e0971bcf94a481cbfa2731484f024a67dbd4a5)

5 years agoDaily bump.
GCC Administrator [Sat, 25 Jul 2020 00:16:54 +0000 (00:16 +0000)] 
Daily bump.

5 years agolibgo: update to Go 1.14.6 release
Ian Lance Taylor [Fri, 17 Jul 2020 19:30:51 +0000 (12:30 -0700)] 
libgo: update to Go 1.14.6 release

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/243317

5 years agoDaily bump.
GCC Administrator [Fri, 24 Jul 2020 00:16:57 +0000 (00:16 +0000)] 
Daily bump.

5 years agosparc/sparc64: use crtendS.o for default-pie executables [PR96190]
Sergei Trofimovich [Thu, 23 Jul 2020 22:58:35 +0000 (23:58 +0100)] 
sparc/sparc64: use crtendS.o for default-pie executables [PR96190]

In --enable-default-pie mode compiler should switch from
using crtend.o to crtendS.o. On sparc it is especially important
because crtend.o contains PIC-unfriendly code.

We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get
crtendS.o instead of crtend.o in !no-pie mode.

gcc:

2020-07-14  Sergei Trofimovich  <siarheit@google.com>

PR target/96190
* config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC
to get crtendS.o for !no-pie mode.
* config/sparc/linux64.h (ENDFILE_SPEC): Ditto.

(cherry picked from commit 87891d5eafe8d1de90b9d9b056eca81c508d1c77)

5 years agoPR fortran/95980 - ICE in get_unique_type_string, at fortran/class.c:485
Harald Anlauf [Fri, 10 Jul 2020 19:35:35 +0000 (21:35 +0200)] 
PR fortran/95980 - ICE in get_unique_type_string, at fortran/class.c:485

In SELECT TYPE, the argument may be an incorrectly specified unlimited
CLASS variable.  Avoid NULL pointer dereferences for clean error
recovery.

gcc/fortran/
PR fortran/95980
* class.c (gfc_add_component_ref, gfc_build_class_symbol):
Add checks for NULL pointer dereference.
* primary.c (gfc_variable_attr): Likewise.
* resolve.c (resolve_variable, resolve_assoc_var)
(resolve_fl_var_and_proc, resolve_fl_variable_derived)
(resolve_symbol): Likewise.

(cherry picked from commit 70c884a4b82733027ac0e2620d09169b177080d7)

5 years agoPR fortran/95980 - ICE on using sync images with -fcheck=bounds
Harald Anlauf [Mon, 6 Jul 2020 16:58:23 +0000 (18:58 +0200)] 
PR fortran/95980 - ICE on using sync images with -fcheck=bounds

In SELECT TYPE, the argument may be an incorrectly specified unlimited
polymorphic variable.  Avoid a NULL pointer dereference for clean error
recovery.

gcc/fortran/
PR fortran/95980
* match.c (copy_ts_from_selector_to_associate, build_class_sym):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.
* resolve.c (resolve_select_type):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.

(cherry picked from commit f2151227dfe90a5fe73297c370786be98b0b090f)

5 years agoPR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645
Harald Anlauf [Fri, 10 Jul 2020 19:00:13 +0000 (21:00 +0200)] 
PR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645

Handle NULL pointer dereference on SELECT RANK with an invalid
assumed-rank array declaration.

gcc/fortran/
PR fortran/96086
* match.c (gfc_match_select_rank): Catch NULL pointer
dereference.
* resolve.c (resolve_assoc_var): Catch NULL pointer dereference
that may occur after an illegal declaration.

(cherry picked from commit 8a0b69f0b089c05d233b8e1a941825b1ceac93bd)

5 years agoPR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792
Harald Anlauf [Tue, 21 Jul 2020 19:37:30 +0000 (21:37 +0200)] 
PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792

When checking for an external procedure from the same file, do not
consider symbols from different modules.

gcc/fortran/
PR fortran/89574
* trans-decl.c (gfc_get_extern_function_decl): Check whether a
symbol belongs to a different module.

(cherry picked from commit 28f2a080cc27531a8c78aec9f44aeff4961c2a4c)

5 years agors6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode
Peter Bergner [Wed, 22 Jul 2020 16:44:35 +0000 (11:44 -0500)] 
rs6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode

PR96236 shows a problem where we don't correctly store our 512-bit accumulators
correctly in little-endian mode.  The patch below detects when we're doing a
little-endian memory access and stores to the correct memory locations.

2020-07-22  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96236
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Handle
little-endian memory ordering.

gcc/testsuite/
PR target/96236
* gcc.target/powerpc/mma-double-test.c: Update storing results for
correct little-endian ordering.
* gcc.target/powerpc/mma-single-test.c: Likewise.

(cherry picked from commit ae575662833d70cb7d74b9538096c7becc79af14)

5 years agoAlways use name from c_interop_kinds_table for -fc-prototypes.
Thomas Koenig [Sun, 19 Jul 2020 15:27:45 +0000 (17:27 +0200)] 
Always use name from c_interop_kinds_table for -fc-prototypes.

When a user specified a KIND that was a parameter taking the value
of an iso_c_binding KIND, the code used the name of that parameter
to look up the type name.  Corrected by always looking it up in
the table of C interop kinds (which was previously done for
non-C-interop types, anyway).

gcc/fortran/ChangeLog:

PR fortran/96220
* dump-parse-tree.c (get_c_type_name): Always use the entries from
c_interop_kinds_table to find the correct C type.

(cherry picked from commit 2e1b25350aa96b3f5678a056d0b55bb323c452d9)

5 years agoFix handling of implicit_pure by checking if non-pure procedures are called.
Thomas Koenig [Thu, 23 Jul 2020 15:56:09 +0000 (17:56 +0200)] 
Fix handling of implicit_pure by checking if non-pure procedures are called.

Procedures are marked as implicit_pure if they fulfill the criteria of
pure procedures.  In this case, a procedure was not marked as not being
implicit_pure which called another procedure, which had not yet been
marked as not being implicit_impure.

Fixed by iterating over all procedures, setting callers of procedures
which are non-pure and non-implicit_pure as non-implicit_pure and
doing this until no more procedure has been changed.

Backport from trunk r11-2215-g3055d879edb1bc2a3923f92a5e681c8f6774fbc3 .

gcc/fortran/ChangeLog:

2020-07-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/96018
* frontend-passes.c (gfc_check_externals): Adjust formatting.
(implicit_pure_call): New function.
(implicit_pure_expr): New function.
(gfc_fix_implicit_pure): New function.
* gfortran.h (gfc_fix_implicit_pure): New prototype.
* parse.c (translate_all_program_units): Call gfc_fix_implicit_pure.

5 years agogcc-changelog: fix when somebody reverts a backport
Martin Liska [Thu, 23 Jul 2020 08:39:00 +0000 (10:39 +0200)] 
gcc-changelog: fix when somebody reverts a backport

contrib/ChangeLog:

* gcc-changelog/git_commit.py: When reverting a backport,
we should print only Revert header.

(cherry picked from commit 02cada26e4783b4bfeaf6512a6c22df24d7a25fc)

5 years agogcc-changelog: Fix typo in output
Jonathan Wakely [Fri, 17 Jul 2020 08:53:19 +0000 (09:53 +0100)] 
gcc-changelog: Fix typo in output

contrib/ChangeLog:

* gcc-changelog/git_update_version.py: Fix typo.

(cherry picked from commit 0c1d1c01039a96c191a7aded40e5df40b14d387a)

5 years agoFix ChangeLog entry: reverted backport commit.
Martin Liska [Thu, 23 Jul 2020 08:45:47 +0000 (10:45 +0200)] 
Fix ChangeLog entry: reverted backport commit.

5 years agoPR target/96260 - KASAN should work even back-end not porting anything.
Kito Cheng [Wed, 22 Jul 2020 06:50:40 +0000 (14:50 +0800)] 
PR target/96260 - KASAN should work even back-end not porting anything.

 - Most KASAN function don't need any porting anything in back-end
   except asan stack protection.

 - However kernel will given shadow offset when enable asan stack
   protection, so eveything in KASAN can work if shadow offset is given.

 - Verified with x86 and risc-v.

 - Verified with RISC-V linux kernel.

gcc/ChangeLog:

PR target/96260
* asan.c (asan_shadow_offset_set_p): New.
* asan.h (asan_shadow_offset_set_p): Ditto.
* toplev.c (process_options): Allow -fsanitize=kernel-address
even TARGET_ASAN_SHADOW_OFFSET not implemented, only check when
asan stack protection is enabled.

gcc/testsuite/ChangeLog:

PR target/96260
* gcc.target/riscv/pr91441.c: Update warning message.
* gcc.target/riscv/pr96260.c: New.

(cherry picked from commit 2ca1b6d009b194286c3ec91f9c51cc6b0a475458)

5 years agoUpdate BASE-VER after GCC 10.2 release
Richard Biener [Thu, 23 Jul 2020 06:42:42 +0000 (08:42 +0200)] 
Update BASE-VER after GCC 10.2 release

2020-07-23  Richard Biener  <rguenther@suse.de>

* BASE-VER: Set to 10.2.1.

5 years agoUpdate ChangeLog and version files for release releases/gcc-10.2.0
Richard Biener [Thu, 23 Jul 2020 06:35:38 +0000 (06:35 +0000)] 
Update ChangeLog and version files for release