platform/upstream/gcc.git
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.

3 years agoc++: partially initialized constexpr array [PR99700]
Patrick Palka [Fri, 16 Apr 2021 13:24:46 +0000 (09:24 -0400)]
c++: partially initialized constexpr array [PR99700]

Here, reduced_constant_expression_p is incorrectly returning true for a
partially initialized array CONSTRUCTOR (in C++20 mode) because when the
CONSTRUCTOR_NO_CLEARING flag is set, the predicate doesn't check that
the CONSTRUCTOR spans the entire array like it does for class CONSTRUCTORS.
This patch adds a dedicated loop for the array case that simultaneously
verifies the CONSTRUCTOR spans the entire array and is made up of valid
constant expressions.

gcc/cp/ChangeLog:

PR c++/99700
* constexpr.c (reduced_constant_expression_p): For array
CONSTRUCTORs, use a dedicated loop that additionally verifies
the CONSTRUCTOR spans the entire array.

gcc/testsuite/ChangeLog:

PR c++/99700
* g++.dg/cpp2a/constexpr-init21.C: New test.

3 years agoaarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]
Jakub Jelinek [Fri, 16 Apr 2021 11:44:23 +0000 (13:44 +0200)]
aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

The testcase used to be compiled at -O2 by GCC8 and earlier to:
f1:
        neg     w1, w0, asr 16
        and     w1, w1, 65535
        orr     w0, w1, w0, lsl 16
        ret
f2:
        neg     w1, w0
        extr    w0, w1, w0, 16
        ret
but since GCC9 (r9-3594 for f1 and r9-6926 for f2) we compile it into:
f1:
        mov     w1, w0
        sbfx    x0, x1, 16, 16
        neg     w0, w0
        bfi     w0, w1, 16, 16
        ret
f2:
        neg     w1, w0
        sbfx    x0, x0, 16, 16
        bfi     w0, w1, 16, 16
        ret
instead, i.e. one insn longer each.  With this patch we get:
f1:
        mov     w1, w0
        neg     w0, w1, asr 16
        bfi     w0, w1, 16, 16
        ret
f2:
        neg     w1, w0
        extr    w0, w1, w0, 16
        ret
i.e. identical f2 and same number of insns as in GCC8 in f1.
The combiner unfortunately doesn't try splitters when doing 2 -> 1
combination, so it can't be implemented as combine splitters, but
it could be implemented as define_insn_and_split if desirable.

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

PR target/100075
* config/aarch64/aarch64.md (*neg_asr_si2_extr, *extrsi5_insn_di): New
define_insn patterns.

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

3 years agoMark untyped calls and handle them specially [PR98689]
Richard Sandiford [Fri, 16 Apr 2021 11:38:02 +0000 (12:38 +0100)]
Mark untyped calls and handle them specially [PR98689]

This patch fixes a regression introduced by the rtl-ssa patches.
It was seen on HPPA but it might be latent elsewhere.

The problem is that the traditional way of expanding an untyped_call
is to emit sequences like:

   (call (mem (symbol_ref "foo")))
   (set (reg pseudo1) (reg result1))
   ...
   (set (reg pseudon) (reg resultn))

The ABI specifies that result1..resultn are clobbered by the call but
nothing in the RTL indicates that result1..resultn are the results
of the call.  Normally, using a clobbered value gives undefined results,
but in this case the results are well-defined and matter for correctness.

This seems like a niche case, so I think it would be better to mark
it explicitly rather than try to detect it heuristically.

Note that in expand_builtin_apply we already have an rtx_insn *,
so it doesn't matter whether we call emit_call_insn or emit_insn.
Calling emit_insn seems more natural now that the gen_* call
has been split out.  It also matches later code in the function.

gcc/
PR rtl-optimization/98689
* reg-notes.def (UNTYPED_CALL): New note.
* combine.c (distribute_notes): Handle it.
* emit-rtl.c (try_split): Likewise.
* rtlanal.c (rtx_properties::try_to_add_insn): Likewise.  Assume
that calls with the note implicitly set all return value registers.
* builtins.c (expand_builtin_apply): Add a REG_UNTYPED_CALL
to untyped_calls.

3 years agortlanal: Don't assume that calls write to a global SP [PR99596]
Richard Sandiford [Fri, 16 Apr 2021 11:38:01 +0000 (12:38 +0100)]
rtlanal: Don't assume that calls write to a global SP [PR99596]

This patch is a GCC 11 regression caused by the rtl-ssa code.
Normally we treat calls as containing a potential set of a global
register, but DF makes a sensible exception for the stack pointer:

      if (i == STACK_POINTER_REGNUM)
/* The stack ptr is used (honorarily) by a CALL insn.  */
df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
       NULL, bb, insn_info, DF_REF_REG_USE,
       DF_REF_CALL_STACK_USAGE | flags);
      else if (global_regs[i])
{
  /* Calls to const functions cannot access any global registers and
     calls to pure functions cannot set them.  All other calls may
     reference any of the global registers, so they are recorded as
     used. */

The only DF definition of SP was therefore the one in the entry block.
However, the rtlanal.c rtx_properties code (wrongly) assumed that calls
also clobbered the global SP.  This led to multiple definitions of SP
when we only expected one.

This patch tightens the rtlanal.c handling of global registers
to match the DF approach.

gcc/
PR rtl-optimization/99596
* rtlanal.c (rtx_properties::try_to_add_insn): Don't add global
register accesses for const calls.  Assume that pure functions
can only read from global registers.  Ignore cases in which
the stack pointer has been marked global.

gcc/testsuite/
PR rtl-optimization/99596
* gcc.target/arm/pr99596.c: New test.

3 years agoarm: Fix some testsuite fallout from r11-8168 [PR100067]
Richard Earnshaw [Fri, 16 Apr 2021 10:58:17 +0000 (11:58 +0100)]
arm: Fix some testsuite fallout from r11-8168 [PR100067]

Commit r11-8168 changed the word ordering of a warning in order to
make the text more consistent.  Unfortunately, it neglected to update
some filters in the testsuite that are intended to strip such warnings
when we try to partially override the user-supplied command-line
options.

This patch rectifies this and also fixes some patterns that were
incorrectly specified in the first place.

gcc/testsuite:

PR target/100067
* g++.target/arm/arm.exp (dg_runtest_extra_prunes): Update prune
template.
* gcc.target/arm/arm.exp (dg_runtest_extra_prunes): Likewise.
* g++.target/arm/mve.exp (dg_runtest_extra_prunes): Likewise.  Fix
missing quotes around switch names.
* gcc.target/arm/mve/mve.exp: (dg_runtest_extra_prunes): Likewise.

3 years agovectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767]
Jakub Jelinek [Fri, 16 Apr 2021 09:44:04 +0000 (11:44 +0200)]
vectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767]

The following testcase ICEs because disabling of DCE means there are dead
stmts in the loop (though, in theory they could become dead only shortly
before if-conv through some optimization), ifcvt which goes through all
stmts in the loop if-converts them into .COND_DIV etc. internal fn calls
in the copy of the loop meant for vectorization only, the loop is
successfully vectorized but the particular .COND_* call is not because
it isn't a live statement and the scalar .COND_* remains in the IL until
expansion where it ICEs because these ifns only support vectors and not
scalars.

These ifns are similar to .MASK_{LOAD,STORE} in this behavior.

One possible fix could be to expand scalar versions of them during
expansion, basically undoing what if-conv did to create them, i.e.
expand them as the lhs = else; if (mask) { lhs = statement; } or so.

For .MASK_LOAD we have code to replace them in vect_transform_loop already
though (not needed for .MASK_STORE, as stores should be always live
and thus always vectorized), so this patch instead replaces .COND_*
similarly to .MASK_LOAD in that loop, with the small difference
that lhs = .MASK_LOAD (...); is replaced by lhs = 0; while
lhs = .COND_* (..., else_arg); is replaced by lhs = else_arg.
The statement must be dead, otherwise it would be vectorized, so I think
it is not a big deal we don't turn it back into multiple basic blocks etc.
(and it might be not possible to do that at that point).

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

PR target/99767
* tree-vect-loop.c (vect_transform_loop): Don't remove just
dead scalar .MASK_LOAD calls, but also dead .COND_* calls - replace
them by their last argument.

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

3 years agoc++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]
Jakub Jelinek [Fri, 16 Apr 2021 07:34:26 +0000 (09:34 +0200)]
c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]

The requires clause parsing has code to suggest users wrapping
non-primary expressions in (), so if it e.g. parses a primary expression
and sees it is followed by ++, --, ., ( or -> among other things it
will try to reparse it as assignment expression or what and if that works
suggests wrapping it inside of parens.
When it is requires-clause that is after <typename T> etc. it already
has an exception from that as ( can occur in valid C++20 expression there
- starting the parameters of the lambda.
In C++23 another case can occur, as the parameters with the ()s can be
omitted, requires C can be followed immediately by -> which starts a
trailing return type.  Even in that case, we don't want to parse that
as C->...

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

PR c++/99850
* parser.c (cp_parser_constraint_requires_parens) <case CPP_DEREF>:
If lambda_p, return pce_ok instead of pce_maybe_postfix.

* g++.dg/cpp23/lambda-specifiers2.C: New test.

3 years agoc++: Fix up handling of structured bindings in extract_locals_r [PR99833]
Jakub Jelinek [Fri, 16 Apr 2021 07:32:44 +0000 (09:32 +0200)]
c++: Fix up handling of structured bindings in extract_locals_r [PR99833]

The following testcase ICEs in tsubst_decomp_names because the assumptions
that the structured binding artificial var is followed in DECL_CHAIN by
the corresponding structured binding vars is violated.
I've tracked it to extract_locals* which is done for the constexpr
IF_STMT.  extract_locals_r when it sees a DECL_EXPR adds that decl
into a hash set so that such decls aren't returned from extract_locals*,
but in the case of a structured binding that just means the artificial var
and not the vars corresponding to structured binding identifiers.
The following patch fixes it by pushing not just the artificial var
for structured bindings but also the other vars.

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

PR c++/99833
* pt.c (extract_locals_r): When handling DECL_EXPR of a structured
binding, add to data.internal also all corresponding structured
binding decls.

* g++.dg/cpp1z/pr99833.C: New test.
* g++.dg/cpp2a/pr99833.C: New test.

3 years agotestsuite: Fix unroll-and-jam.c on IBM Z
Stefan Schulze Frielinghaus [Fri, 16 Apr 2021 05:48:34 +0000 (07:48 +0200)]
testsuite: Fix unroll-and-jam.c on IBM Z

For z10 and newer inner loops are completely unrolled which leaves no
inner loops to jam which renders this testcase to fail.  Reverting
max-completely-peel-times to the default value fixes this testcase.

gcc/testsuite/ChangeLog:

* gcc.dg/unroll-and-jam.c: Revert max-completely-peel-times to
the default value on IBM Z.

3 years agoc++: C++20 class NTTP trailing zero-init [PR100079]
Jason Merrill [Wed, 14 Apr 2021 21:27:19 +0000 (17:27 -0400)]
c++: C++20 class NTTP trailing zero-init [PR100079]

The new testcase was breaking because constexpr evaluation was simplifying
Bar{Baz<42>{}} to Bar{empty}, but then we weren't treating them as
equivalent.  Poking at this revealed that the code for eliding trailing
zero-initialization in class non-type template argument mangling was pretty
broken, including the test, mangle71.

I dealt with the FIXME to support RANGE_EXPR, and fixed the confusion
between a list-initialized temporary mangled as written (i.e. in the
signature of a function template) and a template parameter object mangled as
the value representation of the object.  I'm distinguishing between these
using COMPOUND_LITERAL_P.  A later patch will adjust the use of
COMPOUND_LITERAL_P to be more useful for this distinction, but it works now
for distinguishing these cases in mangling.

gcc/cp/ChangeLog:

PR c++/100079
* cp-tree.h (first_field): Declare.
* mangle.c (range_expr_nelts): New.
(write_expression): Improve class NTTP mangling.
* pt.c (get_template_parm_object): Clear TREE_HAS_CONSTRUCTOR.
* tree.c (zero_init_expr_p): Improve class NTTP handling.
* decl.c: Adjust comment.

gcc/testsuite/ChangeLog:

PR c++/100079
* g++.dg/abi/mangle71.C: Fix expected mangling.
* g++.dg/abi/mangle77.C: New test.
* g++.dg/cpp2a/nontype-class-union1.C: Likewise.
* g++.dg/cpp2a/nontype-class-equiv1.C: Removed.
* g++.dg/cpp2a/nontype-class44.C: New test.

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

3 years agoPropagate type attribute when merging extern declarations at local scope.
Martin Sebor [Thu, 15 Apr 2021 21:49:30 +0000 (15:49 -0600)]
Propagate type attribute when merging extern declarations at local scope.

Resolves:
PR c/99420 - bogus -Warray-parameter on a function redeclaration in function scope
PR c/99972 - missing -Wunused-result on a call to a locally redeclared warn_unused_result function

gcc/c/ChangeLog:

PR c/99420
PR c/99972
* c-decl.c (pushdecl): Always propagate type attribute.

gcc/testsuite/ChangeLog:

PR c/99420
PR c/99972
* gcc.dg/Warray-parameter-9.c: New test.
* gcc.dg/Wnonnull-6.c: New test.
* gcc.dg/Wreturn-type3.c: New test.
* gcc.dg/Wunused-result.c: New test.
* gcc.dg/attr-noreturn.c: New test.
* gcc.dg/attr-returns-nonnull.c: New test.

3 years agogcc.dg/pr84877.c: Xfail for cris-*-*
Hans-Peter Nilsson [Thu, 15 Apr 2021 19:51:08 +0000 (21:51 +0200)]
gcc.dg/pr84877.c: Xfail for cris-*-*

Unfortunately it appears that this PR is on nobody's radar.
Xfailing it to get an arguably artificial zero regression
state (since T0=2007-01-05) helps my autotester.

Caveat: the pass/fail state of this test, as long as stack
alignment isn't adjusted, is dependent on the alignment of
the stack at the entry of main, so depending on the target,
e.g. the size and number of environment variables at
invocation time can affect the result (including simulator
runs where environment variables are propagated to the
target).

gcc/testsuite:
PR middle-end/84877
* gcc.dg/pr84877.c: Xfail for cris-*-*.

3 years agoc++: constexpr and volatile member function [PR80456]
Jason Merrill [Thu, 15 Apr 2021 19:13:18 +0000 (15:13 -0400)]
c++: constexpr and volatile member function [PR80456]

When calling a static member function we still need to evaluate an explicit
object argument.  But we don't want to force a load of the entire object
if the argument is volatile, so we take its address.  If as a result it no
longer has any side-effects, we don't need to evaluate it after all.

gcc/cp/ChangeLog:

PR c++/80456
* call.c (build_new_method_call_1): Check again for side-effects
with a volatile object.

gcc/testsuite/ChangeLog:

PR c++/80456
* g++.dg/cpp0x/constexpr-volatile3.C: New test.

3 years agoPR middle-end/89230 - Bogus uninited usage warning with printf
Martin Sebor [Thu, 15 Apr 2021 20:09:56 +0000 (14:09 -0600)]
PR middle-end/89230 - Bogus uninited usage warning with printf

gcc/testsuite/ChangeLog:
* gcc.dg/uninit-pr89230-1.c: New test.
* gcc.dg/uninit-pr89230-2.c: Same.

3 years agoc++: noexcept error recursion [PR100101]
Jason Merrill [Thu, 15 Apr 2021 17:38:54 +0000 (13:38 -0400)]
c++: noexcept error recursion [PR100101]

Here instantiating the noexcept-specifier for bar<void>() means
instantiating A<void>::value, which complains about the conversion from 0 to
int* in the default argument of foo.  Since my patch for PR99583, printing
the error context involves looking at C<void>::type, which again wants to
instantiate A<void>::value, which breaks.  For now at least, let's break
this recursion by avoiding looking into the noexcept-specifier in
find_typenames, and limit that to just the uses_parameter_packs case that
PR99583 cares about.

gcc/cp/ChangeLog:

PR c++/100101
PR c++/99583
* pt.c (find_parameter_packs_r) [FUNCTION_TYPE]: Walk into
TYPE_RAISES_EXCEPTIONS here.
* tree.c (cp_walk_subtrees): Not here.

gcc/testsuite/ChangeLog:

PR c++/100101
* g++.dg/cpp0x/noexcept67.C: New test.

3 years agolibstdc++: Add -latomic to test flags for 32-bit sparc-linux
Jonathan Wakely [Thu, 15 Apr 2021 15:39:55 +0000 (16:39 +0100)]
libstdc++: Add -latomic to test flags for 32-bit sparc-linux

Without this I see a number of tests failing when -m32 is used.

libstdc++-v3/ChangeLog:

* testsuite/lib/dg-options.exp (add_options_for_libatomic): Also
add libatomic options for 32-bit sparc*-*-linux-gnu.

3 years agoc++: lambda in default type template-argument [PR100091]
Jason Merrill [Thu, 15 Apr 2021 16:16:48 +0000 (12:16 -0400)]
c++: lambda in default type template-argument [PR100091]

My patch for 99478 relied on local_variables_forbidden_p for distinguishing
between a template parameter and its default argument, but that flag wasn't
set for a default type template-argument.

gcc/cp/ChangeLog:

PR c++/100091
PR c++/99478
* parser.c (cp_parser_default_type_template_argument): Set
parser->local_variables_forbidden_p.

gcc/testsuite/ChangeLog:

PR c++/100091
* g++.dg/cpp2a/lambda-uneval15.C: New test.

3 years agolibstdc++: Move atomic functions to libsupc++ [PR 96657]
Jonathan Wakely [Wed, 14 Apr 2021 19:48:54 +0000 (20:48 +0100)]
libstdc++: Move atomic functions to libsupc++ [PR 96657]

The changes for PR libstdc++/64735 mean that libsupc++ function might
now depend on the __exchange_and_add and __atomic_add functions defined
in config/cpu/*/atomicity.h which is not compiled into libsupc++. This
causes a link failure for some targets when trying to use libsupc++
without the rest of libstdc++.

This patch simply moves the definitions of those functions into
libsupc++ so that they are available there.

libstdc++-v3/ChangeLog:

PR libstdc++/96657
* libsupc++/Makefile.am: Add atomicity.cc here.
* src/c++98/Makefile.am: Remove it from here.
* libsupc++/Makefile.in: Regenerate.
* src/c++98/Makefile.in: Regenerate.
* testsuite/18_support/exception_ptr/96657.cc: New test.

3 years agoMake SVE ACLE tests work with --with-cpu
Richard Sandiford [Thu, 15 Apr 2021 15:18:26 +0000 (16:18 +0100)]
Make SVE ACLE tests work with --with-cpu

This patch follows on from a previous one and adds -mtune=generic
to the SVE ACLE assembler tests.  These tests are pure assembly
tests (execution tests are elsewhere) and they already require
dg-additional-options to be used to add new options.  We therefore
don't need aarch64-with-arch-dg-options.

gcc/testsuite/
* g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Add
-mtune=generic to the SVE flags.
* g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise.
* gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise.
* gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise.

3 years agoMake SVE tests work with --with-cpu
Richard Sandiford [Thu, 15 Apr 2021 15:18:25 +0000 (16:18 +0100)]
Make SVE tests work with --with-cpu

A lot of the SVE assembly tests are for generic-tuned SVE codegen
and so can fail when run on a toolchain configured with --with-cpu.

This could easily be solved by forcing -mtune=generic, like we already
do for -moverride=tune=none.  However, the testsuite also has some
useful execution tests that it would be better to run with as
few flag changes as possible.  Also, the flags in $sve_flags are
printed as part of the test results, so each change to $sve_flags
results in a change to the test summaries.

This patch instead intercepts dg-options and tailors the list
of additional options based on what the test is trying to do.
It also gets rid of DEFAULT_CFLAGS, which are never useful
for these tests.

gcc/testsuite/
* lib/gcc-defs.exp (aarch64-arch-dg-options): New procedure.
(aarch64-with-arch-dg-options): Likewise.
* g++.target/aarch64/sve/aarch64-sve.exp: Run the tests inside
aarch64-with-arch-dg-options.  Move the default architecture
flags to the final dg-runtest argument.
* gcc.target/aarch64/sve/aarch64-sve.exp: Likewise.  Dispense with
DEFAULT_CFLAGS.
* gcc.target/aarch64/sve2/aarch64-sve2.exp: Likewise.

3 years agodocs: remove itemx for a param
Martin Liska [Thu, 15 Apr 2021 12:50:04 +0000 (14:50 +0200)]
docs: remove itemx for a param

gcc/ChangeLog:

* doc/invoke.texi: Other params don't use it, remove it.

3 years agotestsuite: enable pr86058.c also on i?86-*-* [PR100073]
Jakub Jelinek [Thu, 15 Apr 2021 12:08:03 +0000 (14:08 +0200)]
testsuite: enable pr86058.c also on i?86-*-* [PR100073]

The test also works with -m32 or -mx32 the same as it does for -m64,
therefore it should be enabled for i?86-*-* x86_64-*-* targets,
x86_64-*-* alone is never right.

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

PR testsuite/100073
* gcc.dg/pr86058.c: Enable also on i?86-*-*.

3 years agoDeprecate gimple-builder.h API
Richard Biener [Thu, 15 Apr 2021 10:57:00 +0000 (12:57 +0200)]
Deprecate gimple-builder.h API

This adds a deprecation note to the undocumented gimple-builder.h
API only used by asan and sancov.

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

* gimple-builder.h: Add deprecation note.

3 years agoc++: Tweak merging of vector attributes that affect type identity [PR98852]
Richard Sandiford [Thu, 15 Apr 2021 10:37:39 +0000 (11:37 +0100)]
c++: Tweak merging of vector attributes that affect type identity [PR98852]

<arm_neon.h> types are distinct from GNU vector types in at least
their mangling.  However, there used to be nothing explicit in the
VECTOR_TYPE itself to indicate the difference: we simply treated them
as distinct TYPE_MAIN_VARIANTs.  This caused problems like the ones
reported in PR95726.

The fix for that PR was to add type attributes to the <arm_neon.h>
types, in order to maintain the distinction between them and GNU
vectors.  However, this in turn caused PR98852, where cp_common_type
would merge the type attributes from the two source types and attach
the result to the common type.  For example:

   unsigned vector with no attribute + signed vector with attribute X

would get converted to:

   unsigned vector with attribute X

That isn't what we want in this case, since X describes the mangling
of the original type.  But even if we dropped the mangling from X and
worked it out from context, we would still have a situation in which
the common type was provably distinct from both of the source types:
it would take its <arm_neon.h>-ness from one side and its signedness
from the other.  I guess there are other cases where the common type
doesn't match either side, but I'm not sure it's the obvious behaviour
here.  It's also different from GCC 10.1 and earlier, where the unsigned
vector “won” in its original form.

This patch instead merges only the attributes that don't affect type
identity.  For now I've restricted it to vector types, since we're so
close to GCC 11, but it might make sense to use this elsewhere.

I've tried to audit the C and target-specific attributes to look for
other types that might be affected by this, but I couldn't see any.
The closest was s390_vector_bool, but the handler for that attribute
changes the type node and drops the attribute itself
(*no_add_attrs = true).

gcc/
PR c++/98852
* attribs.h (restrict_type_identity_attributes_to): Declare.
* attribs.c (restrict_type_identity_attributes_to): New function.

gcc/cp/
PR c++/98852
* typeck.c (merge_type_attributes_from): New function.
(cp_common_type): Use it for vector types.

3 years agoc: Don't drop vector attributes that affect type identity [PR98852]
Richard Sandiford [Thu, 15 Apr 2021 10:37:38 +0000 (11:37 +0100)]
c: Don't drop vector attributes that affect type identity [PR98852]

<arm_neon.h> types are distinct from GNU vector types in at least
their mangling.  However, there used to be nothing explicit in the
VECTOR_TYPE itself to indicate the difference: we simply treated them
as distinct TYPE_MAIN_VARIANTs.  This caused problems like the ones
reported in PR95726.

The fix for that PR was to add type attributes to the <arm_neon.h>
types, in order to maintain the distinction between them and GNU
vectors.  However, this in turn caused PR98852, where c_common_type
would unconditionally drop the attributes on the source types.
This meant that:

   <arm_neon.h> vector + <arm_neon.h> vector

had a GNU vector type rather than an <arm_neon.h> vector type.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96377#c2 for
Jakub's analysis of the history of this c_common_type code.
TBH I'm not sure which case the build_type_attribute_variant
code is handling, but I think we should at least avoid dropping
attributes that affect type identity.

I've tried to audit the C and target-specific attributes to look
for other types that might be affected by this, but I couldn't
see any.  We are only dealing with:

  gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE
      || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE
      || code1 == INTEGER_TYPE);

which excludes most affects_type_identity attributes.  The closest
was s390_vector_bool, but the handler for that attribute changes
the type node and drops the attribute itself (*no_add_attrs = true).

I put the main list handling into a separate function
(remove_attributes_matching) because a later patch will need it
for something else.

gcc/
PR c/98852
* attribs.h (affects_type_identity_attributes): Declare.
* attribs.c (remove_attributes_matching): New function.
(affects_type_identity_attributes): Likewise.

gcc/c/
PR c/98852
* c-typeck.c (c_common_type): Do not drop attributes that
affect type identity.

gcc/testsuite/
PR c/98852
* gcc.target/aarch64/advsimd-intrinsics/pr98852.c: New test.

3 years agoFix handling of clones in lto_wpa_write_files [PR98599]
Jan Hubicka [Thu, 15 Apr 2021 09:40:40 +0000 (11:40 +0200)]
Fix handling of clones in lto_wpa_write_files [PR98599]

2021-04-15  Jan Hubicka  <hubicka@ucw.cz>

PR lto/98599
* lto.c (lto_wpa_write_files): Fix handling of clones.

3 years agoXFAIL OpenMP/nvptx execution-time hangs for simple nested OpenMP 'target'/'parallel...
Thomas Schwinge [Wed, 7 Apr 2021 08:36:36 +0000 (10:36 +0200)]
XFAIL OpenMP/nvptx execution-time hangs for simple nested OpenMP 'target'/'parallel'/'task' constructs [PR99555]

... still awaiting proper resolution, of course.

libgomp/
PR target/99555
* testsuite/lib/libgomp.exp
(check_effective_target_offload_device_nvptx): New.
* testsuite/libgomp.c/pr99555-1.c <nvptx offload device>: Until
resolved, make sure that we exit quickly, with error status,
XFAILed.
* testsuite/libgomp.c-c++-common/task-detach-6.c: Likewise.
* testsuite/libgomp.fortran/task-detach-6.f90: Likewise.

3 years agoaarch64: Fix several *<LOGICAL:optab>_ashl<mode>3 related regressions [PR100056]
Jakub Jelinek [Thu, 15 Apr 2021 08:45:09 +0000 (10:45 +0200)]
aarch64: Fix several *<LOGICAL:optab>_ashl<mode>3 related regressions [PR100056]

Before combiner added 2 to 2 combinations, the following testcase functions
have been all compiled into 2 instructions, zero/sign extensions or and
followed by orr with lsl, e.g. for the first function
Trying 7 -> 8:
    7: r96:SI=r94:SI<<0xb
    8: r95:SI=r96:SI|r94:SI
      REG_DEAD r96:SI
      REG_DEAD r94:SI
Successfully matched this instruction:
(set (reg:SI 95)
    (ior:SI (ashift:SI (reg/v:SI 94 [ i ])
            (const_int 11 [0xb]))
        (reg/v:SI 94 [ i ])))
is the important successful try_combine and so we end up with
        and     w0, w0, 255
        orr     w0, w0, w0, lsl 11
in the body.
With 2 to 2 combination, before that can trigger, another successful
combination:
Trying 2 -> 7:
    2: r94:SI=zero_extend(x0:QI)
      REG_DEAD x0:QI
    7: r96:SI=r94:SI<<0xb
is replaced with:
(set (reg/v:SI 94 [ i ])
    (zero_extend:SI (reg:QI 0 x0 [ i ])))
and
(set (reg:SI 96)
    (and:SI (ashift:SI (reg:SI 0 x0 [ i ])
            (const_int 11 [0xb]))
        (const_int 522240 [0x7f800])))
and in the end results in 3 instructions in the body:
        and     w1, w0, 255
        ubfiz   w0, w0, 11, 8
        orr     w0, w0, w1
The following combine splitters help undo that when combiner tries to
combine 3 instructions - the zero/sign extend or and, the other insn
from the 2 to 2 combination ([us]bfiz) and the logical op, the CPUs
don't have an insn to do everything in one op, but we can split it
back into the zero/sign extend or and followed by logical with lsl.

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

PR target/100056
* config/aarch64/aarch64.md (*<LOGICAL:optab>_<SHIFT:optab><mode>3):
Add combine splitters for *<LOGICAL:optab>_ashl<mode>3 with
ZERO_EXTEND, SIGN_EXTEND or AND.

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

3 years agoFortran: Fix class reallocate on assignment [PR99307].
Paul Thomas [Thu, 15 Apr 2021 06:34:26 +0000 (07:34 +0100)]
Fortran: Fix class reallocate on assignment [PR99307].

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

gcc/fortran
PR fortran/99307
* symbol.c: Remove trailing white space.
* trans-array.c (gfc_trans_create_temp_array): Create a class
temporary for class expressions and assign the new descriptor
to the data field.
(build_class_array_ref): If the class expr can be extracted,
then use that for 'decl'. Class function results are reliably
handled this way. Call gfc_find_and_cut_at_last_class_ref to
eliminate largely redundant code. Remove dead code and recast
the rest of the code to extract 'decl' for remaining cases.
Call gfc_build_spanned_array_ref.
(gfc_alloc_allocatable_for_assignment): Use class descriptor
element length for 'elemsize1'. Eliminate repeat set of dtype
for class expressions.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): Include
additional code from build_class_array_ref, and use optional
gfc_typespec pointer argument.
(gfc_trans_scalar_assign): Make use of pre and post blocks for
all class expressions.
* trans.c (get_array_span): For unlimited polymorphic exprs
multiply the span by the value of the _len field.
(gfc_build_spanned_array_ref): New function.
(gfc_build_array_ref): Call gfc_build_spanned_array_ref and
eliminate repeated code.
* trans.h: Add arg to gfc_find_and_cut_at_last_class_ref and
add prototype for gfc_build_spanned_array_ref.

3 years agore PR tree-optimization/93210 (Sub-optimal code optimization on struct/combound const...
Stefan Schulze Frielinghaus [Thu, 15 Apr 2021 06:03:47 +0000 (08:03 +0200)]
re PR tree-optimization/93210 (Sub-optimal code optimization on struct/combound constexpr (gcc vs. clang))

Regarding test gcc.dg/pr93210.c, on different targets GIMPLE code may
slightly differ which is why the scan-tree-dump-times directive may
fail.  For example, for a RETURN_EXPR on x86_64 we have

  return 0x11100f0e0d0c0a090807060504030201;

whereas on IBM Z the first operand is a RESULT_DECL like

  <retval> = 0x102030405060708090a0c0d0e0f1011;
  return <retval>;

gcc/testsuite/ChangeLog:

* gcc.dg/pr93210.c: Adapt regex in order to also support a
RESULT_DECL as an operand for a RETURN_EXPR.

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

3 years agoCheck for matching CONST_VECTOR encodings [PR99929]
Richard Sandiford [Wed, 14 Apr 2021 19:06:45 +0000 (20:06 +0100)]
Check for matching CONST_VECTOR encodings [PR99929]

PR99929 is one of those “how did we get away with this for so long”
bugs: the equality routines weren't checking whether two variable-length
CONST_VECTORs had the same encoding.  This meant that:

   { 1, 0, 0, 0, 0, 0, ... }

would appear to be equal to:

   { 1, 0, 1, 0, 1, 0, ... }

since both are represented using the elements { 1, 0 }.

gcc/
PR rtl-optimization/99929
* rtl.h (same_vector_encodings_p): New function.
* cse.c (exp_equiv_p): Check that CONST_VECTORs have the same encoding.
* cselib.c (rtx_equal_for_cselib_1): Likewise.
* jump.c (rtx_renumbered_equal_p): Likewise.
* lra-constraints.c (operands_match_p): Likewise.
* reload.c (operands_match_p): Likewise.
* rtl.c (rtx_equal_p_cb, rtx_equal_p): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/pr99929_1.c: New file.
* gcc.target/aarch64/sve/pr99929_2.c: Likewise.

3 years agoBetter const_vector printing
Richard Sandiford [Wed, 14 Apr 2021 19:06:44 +0000 (20:06 +0100)]
Better const_vector printing

Looking at PR99929 showed that we weren't dumping enough information
about variable-length CONST_VECTORs.  Something like:

  (const_vector:VNx4SI [(const_int 1) (const_int 0)])

could be either:

(a) 1, 0, 1, 0, repeating
(b) 1 followed by all zeros

This patch adds more information to the dumps.  There are four cases:

(a) above:

    (const_vector:VNx4SI repeat [
      (const_int 1)
      (const_int 0)
    ])

(b) above:

    (const_vector:VNx4SI [
      (const_int 1)
      repeat [
        (const_int 0)
      ]
    ])

a single stepped sequence:

    (const_vector:VNx4SI [
      (const_int 0)
      stepped [
        (const_int 1)
        (const_int 2)
      ]
    ])

interleaved stepped sequences:

    (const_vector:VNx4SI [
      (const_int 0)
      (const_int 40)
      stepped (interleave 2) [
        (const_int 1)
        (const_int 41)
        (const_int 2)
        (const_int 42)
      ]
    ])

There are probably better syntaxes, but hopefully this is at least
an improvement on the status quo.

gcc/
* print-rtl.c (rtx_writer::print_rtx_operand_codes_E_and_V): Print
more information about variable-length CONST_VECTORs.

3 years agoc++: premature overload resolution redux [PR100078]
Jason Merrill [Wed, 14 Apr 2021 18:14:31 +0000 (14:14 -0400)]
c++: premature overload resolution redux [PR100078]

My patch for PR93085 didn't consider that a default template argument can
also make a template dependent.

gcc/cp/ChangeLog:

PR c++/100078
PR c++/93085
* pt.c (uses_outer_template_parms): Also look at default
template argument.

gcc/testsuite/ChangeLog:

PR c++/100078
* g++.dg/template/dependent-tmpl2.C: New test.

3 years agoc++: non-static member, array bound, sizeof [PR93314]
Jason Merrill [Wed, 14 Apr 2021 13:30:05 +0000 (09:30 -0400)]
c++: non-static member, array bound, sizeof [PR93314]

N2253 allowed referring to non-static data members without an object in
unevaluated operands like that of sizeof, but in a constant-expression
context like an array bound or template argument within such an unevaluated
operand we do actually need a value, so that permission cannot apply.

gcc/cp/ChangeLog:

PR c++/93314
* semantics.c (finish_id_expression_1): Clear cp_unevaluated_operand
for a non-static data member in a constant-expression.

gcc/testsuite/ChangeLog:

PR c++/93314
* g++.dg/parse/uneval1.C: New test.

3 years ago[PR100066] Check paradoxical subreg when splitting hard reg live range
Vladimir N. Makarov [Wed, 14 Apr 2021 17:21:40 +0000 (13:21 -0400)]
[PR100066] Check paradoxical subreg when splitting hard reg live range

When splitting live range of a hard reg, LRA actually split multi-register
containing the hard reg.  So we need to check the biggest used mode of the hard reg on
paradoxical subregister when the natural and the biggest
mode are ordered.

gcc/ChangeLog:

PR rtl-optimization/100066
* lra-constraints.c (split_reg): Check paradoxical_subreg_p for
ordered modes when choosing splitting mode for hard reg.

gcc/testsuite/ChangeLog:

PR rtl-optimization/100066
* gcc.target/i386/pr100066.c: New.

3 years agoPR testsuite/100073 - test case gcc.dg/pr86058.c fails on arm, powerpc64
Martin Sebor [Wed, 14 Apr 2021 16:43:22 +0000 (10:43 -0600)]
PR testsuite/100073 - test case gcc.dg/pr86058.c fails on arm, powerpc64

gcc/testsuite/ChangeLog:
* gcc.dg/pr86058.c: Limit to just x86_64.

3 years agoaarch64: Handle more SVE vector constants [PR99246]
Richard Sandiford [Wed, 14 Apr 2021 15:19:46 +0000 (16:19 +0100)]
aarch64: Handle more SVE vector constants [PR99246]

PR99246 is about a case in which we failed to handle a CONST_VECTOR
with NELTS_PER_PATTERN==2, i.e. a vector with a “foreground” sequence
of N vectors followed by a repeating “background” sequence of N vectors.

At the moment, it's difficult to produce these vectors directly,
but I'm hoping that for GCC 12 we'll do more folding, which will
in turn make this easier to test and easier to optimise.  Until then,
the patch simply relies on the testcase in the PR.

gcc/
PR target/99246
* config/aarch64/aarch64.c (aarch64_expand_sve_const_vector_sel):
New function.
(aarch64_expand_sve_const_vector): Use it for nelts_per_pattern==2.

gcc/testsuite/
PR target/99246
* gcc.target/aarch64/sve/acle/general/pr99246.c: New test.

3 years agoIBM Z: Fix error checking for immediate builtin operands
Andreas Krebbel [Wed, 14 Apr 2021 14:07:17 +0000 (16:07 +0200)]
IBM Z: Fix error checking for immediate builtin operands

This fixes the error checking for two of the vector builtins which
accept irregular (e.g. non-contigiuous) ranges of values.

gcc/ChangeLog:

* config/s390/s390-builtins.def (O_M5, O_M12, ...): Add new macros
for mask operand types.
(s390_vec_permi_s64, s390_vec_permi_b64, s390_vec_permi_u64)
(s390_vec_permi_dbl, s390_vpdi): Use the M5 type for the immediate
operand.
(s390_vec_msum_u128, s390_vmslg): Use the M12 type for the
immediate operand.
* config/s390/s390.c (s390_const_operand_ok): Check the new
operand types and generate a list of valid values.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zvector/imm-range-error-1.c: New test.
* gcc.target/s390/zvector/vec_msum_u128-1.c: New test.

3 years agod: Add TARGET_D_REGISTER_OS_TARGET_INFO
Iain Buclaw [Mon, 5 Apr 2021 18:40:38 +0000 (20:40 +0200)]
d: Add TARGET_D_REGISTER_OS_TARGET_INFO

This allows target platforms that have D support files to defined their
own target-specific information keys.

gcc/ChangeLog:

* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_REGISTER_OS_TARGET_INFO.

gcc/d/ChangeLog:

* d-target.cc (Target::_init): Call new targetdm hook to register OS
specific target info keys.
* d-target.def (d_register_os_target_info): New hook.

3 years agoc++: Fix deduction with reference NTTP [PR83476]
Patrick Palka [Wed, 14 Apr 2021 12:54:30 +0000 (08:54 -0400)]
c++: Fix deduction with reference NTTP [PR83476]

In the testcase ref11.C below, during deduction for the call f(a),
uses_deducible_template_parms returns false for the dependent
specialization A<V> because the generic template argument V here is
wrapped in an implicit INDIRECT_REF (formed from template_parm_to_arg).
Since uses_deducible_template_parms returns false, unify_one_argument
exits early without ever attempting to deduce 'n' for 'V'.  This patch
fixes this by making deducible_expression look through such implicit
INDIRECT_REFs.

gcc/cp/ChangeLog:

PR c++/83476
PR c++/99885
* pt.c (deducible_expression): Look through implicit
INDIRECT_REFs as well.

gcc/testsuite/ChangeLog:

PR c++/83476
PR c++/99885
* g++.dg/cpp1z/class-deduction85.C: New test.
* g++.dg/template/ref11.C: New test.

3 years agod: Remove setting of target-specific global.params flags from front-end
Iain Buclaw [Wed, 14 Apr 2021 10:19:54 +0000 (12:19 +0200)]
d: Remove setting of target-specific global.params flags from front-end

Now that all dependencies on these flags have been removed, there's no
need to test and set them.

gcc/d/ChangeLog:

* d-builtins.cc (d_add_builtin_version): Remove all setting of
target-specific global.params.
* typeinfo.cc (create_typeinfo): Don't add argType fields to
TypeInfo_Struct.

3 years agod: Move call to set_linkage_for_decl to declare_extern_var.
Iain Buclaw [Tue, 13 Apr 2021 14:19:03 +0000 (16:19 +0200)]
d: Move call to set_linkage_for_decl to declare_extern_var.

This both prevents against it being called twice for declarations that
are defined, and fixes an issue where variables defined in the
compilation get one kind of linkage (weak), and the same variables
declared via declare_extern_var get another (extern).

gcc/d/ChangeLog:

PR d/99914
* decl.cc (DeclVisitor::visit (StructDeclaration *)): Don't set
DECL_INSTANTIATED on static initializer declarations.
(DeclVisitor::visit (ClassDeclaration *)): Likewise.
(DeclVisitor::visit (EnumDeclaration *)): Likewise.
(d_finish_decl): Move call to set_linkage_for_decl to...
(declare_extern_var): ...here.

3 years agod: Add TARGET_D_REGISTER_CPU_TARGET_INFO
Iain Buclaw [Mon, 5 Apr 2021 17:37:31 +0000 (19:37 +0200)]
d: Add TARGET_D_REGISTER_CPU_TARGET_INFO

This implements `__traits(getTargetInfo, "floatAbi")' for all targets
that have D support files.

gcc/ChangeLog:

* config/aarch64/aarch64-d.c (aarch64_d_handle_target_float_abi): New
function.
(aarch64_d_register_target_info): New function.
* config/aarch64/aarch64-protos.h (aarch64_d_register_target_info):
Declare.
* config/aarch64/aarch64.h (TARGET_D_REGISTER_CPU_TARGET_INFO):
Define.
* config/arm/arm-d.c (arm_d_handle_target_float_abi): New function.
(arm_d_register_target_info): New function.
* config/arm/arm-protos.h (arm_d_register_target_info): Declare.
* config/arm/arm.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/i386/i386-d.c (ix86_d_handle_target_float_abi): New function.
(ix86_d_register_target_info): New function.
* config/i386/i386-protos.h (ix86_d_register_target_info): Declare.
* config/i386/i386.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/mips/mips-d.c (mips_d_handle_target_float_abi): New function.
(mips_d_register_target_info): New function.
* config/mips/mips-protos.h (mips_d_register_target_info): Declare.
* config/mips/mips.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/pa/pa-d.c (pa_d_handle_target_float_abi): New function.
(pa_d_register_target_info): New function.
* config/pa/pa-protos.h (pa_d_register_target_info): Declare.
* config/pa/pa.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/riscv/riscv-d.c (riscv_d_handle_target_float_abi): New
function.
(riscv_d_register_target_info): New function.
* config/riscv/riscv-protos.h (riscv_d_register_target_info): Declare.
* config/riscv/riscv.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/rs6000/rs6000-d.c (rs6000_d_handle_target_float_abi): New
function.
(rs6000_d_register_target_info): New function.
* config/rs6000/rs6000-protos.h (rs6000_d_register_target_info):
Declare.
* config/rs6000/rs6000.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/s390/s390-d.c (s390_d_handle_target_float_abi): New function.
(s390_d_register_target_info): New function.
* config/s390/s390-protos.h (s390_d_register_target_info): Declare.
* config/s390/s390.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* config/sparc/sparc-d.c (sparc_d_handle_target_float_abi): New
function.
(sparc_d_register_target_info): New function.
* config/sparc/sparc-protos.h (sparc_d_register_target_info): Declare.
* config/sparc/sparc.h (TARGET_D_REGISTER_CPU_TARGET_INFO): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_REGISTER_CPU_TARGET_INFO.

gcc/d/ChangeLog:

* d-target.cc (Target::_init): Call new targetdm hook to register CPU
specific target info keys.
* d-target.def (d_register_cpu_target_info): New hook.

3 years agod: Add TARGET_D_HAS_STDCALL_CONVENTION
Iain Buclaw [Mon, 5 Apr 2021 16:46:18 +0000 (18:46 +0200)]
d: Add TARGET_D_HAS_STDCALL_CONVENTION

This replaces the use of the D front-end `is64bit' parameter in
determining whether to insert the "stdcall" function attribute.

It is also used to determine whether `extern(System)' should be the same
as `extern(Windows)' in the implementation of Target::systemLinkage.

gcc/ChangeLog:

* config/i386/i386-d.c (ix86_d_has_stdcall_convention): New function.
* config/i386/i386-protos.h (ix86_d_has_stdcall_convention): Declare.
* config/i386/i386.h (TARGET_D_HAS_STDCALL_CONVENTION): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_HAS_STDCALL_CONVENTION.

gcc/d/ChangeLog:

* d-target.cc (Target::systemLinkage): Return LINKwindows if
d_has_stdcall_convention applies to LINKsystem.
* d-target.def (d_has_stdcall_convention): New hook.
* types.cc (TypeVisitor::visit (TypeFunction *)): Insert "stdcall"
function attribute if d_has_stdcall_convention applies to LINKwindows.

3 years agoVEC_COND_EXPR verification adjustment
Richard Biener [Wed, 14 Apr 2021 08:26:33 +0000 (10:26 +0200)]
VEC_COND_EXPR verification adjustment

This adjusts GIMPLE verification with respect to the VEC_COND_EXPR
changes forcing a split out condition.

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

* tree-cfg.c (verify_gimple_assign_ternary): Verify that
VEC_COND_EXPRs have a gimple_val condition.
* tree-ssa-propagate.c (valid_gimple_rhs_p): VEC_COND_EXPR
can no longer have a GENERIC condition.

3 years agodocs: Remove empty table column.
Martin Liska [Mon, 12 Apr 2021 14:43:37 +0000 (16:43 +0200)]
docs: Remove empty table column.

gcc/fortran/ChangeLog:

* intrinsic.texi: The table has first column empty and it makes
trouble when processing makeinfo --xml output.

3 years agoarm: fix warning when -mcpu=neoverse-n1 is used with -mfpu=neon [PR100067]
Richard Earnshaw [Wed, 14 Apr 2021 09:56:36 +0000 (10:56 +0100)]
arm: fix warning when -mcpu=neoverse-n1 is used with -mfpu=neon [PR100067]

If the compiler is configured with --with-fpu=<!auto> (or invoked
with, say, -mfpu=neon), then specifying -mcpu=neoverse-n1 can lead to
an unexpected warning: cc1: warning: switch ‘-mcpu=neoverse-n1’
conflicts with ‘-march=armv8.2-a’ switch

The fix for this is to correctly remove all the feature bits relating
to simd/fp units when -mfpu is used, not just those bits that form
part of the -mfpu specification (which is a subset).

gcc:
PR target/100067
* config/arm/arm.c (arm_configure_build_target): Strip isa_all_fpbits
from the isa_delta when -mfpu has been used.
(arm_options_perform_arch_sanity_checks): It's the architecture that
lacks an FPU not the processor.

3 years agotestsuite: Fix up libgomp.fortran/alloc-1.F90 testcase [PR100071]
Jakub Jelinek [Wed, 14 Apr 2021 08:48:56 +0000 (10:48 +0200)]
testsuite: Fix up libgomp.fortran/alloc-1.F90 testcase [PR100071]

As can be seen under valgrind, the testcase didn't bind in the last part
the fortran pointers properly to the c pointers.

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

PR testsuite/100071
* testsuite/libgomp.fortran/alloc-1.F90: Call c_f_pointer after last
cp = omp_alloc with cp, p arguments instead of cq, q and call
c_f_pointer after last cq = omp_alloc with cq, q.

3 years agoc++: lambda in non-type template parm type [PR99478]
Jason Merrill [Wed, 14 Apr 2021 02:28:32 +0000 (22:28 -0400)]
c++: lambda in non-type template parm type [PR99478]

In this testcase, the non-type template parameter has the type of a
lambda-expression.  This makes no sense because a lambda in template context
is specified to be distinct between different specializations of the
template, even if the lambda is non-dependent, but here which specialization
we are dealing with depends on which lambda we have, and vice versa.

gcc/cp/ChangeLog:

PR c++/99478
* parser.c (cp_parser_lambda_expression): Reject lambda
in template parameter type.

gcc/testsuite/ChangeLog:

PR c++/99478
* g++.dg/cpp2a/lambda-uneval14.C: New test.

3 years agoc++: DWARF ICE with defaulted specialization [PR90674]
Jason Merrill [Wed, 14 Apr 2021 00:32:13 +0000 (20:32 -0400)]
c++: DWARF ICE with defaulted specialization [PR90674]

Here when we merged the specialization with the implicit instantiation
declaration, we wrongly kept the value of DECL_INITIALIZED_IN_CLASS_P from
the latter.

gcc/cp/ChangeLog:

PR c++/90674
* decl.c (duplicate_decls): Don't propagate
DECL_INITIALIZED_IN_CLASS_P to a specialization.

gcc/testsuite/ChangeLog:

PR c++/90674
* g++.dg/debug/defaulted1.C: New test.