From 949e0ad4b7b69dcc18691b09667565669763b6a3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 18 Sep 2020 00:16:57 +0000 Subject: [PATCH 01/44] Daily bump. --- gcc/ChangeLog | 15 +++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 12 ++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d66171228101..f55863a5fdb9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2020-09-17 Marek Polacek + + Backported from master: + 2020-09-16 Marek Polacek + + PR preprocessor/96935 + * input.c (get_substring_ranges_for_loc): Return if start.column + is less than 1. + +2020-09-17 liuhongt + + * common/config/i386/i386-common.c + (OPTION_MASK_ISA_AVX_UNSET): Remove OPTION_MASK_ISA_XSAVE_UNSET. + (OPTION_MASK_ISA_XSAVE_UNSET): Add OPTION_MASK_ISA_AVX_UNSET. + 2020-09-16 Jakub Jelinek Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fae3fa1fac63..1900f8394ad4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200917 +20200918 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c68157929fe..23360f09918d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2020-09-17 Marek Polacek + + Backported from master: + 2020-09-16 Marek Polacek + + PR preprocessor/96935 + * gcc.dg/format/pr96935.c: New test. + +2020-09-17 liuhongt + + * gcc.target/i386/xsave-avx-1.c: New test. + 2020-09-16 Jakub Jelinek Backported from master: From ce2c9b341df267ce2ab86815ba957bce9935f7bb Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Thu, 2 Jul 2020 20:48:16 +0200 Subject: [PATCH 02/44] PR fortran/93423 - ICE on invalid with argument list for module procedure When recovering from an error, a NULL pointer dereference could occur. Check for that situation and punt. gcc/fortran/ PR fortran/93423 * resolve.c (resolve_symbol): Avoid NULL pointer dereference. (cherry picked from commit b88744905a46be44ffa3c57d46080f601ae832b8) --- gcc/fortran/resolve.c | 2 +- gcc/testsuite/gfortran.dg/pr93423.f90 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr93423.f90 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c650096df6d6..ce86d4822f58 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -15929,7 +15929,7 @@ resolve_symbol (gfc_symbol *sym) if (formal) { sym->formal_ns = formal->sym->ns; - if (sym->ns != formal->sym->ns) + if (sym->formal_ns && sym->ns != formal->sym->ns) sym->formal_ns->refs++; } } diff --git a/gcc/testsuite/gfortran.dg/pr93423.f90 b/gcc/testsuite/gfortran.dg/pr93423.f90 new file mode 100644 index 000000000000..fed5914daba8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93423.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! PR fortran/93423 - ICE on invalid with argument list for module procedure + +module t + type :: b + contains + procedure :: p => bp + end type b + interface + module function bp(s) + class(b), intent(inout) :: s + integer, pointer :: bp + end function + end interface +end module t + +submodule (t) ts +contains + module procedure bp(s) ! { dg-error "must be in a generic module interface" } + end procedure bp ! { dg-error "Expecting END SUBMODULE statement" } +end submodule ts From 13421890f81844acb134a460eda7132db3e504ed Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Thu, 17 Sep 2020 14:01:09 +0200 Subject: [PATCH 03/44] Fortran: Avoid double-free with parse error (PR96041, PR93423) gcc/fortran/ PR fortran/96041 PR fortran/93423 * decl.c (gfc_match_submod_proc): Avoid later double-free in the error case. (cherry picked from commit c12facd22881517127ebbe213d7ecc7fc1fcea4e) --- gcc/fortran/decl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e6c500bf8d21..c1a15f1a84ae 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -9801,6 +9801,15 @@ gfc_match_submod_proc (void) if (gfc_match_eos () != MATCH_YES) { + /* Unset st->n.sym. Note: in reject_statement (), the symbol changes are + undone, such that the st->n.sym->formal points to the original symbol; + if now this namespace is finalized, the formal namespace is freed, + but it might be still needed in the parent namespace. */ + gfc_symtree *st = gfc_find_symtree (gfc_current_ns->sym_root, sym->name); + st->n.sym = NULL; + gfc_free_symbol (sym->tlink); + sym->tlink = NULL; + sym->refs--; gfc_syntax_error (ST_MODULE_PROC); return MATCH_ERROR; } From e939674db6fda62a98675d20b95175ec4ba81140 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 19 Sep 2020 00:17:02 +0000 Subject: [PATCH 04/44] Daily bump. --- gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 18 ++++++++++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1900f8394ad4..795f43e0fdb7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200918 +20200919 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5ee063bc0c90..23282d3545e7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,21 @@ +2020-09-18 Tobias Burnus + + Backported from master: + 2020-09-17 Tobias Burnus + + PR fortran/96041 + PR fortran/93423 + * decl.c (gfc_match_submod_proc): Avoid later double-free + in the error case. + +2020-09-18 Harald Anlauf + + Backported from master: + 2020-07-02 Harald Anlauf + + PR fortran/93423 + * resolve.c (resolve_symbol): Avoid NULL pointer dereference. + 2020-09-11 Jakub Jelinek Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23360f09918d..5b841c5877ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-09-18 Harald Anlauf + + Backported from master: + 2020-07-02 Harald Anlauf + + PR fortran/93423 + * gfortran.dg/pr93423.f90: New file. + 2020-09-17 Marek Polacek Backported from master: From 7859e07241bd6c8ffdea94a0e54ec24df3424501 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 20 Sep 2020 00:16:56 +0000 Subject: [PATCH 05/44] Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 795f43e0fdb7..2225e4604f0f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200919 +20200920 From 99b8d686333ba972dab214da35b8cd5e0993fa72 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sun, 20 Sep 2020 19:39:42 +0000 Subject: [PATCH 06/44] Fix linkage with -nodefaultlibs option. 2020-09-20 John David Anglin < danglin@gcc.gnu.org> gcc/ChangeLog * config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Delete. * config/pa/pa64-hpux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. (ENDFILE_SPEC): Link with libgcc_stub.a and mill.a. * config/pa/pa32-linux.h (ENDFILE_SPEC): Link with libgcc.a. --- gcc/config/pa/pa-hpux11.h | 5 ----- gcc/config/pa/pa32-linux.h | 5 +++++ gcc/config/pa/pa64-hpux.h | 12 +++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h index 794bf8e29640..28207202e424 100644 --- a/gcc/config/pa/pa-hpux11.h +++ b/gcc/config/pa/pa-hpux11.h @@ -154,11 +154,6 @@ along with GCC; see the file COPYING3. If not see %{!mt:%{!pthread:-a shared -lc -a archive}}}}\ %{shared:%{mt|pthread:-lpthread}}" -/* The libgcc_stub.a library needs to come last. */ -#undef LINK_GCC_C_SEQUENCE_SPEC -#define LINK_GCC_C_SEQUENCE_SPEC \ - "%G %{!nolibc:%L} %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}}}" - #undef STARTFILE_SPEC #define STARTFILE_SPEC \ "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \ diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h index f271bbf51a25..970722ad528c 100644 --- a/gcc/config/pa/pa32-linux.h +++ b/gcc/config/pa/pa32-linux.h @@ -57,6 +57,11 @@ call_ ## FUNC (void) \ } #endif +/* We need to link against libgcc.a for __canonicalize_funcptr_for_compare + and $$dyncall. */ +#undef ENDFILE_SPEC +#define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC "libgcc.a%s" + #undef WCHAR_TYPE #define WCHAR_TYPE "long int" diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h index c7d127f76ace..096aa4bd4ee9 100644 --- a/gcc/config/pa/pa64-hpux.h +++ b/gcc/config/pa/pa64-hpux.h @@ -103,12 +103,6 @@ along with GCC; see the file COPYING3. If not see %{shared:%{mt|pthread:-lpthread}}" #endif -/* The libgcc_stub.a and milli.a libraries need to come last. */ -#undef LINK_GCC_C_SEQUENCE_SPEC -#define LINK_GCC_C_SEQUENCE_SPEC "\ - %G %{!nolibc:%L} %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}\ - milli.a%s}}" - /* Under hpux11, the normal location of the `ld' and `as' programs is the /usr/ccs/bin directory. */ @@ -335,8 +329,12 @@ do { \ %{static:crtbeginT%O%s} %{!static:%{!shared:crtbegin%O%s} \ %{shared:crtbeginS%O%s}}" #endif + +/* The libgcc_stub.a and milli.a libraries must come last. We need + to link with these libraries whenever start files are needed. */ #undef ENDFILE_SPEC -#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" +#define ENDFILE_SPEC \ + "%{!shared:crtend%O%s libgcc_stub.a%s} %{shared:crtendS%O%s} milli.a%s" /* Since HP uses the .init and .fini sections for array initializers and finalizers, we need different defines for INIT_SECTION_ASM_OP From 1af379f689eb1095abe8dcf33d9dead331c0b826 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 21 Sep 2020 00:17:01 +0000 Subject: [PATCH 07/44] Daily bump. --- gcc/ChangeLog | 7 +++++++ gcc/DATESTAMP | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f55863a5fdb9..cd7365604160 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2020-09-20 John David Anglin < danglin@gcc.gnu.org> + + * config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Delete. + * config/pa/pa64-hpux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. + (ENDFILE_SPEC): Link with libgcc_stub.a and mill.a. + * config/pa/pa32-linux.h (ENDFILE_SPEC): Link with libgcc.a. + 2020-09-17 Marek Polacek Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2225e4604f0f..fb22edf35a9d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200920 +20200921 From 9ae110d4f8edd61cf56ee5fea62cadc8e781e8dc Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 10 Sep 2020 15:39:15 +0100 Subject: [PATCH 08/44] libstdc++: handle small max_blocks_per_chunk in pool resources [PR 94160] When a pool resource is constructed with max_blocks_per_chunk=1 it ends up creating a pool with blocks_per_chunk=0 which means it never allocates anything. Instead it returns null pointers, which should be impossible. To avoid this problem, round the max_blocks_per_chunk value to a multiple of four, so it's never smaller than four. libstdc++-v3/ChangeLog: PR libstdc++/94160 * src/c++17/memory_resource.cc (munge_options): Round max_blocks_per_chunk to a multiple of four. (__pool_resource::_M_alloc_pools()): Simplify slightly. * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Check that valid pointers are returned when small values are used for max_blocks_per_chunk. (cherry picked from commit 30b41cfbb2dade63e52465234a725d1d02fe70aa) --- libstdc++-v3/src/c++17/memory_resource.cc | 21 +++++++++++++------ .../unsynchronized_pool_resource/allocate.cc | 20 ++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc index 95352b235378..75ae24e0a062 100644 --- a/libstdc++-v3/src/c++17/memory_resource.cc +++ b/libstdc++-v3/src/c++17/memory_resource.cc @@ -873,7 +873,18 @@ namespace pmr } else { - // TODO round to preferred granularity ? + // Round to preferred granularity. + if (opts.max_blocks_per_chunk < size_t(-4)) + { + // round up + opts.max_blocks_per_chunk += 3; + opts.max_blocks_per_chunk &= ~size_t(3); + } + else + { + // round down + opts.max_blocks_per_chunk &= ~size_t(3); + } } if (opts.max_blocks_per_chunk > chunk::max_blocks_per_chunk()) @@ -1013,11 +1024,9 @@ namespace pmr : pool_sizes[i]; // Decide on initial number of blocks per chunk. - // Always have at least 16 blocks per chunk: - const size_t min_blocks_per_chunk = 16; - // But for smaller blocks, use a larger initial size: - size_t blocks_per_chunk - = std::max(1024 / block_size, min_blocks_per_chunk); + // At least 16 blocks per chunk seems reasonable, + // more for smaller blocks: + size_t blocks_per_chunk = std::max(size_t(16), 1024 / block_size); // But don't exceed the requested max_blocks_per_chunk: blocks_per_chunk = std::min(blocks_per_chunk, _M_opts.max_blocks_per_chunk); diff --git a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc index 5bf20cf262c0..ef5f921211de 100644 --- a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc +++ b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc @@ -239,6 +239,25 @@ test06() } } +void +test08() +{ + std::pmr::pool_options opts; + opts.largest_required_pool_block = 64; + + // PR libstdc++/94160 + // max_blocks_per_chunk=1 causes pool resources to return null pointers + for (int i = 0; i < 8; ++i) + { + opts.max_blocks_per_chunk = i; + std::pmr::unsynchronized_pool_resource upr(opts); + auto* p = (int*)upr.allocate(4); + VERIFY( p != nullptr ); + *p = i; + upr.deallocate(p, 4); + } +} + int main() { @@ -248,4 +267,5 @@ main() test04(); test05(); test06(); + test08(); } From b59b9cb483462624b9301e52272760b506458a17 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 21 Sep 2020 12:45:43 -0700 Subject: [PATCH 09/44] libgo: don't put golang.org packages in zstdpkglist.go This ensures that internal/goroot.IsStandardPackage does not treat golang.org packages as being in the standard library. For golang/go#41368 Fixes golang/go#41499 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/256319 --- libgo/Makefile.am | 2 +- libgo/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libgo/Makefile.am b/libgo/Makefile.am index dea09de592be..41b6da4cb0b2 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -614,7 +614,7 @@ s-zstdpkglist: Makefile echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 607b88c58781..020d6e6ccce9 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -2743,7 +2743,7 @@ s-zstdpkglist: Makefile echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ From 8db568c3c6c3ca1c540198725e7490b819167209 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 21 Sep 2020 00:17:02 +0100 Subject: [PATCH 10/44] libstdc++: Fix noexcept-specifier for std::bind_front [PR 97101] libstdc++-v3/ChangeLog: PR libstdc++/97101 * include/std/functional (bind_front): Fix order of parameters in is_nothrow_constructible_v specialization. * testsuite/20_util/function_objects/bind_front/97101.cc: New test. (cherry picked from commit 3c755b428e188228d0bad90625c995fd25a02322) --- libstdc++-v3/include/std/functional | 4 +- .../function_objects/bind_front/97101.cc | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/function_objects/bind_front/97101.cc diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 2a9b2a003dbb..dc21c10b7ad8 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -905,8 +905,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template constexpr _Bind_front_t<_Fn, _Args...> bind_front(_Fn&& __fn, _Args&&... __args) - noexcept(is_nothrow_constructible_v, - _Fn, _Args...>) + noexcept(is_nothrow_constructible_v<_Bind_front_t<_Fn, _Args...>, + int, _Fn, _Args...>) { return _Bind_front_t<_Fn, _Args...>(0, std::forward<_Fn>(__fn), std::forward<_Args>(__args)...); diff --git a/libstdc++-v3/testsuite/20_util/function_objects/bind_front/97101.cc b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/97101.cc new file mode 100644 index 000000000000..b159eb025917 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/97101.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include + +void +test01() +{ + struct F1 + { + void operator()() { } + }; + + struct F2 + { + F2() = default; + F2(const F2&) noexcept(false) { } + void operator()() { } + }; + + // PR libstdc++/97101 + static_assert( noexcept(std::bind_front(F1{})) ); + static_assert( ! noexcept(std::bind_front(F2{})) ); +} From 4e00119c780f9bcd33181db4580754522f64c60e Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 10 Aug 2020 13:21:59 +0100 Subject: [PATCH 11/44] libstdc++: Make C++17 ignore --disable-libstdcxx-filesystem-ts [PR 94681] The configure switch should only affect the optional Filesystem TS, not the std::filesystem features of C++17. libstdc++-v3/ChangeLog: PR libstdc++/94681 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on $enable_libstdcxx_filesystem_ts. * configure: Regenerate. (cherry picked from commit 90f7636bf8df50940e0f749af60a6b374a8f09b4) --- libstdc++-v3/acinclude.m4 | 437 +++++++++++++++++++------------------- libstdc++-v3/configure | 282 ++++++++++++------------ 2 files changed, 358 insertions(+), 361 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index ee5e0336f2c3..55e9e6061c25 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4536,7 +4536,8 @@ AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [ ]) dnl -dnl Check whether the library calls required by the Filesystem TS are present. +dnl Check whether the library calls required by the C++17 Filesystem library +dnl and the Filesystem TS are present. dnl Defines: dnl HAVE_STRUCT_DIRENT_D_TYPE dnl _GLIBCXX_USE_REALPATH @@ -4551,226 +4552,224 @@ dnl HAVE_SYMLINK dnl AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl dnl - if test $enable_libstdcxx_filesystem_ts = yes; then - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -fno-exceptions" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions" dnl - AC_MSG_CHECKING([for struct dirent.d_type]) - AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [ - struct dirent d; - if (sizeof d.d_type) return 0; - ], - [glibcxx_cv_dirent_d_type=yes], - [glibcxx_cv_dirent_d_type=no]) - ]) - if test $glibcxx_cv_dirent_d_type = yes; then - AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.]) - fi - AC_MSG_RESULT($glibcxx_cv_dirent_d_type) -dnl - AC_MSG_CHECKING([for realpath]) - AC_CACHE_VAL(glibcxx_cv_realpath, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ - #include - #include - #include - ], - [ - #if _XOPEN_VERSION < 500 - #error - #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) - char *tmp = realpath((const char*)NULL, (char*)NULL); - #else - #error - #endif - ], - [glibcxx_cv_realpath=yes], - [glibcxx_cv_realpath=no]) - ]) - if test $glibcxx_cv_realpath = yes; then - AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if usable realpath is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_realpath) -dnl - AC_MSG_CHECKING([for utimensat]) - AC_CACHE_VAL(glibcxx_cv_utimensat, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ - #include - #include - ], - [ - struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; - int i = utimensat(AT_FDCWD, "path", ts, 0); - ], - [glibcxx_cv_utimensat=yes], - [glibcxx_cv_utimensat=no]) - ]) - if test $glibcxx_cv_utimensat = yes; then - AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in and AT_FDCWD in .]) - fi - AC_MSG_RESULT($glibcxx_cv_utimensat) -dnl - AC_MSG_CHECKING([for utime]) - AC_CACHE_VAL(glibcxx_cv_utime, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ - #include - ], - [ - struct utimbuf t = { 1, 1 }; - int i = utime("path", &t); - ], - [glibcxx_cv_utime=yes], - [glibcxx_cv_utime=no]) - ]) - if test $glibcxx_cv_utime = yes; then - AC_DEFINE(_GLIBCXX_USE_UTIME, 1, [Define if utime is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_utime) -dnl - AC_MSG_CHECKING([for lstat]) - AC_CACHE_VAL(glibcxx_cv_lstat, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ #include ], - [ - struct stat st; - int i = lstat("path", &st); - ], - [glibcxx_cv_lstat=yes], - [glibcxx_cv_lstat=no]) - ]) - if test $glibcxx_cv_lstat = yes; then - AC_DEFINE(_GLIBCXX_USE_LSTAT, 1, [Define if lstat is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_lstat) -dnl - AC_MSG_CHECKING([for struct stat.st_mtim.tv_nsec]) - AC_CACHE_VAL(glibcxx_cv_st_mtim, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ #include ], - [ - struct stat st; - return st.st_mtim.tv_nsec; - ], - [glibcxx_cv_st_mtim=yes], - [glibcxx_cv_st_mtim=no]) - ]) - if test $glibcxx_cv_st_mtim = yes; then - AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.]) - fi - AC_MSG_RESULT($glibcxx_cv_st_mtim) -dnl - AC_MSG_CHECKING([for fchmod]) - AC_CACHE_VAL(glibcxx_cv_fchmod, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [fchmod(1, S_IWUSR);], - [glibcxx_cv_fchmod=yes], - [glibcxx_cv_fchmod=no]) - ]) - if test $glibcxx_cv_fchmod = yes; then - AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_fchmod) -dnl - AC_MSG_CHECKING([for fchmodat]) - AC_CACHE_VAL(glibcxx_cv_fchmodat, [dnl - GCC_TRY_COMPILE_OR_LINK( - [ - #include - #include - ], - [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);], - [glibcxx_cv_fchmodat=yes], - [glibcxx_cv_fchmodat=no]) - ]) - if test $glibcxx_cv_fchmodat = yes; then - AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_fchmodat) -dnl - AC_MSG_CHECKING([for sendfile that can copy files]) - AC_CACHE_VAL(glibcxx_cv_sendfile, [dnl - case "${target_os}" in - gnu* | linux* | solaris* | uclinux*) - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [sendfile(1, 2, (off_t*)0, sizeof 1);], - [glibcxx_cv_sendfile=yes], - [glibcxx_cv_sendfile=no]) - ;; - *) - glibcxx_cv_sendfile=no - ;; - esac - ]) - if test $glibcxx_cv_sendfile = yes; then - AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_sendfile) -dnl - AC_MSG_CHECKING([for link]) - AC_CACHE_VAL(glibcxx_cv_link, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [link("", "");], - [glibcxx_cv_link=yes], - [glibcxx_cv_link=no]) - ]) - if test $glibcxx_cv_link = yes; then - AC_DEFINE(HAVE_LINK, 1, [Define if link is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_link) -dnl - AC_MSG_CHECKING([for readlink]) - AC_CACHE_VAL(glibcxx_cv_readlink, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [char buf[32]; readlink("", buf, sizeof(buf));], - [glibcxx_cv_readlink=yes], - [glibcxx_cv_readlink=no]) - ]) - if test $glibcxx_cv_readlink = yes; then - AC_DEFINE(HAVE_READLINK, 1, [Define if readlink is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_readlink) -dnl - AC_MSG_CHECKING([for symlink]) - AC_CACHE_VAL(glibcxx_cv_symlink, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [symlink("", "");], - [glibcxx_cv_symlink=yes], - [glibcxx_cv_symlink=no]) - ]) - if test $glibcxx_cv_symlink = yes; then - AC_DEFINE(HAVE_SYMLINK, 1, [Define if symlink is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_symlink) -dnl - AC_MSG_CHECKING([for truncate]) - AC_CACHE_VAL(glibcxx_cv_truncate, [dnl - GCC_TRY_COMPILE_OR_LINK( - [#include ], - [truncate("", 99);], - [glibcxx_cv_truncate=yes], - [glibcxx_cv_truncate=no]) - ]) - if test $glibcxx_cv_truncate = yes; then - AC_DEFINE(HAVE_TRUNCATE, 1, [Define if truncate is available in .]) - fi - AC_MSG_RESULT($glibcxx_cv_truncate) -dnl - CXXFLAGS="$ac_save_CXXFLAGS" - AC_LANG_RESTORE + AC_MSG_CHECKING([for struct dirent.d_type]) + AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [ + struct dirent d; + if (sizeof d.d_type) return 0; + ], + [glibcxx_cv_dirent_d_type=yes], + [glibcxx_cv_dirent_d_type=no]) + ]) + if test $glibcxx_cv_dirent_d_type = yes; then + AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.]) fi + AC_MSG_RESULT($glibcxx_cv_dirent_d_type) +dnl + AC_MSG_CHECKING([for realpath]) + AC_CACHE_VAL(glibcxx_cv_realpath, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + #include + #include + ], + [ + #if _XOPEN_VERSION < 500 + #error + #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) + char *tmp = realpath((const char*)NULL, (char*)NULL); + #else + #error + #endif + ], + [glibcxx_cv_realpath=yes], + [glibcxx_cv_realpath=no]) + ]) + if test $glibcxx_cv_realpath = yes; then + AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if usable realpath is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_realpath) +dnl + AC_MSG_CHECKING([for utimensat]) + AC_CACHE_VAL(glibcxx_cv_utimensat, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + #include + ], + [ + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); + ], + [glibcxx_cv_utimensat=yes], + [glibcxx_cv_utimensat=no]) + ]) + if test $glibcxx_cv_utimensat = yes; then + AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in and AT_FDCWD in .]) + fi + AC_MSG_RESULT($glibcxx_cv_utimensat) +dnl + AC_MSG_CHECKING([for utime]) + AC_CACHE_VAL(glibcxx_cv_utime, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + ], + [ + struct utimbuf t = { 1, 1 }; + int i = utime("path", &t); + ], + [glibcxx_cv_utime=yes], + [glibcxx_cv_utime=no]) + ]) + if test $glibcxx_cv_utime = yes; then + AC_DEFINE(_GLIBCXX_USE_UTIME, 1, [Define if utime is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_utime) +dnl + AC_MSG_CHECKING([for lstat]) + AC_CACHE_VAL(glibcxx_cv_lstat, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ #include ], + [ + struct stat st; + int i = lstat("path", &st); + ], + [glibcxx_cv_lstat=yes], + [glibcxx_cv_lstat=no]) + ]) + if test $glibcxx_cv_lstat = yes; then + AC_DEFINE(_GLIBCXX_USE_LSTAT, 1, [Define if lstat is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_lstat) +dnl + AC_MSG_CHECKING([for struct stat.st_mtim.tv_nsec]) + AC_CACHE_VAL(glibcxx_cv_st_mtim, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ #include ], + [ + struct stat st; + return st.st_mtim.tv_nsec; + ], + [glibcxx_cv_st_mtim=yes], + [glibcxx_cv_st_mtim=no]) + ]) + if test $glibcxx_cv_st_mtim = yes; then + AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.]) + fi + AC_MSG_RESULT($glibcxx_cv_st_mtim) +dnl + AC_MSG_CHECKING([for fchmod]) + AC_CACHE_VAL(glibcxx_cv_fchmod, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [fchmod(1, S_IWUSR);], + [glibcxx_cv_fchmod=yes], + [glibcxx_cv_fchmod=no]) + ]) + if test $glibcxx_cv_fchmod = yes; then + AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_fchmod) +dnl + AC_MSG_CHECKING([for fchmodat]) + AC_CACHE_VAL(glibcxx_cv_fchmodat, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + #include + ], + [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);], + [glibcxx_cv_fchmodat=yes], + [glibcxx_cv_fchmodat=no]) + ]) + if test $glibcxx_cv_fchmodat = yes; then + AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_fchmodat) +dnl + AC_MSG_CHECKING([for sendfile that can copy files]) + AC_CACHE_VAL(glibcxx_cv_sendfile, [dnl + case "${target_os}" in + gnu* | linux* | solaris* | uclinux*) + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [sendfile(1, 2, (off_t*)0, sizeof 1);], + [glibcxx_cv_sendfile=yes], + [glibcxx_cv_sendfile=no]) + ;; + *) + glibcxx_cv_sendfile=no + ;; + esac + ]) + if test $glibcxx_cv_sendfile = yes; then + AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_sendfile) +dnl + AC_MSG_CHECKING([for link]) + AC_CACHE_VAL(glibcxx_cv_link, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [link("", "");], + [glibcxx_cv_link=yes], + [glibcxx_cv_link=no]) + ]) + if test $glibcxx_cv_link = yes; then + AC_DEFINE(HAVE_LINK, 1, [Define if link is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_link) +dnl + AC_MSG_CHECKING([for readlink]) + AC_CACHE_VAL(glibcxx_cv_readlink, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [char buf[32]; readlink("", buf, sizeof(buf));], + [glibcxx_cv_readlink=yes], + [glibcxx_cv_readlink=no]) + ]) + if test $glibcxx_cv_readlink = yes; then + AC_DEFINE(HAVE_READLINK, 1, [Define if readlink is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_readlink) +dnl + AC_MSG_CHECKING([for symlink]) + AC_CACHE_VAL(glibcxx_cv_symlink, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [symlink("", "");], + [glibcxx_cv_symlink=yes], + [glibcxx_cv_symlink=no]) + ]) + if test $glibcxx_cv_symlink = yes; then + AC_DEFINE(HAVE_SYMLINK, 1, [Define if symlink is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_symlink) +dnl + AC_MSG_CHECKING([for truncate]) + AC_CACHE_VAL(glibcxx_cv_truncate, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [truncate("", 99);], + [glibcxx_cv_truncate=yes], + [glibcxx_cv_truncate=no]) + ]) + if test $glibcxx_cv_truncate = yes; then + AC_DEFINE(HAVE_TRUNCATE, 1, [Define if truncate is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_truncate) +dnl + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE ]) dnl diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9f9c5a2419aa..b9c9b844c278 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -75962,22 +75962,21 @@ $as_echo_n "checking whether to build Filesystem TS support... " >&6; } $as_echo "$enable_libstdcxx_filesystem_ts" >&6; } - if test $enable_libstdcxx_filesystem_ts = yes; then - ac_ext=cpp + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -fno-exceptions" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_type" >&5 + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_type" >&5 $as_echo_n "checking for struct dirent.d_type... " >&6; } - if ${glibcxx_cv_dirent_d_type+:} false; then : + if ${glibcxx_cv_dirent_d_type+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -75985,8 +75984,8 @@ int main () { - struct dirent d; - if (sizeof d.d_type) return 0; + struct dirent d; + if (sizeof d.d_type) return 0; ; return 0; @@ -76009,8 +76008,8 @@ int main () { - struct dirent d; - if (sizeof d.d_type) return 0; + struct dirent d; + if (sizeof d.d_type) return 0; ; return 0; @@ -76027,37 +76026,37 @@ fi fi - if test $glibcxx_cv_dirent_d_type = yes; then + if test $glibcxx_cv_dirent_d_type = yes; then $as_echo "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_dirent_d_type" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_dirent_d_type" >&5 $as_echo "$glibcxx_cv_dirent_d_type" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for realpath" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for realpath" >&5 $as_echo_n "checking for realpath... " >&6; } - if ${glibcxx_cv_realpath+:} false; then : + if ${glibcxx_cv_realpath+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include - #include + #include + #include + #include int main () { - #if _XOPEN_VERSION < 500 - #error - #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) - char *tmp = realpath((const char*)NULL, (char*)NULL); - #else - #error - #endif + #if _XOPEN_VERSION < 500 + #error + #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) + char *tmp = realpath((const char*)NULL, (char*)NULL); + #else + #error + #endif ; return 0; @@ -76076,21 +76075,21 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include - #include + #include + #include + #include int main () { - #if _XOPEN_VERSION < 500 - #error - #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) - char *tmp = realpath((const char*)NULL, (char*)NULL); - #else - #error - #endif + #if _XOPEN_VERSION < 500 + #error + #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) + char *tmp = realpath((const char*)NULL, (char*)NULL); + #else + #error + #endif ; return 0; @@ -76107,31 +76106,31 @@ fi fi - if test $glibcxx_cv_realpath = yes; then + if test $glibcxx_cv_realpath = yes; then $as_echo "#define _GLIBCXX_USE_REALPATH 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_realpath" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_realpath" >&5 $as_echo "$glibcxx_cv_realpath" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimensat" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimensat" >&5 $as_echo_n "checking for utimensat... " >&6; } - if ${glibcxx_cv_utimensat+:} false; then : + if ${glibcxx_cv_utimensat+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include + #include int main () { - struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; - int i = utimensat(AT_FDCWD, "path", ts, 0); + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); ; return 0; @@ -76150,15 +76149,15 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include + #include int main () { - struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; - int i = utimensat(AT_FDCWD, "path", ts, 0); + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); ; return 0; @@ -76175,30 +76174,30 @@ fi fi - if test $glibcxx_cv_utimensat = yes; then + if test $glibcxx_cv_utimensat = yes; then $as_echo "#define _GLIBCXX_USE_UTIMENSAT 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_utimensat" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_utimensat" >&5 $as_echo "$glibcxx_cv_utimensat" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utime" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utime" >&5 $as_echo_n "checking for utime... " >&6; } - if ${glibcxx_cv_utime+:} false; then : + if ${glibcxx_cv_utime+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include + #include int main () { - struct utimbuf t = { 1, 1 }; - int i = utime("path", &t); + struct utimbuf t = { 1, 1 }; + int i = utime("path", &t); ; return 0; @@ -76217,14 +76216,14 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include + #include int main () { - struct utimbuf t = { 1, 1 }; - int i = utime("path", &t); + struct utimbuf t = { 1, 1 }; + int i = utime("path", &t); ; return 0; @@ -76241,19 +76240,19 @@ fi fi - if test $glibcxx_cv_utime = yes; then + if test $glibcxx_cv_utime = yes; then $as_echo "#define _GLIBCXX_USE_UTIME 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_utime" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_utime" >&5 $as_echo "$glibcxx_cv_utime" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lstat" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lstat" >&5 $as_echo_n "checking for lstat... " >&6; } - if ${glibcxx_cv_lstat+:} false; then : + if ${glibcxx_cv_lstat+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76261,8 +76260,8 @@ int main () { - struct stat st; - int i = lstat("path", &st); + struct stat st; + int i = lstat("path", &st); ; return 0; @@ -76285,8 +76284,8 @@ int main () { - struct stat st; - int i = lstat("path", &st); + struct stat st; + int i = lstat("path", &st); ; return 0; @@ -76303,19 +76302,19 @@ fi fi - if test $glibcxx_cv_lstat = yes; then + if test $glibcxx_cv_lstat = yes; then $as_echo "#define _GLIBCXX_USE_LSTAT 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_lstat" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_lstat" >&5 $as_echo "$glibcxx_cv_lstat" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_nsec" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_nsec" >&5 $as_echo_n "checking for struct stat.st_mtim.tv_nsec... " >&6; } - if ${glibcxx_cv_st_mtim+:} false; then : + if ${glibcxx_cv_st_mtim+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76323,8 +76322,8 @@ int main () { - struct stat st; - return st.st_mtim.tv_nsec; + struct stat st; + return st.st_mtim.tv_nsec; ; return 0; @@ -76347,8 +76346,8 @@ int main () { - struct stat st; - return st.st_mtim.tv_nsec; + struct stat st; + return st.st_mtim.tv_nsec; ; return 0; @@ -76365,19 +76364,19 @@ fi fi - if test $glibcxx_cv_st_mtim = yes; then + if test $glibcxx_cv_st_mtim = yes; then $as_echo "#define _GLIBCXX_USE_ST_MTIM 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_st_mtim" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_st_mtim" >&5 $as_echo "$glibcxx_cv_st_mtim" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmod" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmod" >&5 $as_echo_n "checking for fchmod... " >&6; } - if ${glibcxx_cv_fchmod+:} false; then : + if ${glibcxx_cv_fchmod+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76421,24 +76420,24 @@ fi fi - if test $glibcxx_cv_fchmod = yes; then + if test $glibcxx_cv_fchmod = yes; then $as_echo "#define _GLIBCXX_USE_FCHMOD 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmod" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmod" >&5 $as_echo "$glibcxx_cv_fchmod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmodat" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmodat" >&5 $as_echo_n "checking for fchmodat... " >&6; } - if ${glibcxx_cv_fchmodat+:} false; then : + if ${glibcxx_cv_fchmodat+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include + #include int main () @@ -76461,8 +76460,8 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include + #include int main () @@ -76483,21 +76482,21 @@ fi fi - if test $glibcxx_cv_fchmodat = yes; then + if test $glibcxx_cv_fchmodat = yes; then $as_echo "#define _GLIBCXX_USE_FCHMODAT 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmodat" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmodat" >&5 $as_echo "$glibcxx_cv_fchmodat" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5 $as_echo_n "checking for sendfile that can copy files... " >&6; } - if ${glibcxx_cv_sendfile+:} false; then : + if ${glibcxx_cv_sendfile+:} false; then : $as_echo_n "(cached) " >&6 else - case "${target_os}" in - gnu* | linux* | solaris* | uclinux*) - if test x$gcc_no_link = xyes; then + case "${target_os}" in + gnu* | linux* | solaris* | uclinux*) + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76538,27 +76537,27 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi - ;; - *) - glibcxx_cv_sendfile=no - ;; - esac + ;; + *) + glibcxx_cv_sendfile=no + ;; + esac fi - if test $glibcxx_cv_sendfile = yes; then + if test $glibcxx_cv_sendfile = yes; then $as_echo "#define _GLIBCXX_USE_SENDFILE 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5 $as_echo "$glibcxx_cv_sendfile" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for link" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for link" >&5 $as_echo_n "checking for link... " >&6; } - if ${glibcxx_cv_link+:} false; then : + if ${glibcxx_cv_link+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76602,19 +76601,19 @@ fi fi - if test $glibcxx_cv_link = yes; then + if test $glibcxx_cv_link = yes; then $as_echo "#define HAVE_LINK 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_link" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_link" >&5 $as_echo "$glibcxx_cv_link" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readlink" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readlink" >&5 $as_echo_n "checking for readlink... " >&6; } - if ${glibcxx_cv_readlink+:} false; then : + if ${glibcxx_cv_readlink+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76658,19 +76657,19 @@ fi fi - if test $glibcxx_cv_readlink = yes; then + if test $glibcxx_cv_readlink = yes; then $as_echo "#define HAVE_READLINK 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_readlink" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_readlink" >&5 $as_echo "$glibcxx_cv_readlink" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for symlink" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for symlink" >&5 $as_echo_n "checking for symlink... " >&6; } - if ${glibcxx_cv_symlink+:} false; then : + if ${glibcxx_cv_symlink+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76714,19 +76713,19 @@ fi fi - if test $glibcxx_cv_symlink = yes; then + if test $glibcxx_cv_symlink = yes; then $as_echo "#define HAVE_SYMLINK 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_symlink" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_symlink" >&5 $as_echo "$glibcxx_cv_symlink" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for truncate" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for truncate" >&5 $as_echo_n "checking for truncate... " >&6; } - if ${glibcxx_cv_truncate+:} false; then : + if ${glibcxx_cv_truncate+:} false; then : $as_echo_n "(cached) " >&6 else - if test x$gcc_no_link = xyes; then + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -76770,21 +76769,20 @@ fi fi - if test $glibcxx_cv_truncate = yes; then + if test $glibcxx_cv_truncate = yes; then $as_echo "#define HAVE_TRUNCATE 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_truncate" >&5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_truncate" >&5 $as_echo "$glibcxx_cv_truncate" >&6; } - CXXFLAGS="$ac_save_CXXFLAGS" - ac_ext=c + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - fi # For Networking TS. From eef40b0037b90ff117322423fc297dc528285524 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 10 Aug 2020 18:58:14 +0100 Subject: [PATCH 12/44] libstdc++: Fix build for targets without lstat [PR 94681] libstdc++-v3/ChangeLog: PR libstdc++/94681 * src/c++17/fs_ops.cc (read_symlink): Use posix::lstat instead of calling ::lstat directly. * src/filesystem/ops.cc (read_symlink): Likewise. (cherry picked from commit 5b065f0563262a0d6cd1fea8426913bfdd841301) --- libstdc++-v3/src/c++17/fs_ops.cc | 2 +- libstdc++-v3/src/filesystem/ops.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc index c685b1824f9d..2cb26e4605b8 100644 --- a/libstdc++-v3/src/c++17/fs_ops.cc +++ b/libstdc++-v3/src/c++17/fs_ops.cc @@ -1175,7 +1175,7 @@ fs::path fs::read_symlink(const path& p, error_code& ec) path result; #if defined(_GLIBCXX_HAVE_READLINK) && defined(_GLIBCXX_HAVE_SYS_STAT_H) stat_type st; - if (::lstat(p.c_str(), &st)) + if (posix::lstat(p.c_str(), &st)) { ec.assign(errno, std::generic_category()); return result; diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 8c8854bf28e8..a1138490b3ee 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -993,7 +993,7 @@ fs::path fs::read_symlink(const path& p [[gnu::unused]], error_code& ec) path result; #if defined(_GLIBCXX_HAVE_READLINK) && defined(_GLIBCXX_HAVE_SYS_STAT_H) stat_type st; - if (::lstat(p.c_str(), &st)) + if (posix::lstat(p.c_str(), &st)) { ec.assign(errno, std::generic_category()); return result; From 89df5bf44b2a6baf2146a5df9b10f98607b07b81 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 22 Sep 2020 00:17:04 +0000 Subject: [PATCH 13/44] Daily bump. --- gcc/DATESTAMP | 2 +- libstdc++-v3/ChangeLog | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fb22edf35a9d..ca3ee10cb82a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200921 +20200922 diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 247a9dfaeb16..b82652663a57 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,46 @@ +2020-09-21 Jonathan Wakely + + Backported from master: + 2020-08-10 Jonathan Wakely + + PR libstdc++/94681 + * src/c++17/fs_ops.cc (read_symlink): Use posix::lstat instead + of calling ::lstat directly. + * src/filesystem/ops.cc (read_symlink): Likewise. + +2020-09-21 Jonathan Wakely + + Backported from master: + 2020-08-10 Jonathan Wakely + + PR libstdc++/94681 + * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on + $enable_libstdcxx_filesystem_ts. + * configure: Regenerate. + +2020-09-21 Jonathan Wakely + + Backported from master: + 2020-09-20 Jonathan Wakely + + PR libstdc++/97101 + * include/std/functional (bind_front): Fix order of parameters + in is_nothrow_constructible_v specialization. + * testsuite/20_util/function_objects/bind_front/97101.cc: New test. + +2020-09-21 Jonathan Wakely + + Backported from master: + 2020-09-10 Jonathan Wakely + + PR libstdc++/94160 + * src/c++17/memory_resource.cc (munge_options): Round + max_blocks_per_chunk to a multiple of four. + (__pool_resource::_M_alloc_pools()): Simplify slightly. + * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: + Check that valid pointers are returned when small values are + used for max_blocks_per_chunk. + 2020-09-03 Jonathan Wakely Backported from master: From 248cca20c763bdb43af0628fb04e131868493cd2 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 26 Aug 2020 19:32:30 +0100 Subject: [PATCH 14/44] libstdc++: Use correct argument type for __use_alloc [PR 96803] The _Tuple_impl constructor for allocator-extended construction from a different tuple type uses the _Tuple_impl's own _Head type in the __use_alloc test. That is incorrect, because the argument tuple could have a different type. Using the wrong type might select the leading-allocator convention when it should use the trailing-allocator convention, or vice versa. libstdc++-v3/ChangeLog: PR libstdc++/96803 * include/std/tuple (_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl&)): Replace parameter pack with a type parameter and a pack and pass the first type to __use_alloc. * testsuite/20_util/tuple/cons/96803.cc: New test. (cherry picked from commit 5494edae83ad33c769bd1ebc98f0c492453a6417) --- libstdc++-v3/include/std/tuple | 12 +++--- .../testsuite/20_util/tuple/cons/96803.cc | 41 +++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index db4872d3a527..c87ebdb7b837 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -285,14 +285,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Base(__use_alloc<_Head, _Alloc, _Head>(__a), std::forward<_Head>(_M_head(__in))) { } - template + template _GLIBCXX20_CONSTEXPR _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, - const _Tuple_impl<_Idx, _UElements...>& __in) + const _Tuple_impl<_Idx, _UHead, _UTails...>& __in) : _Inherited(__tag, __a, - _Tuple_impl<_Idx, _UElements...>::_M_tail(__in)), - _Base(__use_alloc<_Head, _Alloc, _Head>(__a), - _Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { } + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)), + _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)) { } template _GLIBCXX20_CONSTEXPR @@ -417,7 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX20_CONSTEXPR _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, const _Tuple_impl<_Idx, _UHead>& __in) - : _Base(__use_alloc<_Head, _Alloc, _Head>(__a), + : _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a), _Tuple_impl<_Idx, _UHead>::_M_head(__in)) { } template diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc new file mode 100644 index 000000000000..9d3c07d55b27 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile { target c++11 } } + +#include +#include + +struct X +{ + using allocator_type = std::allocator; + + X(X&&) { } + X(std::allocator_arg_t, const allocator_type&, X&&) { } + + explicit X(int) { } + explicit X(int, allocator_type) { } +}; + +void +test01() +{ + // PR libstdc++/96803 + // std::tuple chooses wrong constructor for uses-allocator construction + std::tuple o; + std::tuple nok(std::allocator_arg, std::allocator(), o); +} From 5a981195bd80ad64475bbc24b7a4d222a6a6eff5 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 22 Sep 2020 08:42:18 +0100 Subject: [PATCH 15/44] libstdc++: Use correct argument type for __use_alloc, again [PR 96803] While backporting 5494edae83ad33c769bd1ebc98f0c492453a6417 I noticed that it's still not correct. I made the allocator-extended constructor use the right type for the uses-allocator construction detection, but I used an rvalue when it should be a const lvalue. This should fix it properly this time. libstdc++-v3/ChangeLog: PR libstdc++/96803 * include/std/tuple (_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl&)): Use correct value category in __use_alloc call. * testsuite/20_util/tuple/cons/96803.cc: Check with constructors that require correct value category to be used. (cherry picked from commit 7825399092d572ce8ea82c4aa8dfeb65076b0e52) --- libstdc++-v3/include/std/tuple | 2 +- .../testsuite/20_util/tuple/cons/96803.cc | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index c87ebdb7b837..94b9e0335b19 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -291,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const _Tuple_impl<_Idx, _UHead, _UTails...>& __in) : _Inherited(__tag, __a, _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)), - _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a), _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)) { } template diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc index 9d3c07d55b27..867a42150e00 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/96803.cc @@ -38,4 +38,25 @@ test01() // std::tuple chooses wrong constructor for uses-allocator construction std::tuple o; std::tuple nok(std::allocator_arg, std::allocator(), o); + + std::tuple oo; + std::tuple nn(std::allocator_arg, std::allocator(), oo); +} + +struct Y +{ + using allocator_type = std::allocator; + + Y(const X&) { } + Y(const X&, const allocator_type&) { } + + Y(X&&) { } + Y(std::allocator_arg_t, const allocator_type&, X&&) { } +}; + +void +test02() +{ + std::tuple o{1, 1}; + std::tuple oo(std::allocator_arg, std::allocator(), o); } From 283b97965ffbb78323e9b4e962eaf8e2c338c7c5 Mon Sep 17 00:00:00 2001 From: David Faust Date: Tue, 22 Sep 2020 20:31:35 +0200 Subject: [PATCH 16/44] bpf: use xBPF signed div, mod insns when available The 'mod' and 'div' operators in eBPF are unsigned, with no signed counterpart. xBPF adds two new ALU operations, sdiv and smod, for signed division and modulus, respectively. Update bpf.md with 'define_insn' blocks for signed div and mod to use them when targetting xBPF, and add new tests to ensure they are used appropriately. 2020-09-17 David Faust gcc/ * config/bpf/bpf.md: Add defines for signed div and mod operators. gcc/testsuite/ * gcc.target/bpf/diag-sdiv.c: New test. * gcc.target/bpf/diag-smod.c: New test. * gcc.target/bpf/xbpf-sdiv-1.c: New test. * gcc.target/bpf/xbpf-smod-1.c: New test. (cherry picked from commit 7c8ba5da80d5d95a8521010d6731d0d83036145d) --- gcc/config/bpf/bpf.md | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/bpf/diag-sdiv.c | 12 ++++++++++++ gcc/testsuite/gcc.target/bpf/diag-smod.c | 12 ++++++++++++ gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c | 14 ++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 gcc/testsuite/gcc.target/bpf/diag-sdiv.c create mode 100644 gcc/testsuite/gcc.target/bpf/diag-smod.c create mode 100644 gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c create mode 100644 gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index 769d8ea00969..8e7cf508ccff 100644 --- a/gcc/config/bpf/bpf.md +++ b/gcc/config/bpf/bpf.md @@ -165,6 +165,16 @@ "div\t%0,%2" [(set_attr "type" "")]) +;; However, xBPF does provide a signed division operator, sdiv. + +(define_insn "div3" + [(set (match_operand:AM 0 "register_operand" "=r,r") + (div:AM (match_operand:AM 1 "register_operand" " 0,0") + (match_operand:AM 2 "reg_or_imm_operand" "r,I")))] + "TARGET_XBPF" + "sdiv\t%0,%2" + [(set_attr "type" "")]) + ;;; Modulus ;; Note that eBPF doesn't provide instructions for signed integer @@ -178,6 +188,16 @@ "mod\t%0,%2" [(set_attr "type" "")]) +;; Again, xBPF provides a signed version, smod. + +(define_insn "mod3" + [(set (match_operand:AM 0 "register_operand" "=r,r") + (mod:AM (match_operand:AM 1 "register_operand" " 0,0") + (match_operand:AM 2 "reg_or_imm_operand" "r,I")))] + "TARGET_XBPF" + "smod\t%0,%2" + [(set_attr "type" "")]) + ;;; Logical AND (define_insn "and3" [(set (match_operand:AM 0 "register_operand" "=r,r") diff --git a/gcc/testsuite/gcc.target/bpf/diag-sdiv.c b/gcc/testsuite/gcc.target/bpf/diag-sdiv.c new file mode 100644 index 000000000000..db0c494a789c --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/diag-sdiv.c @@ -0,0 +1,12 @@ +/* Verify signed division does not produce 'sdiv' insn in eBPF. */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +void +foo () +{ + signed int x = 5; + signed int y = 2; + signed int z = x / y; +} +/* { dg-final { scan-assembler-not "sdiv(32)?\t%r" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/diag-smod.c b/gcc/testsuite/gcc.target/bpf/diag-smod.c new file mode 100644 index 000000000000..20234ee39cc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/diag-smod.c @@ -0,0 +1,12 @@ +/* Verify signed modulo does not produce 'smod' insn in eBPF. */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +void +foo () +{ + signed int x = 5; + signed int y = 2; + signed int z = x % y; +} +/* { dg-final { scan-assembler-not "smod(32)?\t%r" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c b/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c new file mode 100644 index 000000000000..f6c5c9e9f1c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c @@ -0,0 +1,14 @@ +/* Verify that sdiv instruction is used for xBPF. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -mxbpf" } */ + +void +foo () +{ + signed int x = 5; + signed int y = 2; + signed int z = x / y; + signed int w = x / 3; +} + +/* { dg-final { scan-assembler "sdiv(32)?\t%r" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c b/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c new file mode 100644 index 000000000000..b3e5816b5cf4 --- /dev/null +++ b/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c @@ -0,0 +1,14 @@ +/* Verify that smod instruction is used for xBPF. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -mxbpf" } */ + +void +foo () +{ + signed int x = 5; + signed int y = 2; + signed int z = x % y; + signed int w = x % 3; +} + +/* { dg-final { scan-assembler "smod(32)?\t%r" } } */ From ebf259b243069e77dc7199072304b455e8fcb865 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 22 Sep 2020 20:02:58 +0100 Subject: [PATCH 17/44] libstdc++: Fix out-of-bounds string_view access in filesystem::path [PR 97167] libstdc++-v3/ChangeLog: PR libstdc++/97167 * src/c++17/fs_path.cc (path::_Parser::root_path()): Check for empty string before inspecting the first character. * testsuite/27_io/filesystem/path/append/source.cc: Append empty string_view to path. (cherry picked from commit 49ff88bd0d8a36a9e903f01ce05685cfe07dee5d) --- libstdc++-v3/src/c++17/fs_path.cc | 2 +- .../testsuite/27_io/filesystem/path/append/source.cc | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc index 5ff17741f81a..edfb91fc6c5e 100644 --- a/libstdc++-v3/src/c++17/fs_path.cc +++ b/libstdc++-v3/src/c++17/fs_path.cc @@ -81,7 +81,7 @@ struct path::_Parser const size_t len = input.size(); // look for root name or root directory - if (is_dir_sep(input[0])) + if (len && is_dir_sep(input[0])) { #if SLASHSLASH_IS_ROOTNAME // look for root name, such as "//foo" diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc index 2fceee9b7741..dc7331945fe9 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc @@ -161,6 +161,15 @@ test06() test(p2, s.c_str()); } +void +test07() +{ + path p, p0; + std::string_view s; + p /= s; // PR libstdc++/97167 + compare_paths(p, p0); +} + int main() { @@ -170,4 +179,5 @@ main() test04(); test05(); test06(); + test07(); } From 8a2f3019cec2af375dda151ffea933403c677b68 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 23 Sep 2020 00:17:02 +0000 Subject: [PATCH 18/44] Daily bump. --- gcc/ChangeLog | 7 +++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 10 ++++++++++ libstdc++-v3/ChangeLog | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd7365604160..4ee92d4bc20e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2020-09-22 David Faust + + Backported from master: + 2020-09-22 David Faust + + * config/bpf/bpf.md: Add defines for signed div and mod operators. + 2020-09-20 John David Anglin < danglin@gcc.gnu.org> * config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Delete. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ca3ee10cb82a..1a983d8f0511 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200922 +20200923 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b841c5877ff..5db056a82fc8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2020-09-22 David Faust + + Backported from master: + 2020-09-22 David Faust + + * gcc.target/bpf/diag-sdiv.c: New test. + * gcc.target/bpf/diag-smod.c: New test. + * gcc.target/bpf/xbpf-sdiv-1.c: New test. + * gcc.target/bpf/xbpf-smod-1.c: New test. + 2020-09-18 Harald Anlauf Backported from master: diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b82652663a57..c2054dfcb917 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,38 @@ +2020-09-22 Jonathan Wakely + + Backported from master: + 2020-09-22 Jonathan Wakely + + PR libstdc++/97167 + * src/c++17/fs_path.cc (path::_Parser::root_path()): Check + for empty string before inspecting the first character. + * testsuite/27_io/filesystem/path/append/source.cc: Append + empty string_view to path. + +2020-09-22 Jonathan Wakely + + Backported from master: + 2020-09-22 Jonathan Wakely + + PR libstdc++/96803 + * include/std/tuple + (_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl&)): + Use correct value category in __use_alloc call. + * testsuite/20_util/tuple/cons/96803.cc: Check with constructors + that require correct value category to be used. + +2020-09-22 Jonathan Wakely + + Backported from master: + 2020-08-26 Jonathan Wakely + + PR libstdc++/96803 + * include/std/tuple + (_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl&)): + Replace parameter pack with a type parameter and a pack and pass + the first type to __use_alloc. + * testsuite/20_util/tuple/cons/96803.cc: New test. + 2020-09-21 Jonathan Wakely Backported from master: From 7727b713de5bd368cd3705ab442ccf5164311e2c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 24 Sep 2020 00:17:04 +0000 Subject: [PATCH 19/44] Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1a983d8f0511..52a894dd6541 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200923 +20200924 From f82a83a8975af09c9a5ea551a639fc5882dc1e7b Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Thu, 24 Sep 2020 10:17:48 +0100 Subject: [PATCH 20/44] aarch64: Add support for Neoverse V1 CPU This patch backports the AArch64 support for Arm's Neoverse V1 CPU to GCC 10. gcc/ChangeLog: * config/aarch64/aarch64-cores.def: Add Neoverse V1. * config/aarch64/aarch64-tune.md: Regenerate. * doc/invoke.texi: Document support for Neoverse V1. --- gcc/config/aarch64/aarch64-cores.def | 1 + gcc/config/aarch64/aarch64-tune.md | 2 +- gcc/doc/invoke.texi | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def index a7dde38d7687..a3bd56f5b43f 100644 --- a/gcc/config/aarch64/aarch64-cores.def +++ b/gcc/config/aarch64/aarch64-cores.def @@ -134,6 +134,7 @@ AARCH64_CORE("thunderx3t110", thunderx3t110, thunderx3t110, 8_3A, AARCH64_FL_ /* Arm ('A') cores. */ AARCH64_CORE("zeus", zeus, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_SVE | AARCH64_FL_RCPC | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_PROFILE | AARCH64_FL_SSBS | AARCH64_FL_RNG, neoversen1, 0x41, 0xd40, -1) +AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_SVE | AARCH64_FL_RCPC | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_PROFILE | AARCH64_FL_SSBS | AARCH64_FL_RNG, neoversen1, 0x41, 0xd40, -1) /* Qualcomm ('Q') cores. */ AARCH64_CORE("saphira", saphira, saphira, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_CRYPTO | AARCH64_FL_RCPC, saphira, 0x51, 0xC01, -1) diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md index ebf97c38fbda..8e38052d6cfa 100644 --- a/gcc/config/aarch64/aarch64-tune.md +++ b/gcc/config/aarch64/aarch64-tune.md @@ -1,5 +1,5 @@ ;; -*- buffer-read-only: t -*- ;; Generated automatically by gentune.sh from aarch64-cores.def (define_attr "tune" - "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa65,cortexa65ae,ares,neoversen1,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,tsv110,thunderx3t110,zeus,saphira,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55" + "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa65,cortexa65ae,ares,neoversen1,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,tsv110,thunderx3t110,zeus,neoversev1,saphira,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55" (const (symbol_ref "((enum attr_tune) aarch64_tune)"))) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3d3a208dcaa6..5b408150084b 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -16977,8 +16977,8 @@ performance of the code. Permissible values for this option are: @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77}, @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor}, -@samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira}, -@samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx}, +@samp{neoverse-e1},@samp{neoverse-n1},@samp{neoverse-v1},@samp{qdf24xx}, +@samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83}, @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96} @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n}, From aa47c987340946034fe9e32832bd1eb49d6287f3 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 17 Sep 2020 17:17:52 +0100 Subject: [PATCH 21/44] aarch64: Do not alter value on a force_reg returned rtx expanding __jcvt 2020-09-17 Andrea Corallo * config/aarch64/aarch64-builtins.c (aarch64_general_expand_builtin): Use expand machinery not to alter the value of an rtx returned by force_reg. (cherry picked from commit 2c62952f8160bdc8d4111edb34a4bc75096c1e05) --- gcc/config/aarch64/aarch64-builtins.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 8407a34b5948..b8d301f00e22 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -1976,14 +1976,14 @@ aarch64_general_expand_builtin (unsigned int fcode, tree exp, rtx target, return target; case AARCH64_JSCVT: - arg0 = CALL_EXPR_ARG (exp, 0); - op0 = force_reg (DFmode, expand_normal (arg0)); - if (!target) - target = gen_reg_rtx (SImode); - else - target = force_reg (SImode, target); - emit_insn (GEN_FCN (CODE_FOR_aarch64_fjcvtzs) (target, op0)); - return target; + { + expand_operand ops[2]; + create_output_operand (&ops[0], target, SImode); + op0 = expand_normal (CALL_EXPR_ARG (exp, 0)); + create_input_operand (&ops[1], op0, DFmode); + expand_insn (CODE_FOR_aarch64_fjcvtzs, 2, ops); + return ops[0].value; + } case AARCH64_SIMD_BUILTIN_FCMLA_LANEQ0_V2SF: case AARCH64_SIMD_BUILTIN_FCMLA_LANEQ90_V2SF: From 8f4b43c00feed11a6cedd4c40baa3cdcf687b3a1 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 23 Sep 2020 20:15:39 +0930 Subject: [PATCH 22/44] [RS6000] Built-in __PCREL__ define Useful in assembly to know details of power10 function calls. PR target/97166 * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Conditionally define __PCREL__. (cherry picked from commit 677b9150f54a0483d3de1182ac40717b7c4431a5) --- gcc/config/rs6000/rs6000-c.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index fcf36fc622e8..7e211fdbf316 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -597,6 +597,9 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, /* Tell the user if we support the MMA instructions. */ if ((flags & OPTION_MASK_MMA) != 0) rs6000_define_or_undefine_macro (define_p, "__MMA__"); + /* Whether pc-relative code is being generated. */ + if ((flags & OPTION_MASK_PCREL) != 0) + rs6000_define_or_undefine_macro (define_p, "__PCREL__"); } void From 71c83e108de7b54f604eeebefbc9e97672310ca7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 18 Sep 2020 23:21:05 +0930 Subject: [PATCH 23/44] [RS6000] Power10 libffi fixes Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer. That means calling between pc-relative and TOC using code can't be done without intervening linker stubs, and a call from TOC code to pc-relative code must have a nop after the bl in order to restore r2. Now the PowerPC libffi assembly code doesn't use r2 except for the implicit use when making calls back to C, ffi_closure_helper_LINUX64 and ffi_prep_args64. So changing the assembly to interoperate with pc-relative code without stubs is easily done. PR target/97166 * src/powerpc/linux64.S (ffi_call_LINUX64): Don't emit global entry when __PCREL__. Call using @notoc. Add nops. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise. (ffi_go_closure_linux64): Likewise. (cherry picked from commit 08cd8d5929eac84b27788d8483fd75ab7ad13129) (cherry picked from commit fff56af6421a1a3e357bcaad99f2ea084d72a7a8) --- libffi/src/powerpc/linux64.S | 8 ++++++++ libffi/src/powerpc/linux64_closure.S | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libffi/src/powerpc/linux64.S b/libffi/src/powerpc/linux64.S index b2ae60ead6e1..f0006fe90c5f 100644 --- a/libffi/src/powerpc/linux64.S +++ b/libffi/src/powerpc/linux64.S @@ -36,8 +36,10 @@ .cfi_startproc # if _CALL_ELF == 2 ffi_call_LINUX64: +# ifndef __PCREL__ addis %r2, %r12, .TOC.-ffi_call_LINUX64@ha addi %r2, %r2, .TOC.-ffi_call_LINUX64@l +# endif .localentry ffi_call_LINUX64, . - ffi_call_LINUX64 # else .section ".opd","aw" @@ -89,9 +91,15 @@ ffi_call_LINUX64: /* Call ffi_prep_args64. */ mr %r4, %r1 # if defined _CALL_LINUX || _CALL_ELF == 2 +# ifdef __PCREL__ + bl ffi_prep_args64@notoc +# else bl ffi_prep_args64 + nop +# endif # else bl .ffi_prep_args64 + nop # endif # if _CALL_ELF == 2 diff --git a/libffi/src/powerpc/linux64_closure.S b/libffi/src/powerpc/linux64_closure.S index 6487d2a2970a..5663bb402236 100644 --- a/libffi/src/powerpc/linux64_closure.S +++ b/libffi/src/powerpc/linux64_closure.S @@ -37,8 +37,10 @@ .cfi_startproc # if _CALL_ELF == 2 ffi_closure_LINUX64: +# ifndef __PCREL__ addis %r2, %r12, .TOC.-ffi_closure_LINUX64@ha addi %r2, %r2, .TOC.-ffi_closure_LINUX64@l +# endif .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64 # else .section ".opd","aw" @@ -143,7 +145,7 @@ ffi_closure_LINUX64: stfd %f12, -104+(11*8)(%r1) stfd %f13, -104+(12*8)(%r1) - # load up the pointer to the saved fpr registers */ + # load up the pointer to the saved fpr registers addi %r8, %r1, -104 # load up the pointer to the result storage @@ -155,11 +157,19 @@ ffi_closure_LINUX64: # make the call # if defined _CALL_LINUX || _CALL_ELF == 2 +# ifdef __PCREL__ + bl ffi_closure_helper_LINUX64@notoc +.Lret: +# else bl ffi_closure_helper_LINUX64 +.Lret: + nop +# endif # else bl .ffi_closure_helper_LINUX64 -# endif .Lret: + nop +# endif # now r3 contains the return type # so use it to look up in a table @@ -396,8 +406,10 @@ ffi_closure_LINUX64: .cfi_startproc # if _CALL_ELF == 2 ffi_go_closure_linux64: +# ifndef __PCREL__ addis %r2, %r12, .TOC.-ffi_go_closure_linux64@ha addi %r2, %r2, .TOC.-ffi_go_closure_linux64@l +# endif .localentry ffi_go_closure_linux64, . - ffi_go_closure_linux64 # else .section ".opd","aw" From f0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 14 Sep 2020 08:52:27 -0700 Subject: [PATCH 24/44] rtl_data: Add sp_is_clobbered_by_asm Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack pointer is clobbered by asm statement. gcc/ PR target/97032 * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm to true if the stack pointer is clobbered by asm statement. * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm. * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true if the stack pointer is clobbered by asm statement. gcc/testsuite/ PR target/97032 * gcc.target/i386/pr97032.c: New test. (cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc) --- gcc/cfgexpand.c | 14 +++++++++----- gcc/config/i386/i386.c | 6 ++++-- gcc/emit-rtl.h | 3 +++ gcc/testsuite/gcc.target/i386/pr97032.c | 23 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr97032.c diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index c534cb31a472..122a5ff7b65a 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2868,11 +2868,15 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname) as it was before, so no asm can validly clobber the stack pointer in the usual sense. Adding the stack pointer to the clobber list has traditionally had some undocumented and somewhat obscure side-effects. */ - if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM) - && warning (OPT_Wdeprecated, "listing the stack pointer register" - " %qs in a clobber list is deprecated", regname)) - inform (input_location, "the value of the stack pointer after an %" - " statement must be the same as it was before the statement"); + if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM)) + { + crtl->sp_is_clobbered_by_asm = true; + if (warning (OPT_Wdeprecated, "listing the stack pointer register" + " %qs in a clobber list is deprecated", regname)) + inform (input_location, "the value of the stack pointer after" + " an % statement must be the same as it was before" + " the statement"); + } return is_valid; } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 6e03abf6b477..839b9929f6d7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6965,10 +6965,12 @@ ix86_update_stack_boundary (void) static rtx ix86_get_drap_rtx (void) { - /* We must use DRAP if there are outgoing arguments on stack and + /* We must use DRAP if there are outgoing arguments on stack or + the stack pointer register is clobbered by asm statment and ACCUMULATE_OUTGOING_ARGS is false. */ if (ix86_force_drap - || (cfun->machine->outgoing_args_on_stack + || ((cfun->machine->outgoing_args_on_stack + || crtl->sp_is_clobbered_by_asm) && !ACCUMULATE_OUTGOING_ARGS)) crtl->need_drap = true; diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index a878efe3cf7e..0c96c52fc7b3 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -275,6 +275,9 @@ struct GTY(()) rtl_data { pass_stack_ptr_mod has run. */ bool sp_is_unchanging; + /* True if the stack pointer is clobbered by asm statement. */ + bool sp_is_clobbered_by_asm; + /* Nonzero if function being compiled doesn't contain any calls (ignoring the prologue and epilogue). This is set prior to register allocation in IRA and is valid for the remaining diff --git a/gcc/testsuite/gcc.target/i386/pr97032.c b/gcc/testsuite/gcc.target/i386/pr97032.c new file mode 100644 index 000000000000..7cbbe9bc22aa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97032.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { ia32 && fstack_protector } } } */ +/* { dg-options "-O2 -mincoming-stack-boundary=2 -fstack-protector-all" } */ + +#include + +extern int *__errno_location (void); + +long +sys_socketcall (int op, ...) +{ + long int res; + va_list ap; + va_start (ap, op); + asm volatile ("push %%ebx; movl %2, %%ebx; int $0x80; pop %%ebx" + /* { dg-warning "listing the stack pointer register" "" { target *-*-* } .-1 } */ + : "=a" (res) : "0" (102), "ri" (16), "c" (ap) : "memory", "esp"); + if (__builtin_expect (res > 4294963200UL, 0)) + *__errno_location () = -res; + va_end (ap); + return res; +} + +/* { dg-final { scan-assembler "call\[ \t\]*_?__errno_location" } } */ From a93603bba0eae7756e84f9b7edb0a53c3aa45c6a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 25 Sep 2020 00:17:04 +0000 Subject: [PATCH 25/44] Daily bump. --- gcc/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 8 ++++++++ libffi/ChangeLog | 11 +++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ee92d4bc20e..8987bb13dbf2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,39 @@ +2020-09-24 H.J. Lu + + Backported from master: + 2020-09-16 H.J. Lu + + PR target/97032 + * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm + to true if the stack pointer is clobbered by asm statement. + * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm. + * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true + if the stack pointer is clobbered by asm statement. + +2020-09-24 Alan Modra + + Backported from master: + 2020-09-24 Alan Modra + + PR target/97166 + * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): + Conditionally define __PCREL__. + +2020-09-24 Andrea Corallo + + Backported from master: + 2020-09-21 Andrea Corallo + + * config/aarch64/aarch64-builtins.c + (aarch64_general_expand_builtin): Use expand machinery not to + alter the value of an rtx returned by force_reg. + +2020-09-24 Alex Coplan + + * config/aarch64/aarch64-cores.def: Add Neoverse V1. + * config/aarch64/aarch64-tune.md: Regenerate. + * doc/invoke.texi: Document support for Neoverse V1. + 2020-09-22 David Faust Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 52a894dd6541..cfe4a2ef954c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200924 +20200925 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5db056a82fc8..3b1f8c92c76c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-09-24 H.J. Lu + + Backported from master: + 2020-09-16 H.J. Lu + + PR target/97032 + * gcc.target/i386/pr97032.c: New test. + 2020-09-22 David Faust Backported from master: diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 593e2cc7a29d..38b8e5ed8891 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,14 @@ +2020-09-24 Alan Modra + + Backported from master: + 2020-09-24 Alan Modra + + PR target/97166 + * src/powerpc/linux64.S (ffi_call_LINUX64): Don't emit global + entry when __PCREL__. Call using @notoc. Add nops. + * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise. + (ffi_go_closure_linux64): Likewise. + 2020-07-23 Release Manager * GCC 10.2.0 released. From dc0743773bef43cd3e4a8b986befa5bfebcd70f3 Mon Sep 17 00:00:00 2001 From: Joe Ramsay Date: Wed, 19 Aug 2020 12:34:06 +0000 Subject: [PATCH 26/44] arm: Require MVE memory operand for destination of vst1q intrinsic Previously, the machine description patterns for vst1q accepted a generic memory operand for the destination, which could lead to an unrecognised builtin when expanding vst1q* intrinsics. This change fixes the pattern to only accept MVE memory operands. gcc/ChangeLog: PR target/96683 * config/arm/mve.md (mve_vst1q_f): Require MVE memory operand for destination. (mve_vst1q_): Likewise. gcc/testsuite/ChangeLog: PR target/96683 * gcc.target/arm/mve/intrinsics/vst1q_f16.c: New test. * gcc.target/arm/mve/intrinsics/vst1q_s16.c: New test. * gcc.target/arm/mve/intrinsics/vst1q_s8.c: New test. * gcc.target/arm/mve/intrinsics/vst1q_u16.c: New test. * gcc.target/arm/mve/intrinsics/vst1q_u8.c: New test. (cherry picked from commit 91d206adfe39ce063f6a5731b92a03c05e82e94a) --- gcc/config/arm/mve.md | 4 ++-- .../gcc.target/arm/mve/intrinsics/vst1q_f16.c | 10 +++++++--- .../gcc.target/arm/mve/intrinsics/vst1q_s16.c | 10 +++++++--- gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c | 10 +++++++--- .../gcc.target/arm/mve/intrinsics/vst1q_u16.c | 10 +++++++--- gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c | 10 +++++++--- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 9758862ac2bb..465b39a51b3a 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -9330,7 +9330,7 @@ [(set_attr "length" "4")]) (define_expand "mve_vst1q_f" - [(match_operand: 0 "memory_operand") + [(match_operand: 0 "mve_memory_operand") (unspec: [(match_operand:MVE_0 1 "s_register_operand")] VST1Q_F) ] "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT" @@ -9340,7 +9340,7 @@ }) (define_expand "mve_vst1q_" - [(match_operand:MVE_2 0 "memory_operand") + [(match_operand:MVE_2 0 "mve_memory_operand") (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand")] VST1Q) ] "TARGET_HAVE_MVE" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_f16.c index 363b4caf472a..312b7464f17b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_f16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_f16.c @@ -10,12 +10,16 @@ foo (float16_t * addr, float16x8_t value) vst1q_f16 (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ - void foo1 (float16_t * addr, float16x8_t value) { vst1q (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ +/* { dg-final { scan-assembler-times "vstrh.16" 2 } } */ + +void +foo2 (float16_t a, float16x8_t x) +{ + vst1q (&a, x); +} diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s16.c index 37c4713f542e..cd14e2c408f1 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s16.c @@ -10,12 +10,16 @@ foo (int16_t * addr, int16x8_t value) vst1q_s16 (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ - void foo1 (int16_t * addr, int16x8_t value) { vst1q (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ +/* { dg-final { scan-assembler-times "vstrh.16" 2 } } */ + +void +foo2 (int16_t a, int16x8_t x) +{ + vst1q (&a, x); +} diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c index fe5edea02f50..0004c80963ec 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c @@ -10,12 +10,16 @@ foo (int8_t * addr, int8x16_t value) vst1q_s8 (addr, value); } -/* { dg-final { scan-assembler "vstrb.8" } } */ - void foo1 (int8_t * addr, int8x16_t value) { vst1q (addr, value); } -/* { dg-final { scan-assembler "vstrb.8" } } */ +/* { dg-final { scan-assembler-times "vstrb.8" 2 } } */ + +void +foo2 (int8_t a, int8x16_t x) +{ + vst1q (&a, x); +} diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u16.c index a4c8c1aabe7e..248e7ce82b09 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u16.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u16.c @@ -10,12 +10,16 @@ foo (uint16_t * addr, uint16x8_t value) vst1q_u16 (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ - void foo1 (uint16_t * addr, uint16x8_t value) { vst1q (addr, value); } -/* { dg-final { scan-assembler "vstrh.16" } } */ +/* { dg-final { scan-assembler-times "vstrh.16" 2 } } */ + +void +foo2 (uint16_t a, uint16x8_t x) +{ + vst1q (&a, x); +} diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c index bf20b6da7291..f8b48a69903a 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c @@ -10,12 +10,16 @@ foo (uint8_t * addr, uint8x16_t value) vst1q_u8 (addr, value); } -/* { dg-final { scan-assembler "vstrb.8" } } */ - void foo1 (uint8_t * addr, uint8x16_t value) { vst1q (addr, value); } -/* { dg-final { scan-assembler "vstrb.8" } } */ +/* { dg-final { scan-assembler-times "vstrb.8" 2 } } */ + +void +foo2 (uint8_t a, uint8x16_t x) +{ + vst1q (&a, x); +} From 038b65f378b36624b1fd3867fa5e578c1bfa50cc Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Thu, 4 Jun 2020 12:04:48 -0400 Subject: [PATCH 27/44] Add processing STRICT_LOW_PART for matched reloads. 2020-06-04 Vladimir Makarov PR middle-end/95464 * lra.c (lra_emit_move): Add processing STRICT_LOW_PART. * lra-constraints.c (match_reload): Use STRICT_LOW_PART in output reload if the original insn has it too. (cherry picked from commit 5261cf8ce824bfc75eb6f12ad5e3716c085b6f9a) --- gcc/lra-constraints.c | 2 ++ gcc/lra.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index bf6d4a2fd4bf..421c453997b5 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1071,6 +1071,8 @@ match_reload (signed char out, signed char *ins, signed char *outs, if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX) { start_sequence (); + if (out >= 0 && curr_static_id->operand[out].strict_low) + out_rtx = gen_rtx_STRICT_LOW_PART (VOIDmode, out_rtx); lra_emit_move (out_rtx, copy_rtx (new_out_reg)); emit_insn (*after); *after = get_insns (); diff --git a/gcc/lra.c b/gcc/lra.c index 5e8b75b1fdae..3543ce3993c2 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -490,13 +490,16 @@ void lra_emit_move (rtx x, rtx y) { int old; - + rtx_insn *insn; + if (GET_CODE (y) != PLUS) { if (rtx_equal_p (x, y)) return; old = max_reg_num (); - rtx_insn *insn = emit_move_insn (x, y); + + insn = (GET_CODE (x) != STRICT_LOW_PART + ? emit_move_insn (x, y) : emit_insn (gen_rtx_SET (x, y))); /* The move pattern may require scratch registers, so convert them into real registers now. */ if (insn != NULL_RTX) From 957e37ac288fe6c40ee0bb98a0b06a85be8a35e3 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Thu, 4 Jun 2020 13:32:24 -0400 Subject: [PATCH 28/44] Add test for PR95464.c. 2020-06-04 Vladimir Makarov PR middle-end/95464 * gcc.target/i386/pr95464.c: New. (cherry picked from commit e7ef9a40cd0c688cd331bc26224d1fbe360c1fe6) --- gcc/testsuite/gcc.target/i386/pr95464.c | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr95464.c diff --git a/gcc/testsuite/gcc.target/i386/pr95464.c b/gcc/testsuite/gcc.target/i386/pr95464.c new file mode 100644 index 000000000000..33a8290e0cf8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr95464.c @@ -0,0 +1,64 @@ +/* { dg-options "-O2" } */ +/* { dg-do run { target { { *-*-linux* } && { ! ia32 } } } } */ + +struct S { unsigned a:1, b:1, c:1, d:1, e:14, f:14; }; + +__attribute__((noipa)) int +foo (struct S x) +{ + if (x.a != 0 || x.b != 1 || x.c != 0 || x.d != 1 + || x.e != 7239 || x.f != 6474) + __builtin_abort (); +} + +__attribute__((noipa)) void +bar (struct S x, struct S y) +{ + if (x.a != 0 || x.b != 1 || x.c != 0 || x.d != 1 + || x.e != 7239 || x.f != 6474) + __builtin_abort (); + if (y.a != 0 || y.b != 1 || y.c != 1 || y.d != 1 + || y.e != 16320 || y.f != 7315) + __builtin_abort (); +} + +__attribute__((noipa)) void +baz (struct S x) +{ + if (x.a != 1 || x.b != 1 || x.c != 1 || x.d != 1 + || x.e != 16320 || x.f != 7315) + __builtin_abort (); +} + +__attribute__((noipa)) void +qux (struct S x, struct S y, unsigned z) +{ + struct S a = x, b; + for (unsigned i = 0; i < z; ++i) + foo (x); + if (x.a && x.e == 16) + a.e = 32; + b = a; + b.c = y.c; + b.e = y.e; + b.f = y.f; + bar (a, b); + a = b; + __asm volatile ("" : : : "ax", "bx", "cx", "dx", "si", "di", +#ifdef __OPTIMIZE__ + "bp", +#endif + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"); + a.a = 1; + a.c = 1; + baz (a); +} + +int +main () +{ + struct S x = { 0, 1, 0, 1, 7239, 6474 }; + struct S y = { 1, 0, 1, 0, 16320, 7315 }; + qux (x, y, 1); + return 0; +} From 6f4226ff6e8fa32636153993e2c29e96828bfdb0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 26 Sep 2020 00:17:01 +0000 Subject: [PATCH 29/44] Daily bump. --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 20 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8987bb13dbf2..d42ed884c886 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2020-09-25 Vladimir N. Makarov + + Backported from master: + 2020-06-04 Vladimir Makarov + + PR middle-end/95464 + * lra.c (lra_emit_move): Add processing STRICT_LOW_PART. + * lra-constraints.c (match_reload): Use STRICT_LOW_PART in output + reload if the original insn has it too. + +2020-09-25 Joe Ramsay + + Backported from master: + 2020-08-20 Joe Ramsay + + PR target/96683 + * config/arm/mve.md (mve_vst1q_f): Require MVE memory operand for + destination. + (mve_vst1q_): Likewise. + 2020-09-24 H.J. Lu Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cfe4a2ef954c..bfdd19d304c5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200925 +20200926 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b1f8c92c76c..e270d7b88940 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2020-09-25 Vladimir N. Makarov + + Backported from master: + 2020-06-04 Vladimir Makarov + + PR middle-end/95464 + * gcc.target/i386/pr95464.c: New. + +2020-09-25 Joe Ramsay + + Backported from master: + 2020-08-20 Joe Ramsay + + PR target/96683 + * gcc.target/arm/mve/intrinsics/vst1q_f16.c: New test. + * gcc.target/arm/mve/intrinsics/vst1q_s16.c: New test. + * gcc.target/arm/mve/intrinsics/vst1q_s8.c: New test. + * gcc.target/arm/mve/intrinsics/vst1q_u16.c: New test. + * gcc.target/arm/mve/intrinsics/vst1q_u8.c: New test. + 2020-09-24 H.J. Lu Backported from master: From 2c56472f99688a5b815ee880fa397c77269af7e3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 27 Sep 2020 00:16:59 +0000 Subject: [PATCH 30/44] Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index bfdd19d304c5..51daa72546b6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200926 +20200927 From 4a67941a956003dcce8866604ba25f5a0bfd16cf Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Thu, 11 Jun 2020 14:33:51 +0100 Subject: [PATCH 31/44] Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl Mark Eggleston gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. (cherry picked from commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc) --- gcc/fortran/decl.c | 4 ++-- gcc/fortran/match.c | 5 +++-- gcc/fortran/match.h | 6 ++---- gcc/fortran/resolve.c | 7 +++++++ gcc/testsuite/gfortran.dg/pr95614_1.f90 | 6 ++++++ gcc/testsuite/gfortran.dg/pr95614_2.f90 | 6 ++++++ 6 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr95614_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr95614_2.f90 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c1a15f1a84ae..25b7be1e1479 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5989,7 +5989,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, &tmp_sym); } - else if (match_common_name (name) == MATCH_YES) + else if (gfc_match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); @@ -6034,7 +6034,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, &tmp_sym); } - else if (match_common_name (name) == MATCH_YES) + else if (gfc_match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index cb09c5f8ec53..bee73e7b0080 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5166,7 +5166,8 @@ gfc_get_common (const char *name, int from_module) /* Match a common block name. */ -match match_common_name (char *name) +match +gfc_match_common_name (char *name) { match m; @@ -5218,7 +5219,7 @@ gfc_match_common (void) for (;;) { - m = match_common_name (name); + m = gfc_match_common_name (name); if (m == MATCH_ERROR) goto cleanup; diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index b3fb7033891e..ae31e366fe42 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -103,11 +103,9 @@ match gfc_match_call (void); /* We want to use this function to check for a common-block-name that can exist in a bind statement, so removed the "static" - declaration of the function in match.c. + declaration of the function in match.c. */ - TODO: should probably rename this now that it'll be globally seen to - gfc_match_common_name. */ -match match_common_name (char *name); +match gfc_match_common_name (char *name); match gfc_match_common (void); match gfc_match_block_data (void); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ce86d4822f58..4a97ffe289d5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -936,9 +936,16 @@ static void resolve_common_vars (gfc_common_head *common_block, bool named_common) { gfc_symbol *csym = common_block->head; + gfc_gsymbol *gsym; for (; csym; csym = csym->common_next) { + gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name); + if (gsym && gsym->type != GSYM_UNKNOWN && gsym->type != GSYM_COMMON) + gfc_error_now ("Global entity %qs at %L cannot appear in a " + "COMMON block at %L", gsym->name, + &gsym->where, &csym->common_block->where); + /* gfc_add_in_common may have been called before, but the reported errors have been ignored to continue parsing. We do the checks again here. */ diff --git a/gcc/testsuite/gfortran.dg/pr95614_1.f90 b/gcc/testsuite/gfortran.dg/pr95614_1.f90 new file mode 100644 index 000000000000..f835143365a2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr95614_1.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } + +module m ! { dg-error ".1." } + common m ! { dg-error "cannot appear in a COMMON" } +end + diff --git a/gcc/testsuite/gfortran.dg/pr95614_2.f90 b/gcc/testsuite/gfortran.dg/pr95614_2.f90 new file mode 100644 index 000000000000..9d69a5063846 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr95614_2.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } + +module m ! { dg-error ".1." } + common /xc/ m ! { dg-error "cannot appear in a COMMON" } +end + From 9389e3abc1fc4881f22c7376aae2dd650af2b792 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 27 Sep 2020 23:18:26 +0200 Subject: [PATCH 32/44] optabs: Don't reuse target for multi-word expansions if it overlaps operand(s) [PR97073] The following testcase is miscompiled on i686-linux, because we try to expand a double-word bitwise logic operation with op0 being a (mem:DI u) and target (mem:DI u+4), i.e. partial overlap, and thus end up with: movl 4(%esp), %eax andl u, %eax movl %eax, u+4 ! movl u+4, %eax optimized out andl 8(%esp), %eax movl %eax, u+8 rather than with the desired: movl 4(%esp), %edx movl 8(%esp), %eax andl u, %edx andl u+4, %eax movl %eax, u+8 movl %edx, u+4 because the store of the first word to target overwrites the second word of the operand. expand_binop for this (and several similar places) already check for target == op0 or target == op1, this patch just adds reg_overlap_mentioned_p calls next to it. Pedantically, at least for some of these it might be sufficient to force a different target if there is overlap but target is not rtx_equal_p to the operand (e.g. in this bitwise logical case, but e.g. not in the shift cases where there is reordering), though that would go against the preexisting target == op? checks and the rationale that REG_EQUAL notes in that case isn't correct. 2020-09-27 Jakub Jelinek PR middle-end/97073 * optabs.c (expand_binop, expand_absneg_bit, expand_unop, expand_copysign_bit): Check reg_overlap_mentioned_p between target and operand(s) and if it returns true, force a pseudo as target. * gcc.c-torture/execute/pr97073.c: New test. (cherry picked from commit a4b31d5807f2bc67c8999b3d53369cf2a5c6e1ec) --- gcc/optabs.c | 14 ++++++++++++- gcc/testsuite/gcc.c-torture/execute/pr97073.c | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr97073.c diff --git a/gcc/optabs.c b/gcc/optabs.c index d85ce47f7624..049a18ceb7c1 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1395,6 +1395,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1, if (target == 0 || target == op0 || target == op1 + || reg_overlap_mentioned_p (target, op0) + || reg_overlap_mentioned_p (target, op1) || !valid_multiword_target_p (target)) target = gen_reg_rtx (int_mode); @@ -1475,6 +1477,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1, if (target == 0 || target == op0 || target == op1 + || reg_overlap_mentioned_p (target, op0) + || reg_overlap_mentioned_p (target, op1) || !valid_multiword_target_p (target)) target = gen_reg_rtx (int_mode); @@ -1533,6 +1537,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1, || target == op0 || target == op1 || !REG_P (target) + || reg_overlap_mentioned_p (target, op0) + || reg_overlap_mentioned_p (target, op1) || !valid_multiword_target_p (target)) target = gen_reg_rtx (int_mode); @@ -2670,6 +2676,7 @@ expand_absneg_bit (enum rtx_code code, scalar_float_mode mode, if (target == 0 || target == op0 + || reg_overlap_mentioned_p (target, op0) || (nwords > 1 && !valid_multiword_target_p (target))) target = gen_reg_rtx (mode); @@ -2948,7 +2955,10 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target, int i; rtx_insn *insns; - if (target == 0 || target == op0 || !valid_multiword_target_p (target)) + if (target == 0 + || target == op0 + || reg_overlap_mentioned_p (target, op0) + || !valid_multiword_target_p (target)) target = gen_reg_rtx (int_mode); start_sequence (); @@ -3469,6 +3479,8 @@ expand_copysign_bit (scalar_float_mode mode, rtx op0, rtx op1, rtx target, if (target == 0 || target == op0 || target == op1 + || reg_overlap_mentioned_p (target, op0) + || reg_overlap_mentioned_p (target, op1) || (nwords > 1 && !valid_multiword_target_p (target))) target = gen_reg_rtx (mode); diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97073.c b/gcc/testsuite/gcc.c-torture/execute/pr97073.c new file mode 100644 index 000000000000..1955e6b8bd25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr97073.c @@ -0,0 +1,21 @@ +/* PR middle-end/97073 */ +/* { dg-additional-options "-mno-stv" { target i?86-*-* x86_64-*-* } } */ + +typedef unsigned long long L; +union U { L i; struct T { unsigned k; L l; } j; } u; + +__attribute__((noinline,noclone)) void +foo (L x) +{ + u.j.l = u.i & x; +} + +int +main () +{ + u.i = 5; + foo (-1ULL); + if (u.j.l != 5) + __builtin_abort (); + return 0; +} From bbccc4622190d04064bccb6184d2e5ad208449d7 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 28 Sep 2020 00:16:55 +0000 Subject: [PATCH 33/44] Daily bump. --- gcc/ChangeLog | 10 ++++++++++ gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 20 ++++++++++++++++++++ gcc/testsuite/ChangeLog | 18 ++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d42ed884c886..8a6a3c0c893d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2020-09-27 Jakub Jelinek + + Backported from master: + 2020-09-27 Jakub Jelinek + + PR middle-end/97073 + * optabs.c (expand_binop, expand_absneg_bit, expand_unop, + expand_copysign_bit): Check reg_overlap_mentioned_p between target + and operand(s) and if it returns true, force a pseudo as target. + 2020-09-25 Vladimir N. Makarov Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 51daa72546b6..0c0687f326cd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20200927 +20200928 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 23282d3545e7..7597b1cb559a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,23 @@ +2020-09-27 Mark Eggleston + + Backported from master: + 2020-09-27 Steven G. Kargl + Mark Eggleston + + PR fortran/95614 + * decl.c (gfc_get_common): Use gfc_match_common_name instead + of match_common_name. + * decl.c (gfc_bind_idents): Use gfc_match_common_name instead + of match_common_name. + * match.c : Rename match_common_name to gfc_match_common_name. + * match.c (gfc_match_common): Use gfc_match_common_name instead + of match_common_name. + * match.h : Rename match_common_name to gfc_match_common_name. + * resolve.c (resolve_common_vars): Check each symbol in a + common block has a global symbol. If there is a global symbol + issue an error if the symbol type is known as is not a common + block name. + 2020-09-18 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e270d7b88940..355e8147d1fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2020-09-27 Jakub Jelinek + + Backported from master: + 2020-09-27 Jakub Jelinek + + PR middle-end/97073 + * gcc.c-torture/execute/pr97073.c: New test. + +2020-09-27 Mark Eggleston + + Backported from master: + 2020-09-27 Steven G. Kargl + Mark Eggleston + + PR fortran/95614 + * gfortran.dg/pr95614_1.f90: New test. + * gfortran.dg/pr95614_2.f90: New test. + 2020-09-25 Vladimir N. Makarov Backported from master: From 4879a8ee30c0c440cc515e5e81c694215996d213 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 28 Sep 2020 09:00:46 +0200 Subject: [PATCH 34/44] Fix bogus alignment warning on address clause The compiler gives a bogus alignment warning on an address clause and a discriminated record type with variable size. gcc/ada/ChangeLog: * gcc-interface/decl.c (maybe_saturate_size): Add ALIGN parameter and round down the result to ALIGN. (gnat_to_gnu_entity): Adjust calls to maybe_saturate_size. gcc/testsuite/ChangeLog: * gnat.dg/addr16.adb: New test. * gnat.dg/addr16_pkg.ads: New helper. --- gcc/ada/gcc-interface/decl.c | 28 ++++++++++++++++++++-------- gcc/testsuite/gnat.dg/addr16.adb | 14 ++++++++++++++ gcc/testsuite/gnat.dg/addr16_pkg.ads | 9 +++++++++ 3 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/addr16.adb create mode 100644 gcc/testsuite/gnat.dg/addr16_pkg.ads diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 599b7d33701e..64335119dc2b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -232,7 +232,7 @@ static tree build_position_list (tree, bool, tree, tree, unsigned int, tree); static vec build_subst_list (Entity_Id, Entity_Id, bool); static vec build_variant_list (tree, vec, vec); -static tree maybe_saturate_size (tree); +static tree maybe_saturate_size (tree, unsigned int align); static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool, const char *, const char *); static void set_rm_size (Uint, tree, Entity_Id); @@ -4375,7 +4375,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If the size is self-referential, annotate the maximum value after saturating it, if need be, to avoid a No_Uint value. */ if (CONTAINS_PLACEHOLDER_P (gnu_size)) - gnu_size = maybe_saturate_size (max_size (gnu_size, true)); + { + const unsigned int align + = UI_To_Int (Alignment (gnat_entity)) * BITS_PER_UNIT; + gnu_size + = maybe_saturate_size (max_size (gnu_size, true), align); + } /* If we are just annotating types and the type is tagged, the tag and the parent components are not generated by the front-end so @@ -4411,7 +4416,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnu_size = size_binop (PLUS_EXPR, gnu_size, offset); } - gnu_size = maybe_saturate_size (round_up (gnu_size, align)); + gnu_size + = maybe_saturate_size (round_up (gnu_size, align), align); Set_Esize (gnat_entity, annotate_value (gnu_size)); /* Tagged types are Strict_Alignment so RM_Size = Esize. */ @@ -8851,15 +8857,21 @@ build_variant_list (tree qual_union_type, vec subst_list, } /* If SIZE has overflowed, return the maximum valid size, which is the upper - bound of the signed sizetype in bits; otherwise return SIZE unmodified. */ + bound of the signed sizetype in bits, rounded down to ALIGN. Otherwise + return SIZE unmodified. */ static tree -maybe_saturate_size (tree size) +maybe_saturate_size (tree size, unsigned int align) { if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size)) - size = size_binop (MULT_EXPR, - fold_convert (bitsizetype, TYPE_MAX_VALUE (ssizetype)), - build_int_cst (bitsizetype, BITS_PER_UNIT)); + { + size + = size_binop (MULT_EXPR, + fold_convert (bitsizetype, TYPE_MAX_VALUE (ssizetype)), + build_int_cst (bitsizetype, BITS_PER_UNIT)); + size = round_down (size, align); + } + return size; } diff --git a/gcc/testsuite/gnat.dg/addr16.adb b/gcc/testsuite/gnat.dg/addr16.adb new file mode 100644 index 000000000000..8f09da023fb2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/addr16.adb @@ -0,0 +1,14 @@ +-- { dg-do compile } + +with Addr16_Pkg; use Addr16_Pkg; + +procedure Addr16 (R : Rec) is + + pragma Unsuppress (Alignment_Check); + + B : Integer; + for B'Address use R.A'Address; + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/addr16_pkg.ads b/gcc/testsuite/gnat.dg/addr16_pkg.ads new file mode 100644 index 000000000000..9a1b9e3b21bd --- /dev/null +++ b/gcc/testsuite/gnat.dg/addr16_pkg.ads @@ -0,0 +1,9 @@ +package Addr16_Pkg is + + type Arr is array (Positive range <>) of Long_Long_Integer; + + type Rec (D : Positive) is record + A : Arr (1 .. D); + end record; + +end Addr16_Pkg; From 20ed049a8d7d5b879129c5550bfcde36a0c170ec Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Mon, 28 Sep 2020 12:07:07 +0100 Subject: [PATCH 35/44] Revert "Fortran : ICE in build_field PR95614" This reverts commit 4a67941a956003dcce8866604ba25f5a0bfd16cf. --- gcc/fortran/decl.c | 4 ++-- gcc/fortran/match.c | 5 ++--- gcc/fortran/match.h | 6 ++++-- gcc/fortran/resolve.c | 7 ------- gcc/testsuite/gfortran.dg/pr95614_1.f90 | 6 ------ gcc/testsuite/gfortran.dg/pr95614_2.f90 | 6 ------ 6 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 gcc/testsuite/gfortran.dg/pr95614_1.f90 delete mode 100644 gcc/testsuite/gfortran.dg/pr95614_2.f90 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 25b7be1e1479..c1a15f1a84ae 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5989,7 +5989,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, &tmp_sym); } - else if (gfc_match_common_name (name) == MATCH_YES) + else if (match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); @@ -6034,7 +6034,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, &tmp_sym); } - else if (gfc_match_common_name (name) == MATCH_YES) + else if (match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index bee73e7b0080..cb09c5f8ec53 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5166,8 +5166,7 @@ gfc_get_common (const char *name, int from_module) /* Match a common block name. */ -match -gfc_match_common_name (char *name) +match match_common_name (char *name) { match m; @@ -5219,7 +5218,7 @@ gfc_match_common (void) for (;;) { - m = gfc_match_common_name (name); + m = match_common_name (name); if (m == MATCH_ERROR) goto cleanup; diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index ae31e366fe42..b3fb7033891e 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -103,9 +103,11 @@ match gfc_match_call (void); /* We want to use this function to check for a common-block-name that can exist in a bind statement, so removed the "static" - declaration of the function in match.c. */ + declaration of the function in match.c. -match gfc_match_common_name (char *name); + TODO: should probably rename this now that it'll be globally seen to + gfc_match_common_name. */ +match match_common_name (char *name); match gfc_match_common (void); match gfc_match_block_data (void); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 4a97ffe289d5..ce86d4822f58 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -936,16 +936,9 @@ static void resolve_common_vars (gfc_common_head *common_block, bool named_common) { gfc_symbol *csym = common_block->head; - gfc_gsymbol *gsym; for (; csym; csym = csym->common_next) { - gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name); - if (gsym && gsym->type != GSYM_UNKNOWN && gsym->type != GSYM_COMMON) - gfc_error_now ("Global entity %qs at %L cannot appear in a " - "COMMON block at %L", gsym->name, - &gsym->where, &csym->common_block->where); - /* gfc_add_in_common may have been called before, but the reported errors have been ignored to continue parsing. We do the checks again here. */ diff --git a/gcc/testsuite/gfortran.dg/pr95614_1.f90 b/gcc/testsuite/gfortran.dg/pr95614_1.f90 deleted file mode 100644 index f835143365a2..000000000000 --- a/gcc/testsuite/gfortran.dg/pr95614_1.f90 +++ /dev/null @@ -1,6 +0,0 @@ -! { dg-do compile } - -module m ! { dg-error ".1." } - common m ! { dg-error "cannot appear in a COMMON" } -end - diff --git a/gcc/testsuite/gfortran.dg/pr95614_2.f90 b/gcc/testsuite/gfortran.dg/pr95614_2.f90 deleted file mode 100644 index 9d69a5063846..000000000000 --- a/gcc/testsuite/gfortran.dg/pr95614_2.f90 +++ /dev/null @@ -1,6 +0,0 @@ -! { dg-do compile } - -module m ! { dg-error ".1." } - common /xc/ m ! { dg-error "cannot appear in a COMMON" } -end - From 117b23e43f765cadbf3ca4b80602dc158789675b Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 22 Sep 2020 11:58:36 +0100 Subject: [PATCH 36/44] AArch64: Implement poly-type vadd intrinsics This implements the vadd[p]_p* intrinsics. In terms of functionality they are aliases of veor operations on the relevant unsigned types. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vadd_p8, vadd_p16, vadd_p64, vaddq_p8, vaddq_p16, vaddq_p64, vaddq_p128): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vadd_poly_1.c: New test. (cherry picked from commit fa9ad35dae03dcb20c4ccb50ba1b351a8ab77970) --- gcc/config/aarch64/arm_neon.h | 49 ++++++++++++++++++ .../gcc.target/aarch64/simd/vadd_poly_1.c | 50 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 50f8b23bc17b..81cabb2cb260 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -35659,6 +35659,55 @@ vusmmlaq_s32 (int32x4_t __r, uint8x16_t __a, int8x16_t __b) #pragma GCC pop_options +__extension__ extern __inline poly8x8_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vadd_p8 (poly8x8_t __a, poly8x8_t __b) +{ + return __a ^ __b; +} + +__extension__ extern __inline poly16x4_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vadd_p16 (poly16x4_t __a, poly16x4_t __b) +{ + return __a ^ __b; +} + +__extension__ extern __inline poly64x1_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vadd_p64 (poly64x1_t __a, poly64x1_t __b) +{ + return __a ^ __b; +} + +__extension__ extern __inline poly8x16_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vaddq_p8 (poly8x16_t __a, poly8x16_t __b) +{ + return __a ^ __b; +} + +__extension__ extern __inline poly16x8_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vaddq_p16 (poly16x8_t __a, poly16x8_t __b) +{ + return __a ^__b; +} + +__extension__ extern __inline poly64x2_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vaddq_p64 (poly64x2_t __a, poly64x2_t __b) +{ + return __a ^ __b; +} + +__extension__ extern __inline poly128_t +__attribute ((__always_inline__, __gnu_inline__, __artificial__)) +vaddq_p128 (poly128_t __a, poly128_t __b) +{ + return __a ^ __b; +} + #undef __aarch64_vget_lane_any #undef __aarch64_vdup_lane_any diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c new file mode 100644 index 000000000000..a5cdf290b0df --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c @@ -0,0 +1,50 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +poly8x8_t +foo (poly8x8_t a, poly8x8_t b) +{ + return vadd_p8 (a, b); +} + +poly16x4_t +foo16 (poly16x4_t a, poly16x4_t b) +{ + return vadd_p16 (a, b); +} + +poly64x1_t +foo64 (poly64x1_t a, poly64x1_t b) +{ + return vadd_p64 (a, b); +} + +poly8x16_t +fooq (poly8x16_t a, poly8x16_t b) +{ + return vaddq_p8 (a, b); +} + +poly16x8_t +fooq16 (poly16x8_t a, poly16x8_t b) +{ + return vaddq_p16 (a, b); +} + +poly64x2_t +fooq64 (poly64x2_t a, poly64x2_t b) +{ + return vaddq_p64 (a, b); +} + +poly128_t +fooq128 (poly128_t a, poly128_t b) +{ + return vaddq_p128 (a, b); +} + +/* { dg-final { scan-assembler-times "eor\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b, v\[0-9\]+\.8b" 3 } } */ +/* { dg-final { scan-assembler-times "eor\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "eor\\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */ From b8442a7c4c09375b76fa174313205fa7fcbfb016 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 22 Sep 2020 12:00:38 +0100 Subject: [PATCH 37/44] AArch64: Implement missing vceq*_p* intrinsics This patch implements some missing vceq* intrinsics on poly types. The behaviour is to produce the appropriate CMEQ instruction as for the unsigned types. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vceqq_p64, vceqz_p64, vceqzq_p64): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vceq_poly_1.c: New test. (cherry picked from commit d4703be185b422f637deebd3bb9222a41c8023d6) --- gcc/config/aarch64/arm_neon.h | 21 ++++++++++++++ .../gcc.target/aarch64/simd/vceq_poly_1.c | 29 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 81cabb2cb260..caeba10d4353 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -12670,6 +12670,13 @@ vceqq_u64 (uint64x2_t __a, uint64x2_t __b) return (__a == __b); } +__extension__ extern __inline uint64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vceqq_p64 (poly64x2_t __a, poly64x2_t __b) +{ + return (__a == __b); +} + /* vceq - scalar. */ __extension__ extern __inline uint32_t @@ -12779,6 +12786,13 @@ vceqz_u64 (uint64x1_t __a) return (__a == __AARCH64_UINT64_C (0)); } +__extension__ extern __inline uint64x1_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vceqz_p64 (poly64x1_t __a) +{ + return (__a == __AARCH64_UINT64_C (0)); +} + __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vceqzq_f32 (float32x4_t __a) @@ -12856,6 +12870,13 @@ vceqzq_u64 (uint64x2_t __a) return (__a == __AARCH64_UINT64_C (0)); } +__extension__ extern __inline uint64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vceqzq_p64 (poly64x2_t __a) +{ + return (__a == __AARCH64_UINT64_C (0)); +} + /* vceqz - scalar. */ __extension__ extern __inline uint32_t diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c new file mode 100644 index 000000000000..7d43352266c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +uint64x2_t +foo (poly64x2_t a, poly64x2_t b) +{ + return vceqq_p64 (a, b); +} + +/* { dg-final { scan-assembler-times "cmeq\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, v\[0-9\]+\.2d" 1 } } */ + +uint64x1_t +fooz (poly64x1_t a) +{ + return vceqz_p64 (a); +} + +/* { dg-final { scan-assembler-times "cmeq\\td\[0-9\]+, d\[0-9\]+, #0" 1 } } */ + +uint64x2_t +fooqz (poly64x2_t a) +{ + return vceqzq_p64 (a); +} + +/* { dg-final { scan-assembler-times "cmeq\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, #0" 1 } } */ + From 34db2d23439b39d2c7e5760f0f7de41f98b08c80 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 22 Sep 2020 12:03:49 +0100 Subject: [PATCH 38/44] AArch64: Implement missing vcls intrinsics on unsigned types This patch implements some missing intrinsics that perform a CLS on unsigned SIMD types. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vcls_u8, vcls_u16, vcls_u32, vclsq_u8, vclsq_u16, vclsq_u32): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vcls_unsigned_1.c: New test. (cherry picked from commit 30957092db46d8798e632feefb5df634488dbb33) --- gcc/config/aarch64/arm_neon.h | 42 +++++++++++++++ .../gcc.target/aarch64/simd/vcls_unsigned_1.c | 54 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index caeba10d4353..341019bc648b 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -14075,6 +14075,48 @@ vclsq_s32 (int32x4_t __a) return __builtin_aarch64_clrsbv4si (__a); } +__extension__ extern __inline int8x8_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vcls_u8 (uint8x8_t __a) +{ + return __builtin_aarch64_clrsbv8qi ((int8x8_t) __a); +} + +__extension__ extern __inline int16x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vcls_u16 (uint16x4_t __a) +{ + return __builtin_aarch64_clrsbv4hi ((int16x4_t) __a); +} + +__extension__ extern __inline int32x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vcls_u32 (uint32x2_t __a) +{ + return __builtin_aarch64_clrsbv2si ((int32x2_t) __a); +} + +__extension__ extern __inline int8x16_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vclsq_u8 (uint8x16_t __a) +{ + return __builtin_aarch64_clrsbv16qi ((int8x16_t) __a); +} + +__extension__ extern __inline int16x8_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vclsq_u16 (uint16x8_t __a) +{ + return __builtin_aarch64_clrsbv8hi ((int16x8_t) __a); +} + +__extension__ extern __inline int32x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vclsq_u32 (uint32x4_t __a) +{ + return __builtin_aarch64_clrsbv4si ((int32x4_t) __a); +} + /* vclz. */ __extension__ extern __inline int8x8_t diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c new file mode 100644 index 000000000000..f7078d1a67c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +int16x8_t +test_16x8 (uint16x8_t a) +{ + return vclsq_u16 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h" 1 } } */ + + +int8x16_t +test_8x16 (uint8x16_t a) +{ + return vclsq_u8 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b" 1 } } */ + +int32x4_t +test_32x4 (uint32x4_t a) +{ + return vclsq_u32 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s" 1 } } */ + +int16x4_t +test_16x4 (uint16x4_t a) +{ + return vcls_u16 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.4h, v\[0-9\]+\.4h" 1 } } */ + +int8x8_t +test_8x8 (uint8x8_t a) +{ + return vcls_u8 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b" 1 } } */ + +int32x2_t +test32x2 (uint32x2_t a) +{ + return vcls_u32 (a); +} + +/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.2s, v\[0-9\]+\.2s" 1 } } */ + From bc04ceb7b94d9144ac923210f1affaa3dfed0725 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 10:29:17 +0100 Subject: [PATCH 39/44] AArch64: Implement vstrq_p128 intrinsic This patch implements the missing vstrq_p128 intrinsic. It just performs a store of the poly128_t argument to a memory location. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vstrq_p128): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vstrq_p128_1.c: New test. (cherry picked from commit d23ea1e865301cd45f14ccbdb0bca49251fde9e1) --- gcc/config/aarch64/arm_neon.h | 7 +++++++ gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 341019bc648b..fe1ab0ddd179 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -30167,6 +30167,13 @@ vst4q_p64 (poly64_t * __a, poly64x2x4_t __val) __builtin_aarch64_st4v2di ((__builtin_aarch64_simd_di *) __a, __o); } +__extension__ extern __inline void +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vstrq_p128 (poly128_t * __ptr, poly128_t __val) +{ + *__ptr = __val; +} + /* vsub */ __extension__ extern __inline int64_t diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c new file mode 100644 index 000000000000..8d036fde0f15 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +void +test (poly128_t *ptr, poly128_t a) +{ + vstrq_p128 (ptr, a); +} + +/* { dg-final { scan-assembler-times {stp.*x2,.*x3,.*[x0]} 1 } } */ From 1c0679d6b5d12fb9d708442a8af725136a17f9cf Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 10:32:42 +0100 Subject: [PATCH 40/44] AArch64: Implement vldrq_p128 intrinsic This patch implements the missing vldrq_p128 intrinsic that just loads from the appropriate pointer. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vldrq_p128): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vldrq_p128_1.c: New test. (cherry picked from commit f2868e4bcff2c7b882d01231f039459c00e59d7b) --- gcc/config/aarch64/arm_neon.h | 7 +++++++ .../gcc.target/aarch64/simd/vldrq_p128_1.c | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index fe1ab0ddd179..32b0877e2826 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -19676,6 +19676,13 @@ vld4q_p64 (const poly64_t * __a) return ret; } +__extension__ extern __inline poly128_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vldrq_p128 (const poly128_t * __ptr) +{ + return *__ptr; +} + /* vldn_dup */ __extension__ extern __inline int8x8x2_t diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c new file mode 100644 index 000000000000..9c7e01b9e103 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +poly128_t +test (poly128_t * p) +{ + return vldrq_p128 (p); +} + +/* { dg-final { scan-assembler-times {ldp.*x0,.*x1,.*[x0]} 1 } } */ + From 5b9f76b95528775b3f09d151c56ff80747109498 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 11:07:50 +0100 Subject: [PATCH 41/44] AArch64: Implement missing _p64 intrinsics for vector permutes This patch implements some missing vector permute intrinsics operating on poly64x2_t types. They are implemented identically to their uint64x2_t brethren. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vtrn1q_p64, vtrn2q_p64, vuzp1q_p64, vuzp2q_p64, vzip1q_p64, vzip2q_p64): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/trn_zip_p64_1.c: New test. (cherry picked from commit e8e818399d70c5a5a3d30a54d305c6e2b92e2c66) --- gcc/config/aarch64/arm_neon.h | 67 +++++++++++++++++++ .../gcc.target/aarch64/simd/trn_zip_p64_1.c | 44 ++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 32b0877e2826..e8c130f5e806 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -30568,6 +30568,17 @@ vtrn1q_u32 (uint32x4_t __a, uint32x4_t __b) #endif } +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vtrn1q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2}); +#endif +} + __extension__ extern __inline uint64x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn1q_u64 (uint64x2_t __a, uint64x2_t __b) @@ -30838,6 +30849,18 @@ vtrn2q_u64 (uint64x2_t __a, uint64x2_t __b) #endif } + +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vtrn2q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3}); +#endif +} + __extension__ extern __inline float16x4x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vtrn_f16 (float16x4_t __a, float16x4_t __b) @@ -31484,6 +31507,17 @@ vuzp1q_u64 (uint64x2_t __a, uint64x2_t __b) #endif } +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vuzp1q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2}); +#endif +} + __extension__ extern __inline float16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vuzp2_f16 (float16x4_t __a, float16x4_t __b) @@ -31743,6 +31777,17 @@ vuzp2q_u64 (uint64x2_t __a, uint64x2_t __b) #endif } +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vuzp2q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3}); +#endif +} + __INTERLEAVE_LIST (uzp) /* vzip */ @@ -32011,6 +32056,17 @@ vzip1q_u64 (uint64x2_t __a, uint64x2_t __b) #endif } +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vzip1q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2}); +#endif +} + __extension__ extern __inline float16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vzip2_f16 (float16x4_t __a, float16x4_t __b) @@ -32275,6 +32331,17 @@ vzip2q_u64 (uint64x2_t __a, uint64x2_t __b) #endif } +__extension__ extern __inline poly64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vzip2q_p64 (poly64x2_t __a, poly64x2_t __b) +{ +#ifdef __AARCH64EB__ + return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0}); +#else + return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3}); +#endif +} + __INTERLEAVE_LIST (zip) #undef __INTERLEAVE_LIST diff --git a/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c b/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c new file mode 100644 index 000000000000..a47321db80b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +poly64x2_t +foo (poly64x2_t a, poly64x2_t b) +{ + return vtrn1q_p64 (a, b); +} + +poly64x2_t +foo1 (poly64x2_t a, poly64x2_t b) +{ + return vtrn2q_p64 (a, b); +} + +poly64x2_t +foo2 (poly64x2_t a, poly64x2_t b) +{ + return vuzp1q_p64 (a, b); +} + +poly64x2_t +foo3 (poly64x2_t a, poly64x2_t b) +{ + return vuzp2q_p64 (a, b); +} + +poly64x2_t +foo4 (poly64x2_t a, poly64x2_t b) +{ + return vzip1q_p64 (a, b); +} + +poly64x2_t +foo5 (poly64x2_t a, poly64x2_t b) +{ + return vzip2q_p64 (a, b); +} + +/* { dg-final { scan-assembler-times {zip1\tv0.2d, v0.2d, v1.2d} 3 } } */ +/* { dg-final { scan-assembler-times {zip2\tv0.2d, v0.2d, v1.2d} 3 } } */ + From 858cfd55807883dfe1e051ad7d67d9c0449728f9 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 12:02:29 +0100 Subject: [PATCH 42/44] AArch64: Implement missing vrndns_f32 intrinsic This patch implements the missing vrndns_f32 intrinsic. This operates on a scalar float32_t value. It can be mapped down to a __builtin_aarch64_frintnsf builtin. This patch does that. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ PR target/71233 * config/aarch64/aarch64-simd-builtins.def (frintn): Use BUILTIN_VHSDF_HSDF for modes. Remove explicit hf instantiation. * config/aarch64/arm_neon.h (vrndns_f32): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/simd/vrndns_f32_1.c: New test. (cherry picked from commit 02b5377b3766804059b7824330d33d0e1cef2e5b) --- gcc/config/aarch64/aarch64-simd-builtins.def | 3 +-- gcc/config/aarch64/arm_neon.h | 7 +++++++ .../gcc.target/aarch64/simd/vrndns_f32_1.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 332a0b6b1eae..a1d88d0caead 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -334,12 +334,11 @@ BUILTIN_VHSDF (UNOP, nearbyint, 2) BUILTIN_VHSDF (UNOP, rint, 2) BUILTIN_VHSDF (UNOP, round, 2) - BUILTIN_VHSDF_DF (UNOP, frintn, 2) + BUILTIN_VHSDF_HSDF (UNOP, frintn, 2) VAR1 (UNOP, btrunc, 2, hf) VAR1 (UNOP, ceil, 2, hf) VAR1 (UNOP, floor, 2, hf) - VAR1 (UNOP, frintn, 2, hf) VAR1 (UNOP, nearbyint, 2, hf) VAR1 (UNOP, rint, 2, hf) VAR1 (UNOP, round, 2, hf) diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index e8c130f5e806..b3c9b6420142 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -26073,6 +26073,13 @@ vrndmq_f64 (float64x2_t __a) /* vrndn */ +__extension__ extern __inline float32_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vrndns_f32 (float32_t __a) +{ + return __builtin_aarch64_frintnsf (__a); +} + __extension__ extern __inline float32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrndn_f32 (float32x2_t __a) diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c new file mode 100644 index 000000000000..960e4f6f7688 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +float32_t +test (float32_t a) +{ + return vrndns_f32 (a); +} + +/* { dg-final { scan-assembler-times "frintn\\ts\[0-9\]+, s\[0-9\]+" 1 } } */ + From 677f34508f1c8fba6a52c77f83eca08b6762ed28 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 17:37:58 +0100 Subject: [PATCH 43/44] AArch64: Implement missing p128<->f64 reinterpret intrinsics This patch implements the missing reinterprets to and from poly128_t and float64x2_t. I've plugged in the appropriate testing in the advsimd-intrinsics.exp too. Bootstrapped and tested on aarch64-none-linux-gnu. Tested advsimd-intrinsics.exp on arm-none-eabi too to make sure arm testing isn't affected. gcc/ PR target/71233 * config/aarch64/arm_neon.h (vreinterpretq_f64_p128, vreinterpretq_p128_f64): Define. gcc/testsuite/ PR target/71233 * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h (clean_results): Add float64x2_t cleanup. (DECL_VARIABLE_128BITS_VARIANTS): Add float64x2_t variable. * gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c: Add testing of vreinterpretq_f64_p128, vreinterpretq_p128_f64. (cherry picked from commit 65c9878641cbe0ed898aa7047b7b994e9d4a5bb1) --- gcc/config/aarch64/arm_neon.h | 14 ++++++++++++++ .../aarch64/advsimd-intrinsics/arm-neon-ref.h | 8 ++++++-- .../advsimd-intrinsics/vreinterpret_p128.c | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index b3c9b6420142..9a970e7ed1e3 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -6088,6 +6088,20 @@ vreinterpretq_u32_p128 (poly128_t __a) return (uint32x4_t)__a; } +__extension__ extern __inline float64x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vreinterpretq_f64_p128 (poly128_t __a) +{ + return (float64x2_t) __a; +} + +__extension__ extern __inline poly128_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vreinterpretq_p128_f64 (float64x2_t __a) +{ + return (poly128_t) __a; +} + /* vset_lane */ __extension__ extern __inline float16x4_t diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h index fde6029b7fc1..791972c737e7 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h @@ -460,6 +460,8 @@ static void clean_results (void) #endif CLEAN(result, float, 32, 4); + AARCH64_ONLY(CLEAN(result, float, 64, 2)); + #if defined(__aarch64__) /* On AArch64, make sure to return DefaultNaN to have the same results as on AArch32. */ @@ -544,7 +546,8 @@ static void clean_results (void) DECL_VARIABLE(VAR, poly, 16, 8); \ DECL_VARIABLE_CRYPTO(VAR, poly, 64, 2); \ DECL_VARIABLE(VAR, float, 16, 8); \ - DECL_VARIABLE(VAR, float, 32, 4) + DECL_VARIABLE(VAR, float, 32, 4); \ + AARCH64_ONLY(DECL_VARIABLE(VAR, float, 64, 2)) #else #define DECL_VARIABLE_128BITS_VARIANTS(VAR) \ DECL_VARIABLE_128BITS_SIGNED_VARIANTS(VAR); \ @@ -552,7 +555,8 @@ static void clean_results (void) DECL_VARIABLE(VAR, poly, 8, 16); \ DECL_VARIABLE(VAR, poly, 16, 8); \ DECL_VARIABLE_CRYPTO(VAR, poly, 64, 2); \ - DECL_VARIABLE(VAR, float, 32, 4) + DECL_VARIABLE(VAR, float, 32, 4); \ + AARCH64_ONLY(DECL_VARIABLE(VAR, float, 64, 2)) #endif /* Declare all variants. */ #define DECL_VARIABLE_ALL_VARIANTS(VAR) \ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c index 25b348223f3d..67f809c70651 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c @@ -33,6 +33,10 @@ VECT_VAR_DECL(vreint_expected_q_p128_f32,poly,64,2) [] = { 0xc1700000c1800000, 0xc1500000c1600000 }; VECT_VAR_DECL(vreint_expected_q_p128_f16,poly,64,2) [] = { 0xca80cb00cb80cc00, 0xc880c900c980ca00 }; +#ifdef __aarch64__ +VECT_VAR_DECL(vreint_expected_q_p128_f64,poly,64,2) [] = { 0xc030000000000000, + 0xc02e000000000000 }; +#endif /* Expected results: vreinterpretq_*_p128. */ VECT_VAR_DECL(vreint_expected_q_s8_p128,int,8,16) [] = { 0xf0, 0xff, 0xff, 0xff, @@ -75,6 +79,10 @@ VECT_VAR_DECL(vreint_expected_q_f16_p128,hfloat,16,8) [] = { 0xfff0, 0xffff, 0xffff, 0xffff, 0xfff1, 0xffff, 0xffff, 0xffff }; +#ifdef __aarch64__ +VECT_VAR_DECL(vreint_expected_q_f64_p128,hfloat,64,2) [] = { 0xfffffffffffffff0, + 0xfffffffffffffff1 }; +#endif int main (void) { @@ -90,6 +98,10 @@ int main (void) #endif VLOAD(vreint_vector, buffer, q, float, f, 32, 4); +#ifdef __aarch64__ + VLOAD(vreint_vector, buffer, q, float, f, 64, 2); +#endif + /* vreinterpretq_p128_* tests. */ #undef TEST_MSG #define TEST_MSG "VREINTERPRETQ_P128_*" @@ -121,6 +133,10 @@ int main (void) #endif TEST_VREINTERPRET128(q, poly, p, 128, 1, float, f, 32, 4, vreint_expected_q_p128_f32); +#ifdef __aarch64__ + TEST_VREINTERPRET128(q, poly, p, 128, 1, float, f, 64, 2, vreint_expected_q_p128_f64); +#endif + /* vreinterpretq_*_p128 tests. */ #undef TEST_MSG #define TEST_MSG "VREINTERPRETQ_*_P128" @@ -161,5 +177,8 @@ int main (void) #endif TEST_VREINTERPRET_FP_FROM_P128(q, float, f, 32, 4, poly, p, 128, 1, vreint_expected_q_f32_p128); +#ifdef __aarch64__ + TEST_VREINTERPRET_FP_FROM_P128(q, float, f, 64, 2, poly, p, 128, 1, vreint_expected_q_f64_p128); +#endif return 0; } From a6c47f4ce26639bfbc72821ae629b9af7744a9d7 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 25 Sep 2020 10:40:18 +0000 Subject: [PATCH 44/44] testsuite: [aarch64] Fix aarch64/advsimd-intrinsics/v{trn,uzp,zip}_half.c Since r11-3402 (g:65c9878641cbe0ed898aa7047b7b994e9d4a5bb1), the vtrn_half, vuzp_half and vzip_half started failing with vtrn_half.c:76:17: error: redeclaration of 'vector_float64x2' with no linkage vtrn_half.c:77:17: error: redeclaration of 'vector2_float64x2' with no linkage vtrn_half.c:80:17: error: redeclaration of 'vector_res_float64x2' with no linkage This is because r11-3402 now always declares float64x2 variables for aarch64, leading to a duplicate declaration in these testcases. The fix is simply to remove these now useless declarations. These tests are skipped on arm*, so there is no impact on that target. 2020-09-25 Christophe Lyon gcc/testsuite/ PR target/71233 * gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c: Remove declarations of vector, vector2, vector_res for float64x2 type. * gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vzip_half.c: Likewise. (cherry picked from commit 8c775bf447e190024fa08c55e38db94dd013a393) --- .../gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c | 3 --- .../gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c | 3 --- .../gcc.target/aarch64/advsimd-intrinsics/vzip_half.c | 3 --- 3 files changed, 9 deletions(-) diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c index 63f820fbf5a9..25a0f1985182 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c @@ -73,11 +73,8 @@ void exec_vtrn_half (void) /* Input vector can only have 64 bits. */ DECL_VARIABLE_ALL_VARIANTS(vector); DECL_VARIABLE_ALL_VARIANTS(vector2); - DECL_VARIABLE(vector, float, 64, 2); - DECL_VARIABLE(vector2, float, 64, 2); DECL_VARIABLE_ALL_VARIANTS(vector_res); - DECL_VARIABLE(vector_res, float, 64, 2); clean_results (); /* We don't have vtrn1_T64x1, so set expected to the clean value. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c index 8706f248591a..2e6b666b71d3 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c @@ -70,11 +70,8 @@ void exec_vuzp_half (void) /* Input vector can only have 64 bits. */ DECL_VARIABLE_ALL_VARIANTS(vector); DECL_VARIABLE_ALL_VARIANTS(vector2); - DECL_VARIABLE(vector, float, 64, 2); - DECL_VARIABLE(vector2, float, 64, 2); DECL_VARIABLE_ALL_VARIANTS(vector_res); - DECL_VARIABLE(vector_res, float, 64, 2); clean_results (); /* We don't have vuzp1_T64x1, so set expected to the clean value. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c index 619d6b2e6ed3..ef42451c82e0 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c @@ -73,11 +73,8 @@ void exec_vzip_half (void) /* Input vector can only have 64 bits. */ DECL_VARIABLE_ALL_VARIANTS(vector); DECL_VARIABLE_ALL_VARIANTS(vector2); - DECL_VARIABLE(vector, float, 64, 2); - DECL_VARIABLE(vector2, float, 64, 2); DECL_VARIABLE_ALL_VARIANTS(vector_res); - DECL_VARIABLE(vector_res, float, 64, 2); clean_results (); /* We don't have vzip1_T64x1, so set expected to the clean value. */