]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
85 min agowarn-access: -Winvalid-memory-model fixes [PR124827] master trunk
Jakub Jelinek [Fri, 10 Apr 2026 09:47:59 +0000 (11:47 +0200)] 
warn-access: -Winvalid-memory-model fixes [PR124827]

A few years ago Martin moved for unknown reasons -Winvalid-memory-model
diagnostics from expansion to the gimple-ssa-warn-access middle end warning
black hole.
A recent change limited the second instance of the pass to only a small
subset of warnings.
This regressed diagnostics of -Winvalid-memory-model with -fsanitize=thread,
because invalid cases are not warned about anymore during waccess2 and
during waccess3 we've already transformed those builtins into corresponding
tsan builtins.

The following patch fixes that regression by handling the tsan atomic
builtins as well.  While doing that, I've also fixed formatting and noticed
other bogosities in the code, e.g. existance of xchg_models.  No idea
where Martin got that from, neither C11, nor C23, nor various versions of
C++ nor GCC documentation have any restrictions on what memory models can be
used for atomic_exchange_explicit, so why is it trying to prevent
__ATOMIC_ACQUIRE?
And incorrectly so, __atomic_exchange_N has 3 arguments, and suc_arg is 0
based, so setting it to 3 meant it didn't check anything because the 4th
argument doesn't exist.  So fixed to use all_models with the correct arg
index.

Besides this, there is another problem that we fold some atomic builtins
into IFN_ATOMIC* internal functions.  That isn't a 16 Regression though,
could be fixed by also diagnosing this stuff for the IFN_ATOMIC_* calls,
but I'm not doing it right now because there is yet another problem.
C++17 in https://wg21.link/p0418r2 dropped some of the restrictions, in
particular that for the compare and exchange cases failure mode can't be
stronger than success mode.  So I'm hesistant to add further warnings for
16 (beyond just fixing the -fsanitize=thread inconsistency), unsure if
we should somehow mark the atomic builtins from the C++ <atomic> APIs
that the no stronger checking shouldn't be done for those, or simply
mark those for all of C++17 and later, something else?
C23/C2Y I think still require it and it is reasonable requirement,

2026-04-10  <jakub@redhat.com>

PR middle-end/124827
* gimple-ssa-warn-access.cc (xchg_models): Remove.
(pass_waccess::check_atomic_builtin): Fix up sucs_arg for
BUILT_IN_ATOMIC_EXCHAGE_* and use all_models instead of xchg_models.
Handle BUILT_IN_TSAN_ATOMIC*.  Formatting fixes.

* gcc.dg/tsan/atomic-invalid.c: New test.

2 hours agoconfigure: Update #line directives after r16-8546
Dhruv Chawla [Fri, 10 Apr 2026 04:56:16 +0000 (21:56 -0700)] 
configure: Update #line directives after r16-8546

Missed updating after the commit. Patch applied from sourceware builder.
Pushing as obvious.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* configure: Regenerate.

3 hours agotestsuite: Fix up g++.dg/lto/20091022-2_0.C test [PR124828]
Jakub Jelinek [Fri, 10 Apr 2026 07:47:36 +0000 (09:47 +0200)] 
testsuite: Fix up g++.dg/lto/20091022-2_0.C test [PR124828]

From what I can see, this test was added for PR41791 where we didn't stream
in/out the system header flags for LTO.  The test isn't perfect, because
even when we actually do stream those flags, whether it fails or not depends
on the exact decisions of the inliner whether it decides to inline all
inline/constexpr functions or not (maybe it would help to use some
--params to request inlining as few functions as possible).

Anyway, guess at some point we simply started to inline everything that was
used and so whether the test stopped failing even if it would use
-Wsystem-headers.  Now, when not using installed gcc testing, we use
libstdc++-v3/scripts/testsuite_flags script which uses -I options rather
than -isystem, but the headers still had #pragma GCC system_header pragmas.
Except that r15-3859 guarded those pragmas with a macro which isn't defined
by default and needs to be defined only when we want to make sure the
headers are treated as system headers.
And later on the recent changes for C++20 stable string exports started
seeing a constexpr (thus implicitly inline for -Winline purposes) being too
large for default inlining and so the test started to fail again.

The following patch fixes it by making sure the libstdc++ headers are
treated as system headers, so the test tests again what it was supposed to
test.

2026-04-10  Jakub Jelinek  <jakub@redhat.com>

PR lto/124828
* g++.dg/lto/20091022-2_0.C (_GLIBCXX_SYSHDR): Define before including
<string>.

Reviewed-by: Richard Biener <rguenth@suse.de>
4 hours agoc++: Unshare expr in get_template_parm_object [PR124792]
Jakub Jelinek [Fri, 10 Apr 2026 06:46:16 +0000 (08:46 +0200)] 
c++: Unshare expr in get_template_parm_object [PR124792]

The following testcase is miscompiled due to incorrect CONSTRUCTOR sharing.
For reflect_constant_array elts which aren't integral we call
convert_reflect_constant_arg (but reflect_constant etc. do the same) and
that eventually indirectly calls get_template_parm_object which creates
the TPO VAR_DECL with DECL_INITIAL.  Unfortunately, some CONSTRUCTORs
in that DECL_INITIAL can be shared with whatever we use during constant
expression evaluation later on, so when we evaluate ~vector, we modify
those and with that modify also the CONSTRUCTORs inside of TPO
DECL_INITIAL CONSTRUCTOR.
So we need to unshare it somewhere.

This patch unshares in get_template_parm_object, i.e. the lowest level,
and only when not reusing previously created TPO.

2026-04-10  Jakub Jelinek  <jakub@redhat.com>

PR c++/124792
* pt.cc (get_template_parm_object): Call unshare_expr_without_location
on expr if check_init.

* g++.dg/reflect/pr124792.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
5 hours agolibstdc++: Rename views::to_input to views::as_input.
Tomasz Kamiński [Thu, 9 Apr 2026 12:34:35 +0000 (14:34 +0200)] 
libstdc++: Rename views::to_input to views::as_input.

This patch implements P3828R1: Rename the to_input view to as_input.

The paper suggest renaming the feature test macro without changing the
value and this patch follows.

libstdc++-v3/ChangeLog:

* include/bits/version.def (ranges_to_input): Rename to...
(ranges_as_input): Rename from ranges_as_input.
* include/bits/version.h: Regenerate.
* include/std/ranges (ranges::to_input_view, views::to_input)
(__detail::__can_to_input, views::_ToInput): Rename to...
(ranges::as_input_view, views::as_input, __detail::__can_as_input)
(views::_AsInput): Rename from above...
* src/c++23/std.cc.in: Rename views::to_input and to_input_view
export.
* testsuite/25_algorithms/contains/1.cc: Replace views::to_input
with views::as_input.
* testsuite/std/ranges/adaptors/to_input/1.cc: Move to...
* testsuite/std/ranges/adaptors/as_input/1.cc: ...here, and replace
views::to_input with views::as_input.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/range_args.C: Replace views::to_input with
views::as_input.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 hours agolibstdc++: Remove span constructor from initializer_list.
Tomasz Kamiński [Wed, 8 Apr 2026 15:29:07 +0000 (17:29 +0200)] 
libstdc++: Remove span constructor from initializer_list.

Following LWG4520 resolution from paper
P4144R1 Remove span’s initializer_list constructor for C++26.

libstdc++-v3/ChangeLog:

* include/bits/version.def (span_initializer_list): Remove.
* include/bits/version.h: Regenerate.
* include/std/span (span::span(initializer_list<value_type>)):
Remove.
* testsuite/23_containers/span/init_list_cons.cc: Removed.
* testsuite/23_containers/span/init_list_cons_neg.cc: Removed.
* testsuite/23_containers/inplace_vector/copy.cc: Replace span
with initializer_list in eq helper.
* testsuite/23_containers/inplace_vector/erasure.cc: Likewise.
* testsuite/23_containers/inplace_vector/move.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 hours agolibstdc++: Add default template parameters for uninitialized_fill(_n).
Tomasz Kamiński [Thu, 9 Apr 2026 14:54:10 +0000 (16:54 +0200)] 
libstdc++: Add default template parameters for uninitialized_fill(_n).

This implements P3217R0 and adds default argument for the value type
templater parameter for uninitialized_fill, uninitialized_fill_n and
their ranges counterpart.

libstdc++-v3/ChangeLog:

* include/bits/ranges_uninitialized.h
(__uninitialized_fill_fn::operator())
(__uninitialized_fill_fn_n::operator()): Add default argument
for _Tp parameter.
* include/bits/stl_uninitialized.h (std::unitialized_fill)
(std::unitialized_fill_n): Likewise.
* include/pstl/glue_memory_defs.h (std::unitialized_fill)
(std::unitialized_fill_n): Likewise.
* include/bits/version.def (algorithm_default_value_type):
Bump to 202603.
* include/bits/version.h: Regenerate.
* testsuite/25_algorithms/default_template_value.cc:
Test for new algorithms.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
10 hours agoRISC-V: Update RVV intrinsic version to ratified v1.0
Christoph Müllner [Thu, 9 Apr 2026 16:22:50 +0000 (18:22 +0200)] 
RISC-V: Update RVV intrinsic version to ratified v1.0

The RVV intrinsic implementation already matches the ratified v1.0
interface, but GCC still advertises __riscv_v_intrinsic as v0.12 and
the manual still points users at the stale v0.11.x documentation.

Update __riscv_v_intrinsic to v1.0, adjust the related tests, and
update the manual to say that GCC supports the ratified v1.0 RVV
intrinsic specification and point at the v1.0-ratified release.

gcc/ChangeLog:

* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Set
__riscv_v_intrinsic to v1.0.
* doc/extend.texi (RISC-V Vector Intrinsics): Document the
ratified v1.0 RVV intrinsic specification and update the link.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/predef-__riscv_v_intrinsic.c: Update expected
__riscv_v_intrinsic value.
* gcc.target/riscv/rvv/base/pr114017-1.c: Update version check and
expected warning text to v1.0.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
10 hours agoDaily bump.
GCC Administrator [Fri, 10 Apr 2026 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

11 hours agodoc, c++: Document that anonymous namespaces have internal linkage [PR124773]
Sandra Loosemore [Thu, 9 Apr 2026 23:43:35 +0000 (23:43 +0000)] 
doc, c++: Document that anonymous namespaces have internal linkage [PR124773]

gcc/ChangeLog
PR c++/124773
* doc/trouble.texi (Linkage in Anonymous Namespaces): New section.

16 hours agoc++/reflection: reject invalid template splice [PR123998]
Marek Polacek [Fri, 20 Mar 2026 16:34:31 +0000 (12:34 -0400)] 
c++/reflection: reject invalid template splice [PR123998]

When we have "template [:R:]" without template arguments, the
splice has to designate a function template.  E.g.,

  void foo (int);
  template [: ^^foo :] (0); // invalid

We check this in cp_parser_splice_expression.  But when the splice
is dependent, we don't check it when instantiating, thus missing
the error in

  template [: N == 0 ? ^^foo : ^^:: :] (0);

This patch introduces SPLICE_EXPR_TEMPLATE_P and SPLICE_EXPR_TARGS_P,
and moves the checking into check_splice_expr.  It also adds a missing
check for DECL_TYPE_TEMPLATE_P in case we have a splice-expression of
the form template splice-specialization-specifier.

PR c++/123998

gcc/cp/ChangeLog:

* cp-tree.h (SPLICE_EXPR_TEMPLATE_P): Define.
(SET_SPLICE_EXPR_TEMPLATE_P): Define.
(SPLICE_EXPR_TARGS_P): Define.
(SET_SPLICE_EXPR_TARGS_P): Define.
(check_splice_expr): Adjust.
* parser.cc (cp_parser_splice_expression): Do
SET_SPLICE_EXPR_TEMPLATE_P and SET_SPLICE_EXPR_TARGS_P.  Adjust
the call to check_splice_expr.  Move the template_p checking into
check_splice_expr.
* pt.cc (tsubst_splice_expr): Do SET_SPLICE_EXPR_TEMPLATE_P and
SET_SPLICE_EXPR_TARGS_P.  Adjust the call to check_splice_expr.
* reflect.cc (eval_constant_of): Adjust the call to
check_splice_expr.
(check_splice_expr): Two new bool parameters.  Add the template_p
checking from cp_parser_splice_expression.  Allow
variable_template_p in the assert.  Add a check for
DECL_TYPE_TEMPLATE_P.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/crash11.C: Adjust dg-error.
* g++.dg/reflect/splice5.C: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
19 hours agofortran: Diagnose invalid array initializer after parameter substitution [PR103367]
Christopher Albert [Wed, 8 Apr 2026 20:37:11 +0000 (22:37 +0200)] 
fortran: Diagnose invalid array initializer after parameter substitution [PR103367]

Keep the trunk fallback from r16-8509, but turn it into a real
constant-expression error instead of silently returning an empty
constructor.  This avoids the ICE from PR103367 without regressing
the more specific diagnostics discussed in the Bugzilla follow-up.

PR fortran/103367

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_conv_array_initializer): Emit an error for
invalid residual initializer expressions before returning a safe
empty constructor.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr103367.f90: Expect a constant-expression error and
prune the legacy-extension warning.

Signed-off-by: Christopher Albert <albert@tugraz.at>
20 hours agotestsuite: arm: xfail test unless SP and DP FP [PR113276]
Torbjörn SVENSSON [Thu, 2 Apr 2026 11:56:59 +0000 (13:56 +0200)] 
testsuite: arm: xfail test unless SP and DP FP [PR113276]

gcc/testsuite/ChangeLog:

PR testsuite/113276
* gcc.dg/torture/fp-double-convert-float-1.c: Xfail test for arm*
unless single- and double-precision FP.
* lib/target-supports.exp (check_effective_target_arm_mixed_fp):
New function.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
21 hours agoaarch64: Add some missing dependencies to t-aarch64 [PR122483]
Alex Coplan [Fri, 27 Mar 2026 16:54:24 +0000 (16:54 +0000)] 
aarch64: Add some missing dependencies to t-aarch64 [PR122483]

A subsequent patch adds a new target hook; I noticed while testing an
incremental build that some aarch64 object files which invoke target
hooks are missing dependencies on target.def.  This patch fixes that by
adjusting the relevant object files to depend on TARGET_H instead of
TM_H; the former includes the latter but additionally depends on
target.def.

I verified that these changes fixed test failures (ICEs) in
aarch64-sme.exp seen due to the missed dependencies in an incremental
build with later patches.

gcc/ChangeLog:

PR target/122483
* config/aarch64/t-aarch64: Replace instances of TM_H with
TARGET_H where appropriate, add missing dependency on TARGET_H
for aarch64-early-ra.cc.

23 hours agotestsuite: arm-none-eabi ICEs for g++.dg/coroutines/pr110872.C [PR124326]
Torbjörn SVENSSON [Thu, 9 Apr 2026 08:36:01 +0000 (10:36 +0200)] 
testsuite: arm-none-eabi ICEs for g++.dg/coroutines/pr110872.C [PR124326]

When testing r16-8473-g5cc0ead3625fe6, I see the following error for
arm-none-eabi:

FAIL: g++.dg/coroutines/pr110872.C  -std=c++26 (internal compiler error: in expand_expr_addr_expr_1, at expr.cc:9318)

gcc/testsuite/ChangeLog:

PR testsuite/124326
* g++.dg/coroutines/pr110872.C (dg-ice): Add arm*-*-*.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
23 hours agoaarch64: AutoFDO: Add support for ARM SPE to autoprofiledbootstrap
Dhruv Chawla [Thu, 12 Feb 2026 04:06:03 +0000 (04:06 +0000)] 
aarch64: AutoFDO: Add support for ARM SPE to autoprofiledbootstrap

This patch adds support for ARM SPE as a profiler to gcc-auto-profile
and the corresponding detection required for passing the
--profiler=perf_spe option to create_gcov when creating the GCOV files.

The patch also modifies the create_gcov invocation to make sure that the
corresponding component's profile is actually included in the perf.data
file. This is because some of the profiles end up not including invocations of
one of cc1, cc1plus or lto1 and trying to use them to generate the GCOV with the
missing binary ends up failing the create_gcov command. This is expected and is
not an error condition.

For example:

>> perf buildid-list -i prev-libbacktrace/perf.data
aff9c7b2c5c294612904563fa3da88cb054d313d [kernel.kallsyms]
962097804b5c10ba831958fbb9609cb6d0c1101f /usr/bin/make
...
8227253257ca616415b6d90c8b94de71b314997c /local/home/dhruvc/misc-testing/build-afdo-bootstrap-all/prev-gcc/xgcc
077d6240baadea4c3288e106b17164d164ea7b31 /local/home/dhruvc/misc-testing/build-afdo-bootstrap-all/prev-gcc/cc1
...

There is no instance of cc1plus or lto1 here, so create_gcov cannot be
run on this.

Autoprofilebootstrapped and regtested on aarch64-linux-gnu on both BRBE
and SPE equipped machines.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* Makefile.in (AFDO_PROFILER): New variable.
(PERF): Likewise.
* config/aarch64/gcc-auto-profile: Detect and use ARM SPE events when
invoking perf record.
* configure: Regenerate.
* configure.ac: Detect whether build has perf utility available and
check for ARM SPE-based profiling support when building on AArch64.

gcc/c/ChangeLog:

* Make-lang.in (create_fdas_for_cc1): Use $(AFDO_PROFILER) when passing
--profiler to create_gcov. Ensure that perf.data contains profile for
cc1. Make the console output more useful.

gcc/cp/ChangeLog:

* Make-lang.in (create_fdas_for_cc1plus): Use $(AFDO_PROFILER) when
passing --profiler to create_gcov. Ensure that perf.data contains
profile for cc1plus. Make the console output more useful.

gcc/lto/ChangeLog:

* Make-lang.in (create_fdas_for_lto1): Use $(AFDO_PROFILER) when passing
--profiler to create_gcov. Ensure that perf.data contains profile for
lto1. Make the console output more useful.

gcc/testsuite/ChangeLog:

* lib/profopt.exp (profopt-execute): Add support for profiler type
detection.

23 hours agoDo not read classical profile when -fauto-profile
Richard Biener [Wed, 25 Mar 2026 12:48:49 +0000 (13:48 +0100)] 
Do not read classical profile when -fauto-profile

Formerly the code was

  if (flag_auto_profile)
    read_autofdo_file ();
  else if (flag_branch_probabilities)
    read_counts_file ();

but with the AFDO re-org read_autofdo_file was delayed but the
guard not preserved.  The following rectifies this.

* coverage.cc (coverage_init): Do not call read_counts_file
if flag_auto_profile.

24 hours agoRISC-V: Fix Zbkb single-bit IOR/XOR synthesis [PR124818]
Christoph Müllner [Wed, 8 Apr 2026 16:21:04 +0000 (18:21 +0200)] 
RISC-V: Fix Zbkb single-bit IOR/XOR synthesis [PR124818]

Only Zbs provides the bseti/binvi support that can directly handle a
large single-bit immediate in scalar IOR/XOR operations.  Zbkb alone
does not, but synthesize_ior_xor treated Zbkb as sufficient and
returned false for such constants.

On RV32 with -march=rv32gc_zbkb this leaves an unmatchable
(ior:SI reg (const_int 0x20000)) RTL insn, which later triggers an ICE
in extract_insn during virtual register instantiation.

Restrict the single-bit fast path to Zbs and add an RV32 Zbkb
regression test for the reduced reproducer.

PR target/124818

gcc/ChangeLog:

* config/riscv/riscv.cc (synthesize_ior_xor): Do not treat
TARGET_ZBKB as sufficient for single-bit immediate IOR/XOR.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr124818.c: New test.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
26 hours agovect: replace vect_scalar_cost_multiplier with param_vect_allow_possibly_not_worthwhi...
Tamar Christina [Thu, 9 Apr 2026 08:27:15 +0000 (09:27 +0100)] 
vect: replace vect_scalar_cost_multiplier with param_vect_allow_possibly_not_worthwhile_vectorizations

The parameter vect_scalar_cost_multiplier was added in order to make it possible
to apply a scaling factor to the cost of a scalar loop in order to make
vectorization more or less profitable.

However because of the way the costing currently works, increasing the cost of a
scalar loop does not always result in vectorization because in some cases when
the cost of vectorization is very low we switch to looking at only the cost of
the epilog and prologs.

One case where this fell apart was uncounted loops.  As a result this patch
replaces the parameter with
param_vect_allow_possibly_not_worthwhile_vectorizations which just ignores the
result of costing.

gcc/ChangeLog:

* doc/params.texi: Replace param_vect_scalar_cost_multiplier with
param_vect_allow_possibly_not_worthwhile_vectorizations
* params.opt: Likewise.
* config/aarch64/aarch64.cc (aarch64_override_options_internal):
Likewise.
* config/riscv/riscv.cc (riscv_override_options_internal): Likewise.
* tree-vect-loop.cc (vect_estimate_min_profitable_iters): Likewise.
* tree-vect-slp.cc (vect_bb_vectorization_profitable_p): Likewise.
(vect_slp_region): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/cost_model_16.c: Updated.
* gcc.target/aarch64/sve/cost_model_19.c: New test.

27 hours agotestsuite: i386: Restrict gcc.target/i386/pr124759.c to Linux
Rainer Orth [Thu, 9 Apr 2026 08:02:18 +0000 (10:02 +0200)] 
testsuite: i386: Restrict gcc.target/i386/pr124759.c to Linux

The new gcc.target/i386/pr124759.c test FAILs on Solaris/x86:

FAIL: gcc.target/i386/pr124759.c (test for excess errors)
UNRESOLVED: gcc.target/i386/pr124759.c compilation failed to produce executable

With the native assembler, there's

Assembler: pr124759.c
        "/var/tmp//cc86OTka.s", line 8 : Illegal mnemonic
        Near line: "    endbr32"
        "/var/tmp//cc86OTka.s", line 8 : Syntax error
        Near line: "    endbr32"

while even with gas there's also

Excess errors:
cc1: warning: '-fhardened' not supported for this target

Therefore this patch restricts the test to Linux, matching
gcc.target/i386/fhardened-1.c.

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

2026-04-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.target/i386/pr124759.c (dg-do): Restrict to Linux.

33 hours agoifcvt: reject use of ctrap post reload [PR 105192]
Xi Ruoyao [Mon, 6 Apr 2026 20:03:09 +0000 (04:03 +0800)] 
ifcvt: reject use of ctrap post reload [PR 105192]

The ctrap expanders of several targets can end up creating pseudos.  And
it would be really counter-intuitive to disallow a define_expand to
generate pseudos.  So don't invoke the expander post reload.

PR target/105192

gcc/

* ifcvt.cc (find_if_header): Don't attempt to use ctrap expander
after reload.

gcc/testsuite/

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

34 hours agoDaily bump.
GCC Administrator [Thu, 9 Apr 2026 00:16:29 +0000 (00:16 +0000)] 
Daily bump.

40 hours agofortran: Fix false explicit-interface-required for ENTRY with volatile [PR96986]
Christopher Albert [Sun, 29 Mar 2026 19:52:37 +0000 (21:52 +0200)] 
fortran: Fix false explicit-interface-required for ENTRY with volatile [PR96986]

When resolving a call to an ENTRY procedure, the entry lookup that
replaces the master procedure's def_sym with the specific entry symbol
was inside the 'resolved != -1' block.  During recursive resolution the
namespace is marked resolved == -1, so the lookup was skipped and the
explicit interface check used the master procedure's combined formal
argument list instead of the entry's own formals.

Move the entry lookup after the resolution block so it runs regardless
of the namespace resolution state.

PR fortran/96986

gcc/fortran/ChangeLog:

* resolve.cc (resolve_global_procedure): Move entry symbol
lookup outside the resolved != -1 block.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr96986.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
41 hours agoUpdate gcc zh_CN.po
Joseph Myers [Wed, 8 Apr 2026 17:15:09 +0000 (17:15 +0000)] 
Update gcc zh_CN.po

* zh_CN.po: Update.

42 hours agolibphobos: Skip libphobos.shared/finalize.d etc. on Solaris [PR88150]
Rainer Orth [Wed, 8 Apr 2026 16:38:07 +0000 (18:38 +0200)] 
libphobos: Skip libphobos.shared/finalize.d etc. on Solaris [PR88150]

Three libphobos tests currently FAIL on Solaris:

FAIL: libphobos.shared/finalize.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/load.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/load_13414.d -shared-libphobos -ldl execution test

As discussed in PR d/88150, those tests cannot work with refCounted =
false in gcc.sections.elf.handleForName.

Because the test names include additional options, the file name needs
to be extracted first before matching against libphobos_skip_tests.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

2026-04-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libphobos:
PR d/88150
* testsuite/lib/libphobos.exp (libphobos_skipped_test_p): Extract
filename from $test.
* testsuite/libphobos.shared/shared.exp (libphobos_skip_tests):
Skip libphobos.shared/finalize.d etc. on Solaris.

43 hours agoc++/reflection: ICE with invalid splice in member access expr [PR123726]
Marek Polacek [Wed, 18 Mar 2026 17:48:40 +0000 (13:48 -0400)] 
c++/reflection: ICE with invalid splice in member access expr [PR123726]

This patch fixes a crash on invalid code.  In a class member access
with a splice, the splice cannot designate something that is not
a member of the object we're accessing.  check_splice_expr could also
detect more invalid splices, such as accessing a class template or
alias template member with . or ->.

PR c++/123726

gcc/cp/ChangeLog:

* reflect.cc (check_splice_expr): Detect accessing a class template
or alias template with . or ->.
* typeck.cc (finish_class_member_access_expr): Check if the scope of
the spliced entity in a member access expression is of a class type.
Allow variable_template_p for context_for_name_lookup.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/member1.C: Adjust dg-error.
* g++.dg/reflect/member22.C: New test.

Co-authored-by: Boris Staletic <boris.staletic@protonmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
43 hours agoc++/reflection: spurious error with constrained return types [PR124457]
Marek Polacek [Tue, 31 Mar 2026 20:52:10 +0000 (16:52 -0400)] 
c++/reflection: spurious error with constrained return types [PR124457]

Here we are emitting a bogus error in get_reflection because it
got something for which is_auto was true: the constrained auto
coming from make_constrained_auto.  We represent the
return-type-requirement as a constrained auto which is in fact
a placeholder, but in this case we don't want the error.

We can move the error from get_reflection to the parser to avoid
emitting the error.

PR c++/124457

gcc/cp/ChangeLog:

* parser.cc (cp_parser_reflect_expression): Check is_auto here
instead of...
* reflect.cc (get_reflection): ...here.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/concept1.C: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
44 hours agoc++/reflection: allow fns/arrays as annotation values [PR124177]
Marek Polacek [Wed, 18 Mar 2026 21:51:35 +0000 (17:51 -0400)] 
c++/reflection: allow fns/arrays as annotation values [PR124177]

With an annotation like [[=func]] gcc ends up calling
handle_annotation_attribute with TREE_VALUE (args) being
a VIEW_CONVERT_EXPR, whose type is a FUNCTION_TYPE.  That kind of
annotation value should be decayed before checking if the type is
structural.

PR c++/124177

gcc/cp/ChangeLog:

* tree.cc (handle_annotation_attribute): Decay annotation
values.  Turn if !type_dependent_expression_p into an assert.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/annotations18.C: New test.

Co-authored-by: Boris Staletic <boris.staletic@protonmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
45 hours agoc++: gcc_assert(false) replaced with gcc_unreachable()
Yang Kun [Wed, 8 Apr 2026 13:41:16 +0000 (15:41 +0200)] 
c++: gcc_assert(false) replaced with gcc_unreachable()

gcc/cp/ChangeLog:
* pt.cc (tsubst_expr): Use gcc_unreachable, not gcc_assert.
* parser.cc (cp_parser_template_id): Likewise.
* reflect.cc (eval_template_of): Likewise.

Signed-off-by: Yang Kun <yangkun@disroot.org>
45 hours agoc++/reflection: Fix missing return before throw_exception
Yang Kun [Wed, 8 Apr 2026 13:38:31 +0000 (15:38 +0200)] 
c++/reflection: Fix missing return before throw_exception

gcc/cp/ChangeLog:
* reflect.cc (eval_current_function): Add missing return.
(eval_current_class): Likewise.

Signed-off-by: Yang Kun <yangkun@disroot.org>
45 hours agoc++/reflection: Fix wrong function name in error messages
Yang Kun [Wed, 8 Apr 2026 13:38:02 +0000 (15:38 +0200)] 
c++/reflection: Fix wrong function name in error messages

gcc/cp/ChangeLog:
* reflect.cc (eval_display_string_of): Fix copy-paste error in exception
messages.

Signed-off-by: Yang Kun <yangkun@disroot.org>
45 hours agoc++, openmp: Fix copy-paste bug wrote to incrv instead of orig_declv
Jakub Jelinek [Wed, 8 Apr 2026 13:37:09 +0000 (15:37 +0200)] 
c++, openmp: Fix copy-paste bug wrote to incrv instead of orig_declv

gcc/cp/ChangeLog:
* parser.cc (cp_parser_omp_loop_nest): Write orig_declv, not incrv.

Signed-off-by: Yang Kun <yangkun@disroot.org>
45 hours agoc++, openmp: Fix wrong error messages
Yang Kun [Wed, 8 Apr 2026 13:36:27 +0000 (15:36 +0200)] 
c++, openmp: Fix wrong error messages

Error messages wrongly said "invalid depend kind"

gcc/cp/ChangeLog:
* parser.cc (cp_parser_omp_clause_proc_bind): Fix error message
(cp_parser_omp_clause_device_type): Likewise.

Signed-off-by: Yang Kun <yangkun@disroot.org>
46 hours agoc++/reflection: static memfn templs of class templs [PR124617]
Marek Polacek [Fri, 27 Mar 2026 21:54:17 +0000 (17:54 -0400)] 
c++/reflection: static memfn templs of class templs [PR124617]

Here meta::extract either wrongly throws or we crash.  The problem is
that it got a partial specialization, with which it can't do much.

When we have

  template <class F>
  struct S {
      template <int I>
      static constexpr int visit(F&&) { return 42; }

      static constexpr std::meta::info fptrs = ^^visit<0>;
  };

and do get_reflection -> resolve_nondeduced_context for ^^visit<0>,
we should already have substituted F, otherwise we only substitute
I with 0 and are left with a partial specialization.  F should have
been substituted in tsubst_expr/REFLECT_EXPR, but the reflection is

  REFLECT_EXPR<TEMPLATE_ID_EXPR<OVERLOAD, 0>>

and tsubst_expr doesn't do much with an OVERLOAD.  This thing should
be

  REFLECT_EXPR<BASELINK<TEMPLATE_ID_EXPR<OVERLOAD, 0>>>

so that we go to tsubst_baselink and properly substitute the
TEMPLATE_DECL in the OVERLOAD.

cp_parser_reflect_expression doesn't call finish_id_expression which
would add the BASELINK for reason mentioned in the comment there.  So
I think we can do the following: just call baselink_for_fns to create
the BASELINK if needed.

PR c++/124617

gcc/cp/ChangeLog:

* parser.cc (cp_parser_reflect_expression): Call baselink_for_fns.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/dep12.C: New test.
* g++.dg/reflect/dep13.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
47 hours agotree-optimization/124810 - ICE with loop fixup
Richard Biener [Wed, 8 Apr 2026 07:27:41 +0000 (09:27 +0200)] 
tree-optimization/124810 - ICE with loop fixup

The following fixes fix_loop_placements to properly consider
re-parenting only outer loops of a nest.

PR tree-optimization/124810
* cfgloopmanip.cc (fix_loop_placements): Do not stop
iterating when an inner loop didn't get re-parented.
Compute the outermost loop we have to consider re-parenting.

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

47 hours agolibstdc++: Remove non_type and replace it with constant_wrapper in function_ref
Matthias Kretz [Tue, 11 Nov 2025 15:27:34 +0000 (16:27 +0100)] 
libstdc++: Remove non_type and replace it with constant_wrapper in function_ref

This implements P3948R1: constant_wrapper is the only tool needed
for passing constant expressions via function arguments.

This changes function_ref from nontype_t to constant_wrapper and
implements the ambiguity check (static_asert in function_ref
from constant_wrapper constructor).

In addition to P3948R1 this also includes the (forgotten) deduction
guide changes suggested in the draft PR [1].

[1] https://github.com/cplusplus/draft/pull/8878

libstdc++-v3/ChangeLog:

* include/bits/funcref_impl.h (function_ref::function_ref):
Change nontype_t parameter to constant_wrapper, and adjust
accordingly. Add static_assert detecting ambigous semantics.
(function_ref::operator=): Detect constant_wrapper rather than
nontype_t.
* include/bits/funcwrap.h (function_ref): Change nontype_t
parameter to constant_wrapper in deduction guides.
* include/bits/utility.h (std::nontype_t, std::nontype)
(std::__is_nontype_v): Remove.
(std::__is_constant_wrapper_v): Define.
* src/c++23/std.cc.in (std::nontype_t, std::nontype):
Remove exports.
* testsuite/20_util/function_ref/cw_cons_neg.cc: New tests
for ambiguity check.
* testsuite/20_util/function_ref/assign.cc: Replace nontype_t
with constant_wrapper and nontype with std::cw.
* testsuite/20_util/function_ref/call.cc: Likewise.
* testsuite/20_util/function_ref/cons.cc: Likewise.
* testsuite/20_util/function_ref/cons_neg.cc: Likewise.
* testsuite/20_util/function_ref/dangling.cc: Likewise.
* testsuite/20_util/function_ref/deduction.cc: Likewise.
* testsuite/20_util/function_ref/mutation.cc: Likewise.

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 days agotestsuite: /dev/null is not accessible on Windows
Torbjörn SVENSSON [Tue, 7 Apr 2026 07:57:47 +0000 (09:57 +0200)] 
testsuite: /dev/null is not accessible on Windows

Using same approach as in r13-3079-g5fe2e4f87e5124.

gcc/testsuite/ChangeLog:

* g++.dg/modules/modules.exp: Use "@nul" for Windows,
"@/dev/null" for other environments.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 days agofortran: Fix ICE in gfc_trans_auto_array_allocation with scalar coarray [PR93715]
Christopher Albert [Sun, 29 Mar 2026 18:52:26 +0000 (20:52 +0200)] 
fortran: Fix ICE in gfc_trans_auto_array_allocation with scalar coarray [PR93715]

A scalar coarray variable (e.g. integer :: b[*]) used in asynchronous
I/O causes an ICE in gfc_trans_auto_array_allocation because the
variable reaches gfc_trans_auto_array_allocation which asserts
GFC_ARRAY_TYPE_P on the backend declaration type.  For scalar coarrays,
the backend type is a plain scalar, not a GFC array type.

The root cause is in gfc_trans_deferred_vars: scalar coarray variables
enter the AS_EXPLICIT case because sym->attr.codimension is set and the
coarray spec type is AS_EXPLICIT.  The existing guard for static coarray
variables does not catch non-static scalar coarrays, so they fall
through to gfc_trans_auto_array_allocation.

Add a check for scalar coarrays (codimension without dimension) to skip
array allocation, since these variables have no array rank and do not
need auto array allocation.

2026-04-08  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/93715

gcc/fortran

* trans-decl.cc (gfc_trans_deferred_vars): Skip auto array
allocation for scalar coarrays.

gcc/testsuite

* gfortran.dg/pr93715.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 days agolibstdc++: Move constant_wrapper from <type_traits> to <utility>
Tomasz Kamiński [Tue, 7 Apr 2026 11:19:20 +0000 (13:19 +0200)] 
libstdc++: Move constant_wrapper from <type_traits> to <utility>

Change placement of constant_wrapper and related classes per
P3978R3: constant_wrapper should unwrap on call and subscript.

libstdc++-v3/ChangeLog:

* include/bits/utility.h (std::_CwFixedValue, std::_ConstExprParam)
(std::_CwOperators, std::constant_wrapper): Moved from...
* include/std/type_traits (std::_CwFixedValue, std::_ConstExprParam)
(std::_CwOperators, std::constant_wrapper): Moved to bits/utility.h.
Disable __cpp_lib_constant_wrapper defintion.
* include/std/utility: Define __cpp_lib_constant_wrapper.
* testsuite/20_util/constant_wrapper/adl.cc: Updated header includes.
* testsuite/20_util/constant_wrapper/ex.cc: Likewise.
* testsuite/20_util/constant_wrapper/generic.cc: Likewise.
* testsuite/20_util/constant_wrapper/instantiate.cc: Likewise.
* testsuite/20_util/constant_wrapper/op_comma_neg.cc: Likewise.
* testsuite/20_util/constant_wrapper/other_wrappers.cc: Likewise.
* testsuite/20_util/constant_wrapper/version.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 days ago[auto-profile] Improve handling of timestamp merging.
Prathamesh Kulkarni [Wed, 8 Apr 2026 05:56:12 +0000 (05:56 +0000)] 
[auto-profile] Improve handling of timestamp merging.

The following condition:
if (other->timestamp() < timestamp())
  set_timestamp (other->timetamp())

would set timestamp() to 0 if other->timestamp() was zero effectively
dropping the symbol from time-profile based reordering.
The patch fixes this by ensuring other->timestamp() is greater than zero.

Also, handles the case when timestamp() is zero but other->timestamp() is non-zero.

gcc/ChangeLog:
* auto-profile.cc (function_instance::merge): Set other->timestamp() if it's
lesser than timestamp() and greater than zero or if timestamp() is zero.

Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
2 days agoc++, libstdc++: Remove is_consteval_only* traits
Jakub Jelinek [Wed, 8 Apr 2026 05:50:45 +0000 (07:50 +0200)] 
c++, libstdc++: Remove is_consteval_only* traits

The following patch implements LWG4555.

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

gcc/cp/
* constraint.cc (diagnose_trait_expr): Remove CPTK_IS_CONSTEVAL_ONLY
handling.
* metafns.gperf (enum metafn_code): Remove
METAFN_IS_CONSTEVAL_ONLY_TYPE.
(is_consteval_only_type): Remove.
* semantics.cc (trait_expr_value, finish_trait_expr): Remove
CPTK_IS_CONSTEVAL_ONLY handling.
* cp-trait.def (__builtin_is_consteval_only): Remove.
* metafns.h: Regenerate.
* reflect.cc (eval_is_consteval_only_type): Remove.
(process_metafunction): Don't handle METAFN_IS_CONSTEVAL_ONLY_TYPE.
gcc/testsuite/
* g++.dg/reflect/is_consteval_only1.C: Remove.
* g++.dg/reflect/eh1.C: Remove is_consteval_only_type tests.
* g++.dg/reflect/eh2.C: Likewise.
* g++.dg/reflect/type_trait5.C: Likewise.
libstdc++-v3/
* include/std/type_traits (std::is_consteval_only,
std::is_consteval_only_v): Remove.
* include/std/meta (std::meta::is_consteval_only_type): Remove.
* src/c++23/std.cc.in: Don't export std::is_consteval_only,
std::is_consteval_only_v and std::meta::is_consteval_only_type.
* testsuite/20_util/is_consteval_only/requirements/explicit_instantiation.cc:
Remove.
* testsuite/20_util/is_consteval_only/requirements/typedefs.cc:
Remove.
* testsuite/20_util/is_consteval_only/value.cc: Remove.
* testsuite/20_util/variable_templates_for_traits.cc: Remove
is_consteval_only_v tests.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2 days agoc++: Implement CWG3135 - constexpr structured bindings with prvalues from tuples
Jakub Jelinek [Wed, 8 Apr 2026 05:46:38 +0000 (07:46 +0200)] 
c++: Implement CWG3135 - constexpr structured bindings with prvalues from tuples

The following patch implements another CWG issue, added e.g. for the
P1789R3 (Library Support for Expansion Statements) APIs where get returns
a prvalue rather than a reference.

While the issue has been voted as a non-DR, this implementation assumes it
will be changed to a DR.  If that won't be the case, we will need to limit
the changes to C++26 and later only.

The gomp testcase was using get returning prvalue and the changes
cause some changes in lines on which stuff is reported.

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

* decl.cc (cp_finish_decomp): Implement CWG3135 - constexpr structured
bindings with prvalues from tuples (as a DR).  Don't call
cp_build_reference_type if init is prvalue.

* g++.dg/cpp26/decomp30.C: New test.
* g++.dg/gomp/pr108503.C: Adjust expected diagnostic locations.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agolibphobos: Skip math.hardware unittests on targets without IEEE flags support [PR123202]
Iain Buclaw [Fri, 3 Apr 2026 09:35:50 +0000 (11:35 +0200)] 
libphobos: Skip math.hardware unittests on targets without IEEE flags support [PR123202]

PR d/123202

libphobos/ChangeLog:

* testsuite/lib/libphobos.exp
(check_effective_target_phobos_ieee_flags_support): New proc.
* testsuite/libphobos.phobos/phobos.exp: Skip math/hardware.d tests if
target does not have phobos_iee_flags_support.
* testsuite/libphobos.phobos/shared/phobos-shared.exp: Likewise.
* testsuite/libphobos.phobos/static/phobos-static.exp: Likewise.

2 days agoDaily bump.
GCC Administrator [Wed, 8 Apr 2026 00:16:31 +0000 (00:16 +0000)] 
Daily bump.

2 days agofortran: Reject array/allocatable LINEAR on DO [PR102430]
Christopher Albert [Sat, 20 Dec 2025 23:33:11 +0000 (00:33 +0100)] 
fortran: Reject array/allocatable LINEAR on DO [PR102430]

The middle-end does not implement array/allocatable LINEAR for OpenMP
worksharing loops, which can ICE during OpenMP expansion.  Diagnose this
case in the Fortran front end with a sorry message instead.

PR fortran/102430

gcc/fortran/ChangeLog:

* openmp.cc (resolve_omp_clauses): Reject array/allocatable LINEAR on
worksharing-loop constructs.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/pr102430.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 days agoCorrect x86: Call ix86_access_stack_p only for larger alignment
H.J. Lu [Fri, 3 Apr 2026 07:55:17 +0000 (15:55 +0800)] 
Correct x86: Call ix86_access_stack_p only for larger alignment

commit f511bf93f947199a9f9099fee87b7052e5515fb9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Mar 29 14:30:28 2026 -0700

    x86: Call ix86_access_stack_p only for larger alignment

has 2 issues:

1. It didn't exclude memory with SYMBOLIC_CONST when checking for stack
access.
2. It replaced:

  HARD_REG_SET hard_stack_slot_access = stack_slot_access;
  ...
      bool symbolic_const_load_p = false;

      if (!TEST_HARD_REG_BIT (hard_stack_slot_access, regno))
...
        symbolic_const_load_p = true;
      ...

      if (!symbolic_const_load_p
          || ix86_access_stack_p...)
call ix86_update_stack_alignment.

with

      if (ix86_need_alignment_p...
          && ix86_access_stack_p...)
call ix86_update_stack_alignment.

Since ix86_access_stack_p excludes registers on hard_stack_slot_access,
stack alignment isn't updated for registers on hard_stack_slot_access.
Instead, we should do

      if (ix86_need_alignment_p...
          && (TEST_HARD_REG_BIT (hard_stack_slot_access, regno)
              || ix86_access_stack_p...))
        call ix86_update_stack_alignment.

The compile times of PR target/124165 and PR target/124684 test are
unchanged.

      if (ix86_need_alignment_p...
          && (TEST_HARD_REG_BIT (hard_stack_slot_access, regno)
      || ix86_access_stack_p...))
call ix86_update_stack_alignment.

gcc/

PR target/124759
PR target/124789
* config/i386/i386.cc (ix86_need_alignment_p_2): New function.
Exclude memory with SYMBOLIC_CONST.
(ix86_need_alignment_p_1): Call ix86_need_alignment_p_2.
(ix86_find_max_used_stack_alignment): Restore
hard_stack_slot_access handling.

gcc/testsuite/

PR target/124759
PR target/124789
* gcc.target/i386/pr124759.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 days agoUpdate x86: Call ix86_access_stack_p only for larger alignment
H.J. Lu [Tue, 7 Apr 2026 10:12:27 +0000 (18:12 +0800)] 
Update x86: Call ix86_access_stack_p only for larger alignment

commit f511bf93f947199a9f9099fee87b7052e5515fb9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Mar 29 14:30:28 2026 -0700

    x86: Call ix86_access_stack_p only for larger alignment

incorrectly uses GET_MODE_ALIGNMENT as memory alignment since memory
alignment can be different from mode alignment as in

(set (reg:OI 20 xmm0 [orig:112 s ] [112])
     (mem/c:OI (plus:DI (reg/f:DI 7 sp)
            (const_int -32 [0xffffffffffffffe0])) [3 s+0 S32 A128]))

MEM_ALIGN should be used instead.

* config/i386/i386.cc (ix86_need_alignment_p_1): Replace
GET_MODE_ALIGNMENT with MEM_ALIGN.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 days agofortran: Fix encoding value when file/unit opened without specifying.
Jerry DeLisle [Tue, 7 Apr 2026 00:55:21 +0000 (17:55 -0700)] 
fortran: Fix encoding value when file/unit opened without specifying.

When a file or unit is connected as a formatted I/O and the OPEN
statement does not set the ENCODING it is set to DEFAULT.

PR libfortran/124543

libgfortran/ChangeLog:

* io/inquire.c (inquire_via_unit): Change the returned
encoding value to 'DEFAULT' when not specified in the OPEN
statement.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr124543.f90: Add the dg-options "-O0" to
reduce testing time. Adjust test for the change above.

2 days agoUpdate gcc sv.po, zh_CN.po
Joseph Myers [Tue, 7 Apr 2026 18:06:58 +0000 (18:06 +0000)] 
Update gcc sv.po, zh_CN.po

* sv.po, zh_CN.po: Update.

2 days agoUpdate cpplib sr.po
Joseph Myers [Tue, 7 Apr 2026 18:00:56 +0000 (18:00 +0000)] 
Update cpplib sr.po

* sr.po: Update.

2 days agotree-optimization/124802 - wrong SLP pattern detection
Richard Biener [Tue, 7 Apr 2026 13:33:07 +0000 (15:33 +0200)] 
tree-optimization/124802 - wrong SLP pattern detection

We have some permute SLP nodes which still have a SLP_TREE_REPRESENTATIVE,
so make sure we're not facing a permute note when trying to perform
SLP pattern matching.

PR tree-optimization/124802
* tree-vect-slp-patterns.cc (vect_match_expression_p): Fail
for SLP_TREE_PERMUTE_P.

* gcc.dg/vect/vect-pr124802.c: New testcase.

2 days agolibstdc++: Export explicit instantiations for C++20 members of std::string
Tomasz Kamiński [Wed, 1 Apr 2026 12:32:21 +0000 (14:32 +0200)] 
libstdc++: Export explicit instantiations for C++20 members of std::string

The C++20 standard added new starts_with and ends_with members to
std::basic_string, which were not previously instantiated in the library.
This meant that the extern template declarations had to be disabled for
C++20 mode. With this patch the new members are instantiated in the
library and so the explicit instantiation declarations can be used for
C++20.

Furthermore, basic_string default constructor is now constrained with
is_default_constructible_v<_Alloc> constrains, that is included in
mangled name, so we also need to instantiate and export it.

The new members added by C++23 are still not exported, and so the
explicit instantiation declarations are still disabled for C++23.

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu.ver (GLIBCXX_3.4): Make string exports
less greedy.
(GLIBCXX_3.4.35): Export basic_string default constructor and
starts_with and ends_with members.
* include/bits/basic_string.h: Update __cpluplus checks for C++20.
* include/bits/cow_string.h: Likewise.
* include/bits/basic_string.tcc: Declare explicit instantiations
for C++20 as well as earlier dialects.
* src/c++20/Makefile.am: Add cow-string-inst.cc and
string-inst.cc source files.
* src/c++20/Makefile.in: Regenerate.
* src/c++20/string-inst.cc: New file defining explicit
instantiations for basic_string default constructor and starts_with,
ends_with methods added in C++20
* src/c++20/cow-string-inst.cc: Version of above for cow-stings.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 days agofortran: Fix ICE in gfc_conv_array_initializer with invalid index [PR103367]
Christopher Albert [Sun, 29 Mar 2026 20:18:43 +0000 (22:18 +0200)] 
fortran: Fix ICE in gfc_conv_array_initializer with invalid index [PR103367]

An undefined variable used as an array index in a parameter initializer
expression reaches gfc_conv_array_initializer after parameter substitution
with an unexpected expression type, hitting gcc_unreachable().

Guard against unexpected expression types by returning a zero-filled
constructor, since the frontend has already diagnosed the error.

PR fortran/103367

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_conv_array_initializer): Return empty
constructor for unexpected expression types after parameter
substitution.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr103367.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 days agolibstdc++: Make constexpr-if actually disable some tests [PR124722]
Matthias Kretz [Tue, 7 Apr 2026 10:15:10 +0000 (12:15 +0200)] 
libstdc++: Make constexpr-if actually disable some tests [PR124722]

libstdc++-v3/ChangeLog:

PR libstdc++/124722
* testsuite/std/simd/traits_impl.cc (test): Make test() a
function template and instantiate it.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
2 days agofortran: Add testcase [PR104827]
Christopher Albert [Tue, 10 Mar 2026 23:26:14 +0000 (00:26 +0100)] 
fortran: Add testcase [PR104827]

The reproducer from the bug report now gives a proper error on current
trunk instead of an ICE.  Add a testcase to prevent future regressions.

PR fortran/104827

gcc/testsuite/ChangeLog:

PR fortran/104827
* gfortran.dg/gomp/pr104827.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 days agodoc, sanitizer: Document -static-libhwasan [PR124170]
Sandra Loosemore [Mon, 6 Apr 2026 23:44:16 +0000 (23:44 +0000)] 
doc, sanitizer: Document -static-libhwasan [PR124170]

gcc/ChangeLog
PR sanitizer/124170
* doc/invoke.texi (Option Summary) <Linker Options>: Add
-static-libhwasan and fix alphabetization of similar options.
(Link Options): Likewise.
* common.opt.urls: Regenerated.

2 days agodoc: Make regenerate-opt-urls.py handle two-dash options [PR124784]
Sandra Loosemore [Sun, 5 Apr 2026 17:09:37 +0000 (17:09 +0000)] 
doc: Make regenerate-opt-urls.py handle two-dash options [PR124784]

I was puzzled as to why the generated config/picolib.opt.urls
contained no entries.  It turns out this was a general problem with
regenerate-opt-urls.py failing to handle options starting with two dashes,
which are listed with one dash in the .opt file but zero dashes (same as
one-dash options) in the index entries.  The solution here is to remove one
of the dashes when canonicalizing the option name for lookup in the index.

gcc/ChangeLog
PR other/124784
* regenerate-opt-urls.py (canonicalize_option_name):  Remove one
of the dashes from option names starting with two dashes.
(test_parse_option_index): Add a self-test for this.
* common.opt.urls: Regenerated.
* config/picolibc.opt.urls: Regenerated.

gcc/ada/ChangeLog
PR other/124784
* gcc-interface/lang.opt.urls: Regenerated.

gcc/c-family/ChangeLog
PR other/124784
* c.opt.urls: Regenerated.

gcc/d/ChangeLog
PR other/124784
* lang.opt.urls: Regenerated.

gcc/fortran/ChangeLog
PR other/124784
* lang.opt.urls: Regenerated.

gcc/m2/ChangeLog
PR other/124784
* lang.opt.urls: Regenerated.

2 days agoc++: template-id typedef with lambda targ [PR123700]
Patrick Palka [Tue, 7 Apr 2026 16:28:44 +0000 (12:28 -0400)] 
c++: template-id typedef with lambda targ [PR123700]

A typedef to a template-id with a lambda targ must not be stripped by
strip_typedefs because it can cause the lambda to leak into a deeper
template context, which breaks substituting into the lambda later.
For example in the below testcases zero<inner> gets stripped to
zero<Type<[](auto) {}>>, and we end up substituting through this
lambda targ twice (with args {double} then {int}) even though the lambda
is from a depth-one template context.

This patch extends the existing lambda typedef handling in
dependent_opaque_alias_p (added by r15-3694 for decltype(lambda))
to also recognize such template-id typedefs.  This should recognize
the vast majority of such constructs in practice (though the lambda
could also be a subexpression within a template argument which this
won't recognize).

PR c++/123700

gcc/cp/ChangeLog:

* pt.cc (dependent_opaque_alias_p): Return true for a
template-id typedef with a lambda targ.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-targ24.C: New test.
* g++.dg/cpp2a/lambda-targ24a.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++: templated static local var has value-dep addr, cont [PR123529]
Patrick Palka [Tue, 7 Apr 2026 16:28:42 +0000 (12:28 -0400)] 
c++: templated static local var has value-dep addr, cont [PR123529]

has_value_dependent_address for a static local variable checks type
dependence of its context, but that's too narrow and we need a more
general dependence check that considers outer template arguments as
well, so that in the testcase below we deem A<T>::g()::i to have a
value-dependent address (making f<&i>() a dependent call).

PR c++/123529
PR c++/98930

gcc/cp/ChangeLog:

* pt.cc (has_value_dependent_address): Correct context
dependence check for a static local variable.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/nontype9.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++: Implement CWG3140 - Allowing expansion over non-constant std::array
Jakub Jelinek [Tue, 7 Apr 2026 16:13:55 +0000 (18:13 +0200)] 
c++: Implement CWG3140 - Allowing expansion over non-constant std::array

The following patch implements CWG3140, which allows non-constexpr
iterating expansion statements over non-constexpr ranges like std::array
where the range size is still known at compile time.
On the other side it breaks iterating expansion statements without constexpr
keyword on range-decl over ranges where to find out the range size the range
needs to be accessed.  In some cases one will have to just add the constexpr
keyword, in other cases even that doesn't have to work (e.g. when the
iterator is constexpr except for operator* or some non-constexpr conversion
operator is involved).

2026-04-07  Jakub Jelinek  <jakub@redhat.com>

* cp-tree.h: Implement C++26 CWG3140 - Allowing expansion over
non-constant std::array.
(cp_build_range_for_decls): Change last argument from bool to tree.
(build_range_temp): Likewise and default it to NULL_TREE rather than
false.
* parser.cc (build_range_temp): Remove expansion_stmt_p
argument, add expansion_stmt_decl.  Don't call cp_build_qualified_type
if expansion_stmt_decl was not declared constexpr.
(cp_build_range_for_decls): Remove expansion_stmt_p argument, add
expansion_stmt_decl.  Pass expansion_stmt_decl to build_range_temp.
Don't set TREE_STATIC, TREE_PUBLIC, DECL_COMMON, DECL_INTERFACE_KNOWN,
DECL_DECLARED_CONSTEXPR_P and TREE_READONLY on range_temp if
expansion_stmt_decl was not declared constexpr.  Don't call
cp_build_qualified_type on begin type nor set TREE_STATIC etc. on begin
if expansion_stmt_decl was not declared constexpr.  If
expansion_stmt_decl is non-NULL, don't build end at all, instead pass
begin_expr and end_expr in end_p[0] and end_p[1] to the caller.
(cp_convert_range_for): Adjust cp_build_range_for_decls caller.
* pt.cc (finish_expansion_stmt): Likewise.  Use begin_expr and end_expr
instead of begin and end variables from cp_build_range_for_decls,
make them non-constant and avoid spurious -Wunused-result/nodiscard
diagnostics.

* g++.dg/cpp26/expansion-stmt11.C: Expect some extra diagnostics for
C++11.
* g++.dg/cpp26/expansion-stmt13.C: Likewise.  Make it dg-do compile
test for c++11_only and dg-do run only for c++14 and above.
* g++.dg/cpp26/expansion-stmt16.C: Adjust expected diagnostics.
* g++.dg/cpp26/expansion-stmt19.C: Expect some extra diagnostics for
C++11.  Make it dg-do compile test for c++11_only and dg-do run only
for c++14 and above.
* g++.dg/cpp26/expansion-stmt25.C (foo): Test both constexpr
range-for-decl and non-constexpr, adjust expected diagnostics.
* g++.dg/cpp26/expansion-stmt30.C: Adjust expected diagnostics.
* g++.dg/cpp26/expansion-stmt35.C: New test.
* g++.dg/cpp26/expansion-stmt36.C: New test.
* g++.dg/cpp26/expansion-stmt37.C: New test.
* g++.dg/cpp26/expansion-stmt38.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++: Implement mangling for partially instantiated C++26 pack indexing [PR124487]
Jakub Jelinek [Tue, 7 Apr 2026 16:00:24 +0000 (18:00 +0200)] 
c++: Implement mangling for partially instantiated C++26 pack indexing [PR124487]

On Fri, Apr 03, 2026 at 05:56:08PM -0400, Jason Merrill wrote:
> Regarding the TODO, the related case I was thinking about was
>
> >   ::= sZ <template-param>     # sizeof...(T), size of a template parameter pack
> >   ::= sP <template-arg>* E    # sizeof...(T), size of a captured template parameter pack from an alias template
>
> ...but rather than follow the precedent of a different two-letter
> abbreviation, I might use J...E to express the expanded pack, as in
> <template-arg>.  I've now suggested that on the ABI issue, as well.

Here is a patch which implements it.

2026-04-07  Jakub Jelinek  <jakub@redhat.com>

PR c++/124487
* mangle.cc (write_type) <case PACK_INDEX_TYPE>: Handle even
the case of partially substituted pack.
(write_expression): Similarly for PACK_INDEX_EXPR.

* g++.dg/cpp26/pack-indexing9.C: Remove dg-sorry/dg-bogus, add
tests for mangled names and further test coverage.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++: Mark reflected vars/parameters as read [PR124790]
Jakub Jelinek [Tue, 7 Apr 2026 15:59:13 +0000 (17:59 +0200)] 
c++: Mark reflected vars/parameters as read [PR124790]

This PR complains about spurious -Wunused-but-set-* warnings when using
reflections.  E.g. there is no warning for variable just set and used in
sizeof (var), but there is one when using size_of (^^var).  If we reflect
some variable or parameter, we can do all kinds of things with it, so
setting preventing these warnings is IMHO desirable.

2026-04-07  Jakub Jelinek  <jakub@redhat.com>

PR c++/124790
* reflect.cc (get_reflection): When reflecting VAR_DECL or PARM_DECL,
call mark_exp_read on it.

* g++.dg/reflect/pr124790.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agofortran: Accept valid ENTRY specification expressions [PR85352]
Christopher Albert [Sat, 28 Mar 2026 16:04:12 +0000 (17:04 +0100)] 
fortran: Accept valid ENTRY specification expressions [PR85352]

Remember the dummy whose bounds or character length are currently being
resolved as a specification expression so sibling ENTRY arguments in the
same unresolved ENTRY can be accepted.

2026-04-07  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran

PR fortran/85352
* resolve.cc (specification_expr_symbol): New variable.
(entry_dummy_seen_p): Return whether a dummy appears in an already
seen ENTRY.
(gfc_resolve_formal_arglist): Remember the dummy whose specification
expressions are being resolved.
(resolve_variable): Accept unresolved sibling ENTRY dummy arguments
while resolving the current dummy's specification expressions.
(resolve_fl_variable): Preserve specification_expr_symbol.
(resolve_symbol_array_spec): Likewise.

gcc/testsuite

PR fortran/85352
* gfortran.dg/pr85352.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 days agomingw: Remove obsolete STMP_FIXINC override from t-cygming
Peter Damianov [Sun, 5 Apr 2026 00:41:04 +0000 (01:41 +0100)] 
mingw: Remove obsolete STMP_FIXINC override from t-cygming

The STMP_FIXINC assignment in t-cygming dates back to
r0-48723-g70e5e841b8b931, which introduced the shared cygwin/mingw
makefile fragment and used it to force fixincludes on for those
targets.

That predates r0-63200-g53c7ffe7dd1c28, which made configure default
STMP_FIXINC to stmp-fixinc, so the t-cygming assignment is now
redundant in normal builds.  Once --disable-fixincludes was added by
r13-2319-gbe9dd80f933480, the old override became incorrect as well,
because it forced stmp-fixinc back on for targets using t-cygming.
Configuring for mingw targets with --disable-fixincludes would then
fail with:

make[1]: No rule to make target
'../build-x86_64-pc-linux-gnu/fixincludes/fixinc.sh', needed by 'stmp-fixinc'.
Stop.

Remove the obsolete assignment so the configure-time default is used,
including when honoring an explicit --disable-fixincludes.

gcc/ChangeLog:

* config/mingw/t-cygming: Remove obsolete STMP_FIXINC
override.

3 days agotestsuite: cache various python3 effective target checks
Torbjörn SVENSSON [Tue, 7 Apr 2026 08:40:06 +0000 (10:40 +0200)] 
testsuite: cache various python3 effective target checks

There is no need to check the version of python multiple times in a
single run.  Cache the result and avoid the extra tool invocation.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_recent_python3): Cache result of check.
(check_effective_target_python3_module): Likewise.
(check_effective_target_pytest3): Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
3 days agotestsuite: arm: disable some gen-vect tests with MVE [PR124704]
Christophe Lyon [Thu, 2 Apr 2026 12:33:07 +0000 (12:33 +0000)] 
testsuite: arm: disable some gen-vect tests with MVE [PR124704]

Like we already do when Neon enablement does not need a compiler
option, return 0 when MVE is enabled by default.

For instance when checking for -march=armv8.1-m.main+mve.fp+fp.dp (or
-mcpu=cortex-m55), this makes the following tests UNSUPPORTED:

gcc.dg/tree-ssa/gen-vect-11.c
gcc.dg/tree-ssa/gen-vect-11a.c
gcc.dg/tree-ssa/gen-vect-11b.c
gcc.dg/tree-ssa/gen-vect-11c.c
gcc.dg/tree-ssa/gen-vect-2.c

and thus avoids
FAIL: gcc.dg/tree-ssa/gen-vect-11b.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/tree-ssa/gen-vect-11c.c scan-tree-dump-times vect "vectorized 0 loops" 1

This may be overkill Given that all the other tests mentioned above
PASS, but this is consistent with what we already do for Neon.

gcc/testsuite/ChangeLog:

PR target/124704
* lib/target-supports.exp
(check_effective_target_vect_cmdline_neeed): Handle arm_mve
similarly to arm_neon.

3 days agotree-optimization/124743 - SLP scheduling of invariant internal ops
Richard Biener [Wed, 1 Apr 2026 10:39:43 +0000 (12:39 +0200)] 
tree-optimization/124743 - SLP scheduling of invariant internal ops

The following makes us avoid scheduling invariant internal operations
to random points in the CFG when doing loop vectorization since
in that case the stmt UIDs we use for dominance checks are not
initialized outside of loop bodies.  Instead schedule such
operations by appending to the loop preheader which is where
invariants generally end up for loop vectorization.

PR tree-optimization/124743
* tree-vect-slp.cc (vect_schedule_slp_node): Schedule
loop invariant operations in the loop preheader.

* gcc.dg/vect/vect-pr124743.c: New testcase.

3 days agofortran: Fix ICE with implicit variable in iterator depend clause [PR107425]
Christopher Albert [Fri, 3 Apr 2026 15:50:05 +0000 (17:50 +0200)] 
fortran: Fix ICE with implicit variable in iterator depend clause [PR107425]

An implicitly typed variable used as a subscript in an OpenMP iterator
depend clause (e.g., x(j) where j is implicit and only referenced in
the clause) caused an ICE in gimplify_var_or_parm_decl because the
variable's decl was never associated with a BIND_EXPR.

The root cause is that gfc_match_iterator creates a block namespace
(via gfc_build_block_ns) for iterator variables.  When the locator
expression x(j) is parsed with gfc_current_ns set to this iterator
namespace, the implicit variable j is created there rather than in the
enclosing program namespace.  In gfc_finish_var_decl, the FL_LABEL
check for BLOCK constructs matched before the omp_affinity_iterators
check, routing j through add_decl_as_local.  Unlike real BLOCK
construct variables, these never get a proper BIND_EXPR, so the
gimplifier rejects them.

Fixed by checking for omp_affinity_iterators before the FL_LABEL
BLOCK construct check, and only treating actual iterator variables
(those on the omp_affinity_iterators chain) as block-local.  Other
variables in the iterator namespace are added to the enclosing
function scope.

2026-04-07  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/107425
* trans-decl.cc (gfc_finish_var_decl): Check for
omp_affinity_iterators namespace before FL_LABEL BLOCK check.
Only route actual iterator variables through add_decl_as_local;
add other variables to the enclosing function.

gcc/testsuite
PR fortran/107425
* gfortran.dg/gomp/pr107425.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
3 days agoFortran: Bugs found while testing r16-8436 [PR124780]
Paul Thomas [Sun, 5 Apr 2026 09:53:08 +0000 (10:53 +0100)] 
Fortran: Bugs found while testing r16-8436 [PR124780]

2026-04-07  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/124780
* resolve.cc (resolve_ordinary_assign): Do not add the class
data component to an operator expression.
* trans-expr.cc (gfc_trans_scalar_assign): If class to class
assignment uses ordinary scalar assignment and neither lhs or
rhs are class types, do a deep copy for allocatable components.

gcc/testsuite/
PR fortran/124780
* gfortran.dg/pr124780.f90: New test.

3 days agotestsuite: fork does not work for bare metal targets
Torbjörn SVENSSON [Tue, 24 Feb 2026 15:27:12 +0000 (16:27 +0100)] 
testsuite: fork does not work for bare metal targets

For an arm-none-eabi toolchain, at least built with newlib, the fork()
function exists, but it returns failure.  The implementation is part of
libnosys.a and is there only to allow linking (runtime failure).

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_fork_runtime): New function to
check that target has a working fork() implementation.
* lib/target-supports-dg.exp (dg-require-fork): When test is
"run", then call check_fork_runtime, else check_fork_available.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
3 days agoFortran: Fix ICE instantiating nested PDTs [PR124598]
Paul Thomas [Mon, 6 Apr 2026 14:02:15 +0000 (15:02 +0100)] 
Fortran: Fix ICE instantiating nested PDTs [PR124598]

2026-04-07  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/124598
* trans-expr.cc (gfc_conv_structure): Do not add parameterized
components to a structure constructor.

gcc/testsuite/
PR fortran/124598
* gfortran.dg/pdt_91.f03: New test.

3 days agors6000: Add new builtin __builtin_ppc_atomic_cas_local
Avinash Jayakar [Tue, 24 Mar 2026 04:29:02 +0000 (23:29 -0500)] 
rs6000: Add new builtin __builtin_ppc_atomic_cas_local

This patch adds a new powerpc specific atomic builtin which is similar
to the generic __atomic_compare_exchange builtin.

bool __builtin_ppc_atomic_cas_local (type *ptr, type *expected,
     type *desired, bool weak,
     int success_memorder,
     int failure_memorder)

It behaves like __atomic_compare_exchange(), but it uses an EH value of
1 in the larx (load-and-reserve) instruction. The new builtin helps
optimize lock contention on PowerPC by keeping the lock cacheline in
the local processor longer, reducing performance penalties from
cache coherence protocol traffic.

2026-04-07  Avinash Jayakar  <avinashd@linux.ibm.com>
    Surya Kumari Jangala  <jskumari@linux.ibm.com>

gcc/ChangeLog:

* config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Add
logic to handle __builtin_ppc_atomic_cas_local.
* config/rs6000/rs6000-builtins.def: New builtins for
__builtin_ppc_atomic_cas_local with types.
* config/rs6000/rs6000-c.cc (altivec_build_resolved_builtin):
Handle builtins with up to 6 arguments.
* config/rs6000/rs6000-overload.def: Overload builtin for
signed/unsiged char, short, int, long, __int128.
* config/rs6000/rs6000-protos.h (rs6000_expand_atomic_compare_and_swap):
Add additional parameter 'local' to the prototype.
* config/rs6000/rs6000.cc (emit_load_locked): Add new parameter. Pass
new parameter to generate load-locked instruction.
(rs6000_expand_atomic_compare_and_swap): Add new parameter. Call
emit_load_locked() with additional parameter value of EH bit.
(rs6000_expand_atomic_exchange): Pass EH value 0 to emit_load_locked().
(rs6000_expand_atomic_op): Likewise.
* config/rs6000/sync.md (load_locked<mode>): Add new operand in RTL
template. Specify EH bit in the larx instruction.
(load_locked<QHI:mode>_si): Likewise.
(load_lockedpti): Likewise.
(load_lockedti): Add new operand in RTL template. Pass EH bit to
gen_load_lockedpti().
(atomic_compare_and_swap<mode>): Pass new parameter 'false' to
rs6000_expand_atomic_compare_and_swap.
(atomic_compare_and_swap_local<mode>): New define_expand.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/acmp-tst.c: New test.

3 days agoDaily bump.
GCC Administrator [Tue, 7 Apr 2026 00:16:25 +0000 (00:16 +0000)] 
Daily bump.

3 days agoc++/modules: Allow exporting usings of internal GMF entities with pedwarn [PR124268]
Nathaniel Shead [Thu, 19 Mar 2026 12:58:30 +0000 (23:58 +1100)] 
c++/modules: Allow exporting usings of internal GMF entities with pedwarn [PR124268]

As discussed in libstdc++/124268, the std module relies on exporting
using-declarations for various entities, but on some targets the
relevant declarations have internal linkage.

Given we already support exposures of such internal linkage entities for
migration purposes, it seems reasonable to allow the same for
using-declarations.

PR libstdc++/124268

gcc/ChangeLog:

* doc/invoke.texi: Note that -Wexpose-global-module-tu-local
also applies to 'export using' declarations.

gcc/cp/ChangeLog:

* module.cc (instantiating_tu_local_entity): Use pedwarn instead
of warning.
(depset::hash::add_binding_entity): Don't skip exported
using-decls as TU-local entities.
(depset::hash::finalize_dependencies): Don't attempt to complain
again about using-decls referencing TU-local entities.
* name-lookup.cc (check_can_export_using_decl): Demote the error
to a warning for using-decls of GMF vars or functions.

gcc/testsuite/ChangeLog:

* g++.dg/modules/using-34_a.C: New test.
* g++.dg/modules/using-34_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++/modules: Handle importing an undeduced auto over a deduced auto [PR124735]
Nathaniel Shead [Sat, 4 Apr 2026 12:55:16 +0000 (23:55 +1100)] 
c++/modules: Handle importing an undeduced auto over a deduced auto [PR124735]

Like with implicit constexpr, we need to handle cases where we import an
function declaration with undeduced auto, but we already have a
definition available with deduced auto.  In this case we can just keep
the existing declaration's type.

PR c++/124735

gcc/cp/ChangeLog:

* module.cc (trees_in::is_matching_decl): Handle importing
undeduced auto when existing is already deduced.

gcc/testsuite/ChangeLog:

* g++.dg/modules/auto-8_a.H: New test.
* g++.dg/modules/auto-8_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++/modules: Only mark namespace-scope entities as exported [PR124781]
Nathaniel Shead [Sun, 5 Apr 2026 13:26:32 +0000 (23:26 +1000)] 
c++/modules: Only mark namespace-scope entities as exported [PR124781]

We call 'set_originating_module' before we call pushdecl, which means
that for function-scope entities we might not have set DECL_CONTEXT yet.
Usually this doesn't matter, we only look at DECL_MODULE_EXPORT/ATTACH_P
on namespace-scope entities to begin with, but in the case in the linked
PR it causes issues because declarations in an unevaluated lambda appear
to be in an internal context.

Fixed by only considering non-null DECL_CONTEXT as being namespace scope
within set_originating_module.

As a drive-by improvement, ensured that we only talk about unnamed
namespaces in the diagnostic within check_module_decl_linkage if we're
actually within an anonymous namespace; this should be equivalent but
will lead to a slightly clearer diagnostic if a similar bug crops up
again later.

PR c++/124781

gcc/cp/ChangeLog:

* module.cc (set_originating_module): Add a function comment,
only set attachment/exporting for entities with non-NULL
DECL_CONTEXT.
(check_module_decl_linkage): Use decl_anon_ns_mem_p instead of
decl_internal_context_p.

gcc/testsuite/ChangeLog:

* g++.dg/modules/export-7.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++/modules: Fix propagating noexcept for templates [PR124785]
Nathaniel Shead [Sun, 5 Apr 2026 14:34:33 +0000 (00:34 +1000)] 
c++/modules: Fix propagating noexcept for templates [PR124785]

We triggered a checking assertion because when propagating deduced
noexcept, we were updating the type of the existing TEMPLATE_DECL but
not the type of its DECL_TEMPLATE_RESULT, violating assumptions made
later on during modules streaming.

But actually there was nothing to propagate here anyway, these
declarations are identical, so this patch also fixes the condition for
checking whether we need to propagate anything.  And so now I don't
think there is ever a case we should have a noexcept-spec to propagate
for a TEMPLATE_DECL, so add an assertion to validate this.

PR c++/124785

gcc/cp/ChangeLog:

* module.cc (trees_in::is_matching_decl): Narrow condition for
when noexcept propagation occurs; assert that we don't propagate
noexcept-specs for TEMPLATE_DECLs.

gcc/testsuite/ChangeLog:

* g++.dg/modules/noexcept-5.h: New test.
* g++.dg/modules/noexcept-5_a.C: New test.
* g++.dg/modules/noexcept-5_b.C: New test.
* g++.dg/modules/noexcept-5_c.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++/modules: Fix entry-point detection for recursive clusters [PR118630]
Nathaniel Shead [Sun, 5 Apr 2026 15:56:28 +0000 (01:56 +1000)] 
c++/modules: Fix entry-point detection for recursive clusters [PR118630]

In r15-4861-g4a99443c5dd9a235022652ba0fb143c6370ea99d we added support
to handle recursive dependency clusters, where we need to find the
"entry" dependency that all other entities will hook off to ensure that
we stream merge keys in the correct order on read-in.

The logic I'd used to track the entry bit was not completely correct
however, leading to assertion failures in 'sort_cluster' where we found
that entities were not marked maybe_recursive when they should have
been, or multiple entities were marked as the entry point.

Consider a cycle of three entities in a cluster, 'A', 'B', and 'C',
where 'A' is the entry point.  By definition we walk into 'A' first, and
find one of the other entities, 'B'.  The old logic marked 'A' as the
entry and 'B' as maybe-recursive; so far this is correct.

But then if we walk into 'B' and find 'C' is maybe-recursive, the old
logic would mark 'B' as the entry point (again!).  And likewise when we
walk into 'C' and find 'A'.  So we would end up with three entry points.
Similar issues could happen with other arrangements of dependencies.

Instead, by aggressively marking everything we see as maybe-recursive,
and only marking an entry point if nothing we see is maybe-recursive, we
avoid this issue.  We should only be able to discover these other
entities through the entry point (A) and so this 'flood fill' behaviour
should ensure that all entities are correctly marked maybe-recursive,
and only A is marked as an entry-point.

PR c++/118630

gcc/cp/ChangeLog:

* module.cc (depset::hash::add_dependency): Correct entry point
corection for recursive clusters.

gcc/testsuite/ChangeLog:

* g++.dg/modules/late-ret-5.h: New test.
* g++.dg/modules/late-ret-5_a.H: New test.
* g++.dg/modules/late-ret-5_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++: Fix up handling of for-range-decls of expansion stmt [PR124488]
Jakub Jelinek [Mon, 6 Apr 2026 21:10:46 +0000 (23:10 +0200)] 
c++: Fix up handling of for-range-decls of expansion stmt [PR124488]

The following testcase is rejected, because we don't set all the needed
flags on range_decl in cp_parser_expansion_statement.  During parsing
of the expansion stmt body, it should be treated as if there is a decl
with value dependent initializer in a template, because the value it will
have is yet to be determined (and possibly different in each instantiation
of the body).
For such decls, cp_finish_decl normally conservatively sets
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (because it might be initialized
by constant expression) and for non-references also sets TREE_CONSTANT
if decl_maybe_constant_var_p.  Furthermore, those have a value dependent
initializer and DECL_DEPENDENT_INIT_P is set on those too.

The following patch arranges all of that for the range_decl.

2026-04-06  Jakub Jelinek  <jakub@redhat.com>

PR c++/124488
* parser.cc (cp_parser_expansion_statement): Set
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P, DECL_DEPENDENT_INIT_P and
if maybe constant non-reference TREE_CONSTANT on range_decl.
* pt.cc (tsubst_stmt) <case TEMPLATE_FOR_STMT>: Set
DECL_DEPENDENT_INIT_P on decl.

* g++.dg/cpp26/expansion-stmt33.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agoc++: Implement the annotations_of on parms part of P3795R2
Jakub Jelinek [Mon, 6 Apr 2026 21:08:48 +0000 (23:08 +0200)] 
c++: Implement the annotations_of on parms part of P3795R2

The current behavior of GCC is that we list all annotations gathered from
all the PARM_DECLs merged together on ^^fnparm or
variable_of (parameters_of (^^fn)[0]) and throw on annotations_of
on parameters_of (^^fn)[0].  The paper requires that the last one works
like we currently handle the former two, and for the former two we
filter out annotations that have not appeared on the function definition.

The following patch marks the annotations in grokfndecl before pushdecl
etc. merges it with other decls.

2026-04-06  Jakub Jelinek  <jakub@redhat.com>

* decl.cc (grokfndecl): For -freflection mark annotations of
PARM_DECLs in a function definition.
* reflect.cc (eval_annotations_of): Allow annotations_of on
function parameters.  For r which is a PARM_DECL without REFLECT_PARM,
filter out annotations not marked by grokfndecl.
(reflection_mangle_prefix): Preserve the grokfndecl marking of
annotations during mangling.

* g++.dg/reflect/annotations15.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agodoc: Rewrite Solaris section of install.texi for GCC 16
Rainer Orth [Mon, 6 Apr 2026 18:24:59 +0000 (20:24 +0200)] 
doc: Rewrite Solaris section of install.texi for GCC 16

The Solaris installation information in install.texi urgently needed a
rewrite.  It was highly repetitive, with information spread over both a
generic Solaris section and several separate ones for the different
configurations, and contained lots of cruft that's no longer relevant.

This patch merges all of them into a single Solaris section and attempts
a concise documentation of the requirements, configuration options and
quirks.

Tested on i386-pc-solaris2.11.

2026-03-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* doc/install.texi (Specific, amd64-*-solaris2*, i?86-*-solaris2*)
(sparc-sun-solaris2*, sparc64-*-solaris2*, sparcv9-*-solaris2*)
(x86_64-*-solaris2*): Remove.  Fold into ...
(Specific, *-*-solaris2*): ... this.
Rewrite.

3 days agolibstdc++: Require SSE2 for std::simd [PR124722]
Matthias Kretz [Sat, 4 Apr 2026 09:40:38 +0000 (11:40 +0200)] 
libstdc++: Require SSE2 for std::simd [PR124722]

Without SSE2 double precision uses excess precision, leading to test
failures. For now, std::simd remains a tech preview that simply is
disabled without SSE2.

libstdc++-v3/ChangeLog:

PR libstdc++/124722
* include/bits/version.def: Check for __SSE2__ rather than x86.
* include/bits/version.h: Regenerate.
* testsuite/std/simd/arithmetic.cc: Build with -msse2.
* testsuite/std/simd/arithmetic_expensive.cc: Likewise.
* testsuite/std/simd/creation.cc: Likewise.
* testsuite/std/simd/creation_expensive.cc: Likewise.
* testsuite/std/simd/loads.cc: Likewise.
* testsuite/std/simd/loads_expensive.cc: Likewise.
* testsuite/std/simd/mask.cc: Likewise.
* testsuite/std/simd/mask2.cc: Likewise.
* testsuite/std/simd/mask2_expensive.cc: Likewise.
* testsuite/std/simd/mask_expensive.cc: Likewise.
* testsuite/std/simd/reductions.cc: Likewise.
* testsuite/std/simd/reductions_expensive.cc: Likewise.
* testsuite/std/simd/shift_left.cc: Likewise.
* testsuite/std/simd/shift_left_expensive.cc: Likewise.
* testsuite/std/simd/shift_right.cc: Likewise.
* testsuite/std/simd/shift_right_expensive.cc: Likewise.
* testsuite/std/simd/simd_alg.cc: Likewise.
* testsuite/std/simd/simd_alg_expensive.cc: Likewise.
* testsuite/std/simd/sse_intrin.cc: Likewise.
* testsuite/std/simd/stores.cc: Likewise.
* testsuite/std/simd/stores_expensive.cc: Likewise.
* testsuite/std/simd/traits_common.cc: Likewise.
* testsuite/std/simd/traits_math.cc: Likewise.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
3 days agofortran: Clean up charlens after rejected parameter arrays [PR79524]
Christopher Albert [Fri, 3 Apr 2026 10:45:57 +0000 (12:45 +0200)] 
fortran: Clean up charlens after rejected parameter arrays [PR79524]

When a parameter array declaration such as
character(*), parameter :: z(2) = [character(n) :: 'x', 'y']
is rejected, declaration-local charlen nodes from that statement can remain on
cl_list and later be resolved again.  The charlen's length expression still
references the symbol 'n' whose symtree was already freed by gfc_undo_symbols,
causing a heap-use-after-free in resolve_charlen.

Clean up those statement-local charlens at the rejection point in decl.cc,
after clearing the surviving owners in that path.

PR fortran/79524

gcc/fortran/ChangeLog:

PR fortran/79524
* decl.cc (discard_pending_charlens): New helper.
(add_init_expr_to_sym): Drop statement-local charlens when
rejecting variable-length parameter arrays.
(variable_decl, do_parm, enumerator_decl): Save the current
namespace charlen list before parsing declarations with
initializers.
(match_procedure_decl): Adjust call to add_init_expr_to_sym.

gcc/testsuite/ChangeLog:

PR fortran/79524
* gfortran.dg/pr79524.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
3 days agoc++: Fix unary negation of nullptr [PR123087]
Eczbek [Mon, 6 Apr 2026 15:15:02 +0000 (11:15 -0400)] 
c++: Fix unary negation of nullptr [PR123087]

[expr.unary.op] paragraph 9 says that the operand is
contextually converted to bool, so this should be legal.

PR c++/123087

gcc/cp/ChangeLog:

* typeck.cc (cp_build_unary_op): For TRUTH_NOT_EXPR, replace
call to perform_implicit_conversion with call to
contextual_conv_bool.

gcc/testsuite/ChangeLog:

* g++.dg/DRs/dr1423.C: Additonal test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 days agotestsuite: Fix dg-do-if
Rainer Orth [Mon, 6 Apr 2026 12:25:36 +0000 (14:25 +0200)] 
testsuite: Fix dg-do-if

Tests that use dg-do-if ERROR when the target selector matches, e.g.

ERROR: gcc.dg/vect/vect-simd-clone-16f.c -flto -ffat-lto-objects: compile: syntax error for " dg-do-if 1 compile { target { sse2_runtime && { ! sse4_runtime } } } "

While the error message isn't particularly helpful, it's from dg.exp
(dg-do): like the other dg-* procs it expects the line number to be the
first argument.  However, dg-do-if strips that, so dg-do gets the target
selector instead of the expected action keyword.

Fixed by no longer stripping the line number.

Tested on amd64-pc-freebsd15.0 (sse2_runtime && !sse4_runtime),
i386-pc-solaris2.11 and x86_64-pc-linux-gnu (sse2_runtime &&
sse4_runtime).

2026-04-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* lib/target-supports-dg.exp (dg-do-if): Don't strip line number
from args.

4 days agoDaily bump.
GCC Administrator [Mon, 6 Apr 2026 00:16:22 +0000 (00:16 +0000)] 
Daily bump.

4 days agoc++: Error recovery for fuzzed <meta> [PR124689]
Jakub Jelinek [Sun, 5 Apr 2026 16:06:34 +0000 (18:06 +0200)] 
c++: Error recovery for fuzzed <meta> [PR124689]

I knew this was coming, but hoped it would come later ;)
Basically, when one preprocesses <meta> + some reflection code and
attempts to fuzz it, we can ICE in various ways as we expect a sane
<meta>.  In various places we've already tried to be defensive, error
out e.g. when we don't find the members we are looking for in <meta>
classes etc., plus when adding metafns.gperf I've added to the details
about each metafn the types of arguments and return type (which was
only partially used to evaluate e.g. the arguments in different ways
and prepare for the eval_* handlers, but checking of the types
wasn't actually done.

This patch introduces some limited checking of the return type and
argument types to make sure they are sane.  Plus I've noticed the
can_substitute marking said incorrectly it returns info when it returns
bool.

The reflection_range/input_range arguments aren't checked, because they
can be all kinds of things and get_range_elts already does a lot of
checking.  Similarly METAFN_KIND_ARG_TEMPLATE_PARM*, those aren't even
argument types, just a hack to tell the code that it needs to supply
the template parameter to the eval_* handlers.

2026-04-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/124689
* metafns.gperf (enum metafn_kind): Add
METAFN_KIND_BOOL_INFO_REFLECTION_RANGE.
(can_substitute): Use METAFN_KIND_BOOL_INFO_REFLECTION_RANGE
instead of METAFN_KIND_INFO_INFO_REFLECTION_RANGE.
(METAFN_KIND_ARG): Add MINFO argument.
(METAFN_KIND_RET): Define.
* reflect.cc (is_std_meta_class): New function.
(get_info): Add LOC argument, diagnose invalid argument type instead
of failing assertion.
(check_metafn_arg_type): New function.
(check_metafn_return_type): New function.
(process_metafunction): Diagnose clearly invalid return
or argument types.  Use rettype variable instead of TREE_TYPE (call).
* metafns.h: Regenerate.

* g++.dg/reflect/pr124689.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 days agofortran: Fix character SPREAD intrinsic lowering [PR109788]
Christopher Albert [Sat, 28 Mar 2026 15:57:02 +0000 (16:57 +0100)] 
fortran: Fix character SPREAD intrinsic lowering [PR109788]

Copy the SPREAD intrinsic descriptor before specializing the character
formal argument type so other uses keep the generic signature.

PR fortran/109788

gcc/fortran/ChangeLog:

* iresolve.cc (copy_intrinsic_sym): New helper.
(gfc_resolve_spread): Copy the intrinsic descriptor before
specializing the character formal argument type.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr109788.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
5 days agoAda: Silence couple of warnings
Eric Botcazou [Sun, 5 Apr 2026 10:48:47 +0000 (12:48 +0200)] 
Ada: Silence couple of warnings

gcc/testsuite/
* gnat.dg/aggr35_pkg.adb: Pass -gnatws.

5 days agoAda: Fix too large secondary stack allocation for aggregate return
Eric Botcazou [Sun, 5 Apr 2026 08:21:46 +0000 (10:21 +0200)] 
Ada: Fix too large secondary stack allocation for aggregate return

This is a regression present on the mainline and 15 branch.  The problematic
allocation may occur when the result type of the function is a discriminated
record type with defaulted discriminants.  Although it had been present for
a long time when the type is limited, the problem was recently propagated
to nonlimited types because of an optimization.

While the fix is a one-liner, the change also makes it so that SS_Allocate
raises a Storage_Error when the size overflows, like the other allocators.

gcc/ada/
* exp_ch6.adb (Expand_Simple_Function_Return): Use a constant return
object when the simple return is rewritten as an extended one.
* libgnat/s-secsta.adb (SS_Allocate): Raise Storage_Error if the
requested size is negative.
* libgnat/s-secsta__cheri.adb (SS_Allocate): Likewise.

gcc/testsuite/
* gnat.dg/aggr35.adb: New test.
* gnat.dg/aggr35_pkg.ads, gnat.dg/aggr35_pkg.adb: New helper.

5 days agoDaily bump.
GCC Administrator [Sun, 5 Apr 2026 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

5 days agodoc: Copy-edit Picolibc option documentation
Sandra Loosemore [Sat, 4 Apr 2026 22:52:32 +0000 (22:52 +0000)] 
doc: Copy-edit Picolibc option documentation

gcc/ChangeLog
* doc/invoke.texi (Picolibc Options): Copy-edit for markup, use
of proper names, etc.

5 days agodoc: Move Picolibc option documentation
Sandra Loosemore [Sat, 4 Apr 2026 17:28:01 +0000 (17:28 +0000)] 
doc: Move Picolibc option documentation

The documentation for Picolibc options was inserted at the top level
within the GCC options section.  It really should be classified with
the target-specific options; that's where we document other options
specific to the runtime configuration, including MinGW, Darwin,
Gnu/Linux, etc.

gcc/ChangeLog
* doc/invoke.texi (GCC Command Options): Move Picolibc Options
section to Target-Specific Options.
(Option Summary): Likewise.

5 days agodoc: Rename "Submodel Options"
Sandra Loosemore [Sat, 4 Apr 2026 22:10:52 +0000 (22:10 +0000)] 
doc: Rename "Submodel Options"

The node name "Submodel Options" is not meaningful, and the section name
"Machine-Dependent Options" is misleading since this section also contains
subsections documenting options for the software environment on the target
as well as its hardware -- for example, Windows/Cygwin/MinGW, Darwin, etc.
"Target-Specific Options" is a better name for it as we already use that
phrasing elsewhere, e.g. "Target-Specific Attributes".

gcc/ChangeLog
* doc/extend.texi (Common Attributes): Fix cross-reference for
renamed "Submodel Options" -> "Target-Specific Options".
* doc/invoke.texi (Invoking GCC): Likewise for the menu.
(Option Summary): Likewise for the use here.
(Submodel Options): Rename to Target-Specific Options.  Leave
an anchor with the old name.  Add better index entries.  Rewrite
introductory text.
(Precompiled Headers): Fix another cross-reference.

5 days agodoc, i386: Document more CPUs as having CX16 support [PR107337]
Sandra Loosemore [Sat, 4 Apr 2026 14:58:56 +0000 (14:58 +0000)] 
doc, i386: Document more CPUs as having CX16 support [PR107337]

The CX16 extension seems to have been omitted from the documentation
entries for a couple of early CPUs that supported it, which were
subsequently cut-and-pasted for newer models.  I checked the code
against the list of CPUs in the issue and found one more (novalake)
affected CPU that was added since then.

gcc/ChangeLog
PR target/107337
* doc/invoke.texi (x86 Options): Add CX16 feature to nocona,
alderlake, arrowlake, arrowlake-s, pantherlake, novalake,
bonnell, sierraforest, grandridge, clearwaterforest, and amdfam10
family processors.

5 days agomiddle-end/121467 - split the Standard Pattern Names section
Richard Biener [Tue, 24 Mar 2026 18:09:38 +0000 (19:09 +0100)] 
middle-end/121467 - split the Standard Pattern Names section

The following splits the standard pattern names section into two
(for now), listing vector related patterns separately.  It also
adds a separate index for the many standard pattern names we have,
something long overdue.

* doc/gccint.texi: Add named pattern index with @mdindex.
* doc/md.texi (Standard Pattern Names For Generation): Split
table into two using subsections, splitting out vectorizer
related standard patterns.  Use @mdindex for all standard
pattern names.

5 days agoPR c++/124573: ICE on invalid P4 regression
Roger Sayle [Sat, 4 Apr 2026 12:57:55 +0000 (13:57 +0100)] 
PR c++/124573: ICE on invalid P4 regression

This patch addresses PR c++/124573 by making finish_enum_value_list more
robust to DECL_INITIAL being NULL, which I believe only occurs in the
event of an error, and treating it as integer_zero_node for the purposes
of error recovery.

2026-04-04  Roger Sayle  <roger@nextmovesoftware.com>

gcc/cp/ChangeLog
PR c++/124573
* decl.cc (finish_enum_value_list): Defend against a DECL_INITIAL
being NULL during error recovery.

gcc/testsuite/ChangeLog
PR c++/124573
* g++.dg/other/enum4.C: New test case.

6 days agoc++: Implement CWG3119 - for-range-declaration of an expansion-statement as a templat...
Jakub Jelinek [Sat, 4 Apr 2026 09:32:33 +0000 (11:32 +0200)] 
c++: Implement CWG3119 - for-range-declaration of an expansion-statement as a templated entity

The following patch implements the proposed resolution of
https://wg21.link/cwg3119
Temporarily setting processing_template_decl around the
cp_parser_simple_declaration causes all kinds of ICEs and miscompilations,
this patch just sets in_expansion_stmt around it and allows the sb
pack in that case.

2026-04-04  Jakub Jelinek  <jakub@redhat.com>

* parser.cc (cp_parser_expansion_statement): Temporarily set
in_expansion_stmt to true around cp_parser_simple_declaration
for range_decl.
(cp_parser_decomposition_declaration): Don't reject structured binding
packs if in_expansion_stmt is set.

* g++.dg/cpp26/expansion-stmt34.C: New test.

6 days agolibstdc++: Guard use of float16_t and bfloat16_t [PR124722]
Matthias Kretz [Wed, 1 Apr 2026 09:46:08 +0000 (11:46 +0200)] 
libstdc++: Guard use of float16_t and bfloat16_t [PR124722]

The rest of this test is still relevant, thus only the (b)float16_t
tests are made optional rather than skipping the whole test via
dg-effective-target.

libstdc++-v3/ChangeLog:

PR libstdc++/124722
* testsuite/std/simd/traits_impl.cc: Add __STDCPP_FLOAT16_T__
and __STDCPP_BFLOAT16_T__ guards.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
6 days agoc++: Partially implement mangling for C++26 pack indexing [PR124487]
Jakub Jelinek [Sat, 4 Apr 2026 09:18:20 +0000 (11:18 +0200)] 
c++: Partially implement mangling for C++26 pack indexing [PR124487]

I still haven't figured out how to correctly mangle the case
in pack-indexing9.C where write_type is called with PACK_INDEX_TYPE
where PACK_INDEX_PACK is TREE_VEC of types, i.e. already expanded pack,
but given that right now we sorry on mangling of all PACK_INDEX_TYPE
or PACK_INDEX_EXPR trees, I think the following patch is an incremental
progress in the right direction and just mangles what is clearly specified
in the proposal.

This patch relies on the PR124198 patch I've just posted, because the
casts to size_t change mangling of pack...[1] from having i1 in it
to m1 (on x86_64, j1 on ia32, ...).

2026-04-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/124487
* mangle.cc (write_type) <case PACK_INDEX_TYPE>: Handle pack index
mangling unless (for now) PACK_INDEX_PACK is a TREE_VEC.
(write_expression): Handle PACK_INDEX_EXPR.

* g++.dg/cpp26/pack-indexing7.C: Don't xfail dg-bogus.
* g++.dg/cpp26/pack-indexing22.C: New test.