platform/upstream/gcc.git
3 years agolibstdc++: Remove #error from <semaphore> implementation [PR 100179]
Jonathan Wakely [Thu, 22 Apr 2021 10:10:06 +0000 (11:10 +0100)]
libstdc++: Remove #error from <semaphore> implementation [PR 100179]

This removes the #error from <bits/semaphore_base.h> for the case where
neither __atomic_semaphore nor __platform_semaphore is defined.

Also rename the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro to
_GLIBCXX_USE_POSIX_SEMAPHORE for consistency with the similar
_GLIBCXX_USE_CXX11_ABI macro that can be used to request an alternative
(ABI-changing) implementation.

libstdc++-v3/ChangeLog:

PR libstdc++/100179
* include/bits/semaphore_base.h: Remove #error.
* include/std/semaphore: Do not define anything unless one of
the implementations is available.

3 years agotestsuite/aarch64: Run pr99988.c test under lp64 only
Christophe Lyon [Thu, 22 Apr 2021 12:43:25 +0000 (12:43 +0000)]
testsuite/aarch64: Run pr99988.c test under lp64 only

The new test fails with -mabi=ilp32:
sorry, unimplemented: return address signing is only supported for '-mabi=lp64'

2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
PR target/99988
* gcc.target/aarch64/pr99988.c: Skip if not lp64 target.

3 years agogfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS
Tobias Burnus [Thu, 22 Apr 2021 09:05:17 +0000 (11:05 +0200)]
gfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS

pr68078.f90 tests out-of-memory handling and calls set_vm_limit to set the
soft limit.  However, setrlimit was then called with hard limit RLIM_INFINITY,
which failed when the current hard limit was lower.

gcc/testsuite/
* gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use
obtained hard limit, and only call setrlimit if new softlimit is lower.

3 years agotestsuite/100176 - fix struct-layout-1_generate.c compile
Richard Biener [Thu, 22 Apr 2021 07:50:26 +0000 (09:50 +0200)]
testsuite/100176 - fix struct-layout-1_generate.c compile

With -Werror=return-type we run into compile fails complaining about
missing return stmts.

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

PR testsuite/100176
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add
missing return.

3 years agoAvoid -latomic for amdgcn offloading
Richard Biener [Wed, 21 Apr 2021 12:54:05 +0000 (14:54 +0200)]
Avoid -latomic for amdgcn offloading

libatomic isn't built for amdgcn but reduction-16.c adds it
via -foffload=-latomic when offloading for nvptx is enabled.
The following avoids linker errors when offloading to amdgcn is enabled
as well.

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

libgomp/
* testsuite/libgomp.c-c++-common/reduction-16.c: Use -latomic
only on nvptx-none.

3 years agoFix Fortran rounding issues, PR fortran/96983.
Michael Meissner [Thu, 22 Apr 2021 03:02:07 +0000 (23:02 -0400)]
Fix Fortran rounding issues, PR fortran/96983.

I was looking at Fortran PR 96983, which fails on the PowerPC when trying to
run the test PR96711.F90.  The compiler ICEs because the PowerPC does not have
a floating point type with a type precision of 128.  The reason is that the
PowerPC has 3 different 128 bit floating point types (__float128/_Float128,
__ibm128, and long double).  Currently long double uses the IBM extended double
type, but we would like to switch to using IEEE 128-bit long doubles in the
future.

In order to prevent the compiler from converting explicit __ibm128 types to
long double when long double uses the IEEE 128-bit representation, we have set
up the precision for __ibm128 to be 128, long double to be 127, and
__float128/_Float128 to be 126.

Originally, I was trying to see if for Fortran, I could change the precision of
long double to be 128 (Fortran doesn't access __ibm128), but it quickly became
hard to get the changes to work.

I looked at the Fortran code in build_round_expr, and I came to the conclusion
that there is no reason to promote the floating point type.  If you just do a
normal round of the value using the current floating point format and then
convert it to the integer type.  We don't have an appropriate built-in function
that provides the equivalent of llround for 128-bit integer types.

This patch fixes the compiler crash.

However, while with this patch, the PowerPC compiler will not crash when
building the test case, it will not run on the current default installation.
The failure is because the test is explicitly expecting 128-bit floating point
to handle 10384593717069655257060992658440192_16 (i.e. 2**113).

By default, the PowerPC uses IBM extended double used for 128-bit floating
point.  The IBM extended double format is a pair of doubles that provides more
mantissa bits but does not grow the expoenent range.  The value in the test is
fine for IEEE 128-bit floating point, but it is too large for the PowerPC
extended double setup.

I have built the following tests with this patch:

   * I have built a bootstrap compiler on a little endian power9 Linux system
     with the default long double format (IBM extended double).  The
     pr96711.f90 test builds, but it does not run due to the range of the
     real*16 exponent.  There were no other regressions in the C/C++/Fortran
     tests.

   * I have built a bootstrap compiler on a little endian power9 Linux system
     with the default long double format set to IEEE 128-bit. I used the
     Advance Toolchain 14.0-2 to provide the IEEE 128-bits.  The compiler was
     configured to build power9 code by default, so the test generated native
     power9 IEEE 128-bit instructions.  The pr96711.f90 test builds and runs
     correctly in this setup.

   * I have built a bootstrap compiler on a big endian power8 Linux system with
     the default long double format (IBM extended double).  Like the first
     case, the pr96711.f90 test does not crash the compiler, but the test fails
     due to the range of the real*16 exponent.    There were no other
     regressions in the C/C++/Fortran tests.

   * I built a bootstrap compiler on my x86_64 laptop.  There were no
     regressions in the tests.

gcc/fortran/
2021-04-21  Michael Meissner  <meissner@linux.ibm.com>

PR fortran/96983
* trans-intrinsic.c (build_round_expr): If int type is larger than
long long, do the round and convert to the integer type.  Do not
try to find a floating point type the exact size of the integer
type.

3 years agoDaily bump.
GCC Administrator [Thu, 22 Apr 2021 00:16:32 +0000 (00:16 +0000)]
Daily bump.

3 years agolibgomp.fortran/depobj-1.f90: Fix omp_depend_kind
Tobias Burnus [Wed, 21 Apr 2021 20:47:18 +0000 (22:47 +0200)]
libgomp.fortran/depobj-1.f90: Fix omp_depend_kind

libgomp/
* testsuite/libgomp.fortran/depobj-1.f90: Use omp_lib's
omp_depend_kind instead of defining it as 16.

3 years ago[libstdc++] Fix test timeout in stop_calback/destroy.cc
Thomas Rodgers [Wed, 21 Apr 2021 17:01:06 +0000 (10:01 -0700)]
[libstdc++] Fix test timeout in stop_calback/destroy.cc

A change was made to __atomic_semaphore::_S_do_try_acquire() to
(ideally) let the compare_exchange reload the value of __old rather than
always reloading it twice. This causes _M_acquire to spin indefinitely
if the value of __old is already 0.

libstdc++-v3/ChangeLog:
* include/bits/semaphore_base.h: Always reload __old in
__atomic_semaphore::_S_do_try_acquire().
* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
re-enable testcase.

3 years agoDarwin, X86 : Fix bootstrap break from flags changes.
Iain Sandoe [Wed, 21 Apr 2021 19:40:48 +0000 (20:40 +0100)]
Darwin, X86 : Fix bootstrap break from flags changes.

The changes from r12-36-g1751bec027f030515889fcf4baa9c91501aafc85
did not remove the uses of TARGET_ISA_* from i386/darwin.h.

Fixed thus.

gcc/ChangeLog:

* config/i386/darwin.h (TARGET_64BIT): Remove definition
based on TARGET_ISA_64BIT.
(TARGET_64BIT_P): Remove definition based on
TARGET_ISA_64BIT_P().

3 years agoRevert "Use std::thread::hardware_concurrency in lto-wrapper.c."
Martin Liska [Wed, 21 Apr 2021 19:33:41 +0000 (21:33 +0200)]
Revert "Use std::thread::hardware_concurrency in lto-wrapper.c."

This reverts commit 0a18305ee11e139838771f96c5a037a29606236e.

3 years agoCall toplev::finalize in CHECKING_P mode.
Martin Liska [Mon, 11 Jan 2021 17:12:54 +0000 (18:12 +0100)]
Call toplev::finalize in CHECKING_P mode.

gcc/ChangeLog:

PR jit/98615
* main.c (main): Call toplev::finalize in CHECKING_P mode.
* ipa-modref.c (ipa_modref_c_finalize): summaries are NULL
when incremental LTO linking happens.

3 years agolibgomp/testsuite: Fix checks for dg-excess-errors
Tobias Burnus [Wed, 21 Apr 2021 18:07:19 +0000 (20:07 +0200)]
libgomp/testsuite: Fix checks for dg-excess-errors

For the tests modified below, the effective target line has to be effective
when compiling for an offload target, except that variable-not-offloaded.c
would compile with unified-share memory and pr86416-*.c if long double/float128
is supported.
The previous check used a run-time device ability check. This new variant
now enables those dg- lines when _compiling_ for nvptx or gcn.

libgomp/ChangeLog:

* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
New, based on check_effective_target_offload_target_nvptx.
(check_effective_target_offload_target_nvptx): Call it.
(check_effective_target_offload_target_amdgcn): New.
* testsuite/libgomp.c-c++-common/function-not-offloaded.c:
Require target offload_target_nvptx || offload_target_amdgcn.
* testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Likewise.
* testsuite/libgomp.c/pr86416-1.c: Likewise.
* testsuite/libgomp.c/pr86416-2.c: Likewise.

3 years agolibstdc++: Install libstdc++*-gdb.py more robustly [PR 99453]
Philippe Blain [Sat, 13 Mar 2021 00:26:46 +0000 (19:26 -0500)]
libstdc++: Install libstdc++*-gdb.py more robustly [PR 99453]

In order for GDB to auto-load the pretty printers, they must be installed
as "libstdc++.$ext-gdb.py", where 'libstdc++.$ext' is the name of the
object file that is loaded by GDB [1], i.e. the libstdc++ shared library.

The approach taken in libstdc++-v3/python/Makefile.am is to loop over
files matching 'libstdc++*' in $(DESTDIR)$(toolexeclibdir) and choose
the last file matching that glob that is not a symlink, the Libtool
'*.la' file or a Python file.

That works fine for ELF targets where the matching names are:

  libstdc++.a
  libstdc++.so
  libstdc++.so.6
  libstdc++.so.6.0.29

But not for macOS with:

  libstdc++.6.dylib
  libstdc++.a

Or MinGW with:

  libstdc++-6.dll
  libstdc++.dll.a

Try to make a better job at installing the pretty printers with the
correct name by copying the approach taken by isl [2], that is, using
a sed invocation on the Libtool-generated 'libstdc++.la' to read the
correct name for the current platform.

[1] https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html
[2] https://repo.or.cz/isl.git/blob/HEAD:/Makefile.am#l611

libstdc++-v3/ChangeLog:

PR libstdc++/99453
* python/Makefile.am: Install libstdc++*-gdb.py more robustly.
* python/Makefile.in: Regenerate.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
3 years agotestsuite: Fix bind_c_array_params_2.f90 on AIX
David Edelsohn [Wed, 21 Apr 2021 12:27:31 +0000 (08:27 -0400)]
testsuite: Fix bind_c_array_params_2.f90 on AIX

gcc/testsuite/ChangeLog:

* gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call
pattern.

3 years ago[libstdc++] Add missing _M_try_acquire() to __platform_semaphore
Thomas Rodgers [Wed, 21 Apr 2021 15:15:16 +0000 (08:15 -0700)]
[libstdc++] Add missing _M_try_acquire() to __platform_semaphore

libstdc++-v3/ChangeLog:
* include/bits/semaphore_base.h: Add missing _M_try_acquire()
member to __platform_wait.

3 years agoLTO: fallback to -flto=N if -flto=jobserver does not work.
Martin Liska [Fri, 12 Mar 2021 12:37:06 +0000 (13:37 +0100)]
LTO: fallback to -flto=N if -flto=jobserver does not work.

gcc/ChangeLog:

* lto-wrapper.c (run_gcc): When -flto=jobserver is used, but the
makeserver cannot be detected, then use -flto=N fallback.

3 years agoc++: Don't allow defining types in enum-base [PR96380]
Marek Polacek [Tue, 20 Apr 2021 16:16:04 +0000 (12:16 -0400)]
c++: Don't allow defining types in enum-base [PR96380]

In r11-2064 I made cp_parser_enum_specifier commit to tentative parse
when seeing a '{'.  That still looks like the correct thing to do, but
it caused an ICE-on-invalid as well as accepts-invalid.

When we have something sneaky like this, which is broken in multiple
ways:

  template <class>
  enum struct c : union enum struct c { e = b, f = a };

we parse the "enum struct c" part (that's OK) and then we see that
we have an enum-base, so we consume ':' and then parse the type-specifier
that follows the :.  "union enum" is clearly invalid, but we're still
parsing tentatively and we parse everything up to the ;, and then
throw away the underlying type.  We parsed everything because we were
tricked into parsing an enum-specifier in an enum-base of another
enum-specifier!  Not good.

Since the grammar for enum-base doesn't allow a defining-type-specifier,
only a type-specifier, we should set type_definition_forbidden_message
which fixes all the problems in this PR.

gcc/cp/ChangeLog:

PR c++/96380
* parser.c (cp_parser_enum_specifier): Don't allow defining
types in enum-base.

gcc/testsuite/ChangeLog:

PR c++/96380
* g++.dg/cpp0x/enum_base4.C: New test.
* g++.dg/cpp0x/enum_base5.C: New test.

3 years agoFix clang warning (-Wstring-plus-int)
Martin Liska [Wed, 21 Apr 2021 14:52:17 +0000 (16:52 +0200)]
Fix clang warning (-Wstring-plus-int)

This fixes:

lto-plugin.c:642:7: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]

lto-plugin/ChangeLog:

* lto-plugin.c (exec_lto_wrapper): Make a temp variable.

3 years agoaarch64: Always use .init/.fini_array for GNU/Linux
Richard Sandiford [Wed, 21 Apr 2021 14:36:51 +0000 (15:36 +0100)]
aarch64: Always use .init/.fini_array for GNU/Linux

I was wondering why the (now fixed) c-c++-common/attr-retain-[78].c
failures were showing up in the native results for aarch64-linux-gnu
but not in the posted cross results.  It turns out that .init/
.fini_array support is disabled by default for cross builds,
which in turn stops those tests from running.

The test for .init/fini_array support has two parts: one that builds
something with the assembler and linker, and another that compiles
C code and uses preprocessor macros to test the glibc version.
The first test would work with build=host but the second is only
safe for build=target.

However, AArch64 postdates glibc and binutils support for
.init/fini_array by some distance, so it's safe to hard-code the
result to "yes" for cross compilers.

This fixes the only material difference in auto-host.h between
a native and a cross build.

gcc/
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): When cross-compiling,
default to yes for aarch64-linux-gnu.
* configure: Regenerate.

3 years agoUse std::thread::hardware_concurrency in lto-wrapper.c.
Martin Liska [Thu, 11 Mar 2021 10:37:50 +0000 (11:37 +0100)]
Use std::thread::hardware_concurrency in lto-wrapper.c.

gcc/ChangeLog:

* lto-wrapper.c (cpuset_popcount): Remove.
(init_num_threads): Remove and use hardware_concurrency.

3 years agoFix clang warnings.
Martin Liska [Mon, 15 Mar 2021 08:45:41 +0000 (09:45 +0100)]
Fix clang warnings.

gcc/ChangeLog:

* config/i386/i386.c: Remove superfluous || TARGET_MACHO
which remains to be '(... || 0)' and clang complains about it.
* dwarf2out.c (AT_vms_delta): Declare conditionally.
(add_AT_vms_delta): Likewise.
* tree.c (fld_simplified_type): Use rather more common pattern
for disabling of something (#if 0).
(get_tree_code_name): Likewise.
(verify_type_variant): Likewise.

3 years agoRemove TARGET_foo (ix86_tune == PROCESSOR_foo) macros.
Martin Liska [Tue, 9 Mar 2021 13:56:54 +0000 (14:56 +0100)]
Remove TARGET_foo (ix86_tune == PROCESSOR_foo) macros.

gcc/ChangeLog:

* config/i386/i386-expand.c (decide_alignment): Use newly named
macro TARGET_CPU_P.
* config/i386/i386.c (ix86_decompose_address): Likewise.
(ix86_address_cost): Likewise.
(ix86_lea_outperforms): Likewise.
(ix86_avoid_lea_for_addr): Likewise.
(ix86_add_stmt_cost): Likewise.
* config/i386/i386.h (TARGET_*): Remove.
(TARGET_CPU_P): New macro.
* config/i386/i386.md: Use newly named macro TARGET_CPU_P.
* config/i386/x86-tune-sched-atom.c (do_reorder_for_imul): Likewise.
(swap_top_of_ready_list): Likewise.
(ix86_atom_sched_reorder): Likewise.
* config/i386/x86-tune-sched-bd.c (ix86_bd_has_dispatch): Likewise.
* config/i386/x86-tune-sched.c (ix86_adjust_cost): Likewise.

3 years agoOverhaul in isa_flags and handling it.
Martin Liska [Mon, 8 Mar 2021 13:54:18 +0000 (14:54 +0100)]
Overhaul in isa_flags and handling it.

gcc/ChangeLog:

* config/i386/i386-options.c (TARGET_EXPLICIT_NO_SAHF_P):
Define.
(SET_TARGET_NO_SAHF): Likewise.
(TARGET_EXPLICIT_PREFETCH_SSE_P): Likewise.
(SET_TARGET_PREFETCH_SSE): Likewise.
(TARGET_EXPLICIT_NO_TUNE_P): Likewise.
(SET_TARGET_NO_TUNE): Likewise.
(TARGET_EXPLICIT_NO_80387_P): Likewise.
(SET_TARGET_NO_80387): Likewise.
(DEF_PTA): New.
* config/i386/i386.h (TARGET_*): Remove.
* opth-gen.awk: Generate new used macros.

3 years agoGenerate PTA features from a def file.
Martin Liska [Mon, 8 Mar 2021 12:53:09 +0000 (13:53 +0100)]
Generate PTA features from a def file.

gcc/ChangeLog:

* config/i386/i386.h (PTA_*): Remove.
(enum pta_flag): New.
(DEF_PTA): Generate PTA_* values from i386-isa.def.
* config/i386/i386-isa.def: New file.

3 years agoaarch64: Avoid duplicating bti j insns for jump tables [PR99988]
Alex Coplan [Wed, 21 Apr 2021 13:42:04 +0000 (14:42 +0100)]
aarch64: Avoid duplicating bti j insns for jump tables [PR99988]

This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.

The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.

gcc/ChangeLog:

PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.

gcc/testsuite/ChangeLog:

PR target/99988
* gcc.target/aarch64/pr99988.c: New test.

3 years agotestsuite: Add -fchecking to dg-ice tests
Jakub Jelinek [Wed, 21 Apr 2021 13:17:10 +0000 (15:17 +0200)]
testsuite: Add -fchecking to dg-ice tests

In --enable-checking=release builds (which is the default on release
branches), I'm getting various extra FAILs that don't appear in
--enable-checking=yes builds.

XPASS: g++.dg/cpp0x/constexpr-52830.C  -std=c++14 (internal compiler error)
FAIL: g++.dg/cpp0x/constexpr-52830.C  -std=c++14 (test for excess errors)
XPASS: g++.dg/cpp0x/constexpr-52830.C  -std=c++17 (internal compiler error)
FAIL: g++.dg/cpp0x/constexpr-52830.C  -std=c++17 (test for excess errors)
XPASS: g++.dg/cpp0x/constexpr-52830.C  -std=c++2a (internal compiler error)
FAIL: g++.dg/cpp0x/constexpr-52830.C  -std=c++2a (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++2a (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++2a (test for excess errors)
FAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++2a (test for excess errors)
FAIL: g++.dg/cpp2a/nontype-class39.C  -std=c++2a (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c  -std=c++14 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c  -std=c++17 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c  -std=c++2a (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c  -std=c++98 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c  -std=c++14 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c  -std=c++17 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c  -std=c++2a (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c  -std=c++98 (test for excess errors)

These are tests that have dg-ice and most of those ICEs are checking ICEs
which go away in release checking when -fno-checking is the default.

The following patch adds -fchecking option to those.

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

* g++.dg/cpp1z/constexpr-lambda26.C: Add dg-additional-options
-fchecking.
* g++.dg/cpp1y/auto-fn61.C: Likewise.
* g++.dg/cpp2a/nontype-class39.C: Likewise.
* g++.dg/cpp0x/constexpr-52830.C: Likewise.
* g++.dg/cpp0x/vt-88982.C: Likewise.
* c-c++-common/goacc/kernels-decompose-ice-1.c: Add -fchecking to
dg-additional-options.
* c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.

3 years agox86: Add -mmwait for -mgeneral-regs-only
H.J. Lu [Thu, 15 Apr 2021 18:19:32 +0000 (11:19 -0700)]
x86: Add -mmwait for -mgeneral-regs-only

Add -mmwait so that the MWAIT and MONITOR intrinsics can be used with
-mgeneral-regs-only and make -msse3 to imply -mmwait.

gcc/

* config.gcc: Install mwaitintrin.h for i[34567]86-*-* and
x86_64-*-* targets.
* common/config/i386/i386-common.c (OPTION_MASK_ISA2_MWAIT_SET):
New.
(OPTION_MASK_ISA2_MWAIT_UNSET): Likewise.
(ix86_handle_option): Handle -mmwait.
* config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins):
Replace OPTION_MASK_ISA_SSE3 with OPTION_MASK_ISA2_MWAIT on
__builtin_ia32_monitor and __builtin_ia32_mwait.
* config/i386/i386-options.c (isa2_opts): Add -mmwait.
(ix86_valid_target_attribute_inner_p): Likewise.
(ix86_option_override_internal): Enable mwait/monitor
instructions for -msse3.
* config/i386/i386.h (TARGET_MWAIT): New.
(TARGET_MWAIT_P): Likewise.
* config/i386/i386.opt: Add -mmwait.
* config/i386/mwaitintrin.h: New file.
* config/i386/pmmintrin.h: Include <mwaitintrin.h>.
* config/i386/sse.md (sse3_mwait): Replace TARGET_SSE3 with
TARGET_MWAIT.
(@sse3_monitor_<mode>): Likewise.
* config/i386/x86gprintrin.h: Include <mwaitintrin.h>.
* doc/extend.texi: Document mwait target attribute.
* doc/invoke.texi: Document -mmwait.

gcc/testsuite/

* gcc.target/i386/monitor-2.c: New test.

3 years agolibstdc++: Fix whitespace in license boilerplate
Jonathan Wakely [Wed, 21 Apr 2021 11:59:04 +0000 (12:59 +0100)]
libstdc++: Fix whitespace in license boilerplate

libstdc++-v3/ChangeLog:

* include/std/latch: Replace tab characters in license text.
* include/std/semaphore: Likewise.

3 years agoRemove DEF_ENUM from stringop.def.
Martin Liska [Mon, 8 Mar 2021 12:01:37 +0000 (13:01 +0100)]
Remove DEF_ENUM from stringop.def.

gcc/ChangeLog:

* config/i386/i386-options.c (DEF_ENUM): Remove it.
* config/i386/i386-opts.h (DEF_ENUM): Likewise.
* config/i386/stringop.def (DEF_ENUM): Likewise.

3 years agoRevert "Use flags in dump_decl."
Martin Liska [Wed, 21 Apr 2021 11:30:03 +0000 (13:30 +0200)]
Revert "Use flags in dump_decl."

This reverts commit 9b6360b83cf5c684422c42301faee3a79ac42dc1.

3 years agoFix endian bug in rust demangler
Andreas Schwab [Tue, 20 Apr 2021 15:30:46 +0000 (17:30 +0200)]
Fix endian bug in rust demangler

libiberty/
PR demangler/100177
* rust-demangle.c (demangle_const_char): Properly print the
character value.

3 years agoUse flags in dump_decl.
Martin Liska [Wed, 21 Apr 2021 11:27:08 +0000 (13:27 +0200)]
Use flags in dump_decl.

gcc/cp/ChangeLog:

* error.c (dump_decl): Use flags in dump_generic_node call.

3 years agoSupport LABEL_DECL in %qD directive.
Martin Liska [Thu, 18 Feb 2021 11:58:39 +0000 (12:58 +0100)]
Support LABEL_DECL in %qD directive.

gcc/cp/ChangeLog:

* error.c (dump_decl): Support anonymous labels.

gcc/ChangeLog:

* tree-cfg.c (gimple_verify_flow_info): Use qD instead
of print_generic_expr.

3 years agotestsuite/100176 - fix struct-layout-1_generate.c compile
Richard Biener [Wed, 21 Apr 2021 10:46:51 +0000 (12:46 +0200)]
testsuite/100176 - fix struct-layout-1_generate.c compile

With -Werror=return-type we run into compile fails complaining about
missing return stmts.

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

PR testsuite/100176
* g++.dg/compat/struct-layout-1_generate.c: Add missing return.
* gcc.dg/compat/struct-layout-1_generate.c: Likewise.

3 years agocprop: Fix -fcompare-debug bug in constprop_register [PR100148]
Jakub Jelinek [Wed, 21 Apr 2021 10:31:45 +0000 (12:31 +0200)]
cprop: Fix -fcompare-debug bug in constprop_register [PR100148]

The following testcase shows different behavior between -g and -g0
in constprop_register, if a flags register setter is separated
from a conditional jump using those flags with -g by a DEBUG_INSN.
As it uses just NEXT_INSN, for -g it will look at the DEBUG_INSN which is
not a conditional jump, while otherwise it would look at the conditional
jump and call cprop_jump.

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

PR rtl-optimization/100148
* cprop.c (constprop_register): Use next_nondebug_insn instead of
NEXT_INSN.

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

3 years agoTest simlified call in cgraph_node::analyze().
Martin Liska [Tue, 26 Jan 2021 11:55:52 +0000 (12:55 +0100)]
Test simlified call in cgraph_node::analyze().

gcc/ChangeLog:

PR ipa/98815
* cgraphunit.c (cgraph_node::analyze): Remove duplicate
free_dominance_info calls.

3 years agoFix AIX libstdc++ semaphore support [PR100164]
Jakub Jelinek [Wed, 21 Apr 2021 09:09:25 +0000 (11:09 +0200)]
Fix AIX libstdc++ semaphore support [PR100164]

> > The #error would not be hit if _GLIBCXX_HAVE_POSIX_SEMAPHORE were defined,
> > but it shows up in your error report.

> You now have pinpointed the problem.

> It's not that AIX doesn't have semaphore, but that the code previously
> had a fallback that hid a bug in the macros:

  // Use futex if available and didn't force use of POSIX
  using __fast_semaphore = __atomic_semaphore<__detail::__platform_wait_t>;
  using __fast_semaphore = __platform_semaphore;
  using __fast_semaphore = __atomic_semaphore<ptrdiff_t>;

> The problem is that libstdc++ configure defines
> _GLIBCXX_HAVE_POSIX_SEMAPHORE in config.h.  libstdc++ uses sed to
> rewrite config.h to c++config.h and prepends _GLIBCXX_, so c++config.h
> contains

> And bits/semaphore_base.h is not testing that corrupted macro.  Either
> semaphore_base.h needs to test for the corrupted macro, or libtsdc++
> configure needs to define HAVE_POSIX_SEMAPHORE without itself
> prepending _GLIBCXX_  so that the c++config.h rewriting works
> correctly and defines the correct macro for semaphore_base.h.

The include/Makefile.am sed is:
        sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
            -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
            -e 's/VERSION/_GLIBCXX_VERSION/g' \
            -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
            -e 's/_DARWIN_USE_64_BIT_INODE/_GLIBCXX_DARWIN_USE_64_BIT_INODE/g' \
            -e 's/_FILE_OFFSET_BITS/_GLIBCXX_FILE_OFFSET_BITS/g' \
            -e 's/_LARGE_FILES/_GLIBCXX_LARGE_FILES/g' \
            -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_COMPAT[   ]/d' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT[    ]/d' \
            < ${CONFIG_HEADER} >> $@ ;\
so for many macros one needs _GLIBCXX_ prefixes already in configure,
as can be seen in grep AC_DEFINE.*_GLIBCXX configure.ac acinclude.m4
But _GLIBCXX_HAVE_POSIX_SEMAPHORE is the only one that shouldn't have
that prefix because the sed is adding that.
E.g. on i686-linux, I see
grep _GLIBCXX__GLIBCXX c++config.h
that proves it is the only broken one.

So this change fixes the acinclude.m4 side.

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

PR libstdc++/100164
* acinclude.m4: For POSIX semaphores AC_DEFINE HAVE_POSIX_SEMAPHORE
rather than _GLIBCXX_HAVE_POSIX_SEMAPHORE.
* configure: Regenerated.
* config.h.in: Regenerated.

3 years agoSimplify maybe_fold_reference API
Richard Biener [Fri, 16 Apr 2021 09:56:00 +0000 (11:56 +0200)]
Simplify maybe_fold_reference API

This simplifies the maybe_fold_reference API reflecting that it
no longer canonicalizes refs (that's done with another function)
but only performs constant folding and thus does nothing for is_lhs.

This in turn allows to rip out quite some dead code and one user
of valid_gimple_rhs_p.

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

* gimple-fold.c (maybe_fold_reference): Remove is_lhs
parameter (and assume it to be false).
(fold_gimple_assign): Adjust, remove all callers of
maybe_fold_reference calling it with is_lhs true.
(gimple_fold_call): Likewise.
(fold_stmt_1): Likewise.

3 years agoFortran/OpenMP: Add 'omp depobj' and 'depend(mutexinoutset:'
Tobias Burnus [Wed, 21 Apr 2021 08:58:29 +0000 (10:58 +0200)]
Fortran/OpenMP: Add 'omp depobj' and 'depend(mutexinoutset:'

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_omp_namelist): Handle depobj + mutexinoutset
in the depend clause.
(show_omp_clauses, show_omp_node, show_code_node): Handle depobj.
* gfortran.h (enum gfc_statement): Add ST_OMP_DEPOBJ.
(enum gfc_omp_depend_op): Add OMP_DEPEND_UNSET,
OMP_DEPEND_MUTEXINOUTSET and OMP_DEPEND_DEPOBJ.
(gfc_omp_clauses): Add destroy, depobj_update and depobj.
(enum gfc_exec_op): Add EXEC_OMP_DEPOBJ
* match.h (gfc_match_omp_depobj): Match 'omp depobj'.
* openmp.c (gfc_match_omp_clauses): Add depobj + mutexinoutset
to depend clause.
(gfc_match_omp_depobj, resolve_omp_clauses, gfc_resolve_omp_directive):
Handle 'omp depobj'.
* parse.c (decode_omp_directive, next_statement, gfc_ascii_statement):
Likewise.
* resolve.c (gfc_resolve_code): Likewise.
* st.c (gfc_free_statement): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Handle depobj + mutexinoutset
in the depend clause.
(gfc_trans_omp_depobj, gfc_trans_omp_directive): Handle EXEC_OMP_DEPOBJ.
* trans.c (trans_code): Likewise.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/depobj-1.f90: New test.

gcc/testsuite/ChangeLog:

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

3 years agotestsuite: Xfail gcc.dg/vect/pr71264.c on IBM Z
Stefan Schulze Frielinghaus [Wed, 21 Apr 2021 08:44:54 +0000 (10:44 +0200)]
testsuite: Xfail gcc.dg/vect/pr71264.c on IBM Z

The test fails for targets with V4QImode support which is the case for
IBM Z.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr71264.c: Xfail on IBM Z due to V4QImode support.

3 years agoRemove pedantic_non_lvalue_loc
Richard Biener [Mon, 19 Apr 2021 12:38:03 +0000 (14:38 +0200)]
Remove pedantic_non_lvalue_loc

This removes pedantic_non_lvalue_loc which doesn't do what it says
since quite some time in favor of what it actually does and where
that's not a duplicate (protected_set_expr_location_unshare).

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

* fold-const.c (pedantic_non_lvalue_loc): Remove.
(fold_binary_loc): Adjust.
(fold_ternary_loc): Likewise.

3 years agovarasm: Two SECTION_RETAIN fixes [PR100130]
Richard Sandiford [Wed, 21 Apr 2021 08:08:44 +0000 (09:08 +0100)]
varasm: Two SECTION_RETAIN fixes [PR100130]

switch_to_section warns if we try to output a retain decl in a
section without a retain flag, or if we try to output a non-retain
decl in a section with a retain flag.  However, the warning only
applied if we were trying to “switch” to the current section.
This works if all decls that use a section are generated consecutively,
but not if there is an unrelated decl in between.

This patch makes the check unconditional, but suppresses the warning
if we're writing the section's named.decl (i.e. the decl from which
the section name and original flags were derived).

Also, the warning didn't fire for -fsection-anchors, for two reasons:
we allowed retain and non-retain decls to be put into the same block,
and we didn't pass a decl to switch_to_section.

Although these are arguably separate bugs, it isn't easy to fix them
independently without temporarily regressing -fsection-anchor targets.

gcc/
PR middle-end/100130
* varasm.c (get_block_for_decl): Make sure that any use of the
retain attribute matches the section's retain flag.
(switch_to_section): Check for retain mismatches even when
changing sections, but do not warn if the given decl is the
section's named.decl.
(output_object_block): Pass the first decl in the block (if any)
to switch_to_section.

gcc/testsuite/
PR middle-end/100130
* c-c++-common/attr-retain-10.c: New test.
* c-c++-common/attr-retain-11.c: Likewise.

3 years agotestsuite: Fix gcc.dg/vect/bb-slp-39.c on IBM Z
Stefan Schulze Frielinghaus [Wed, 21 Apr 2021 06:27:29 +0000 (08:27 +0200)]
testsuite: Fix gcc.dg/vect/bb-slp-39.c on IBM Z

On IBM Z the aliasing stores are realized through one element vector
instructions, if no cost model for vectorization is used which is the
default according to vect.exp.  Fixed by changing the number of times
the pattern must be found in the dump.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-39.c: Change number of times the pattern
must match for target IBM Z only.

3 years agolibphobos: Fix build fails for powerpc-linux
Iain Buclaw [Tue, 20 Apr 2021 23:15:33 +0000 (01:15 +0200)]
libphobos: Fix build fails for powerpc-linux

As register names are required for darwin, but not accepted by gas
unless you use `-mregnames', they have been conditionally removed on
non-darwin targets.

To avoid duplicating large blocks of almost identical code, the inline
assembly is now statically generated.

libphobos/ChangeLog:

* libdruntime/core/thread/osthread.d (callWithStackShell): Statically
generate PPC and PPC64 asm implementations, and conditionally remove
PPC register names on non-Darwin targets.

3 years agoDaily bump.
GCC Administrator [Wed, 21 Apr 2021 00:16:23 +0000 (00:16 +0000)]
Daily bump.

3 years agoRegenerate gcc.pot.
Joseph Myers [Tue, 20 Apr 2021 18:18:03 +0000 (18:18 +0000)]
Regenerate gcc.pot.

* gcc.pot: Regenerate.

3 years agox86: Use crc32 target option for CRC32 intrinsics
H.J. Lu [Thu, 15 Apr 2021 12:59:48 +0000 (05:59 -0700)]
x86: Use crc32 target option for CRC32 intrinsics

Use crc32 target option for CRC32 intrinsics to support CRC32 intrinsics
without enabling SSE vector instructions.

* config/i386/i386-c.c (ix86_target_macros_internal): Define
__CRC32__ for -mcrc32.
* config/i386/i386-options.c (ix86_option_override_internal):
Enable crc32 instruction for -msse4.2.
* config/i386/i386.md (sse4_2_crc32<mode>): Remove TARGET_SSE4_2
check.
(sse4_2_crc32di): Likewise.
* config/i386/ia32intrin.h: Use crc32 target option for CRC32
intrinsics.

3 years agolibstdc++: Disable tests that fail after atomic wait/notify rewrite
Jonathan Wakely [Tue, 20 Apr 2021 14:11:29 +0000 (15:11 +0100)]
libstdc++: Disable tests that fail after atomic wait/notify rewrite

These tests are currently failing, but should be analyzed and
re-enabled.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/semaphore/try_acquire_for.cc: Disable
test for targets not using futexes for semaphores.
* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
Disable for all targets.

3 years agolibstdc++: Refactor/cleanup of C++20 atomic wait implementation
Thomas Rodgers [Tue, 20 Apr 2021 10:54:27 +0000 (11:54 +0100)]
libstdc++: Refactor/cleanup of C++20 atomic wait implementation

This is a substantial rewrite of the atomic wait/notify (and timed wait
counterparts) implementation.

The previous __platform_wait looped on EINTR however this behavior is
not required by the standard. A new _GLIBCXX_HAVE_PLATFORM_WAIT macro
now controls whether wait/notify are implemented using a platform
specific primitive or with a platform agnostic mutex/condvar. This
patch only supplies a definition for linux futexes. A future update
could add support __ulock_wait/wake on Darwin, for instance.

The members of __waiters were lifted to a new base class. The members
are now arranged such that overall sizeof(__waiter_pool_base) fits in
two cache lines (on platforms with at least 64 byte cache lines). The
definition will also use destructive_interference_size for this if it is
available.

The __waiters type is now specific to untimed waits, and is renamed to
__waiter_pool. Timed waits have a corresponding __timed_waiter_pool
type.  Much of the code has been moved from the previous __atomic_wait()
free function to the __waiter_base template and a __waiter derived type
is provided to implement the un-timed wait operations. A similar change
has been made to the timed wait implementation.

The __atomic_spin code has been extended to take a spin policy which is
invoked after the initial busy wait loop. The default policy is to
return from the spin. The timed wait code adds a timed backoff spinning
policy. The code from <thread> which implements this_thread::sleep_for,
sleep_until has been moved to a new <bits/std_thread_sleep.h> header
which allows the thread sleep code to be consumed without pulling in the
whole of <thread>.

The entry points into the wait/notify code have been restructured to
support either -
   * Testing the current value of the atomic stored at the given address
     and waiting on a notification.
   * Applying a predicate to determine if the wait was satisfied.
The entry points were renamed to make it clear that the wait and wake
operations operate on addresses. The first variant takes the expected
value and a function which returns the current value that should be used
in comparison operations, these operations are named with a _v suffix
(e.g. 'value'). All atomic<_Tp> wait/notify operations use the first
variant. Barriers, latches and semaphores use the predicate variant.

This change also centralizes what it means to compare values for the
purposes of atomic<T>::wait rather than scattering through individual
predicates.

This change also centralizes the repetitive code which adjusts for
different user supplied clocks (this should be moved elsewhere
and all such adjustments should use a common implementation).

This change also removes the hashing of the pointer and uses
the pointer value directly for indexing into the waiters table.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Add new <bits/this_thread_sleep.h> header.
* include/Makefile.in: Regenerate.
* include/bits/this_thread_sleep.h: New file.
* include/bits/atomic_base.h: Adjust all calls
to __atomic_wait/__atomic_notify for new call signatures.
* include/bits/atomic_timed_wait.h: Extensive rewrite.
* include/bits/atomic_wait.h: Likewise.
* include/bits/semaphore_base.h: Adjust all calls
to __atomic_wait/__atomic_notify for new call signatures.
* include/std/atomic: Likewise.
* include/std/barrier: Likewise.
* include/std/latch: Likewise.
* include/std/semaphore: Likewise.
* include/std/thread (this_thread::sleep_for)
(this_thread::sleep_until): Move to new header.
* testsuite/29_atomics/atomic/wait_notify/bool.cc: Simplify
test.
* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.

3 years agors6000: Fix cpu selection w/ isel (PR100108)
Segher Boessenkool [Tue, 20 Apr 2021 12:00:50 +0000 (12:00 +0000)]
rs6000: Fix cpu selection w/ isel (PR100108)

There are various non-IBM CPUs with isel as well, so it is easiest if we
just don't consider that flag here (it is not needed).

2021-04-20  Segher Boessenkool  <segher@kernel.crashing.org>

PR target/100108
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Do not consider
OPTION_MASK_ISEL.

3 years agolibstdc++: Implement P2259R1 changes [PR95983]
Patrick Palka [Tue, 20 Apr 2021 13:18:50 +0000 (09:18 -0400)]
libstdc++: Implement P2259R1 changes [PR95983]

This implements the wording changes of P2259R1 "Repairing input range
adaptors and counted_iterator", which resolves LWG 3283, 3289 and 3408.

The wording changes are relatively straightforward, but they require
some boilerplate to implement: the changes to make a type alias
"conditionally present" in some iterator class are realized by defining
a base class template and an appropriately constrained partial
specialization thereof that contains the type alias, and having the
iterator class derive from this base class.  Sometimes the relevant
condition depend on members from the iterator class, but because a
class is incomplete when instantiating its bases, the constraints on
the partial specialization can't use anything from the iterator class.
This patch works around this by hoisting these members out to the
enclosing scope (e.g. transform_view::_Iterator::_Base is hoisted out
to transform_view::_Base so that transform_view::__iter_cat can use it).

This patch also implements the proposed resolution of LWG 3291 to rename
iota_view::iterator_category to iota_view::iterator_concept, which was
previously problematic due to LWG 3408.

libstdc++-v3/ChangeLog:

PR libstdc++/95983
* include/bits/stl_iterator.h (__detail::__move_iter_cat):
Define.
(move_iterator): Derive from the above in C++20 in order to
conditionally define iterator_category as per P2259.
(move_iterator::__base_cat): No longer used, so remove.
(move_iterator::iterator_category): Remove in C++20.
(__detail::__common_iter_use_postfix_proxy): Define.
(common_iterator::_Proxy): Rename to ...
(common_iterator:__arrow_proxy): ... this.
(common_iterator::__postfix_proxy): Define as per P2259.
(common_iterator::operator->): Adjust.
(common_iterator::operator++): Adjust as per P2259.
(iterator_traits<common_iterator>::_S_iter_cat): Define.
(iterator_traits<common_iterator>::iterator_category): Change as
per P2259.
(__detail::__counted_iter_value_type): Define.
(__detail::__counted_iter_concept): Define.
(__detail::__counted_iter_cat): Define.
(counted_iterator): Derive from the above three classes in order
to conditionally define value_type, iterator_concept and
iterator category respectively as per P2259.
(counted_iterator::operator->): Define as per P2259.
(incrementable_traits<counted_iterator>): Remove as per P2259.
(iterator_traits<counted_iterator>): Adjust as per P2259.
* include/std/ranges (__detail::__iota_view_iter_cat): Define.
(iota_view::_Iterator): Derive from the above in order to
conditionally define iterator_category as per P2259.
(iota_view::_S_iter_cat): Rename to ...
(iota_view::_S_iter_concept): ... this.
(iota_view::iterator_concept): Use it to apply LWG 3291 changes.
(iota_view::iterator_category): Remove.
(__detail::__filter_view_iter_cat): Define.
(filter_view::_Iterator): Derive from the above in order to
conditionally define iterator_category as per P2259.
(filter_view::_Iterator): Move to struct __filter_view_iter_cat.
(filter_view::_Iterator::iterator_category): Remove.
(transform_view::_Base): Define.
(transform_view::__iter_cat): Define.
(transform_view::_Iterator): Derive from the above in order to
conditionally define iterator_category as per P2259.
(transform_view::_Iterator::_Base): Just alias
transform_view::_Base.
(transform_view::_Iterator::_S_iter_cat): Move to struct
transform_view::__iter_cat.
(transform_view::_Iterator::iterator_category): Remove.
(transform_view::_Sentinel::_Base): Just alias
transform_view::_Base.
(join_view::_Base): Define.
(join_view::_Outer_iter): Define.
(join_view::_Inner_iter): Define.
(join_view::_S_ref_is_glvalue): Define.
(join_view::__iter_cat): Define.
(join_view::_Iterator): Derive from it in order to conditionally
define iterator_category as per P2259.
(join_view::_Iterator::_Base): Just alias join_view::_Base.
(join_view::_Iterator::_S_ref_is_glvalue): Just alias
join_view::_S_ref_is_glvalue.
(join_view::_Iterator::_S_iter_cat): Move to struct
transform_view::__iter_cat.
(join_view::_Iterator::_Outer_iter): Just alias
join_view::_Outer_iter.
(join_view::_Iterator::_Inner_iter): Just alias
join_view::_Inner_iter.
(join_view::_Iterator::iterator_category): Remove.
(join_view::_Sentinel::_Base): Just alias join_view::_Base.
(__detail::__split_view_outer_iter_cat): Define.
(__detail::__split_view_inner_iter_cat): Define.
(split_view::_Base): Define.
(split_view::_Outer_iter): Derive from __split_view_outer_iter_cat
in order to conditionally define iterator_category as per P2259.
(split_view::_Outer_iter::iterator_category): Remove.
(split_view::_Inner_iter): Derive from __split_view_inner_iter_cat
in order to conditionally define iterator_category as per P2259.
(split_view::_Inner_iter::_S_iter_cat): Move to
__split_view_inner_iter_cat.
(split_view::_Inner_iter::iterator_category): Remove.
(elements_view::_Base): Define.
(elements_view::__iter_cat): Define.
(elements_view::_Iterator): Derive from the above in order to
conditionall define iterator_category as per P2259.
(elements_view::_Iterator::_Base): Just alias
elements_view::_Base.
(elements_view::_Iterator::_S_iter_concept)
(elements_view::_Iterator::iterator_concept): Define as per
P2259.
(elements_view::_Iterator::iterator_category): Remove.
(elements_view::_Sentinel::_Base): Just alias
elements_view::_Base.
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
Adjust constraints on iterator_traits<counted_iterator>.
* testsuite/std/ranges/p2259.cc: New test.

3 years agoc++: unexpanded pack in enum in lambda [PR100109]
Jason Merrill [Tue, 20 Apr 2021 04:50:49 +0000 (00:50 -0400)]
c++: unexpanded pack in enum in lambda [PR100109]

Another construct we need to look inside.

gcc/cp/ChangeLog:

PR c++/100109
* pt.c (find_parameter_packs_r): Look into enum initializers.

gcc/testsuite/ChangeLog:

PR c++/100109
* g++.dg/cpp0x/lambda/lambda-variadic14.C: New test.

3 years agolibstdc++: Define __cpp_lib_to_chars for C++20 [PR 100146]
Jonathan Wakely [Tue, 20 Apr 2021 11:46:11 +0000 (12:46 +0100)]
libstdc++: Define __cpp_lib_to_chars for C++20 [PR 100146]

This defines the feature test macro when uselocale is available, because
the floating-point std::from_chars support currently depends on that.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/100146
* include/std/charconv (__cpp_lib_to_chars): Define
conditionally.
* include/std/version (__cpp_lib_to_chars): Likewise..
* testsuite/20_util/from_chars/4.cc: Only check feature test
macro, not _GLIBCXX_HAVE_USELOCALE.
* testsuite/20_util/from_chars/5.cc: Likewise.
* testsuite/20_util/from_chars/6.cc: Likewise.
* testsuite/20_util/to_chars/long_double.cc: Likewise.

3 years agolibstdc++: Update ppc64le baseline_symbols.txt
Jakub Jelinek [Tue, 20 Apr 2021 10:48:12 +0000 (12:48 +0200)]
libstdc++: Update ppc64le baseline_symbols.txt

> Tested on powerpc64{,le}-linux now (-m32/-m64 on be) and while the first
> patch works fine, the second one unfortunately doesn't on either be or le,
> so more work is needed there.

Here are the needed changes to make it work.
For symbols with _LDBL_ substring in version name we already have code to
ignore those if no such symbols appear (but it is slightly incorrect, see
below).
So, this patch does the same thing for symbol versions with _IEEE128_
substring.
The previously incorrectly handled case is that in addition to
FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
or
OBJECT:12:_ZTSu9__ieee128@@CXXABI_IEEE128_1.3.13
cases we also have the
OBJECT:0:CXXABI_IEEE128_1.3.13
OBJECT:0:GLIBCXX_IEEE128_3.4.29
cases, which have empty version_name and the name is in that case the
symbol version.  Those need to be ignored too.

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

* testsuite/util/testsuite_abi.cc (compare_symbols): If any symbol
versions with _IEEE128_ substring are found, set ieee_version_found
to true.  Ignore missing symbols with _IEEE128_ in version name if
!ieee_version_found.  Use i->first as version_name instead of
i->second.version_name if the latter is empty.
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.

3 years agoFix typo in param description.
Martin Liska [Tue, 20 Apr 2021 10:10:20 +0000 (12:10 +0200)]
Fix typo in param description.

gcc/ChangeLog:

* doc/invoke.texi: Fix typo.
* params.opt: Likewise.

3 years agoBump version to 12.
Martin Liska [Tue, 20 Apr 2021 09:43:51 +0000 (11:43 +0200)]
Bump version to 12.

gcc/ada/ChangeLog:

* gnatvsn.ads: Bump Library_Version to 12.

3 years agoDocument ranger-logical-depth in invoke.texi
Martin Liska [Tue, 20 Apr 2021 08:59:47 +0000 (10:59 +0200)]
Document ranger-logical-depth in invoke.texi

gcc/ChangeLog:

* doc/invoke.texi: Document new param.

3 years agoUpdate crontab and git_update_version.py
Jakub Jelinek [Tue, 20 Apr 2021 08:50:22 +0000 (10:50 +0200)]
Update crontab and git_update_version.py

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

maintainer-scripts/
* crontab: Snapshots from trunk are now GCC 12 related.
Add GCC 11 snapshots from the respective branch.
contrib/
* gcc-changelog/git_update_version.py (active_refs): Add
releases/gcc-11.

3 years agoBump BASE-VER.
Jakub Jelinek [Tue, 20 Apr 2021 08:26:12 +0000 (10:26 +0200)]
Bump BASE-VER.

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

* BASE-VER: Set to 11.0.0.

3 years agotestsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c
Stefan Schulze Frielinghaus [Tue, 20 Apr 2021 07:51:16 +0000 (09:51 +0200)]
testsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c

Depending on whether GCC is configured using --with-mode=zarch or not,
for the 31bit target instructions are generated either for ESA or
z/Architecture.  For the sake of simplicity and robustness test only for
the latter by adding manually option -mzarch.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zero-scratch-regs-1.c: Force test to run for
z/Architecture only.

3 years agoFortran: Fix host associated PDT entity initialization [PR99307].
Paul Thomas [Tue, 20 Apr 2021 06:30:07 +0000 (07:30 +0100)]
Fortran: Fix host associated PDT entity initialization [PR99307].

2021-04-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/100110
* trans-decl.c (gfc_get_symbol_decl): Replace test for host
association with a check that the current and symbol namespaces
are the same.

gcc/testsuite/
PR fortran/100110
* gfortran.dg/pdt_31.f03: New test.
* gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
to 8.

3 years agolibphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)
Iain Buclaw [Tue, 20 Apr 2021 00:09:51 +0000 (02:09 +0200)]
libphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)

Instead of unsafe pointer dereferencing, use memcpy() to read encoded
values from memory.  The function `read_encoded_value' has been updated
to accept a ref parameter, this simplifies handling of the pointer to
memory needing to be read.

libphobos/ChangeLog:

PR d/98584
* libdruntime/gcc/deh.d (scanLSDA): Update calls to read_uleb128 and
read_encoded_value.
(actionTableLookup): Update calls to read_sleb128 and
read_encoded_value_with_base.
* libdruntime/gcc/unwind/pe.d (read_uleb128): Update signature.
(read_sleb128): Update signature.
(read_unaligned): New function.
(read_encoded_value_with_base): Update signature.  Call read_unaligned
instead of unsafe pointer dereferencing.
(read_encoded_value): Update signature.

3 years agoDaily bump.
GCC Administrator [Tue, 20 Apr 2021 00:16:27 +0000 (00:16 +0000)]
Daily bump.

3 years agoc++: ICE with concept defined in function [PR97536]
Marek Polacek [Mon, 19 Apr 2021 20:21:46 +0000 (16:21 -0400)]
c++: ICE with concept defined in function [PR97536]

This is an ICE-on-invalid, but I keep seeing it when reducing code so
I'd like to fix it.  We crash on

  template <typename> void forward() {
    concept C = true;
  }

which breaks two requirements:
[temp.concept]/1: A concept is a template ...
[temp.concept]/3: A concept-definition shall inhabit a namespace scope.

This patch adds a test that exercises broken code and fixes the ICE
by checking that a concept-definition is defined at namespace scope.

gcc/cp/ChangeLog:

PR c++/97536
* decl.c (grokvardecl): Given an error when a concept is not defined
at namespace scope.

gcc/testsuite/ChangeLog:

PR c++/97536
* g++.dg/concepts/diagnostic16.C: New test.

3 years agotree-optimization/100081 - Limit depth of logical expression windback.
Andrew MacLeod [Fri, 16 Apr 2021 21:08:51 +0000 (17:08 -0400)]
tree-optimization/100081 - Limit depth of logical expression windback.

Limit how many logical expressions GORI will look back through when
evaluating outgoing edge range.

PR tree-optimization/100081
* gimple-range-cache.h (ranger_cache): Inherit from gori_compute
rather than gori_compute_cache.
* gimple-range-gori.cc (is_gimple_logical_p): Move to top of file.
(range_def_chain::m_logical_depth): New member.
(range_def_chain::range_def_chain): Initialize m_logical_depth.
(range_def_chain::get_def_chain): Don't build defchains through more
than LOGICAL_LIMIT logical expressions.
* params.opt (param_ranger_logical_depth): New.

3 years agod: Fix ICE in when formating a string with '%' or '`' characters (PR98457)
Iain Buclaw [Mon, 19 Apr 2021 16:45:32 +0000 (18:45 +0200)]
d: Fix ICE in when formating a string with '%' or '`' characters (PR98457)

The percentage character was being confused for a format specifier in
pp_format(), whilst the backtick character was confused for the
beginning of a quoted string in expand_d_format().

Both are now properly escaped to avoid the ICE.

gcc/d/ChangeLog:

PR d/98457
* d-diagnostic.cc (expand_d_format): Handle escaped backticks.
(escape_d_format): New funtion.
(verror): Call escape_d_format on prefixing strings.
(vdeprecation): Likewise.

gcc/testsuite/ChangeLog:

PR d/98457
* gdc.dg/pr98457.d: New test.

3 years agolibphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e
Iain Buclaw [Mon, 19 Apr 2021 11:51:02 +0000 (13:51 +0200)]
libphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e

Phobos changes:

 - Synchronize C bindings with the latest port fixes in upstream
   druntime.

 - Add Config.stderrPassThrough to std.process (PR98494).

Reviewed-on: https://github.com/dlang/druntime/pull/3448
     https://github.com/dlang/phobos/pull/7984

libphobos/ChangeLog:

PR d/98494
* libdruntime/MERGE: Merge upstream druntime 89f870b7.
* src/MERGE: Merge upstream phobos e6907ff3e.

3 years agolibphobos: Add Thread/Fiber support code for Darwin (PR98058)
Iain Buclaw [Mon, 19 Apr 2021 12:48:32 +0000 (14:48 +0200)]
libphobos: Add Thread/Fiber support code for Darwin (PR98058)

libphobos/ChangeLog:

PR d/98058
* configure: Regenerate.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
core/sys/darwin/config.d
* libdruntime/Makefile.in: Regenerate.
* libdruntime/config/powerpc/switchcontext.S: Implement
fiber_switchContext for __MACH__.
* libdruntime/config/x86/switchcontext.S: Likewise.
* libdruntime/core/sys/darwin/config.d: New file.
* libdruntime/core/thread/fiber.d (Fiber.getThis): Mark noinline.
(UnsafeFiberMigration): Define for OSX/X86 and OSX/X86_64.
* libdruntime/core/thread/osthread.d (callWithStackShell): Add inline
assembler implementation for X86, X86_64, PPC, and PPC64.
* libdruntime/core/thread/threadbase.d (ThreadBase.getThis): Mark
noinline.
* libdruntime/gcc/deh.d (FuncTable): Remove definition.
* m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING): Check for right
bracket symbol on darwin* targets.
* testsuite/libphobos.thread/fiber_guard_page.d: Update test to
support ucontext-based Fibers.

3 years agolibphobos: Add D runtime support code for MinGW (PR99794)
Iain Buclaw [Mon, 19 Apr 2021 12:36:14 +0000 (14:36 +0200)]
libphobos: Add D runtime support code for MinGW (PR99794)

libphobos/ChangeLog:

PR d/99794
* libdruntime/Makefile.am (DRUNTIME_SOURCES_CONFIGURED): Add
config/mingw/msvc.c on DRUNTIME_OS_MINGW.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/config/mingw/msvc.c: New file.
* libdruntime/config/mingw/switchcontext.S (fiber_switchContext): Fix
function definition.
* libdruntime/gcc/deh.d (__gdc_personality_seh0): Fix call to
_GCC_specific_handler.
* libdruntime/gcc/gthread.d (__gthread_once_t): Fix definition.
* libdruntime/gcc/unwind/generic.d (_GCC_specific_handler): Fix
declaration.
* libdruntime/rt/dmain2.d (rt_loadLibrary): Remove function.
(rt_loadLibraryW): Remove function.
(initLibrary): Remove function.
(rt_unloadLibrary): Remove function.

3 years agolibphobos: Add section support code for OpenBSD (PR99691)
Iain Buclaw [Mon, 19 Apr 2021 12:23:00 +0000 (14:23 +0200)]
libphobos: Add section support code for OpenBSD (PR99691)

libphobos/ChangeLog:

PR d/99691
* configure: Regenerate.
* libdruntime/config/common/threadasm.S: Add __OpenBSD__.
* libdruntime/gcc/backtrace.d: Import core.sys.openbsd.dlfcn on
OpenBSD platforms.
* libdruntime/gcc/sections/elf.d (SharedElf): Define on OpenBSD.
(linkMapForHandle): Implement for OpenBSD.
(exeLinkMap): Remove.
(getDependencies): Adjust dlpi_addr on OpenBSD.
(handleForName): Implement for OpenBSD.
(IterateManually): Define on OpenBSD.
* libdruntime/gcc/sections/package.d (SectionsElf): Define on OpenBSD.
* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ATOMIC): Test for
enable_libatomic.
(DRUNTIME_LIBRARIES_BACKTRACE): Test for enable_libbacktrace.

3 years agoarm: partial revert of r11-8168 [PR100067]
Richard Earnshaw [Mon, 19 Apr 2021 15:56:31 +0000 (16:56 +0100)]
arm: partial revert of r11-8168 [PR100067]

This is a partial revert of r11-8168.  The overall purpose of the
commit is retained (to fix a bogus warning when -mfpu=<not-auto> is
used in combination with eg -mcpu=neoverse-v1), but it removes the
hunk that changed the subsequent feature bits for features of a
simd/fp unit that cannot be described by -mfpu.  While I still think
that is the correct direction of travel, it's somewhat disruptive and
not appropriate for late stage4.  I'll revisit for gcc-12.

gcc:
PR target/100067
* config/arm/arm.c (arm_configure_build_target): Do not strip
extended FPU/SIMD feature bits from the target ISA when -mfpu
is specified (partial revert of r11-8168).

3 years agoaarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]
Christophe Lyon [Mon, 19 Apr 2021 13:24:31 +0000 (13:24 +0000)]
aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

The testcase is endianness dependent and works only on little-endian.

2021-04-19  Christophe Lyon  <christophe.lyon@linaro.org>

PR target/100075
gcc/testsuite/
* gcc.target/aarch64/pr100075.c: Add aarch64_little_endian
effective target.

3 years agopreprocessor/100142 - revert unwanted change in last commit
Richard Biener [Mon, 19 Apr 2021 08:07:35 +0000 (10:07 +0200)]
preprocessor/100142  - revert unwanted change in last commit

This reverts a s/column_offset/column/ change in the fix for PR99446.

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

PR preprocessor/100142
libcpp/
* line-map.c (linemap_position_for_loc_and_offset): Revert
unintended s/column_offset/column/ change.

gcc/testsuite/
* gcc.dg/pr100142.c: New testcase.
* g++.dg/diagnostic/pr72803.C: Revert last change.

3 years ago[OpenACC 'kernels'] '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'
Thomas Schwinge [Mon, 19 Apr 2021 08:24:49 +0000 (10:24 +0200)]
[OpenACC 'kernels'] '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'

This configuration knob is temporary, and isn't really meant to be exposed to
users.

gcc/
* params.opt (-param=openacc-kernels=): Add.
* omp-oacc-kernels-decompose.cc
(pass_omp_oacc_kernels_decompose::gate): Use it.
* doc/invoke.texi (-fopenacc-kernels=@var{mode}): Move...
(--param): ... here, 'openacc-kernels'.
gcc/c-family/
* c.opt (fopenacc-kernels=): Remove.
gcc/fortran/
* lang.opt (fopenacc-kernels=): Remove.
gcc/testsuite/
* c-c++-common/goacc/if-clause-2.c: '-fopenacc-kernels=[...]' ->
'--param=openacc-kernels=[...]'.
* c-c++-common/goacc/kernels-decompose-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
* c-c++-common/goacc/kernels-decompose-ice-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c:
'-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'.
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.
* testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise.

3 years agolibstdc++: Update some baseline_symbols.txt (x32)
H.J. Lu [Sun, 18 Apr 2021 17:02:17 +0000 (10:02 -0700)]
libstdc++: Update some baseline_symbols.txt (x32)

* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt:
Updated.

3 years agoAlign decl and def arguments.
Martin Liska [Mon, 19 Apr 2021 09:20:46 +0000 (11:20 +0200)]
Align decl and def arguments.

gcc/ChangeLog:

PR c/100143
* gengtype.c (finish_root_table): Align function arguments
in between declaration and definition.

3 years agoFix another -freorder-blocks-and-partition glitch with Windows SEH
Eric Botcazou [Mon, 19 Apr 2021 08:13:36 +0000 (10:13 +0200)]
Fix another -freorder-blocks-and-partition glitch with Windows SEH

Since GCC 8, the -freorder-blocks-and-partition pass can split a function
into hot and cold parts, thus generating 2 FDEs for a single function in
DWARF for exception purposes and doing an equivalent trick for Windows SEH.

Now the Windows system unwinder does not support arbitrarily large frames
and there is even a hard limit on the encoding of the CFI, which changes
the stack allocation strategy when it is topped and which must be reflected
everywhere.

gcc/
* config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with
frames larger than the SEH maximum frame size.
gcc/testsuite/
* gnat.dg/opt92.adb: New test.

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

3 years agocombine: Don't create REG_UNUSED notes if the reg already died (PR99927)
Segher Boessenkool [Sat, 17 Apr 2021 18:06:17 +0000 (18:06 +0000)]
combine: Don't create REG_UNUSED notes if the reg already died (PR99927)

If the register named in an existing REG_UNUSED note dies somewhere
between where the note used to be and I3, we should just drop it.

2021-04-21  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/99927
* combine.c (distribute_notes) [REG_UNUSED]: If the register already
is dead, just drop it.

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

3 years agotestsuite: Enable zero-scratch-regs-{8,9,10,11}.c on s390*
Stefan Schulze Frielinghaus [Sat, 17 Apr 2021 15:53:33 +0000 (17:53 +0200)]
testsuite: Enable zero-scratch-regs-{8,9,10,11}.c on s390*

On s390* the only missing part for the mentioned testcases was a load of
a double floating-point zero via a move (in particular for quite old
machines) which was added in commit 46c47420a5fefd4d9d02b0db347235dd74e20fb2.
Common code implementation is sufficient in order to clear volatile
GPRs, FPRs, and VRs.  Access registers a0 and a1 are nonvolatile and not
cleared.  Therefore, target hook TARGET_ZERO_CALL_USED_REGS is not
implemented for s390*.

Added a target specific test in order to ensure that all call clobbered
GPRs, FPRs, and VRs are zeroed and all call saved registers are kept.

gcc/testsuite/ChangeLog:

* c-c++-common/zero-scratch-regs-8.c: Enable on s390*.
* c-c++-common/zero-scratch-regs-9.c: Likewise.
* c-c++-common/zero-scratch-regs-10.c: Likewise.
* c-c++-common/zero-scratch-regs-11.c: Likewise.
* gcc.target/s390/zero-scratch-regs-1.c: New test.

3 years agod: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT
Iain Buclaw [Tue, 13 Apr 2021 20:28:55 +0000 (22:28 +0200)]
d: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT

Following up on the fix for PR99914, when testing on MinGW, it was found
not to support weak in the same way as on ELF or Mach-O targets.

So the linkage has been reverted back to COMDAT for that target, however
in order to properly support overriding functions and variables, all
declarations with external linkage must be put on COMDAT.  For this a
new target hook has been added to control the behavior.

gcc/ChangeLog:

PR d/99914
* config/i386/winnt-d.c (TARGET_D_TEMPLATES_ALWAYS_COMDAT): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_TEMPLATES_ALWAYS_COMDAT.

gcc/d/ChangeLog:

PR d/99914
* d-target.def (d_templates_always_comdat): New hook.
* d-tree.h (mark_needed): Remove prototype.
* decl.cc: Include d-target.h.
(mark_needed): Rename to...
(d_mark_needed): ...this.  Make static.
(set_linkage_for_decl): Put variables in comdat if
d_templates_always_comdat.

3 years agod: Implement __traits(getTargetInfo, "objectFormat")
Iain Buclaw [Sun, 11 Apr 2021 23:39:08 +0000 (01:39 +0200)]
d: Implement __traits(getTargetInfo, "objectFormat")

Following on from adding TARGET_D_REGISTER_OS_TARGET_INFO, this adds the
required handlers to implement `__traits(getTargetInfo, "objectFormat")'
for all platforms that have D support files.

Some back-ends (i386, rs6000, and pa) have some awarenes of the what
object format they are compiling for, so new getTargetInfo handlers have
been have added both to those back-ends as well as platform-specific
target files to override the default in the D front-end.

gcc/ChangeLog:

* config/darwin-d.c (darwin_d_handle_target_object_format): New
function.
(darwin_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/dragonfly-d.c (dragonfly_d_handle_target_object_format): New
function.
(dragonfly_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/freebsd-d.c (freebsd_d_handle_target_object_format): New
function.
(freebsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/glibc-d.c (glibc_d_handle_target_object_format): New
function.
(glibc_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/i386/i386-d.c (ix86_d_handle_target_object_format): New
function.
(ix86_d_register_target_info): Add ix86_d_handle_target_object_format
as handler for objectFormat key.
* config/i386/winnt-d.c (winnt_d_handle_target_object_format): New
function.
(winnt_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/netbsd-d.c (netbsd_d_handle_target_object_format): New
function.
(netbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/openbsd-d.c (openbsd_d_handle_target_object_format): New
function.
(openbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/pa/pa-d.c (pa_d_handle_target_object_format): New function.
(pa_d_register_target_info): Add pa_d_handle_target_object_format as
handler for objectFormat key.
* config/rs6000/rs6000-d.c (rs6000_d_handle_target_object_format): New
function.
(rs6000_d_register_target_info): Add
rs6000_d_handle_target_object_format as handler for objectFormat key.
* config/sol2-d.c (solaris_d_handle_target_object_format): New
function.
(solaris_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.

gcc/d/ChangeLog:

* d-target.cc (d_handle_target_object_format): New function.
(d_language_target_info): Add d_handle_target_object_format as handler
for objectFormat key.
(Target::getTargetInfo): Continue if handler returned NULL_TREE.

3 years agolibstdc++: Update ppc32 baseline_symbols.txt
Jakub Jelinek [Sat, 17 Apr 2021 09:33:52 +0000 (11:33 +0200)]
libstdc++: Update ppc32 baseline_symbols.txt

And here is an update for 32-bit powerpc-linux.

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

* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.

3 years agolibstdc++: Update some baseline_symbols.txt
Jakub Jelinek [Sat, 17 Apr 2021 09:31:30 +0000 (11:31 +0200)]
libstdc++: Update some baseline_symbols.txt

As we have only one P1 left right now, I think it is the right time
to update abi list files in libstdc++.

Here is an update for x86_64/i?86/s390x/ppc64 linux (aarch64 seems
to be correct already).  For ppc64le it is missing the IEEE128 symver
symbols, but those need further work on the abi checking side.

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

* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.

3 years agosanitizer: Fix asan against glibc 2.34 [PR100114]
Jakub Jelinek [Sat, 17 Apr 2021 09:27:14 +0000 (11:27 +0200)]
sanitizer: Fix asan against glibc 2.34 [PR100114]

As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in
glibc 2.34 and later, so
static const uptr kAltStackSize = SIGSTKSZ * 4;
needs dynamic initialization, but is used by a function called indirectly
from .preinit_array and therefore before the variable is constructed.
This results in using 0 size instead and all asan instrumented programs
die with:
==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)

Here is a cherry-pick from upstream to fix this.

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

PR sanitizer/100114
* sanitizer_common/sanitizer_posix_libcdep.cpp: Cherry-pick
llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe
and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023.

3 years agoDaily bump.
GCC Administrator [Sat, 17 Apr 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.

3 years agoFortran: Add missing TKR initialization [PR100094]
José Rui Faustino de Sousa [Fri, 16 Apr 2021 23:33:04 +0000 (23:33 +0000)]
Fortran: Add missing TKR initialization [PR100094]

gcc/fortran/ChangeLog:

PR fortran/100094
* trans-array.c (gfc_trans_deferred_array): Add code to initialize
pointers and allocatables with correct TKR parameters.

gcc/testsuite/ChangeLog:

PR fortran/100094
* gfortran.dg/PR100094.f90: New test.

3 years agotestsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw
Christophe Lyon [Fri, 16 Apr 2021 19:58:25 +0000 (19:58 +0000)]
testsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw

The previous change to this testcase missed the fact that the data may
be accessed via an anchor, depending on the optimization level,
leading to false failures.

This patch restricts matching to upper16:lower16 followed by
non-spaces, followed by +4 (in f4) or +320 (in f5).

Using '.*' instead of '[^ \]' would match accross the whole assembly
file, which is not what we want, hence the limitation with spaces.

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

gcc/testsuite/
PR target/96770
* gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times
with movt/movw.

3 years agoaarch64: Don't emit -Wpsabi note when ABI was never affected [PR91710]
Jakub Jelinek [Fri, 16 Apr 2021 18:49:33 +0000 (20:49 +0200)]
aarch64: Don't emit -Wpsabi note when ABI was never affected [PR91710]

As the following testcase shows, we emit a -Wpsabi note about argument
passing change since GCC 9, but in reality the ABI didn't change.
The alignment is 8 bits in GCC < 9 and 32 bits in GCC >= 9 and
the aarch64_function_arg_alignment returns in that case:
return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY);
so when both the old and new alignment are smaller or equal to PARM_BOUNDARY
(or both are larger than STACK_BOUNDARY, just in theory), even when the new
one is bigger, it doesn't change the argument passing.

So, the following patch changes aarch64_function_arg_alignment to tell the
callers the exact old alignmentm so that they can test it if needed.
The other aarch64_function_arg_alignment callers either check the
alignment for equality against 16-byte alignment (when old alignment was
smaller than that and the new one is 16-byte, we want to emit -Wpsabi
in all the cases) or the va_arg case which I think is ok now too.

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

PR target/91710
* config/aarch64/aarch64.c (aarch64_function_arg_alignment): Change
abi_break argument from bool * to unsigned *, store there the pre-GCC 9
alignment.
(aarch64_layout_arg, aarch64_gimplify_va_arg_expr): Adjust callers.
(aarch64_function_arg_regno_p): Likewise.  Only emit -Wpsabi note if
the old and new alignment after applying MIN/MAX to it is different.

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

3 years agointl: Add --enable-host-shared support [PR100096]
Jakub Jelinek [Fri, 16 Apr 2021 16:32:27 +0000 (18:32 +0200)]
intl: Add --enable-host-shared support [PR100096]

As mentioned in the PR, building gcc with jit enabled and
--enable-host-shared doesn't work on NetBSD/i?86, as libgccjit.so.0
has text relocations.
The r0-125846-g459260ecf8b420b029601a664cdb21c185268ecb changes
added --enable-host-shared support to various libraries, but didn't
add it to intl/ subdirectory; on Linux it isn't really needed, because
all: all-no
all-no: #nothing
but on other OSes intl/libintl.a is built.

The following patch makes sure it is built with -fPIC when
--enable-host-shared is used.

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

PR jit/100096
* configure.ac: Add --enable-host-shared support.
* Makefile.in: Update copyright.  Add @PICFLAG@ to CFLAGS.
* configure: Regenerated.

3 years agoFortran: Fix ICE due to referencing a NULL pointer [PR100018]
José Rui Faustino de Sousa [Fri, 16 Apr 2021 16:17:21 +0000 (16:17 +0000)]
Fortran: Fix ICE due to referencing a NULL pointer [PR100018]

gcc/fortran/ChangeLog:

PR fortran/100018
* resolve.c: Add association check before de-referencing pointer.

gcc/testsuite/ChangeLog:

PR fortran/100018
* gfortran.dg/PR10018.f90: New test.

3 years agoSVE: Fix wrong sve predicate split (PR100048)
Tamar Christina [Fri, 16 Apr 2021 15:58:50 +0000 (16:58 +0100)]
SVE: Fix wrong sve predicate split (PR100048)

The attached testcase generates the following paradoxical subregs when creating
the predicates.

(insn 22 21 23 2 (set (reg:VNx8BI 100)
(subreg:VNx8BI (reg:VNx2BI 103) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0])
(const_int 1 [0x1])
(const_int 0 [0]) repeated x5
    ])
(nil)))

and

(insn 15 14 16 2 (set (reg:VNx8BI 96)
(subreg:VNx8BI (reg:VNx2BI 99) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0]) repeated x7
    ])
(nil)))

This causes CSE to incorrectly think that the two predicates are equal because
some of the significant bits get ignored due to the subreg.

The attached patch instead makes it so it always looks at all 16-bits of the
predicate, but in turn means we need to generate a TRN that matches the expected
result mode.  In effect in RTL we keep the mode as VNx16BI but during codegen
re-interpret them as the mode the predicate instruction wanted:

(insn 10 9 11 2 (set (reg:VNx8BI 96)
(subreg:VNx8BI (reg:VNx16BI 99) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0]) repeated x7
    ])
(nil)))

Which needed correction to the TRN pattern.  A new TRN1_CONV unspec is
introduced which allows one to keep the arguments as VNx16BI but encode the
instruction as a type of the last operand.

(insn 9 8 10 2 (set (reg:VNx16BI 99)
(unspec:VNx16BI [
(reg:VNx16BI 97)
(reg:VNx16BI 98)
(reg:VNx2BI 100)
    ] UNSPEC_TRN1_CONV))
(nil))

This allows us remove all the paradoxical subregs and end up with

(insn 16 15 17 2 (set (reg:VNx8BI 101)
(subreg:VNx8BI (reg:VNx16BI 104) 0))
(expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0])
(const_int 1 [0x1])
(const_int 0 [0]) repeated x5
    ])
(nil)))

gcc/ChangeLog:

PR target/100048
* config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv<mode>): New.
* config/aarch64/aarch64.c (aarch64_expand_sve_const_pred_trn): Use new
TRN optab.
* config/aarch64/iterators.md (UNSPEC_TRN1_CONV): New.

gcc/testsuite/ChangeLog:

PR target/100048
* gcc.target/aarch64/sve/pr100048.c: New test.

3 years agoc++: Fix empty base stores in cxx_eval_store_expression [PR100111]
Jakub Jelinek [Fri, 16 Apr 2021 15:37:07 +0000 (17:37 +0200)]
c++: Fix empty base stores in cxx_eval_store_expression [PR100111]

In r11-6895 handling of empty bases has been fixed such that non-lval
stores of empty classes are not added when the type of *valp doesn't
match the type of the initializer, but as this testcase shows it is
done only when *valp is non-NULL.  If it is NULL, we still shouldn't
add empty class constructors if the type of the constructor elt *valp
points to doesn't match.

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

PR c++/100111
* constexpr.c (cxx_eval_store_expression): Don't add CONSTRUCTORs
for empty classes into *valp when types don't match even when *valp
is NULL.

* g++.dg/cpp0x/constexpr-100111.C: New test.

3 years agodoc: Update Power builtin documentation in user's manual
Bill Schmidt [Fri, 16 Apr 2021 15:38:11 +0000 (10:38 -0500)]
doc: Update Power builtin documentation in user's manual

The standard for many Power vector interfaces is now the recently
published Power Vector Intrinsic Programming Reference.  Reference
that document for the relevant interfaces, and remove redundant
information from the GCC user's manual.

2021-04-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Revise
this section and its subsections.

3 years agoc++: ICE with bogus late return type [PR99803]
Marek Polacek [Wed, 14 Apr 2021 21:57:15 +0000 (17:57 -0400)]
c++: ICE with bogus late return type [PR99803]

Here we ICE when compiling this code in C++20, because we're trying to
slam a 'typename' after the ->.  The cp_parser_template_id call just
before the spot I'm changing parsed A::template A<int> as a BASELINK
that contains a constructor, but make_typename_type crashes on that.

This patch makes make_typename_type more robust instead of checking
for is_overloaded_fn prior calling it.

gcc/cp/ChangeLog:

PR c++/99803
* decl.c (make_typename_type): Give an error and return when
name is is_overloaded_fn.
* parser.c (cp_parser_class_name): Don't check is_overloaded_fn
before calling make_typename_type.

gcc/testsuite/ChangeLog:

PR c++/99803
* g++.dg/cpp2a/typename14.C: Don't expect particular error
messages.
* g++.dg/cpp2a/typename19.C: New test.

3 years agotestsuite: Move gimplefe-4[0|1] tests.
Robin Dapp [Wed, 17 Mar 2021 08:08:42 +0000 (09:08 +0100)]
testsuite: Move gimplefe-4[0|1] tests.

The gimplefe-40.c and gimplefe-41.c test cases require vect_* effective
targets even though they reside in gcc.dg.  By default e.g.
DEFAULT_VECTCFLAGS which is used to add target-specific machine or build
flags is only applied in the ./vect subdirectory.  Move these tests
there.

gcc/testsuite/ChangeLog:

* gcc.dg/gimplefe-40.c: Moved to...
* gcc.dg/vect/gimplefe-40.c: ...here.
* gcc.dg/gimplefe-41.c: Moved to...
* gcc.dg/vect/gimplefe-41.c: ...here.

3 years agoPR fortran/63797 - Bogus ambiguous reference to 'sqrt'
Harald Anlauf [Fri, 16 Apr 2021 14:24:31 +0000 (16:24 +0200)]
PR fortran/63797 - Bogus ambiguous reference to 'sqrt'

The interface of an intrinsic procedure is automatically explicit.
Do not write it to the module file to prevent wrong ambiguities on USE.

gcc/fortran/ChangeLog:

PR fortran/63797
* module.c (write_symtree): Do not write interface of intrinsic
procedure to module file for F2003 and newer.

gcc/testsuite/ChangeLog:

PR fortran/63797
* gfortran.dg/pr63797.f90: New test.

Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
3 years agotestsuite: Fix pr83403-{1,2}.c on IBM Z
Stefan Schulze Frielinghaus [Fri, 16 Apr 2021 14:03:07 +0000 (16:03 +0200)]
testsuite: Fix pr83403-{1,2}.c on IBM Z

For z10 and newer inner loops are completely unrolled which means store
motion is not applied.  Reverting max-completely-peeled-insns to the
default value fixes these testcases.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr83403-1.c: Revert
max-completely-peeled-insns to the default value on IBM Z.
* gcc.dg/tree-ssa/pr83403-2.c: Likewise.