platform/upstream/gcc.git
16 months agoRISC-V: Fix wrong vsetvli fusion for vmv.s.x
Ju-Zhe Zhong [Thu, 16 Mar 2023 08:55:42 +0000 (16:55 +0800)]
RISC-V: Fix wrong vsetvli fusion for vmv.s.x

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (reg_available_p): Fix bugs.
(pass_vsetvl::compute_local_backward_infos): Fix bugs.
(pass_vsetvl::need_vsetvl): Fix bugs.
(pass_vsetvl::backward_demand_fusion): Fix bugs.
(pass_vsetvl::demand_fusion): Fix bugs.
(eliminate_insn): Fix bugs.
(insert_vsetvl): Ditto.
(pass_vsetvl::emit_local_forward_vsetvls): Ditto.
* config/riscv/riscv-vsetvl.h (enum vsetvl_type): Ditto.
* config/riscv/vector.md: Ditto.

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/bug-10.C: New test.
* g++.target/riscv/rvv/base/bug-11.C: New test.
* g++.target/riscv/rvv/base/bug-12.C: New test.
* g++.target/riscv/rvv/base/bug-13.C: New test.
* g++.target/riscv/rvv/base/bug-14.C: New test.
* g++.target/riscv/rvv/base/bug-15.C: New test.
* g++.target/riscv/rvv/base/bug-16.C: New test.
* g++.target/riscv/rvv/base/bug-17.C: New test.
* g++.target/riscv/rvv/base/bug-2.C: New test.
* g++.target/riscv/rvv/base/bug-3.C: New test.
* g++.target/riscv/rvv/base/bug-4.C: New test.
* g++.target/riscv/rvv/base/bug-5.C: New test.
* g++.target/riscv/rvv/base/bug-6.C: New test.
* g++.target/riscv/rvv/base/bug-7.C: New test.
* g++.target/riscv/rvv/base/bug-8.C: New test.
* g++.target/riscv/rvv/base/bug-9.C: New test.

Signed-off-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Co-authored-by: kito-cheng <kito.cheng@sifive.com>
16 months agoRISC-V: Fix wrong RTL pattern for ternary instructions.
Ju-Zhe Zhong [Tue, 14 Mar 2023 02:23:31 +0000 (10:23 +0800)]
RISC-V: Fix wrong RTL pattern for ternary instructions.

We've wrong RTL pattern cause unexpected optimizaion result.

Give a example is vnmsub.vx pattern, the operation of vnmsub.vx
list below:

  vnmsub.vx vd, rs1, vs2, vm    # vd[i] = -(x[rs1] * vd[i]) + vs2[i]

But our RTL pattern write as (x[rs1] * vd[i]) - vs2[i], and the GCC try to
simplify when x[rs1] is constant 1, and then become a vd[i] - vs[i]
instruction.

We also revise all ternary instructions to make sure the RTL has right
semantic:

And it's the mapping list between instruction and RTL pattern:

interger:
vnmsac.vv vd, vs1, vs2, vm    # vd[i] = -(vs1[i] * vs2[i]) + vd[i]  (minus op3 (mult op1 op2))
vnmsac.vx vd, rs1, vs2, vm    # vd[i] = -(x[rs1] * vs2[i]) + vd[i]   (minus op3 (mult op1 op2))

floating-point:
vfmacc.vv vd, vs1, vs2, vm    # vd[i] = +(vs1[i] * vs2[i]) + vd[i] (plus (mult (op1 op2)) op3)
vfmacc.vf vd, rs1, vs2, vm    # vd[i] = +(f[rs1] * vs2[i]) + vd[i] (plus (mult (op1 op2)) op3)

vfnmacc.vv vd, vs1, vs2, vm   # vd[i] = -(vs1[i] * vs2[i]) - vd[i] (minus (neg (mult (op1 op2))) op3))
vfnmacc.vf vd, rs1, vs2, vm   # vd[i] = -(f[rs1] * vs2[i]) - vd[i] (minus (neg (mult (op1 op2)) op3))
vfmsac.vv vd, vs1, vs2, vm    # vd[i] = +(vs1[i] * vs2[i]) - vd[i] (minus (mult (op1 op2)) op3)
vfmsac.vf vd, rs1, vs2, vm    # vd[i] = +(f[rs1] * vs2[i]) - vd[i] (minus (mult (op1 op2)) op3)

vfnmsac.vv vd, vs1, vs2, vm   # vd[i] = -(vs1[i] * vs2[i]) + vd[i] (plus (neg:(mult (op1 op2))) op3)
vfnmsac.vf vd, rs1, vs2, vm   # vd[i] = -(f[rs1] * vs2[i]) + vd[i] (plus (neg:(mult (op1 op2))) op3)

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc: Fix ternary bug.
* config/riscv/vector-iterators.md (nmsac): Ditto.
(nmsub): Ditto.
(msac): Ditto.
(msub): Ditto.
(nmadd): Ditto.
(nmacc): Ditto.
* config/riscv/vector.md (@pred_mul_<optab><mode>): Ditto.
(@pred_mul_plus<mode>): Ditto.
(*pred_madd<mode>): Ditto.
(*pred_macc<mode>): Ditto.
(*pred_mul_plus<mode>): Ditto.
(@pred_mul_plus<mode>_scalar): Ditto.
(*pred_madd<mode>_scalar): Ditto.
(*pred_macc<mode>_scalar): Ditto.
(*pred_mul_plus<mode>_scalar): Ditto.
(*pred_madd<mode>_extended_scalar): Ditto.
(*pred_macc<mode>_extended_scalar): Ditto.
(*pred_mul_plus<mode>_extended_scalar): Ditto.
(@pred_minus_mul<mode>): Ditto.
(*pred_<madd_nmsub><mode>): Ditto.
(*pred_nmsub<mode>): Ditto.
(*pred_<macc_nmsac><mode>): Ditto.
(*pred_nmsac<mode>): Ditto.
(*pred_mul_<optab><mode>): Ditto.
(*pred_minus_mul<mode>): Ditto.
(@pred_mul_<optab><mode>_scalar): Ditto.
(@pred_minus_mul<mode>_scalar): Ditto.
(*pred_<madd_nmsub><mode>_scalar): Ditto.
(*pred_nmsub<mode>_scalar): Ditto.
(*pred_<macc_nmsac><mode>_scalar): Ditto.
(*pred_nmsac<mode>_scalar): Ditto.
(*pred_mul_<optab><mode>_scalar): Ditto.
(*pred_minus_mul<mode>_scalar): Ditto.
(*pred_<madd_nmsub><mode>_extended_scalar): Ditto.
(*pred_nmsub<mode>_extended_scalar): Ditto.
(*pred_<macc_nmsac><mode>_extended_scalar): Ditto.
(*pred_nmsac<mode>_extended_scalar): Ditto.
(*pred_mul_<optab><mode>_extended_scalar): Ditto.
(*pred_minus_mul<mode>_extended_scalar): Ditto.
(*pred_<madd_msub><mode>): Ditto.
(*pred_<macc_msac><mode>): Ditto.
(*pred_<madd_msub><mode>_scalar): Ditto.
(*pred_<macc_msac><mode>_scalar): Ditto.
(@pred_neg_mul_<optab><mode>): Ditto.
(@pred_mul_neg_<optab><mode>): Ditto.
(*pred_<nmadd_msub><mode>): Ditto.
(*pred_<nmsub_nmadd><mode>): Ditto.
(*pred_<nmacc_msac><mode>): Ditto.
(*pred_<nmsac_nmacc><mode>): Ditto.
(*pred_neg_mul_<optab><mode>): Ditto.
(*pred_mul_neg_<optab><mode>): Ditto.
(@pred_neg_mul_<optab><mode>_scalar): Ditto.
(@pred_mul_neg_<optab><mode>_scalar): Ditto.
(*pred_<nmadd_msub><mode>_scalar): Ditto.
(*pred_<nmsub_nmadd><mode>_scalar): Ditto.
(*pred_<nmacc_msac><mode>_scalar): Ditto.
(*pred_<nmsac_nmacc><mode>_scalar): Ditto.
(*pred_neg_mul_<optab><mode>_scalar): Ditto.
(*pred_mul_neg_<optab><mode>_scalar): Ditto.
(@pred_widen_neg_mul_<optab><mode>): Ditto.
(@pred_widen_mul_neg_<optab><mode>): Ditto.
(@pred_widen_neg_mul_<optab><mode>_scalar): Ditto.
(@pred_widen_mul_neg_<optab><mode>_scalar): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/bug-3.c: New test.
* gcc.target/riscv/rvv/base/bug-4.c: New test.
* gcc.target/riscv/rvv/base/bug-5.c: New test.

Signed-off-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Co-authored-by: kito-cheng <kito.cheng@sifive.com>
16 months agoRISC-V: Add riscv_vector target check
Kito Cheng [Wed, 22 Mar 2023 10:47:52 +0000 (18:47 +0800)]
RISC-V: Add riscv_vector target check

Add target check funciton to ensure vector extension can be used.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_riscv_vector):
New.

16 months agoRemove TARGET_GEN_MEMSET_SCRATCH_RTX since it's not used anymore.
liuhongt [Tue, 21 Mar 2023 08:47:25 +0000 (16:47 +0800)]
Remove TARGET_GEN_MEMSET_SCRATCH_RTX since it's not used anymore.

The target hook is only used by i386, and the current definition is
same as default gen_reg_rtx.

gcc/ChangeLog:

* builtins.cc (builtin_memset_read_str): Replace
targetm.gen_memset_scratch_rtx with gen_reg_rtx.
(builtin_memset_gen_str): Ditto.
* config/i386/i386-expand.cc
(ix86_convert_const_wide_int_to_broadcast): Replace
ix86_gen_scratch_sse_rtx with gen_reg_rtx.
(ix86_expand_vector_move): Ditto.
* config/i386/i386-protos.h (ix86_gen_scratch_sse_rtx):
Removed.
* config/i386/i386.cc (ix86_gen_scratch_sse_rtx): Removed.
(TARGET_GEN_MEMSET_SCRATCH_RTX): Removed.
* doc/tm.texi: Remove TARGET_GEN_MEMSET_SCRATCH_RTX.
* doc/tm.texi.in: Ditto.
* target.def: Ditto.

16 months agoDaily bump.
GCC Administrator [Thu, 23 Mar 2023 00:17:30 +0000 (00:17 +0000)]
Daily bump.

16 months agolibstdc++: Fix assigning nullptr to std::atomic<shared_ptr<T>> (LWG 3893)
Jonathan Wakely [Wed, 22 Mar 2023 21:54:24 +0000 (21:54 +0000)]
libstdc++: Fix assigning nullptr to std::atomic<shared_ptr<T>> (LWG 3893)

LWG voted this to Tentatively Ready recently.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (atomic::operator=(nullptr_t)):
Add overload, as per LWG 3893.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Check assignment from nullptr.

16 months agotestsuite: always use UTF-8 in scan-sarif-file[-not] [PR105959]
David Malcolm [Wed, 22 Mar 2023 20:48:27 +0000 (16:48 -0400)]
testsuite: always use UTF-8 in scan-sarif-file[-not] [PR105959]

c-c++-common/diagnostic-format-sarif-file-4.c is a test case for
quoting non-ASCII source code in a SARIF diagnostic log.

The SARIF standard mandates that .sarif files are UTF-8 encoded.

PR testsuite/105959 notes that the test case fails when the system
encoding is not UTF-8, such as when the "make" invocation is prefixed
with LC_ALL=C, whereas it works with in a UTF-8-locale.

The root cause is that dg-scan opens the file for reading using the
"system" encoding; I believe it is falling back to treating all files as
effectively ISO 8859-1 in a non-UTF-8 locale.

This patch fixes things by adding a mechanism to dg-scan to allow
callers to (optionally) specify an encoding to use when reading the
file, and updating scan-sarif-file (and the -not variant) to always
use UTF-8 when calling dg-scan, fixing the test case with LC_ALL=C.

gcc/testsuite/ChangeLog:
PR testsuite/105959
* gcc.dg-selftests/dg-final.exp
(dg_final_directive_check_num_args): Update expected maximum
number of args for the various directives using dg-scan.
* lib/scanasm.exp (append_encoding_arg): New procedure.
(dg-scan): Add optional 3rd argument: the encoding to use when
reading from the file.
* lib/scansarif.exp (scan-sarif-file): Treat the file as UTF-8
encoded when reading it.
(scan-sarif-file-not): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agocompiler: add missing Slice_info_expression::do_traverse
Ian Lance Taylor [Wed, 22 Mar 2023 04:34:03 +0000 (21:34 -0700)]
compiler: add missing Slice_info_expression::do_traverse

Fixes golang/go#59169

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

16 months agoc++: array bound partial ordering [PR108390]
Jason Merrill [Wed, 22 Mar 2023 15:12:57 +0000 (11:12 -0400)]
c++: array bound partial ordering [PR108390]

fold_convert doesn't work with a dependent argument, and problematically
differed from the corresponding fold+build_nop further down in the
function.  So change it to match.

PR c++/108390

gcc/cp/ChangeLog:

* pt.cc (unify): Use fold of build_nop instead of fold_convert.

gcc/testsuite/ChangeLog:

* g++.dg/template/partial-order3.C: New test.

16 months agoFortran: improve checking of FINAL subroutine arguments [PR104572]
Harald Anlauf [Wed, 22 Mar 2023 18:20:41 +0000 (19:20 +0100)]
Fortran: improve checking of FINAL subroutine arguments [PR104572]

gcc/fortran/ChangeLog:

PR fortran/104572
* resolve.cc (gfc_resolve_finalizers): Argument of a FINAL subroutine
cannot be an alternate return.

gcc/testsuite/ChangeLog:

PR fortran/104572
* gfortran.dg/pr104572.f90: New test.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
16 months agolibstdc++: Remove std::formatter<const charT[N], charT> specialization
Jonathan Wakely [Wed, 22 Mar 2023 13:01:07 +0000 (13:01 +0000)]
libstdc++: Remove std::formatter<const charT[N], charT> specialization

This was approved in Issaquah as LWG 3833.

libstdc++-v3/ChangeLog:

* include/std/format (formatter<const charT[N], charT>): Do not
define partial speclialization, as per LWG 3833.
* testsuite/std/format/formatter/requirements.cc: Check it.

16 months agolibstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792)
Jonathan Wakely [Wed, 22 Mar 2023 12:55:29 +0000 (12:55 +0000)]
libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792)

We actually defined this macro in <utility> at one point, but I removed
it in r10-7901-g2025db692e9ed1.

libstdc++-v3/ChangeLog:

* include/std/utility (__cpp_lib_constexpr_algorithms): Define,
as per LWG 3792.
* testsuite/20_util/exchange/constexpr.cc: Check for it.

16 months agolibstdc++: Add missing __cpp_lib_format macro to <version>
Jonathan Wakely [Wed, 22 Mar 2023 12:37:17 +0000 (12:37 +0000)]
libstdc++: Add missing __cpp_lib_format macro to <version>

libstdc++-v3/ChangeLog:

* include/std/version (__cpp_lib_format): Define.
* testsuite/std/format/functions/format.cc: Check it.

16 months agolibstdc++: Use rvalues in std::string::resize_and_overwrite (LWG 3645)
Jonathan Wakely [Wed, 22 Mar 2023 11:54:31 +0000 (11:54 +0000)]
libstdc++: Use rvalues in std::string::resize_and_overwrite (LWG 3645)

Previously the C++23 draft required that the callback arguments were
lvalues, which was overvable by the callback. LWG 3645 removes that
overspecification, so we can pass rvalues and the user can't modify
our local variables. I've used auto(p) to produce rvalues, which is only
supported since Clang 15, but I think that's OK for a C++23 feature.

While making this change I noticed that we weren't correctly enforcing
the requirement that the callback returns an integer-like type. Add
better assertions for the type and value.

libstdc++-v3/ChangeLog:

* include/bits/basic_string.tcc (basic_string::resize_and_overwrite):
Pass rvalues to the callback, as now allowed by LWG 3645.
Enforce preconditions on the return value.
* testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc:
Adjust.

16 months agolibstdc++: Add comment to <format> (LWG 3720)
Jonathan Wakely [Wed, 22 Mar 2023 11:42:11 +0000 (11:42 +0000)]
libstdc++: Add comment to <format> (LWG 3720)

libstdc++-v3/ChangeLog:

* include/std/format: Add a comment noting that the resolution
of LWG 3720 has been applied..

16 months agolibstdc++: Add allocator-extended constructors to std::match_results (LWG 2195)
Jonathan Wakely [Wed, 22 Mar 2023 11:36:06 +0000 (11:36 +0000)]
libstdc++: Add allocator-extended constructors to std::match_results (LWG 2195)

This was approved in Issaquah last month.

libstdc++-v3/ChangeLog:

* include/bits/regex.h (match_results): Add allocator-extended
copy and move constructors, as per LWG 2195.
* testsuite/28_regex/match_results/ctors/char/alloc.cc: New test.

16 months agolibstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600)
Jonathan Wakely [Wed, 22 Mar 2023 11:10:38 +0000 (11:10 +0000)]
libstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600)

As explained in LWG 3600, we never implemented a C++0x change that made
the copy constructor of std::istream_iterator defined as defaulted. That
would be an ABI break, so the resolution of LWG 3600 is to not require
it to be trivial, but just constexpr and conditionally noexcept. This
applies that resolution.

libstdc++-v3/ChangeLog:

* include/bits/stream_iterator.h (istream_iterator): Add
constexpr to copy constructor, as per LWG 3600.
* testsuite/24_iterators/istream_iterator/cons/constexpr.cc:
Check copy construction.

16 months agoLRA: Do not repeat inheritance and live range splitting in case of asm error
Vladimir N. Makarov [Wed, 22 Mar 2023 16:33:11 +0000 (12:33 -0400)]
LRA: Do not repeat inheritance and live range splitting in case of asm error

LRA was trying to do live range splitting again and again as there were
no enough regs for asm.  This patch solves the problem.

        PR target/109137

gcc/ChangeLog:

* lra.cc (lra): Do not repeat inheritance and live range splitting
when asm error is found.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr109137.c: New.

16 months agomodula2: Add cwd to include path. Include m2cor before m2pim.
Gaius Mulley [Wed, 22 Mar 2023 16:39:12 +0000 (16:39 +0000)]
modula2: Add cwd to include path.  Include m2cor before m2pim.

The driver should default to include the current working directory in the
module search path.  This patch adds . to the search path provided
-fm2-pathname has not been specified.  The patch also reorders the pim
libraries so that the m2cor directory is searched before m2pim.
Coroutine support is visible by default for both -fpim and -fiso
(from their respective SYSTEM modules).

gcc/m2/ChangeLog:

PR modula2/109248
* Make-lang.in (m2/pge-boot/%.o): Add CFLAGS and CXXFLAGS for C
and C++ compiles.
* gm2spec.cc (add_m2_I_path): Indentation.
(lang_specific_driver): New variable seen_pathname.
Detect -fm2-pathname.  If not seen then push_back_Ipath (".").
Change non iso library path to "m2cor,m2log,m2pim,m2iso".

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoc++: attribute on dtor in template [PR108795]
Jason Merrill [Tue, 21 Mar 2023 19:15:27 +0000 (15:15 -0400)]
c++: attribute on dtor in template [PR108795]

Since r7-2549 we were throwing away the explicit C:: when we found that ~C
has an attribute that we treat as making its type dependent.

PR c++/108795

gcc/cp/ChangeLog:

* semantics.cc (finish_id_expression_1): Check scope before
returning id_expression.

gcc/testsuite/ChangeLog:

* g++.dg/ext/attr-tsafe1.C: New test.

16 months agoc++: Avoid duplicate diagnostic calling unavailable function [PR109177]
Alex Coplan [Wed, 22 Mar 2023 15:20:49 +0000 (15:20 +0000)]
c++: Avoid duplicate diagnostic calling unavailable function [PR109177]

As the PR shows, we currently emit duplicate diagnostics for calls to
functions marked with __attribute__((unavailable)). This patch fixes
that.

gcc/cp/ChangeLog:

PR c++/109177
* call.cc (build_over_call): Use make_temp_override to suppress
both unavailable and deprecated warnings when calling
build_addr_func.

gcc/testsuite/ChangeLog:

PR c++/109177
* g++.dg/ext/pr109177.C: New test.

16 months agoanalyzer: fix false +ves from -Wanalyzer-deref-before-check due to inlining [PR109239]
David Malcolm [Wed, 22 Mar 2023 12:40:34 +0000 (08:40 -0400)]
analyzer: fix false +ves from -Wanalyzer-deref-before-check due to inlining [PR109239]

The patch has this effect on my integration tests of -fanalyzer:

  Comparison:
    GOOD: 129        (17.70% -> 17.92%)
     BAD: 600 -> 591 (-9)

which is purely due to improvements to -Wanalyzer-deref-before-check
on the Linux kernel:

  -Wanalyzer-deref-before-check:
    GOOD: 1        (4.55% -> 7.69%)
     BAD: 21 -> 12 (-9)
     Known false positives: 16 -> 10 (-6)
       linux-5.10.162: 7 -> 1 (-6)
     Suspected false positives: 3 -> 0 (-3)
       linux-5.10.162: 3 -> 0 (-3)

gcc/analyzer/ChangeLog:
PR analyzer/109239
* program-point.cc: Include "analyzer/inlining-iterator.h".
(program_point::effectively_intraprocedural_p): New function.
* program-point.h (program_point::effectively_intraprocedural_p):
New decl.
* sm-malloc.cc (deref_before_check::emit): Use it when rejecting
interprocedural cases, so that we reject interprocedural cases
that have become intraprocedural due to inlining.

gcc/testsuite/ChangeLog:
PR analyzer/109239
* gcc.dg/analyzer/deref-before-check-pr109239-linux-bus.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agoamdgcn: Add instruction patterns for complex number operations.
Andrew Jenner [Wed, 22 Mar 2023 11:12:49 +0000 (11:12 +0000)]
amdgcn: Add instruction patterns for complex number operations.

gcc/ChangeLog:

* config/gcn/gcn-protos.h (gcn_expand_dpp_swap_pairs_insn)
(gcn_expand_dpp_distribute_even_insn)
(gcn_expand_dpp_distribute_odd_insn): Declare.
* config/gcn/gcn-valu.md (@dpp_swap_pairs<mode>)
(@dpp_distribute_even<mode>, @dpp_distribute_odd<mode>)
(cmul<conj_op><mode>3, cml<addsub_as><mode>4, vec_addsub<mode>3)
(cadd<rot><mode>3, vec_fmaddsub<mode>4, vec_fmsubadd<mode>4)
(fms<mode>4<exec>, fms<mode>4_negop2<exec>, fms<mode>4)
(fms<mode>4_negop2): New patterns.
* config/gcn/gcn.cc (gcn_expand_dpp_swap_pairs_insn)
(gcn_expand_dpp_distribute_even_insn)
(gcn_expand_dpp_distribute_odd_insn): New functions.
* config/gcn/gcn.md: Add entries to unspec enum.

gcc/testsuite/ChangeLog:

* gcc.target/gcn/complex.c: New test.

16 months agoMAINTAINERS: Add myself as OpenMP and libgomp maintainer
Tobias Burnus [Wed, 22 Mar 2023 09:41:00 +0000 (10:41 +0100)]
MAINTAINERS: Add myself as OpenMP and libgomp maintainer

ChangeLog:
* MAINTAINERS: Add myself as OpenMP and libgomp maintainer.

16 months agofrange: Implement nan_state class [PR109008]
Aldy Hernandez [Wed, 8 Mar 2023 09:58:01 +0000 (10:58 +0100)]
frange: Implement nan_state class [PR109008]

This patch implements a nan_state class, that allows us to query or
pass around the NANness of an frange.  We can store +NAN, -NAN, +-NAN,
or not-a-NAN with it.

I tried to touch as little as possible, leaving other cleanups to the
next release.  For example, we should replace the m_*_nan fields in
frange with nan_state, and provide relevant accessors to nan_state
(isnan, etc).

PR tree-optimization/109008

gcc/ChangeLog:

* value-range.cc (frange::set): Add nan_state argument.
* value-range.h (class nan_state): New.
(frange::get_nan_state): New.

16 months agoconfigure: regenerate
Martin Liska [Wed, 22 Mar 2023 07:45:33 +0000 (08:45 +0100)]
configure: regenerate

gcc/ChangeLog:

* configure: Regenerate.

16 months agoPR modula2/107630 Remove M2LINK and remove some cross linking
Gaius Mulley [Wed, 22 Mar 2023 01:45:58 +0000 (01:45 +0000)]
PR modula2/107630 Remove M2LINK and remove some cross linking

Remove M2LINK.def.  Pass the user forced module initialization string as
a parameter to M2RTS.ConstructModules.  This patch allows
-fm2-whole-program to link successfully using dynamic libraries.

gcc/m2/ChangeLog:

PR modula2/107630
* Make-lang.in (m2/stage2/cc1gm2$(exeext)): Remove
m2/gm2-libs-boot/M2LINK.o.
(m2/stage1/cc1gm2$(exeext)): Ditto.
(GM2-LIBS-BOOT-DEFS): Remove M2LINK.def.
(GM2-LIBS-DEFS): Ditto.
(m2/mc-boot/$(SRC_PREFIX)%.o): Replace CXX_FLAGS with CXXFLAGS.
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
(m2/mc-boot/main.o): Ditto.
(mcflex.o): Add $(CFLAGS).
(m2/gm2-libs-boot/M2LINK.o): Remove rule.
* gm2-compiler/M2GCCDeclare.def (DeclareM2linkGlobals): Remove.
* gm2-compiler/M2GCCDeclare.mod: (M2LinkEntry): Remove.
(M2LinkIndex): Remove.
(DoVariableDeclaration): Remove initial and call to
AddEntryM2Link.
(AddEntryM2Link): Remove.
(GetEntryM2Link): Remove.
(DeclareM2linkGlobals): Remove.
(DetectM2LinkInitial): Remove.
(InitM2LinkModule): Remove.
* gm2-compiler/M2GenGCC.mod (CodeFinallyEnd): Remove call to
DeclareM2linkGlobals.
* gm2-compiler/M2Quads.mod (BuildM2InitFunction): Add extra
parameter containing runtime module override to ConstructModules.
* gm2-compiler/M2Scaffold.mod: Update comment describing
ConstructModules.
* gm2-gcc/m2decl.cc (m2decl_DeclareM2linkForcedModuleInitOrder):
Remove.
* gm2-libs-iso/M2RTS.def (ConstructModules): Add overrideliborder
parameter.
* gm2-libs-iso/M2RTS.mod: Add overrideliborder parameter.
* gm2-libs/M2Dependent.def (ConstructModules): Add overrideliborder
parameter.
* gm2-libs/M2Dependent.mod (ConstructModules): Add overrideliborder
parameter.
* gm2-libs/M2RTS.def (ConstructModules): Add overrideliborder parameter.
* gm2-libs/M2RTS.mod (ConstructModules): Add overrideliborder
parameter.
* gm2-libs/M2LINK.def: Removed.

libgm2/ChangeLog:

* libm2pim/Makefile.am (M2DEFS): Remove M2LINK.def.
* libm2pim/Makefile.in: Rebuild.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoDaily bump.
GCC Administrator [Wed, 22 Mar 2023 00:17:03 +0000 (00:17 +0000)]
Daily bump.

16 months agostor-layout: Set TYPE_TYPELESS_STORAGE consistently for type variants
Joseph Myers [Tue, 21 Mar 2023 22:35:49 +0000 (22:35 +0000)]
stor-layout: Set TYPE_TYPELESS_STORAGE consistently for type variants

I've observed an LTO wrong-code bug with a large testcase in GCC 12,
that results from TYPE_TYPELESS_STORAGE not being set consistently on
type variants.

Specifically, in the LTO stage of compilation, there is an aggregate
type passed to get_alias_set, whose TYPE_MAIN_VARIANT does not have
TYPE_TYPELESS_STORAGE set.  However, the TYPE_CANONICAL of that main
variant *does* have have TYPE_TYPELESS_STORAGE set; note that the use
of TYPE_CANONICAL in get_alias_set comes after the check of
TYPE_TYPELESS_STORAGE.  The effect is that when (one-argument)
record_component_aliases is called, the recursive call to
get_alias_set gives alias set 0, and the aggregate type ends up not
being considered to alias its members, with wrong-code consequences.

I haven't managed to produce a self-contained executable testcase to
demonstrate this, but it clearly seems appropriate for
TYPE_TYPELESS_STORAGE to be consistent on type variants, so this patch
makes it so, which appears to be sufficient to resolve the bug.  I've
attached a reduced test to
<https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614278.html>
that does at least demonstrate main-variant versions of a type (SB in
this test) being written out to LTO IR both with and without
TYPE_TYPELESS_STORAGE, although not the subsequent consequences of a
type without TYPE_TYPELESS_STORAGE with a TYPE_CANONICAL (as
constructed after LTO type merging) with TYPE_TYPELESS_STORAGE and
following wrong-code.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

* stor-layout.cc (finalize_type_size): Copy TYPE_TYPELESS_STORAGE
to variants.

16 months agolibstdc++: Use more precise __RECIPROCAL_MATH__ macro
Matthias Kretz [Tue, 21 Mar 2023 16:40:21 +0000 (17:40 +0100)]
libstdc++: Use more precise __RECIPROCAL_MATH__ macro

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_x86.h
(_SimdImplX86::_S_divides): Replace test for __GCC_IEC_559 == 0
with __RECIPROCAL_MATH__.

16 months agolibstdc++: Skip integer division optimization for Clang
Matthias Kretz [Tue, 21 Mar 2023 13:20:52 +0000 (14:20 +0100)]
libstdc++: Skip integer division optimization for Clang

Clang ICEs on _SimdImplX86::_S_divides. The function is only working
around a missed optimization and not necessary for correctness.
Therefore, don't use it for Clang.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_detail.h: Don't define
_GLIBCXX_SIMD_WORKAROUND_PR90993 for Clang.
* include/experimental/bits/simd_x86.h (_S_divides): Remove
check for __clang__.

16 months agoFortran: reject MODULE PROCEDURE outside generic module interface [PR99036]
Harald Anlauf [Tue, 21 Mar 2023 18:58:31 +0000 (19:58 +0100)]
Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036]

gcc/fortran/ChangeLog:

PR fortran/99036
* decl.cc (gfc_match_modproc): Reject MODULE PROCEDURE if not in a
generic module interface.

gcc/testsuite/ChangeLog:

PR fortran/99036
* gfortran.dg/pr99036.f90: New test.

16 months agolibstdc++: Fix simd compilation with Clang
Matthias Kretz [Thu, 23 Feb 2023 13:55:08 +0000 (14:55 +0100)]
libstdc++: Fix simd compilation with Clang

Clang fails to compile some constant expressions involving simd.
Therefore, just disable this non-conforming extension for clang.

Fix AVX512 blend implementation for Clang. It was converting the bitmask
to bool before, which is obviously wrong. Instead use a Clang builtin to
convert the bitmask to vector-mask before using a vector blend ?:. A
similar change is required for the masked unary implementation, because
the GCC builtins do not exist on Clang.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_detail.h: Don't declare the
simd API as constexpr with Clang.
* include/experimental/bits/simd_x86.h (__movm): New.
(_S_blend_avx512): Resolve FIXME. Implement blend using __movm
and ?:.
(_SimdImplX86::_S_masked_unary): Clang does not implement the
same builtins. Implement the function using __movm, ?:, and -
operators on vector_size types instead.

16 months agoc++: DMI in template with virtual base [PR106890]
Jason Merrill [Sat, 18 Mar 2023 12:27:26 +0000 (08:27 -0400)]
c++: DMI in template with virtual base [PR106890]

When parsing a default member init we just build a CONVERT_EXPR for
converting to a virtual base, and then expand that into the more complex
form when we actually use the DMI in a constructor.  But that wasn't working
for the template case where we are considering the conversion at the point
that the constructor needs the DMI instantiation, so it seemed like we were
in a constructor already.  And then when the other constructor tries to
reuse the instantiation, it sees uses of the first constructor's parameters,
and dies.  So ensure that we get the CONVERT_EXPR in this case, too.

PR c++/106890

gcc/cp/ChangeLog:

* init.cc (maybe_instantiate_nsdmi_init): Don't leave
current_function_decl set to a constructor.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/nsdmi-template25.C: New test.

16 months agoTerminate GORI calculations if a relation is not relevant.
Andrew MacLeod [Mon, 20 Mar 2023 20:11:12 +0000 (16:11 -0400)]
Terminate GORI calculations if a relation is not relevant.

We currently allow VARYING lhs GORI calculations to continue if there is
a relation present in the hope it will eventually better refine a result.
This adds a check that the relation is relevant to the outgoing range
calculation first.  If it is not relevant, stop calculating.

PR tree-optimization/109192
* gimple-range-gori.cc (gori_compute::compute_operand_range):
Terminate gori calculations if a relation is not relevant.
* value-relation.h (value_relation::set_relation): Allow
equality between op1 and op2 if they are the same.

16 months agotree-optimization/109219 - avoid looking at STMT_SLP_TYPE
Richard Biener [Tue, 21 Mar 2023 11:49:36 +0000 (12:49 +0100)]
tree-optimization/109219 - avoid looking at STMT_SLP_TYPE

The following avoids looking at STMT_SLP_TYPE apart from the only
place needing it - transform and analysis of non-SLP loop stmts.
In particular it doesn't have a reliable meaning on SLP representatives
which are also passed as stmt_vinfo to vectorizable_* routines.  The
proper way to check in those is to look for the slp_node argument
instead.

PR tree-optimization/109219
* tree-vect-loop.cc (vectorizable_reduction): Check
slp_node, not STMT_SLP_TYPE.
* tree-vect-stmts.cc (vectorizable_condition): Likewise.
* tree-vect-slp.cc (vect_slp_analyze_node_operations_1):
Remove assertion on STMT_SLP_TYPE.

* gcc.dg/torture/pr109219.c: New testcase.

16 months agotestsuite: Remove obsolete comments [PR108898]
Jakub Jelinek [Tue, 21 Mar 2023 12:42:51 +0000 (13:42 +0100)]
testsuite: Remove obsolete comments [PR108898]

On Tue, Mar 21, 2023 at 12:35:19PM +0000, Andrew Stubbs wrote:
> >   /* Ensure the the in-branch simd clones are used on targets that support them.
> >      Some targets use another call for the epilogue loops.  */
> > -/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { ! aarch64*-*-* } } } } */
> > -/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 3 "vect" { target aarch64*-*-* } } } */
> > +/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" } } */
>
> I suppose those comments are now obsolete.

Oops, fixed thusly.

2023-03-21  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/108898
* gcc.dg/vect/vect-simd-clone-16.c: Remove parts of comment mentioning
epilogue loops.
* gcc.dg/vect/vect-simd-clone-17.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18.c: Likewise.

16 months agotestsuite: Fix up vect-simd-clone1[678]*.c tests [PR108898]
Jakub Jelinek [Tue, 21 Mar 2023 12:28:50 +0000 (13:28 +0100)]
testsuite: Fix up vect-simd-clone1[678]*.c tests [PR108898]

As mentioned in the PR, vect-simd-clone-1[678]{,f}.c tests FAIL on
x86_64-linux with -m64/-march=cascadelake or -m32/-march=cascadelake,
there are 3 matches for the calls rather than expected two.
As suggested by Richi, this patch changes those tests to use
--param vect-epilogues-nomask=0 such that it is more predictable on how
many calls will show up.  In the non-[a-f] suffixed tests, the
scan-tree-dump-times patterns were expecting 2 for non-aarch64 and 3 for
aarch64, which is a puzzle for me, because vect_simd_clones effective
target is apparently never true on aarch64 (just on x86 in some cases and
on amdgcn; perhaps something to change for GCC14, but I guess too late
for stage4).  That said, I have looked at aarch64 dumps and see only 2
calls with --param vect-epilogues-nomask=0 and 3 with --param
vect-epilogues-nomask=1 or without it, so I have tweaked those to always
expect the same thing.  Another thing is some tests uselessly had
-fdump-tree-optimized in dg-options even when they don't scan anything
there.

Tested on x86_64-linux with
make -j32 -k check-gcc RUNTESTFLAGS="vect.exp=gcc.dg/vect/vect-simd-clone-*.c \
--target_board='unix{-m64/-march=x86-64,-m64/-march=cascadelake,-m32/-march=i686,-m32/-march=cascadelake}'"
and aarch64-linux (where all tests are UNSUPPORTED before/after).

2023-03-21  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/108898
* gcc.dg/vect/vect-simd-clone-16.c: Add --param vect-epilogues-nomask=0
to dg-additional-options.  Always expect just 2 foo.simdclone calls.
* gcc.dg/vect/vect-simd-clone-16f.c: Add
--param vect-epilogues-nomask=0 to dg-additional-options.
* gcc.dg/vect/vect-simd-clone-17.c: Likewise.  Always expect just 2
foo.simdclone calls.
* gcc.dg/vect/vect-simd-clone-17d.c: Remove -fdump-tree-optimized from
dg-additional-options.
* gcc.dg/vect/vect-simd-clone-17e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.  Add
--param vect-epilogues-nomask=0 to dg-additional-options.
* gcc.dg/vect/vect-simd-clone-18.c: Add --param vect-epilogues-nomask=0
to dg-additional-options.  Always expect just 2 foo.simdclone calls.
* gcc.dg/vect/vect-simd-clone-18f.c: Add
--param vect-epilogues-nomask=0 to dg-additional-options.

16 months agolibstdc++: Fix simd test compilation with Clang
Matthias Kretz [Thu, 23 Feb 2023 13:45:07 +0000 (14:45 +0100)]
libstdc++: Fix simd test compilation with Clang

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* testsuite/experimental/simd/tests/operators.cc: Clang doesn't
define __GCC_IEC_559. Use __STDC_IEC_559__ instead.

16 months agotree: Fix up component_ref_sam_type handling of arrays of 0 sized elements [PR109215]
Jakub Jelinek [Tue, 21 Mar 2023 10:06:20 +0000 (11:06 +0100)]
tree: Fix up component_ref_sam_type handling of arrays of 0 sized elements [PR109215]

Our documentation sadly talks about elt_type arr[0]; as zero-length arrays,
not arrays with zero elements.  Unfortunately, those aren't the only arrays
which can have zero size, the same size can be also result of zero-length
element, like in GNU C struct whatever {} or in GNU C/C++ if the element
type is [0] array or combination thereof (dunno if Ada doesn't allow
something similar too).  One can't do much with them, taking address of
their elements, (no-op) copying of the elements in and out.  But they
behave differently from arr[0] arrays e.g. in that using non-zero indexes
in them (as long as they are within bounds as for normal arrays) is valid.

I think this naming inaccuracy resulted in Martin designing
special_array_member in an inconsistent way, mixing size zero array members
with array members of one or two or more elements and then using the
size zero interchangeably with zero elements.

The following patch changes that (but doesn't do any
documentation/diagnostics renaming, as this is really a corner case),
such that int_0/trail_0 for consistency is just about [0] arrays
plus [] for the latter, not one or more zero sized elements case.

The testcase has one xfailed case for where perhaps in later GCC versions
we could add extra code to handle it, for some reason we don't diagnose
out of bounds accesses for the zero sized elements cases.  It will be
harder because e.g. FRE will canonicalize &var.fld[0] and &var.fld[10]
to just one of them because they are provably the same address.
But the important thing is to fix this regression (where we warn on
completely valid code in the Linux kernel).  Anyway, for further work
on this we don't really need any extra help from special_array_member,
all code can just check integer_zerop (TYPE_SIZE_UNIT (TREE_TYPE (type))),
it doesn't depend on the position of the members etc.

2023-03-21  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109215
* tree.h (enum special_array_member): Adjust comments for int_0
and trail_0.
* tree.cc (component_ref_sam_type): Clear zero_elts if memtype
has zero sized element type and the array has variable number of
elements or constant one or more elements.
(component_ref_size): Adjust comments, formatting fix.

* gcc.dg/Wzero-length-array-bounds-3.c: New test.

16 months agohtml: Set CONTENTS_OUTPUT_LOCATION=inline if makeinfo supports it
Arsen Arsenović [Thu, 9 Mar 2023 20:44:29 +0000 (21:44 +0100)]
html: Set CONTENTS_OUTPUT_LOCATION=inline if makeinfo supports it

This flag allows us to restore old (pre-6.8) behavior of the
@{summary,}content commands, so that texi2any continues to emit
summarycontents first.

maintainer-scripts/ChangeLog:

* update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
order to put @shortcontents above contents.

gcc/ChangeLog:

* configure.ac: Add check for the Texinfo 6.8
CONTENTS_OUTPUT_LOCATION customization variable and set it if
supported.
* configure: Regenerate.
* Makefile.in (MAKEINFO_TOC_INLINE_FLAG): New variable.  Set by
configure.ac to -c CONTENTS_OUTPUT_LOCATION=inline if
CONTENTS_OUTPUT_LOCATION support is detected, empty otherwise.
($(build_htmldir)/%/index.html): Pass MAKEINFO_TOC_INLINE_FLAG.

16 months agodocs: Fix up new instances of index reordering
Arsen Arsenović [Tue, 28 Feb 2023 10:40:56 +0000 (11:40 +0100)]
docs: Fix up new instances of index reordering

This commit fixes up an instance of the index entry mis-ordering that
occurred between the formulation and application of commit
r13-6310-gf33d7a88d069d1.

gcc/ChangeLog:

* doc/extend.texi: Associate use_hazard_barrier_return index
entry with its attribute.
* doc/invoke.texi: Associate -fcanon-prefix-map index entry with
its attribute

16 months agoupdate_web_docs_git: Update CSS reference to new manual CSS
Arsen Arsenović [Thu, 26 Jan 2023 17:50:38 +0000 (18:50 +0100)]
update_web_docs_git: Update CSS reference to new manual CSS

maintainer-scripts/ChangeLog:

* update_web_docs_git (CSS): Update CSS reference to point to
/texinfo-manuals.css.

16 months agodoc: Remove the @gol macro/alias
Arsen Arsenović [Wed, 25 Jan 2023 22:33:03 +0000 (23:33 +0100)]
doc: Remove the @gol macro/alias

The @gol macro appears to have existed as a workaround for a bug in old
versions of makeinfo and/or texinfo.tex, where they would, in some types
of output, fail to emit line breaks in @gccoptlists.  After updating
texinfo.tex, I noticed that this behavior appears to no longer be
exhibited, instead, both acted correctly and inserted newlines.  The
(groff) manual output also appears unaffected.

gcc/ChangeLog:

* doc/implement-c.texi: Remove usage of @gol.
* doc/invoke.texi: Ditto.
* doc/sourcebuild.texi: Ditto.
* doc/include/gcc-common.texi: Remove @gol.  In new Makeinfo and
texinfo.tex versions, the bug it was working around appears to
be gone.

gcc/fortran/ChangeLog:

* invoke.texi: Remove usages of @gol.
* intrinsic.texi: Ditto.

16 months agodoc: Update texinfo.tex
Arsen Arsenović [Fri, 10 Mar 2023 15:21:33 +0000 (16:21 +0100)]
doc: Update texinfo.tex

gcc/ChangeLog:

* doc/include/texinfo.tex: Update to 2023-01-17.19.

16 months agodocs: Add @defbuiltin family of helpers
Arsen Arsenović [Fri, 10 Mar 2023 15:13:28 +0000 (16:13 +0100)]
docs: Add @defbuiltin family of helpers

The @defbuiltin{,x} macros are convenience macros for the often-repeated
task of defining a built-in function in extend.texi.  Usage of this
macro should lead to a higher degree of consistency across pieces of
text written by different people, and provide a better reading
experience, as they prevent easy-to-make errors, like forgetting index
entries for these functions.

gcc/ChangeLog:

* doc/include/gcc-common.texi: Add @defbuiltin{,x} and
@enddefbuiltin for defining built-in functions.
* doc/extend.texi: Apply @defbuiltin{,x} to many, but not all,
places where it should be used.

16 months agodoc: Fix a few minor errors spotted by testers
Arsen Arsenović [Fri, 10 Mar 2023 15:08:19 +0000 (16:08 +0100)]
doc: Fix a few minor errors spotted by testers

This commit addresses a few minor errors that were spotted while testing
the GCC manual with a few people, and while working on wider changes.

gcc/ChangeLog:

* doc/extend.texi (Formatted Output Function Checking): New
subsection for  grouping together printf et al.
(Exception handling) Fix missing @ sign before copyright
header, which lead to the copyright line leaking into
'(gcc)Exception handling'.
* doc/gcc.texi: Set document language to en_US.
(@copying): Wrap front cover texts in quotations, move in manual
description text.

16 months agodocs: Create Indices appendix
Arsen Arsenović [Sun, 20 Nov 2022 16:57:46 +0000 (17:57 +0100)]
docs: Create Indices appendix

The GCC manual has multiple indices.  By creating an appendix which
lists them, we help makeinfo present a more accessible way for the
reader to see all the indices.

gcc/ChangeLog:

* doc/gcc.texi: Add the Indices appendix, to make texinfo
generate nice indices overview page.

16 months agotree-optimization/109170 - bogus use-after-free with __builtin_expect
Richard Biener [Fri, 17 Mar 2023 12:14:49 +0000 (13:14 +0100)]
tree-optimization/109170 - bogus use-after-free with __builtin_expect

The following adds a missing range-op for __builtin_expect which
helps -Wuse-after-free to detect the case a realloc original
pointer is used when the result was NULL.  The implementation
should handle all argument one pass-through builtins we handle
in the fnspec machinery, but that's defered to GCC 14.

The gcc.dg/tree-ssa/ssa-lim-21.c testcase needs adjustment because

   for (int j = 0; j < m; j++)
     if (__builtin_expect (m, 0))
       for (int i = 0; i < m; i++)

is now correctly optimized to a unconditional jump by EVRP - m
cannot be zero when the outer loop is entered.  I've adjusted
the outer loop to iterate 'n' times which makes us apply store-motion
to 'count' and 'q->data1' but only out of the inner loop and
as expected not apply store motion to 'q->data' at all.

The gcc.dg/predict-20.c testcase relies on broken behavior of
profile estimation when trying to handle __builtin_expect values
flowing into PHI nodes.  I have opened PR109210 and removed
the expected matching from the testcase.

PR tree-optimization/109170
* gimple-range-op.cc (cfn_pass_through_arg1): New.
(gimple_range_op_handler::maybe_builtin_call): Handle
__builtin_expect via cfn_pass_through_arg1.

* gcc.dg/Wuse-after-free-pr109170.c: New testcase.
* gcc.dg/tree-ssa/ssa-lim-21.c: Adjust.
* gcc.dg/predict-20.c: Likewise.

16 months agoFortran: Fix regression caused by PR37336 patch [PR109206]
Paul Thomas [Tue, 21 Mar 2023 06:28:07 +0000 (06:28 +0000)]
Fortran: Fix regression caused by PR37336 patch [PR109206]

2023-03-21  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/109206
* trans-array.cc (gfc_trans_array_constructor_value): Correct
incorrect setting of typespec.

16 months agoFortran: Fix regression caused by PR37336 patch [PR109209]
Paul Thomas [Tue, 21 Mar 2023 06:22:37 +0000 (06:22 +0000)]
Fortran: Fix regression caused by PR37336 patch [PR109209]

2023-03-21  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/109209
* resolve.cc (generate_component_assignments): Restore the
exclusion of allocatable components from the loop.

gcc/testsuite/
PR fortran/109209
* gfortran.dg/pr109209.f90: New test.

16 months ago[modula2] Add $(CXX_FLAGS) to the bootstrap tool rules.
Gaius Mulley [Tue, 21 Mar 2023 00:30:56 +0000 (00:30 +0000)]
[modula2] Add $(CXX_FLAGS) to the bootstrap tool rules.

The bootstrap tool mc is built using $(CXX) and it is missing
$(CXXFLAGS).

gcc/m2/ChangeLog:

* Make-lang.in (m2/mc-boot/$(SRC_PREFIX)%.o): Add $(CXXFLAGS).
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Add $(CXXFLAGS).
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Add $(CXXFLAGS).
(m2/mc-boot/main.o): Add $(CXXFLAGS).

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoDaily bump.
GCC Administrator [Tue, 21 Mar 2023 00:17:02 +0000 (00:17 +0000)]
Daily bump.

16 months agolibstdc++: Fix formatting in std::filesystem helper function
Jonathan Wakely [Mon, 20 Mar 2023 13:40:59 +0000 (13:40 +0000)]
libstdc++: Fix formatting in std::filesystem helper function

libstdc++-v3/ChangeLog:

* src/filesystem/ops-common.h (get_temp_directory_from_env): Fix
formatting.

16 months agoUpdate gcc sv.po
Joseph Myers [Mon, 20 Mar 2023 22:47:39 +0000 (22:47 +0000)]
Update gcc sv.po

* sv.po: Update.

16 months agoFortran: fix documentation of -fno-underscoring [PR109216]
Harald Anlauf [Mon, 20 Mar 2023 19:55:00 +0000 (20:55 +0100)]
Fortran: fix documentation of -fno-underscoring [PR109216]

gcc/fortran/ChangeLog:

PR fortran/109216
* invoke.texi: Correct documentation of how underscores are appended
to external names.

16 months agoc++: explicit ctor and list-initialization [PR109159]
Marek Polacek [Fri, 17 Mar 2023 22:25:13 +0000 (18:25 -0400)]
c++: explicit ctor and list-initialization [PR109159]

When I implemented explicit(bool) in r9-3735, I added this code to
add_template_candidate_real:
+  /* Now the explicit specifier might have been deduced; check if this
+     declaration is explicit.  If it is and we're ignoring non-converting
+     constructors, don't add this function to the set of candidates.  */
+  if ((flags & LOOKUP_ONLYCONVERTING) && DECL_NONCONVERTING_P (fn))
+    return NULL;
but as this test demonstrates, that's incorrect when we're initializing
from a {}: for list-initialization we consider explicit constructors and
complain if one is chosen.

PR c++/109159

gcc/cp/ChangeLog:

* call.cc (add_template_candidate_real): Add explicit decls to the
set of candidates when the initializer is a braced-init-list.

libstdc++-v3/ChangeLog:

* testsuite/20_util/pair/cons/explicit_construct.cc: Adjust dg-error.
* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.
* testsuite/23_containers/span/explicit.cc: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/explicit16.C: New test.

16 months agoc++: Drop TREE_READONLY on vars (possibly) initialized by tls wrapper [PR109164]
Jakub Jelinek [Mon, 20 Mar 2023 19:29:47 +0000 (20:29 +0100)]
c++: Drop TREE_READONLY on vars (possibly) initialized by tls wrapper [PR109164]

The following two testcases are miscompiled, because we keep TREE_READONLY
on the vars even when they are (possibly) dynamically initialized by a TLS
wrapper function.  Normally cp_finish_decl drops TREE_READONLY from vars
which need dynamic initialization, but for TLS we do this kind of
initialization upon every access to those variables.  Keeping them
TREE_READONLY means e.g. PRE can hoist loads from those before loops
which contain the TLS wrapper calls, so we can access the TLS variables
before they are initialized.

2023-03-20  Jakub Jelinek  <jakub@redhat.com>

PR c++/109164
* cp-tree.h (var_needs_tls_wrapper): Declare.
* decl2.cc (var_needs_tls_wrapper): No longer static.
* decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
for which a TLS wrapper will be needed.

* g++.dg/tls/thread_local13.C: New test.
* g++.dg/tls/thread_local13-aux.cc: New file.
* g++.dg/tls/thread_local14.C: New test.
* g++.dg/tls/thread_local14-aux.cc: New file.

16 months agoRework 128-bit complex multiply and divide.
Michael Meissner [Mon, 20 Mar 2023 18:48:06 +0000 (14:48 -0400)]
Rework 128-bit complex multiply and divide.

This patch reworks how the complex multiply and divide built-in functions are
done.  Previously GCC created built-in declarations for doing long double complex
multiply and divide when long double is IEEE 128-bit.  However, it did not
support __ibm128 complex multiply and divide if long double is IEEE 128-bit.

This code does not create the built-in declaration with the changed name.
Instead, it uses the TARGET_MANGLE_DECL_ASSEMBLER_NAME hook to change the name
before it is written out to the assembler file like it now does for all of the
other long double built-in functions.

2023-03-20   Michael Meissner  <meissner@linux.ibm.com>

gcc/

PR target/109067
* config/rs6000/rs6000.cc (create_complex_muldiv): Delete.
(init_float128_ieee): Delete code to switch complex multiply and divide
for long double.
(complex_multiply_builtin_code): New helper function.
(complex_divide_builtin_code): Likewise.
(rs6000_mangle_decl_assembler_name): Add support for mangling the name
of complex 128-bit multiply and divide built-in functions.

gcc/testsuite/

PR target/109067
* gcc.target/powerpc/divic3-1.c: New test.
* gcc.target/powerpc/divic3-2.c: Likewise.
* gcc.target/powerpc/mulic3-1.c: Likewise.
* gcc.target/powerpc/mulic3-2.c: Likewise.

16 months agoFortran: simplification of NEAREST for large argument [PR109186]
Harald Anlauf [Sun, 19 Mar 2023 20:29:46 +0000 (21:29 +0100)]
Fortran: simplification of NEAREST for large argument [PR109186]

gcc/fortran/ChangeLog:

PR fortran/109186
* simplify.cc (gfc_simplify_nearest): Fix off-by-one error in setting
up real kind-specific maximum exponent for mpfr.

gcc/testsuite/ChangeLog:

PR fortran/109186
* gfortran.dg/nearest_6.f90: New test.

16 months agors6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
Peter Bergner [Mon, 20 Mar 2023 14:12:47 +0000 (09:12 -0500)]
rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]

When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
for the MEM operand which causes an unrecognizable insn ICE.  The solution
is to use the correct TMODE mode.

2023-03-20  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/109178
* config/rs6000/rs6000-builtin.cc (stv_expand_builtin): Use tmode.

gcc/testsuite/
PR target/109178
* gcc.target/powerpc/pr109178.c: New test.

16 months agotestsuite: Fix up 20230313.C test
Jakub Jelinek [Mon, 20 Mar 2023 11:38:43 +0000 (12:38 +0100)]
testsuite: Fix up 20230313.C test

I've noticed this testcase FAILs on i686-linux with
-fstack-protector-strong.

sizeof (auto_vec<int, 8>) == 16, which in this case contains
4-byte m_vec (which points to to m_auto), then 8-byte m_auto
which contains just 8-byte m_vecpfx and finally 1 byte m_data,
rest is padding.  We then try to push 2 ints to it, so 8 bytes,
starting at the end of m_vecpfx aka address of m_data, but there
is just 1 byte + 3 bytes of padding.
In the lp64 case, I think sizeof (auto_vec<int, 8>) == 24,
because there is 8-byte m_vec, 8-byte m_vecpfx and 1-byte m_char
all with 8-byte alignment.

2023-03-20  Jakub Jelinek  <jakub@redhat.com>

* g++.dg/torture/20230313.C (auto_vec): Change m_data type
from char to char [2 * sizeof (int)].

16 months agolibstdc++: Remove template-head from std::expected<void> ctor [PR109182]
Jonathan Wakely [Mon, 20 Mar 2023 09:30:58 +0000 (09:30 +0000)]
libstdc++: Remove template-head from std::expected<void> ctor [PR109182]

The presence of a template-head on this constructor is a copy & paste
error from the primary template.

libstdc++-v3/ChangeLog:

PR libstdc++/109182
* include/std/expected (expected<void>::expected(in_place_t)):
Remove template-head.

16 months agoFortran: Allow external function from in an associate block [PR87127]
Paul Thomas [Mon, 20 Mar 2023 06:13:54 +0000 (06:13 +0000)]
Fortran: Allow external function from in an associate block [PR87127]

2023-03-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/87127
* resolve.cc (check_host_association): If an external function
is typed but not declared explicitly to be external, change the
old symbol from a variable to an external function.

gcc/testsuite/
PR fortran/87127
* gfortran.dg/external_procedures_4.f90: New test.

16 months agoDaily bump.
GCC Administrator [Mon, 20 Mar 2023 00:17:08 +0000 (00:17 +0000)]
Daily bump.

16 months agoFortran: procedures with BIND(C) attribute require explicit interface [PR85877]
Harald Anlauf [Fri, 17 Mar 2023 21:24:49 +0000 (22:24 +0100)]
Fortran: procedures with BIND(C) attribute require explicit interface [PR85877]

gcc/fortran/ChangeLog:

PR fortran/85877
* resolve.cc (resolve_fl_procedure): Check for an explicit interface
of procedures with the BIND(C) attribute (F2018:15.4.2.2).

gcc/testsuite/ChangeLog:

PR fortran/85877
* gfortran.dg/pr85877.f90: New test.

16 months agoMention undefined behavior on integer overflow.
Thomas Koenig [Sun, 19 Mar 2023 17:34:38 +0000 (18:34 +0100)]
Mention undefined behavior on integer overflow.

gcc/fortran/ChangeLog:

* gfortran.texi: Mention behavior on overflow.

16 months agoRe: [PATCH] Testsuite: Disable micromips for MSA tests
Xin Liu [Sun, 19 Mar 2023 17:28:07 +0000 (13:28 -0400)]
Re: [PATCH] Testsuite: Disable micromips for MSA tests

gcc/testsuite
* gcc.target/mips/mips.exp (mips-dg-options): Disable micromips
for MSA tests.

16 months ago[modula2] target independent doc and tools rebuilt
Gaius Mulley [Sun, 19 Mar 2023 13:06:53 +0000 (13:06 +0000)]
[modula2] target independent doc and tools rebuilt

The target independent documentation needs to be rebuilt together with the
bootstrap tools after the library changes and after the <* noreturn *>
attribute has been implemented.

gcc/m2/ChangeLog:

* Make-maintainer.in (gm2.maintainer-clean): Remove.
(gm2.maintainer-help): Add gm2.maintainer-tools,
gm2.maintainer-doc.  Remove gm2.maintainer-clean.
Change target-independent directory to target-independent/m2.
* gm2-compiler/ppg.mod: Correct __FILE_ typo to __FILE__.
* gm2-compiler/M2Options.def (SetAutoInit): Update comment.
* gm2-compiler/M2Options.mod (SetAutoInit): Update comment.
* gm2-gcc/m2color.cc (m2color_colorize_start): Rename name_len
to _name_high.
* gm2-gcc/m2color.def (colorize_start): change ARRAY OF CHAR to
ADDRESS and add _name_high.
* gm2-gcc/m2decl.cc (m2decl_BuildStartFunctionDeclaration): Change
int to bool.
* gm2-gcc/m2decl.h (m2decl_BuildStartFunctionDeclaration): Change
int to bool.
* gm2-gcc/m2expr.cc (m2expr_BuildBinarySetDo): Change int to bool.
(m2expr_BuildIfConstInVar): Change int to bool.
(m2expr_BuildIfNotConstInVar): Change int to bool.
(m2expr_BuildIfVarInVar): Change int to bool.
(m2expr_BuildIfNotVarInVar): Change int to bool.
(m2expr_BuildForeachWordInSetDoIfExpr): Change int to bool.
* gm2-gcc/m2expr.h (m2expr_BuildIfNotVarInVar): Change int to bool.
(m2expr_BuildIfVarInVar): Change int to bool.
(m2expr_BuildIfNotConstInVar): Change int to bool.
(m2expr_BuildIfConstInVar): Change int to bool.
* gm2-gcc/m2options.h (M2Options_SetAutoInit): Change int to bool.
(M2Options_SetNilCheck): Change int to bool.
(M2Options_SetReturnCheck): Change int to bool.
(M2Options_SetCaseCheck): Change int to bool.
(M2Options_SetCheckAll): Change int to bool.
(M2Options_SetVerboseUnbounded): Change int to bool.
(M2Options_SetUnboundedByReference): Change int to bool.
(M2Options_SetOptimizing): Change int to bool.
(M2Options_SetQuiet): Change int to bool.
(M2Options_SetCpp): Change int to bool.
(M2Options_SetM2g): Change int to bool.
(M2Options_SetLowerCaseKeywords): Change int to bool.
(M2Options_SetVerbose): Change int to bool.
* gm2-gcc/m2treelib.cc (m2treelib_get_rvalue): Change int to bool.
(m2treelib_get_field_no): Change int to bool.
(m2treelib_get_set_value): Change int to bool.
(m2treelib_get_set_address): Change int to bool.
(m2treelib_get_set_address_if_var): Change int to bool.
* gm2-gcc/m2treelib.def (get_set_address_if_var): Change int to bool.
(get_set_address): Change int to bool.
(get_set_value): Change int to bool.
(get_field_no): Change int to bool.
(get_rvalue): Change int to bool.
* gm2-gcc/m2treelib.h (m2treelib_get_field_no): Change int to bool.
(m2treelib_get_set_value): Change int to bool.
(m2treelib_get_set_address): Change int to bool.
(m2treelib_get_set_address_if_var): Change int to bool.
* gm2-gcc/m2type.cc (m2type_BuildEndFunctionType): Change int to bool.
* gm2-gcc/m2type.h (m2type_BuildEndFunctionType): Change int to bool.
* gm2-libs-ch/dtoa.cc (dtoa_calcsign): Change int to bool.
* gm2-libs-ch/ldtoa.cc (dtoa_calcsign): Change int to bool.
(ldtoa_ldtoa): Change int to bool.
* m2.flex (functionInfo): Change int to bool.
(pushFunction): Change parameter from int to bool.
* mc-boot/GDebug.cc (Debug_Halt): Rebuild.
* mc-boot/GDebug.h (Debug_Halt): Rebuild.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GDynamicStrings.h: Rebuild.
* mc-boot/GFIO.cc: Rebuild.
* mc-boot/GM2RTS.cc: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GPushBackInput.cc: Rebuild.
* mc-boot/GRTExceptions.cc: Rebuild.
* mc-boot/GRTint.cc: Rebuild.
* mc-boot/GSysStorage.cc: Rebuild.
* mc-boot/Gdecl.cc: Rebuild.
* mc-boot/GsymbolKey.cc: Rebuild.
* mc/symbolKey.mod: Rebuild.
* target-independent/m2/Builtins.texi: Rebuild.
* target-independent/m2/SYSTEM-iso.texi: Rebuild.
* target-independent/m2/SYSTEM-pim.texi: Rebuild.
* target-independent/m2/gm2-libs.texi: Rebuild.
* tools-src/def2doc.py (PIM_Log): Change gm2-libs-pim to
gm2-lib-log.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoor1k: Do not clear existing FPU exceptions before updating
Stafford Horne [Sat, 18 Mar 2023 07:43:05 +0000 (16:43 +0900)]
or1k: Do not clear existing FPU exceptions before updating

We should always carry the exceptions forward.  This bug was found when
working on testing glibc math tests, many tests were failing with
Overflow and Underflow flags not set.  This was traced to here.

libgcc/ChangeLog:

* config/or1k/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Remove
statement clearing existing exceptions.

16 months agoDocs: correct typo in nonnull function attribute description.
Jonny Grant [Sun, 19 Mar 2023 01:21:33 +0000 (01:21 +0000)]
Docs: correct typo in nonnull function attribute description.

gcc/ChangeLog:
* doc/extend.texi (Common Function Attributes) <nonnull>:
Correct typo.

16 months agoDaily bump.
GCC Administrator [Sun, 19 Mar 2023 00:16:36 +0000 (00:16 +0000)]
Daily bump.

16 months agoanalyzer: fix ICE on certain longjmp calls [PR109094]
David Malcolm [Sat, 18 Mar 2023 16:48:01 +0000 (12:48 -0400)]
analyzer: fix ICE on certain longjmp calls [PR109094]

PR analyzer/109094 reports an ICE in the analyzer seen on qemu's
target/i386/tcg/translate.c

The issue turned out to be that when handling a longjmp, the code
to pop the frames was generating an svalue for the result_decl of any
popped frame that had a non-void return type (and discarding it) leading
to "uninit" poisoned_svalue_diagnostic instances being saved since the
result_decl is only set by the greturn stmt.  Later, when checking the
feasibility of the path to these diagnostics, m_check_expr was evaluated
in the context of the frame of the longjmp, leading to an attempt to
evaluate the result_decl of each intervening frames whilst in the
context of the topmost frame, leading to an assertion failure in
frame_region::get_region_for_local here:

919 case RESULT_DECL:
920   gcc_assert (DECL_CONTEXT (expr) == m_fun->decl);
921   break;

This patch updates the analyzer's longjmp implementation so that it
doesn't attempt to generate svalues for the result_decls when popping
frames, fixing the assertion failure (and presumably fixing "uninit"
false positives in a release build).

gcc/analyzer/ChangeLog:
PR analyzer/109094
* region-model.cc (region_model::on_longjmp): Pass false for
new "eval_return_svalue" param of pop_frame.
(region_model::pop_frame): Add new "eval_return_svalue" param and
use it to suppress the call to get_rvalue on the result when
needed by on_longjmp.
* region-model.h (region_model::pop_frame): Add new
"eval_return_svalue" param.

gcc/testsuite/ChangeLog:
PR analyzer/109094
* gcc.dg/analyzer/setjmp-pr109094.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
16 months agolibstdc++: Fix test for hash<coroutine_handle<P>>::operator() [PR109165]
Jonathan Wakely [Fri, 17 Mar 2023 11:39:55 +0000 (11:39 +0000)]
libstdc++: Fix test for hash<coroutine_handle<P>>::operator() [PR109165]

libstdc++-v3/ChangeLog:

PR libstdc++/109165
* testsuite/18_support/coroutines/hash.cc: Use const object
in second call.

16 months agoFortran: Fix bugs and missing features in finalization [PR37336]
Paul Thomas [Sat, 18 Mar 2023 07:56:23 +0000 (07:56 +0000)]
Fortran: Fix bugs and missing features in finalization [PR37336]

2023-03-18  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/103854
PR fortran/96122
PR fortran/37336
* class.cc (finalize_component): Include the missing arguments
in the call to the component's finalizer wrapper.
(has_finalizer_component): Do not return true for procedure
pointer components.
(finalizer_insert_packed_call): Remove the redundant argument
in the call to the final subroutine.
(generate_finalization_wrapper): Add support for assumed rank
finalizers.
(gfc_may_be_finalized): New helper function.
* dump-parse-tree.cc (write_proc): Whitespace.
* gfortran.h : Add prototype for gfc_may_be_finalized.
* resolve.cc (resolve_function): Correct derived types that
have an incomplete namespace.
(resolve_where, gfc_resolve_where_code_in_forall,
gfc_resolve_forall_body, gfc_resolve_code): Check that the op
code is still EXEC_ASSIGN. If it is set lhs to must finalize.
(is_finalizable_type): New function.
(generate_component_assignments): Set must_finalize if needed.
(gfc_resolve_finalizers): Error if assumed rank finalizer is
not the only one. Warning on lack of scalar finalizer modified
to account for assumed rank finalizers.
(generate_final_call): New function.
(generate_component_assignments): Enclose the outermost call in
a block to capture automatic deallocation and final calls.
Set must_finalize as required to satisfy the standards. Use an
explicit pointer assignment for pointer components to capture
finalization of the target. Likewise use explicit assignment
for allocatable components. Do not use the temporary copy of
the lhs in defined assignment if the component is allocatable.
Put the temporary in the same namespace as the lhs symbol if
the component may be finalized. Remove the leading assignment
from the expansion of assignment of components that have their
own defined assignment components. Suppress finalization of
assignment of temporary components to the lhs. Make an explicit
final call for the rhs function temporary if it exists.
(gfc_resolve_code): Set must_finalize for assignments with an
array constructor on the rhs.
(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
is the only finalizer for that type and correct the surprising
warning for the lack of a scalar finalizer.
(check_defined_assignments): Handle allocatable components.
(resolve_fl_derived): Set referenced the vtab for use
associated symbols.
(resolve_symbol): Set referenced an unreferenced symbol that
will be finalized.
* trans-array.cc (gfc_trans_array_constructor_value): Add code
to finalize the constructor result. Warn that this feature was
removed in F2018 and that it is suppressed by -std=2018.
(trans_array_constructor): Add finalblock, pass to previous
and apply to loop->post if filled.
(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
generated finalization code to the main block.
(structure_alloc_comps): Add boolean argument to suppress
finalization and use it for calls from
gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
false.
(gfc_copy_alloc_comp_no_fini): New wrapper for
structure_alloc_comps.
(gfc_alloc_allocatable_for_assignment): Suppress finalization
by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
deallocate the components of entities with a leading '_' in the
name that are also marked as artificial.
* trans-array.h : Add the new boolean argument to the prototype
of gfc_deallocate_alloc_comp_no_caf with a default of false.
Add prototype for gfc_copy_alloc_comp_no_fini.
* trans-decl.cc(init_intent_out_dt): Tidy up the code.
* trans-expr.cc (gfc_init_se): Initialize finalblock.
(gfc_conv_procedure_call): Use gfc_finalize_tree_expr to
finalize function results. Replace in-line block for class
results with call to new function.
(gfc_conv_expr): Finalize structure constructors for F2003 and
F2008. Warn that this feature was deleted in F2018 and, unlike
array constructors, is not default. Add array constructor
finalblock to the post block.
(gfc_trans_scalar_assign): Suppress finalization by setting new
argument in call to gfc_deallocate_alloc_comp_no_caf. Add the
finalization blocks to the main block.
(gfc_trans_arrayfunc_assign): Use gfc_assignment_finalizer_call
and ensure that finalization occurs after the evaluation of the
rhs but using the initial value for the lhs. Finalize rhs
function results using gfc_finalize_tree_expr.
(trans_class_assignment, gfc_trans_assignment_1): As previous
function, taking care to order evaluation, assignment and
finalization correctly.
* trans-io.cc (gfc_trans_transfer): Add the final block.
* trans-stmt.cc (gfc_trans_call, gfc_trans_allocate): likewise.
(trans_associate_var): Nullify derived allocatable components
and finalize function targets with defined assignment
components on leaving the block scope.
(trans_allocate): Finalize source expressions, if required,
and set init_expr artificial temporarily to suppress the
finalization in gfc_trans_assignment.
* trans.cc (gfc_add_finalizer_call): Do not finalize the
temporaries generated in type assignment with defined
assignment components.
(gfc_assignment_finalizer_call): New function.
(gfc_finalize_tree_expr): New function.
* trans.h: Add finalblock to gfc_se. Add the prototypes for
gfc_finalize_tree_expr and gfc_assignment_finalizer_call.

gcc/testsuite/
PR fortran/64290
* gfortran.dg/finalize_38.f90 : New test.
* gfortran.dg/finalize_38a.f90 : New test.
* gfortran.dg/allocate_with_source_25.f90 : The number of final
calls goes down from 6 to 4.
* gfortran.dg/associate_25.f90 : Remove the incorrect comment.
* gfortran.dg/auto_dealloc_2.f90 : Change the tree dump expr
but the final count remains the same.
* gfortran.dg/unlimited_polymorphic_8.f90 : Tree dump reveals
foo.1.x rather than foo.0.x

PR fortran/67444
* gfortran.dg/finalize_39.f90 : New test.

PR fortran/67471
* gfortran.dg/finalize_40.f90 : New test.

PR fortran/69298
PR fortran/70863
* gfortran.dg/finalize_41.f90 : New test.

PR fortran/71798
* gfortran.dg/finalize_42.f90 : New test.

PR fortran/80524
* gfortran.dg/finalize_43.f90 : New test.

PR fortran/82996
* gfortran.dg/finalize_44.f90 : New test.

PR fortran/84472
* gfortran.dg/finalize_45.f90 : New test.

PR fortran/88735
PR fortran/93691
* gfortran.dg/finalize_46.f90 : New test.

PR fortran/91316
* gfortran.dg/finalize_47.f90 : New test.

PR fortran/106576
* gfortran.dg/finalize_48.f90 : New test.

PR fortran/37336
* gfortran.dg/finalize_49.f90 : New test.
* gfortran.dg/finalize_50.f90 : New test.
* gfortran.dg/finalize_51.f90 : New test.

16 months agoDaily bump.
GCC Administrator [Sat, 18 Mar 2023 00:16:40 +0000 (00:16 +0000)]
Daily bump.

16 months agolra: Ignore debug insns and notes in combine_reload_insn [PR109179]
Peter Bergner [Sat, 18 Mar 2023 00:01:45 +0000 (19:01 -0500)]
lra: Ignore debug insns and notes in combine_reload_insn [PR109179]

We ICE in combine_reload_insn if we've deleted the TO insn operand during
processing, because lra_get_insn_recog_data doesn't expect to see the note
that replaces the deleted insn.  The solution here is to exit early if TO
is a debug insn or note.

2023-03-17  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR rtl-optimization/109179
* lra-constraints.cc (combine_reload_insn): Enforce TO is not a debug
insn or note.  Move the tests earlier to guard lra_get_insn_recog_data.

16 months agotestsuite: Skip some gcc.dg/plugin tests for default_packed targets
Hans-Peter Nilsson [Fri, 17 Mar 2023 16:03:34 +0000 (17:03 +0100)]
testsuite: Skip some gcc.dg/plugin tests for default_packed targets

Avoid unweildy structure-layout-specific message-matching
expressions by exluding targets that lay out structures as
if they had been specified with __attribute__ ((__packed__)),
for tests where multiple messages depend on the structure
layout.

It's arguably a judgement call whether to skip some of these
tests or add multiple lines of matches depending on the
layout of structures.

* gcc.dg/plugin/infoleak-2.c,
gcc.dg/plugin/infoleak-CVE-2011-1078-1.c,
gcc.dg/plugin/infoleak-CVE-2011-1078-2.c,
gcc.dg/plugin/infoleak-CVE-2017-18549-1.c,
gcc.dg/plugin/infoleak-CVE-2017-18550-1.c,
gcc.dg/plugin/infoleak-antipatterns-1.c,
gcc.dg/plugin/infoleak-fixit-1.c: Skip for default_packed targets.

16 months agoc++: constant, array, lambda, template [PR108975]
Jason Merrill [Fri, 17 Mar 2023 21:26:40 +0000 (17:26 -0400)]
c++: constant, array, lambda, template [PR108975]

When a lambda refers to a constant local variable in the enclosing scope, we
tentatively capture it, but if we end up pulling out its constant value, we
go back at the end of the lambda and prune any unneeded captures.  Here
while parsing the template we decided that the dim capture was unneeded,
because we folded it away, but then we brought back the use in the template
trees that try to preserve the source representation with added type info.
So then when we tried to instantiate that use, we couldn't find what it was
trying to use, and crashed.

Fixed by not trying to prune when parsing a template; we'll prune at
instantiation time.

PR c++/108975

gcc/cp/ChangeLog:

* lambda.cc (prune_lambda_captures): Don't bother in a template.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/lambda/lambda-const11.C: New test.

16 months agoc++: throw and private destructor [PR109172]
Jason Merrill [Fri, 17 Mar 2023 19:27:10 +0000 (15:27 -0400)]
c++: throw and private destructor [PR109172]

Since we aren't going through the normal call machinery, we need to check
the dtor access specifically.

PR c++/109172

gcc/cp/ChangeLog:

* except.cc (build_throw): Check dtor access.

gcc/testsuite/ChangeLog:

* g++.dg/eh/dtor4.C: New test.

16 months agolibstdc++: Add const to hash<coroutine_handle<P>>::operator() [PR109165]
Jonathan Wakely [Fri, 17 Mar 2023 11:39:55 +0000 (11:39 +0000)]
libstdc++: Add const to hash<coroutine_handle<P>>::operator() [PR109165]

libstdc++-v3/ChangeLog:

PR libstdc++/109165
* include/std/coroutine (hash<>::operator()): Add const.
* testsuite/18_support/coroutines/hash.cc: New test.

16 months agoc++: namespace-scoped friend in local class [PR69410]
Jason Merrill [Fri, 17 Mar 2023 13:43:48 +0000 (09:43 -0400)]
c++: namespace-scoped friend in local class [PR69410]

do_friend was only considering class-qualified identifiers for the
qualified-id case, but we also need to skip local scope when there's an
explicit namespace scope.

PR c++/69410

gcc/cp/ChangeLog:

* friend.cc (do_friend): Handle namespace as scope argument.
* decl.cc (grokdeclarator): Pass down in_namespace.

gcc/testsuite/ChangeLog:

* g++.dg/lookup/friend24.C: New test.

16 months agotree-inline: Fix up multiversioning with vector arguments [PR105554]
Jakub Jelinek [Fri, 17 Mar 2023 17:59:56 +0000 (18:59 +0100)]
tree-inline: Fix up multiversioning with vector arguments [PR105554]

The following testcase ICEs, because we call tree_function_versioning from
old_decl which has target attributes not supporting V4DImode and so
DECL_MODE of DECL_ARGUMENTS is BLKmode, while new_decl supports those.
tree_function_versioning initially copies DECL_RESULT and DECL_ARGUMENTS
from old_decl to new_decl, then calls initialize_cfun to create cfun
and only when the cfun is created it can later actually remap_decl
DECL_RESULT and DECL_ARGUMENTS etc.
The problem is that initialize_cfun -> push_struct_function ->
allocate_struct_function calls relayout_decl on DECL_RESULT and
DECL_ARGUMENTS, which clobbers DECL_MODE of old_decl and we then ICE because
of it.
In particular, allocate_struct_function does:
      if (!abstract_p)
        {
          /* Now that we have activated any function-specific attributes
             that might affect layout, particularly vector modes, relayout
             each of the parameters and the result.  */
          relayout_decl (result);
          for (tree parm = DECL_ARGUMENTS (fndecl); parm;
               parm = DECL_CHAIN (parm))
            relayout_decl (parm);

          /* Similarly relayout the function decl.  */
          targetm.target_option.relayout_function (fndecl);
        }

      if (!abstract_p && aggregate_value_p (result, fndecl))
        {
 #ifdef PCC_STATIC_STRUCT_RETURN
          cfun->returns_pcc_struct = 1;
 #endif
          cfun->returns_struct = 1;
        }
Now, in the case of tree_function_versioning, I believe all that we need
from these is possibly the
targetm.target_option.relayout_function (fndecl);
call (arm only), we will remap DECL_RESULT and DECL_ARGUMENTS later on
and copy_decl_for_dup_finish in that case will handle all we need:
  /* For vector typed decls make sure to update DECL_MODE according
     to the new function context.  */
  if (VECTOR_TYPE_P (TREE_TYPE (copy)))
    SET_DECL_MODE (copy, TYPE_MODE (TREE_TYPE (copy)));
We don't need the cfun->returns_*struct either, because we override it
in initialize_cfun a few lines later:
  /* Copy items we preserve during cloning.  */
...
  cfun->returns_struct = src_cfun->returns_struct;
  cfun->returns_pcc_struct = src_cfun->returns_pcc_struct;

So, to avoid the clobbering of DECL_RESULT/DECL_ARGUMENTS of old_decl,
the following patch arranges allocate_struct_function to be called with
abstract_p true and calls targetm.target_option.relayout_function (fndecl);
by hand.

The removal of DECL_RESULT/DECL_ARGUMENTS copying at the start of
initialize_cfun is removed because the only caller -
tree_function_versioning, does that unconditionally before.

2023-03-17  Jakub Jelinek  <jakub@redhat.com>

PR target/105554
* function.h (push_struct_function): Add ABSTRACT_P argument defaulted
to false.
* function.cc (push_struct_function): Add ABSTRACT_P argument, pass it
to allocate_struct_function instead of false.
* tree-inline.cc (initialize_cfun): Don't copy DECL_ARGUMENTS
nor DECL_RESULT here.  Pass true as ABSTRACT_P to
push_struct_function.  Call targetm.target_option.relayout_function
after it.
(tree_function_versioning): Formatting fix.

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

16 months agoc, ubsan: Instrument even shortened divisions [PR109151]
Jakub Jelinek [Fri, 17 Mar 2023 15:10:14 +0000 (16:10 +0100)]
c, ubsan: Instrument even shortened divisions [PR109151]

On the following testcase, the C FE decides to shorten the division because
it has a guarantee that INT_MIN / -1 division won't be encountered, the
first operand is widened from narrower unsigned and/or the second operand is
a constant other than all ones (in this case both are true).
The problem is that the narrower type in this case is _Bool and
ubsan_instrument_division only instruments it if op0's type is INTEGER_TYPE
or REAL_TYPE.  Strangely this doesn't happen in C++ FE.
Anyway, we only shorten divisions if the INT_MIN / -1 case is impossible,
so I think we should be fine even with -fstrict-enums in C++ in case it
shortened to ENUMERAL_TYPEs.

The following patch just instruments those on the ubsan_instrument_division
side.  Perhaps only the first hunk and testcase might be needed because
we shouldn't shorten if the other case could be triggered.

2023-03-17  Jakub Jelinek  <jakub@redhat.com>

PR c/109151
* c-ubsan.cc (ubsan_instrument_division): Handle all scalar integral
types rather than just INTEGER_TYPE.

* c-c++-common/ubsan/div-by-zero-8.c: New test.

16 months agoPR modula2/109032 - message 'compiler checks to force' is too complicated
Gaius Mulley [Fri, 17 Mar 2023 14:32:22 +0000 (14:32 +0000)]
PR modula2/109032 - message 'compiler checks to force' is too complicated

Correct typos and improve the descriptions of command line options.
Improve comments in gm2-gcc/m2expr.cc.

gcc/m2/ChangeLog:

PR modula2/109032
* gm2-gcc/m2expr.cc: Correct ? : order in comments.
(m2expr_BuildDivM2): Improve comment.
* lang.opt: Improve option descriptions.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoLRA: Implement combining secondary memory reload and original insn
Vladimir N. Makarov [Fri, 17 Mar 2023 12:58:58 +0000 (08:58 -0400)]
LRA: Implement combining secondary memory reload and original insn

LRA creates secondary memory reload insns but do not try to combine it
with the original insn.  This patch implements a simple insn combining
for such cases in LRA.

        PR rtl-optimization/109052

gcc/ChangeLog:

* lra-constraints.cc: Include hooks.h.
(combine_reload_insn): New function.
(lra_constraints): Call it.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr109052.c: New.

16 months agoPR modula2/109102 Wrong quotes in diagnostic
Gaius Mulley [Fri, 17 Mar 2023 12:47:06 +0000 (12:47 +0000)]
PR modula2/109102 Wrong quotes in diagnostic

The backtick and single quote should be replaced with %< and %> or
%qs.

gcc/m2/ChangeLog:

PR modula2/109102
* gm2-gcc/m2builtins.cc (ASSERT): Change format specifier to
use %qs rather than quotes.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoRISC-V: Handle undef for vector mask patterns
Ju-Zhe Zhong [Mon, 13 Mar 2023 07:52:01 +0000 (15:52 +0800)]
RISC-V: Handle undef for vector mask patterns

Add new instruction pattern for setting vector mask to undefine value,
also merge undef and non-undef ternary operation pattern like MAC operations to
single pattern.

gcc/ChangeLog:

* config/riscv/riscv-v.cc (legitimize_move): Allow undef value
as legitimate value.
* config/riscv/riscv-vector-builtins.cc
(function_expander::use_ternop_insn): Fix bugs of ternary intrinsic.
(function_expander::use_widen_ternop_insn): Ditto.
* config/riscv/vector.md (@vundefined<mode>): New pattern.
(pred_mul_<optab><mode>_undef_merge): Remove.
(*pred_mul_<optab><mode>_undef_merge_scalar): Ditto.
(*pred_mul_<optab><mode>_undef_merge_extended_scalar): Ditto.
(pred_neg_mul_<optab><mode>_undef_merge): Ditto.
(*pred_neg_mul_<optab><mode>_undef_merge_scalar): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/binop_vv_constraint-4.c: Adapt the test.
* gcc.target/riscv/rvv/base/binop_vv_constraint-6.c: Ditto.
* gcc.target/riscv/rvv/base/binop_vx_constraint-127.c: Ditto.
* g++.target/riscv/rvv/base/bug-1.C: New test.
* gcc.target/riscv/rvv/base/bug-2.c: New test.

Signed-off-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Co-authored-by: kito-cheng <kito.cheng@sifive.com>
16 months agoRISC-V: Use reg_or_subregno to check regno [PR109092]
Ju-Zhe Zhong [Mon, 13 Mar 2023 14:17:57 +0000 (22:17 +0800)]
RISC-V: Use reg_or_subregno to check regno [PR109092]

gcc/ChangeLog:

PR target/109092
* config/riscv/riscv.md: Fix subreg bug.

16 months agotestsuite: Fix up forwprop-39.c testcase [PR109145]
Jakub Jelinek [Fri, 17 Mar 2023 08:58:08 +0000 (09:58 +0100)]
testsuite: Fix up forwprop-39.c testcase [PR109145]

As written in the PR, newlib headers aren't C11 compliant in that they
don't define CMPLXF macro, and glibc before 2.16 doesn't define that
either.  I think it is easier to use __builtin_complex directly, over
another patch which keeps including complex.h but defines CMPLXF if it
isn't defined, we want to test how forwprop behaves rather than what
complex.h defines or doesn't define.

2023-03-17  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/109145
* gcc.dg/tree-ssa/forwprop-39.c: Remove -std=c11 from dg-options.
Don't include complex.h.
(foo): Use __builtin_complex rather than CMPLXF.

16 months agoopenmp: Fix up handling of doacross loops with noreturn body in loops [PR108685]
Jakub Jelinek [Fri, 17 Mar 2023 07:46:28 +0000 (08:46 +0100)]
openmp: Fix up handling of doacross loops with noreturn body in loops [PR108685]

The following patch fixes an ICE with doacross loops which have a single entry
no exit body, at least one of the ordered > collapse loops isn't guaranteed to
have at least one iteration and the whole doacross loop is inside some other loop.
The OpenMP constructs aren't represented by struct loop until the omp expansions,
so for a normal doacross loop which doesn't have a noreturn body the entry_bb
with the GOMP_FOR statement and the first bb of the body typically have the
same loop_father, and if the doacross loop isn't inside of some other loop
and the body is noreturn as well, both are part of loop 0.  The problematic
case is when the entry_bb is inside of some deeper loop, but the body, because
it falls through into EXIT, has loop 0 as loop_father.  l0_bb is created by
splitting the entry_bb fallthru edge into l1_bb, and because the two basic blocks
have different loop_father, a common loop is found for those (which is loop 0).
Now, if the doacross loop has collapse == ordered or all the ordered > collapse
loops are guaranteed to iterate at least once, all is still fine, because all
enter the l1_bb (body), which doesn't return and so doesn't loop further either.
But, if one of those loops could loop 0 times, the user written body wouldn't be
reached at all, so unlike the expectations the whole construct actually wouldn't
be noreturn if entry_bb is encountered and decides to handle at least one
iteration.

In this case, we need to fix up, move the l0_bb into the same loop as entry_bb
(initially) and for the extra added loops put them as children of that same
loop, rather than of loop 0.

2023-03-17  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108685
* omp-expand.cc (expand_omp_for_ordered_loops): Add L0_BB argument,
use its loop_father rather than BODY_BB's loop_father.
(expand_omp_for_generic): Adjust expand_omp_for_ordered_loops caller.
If broken_loop with ordered > collapse and at least one of those
extra loops aren't guaranteed to have at least one iteration, change
l0_bb's loop_father to entry_bb's loop_father.  Set cont_bb's
loop_father to l0_bb's loop_father rather than l1_bb's.

* c-c++-common/gomp/doacross-8.c: New test.

16 months agogdbhooks: Update gdbhooks.py for recent tree_code_type changes [PR108634]
Jakub Jelinek [Fri, 17 Mar 2023 07:44:19 +0000 (08:44 +0100)]
gdbhooks: Update gdbhooks.py for recent tree_code_type changes [PR108634]

On Mon, Mar 13, 2023 at 04:15:12PM -0400, Jason Merrill wrote:
> The r13-6577 change to use tree_code_type_tmpl in earlier C++ dialects broke
> gdbhooks, which expects tree_code_type to always be available.  I considered
> trying to make gdbhooks more robust, but it seemed simpler to define
> tree_code_type as a reference to the template.

As I said earlier, I think it is better to tweak gdbhooks.

The following patch does that, I've tested it now both with gcc 12 and
older gcc as system compiler and the patch fixed the latter while keeping
the former working as before.

2023-03-17  Jakub Jelinek  <jakub@redhat.com>

PR plugins/108634
* gdbhooks.py (TreePrinter.to_string): Wrap
gdb.parse_and_eval('tree_code_type') in a try block, parse
and eval 'tree_code_type_tmpl<0>::tree_code_type' instead if it
raises exception.  Update comments for the recent tree_code_type
changes.

16 months agod: Merge upstream dmd, druntime 5f7552bb28, phobos 67a47cf39.
Iain Buclaw [Thu, 16 Mar 2023 23:27:52 +0000 (00:27 +0100)]
d: Merge upstream dmd, druntime 5f7552bb28, phobos 67a47cf39.

D front-end changes:

- Import dmd v2.103.0-rc.1.

D runtime changes:

- Import druntime v2.103.0-rc.1.

Phobos changes:

- Import phobos v2.103.0-rc.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 5f7552bb28.
* dmd/VERSION: Bump version to v2.103.0-rc.1.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 5f7552bb28.
* src/MERGE: Merge upstream phobos 67a47cf39.

16 months agoDocs: Fix formatting issues in BPF built-ins documentation.
Sandra Loosemore [Thu, 16 Mar 2023 21:07:18 +0000 (21:07 +0000)]
Docs: Fix formatting issues in BPF built-ins documentation.

gcc/ChangeLog:
* doc/extend.texi (BPF Built-in Functions): Fix numerous markup
issues.  Add more line breaks to example so it doesn't overflow
the margins.

16 months agoDocs: Fix some too-long lines in Texinfo manual.
Sandra Loosemore [Thu, 16 Mar 2023 21:05:53 +0000 (21:05 +0000)]
Docs: Fix some too-long lines in Texinfo manual.

gcc/ChangeLog:
* doc/extend.texi (Common Function Attributes) <access>: Fix bad
line breaks in examples.
<malloc>: Fix bad line breaks in running text, also copy-edit
for consistency.
(Extended Asm) <Generic Operand Modifiers>: Fix @multitable width.
* doc/invoke.texi (Option Summary) <Developer Options>: Fix misplaced
@gol.
(C++ Dialect Options) <-fcontracts>: Add line break in example.
<-Wctad-maybe-unsupported>: Likewise.
<-Winvalid-constexpr>: Likewise.
(Warning Options) <-Wdangling-pointer>: Likewise.
<-Winterference-size>: Likewise.
<-Wvla-parameter>: Likewise.
(Static Analyzer Options): Fix bad line breaks in running text,
plus add some missing markup.
(Optimize Options) <openacc-privatization>: Fix more bad line
breaks in running text.

16 months ago[modula2] Bugfix local symbol names for -fm2-whole-program
Gaius Mulley [Fri, 17 Mar 2023 00:23:02 +0000 (00:23 +0000)]
[modula2] Bugfix local symbol names for -fm2-whole-program

Local symbols must be prefixed by the modulename if
-fm2-whole-program is used to avoid a name clash.

gcc/m2/ChangeLog:

* gm2-compiler/M2AsmUtil.mod (SymNeedsModulePrefix):
Re-implemented.
* gm2-libs/SysStorage.mod (enableTrace): Disable tracing.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoDaily bump.
GCC Administrator [Fri, 17 Mar 2023 00:17:03 +0000 (00:17 +0000)]
Daily bump.

16 months agomaintainer-scripts: Add Modula-2 manual to update_web_docs_git
Gaius Mulley [Thu, 16 Mar 2023 23:08:20 +0000 (00:08 +0100)]
maintainer-scripts: Add Modula-2 manual to update_web_docs_git

maintainer-scripts/ChangeLog:

* update_web_docs_git (MANUALS): Add gm2.
Add include path for gm2 manual.

16 months agoc++: __func__ and local class DMI [PR105809]
Jason Merrill [Thu, 16 Mar 2023 19:35:15 +0000 (15:35 -0400)]
c++: __func__ and local class DMI [PR105809]

As in 108242, we need to instantiate in the context of the enclosing
function, not after it's gone.

PR c++/105809

gcc/cp/ChangeLog:

* init.cc (get_nsdmi): Split out...
(maybe_instantiate_nsdmi_init): ...this function.
* cp-tree.h: Declare it.
* pt.cc (tsubst_expr): Use it.

gcc/testsuite/ChangeLog:

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

16 months agoc++: generic lambda, local class, __func__ [PR108242]
Jason Merrill [Thu, 16 Mar 2023 19:11:25 +0000 (15:11 -0400)]
c++: generic lambda, local class, __func__ [PR108242]

Here we are trying to do name lookup in a deferred instantiation of t() and
failing to find __func__.  tsubst_expr already tries to instantiate members
of local classes, but was failing with the partial instantiation of generic
lambdas.

PR c++/108242

gcc/cp/ChangeLog:

* pt.cc (tsubst_expr) [TAG_DEFN]: Handle partial instantiation.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/lambda-generic-func2.C: New test.