]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 days ago[lra] take scratch as implicit unused output reloads [PR55212]
Alexandre Oliva [Fri, 19 Dec 2025 07:57:05 +0000 (04:57 -0300)] 
[lra] take scratch as implicit unused output reloads [PR55212]

When trying to convert the SH port to use LRA, the first issue I hit
was the need for dealing with former scratch registers at places we
didn't need to on other ports, treating them like unused output
reloads instead of rejecting them.

for  gcc/ChangeLog

PR target/55212
* lra-constraints.cc (match_reload): Treat former scratch
regs as implicit unused output reloads.
(process_alt_operands): Likewise.
(curr_insn_transform): Likewise.

4 days agoc++/modules: Reattempt to complete ARRAY_TYPEs after reading a cluster [PR122922]
Nathaniel Shead [Sat, 6 Dec 2025 05:47:18 +0000 (16:47 +1100)] 
c++/modules: Reattempt to complete ARRAY_TYPEs after reading a cluster [PR122922]

The PR raises an issue where we complain about value-initializing an
incomplete array type, where the element type is a complete type.

Here, the friend declaration brings TTensor<0> and TTensor<1> into the
same cluster, and we have no intra-cluster ordering that ensures
TTensor<0>'s definition is streamed before TTensor<1>'s definition is.
In general we don't currently do any ordering of definitions, we only
reorder in cases that a declaration depends on another.

In this particular case we happen to stream TTensor<1>'s definition
first, which builds an array type of TTensor<0>.  At this point
TTensor<0>'s definition hasn't been streamed, so the array is considered
to be an array of incomplete type.  Later we do stream TTensor<0>'s
definition, but we don't update the TYPE_SIZE etc. of the array type we
built earlier so build_value_init thinks we still have incomplete type
and errors.

Some possible approaches:

1. Have some post-processing for arrays of incomplete type during module
   streaming; once we've finished reading the cluster we can loop
   through those array types and attempt to complete them.

2. Add a dependency ordering between structs that have a field that's a
   non-dependent array type of a different struct in the same cluster,
   so that the latter is always streamed first.  We shouldn't see cycles
   because we cannot have two structs with arrays of each other.  This
   would require processing definitions though and I'm not convinced
   this necessarily would fix the issue in all cases.

3. Add more calls to 'complete_type' when processing structure fields,
   rather than assuming that if we have a complete record type all its
   fields must also have been completed already.  This seems error-prone
   though, as we may miss cases.  Unless perhaps we replace uses of
   COMPLETE_TYPE_P entirely in the C++ frontend with a function that
   attempts to complete the type and returns false if it failed?

This patch takes approach #1 as a minimal fix, but maybe it would be
worth exploring other approaches later.

PR c++/122922

gcc/cp/ChangeLog:

* module.cc (trees_in::post_types): New member.
(trees_in::trees_in): Initialize it.
(trees_in::~trees_in): Clean it up.
(trees_in::post_process_type): New functions.
(trees_in::tree_node): Save incomplete ARRAY_TYPEs for later
post-processing.
(module_state::read_cluster): Attempt to complete any
ARRAY_TYPEs we saved earlier.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr122922_a.C: New test.
* g++.dg/modules/pr122922_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
4 days agoc++/modules: Don't build STAT_HACKs for current TU namespace bindings [PR122995]
Nathaniel Shead [Thu, 4 Dec 2025 14:14:36 +0000 (01:14 +1100)] 
c++/modules: Don't build STAT_HACKs for current TU namespace bindings [PR122995]

The issue in the PR is that we're checking if the binding entity for the
current TU matches the namespace we're pushing.  In this case the slot
however is a STAT_HACK we created during 'maybe_record_mergeable_decl'
to indicate that the binding entity contains a global module binding.

Adding '|| (STAT_HACK_P ((tree) slot) && STAT_DECL ((tree) slot) == ns)'
should fix the assertion, but I think we want to just not build the
STAT_HACK for namespaces, as they'll always be global module regardless,
and cannot match with any other declaration, so there's no need for the
special flag.

PR c++/122995

gcc/cp/ChangeLog:

* name-lookup.cc (maybe_record_mergeable_decl): Don't build a
STAT_HACK for namespaces.

gcc/testsuite/ChangeLog:

* g++.dg/modules/namespace-17_a.C: New test.
* g++.dg/modules/namespace-17_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
4 days agoconfigure: Support disabling specific languages [PR12407]
Lewis Hyatt [Tue, 16 Dec 2025 05:15:14 +0000 (00:15 -0500)] 
configure: Support disabling specific languages [PR12407]

Sometimes it can be desirable to get the semantics of
--enable-languages=all, but to exclude one or more languages from the
build. Currently this is not directly supported; the best you can do is to
list the ones you do want to be built as arguments to --enable-languages.
In addition to being inconvenient, this also complicates cross-platform
portability, since --enable-languages=all carries the useful semantics that
unsupported languages will be skipped automatically; by contrast, languages
listed explicitly as arguments to --enable-languages will produce a hard
error if they are not supported.

This patch extends the syntax of --enable-languages so that, e.g.:

--enable-languages=all,^xyz,^abc

would build every supported language other than xyz and abc.

ChangeLog:

PR bootstrap/12407
* configure.ac: Add feature to parsing of --enable-languages so that
a language can be disabled by prefixing it with a caret.
* configure: Regenerate.

gcc/ChangeLog:

PR bootstrap/12407
* doc/install.texi (--enable-languages): Document the new language
exclusion feature.

4 days agoSH: Add test case from PR55212 c#405 / c#413 / att. 59442
Oleg Endo [Sat, 26 Oct 2024 09:04:25 +0000 (18:04 +0900)] 
SH: Add test case from PR55212 c#405 / c#413 / att. 59442

gcc/testsuite/ChangeLog:

PR target/55212
* g++.target/sh/torture/pr55212-c413.C: New.

4 days agoSH: Add test case from PR55212 c#378 / c#384 / att. 59289
Oleg Endo [Tue, 8 Oct 2024 04:17:20 +0000 (13:17 +0900)] 
SH: Add test case from PR55212 c#378 / c#384 / att. 59289

gcc/testsuite/ChangeLog:

PR target/55212
* g++.target/sh/torture/pr55212-c384.C: New.

4 days agoSH: Add test case from PR55212 c#367 / c#373 / att. 59285
Oleg Endo [Tue, 8 Oct 2024 04:08:50 +0000 (13:08 +0900)] 
SH: Add test case from PR55212 c#367 / c#373 / att. 59285

gcc/testsuite/ChangeLog:

PR target/55212
* g++.target/sh/torture/pr55212-c373.C: New.

4 days agoSH: Add test case from PR55212 c#331 / c#333 / att. 59215
Oleg Endo [Tue, 8 Oct 2024 04:03:50 +0000 (13:03 +0900)] 
SH: Add test case from PR55212 c#331 / c#333 / att. 59215

gcc/testsuite/ChangeLog:

PR target/55212
* g++.target/sh/torture/pr55212-c333.C: New.

4 days agoSH: Add test case from PR55212 c#298 / c#311 / att. 59185
Oleg Endo [Tue, 8 Oct 2024 03:30:42 +0000 (12:30 +0900)] 
SH: Add test case from PR55212 c#298 / c#311 / att. 59185

gcc/testsuite/ChangeLog:

PR target/55212
* g++.target/sh/sh.exp: New.
* g++.target/sh/torture/sh-torture.exp: New.
* g++.target/sh/torture/pr55212-c311.C: New

4 days agoSH: A test case for wrong-code with -mlra PR55212 c#192 / c#248 / att. 59102
Kaz Kojima [Fri, 20 Sep 2024 09:36:22 +0000 (18:36 +0900)] 
SH: A test case for wrong-code with -mlra PR55212 c#192 / c#248 / att. 59102

gcc/testsuite/ChangeLog:

PR target/55212
* gcc.target/sh/pr55212-c248.c: New test.

4 days agoDaily bump.
GCC Administrator [Fri, 19 Dec 2025 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

4 days agolibstdc++: Fix some warnings seen during mingw-w64 bootstrap
Jonathan Wakely [Thu, 18 Dec 2025 23:37:35 +0000 (23:37 +0000)] 
libstdc++: Fix some warnings seen during mingw-w64 bootstrap

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono::_M_write): Add
maybe_unused attribute to avoid -Wunused-parameter warning.
* src/c++20/tzdb.cc (detect_windows_zone): Decay array to
pointer to avoid -Warray-compare warning.

4 days agolibstdc++: On Windows, retrieve thread-local variables via functions
LIU Hao [Wed, 3 Dec 2025 03:10:46 +0000 (11:10 +0800)] 
libstdc++: On Windows, retrieve thread-local variables via functions

For Windows, GCC can be configured with `--enable-tls` to enable native TLS.
The native TLS implementation has a limitation that it is incapable of
exporting thread-local variables from DLLs. Therefore, they are retrieved
via getter functions instead.

libstdc++-v3/ChangeLog:

* config/os/mingw32-w64/os_defines.h (_GLIBCXX_NO_EXTERN_THREAD_LOCAL):
New macro.
* include/std/mutex [_GLIBCXX_NO_EXTERN_THREAD_LOCAL]
(__get_once_callable, __get_once_call): Declare new functions.
* src/c++11/mutex.cc [_GLIBCXX_NO_EXTERN_THREAD_LOCAL]
(__get_once_callable, __get_once_call): Define.

Signed-off-by: LIU Hao <lh_mouse@126.com>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
4 days agoOpenMP: Add no_openmp_constructs; improve Fortran clause parsing
Tobias Burnus [Thu, 18 Dec 2025 21:55:40 +0000 (22:55 +0100)] 
OpenMP: Add no_openmp_constructs; improve Fortran clause parsing

Add the assumption clause 'no_openmp_constructs' (which as most assumption
clauses is ignored in the front end - for now).
For Fortran, improve free-form parsing of argument-free clauses
by avoiding substring matches.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_omp_assumption_clauses): Add
no_openmp_constructs clause.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_omp_assumption_clauses): Add
no_openmp_constructs clause.

gcc/fortran/ChangeLog:

* dump-parse-tree.cc (show_omp_assumes): Handle
no_openmp_constructs clause.
* gfortran.h (struct gfc_omp_assumptions): Add
no_openmp_constructs.
* openmp.cc (gfc_match_dupl_check): For free-form
Fortran, avoid substring matching.
(gfc_match_omp_clauses): Match no_openmp_constructs clause.
Remove no longer needed 'needs_space', match 'order' followed by
parenthesis instead of 'order' with parenthesis; reorder 'order'
and 'ordering' clauses for free-form Fortran.
(gfc_match_omp_assumes): Handle no_openmp_constructs clause.

libgomp/ChangeLog:

* libgomp.texi (OpenMP Implemenation Status): Mark
no_openmp_constructs as implemented.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/update-if_present-2.f90: Update dg-error.
* gfortran.dg/gomp/order-8.f90: Likewise.
* gfortran.dg/gomp/order-9.f90: Likewise.
* c-c++-common/gomp/assume-5.c: New test.
* gfortran.dg/gomp/assume-6.f90: New test.

4 days agoc++: restore printing 'typename' for none_type tag
Patrick Palka [Thu, 18 Dec 2025 19:24:54 +0000 (14:24 -0500)] 
c++: restore printing 'typename' for none_type tag

The drive-by change in r16-6144 to have dump_type not print any tag name
for none_type TYPENAME_TYPE caused some diagnostic regressions in C++20
mode where an expected 'typename' is now missing in the error message:

  g++.dg/concepts/diagnostic5.C (test for warnings, line 5)
  g++.old-deja/g++.pt/typename3.C (test for errors, line 20)
  g++.old-deja/g++.pt/typename4.C (test for errors, line 25)
  g++.old-deja/g++.pt/typename6.C (test for errors, line 18)

The first test shows we no longer print 'typename' when diagnosing a
failed type-requirement:

  • in requirements  [with T = char]
    gcc/testsuite/g++.dg/concepts/diagnostic5.C:5:16:
        5 |   concept c1 = requires { typename T::blah; };
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • the required type ‘T::blah’ is invalid

which is undesirable since 'typename' has been explicitly written.
(The other three tests are less interesting since they're error-recovery.)

The TYPENAME_TYPE in question is being built with a none_type tag due
to cp_parser_type_name passing tag_type=none_type to cp_parser_class_name.
This seems wrong at least when typename_keyword_p=true.  But rather than
continue messing with this old and delicate part of the parser, this patch
just restores printing the 'typename' prefix for none_type TYPENAME_TYPEs.

gcc/cp/ChangeLog:

* decl.cc (tag_name) <case none_type>: Return "typename" as if
typename_type.

4 days agoc++: Fix up recent cp_parser_template_id regression [PR123186]
Jakub Jelinek [Thu, 18 Dec 2025 15:41:10 +0000 (16:41 +0100)] 
c++: Fix up recent cp_parser_template_id regression [PR123186]

On Fri, Dec 12, 2025 at 09:39:18AM -0500, Patrick Palka wrote:
> +      TREE_TYPE (templ)
> +     = build_typename_type (TYPE_CONTEXT (TREE_TYPE (templ)),
> +                            TYPE_NAME (TREE_TYPE (templ)),
> +                            fullname,
> +                            get_typename_type_tag (TREE_TYPE (templ)));
>        template_id = templ;
>      }
>    else

This change causes ICE e.g. on the following testcase.

The problem is that build_typename_type expects IDENTIFIER_NODE as the
second argument, e.g. it uses it as
      tree d = build_decl (input_location, TYPE_DECL, name, t);
argument.  But TYPE_NAME doesn't have to be an IDENTIFIER_NODE, it can
be a TYPE_DECL too and when we build a TYPE_DECL with TYPE_DECL as
DECL_NAME, it breaks all kinds of assumptions everywhere in the FE as well
as middle-end.

Fixed by using TYPE_IDENTIFIER instead.

2025-12-18  Jakub Jelinek  <jakub@redhat.com>

PR c++/123186
* parser.cc (cp_parser_template_id): Use TYPE_IDENTIFIER instead of
TYPE_NAME in second build_typename_type argument.

* g++.dg/template/crash133.C: New test.

4 days agoc++: Fix ICE with type aliases in inherited CTAD [PR122070]
Egas Ribeiro [Sat, 13 Dec 2025 13:14:47 +0000 (13:14 +0000)] 
c++: Fix ICE with type aliases in inherited CTAD [PR122070]

When processing inherited CTAD in C++23, type_targs_deducible_from can
be called with a synthetic alias template whose TREE_VALUE is a type
alias.  Since TYPE_TEMPLATE_INFO_MAYBE_ALIAS can return NULL for type
aliases, we need to fall back to TYPE_TEMPLATE_INFO to get the template
info of the underlying type before calling TI_TEMPLATE, which should
always be non-NULL when called from inherited_ctad_tweaks.

PR c++/122070

gcc/cp/ChangeLog:

* pt.cc (type_targs_deducible_from): Fall back to
TYPE_TEMPLATE_INFO when TYPE_TEMPLATE_INFO_MAYBE_ALIAS is NULL.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/class-deduction-inherited10.C: New test.
* g++.dg/cpp23/class-deduction-inherited9.C: New test.

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Co-authored-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
4 days agolibstdc++: Fix ranges::stable_sort handling of null buffer [PR123180]
Jonathan Wakely [Thu, 18 Dec 2025 10:38:31 +0000 (10:38 +0000)] 
libstdc++: Fix ranges::stable_sort handling of null buffer [PR123180]

The logic of the null pointer check got reversed when converting the
std::stable_sort code for ranges::stable_sort.

libstdc++-v3/ChangeLog:

PR libstdc++/123180
* include/bits/ranges_algo.h (__stable_sort_fn::operator()): Fix
sense of null check. Replace typedef with alias-declaration.
* testsuite/25_algorithms/stable_sort/123180.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
5 days agoOpenMP: Add parser support for target's device_type clause
Tobias Burnus [Thu, 18 Dec 2025 11:20:36 +0000 (12:20 +0100)] 
OpenMP: Add parser support for target's device_type clause

Enables the existing 'device_type(nohost|host|any)' for the
'target' construct; for now, it will fail with a 'sorry,
unimplemented' for all but 'any'.

gcc/c-family/ChangeLog:

* c-omp.cc (c_omp_split_clauses): Handle target's
device_type clause.

gcc/c/ChangeLog:

* c-parser.cc (OMP_TARGET_CLAUSE_MASK): Add
device_type clause.

gcc/cp/ChangeLog:

* parser.cc (OMP_TARGET_CLAUSE_MASK): Add
device_type clause.

gcc/fortran/ChangeLog:

* dump-parse-tree.cc (show_omp_clauses): Handle
device_type clause.
* openmp.cc (gfc_match_omp_clauses): Reorder to
match 'device' after 'device_...' to avoid parse
errors.
(OMP_TARGET_CLAUSES): Add device_type clause.
* trans-openmp.cc (gfc_trans_omp_clauses,
gfc_split_omp_clauses): Handle device_type clause.

gcc/ChangeLog:

* gimplify.cc (gimplify_scan_omp_clauses): Handle
OpenMP device_type clause.
* omp-low.cc (scan_sharing_clauses): Likewise.
(lower_omp_target): Print 'sorry, unimplemented' for
device_type clause value other than 'any'.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/target-device-type-1.c: New test.
* gfortran.dg/gomp/target-device-type-1.f90: New test.

5 days agoaarch64: Add ACLE macro __ARM_FEATURE_SVE_PREDICATE_OPERATORS
Tejas Belagod [Wed, 17 Dec 2025 15:37:23 +0000 (15:37 +0000)] 
aarch64: Add ACLE macro __ARM_FEATURE_SVE_PREDICATE_OPERATORS

This patch enables ACLE macro __ARM_FEATURE_SVE_PREDICATE_OPERATORS to indicate
that C/C++ language operations are available natively on SVE ACLE type svbool_t.

gcc/

* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define
__ARM_FEATURE_SVE_PREDICATE_OPERATORS.

gcc/testsuite

* gcc.target/aarch64/sve/acle/general/attributes_1.c: Update test for
__ARM_FEATURE_SVE_PREDICATE_OPERATORS.
* gcc.target/aarch64/sve/acle/general/attributes_9.c: New.

5 days agoFix profile_probability constructor arg [PR123153]
Victor Do Nascimento [Wed, 17 Dec 2025 14:43:41 +0000 (14:43 +0000)] 
Fix profile_probability constructor arg [PR123153]

Given that profile probability is computed as an unsigned integer
value in the [0, max_probability = (uint32_t) 1 << (n_bits - 2)]
range (as opposed to a [0, 1] float), 50/50 likeihoods are encoded as
`even()', mapping to `max_probability / 2'.

The previous use of 0.5 for an even probability was, as a consequence
of the implicit `double' -> `uint32_t' conversion, silently set to 0 by
GCC when not using the `-Wconversion' flag.

We therefore replace the erroneous `probability (0.5, GUESSED)'
initialization with its correct `profile_probability::even ()'
counterpart.

gcc/ChangeLog:

PR tree-optimization/123153
* tree-vect-loop-manip.cc
(slpeel_tree_duplicate_loop_to_edge_cfg): use
profile_probability::even () for even likelihood.

5 days agolibstdc++: Fix up std::generate_canonical for 32-bit arches
Jonathan Wakely [Wed, 17 Dec 2025 18:36:36 +0000 (18:36 +0000)] 
libstdc++: Fix up std::generate_canonical for 32-bit arches

Make use of __detail::_Select_uint_least_t<d>::type for
std::generate_canonical, so that we choose an appropriately sized
integer based on the number of bits needed, and so we have a 128-bit
integer type even on 32-bit targets (via the new __rand_uint128 class).

libstdc++-v3/ChangeLog:

* include/bits/random.tcc (__generate_canonical_pow2): Adjust
comments. Remove _UInt template parameter and define it in the
body using _Select_uint_least_t<__d>. Remove popcount call for
getting the width of the _UInt type. Cast floating-point
literal to _RealT.
(__generate_canonical_any): Remove _UInt template parameter and
define it in the body using _Select_uint_least_t<__d * 2>. Use
direct-initialization for _UInt variables. Cast floating-point
literal to _RealT.
(generate_canonical): Remove unused typedef. Remove constexpr-if
branches and remove unsigned type from template argument lists.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Nathan Myers <nmyers@redhat.com>
5 days agoaarch64: Update SME_LUTv2 feature string.
Alfie Richards [Mon, 15 Dec 2025 16:43:27 +0000 (16:43 +0000)] 
aarch64: Update SME_LUTv2 feature string.

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def (sme-lutv2): Fix
feature string.

5 days agoaarch64: Add new target options for 2024 Architecture Extension and Armv9.6-A
Alfie Richards [Wed, 29 Oct 2025 13:29:10 +0000 (13:29 +0000)] 
aarch64: Add new target options for 2024 Architecture Extension and Armv9.6-A

This does not add support for these version (and the corresponding
__ARM_FEATURE_<X> macros aren't implemented for this reason) but
accepts the command line strings and allows these to be passed on to
the assembler.

Armv9.6-A is supported by the new "armv9.6-a" option and defined as
"armv9.5-a+cmpbr+lsui+occmo"

The new extensions are:

- fprcvt        (FEAT_FPRCVT)
- lsfe          (FEAT_LSFE)
- f8f32mm       (FEAT_F8F32MM)
- f8f16mm       (FEAT_F8F16MM)
- sme2p2        (FEAT_SME2p2)
- sve2p2        (FEAT_SVE2p2)
- sve-aes2      (FEAT_SVE_AES2)
- sve-f16f32mm  (FEAT_SVE_F16F32MM)
- sve-bfscale   (FEAT_SVE_BFSCALE)
- ssve-aes      (FEAT_SSVE_AES)
- lsui          (FEAT_LSUI)
- occmo         (FEAT_OCCMO)
- pcdphint      (FEAT_PCDPHINT)
- pops          (FEAT_PoPS)
- ssve-bitperm  (FEAT_SSVE_BitPerm)
- ssve-fexpa    (FEAT_SSVE_FEXPA)
- sme-mop4      (FEAT_SME_MOP4)
- sme-tmop      (FEAT_TMOP)

gcc/ChangeLog:

* config/aarch64/aarch64-arches.def: Add armv9.6-a.
* config/aarch64/aarch64-option-extensions.def:
(sve-aes): Update to be enables by smeaes.
(sve-bitperm): Update to be enables by smesbitperm.
(fprcvt): New cli extension option.
(lsfe): Likewise.
(f8f32mm): Likewise.
(f8f16mm): Likewise.
(sme2p2): Likewise.
(sve2p2): Likewise.
(sve-aes2): Likewise.
(sve-f16f32mm): Likewise.
(sve-bfscale): Likewise.
(ssve-aes): Likewise.
(lsui): Likewise.
(occmo): Likewise.
(pcdphint): Likewise.
(pops): Likewise.
(ssve-bitperm): Likewise.
(ssve-fexpa): Likewise.
(sme-mop4): Likewise.
(sme-tmop): Likewise.

5 days agoaarch64: Split sve2-X extensions into sve2 + sve-X extension.
Alfie Richards [Wed, 29 Oct 2025 13:29:10 +0000 (13:29 +0000)] 
aarch64: Split sve2-X extensions into sve2 + sve-X extension.

Changes the "sve2-sm4", "sve2-sha3", "sve2-bitperm", and "sve2-aes"
to be aliases which imply both "sve2" and the new option "sve-sm4",
"sve-sha3", "sve-bitperm", or "sve-aes" respectively.

The EXPLICIT_OFF values are chosen to preserve the existing behaviour of
+nosve2-X.

This granularity is needed to model the 2024 Architecture Extensions
dependencies.

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def
(sve-aes): New cli extension option.
(sve2-aes): Changed to be alias of sve2+sve-aes2.
(sve-bitperm): New cli extension option.
(sve2-bitperm): Changed to be alias of sve2+sve-bitperm.
(sve-sm4): New cli extension option.
(sve2-sm4): Changed to be alias of sve2+sve-sm4.
(sve-sm4): New cli extension option.
(sve2-sm4): Changed to be alias of sve2+sve-sm4.
* config/aarch64/aarch64.h (TARGET_SVE2_AES): Updated to require
sve2+sve-aes.
(TARGET_SVE2_BITPERM): Updated to require sve2+sve-bitperm.
(TARGET_SVE2_SHA3): Updated to require sve2+sve-sha3.
(TARGET_SVE2_SM4): Updated to require sve2+sve-sm4
* config/aarch64/aarch64-sve-builtins-sve2.def: Update gating for sve2-X
intrinsics.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_5.c: New test.
* gcc.target/aarch64/options_set_30.c: Likewise.
* lib/target-supports.exp (exts): Add sve-sm4, sve-aes, sve-bitperm.

5 days agoaarch64: Add alias option support
Alfie Richards [Wed, 12 Nov 2025 16:30:45 +0000 (16:30 +0000)] 
aarch64: Add alias option support

Adds the AARCH64_OPT_EXTENSION_ALIAS macro to aarch64-option-extensions.def
to define architecture features which gate no features themselves, but
act as aliases for other features.

When getting the extension string for some architecture flags, alias features
should be used over their constituent features, even if some of the constituent
features are enabled transitively by other features.

Changes +crypto option to use this macro.

gcc/ChangeLog:

* common/config/aarch64/aarch64-common.cc
(struct aarch64_extension_info): Add flags_alias_preferred_over.
(AARCH64_OPT_EXTENSION): Add setting flags preferred over to 0.
(AARCH64_OPT_EXTENSION_ALIAS): New macro def.
(aarch64_get_extension_string_for_isa_flags): Update to use alias
extensions over constituent extensions.
* config/aarch64/aarch64-feature-deps.h (alias_flags): New variable
(AARCH64_OPT_EXTENSION): New macro def.
(AARCH64_OPT_EXTENSION_ALIAS): New macro def.
(HANDLE): Update to use alias_flags.
(AARCH64_CORE): Update to use alias_flags.
* config/aarch64/aarch64-option-extensions.def
(AARCH64_OPT_EXTENSION_ALIAS): New macro def to
define alias_prefer_over_flags_X.
(crypto): Update to us AARCH64_OPT_EXTENSION_ALIAS.

5 days agoLoongArch: Fix ISA base not being updated in loongarch_option_restore [PR123171]
WANG Xuerui [Thu, 18 Dec 2025 05:42:33 +0000 (13:42 +0800)] 
LoongArch: Fix ISA base not being updated in loongarch_option_restore [PR123171]

Fixes switching between LA32S and LA32R base arches with target pragmas
or attributes.

Bootstrapped and regtested on loongarch64-linux-gnu.

PR target/123171
gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_option_restore): Add
missing update to la_target.isa.base.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/pr123171.c: New test.

Suggested-by: Lulu Cheng <chenglulu@loongson.cn>
Signed-off-by: WANG Xuerui <git@xen0n.name>
5 days agoLoongArch: Add support for the TARGET_MODES_TIEABLE_P vectorization type.
chenxiaolong [Thu, 11 Dec 2025 02:49:05 +0000 (10:49 +0800)] 
LoongArch: Add support for the TARGET_MODES_TIEABLE_P vectorization type.

v1->v2:
Add the TARGET_MODES_TIEABLE_P function description and analyze the
reasons for the cost change of Subreg type rtx after supporting
vectorization.

This hook returns true if a value of mode mode1 is accessible in mode
mode2 without copying. On LA, for vector types V4SF and V8SF, the lower
128 bit data can be shared. After adding vector support in this hook,
the cost of type conversion for the subreg operation from the V4SF to
the V8SF registers can be made zero, and some rtx optimization
operations can be completed in the combine traversal. The comparison
of the backend support vectors before and after is as follows:

support before:

(insn 7 4 9 2 (set (reg:V8SF 82 [ _6 ])
        (subreg:V8SF (reg:V4SF 86 [ aD.7906 ]) 0))
(insn 9 7 10 2 (set (reg:V8SF 80 [ _4 ])
        (plus:V8SF (reg:V8SF 82 [ _6 ])
            (reg:V8SF 82 [ _6 ])))

===>

support after:

(insn 9 7 10 2 (set (reg:V8SF 80 [ _4 ])
        (plus:V8SF (subreg:V8SF (reg:V4SF 86 [ aD.7906 ]) 0)
            (subreg:V8SF (reg:V4SF 86 [ aD.7906 ]) 0)))

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_modes_tieable_p):
Add support for vector conversion.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vector/lasx/vect-extract-256-128.c:
After supporting the vectorized type corresponding to subreg in
the backend, the cost of rtx becomes 0. In fwprop1 pass,
memory-loaded rtx cannot be propagated to this insn, which leads
to xvld not being optimized into vld instructions.
* gcc.target/loongarch/vect-mode-tieable.c: New test.

5 days agoc/123156 - overflow in shuffle mask for __builtin_shufflevector
Richard Biener [Wed, 17 Dec 2025 13:38:23 +0000 (14:38 +0100)] 
c/123156 - overflow in shuffle mask for __builtin_shufflevector

At some point the permute vector element type had to match the value
elemnt in size which easily leads to overflow for char element types
as shown in the testcase.  This was relaxed for constant permute
masks, so use ssizetype.

PR c/123156
gcc/c-family/
* c-common.cc (c_build_shufflevector): Use ssizetype for the
permute vector element type.

gcc/testsuite/
* gcc.dg/torture/builtin-shufflevector-pr123156.c: New testcase.

5 days agoDo not skip jobserver flags with negative file descriptors
Senthil Kumar Selvaraj [Thu, 18 Dec 2025 06:15:50 +0000 (11:45 +0530)] 
Do not skip jobserver flags with negative file descriptors

As part of jobserver detection, the jobserver_info constructor looks
for the last occurence of "--jobserver-auth=", and parses the argument
for that option to look for either a named pipe (has a "fifo:" prefix)
or read and write pipe fds separated by a comma.

With GNU Make 4.4 and above, named pipes are used by default because
anonymous pipe fds cannot be used reliably (see
https://savannah.gnu.org/bugs/?57242), but it still supports a
--jobserver-style=pipe option for compatibility reasons. With that
flag enabled, or with older GNU Make versions, the jobserver detection
code checks if the provided fds are greater than 0 and valid. If
invalid, it drops them from MAKEFLAGS used for subsequent child
processes.

However, GNU Make explicitly provides negative jobserver pipe fds if
the command is not marked as recursive (i.e is missing a '+' prefix in
the Makefile) - see https://savannah.gnu.org/bugs/?57242#comment13.

The MAKEFLAGS look like this in that case.

-j4 --jobserver-auth=3,4 --jobserver-auth=-2,-2

Stripping off the final --jobserver-auth with negative fds undoes this
helpful hint from GNU Make, and exposes child processes (like
lto-wrapper) to all the issues with anonymous pipe fds that forced GNU
Make to switch to named pipes by default.

This patch prevents that stripping if jobserver communication is *not*
via a named pipe *and* file descriptors are negative. As a result,
child processes receive MAKEFLAGS with negative file descriptors too,
and correctly decide that a jobserver is not available.

gcc/ChangeLog:

* opts-common.cc (jobserver_info::jobserver_info): Do not skip
negative file descriptors in simple UNIX pipe mode.

5 days agoch: Fix detection of non-executed loop exit
Andrew Pinski [Mon, 15 Dec 2025 20:36:44 +0000 (12:36 -0800)] 
ch: Fix detection of non-executed loop exit

After r16-6104-gb5c64db0a49d46, we try to duplicate bb's
that contain loop exit that have "never exit" but we check
against the propability of the exit to very_unlikely. If we
have PGO, then a loop exit might be very unlikely to be taken
if we interate the loop more than 2000 times.
The problem is the check for very_unlikely is just wrong. It should
just be never. So let's remove that.

Also adds a testcase for __builtin_abort instead of __builtin_unreachable
since there are slightly different pathes to get the probilities.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122734
gcc/ChangeLog:

* tree-ssa-loop-ch.cc (should_duplicate_loop_header_p): Remove
check on very_unlikely probability.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/copy-headers-13.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 days agopredict: Fix return value in unlikely_executed_stmt_p for __builtin_unreachable/__bui...
Andrew Pinski [Wed, 17 Dec 2025 00:04:18 +0000 (16:04 -0800)] 
predict: Fix return value in unlikely_executed_stmt_p for __builtin_unreachable/__builtin_trap

Looks like Honza messed up the return value for __builtin_unreachable/__builtin_trap
in unlikely_executed_stmt_p (with r16-2639-g1d3e713dda99e2). These are inserted
by the user or optimizers but they are always unlikely. So fix the return value
to be true for these.

A minor update to gcc.target/i386/pr121572-1a.c is needed as the never executed
predicate causes the trap instruction (ud2) to be in a new partition which interfers
with the dg-final check-body check. Also the code generation goes back to what it
was in GCC 15 also.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* predict.cc (unlikely_executed_stmt_p): Fix up return for
__builtin_unreachable/__builtin_trap.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr121572-1a.c: Turn off -freorder-blocks-and-partition
as it interferes with the check-body.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 days agovartrack: fix skipping of unsuitable locs
Alexandre Oliva [Thu, 18 Dec 2025 01:41:14 +0000 (22:41 -0300)] 
vartrack: fix skipping of unsuitable locs

When the last loc in a chain happens to be an unsuitable_loc(), we
record VAR_LOC_FROM as if the empty location had been derived from
that unsuitable loc, instead of leaving it empty, which ends up
preventing the VAR loc from being recomputed when other related locs
are usefully expanded.

Adjust the code that skips an unsuitable_loc() to take the same
preparation steps we take for exiting the loop as when an expansion
attempt yields NULL_RTX.

for  gcc/ChangeLog

* var-tracking.cc (vt_expand_var_loc_chain): Prepare to exit
the loop after unsuitable_loc.

5 days agoDaily bump.
GCC Administrator [Thu, 18 Dec 2025 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

5 days agocse: Check volatile memory in cselib_redundant_set_p
H.J. Lu [Wed, 17 Dec 2025 04:18:15 +0000 (12:18 +0800)] 
cse: Check volatile memory in cselib_redundant_set_p

For h8300-elf, gcc.dg/pr114768.c fails when compiled with -O2 -msx since
cselib_redundant_set_p returns true when called with

(gdb) call debug (set)
(set (mem:HI (reg/f:SI 0 r0 [orig:21 p ] [21]) [1 *p_3(D)+0 S2 A16])
    (mem/v:HI (reg/f:SI 0 r0 [orig:21 p ] [21]) [1 MEM[(volatile int *)p_3(D)]+0 S2 A16]))
(gdb)

from reload_cse_regs.  Update cselib_redundant_set_p to return false for
volatile memory source or destination.

gcc/

PR target/122343
* cselib.cc (cselib_redundant_set_p): Return false for volatile
memory source or destination.

gcc/testsuite/

PR target/122343
* gcc.dg/pr122343-1.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 days agolibstdc++: Make __cpp_lib_constexpr_exceptions depend on cxx11 ABI
Jonathan Wakely [Tue, 16 Dec 2025 11:12:33 +0000 (11:12 +0000)] 
libstdc++: Make __cpp_lib_constexpr_exceptions depend on cxx11 ABI

The COW std::string is not constexpr, so the <stdexcept> exception
classes can't be constexpr either when they're defined in terms of the
COW string.

While constexpr exceptions for <typeinfo>, <new>, and <exception>
classes would work, __cpp_constexpr_exceptions >= 202411L implies that
everything including <stdexcept> should work. So when we can't support
it fully, we shouldn't announce it.

libstdc++-v3/ChangeLog:

* include/bits/version.def (constexpr_exceptions): Add
cxx11abi=yes.
* include/bits/version.h: Regenerate.
* testsuite/18_support/exception/version.cc: Require effectiove
target cxx11_abi.
* testsuite/18_support/exception_ptr/exception_ptr_cast.cc: Only
check for constexpr support in cxx11 ABI.
* testsuite/19_diagnostics/headers/stdexcept/version.cc: Require
effective target cxx11_abi.
* testsuite/19_diagnostics/logic_error/constexpr.cc: Likewise.
* testsuite/19_diagnostics/runtime_error/constexpr.cc: Likewise.
* testsuite/20_util/expected/version.cc: Only check for
__cpp_lib_constexpr_exceptions macro for cxx11 ABI.
* testsuite/20_util/optional/version.cc: Likewise.
* testsuite/20_util/variant/version.cc: Likewise.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
5 days agolibstdc++: Implement std::philox_engine for targets without __int128
Jonathan Wakely [Wed, 17 Dec 2025 12:42:12 +0000 (12:42 +0000)] 
libstdc++: Implement std::philox_engine for targets without __int128

This moves the __detail::_Select_uint_least_t<N>::type class to
namespace scope and extends it with more 128-bit arithmetic operations,
implemented in terms of uint64_t.

Now std::philox_engine can use _Select_uint_least_t<w*2>::type instead
of __uint128_t, so that it works on targets without 128-bit integers.
This also means that targets that do support __uint128_t only use it
when actually necessary, so that we use uint64_t when generating a
32-bit result (e.g. with std::philox4x32).

libstdc++-v3/ChangeLog:

* include/bits/random.h [!__SIZEOF_INT128__] (__rand_uint128):
Refactor and rename _Select_uint_least_t<128>::type to a new
class. Make all members constexpr. Add new member functions for
additional arithmetic and bitwise operations, and comparisons.
(__detail::_Select_uint_least_t<>::type): Define as an alias of
__rand_uint128.
* include/bits/random.tcc (philox_engine::_M_mulhi): Use
_Select_uint_least_t<w*2>::type instead of __uint128_t.
(philox_engine::_M_transition): Likewise.
* include/bits/version.def (philox_engine): Remove extra_cond.
* include/bits/version.h: Regenerate.
* testsuite/26_numerics/random/philox4x32.cc: Remove
dg-require-cpp-feature-test directive.
* testsuite/26_numerics/random/philox4x64.cc: Likewise.
* testsuite/26_numerics/random/philox_engine/cons/copy.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/cons/default.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/cons/seed.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/operators/equal.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/operators/serialize.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/requirements/constants.cc:
Likewise.
* testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc:
Likewise.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 days agolibstdc++: Use -fexcess-precision=standard for std::generate_canonical tests
Jonathan Wakely [Wed, 17 Dec 2025 19:39:39 +0000 (19:39 +0000)] 
libstdc++: Use -fexcess-precision=standard for std::generate_canonical tests

On 32-bit x86 the default -fexcess-precision=fast setting used by
-std=gnu++20 results in unpredictable rounding which alters the number
of times that std::generate_canonical produces exactly 1.0f, which
means that the URBG is invoked a different number of times.

To ensure that the behaviour is consistent and the expected number of
calls happens, use -fexcess-precision=standard.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc:
Add -fexcess-precision=standard to options.
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Likewise.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
5 days agolibstdc++: Adjust tests to work for -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL
Jonathan Wakely [Wed, 17 Dec 2025 13:58:21 +0000 (13:58 +0000)] 
libstdc++: Adjust tests to work for -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc
[_GLIBCXX_USE_OLD_GENERATE_CANONICAL]: Restore test01. Do not discard an
extra value in test02.
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Skip if _GLIBCXX_USE_OLD_GENERATE_CANONICAL is defined in options.

5 days agoa68: fix handling of flex modes in complete_encoded_mode [PR algol68/123006]
Jose E. Marchesi [Wed, 17 Dec 2025 17:17:26 +0000 (18:17 +0100)] 
a68: fix handling of flex modes in complete_encoded_mode [PR algol68/123006]

gcc/algol68/ChangeLog

PR algol68/123006
* a68-imports.cc (complete_encoded_mode): Fix handling of flex
modes.

5 days agoa68: fix imports in big-endian targets [PR algol68/123132]
Jose E. Marchesi [Wed, 17 Dec 2025 17:03:15 +0000 (18:03 +0100)] 
a68: fix imports in big-endian targets [PR algol68/123132]

This commit fixes the macro DOFFSET in big-endian targets.
Tested in sparc64-linux-gnu in both -m64 and -m32.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

PR algol68/123132
* a68-imports.cc (DOFFSET): Fix big-endian path.

5 days agoa68: remove multiple definition module from testcase
Jose E. Marchesi [Wed, 17 Dec 2025 16:55:53 +0000 (17:55 +0100)] 
a68: remove multiple definition module from testcase

We have removed support for having multiple definition modules in a
single prelude packet.  This commit updates a testcase that was missed
before.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/testsuite/ChangeLog

* algol68/execute/modules/module11.a68: Remove multiple definition
module.

5 days agoPR modula2/23178: reduce error message clutter when reporting a non procedure
Gaius Mulley [Wed, 17 Dec 2025 17:02:09 +0000 (17:02 +0000)] 
PR modula2/23178: reduce error message clutter when reporting a non procedure

This bug fix corrects the token of an error message when reporting
about a symbol which was not exported from a definition module.
The reimplemented procedure CheckCanBeImported uses MetaError2
with the spell hint format specifier if the symbol is unknown
rather than the older WriteFormat2 procedure.

gcc/m2/ChangeLog:

PR modula2/23178
* gm2-compiler/P3SymBuild.mod (CheckCanBeImported): Reimplement to
use MetaError2 and provide spell hints if possible for unknown symbols.

gcc/testsuite/ChangeLog:

PR modula2/23178
* gm2/pim/fail/badprocedure.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
5 days agoAVR: Tweak shift execution times in some cases.
Georg-Johann Lay [Tue, 16 Dec 2025 19:49:31 +0000 (20:49 +0100)] 
AVR: Tweak shift execution times in some cases.

When the tail reg (last register) in a shift is an upper register,
then inserting a sequence of 0s and a 1 into the tail register
only takes 2 instruction.  The preparation will be one instruction
longer, but the loop body will be one instruction shorter, saving
count-1 cycles.

For example uint32_t R22 >> 5 will turn from:

    ldi srcatch, 5
1:  lsr r25
    ror r24
    ror r23
    ror r22
    dec scratch
    brne 1b

to:

    andi r22,-32   ; Set lower 5 bits to 0.
    ori r22,16     ; Set bit 4 to 1.
    ;; Now r22 = 0b***10000
1:  lsr r25
    ror r24
    ror r23
    ror r22
    brcc 1b        ; Carry will be 0, 0, 0, 0, 1.

gcc/
* config/avr/avr.cc (avr_out_shift_with_cnt): Tweak
execution time by count-1 cycles in some cases.

5 days agoAVR: Refactor avr.cc::out_shift_with_cnt().
Georg-Johann Lay [Tue, 16 Dec 2025 17:08:14 +0000 (18:08 +0100)] 
AVR: Refactor avr.cc::out_shift_with_cnt().

This is a no-op refactoring of out_shift_with_cnt() that passes the
shift rtx_code instead of an template asm string.

gcc/
* config/avr/avr-protos.h (out_shift_with_cnt): Remove.
* config/avr/avr.cc (avr_out_shift_with_cnt): New static
function from out_shift_with_cnt: Pass shift rtx_code instead
of asm template.
(avr_out_shift_1): New static helper function.
(ashlqi3_out, ashlhi3_out, avr_out_ashlpsi3, ashlsi3_out)
(ashrqi3_out, ashrhi3_out, avr_out_ashrpsi3, ashrsi3_out)
(lshrqi3_out, lshrhi3_out, avr_out_lshrpsi3, lshrsi3_out):
Adjust avr_out_shift_with_cnt to new interface.

5 days agoFix testsuite/123166 - add missing dg-do run
Ulrich Weigand [Wed, 17 Dec 2025 16:36:56 +0000 (17:36 +0100)] 
Fix testsuite/123166 - add missing dg-do run

The patch I committed a few years ago to remove SPU support
https://gcc.gnu.org/pipermail/gcc-patches/2019-September/529052.html
accidentally completely removed the { dg-do run } annotations
in four gfortran.dg test cases.  Add them back.

gcc/testsuite/ChangeLog:

PR testsuite/123166
* gfortran.dg/bessel_6.f90: Add { dg-do run } annotation.
* gfortran.dg/erf_2.F90: Likewise.
* gfortran.dg/integer_exponentiation_3.F90: Likewise.
* gfortran.dg/integer_exponentiation_5.F90: Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
5 days agoFix various RISC-V testsuite regressions after volatile patch
Jeff Law [Wed, 17 Dec 2025 16:08:09 +0000 (09:08 -0700)] 
Fix various RISC-V testsuite regressions after volatile patch

The RISC-V port showed a handful of regressions after integrating the final
patch from HJ for volatile accesses.

The core issue is the RISC-V port has two patterns which are basically the same
RTL form with the exception of a clobber of a scratch operand.

Those patterns do differ materially in their condition in that one is more
strict than the other.  The pattern with the stricter condition also happens to
be the one without the clobber.  So it's clearly stricter across both of those
axis.

The stricter pattern naturally generates more efficient (loopless) code for the
relevant atomic operations.  We have a handful of tests in the RISC-V port
which verify that we use the right sequences.

With HJ's patch the insn gets re-matched during combine which adds the clobber
and ultimately matches the more general pattern (which is currently first in
the MD file).  So we end up with the less efficient sequence and the relevant
tests naturally fail.

This patch just puts the two patterns in the right order with the stricter
pattern coming first.  I also walked through the rest of the sync.md patterns
and none obviously had the same problem.

This has been bootstrapped and regression tested on risc-v with both the
Pioneer and BPI F3 systems.

I'll let pre-commit CI chew on it overnight before the planned commit tomorrow.

jeff

gcc/
* config/riscv/sync.md (atomic compare and set): Reorder patterns
so the stricter pattern comes first.

5 days ago[committed] Another MAINTAINERS update
Jeff Law [Wed, 17 Dec 2025 14:30:51 +0000 (07:30 -0700)] 
[committed] Another MAINTAINERS update

My oss.qualcomm.com address is set up, so I'll be using that for contributions
going forward.  This updates the MAINTAINERS file.

/
* MAINTAINERS: Use my oss.qualcomm.com address.

5 days agolibgomp: Fix libgomp.c/affinity-1.c on non-Linux
Rainer Orth [Wed, 17 Dec 2025 14:39:20 +0000 (15:39 +0100)] 
libgomp: Fix libgomp.c/affinity-1.c on non-Linux

The new libgomp.c/affinity-1.c test FAILs on Solaris and Darwin:

FAIL: libgomp.c/affinity-1.c (test for excess errors)

Excess errors:
libgomp.c/affinity-1.c:194:3: warning: 'omp_proc_bind_master' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:267:3: warning: 'omp_set_nested' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:272:5: warning: 'omp_proc_bind_master' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:285:43: warning: 'master' affinity deprecated since OpenMP 5.1, use 'primary' [-Wdeprecated-openmp]

and several more.  This happens because the required -Wno-* options have
only been added for Linux.  This patch adds them unconditionally
instead.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
x86_64-apple-darwin25.1.0, and x86_64-pc-linux-gnu.

2025-12-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libgomp:
* testsuite/libgomp.c/affinity-1.c: Always add warnings.

5 days agoc++: adjust comment wording in cp_parser_init_declarator
benwu25 [Wed, 17 Dec 2025 13:54:00 +0000 (20:54 +0700)] 
c++: adjust comment wording in cp_parser_init_declarator

It seems likely the original author meant to use either "and" or "for"
in this comment rather than both. We can remove the "for" to make it
slightly more clear that the declarator for the function-definition
and everything left in the function-definition would be handled here.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_init_declarator): Adjust comment.

Signed-off-by: Ben Wu <soggysocks206@gmail.com>
5 days agolibstdc++: Move new std::generate_canonical to inline namespace
Jonathan Wakely [Wed, 17 Dec 2025 10:17:37 +0000 (10:17 +0000)] 
libstdc++: Move new std::generate_canonical to inline namespace

This ensures that the new definition of std::generate_canonical has a
different mangled name from the old one, so that TUs compiled with GCC
16 will be sure to use the new definition, even if the linker also sees
a symbol instantiated from the old definition. We use the same _V2
inline namespace as used elsewhere (std::_V2::condition_variable,
std::_V2::__rotate, and std::chrono::_V2::system_clock), and use a macro
to add it conditionally so that it's not used for the ABI-unstable
gnu-versioned-namespace configuration.

We can simplify the 26_numerics/random/pr60037-neg.cc test to only use
one dg-error without a line number, so that it matches any of the three
relevant static_assert failures for this test: the one from _Adaptor in
<bits/random.h> and the ones from the new and old definitions of
std::generate_canonical in <bits/random.tcc>. Without this change, the
line number for the dg-error matching the <bits/random.tcc> error
depends on the _GLIBCXX_USE_OLD_GENERATE_CANONICAL macro, which is
awkward to depend on in the test (because DejaGnu sees all dg-error
directives, it doesn't care if they're guarded by #ifdef preprocessor
checks).

libstdc++-v3/ChangeLog:

* include/bits/random.h [!_GLIBCXX_USE_OLD_GENERATE_CANONICAL]
(generate_canonical): Use inline namespace _V2.
* include/bits/random.tcc [!_GLIBCXX_USE_OLD_GENERATE_CANONICAL]
(generate_canonical): Likewise.
* testsuite/26_numerics/random/pr60037-neg.cc: Remove lineno so
that one dg-error matches both diagnostics.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 days agolibstdc++: Restore braces around body of if-statement
Jonathan Wakely [Wed, 17 Dec 2025 09:55:20 +0000 (09:55 +0000)] 
libstdc++: Restore braces around body of if-statement

libstdc++-v3/ChangeLog:

* include/bits/random.tcc [_GLIBCXX_USE_OLD_GENERATE_CANONICAL]
(generate_canonical): Restore braces around statement.

5 days agoPR modula2/123151: Unable to use IsNoError with Close in FIO library module
Gaius Mulley [Wed, 17 Dec 2025 13:00:33 +0000 (13:00 +0000)] 
PR modula2/123151: Unable to use IsNoError with Close in FIO library module

This is a bug fix to the library module FIO to allow Close to return a
boolean indicating success.  Most probably in the future there should be
a GetStatus procedure provided and the FileStatus enumeration inside
FIO.mod should also be exported.

gcc/m2/ChangeLog:

PR modula2/123151
* gm2-libs/FIO.def (IsError): New procedure function.
(IsActive): Rewrite the comment.
(Exists): Ditto.
(OpenToRead): Ditto.
(OpenToWrite): Ditto.
(Close): Add an optional BOOLEAN return result.
* gm2-libs/FIO.mod (Close): Reimplement with an
optional BOOLEAN return result.

gcc/testsuite/ChangeLog:

PR modula2/123151
* gm2/pimlib/base/run/pass/FIO.mod: Reimplement.
Copy from gm2-libs/FIO.mod since FIO.def api has changed.
* gm2/pimlib/run/pass/testclose.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
5 days agotestsuite: i386: Restrict gcc.target/i386/pr120881-1?.c to Linux
Rainer Orth [Wed, 17 Dec 2025 12:20:20 +0000 (13:20 +0100)] 
testsuite: i386: Restrict gcc.target/i386/pr120881-1?.c to Linux

Two tests FAIL on Solaris x86:

FAIL: gcc.target/i386/pr120881-1a.c  at line 4 (test for warnings, line )
FAIL: gcc.target/i386/pr120881-1b.c  at line 4 (test for warnings, line )

producing no message contrary to what the tests expect.  The reason is
similar to previous instances: Solaris doesn't support -mfentry.  Like
previous cases, this patch thus restricts them to Linux.

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

2025-12-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.target/i386/pr120881-1a.c: Restrict to Linux.
* gcc.target/i386/pr120881-1b.c: Likewise.

5 days agotestsuite: c++: Skip g++.dg/cpp26/literals2.C on Solaris [PR112652]
Rainer Orth [Wed, 17 Dec 2025 12:17:32 +0000 (13:17 +0100)] 
testsuite: c++: Skip g++.dg/cpp26/literals2.C on Solaris [PR112652]

The g++.dg/cpp26/literals2.C FAILs on Solaris like this:

FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 10)
FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 11)
FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 13)
FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 41)
FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 42)
FAIL: g++.dg/cpp26/literals2.C  -std=gnu++11  (test for errors, line 44)

As discussed in the PR, this is an issue with the Solaris iconv
implementation.  While one could fix it by requiring GNU libiconv or
implement a workaround in libcpp, it seems easier to just skip the test
on Solaris.  xfailing it isn't really an option since that would have to
be applied to every single affected dg-error which seems overkill.

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

2024-03-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR c++/112652
* g++.dg/cpp26/literals2.C: Skip on Solaris.

5 days agotestsuite: diagnostics: Fix gcc.dg/plugin/crash-test-nested-write-through-null.c...
Rainer Orth [Wed, 17 Dec 2025 12:15:12 +0000 (13:15 +0100)] 
testsuite: diagnostics: Fix gcc.dg/plugin/crash-test-nested-write-through-null.c etc. on Solaris

Two diagnosics tests currently FAIL on Solaris:

FAIL: gcc.dg/plugin/crash-test-nested-write-through-null.c crash-test-nested-write-through-null-sarif.py::test_notificatio
FAIL: gcc.dg/plugin/crash-test-nested-write-through-null.c crash-test-nested-write-through-null-html.py::test_result

The reason is the same in both cases: the tests expect a

Segmentation fault

message, while the capitalization is different on Solaris:

Segmentation Fault

This patch allows for both forms, adjusting
crash-test-write-through-null-stderr.c in a similar way.

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

2025-12-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.dg/plugin/crash-test-nested-write-through-null-html.py:
Import re.
(test_results): Allow for "Segmentation Fault", too.
* gcc.dg/plugin/crash-test-nested-write-through-null-sarif.py:
Likewise.
* gcc.dg/plugin/crash-test-write-through-null-stderr.c
(test_inject_write_through_null): Likewise.

5 days agoc++: clear in_declarator_p before parsing a lambda [PR121443]
benwu25 [Wed, 17 Dec 2025 11:59:05 +0000 (18:59 +0700)] 
c++: clear in_declarator_p before parsing a lambda [PR121443]

We should set parser->in_declarator_p to false when parsing a lambda.
In this testcase, for example, a lambda in a function declarator
could contain a constructor, which would be disallowed in
cp_parser_decl_specifier_seq since in_declarator_p was true.

PR c++/121443

gcc/cp/ChangeLog:

* parser.cc (cp_parser_lambda_expression): Clear
in_declarator_p.

gcc/testsuite/ChangeLog:

* g++.dg/parse/pr121443.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
6 days agoc++: Don't record lambdas in concept evaluations [PR123075]
Nathaniel Shead [Sat, 13 Dec 2025 22:32:50 +0000 (09:32 +1100)] 
c++: Don't record lambdas in concept evaluations [PR123075]

When evaluating a concept definition in a template, any lambdas in the
definition of the concept get instantiated in the context of where the
evaluation occurred.

This causes two issues:

- Any lambdas declared later in the body of the function get the wrong
  discriminator, which causes ABI divergences with Clang.

- Modules streaming gets confused, because the lambda is keyed to an
  unrelated declaration.  Keying the lambda to the concept also doesn't
  work because we'd really want to key it to a concept instantiation
  (that doesn't exist) so that merging works correctly.

I think really we just want to throw away these lambdas declarations
after evaluating the concept.  They can (and will) be recreated in
importers re-evaluating the concept with the given args regardless.

This patch implements this by disabling scope recording for an
instantiation of a lambda keyed to a concept, and pushing into an
unrelated context so that the lambda's type is not mistakenly added
into the scope it was instantiated from.

PR c++/123075

gcc/cp/ChangeLog:

* constraint.cc (evaluate_concept_check): Push to an unrelated
scope, but keep the same access context.
* pt.cc (tsubst_lambda_expr): Don't record lambda scopes for
lambdas attached to a concept.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-lambda25.C: New test.
* g++.dg/modules/lambda-13.h: New test.
* g++.dg/modules/lambda-13_a.H: New test.
* g++.dg/modules/lambda-13_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
6 days agolibstdc++: Make declaration and definition of generate_canonical consistent.
Tomasz Kamiński [Wed, 17 Dec 2025 09:32:54 +0000 (10:32 +0100)] 
libstdc++: Make declaration and definition of generate_canonical consistent.

The r16-6177-g866bc8a9214b1d introduced type-constraint on _Urbg template
parameter in __glibcxx_concepts, with was inconsistent with declaration in
bits/random.h and definition in bits/random.tcc causing the missing symbol
errors in tests.

Furthermore, this made the mangled name of generate_canonical in C++20
mode different from older standard and previous versions of GCC.

libstdc++-v3/ChangeLog:

* include/bits/random.tcc (generate_canonical)
[!_GLIBCXX_USE_OLD_GENERATE_CANONICAL]: Use static_assert
instead of type-constraint on template parameter.
* testsuite/26_numerics/random/pr60037-neg.cc: Updated line
of error.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
6 days agolibstdc++: Fixed failing dg-error in random/pr60037-neg.cc tests.
Tomasz Kamiński [Wed, 17 Dec 2025 09:32:54 +0000 (10:32 +0100)] 
libstdc++: Fixed failing dg-error in random/pr60037-neg.cc tests.

libstdc++-v3/ChangeLog:

* include/bits/random.tcc (generate_canonical): Update
error message to match pre-existing one in random.h.
* testsuite/26_numerics/random/pr60037-neg.cc: Updated
line for error message.

6 days agolibstdc++: Fix up all_pedantic_errors.cc
Jakub Jelinek [Wed, 17 Dec 2025 08:16:46 +0000 (09:16 +0100)] 
libstdc++: Fix up all_pedantic_errors.cc

On x86_64-linux I see
On x86_64-linux
FAIL: 17_intro/headers/c++1998/all_pedantic_errors.cc  -std=gnu++17 (test for excess errors)
Excess errors:
/home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3681: error: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
/home/jakub/src/gcc/obj20/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/random.tcc:3698: error: ISO C++ does not support '__int128' for 'type name' [-Wpedantic]
This fixes it by adding __extension__.

2025-12-17  Jakub Jelinek  <jakub@redhat.com>

* include/bits/random.tcc (std::generate_canonical): Use
__extension__ before __generate_canonical_{pow2,any} calls with
unsigned __int128 template arguments.

6 days agoi386: Obfuscate _mm_maskmove_si64 local variable [PR123155]
Jakub Jelinek [Wed, 17 Dec 2025 08:13:58 +0000 (09:13 +0100)] 
i386: Obfuscate _mm_maskmove_si64 local variable [PR123155]

Even automatic variables in inline functions in installed headers need to be
obfuscated, as e.g.
is a valid program.  Most of the automatic variables are obfuscated, but one
has leaked in in the xmmintrin.h header.
gcc -S -O2 -O2 -Werror-implicit-function-declaration -march=novalake -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -msha -mxsavec -mxsaves -mclflushopt -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mavx10.2 -mamx-avx512 -mamx-tf32 -mamx-fp8 -mmovrs -mamx-movrs -g -dA gcc/testsuite/gcc.target/i386/sse-13.c -fno-eliminate-unused-debug-{symbols,types} -o sse-13.s
grep -A1 DW_TAG_variable sse-13.s | grep DW_AT_name | grep -v 'scii "__' | grep -v 'DW_AT_name: "__'
shows variables not prefixed with __ and the following patch fixes it.

2025-12-17  Jakub Jelinek  <jakub@redhat.com>

PR target/123155
* config/i386/xmmintrin.h (_mm_maskmove_si64): Rename offset automatic
variable to __offset.

6 days agoi386: Obfuscate avx10_2bf16intrin.h inline function arguments [PR123155]
Jakub Jelinek [Wed, 17 Dec 2025 08:12:42 +0000 (09:12 +0100)] 
i386: Obfuscate avx10_2bf16intrin.h inline function arguments [PR123155]

Function arguments in installed headers need to be obfuscated (unlike
object-like macro arguments), as e.g.
is a valid program.  Most of the arguments are obfuscated, but some
leaked in in the avx10_2bf16intrin.h header.
gcc -S -O2 -O2 -Werror-implicit-function-declaration -march=novalake -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp  -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -msha -mxsavec -mxsaves -mclflushopt -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl -mavxvnni -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mavx10.2 -mamx-avx512 -mamx-tf32 -mamx-fp8 -mmovrs -mamx-movrs -g -dA gcc/testsuite/gcc.target/i386/sse-13.c -fno-eliminate-unused-debug-{symbols,types} -o sse-13.s
grep -A1 DW_TAG_formal_parameter sse-13.s | grep DW_AT_name | grep -v 'scii "__' | grep -v 'DW_AT_name: "__'
shows arguments not prefixed with __ and the following patch fixes them.

2025-12-17  Jakub Jelinek  <jakub@redhat.com>

PR target/123155
* config/i386/avx10_2bf16intrin.h (_mm512_roundscale_pbh,
_mm512_mask_roundscale_pbh, _mm512_maskz_roundscale_pbh,
_mm256_roundscale_pbh, _mm256_mask_roundscale_pbh,
_mm256_maskz_roundscale_pbh, _mm_roundscale_pbh,
_mm_mask_roundscale_pbh, _mm_maskz_roundscale_pbh,
_mm512_reduce_pbh, _mm512_mask_reduce_pbh, _mm512_maskz_reduce_pbh,
_mm256_reduce_pbh, _mm256_mask_reduce_pbh, _mm256_maskz_reduce_pbh,
_mm_reduce_pbh, _mm_mask_reduce_pbh, _mm_maskz_reduce_pbh): Rename
B argument to __B.

6 days agogccrs: Change parser template implementation file ext
Pierre-Emmanuel Patry [Thu, 4 Dec 2025 12:22:04 +0000 (13:22 +0100)] 
gccrs: Change parser template implementation file ext

We have a few more template implementation files within the rust frontend
that use the hxx extension to make their content clear and highlight the
missing header guards.

gcc/rust/ChangeLog:

* parse/rust-parse-impl-lexer.cc: Fix included file name.
* parse/rust-parse-impl-macro.cc: Likewise.
* parse/rust-parse-impl-proc-macro.cc: Likewise.
* parse/rust-parse-impl.h: Move to...
* parse/rust-parse-impl.hxx: ...here.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Split parser implementation into several files
Pierre-Emmanuel Patry [Wed, 3 Dec 2025 14:22:48 +0000 (15:22 +0100)] 
gccrs: Split parser implementation into several files

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_inner_attributes): Move to
rust-parse-impl-XXX.hxx implementation file.
(Parser::parse_doc_comment): Likewise. Change return type to
AttributeBody.
(Parser::parse_inner_attribute): Likewise.
(Parser::parse_attribute_body): Likewise.
(Parser::parse_identifier_or_keyword_token): Likewise.
(Parser::parse_outer_attributes): Likewise.
(Parser::is_macro_rules_def): Likewise.
(Parser::parse_simple_path): Likewise.
(Parser::parse_item): Likewise.
(Parser::parse_simple_path_segment): Likewise.
(Parser::parse_path_ident_segment): Likewise.
(Parser::parse_vis_item): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_async_item): Likewise.
(Parser::parse_delim_token_tree): Likewise.
(Parser::parse_macro_rules_def): Likewise.
(Parser::parse_decl_macro_def): Likewise.
(Parser::parse_token_tree): Likewise.
(Parser::parse_visibility): Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_outer_attribute): Likewise.
(Parser::parse_extern_crate): Likewise.
(Parser::parse_use_decl): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_function): Likewise.
(Parser::parse_macro_invocation): Likewise.
(Parser::parse_macro_rule): Likewise.
(Parser::parse_function_qualifiers): Likewise.
(Parser::parse_macro_matcher): Likewise.
(Parser::parse_generic_params_in_angles): Likewise.
(Parser::parse_macro_match): Likewise.
(Parser::parse_generic_param): Likewise.
(Parser::parse_macro_match_fragment): Likewise.
(Parser::parse_macro_match_repetition): Likewise.
(Parser::parse_generic_params): Likewise.
(Parser::parse_lifetime_params): Likewise.
(Parser::parse_lifetime_params_objs): Likewise.
(Parser::parse_lifetime_param): Likewise.
(Parser::parse_type_params): Likewise.
(Parser::parse_type_param): Likewise.
(Parser::parse_function_params): Likewise.
(Parser::parse_function_param): Likewise.
(Parser::parse_function_return_type): Likewise.
(Parser::parse_where_clause): Likewise.
(Parser::parse_lifetime_where_clause_item): Likewise.
(Parser::parse_for_lifetimes): Likewise.
(Parser::parse_type_param_bounds): Likewise.
(Parser::parse_type_param_bound): Likewise.
(Parser::parse_trait_bound): Likewise.
(Parser::parse_lifetime_bounds): Likewise.
(Parser::parse_lifetime): Likewise.
(Parser::lifetime_from_token): Likewise.
(Parser::parse_external_type_item): Likewise.
(Parser::parse_type_alias): Likewise.
(Parser::parse_struct): Likewise.
(Parser::parse_struct_fields): Likewise.
(Parser::parse_struct_field): Likewise.
(Parser::parse_tuple_fields): Likewise.
(Parser::parse_tuple_field): Likewise.
(Parser::parse_enum): Likewise.
(Parser::parse_enum_items): Likewise.
(Parser::parse_enum_item): Likewise.
(Parser::parse_union): Likewise.
(Parser::parse_const_item): Likewise.
(Parser::parse_static_item): Likewise.
(Parser::parse_trait): Likewise.
(Parser::parse_trait_item): Likewise.
(Parser::parse_trait_type): Likewise.
(Parser::parse_trait_const): Likewise.
(Parser::parse_impl): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_extern_block): Likewise.
(Parser::parse_external_item): Likewise.
(Parser::parse_stmt): Likewise.
(Parser::parse_let_stmt): Likewise.
(Parser::parse_generic_arg): Likewise.
(Parser::parse_path_generic_args): Likewise.
(Parser::parse_generic_args_binding): Likewise.
(Parser::parse_self_param): Likewise.
(Parser::parse_expr_stmt): Likewise.
(Parser::parse_anon_const): Likewise.
(Parser::parse_const_block_expr): Likewise.
(Parser::parse_grouped_expr): Likewise.
(Parser::parse_type_path): Likewise.
(Parser::parse_closure_expr): Likewise.
(Parser::parse_literal_expr): Likewise.
(Parser::parse_box_expr): Likewise.
(Parser::parse_return_expr): Likewise.
(Parser::parse_try_expr): Likewise.
(Parser::parse_break_expr): Likewise.
(Parser::parse_continue_expr): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_loop_label): Likewise.
(Parser::parse_type_path_function): Likewise.
(Parser::parse_if_expr): Likewise.
(Parser::parse_path_in_expression): Likewise.
(Parser::parse_path_expr_segment): Likewise.
(Parser::parse_if_let_expr): Likewise.
(Parser::parse_loop_expr): Likewise.
(Parser::parse_qualified_path_in_type): Likewise.
(Parser::parse_labelled_loop_expr): Likewise.
(Parser::parse_match_expr): Likewise.
(Parser::parse_match_arm): Likewise.
(Parser::parse_match_arm_patterns): Likewise.
(Parser::parse_async_block_expr): Likewise.
(Parser::parse_array_expr): Likewise.
(Parser::parse_closure_param): Likewise.
(Parser::parse_type): Likewise.
(Parser::parse_paren_prefixed_type): Likewise.
(Parser::parse_for_prefixed_type): Likewise.
(Parser::parse_maybe_named_param): Likewise.
(Parser::parse_reference_type_inner): Likewise.
(Parser::parse_reference_type): Likewise.
(Parser::parse_raw_pointer_type): Likewise.
(Parser::parse_slice_or_array_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
(Parser::parse_paren_prefixed_type_no_bounds): Likewise.
(Parser::parse_literal_or_range_pattern): Likewise.
(Parser::parse_range_pattern_bound): Likewise.
(Parser::parse_pattern): Likewise.
(Parser::parse_pattern_no_alt): Likewise.
(Parser::parse_reference_pattern): Likewise.
(Parser::parse_grouped_or_tuple_pattern): Likewise.
(Parser::parse_slice_pattern): Likewise.
(Parser::parse_identifier_pattern): Likewise.
(Parser::parse_ident_leading_pattern): Likewise.
(Parser::parse_struct_pattern_elems): Likewise.
(Parser::parse_struct_pattern_field): Likewise.
(Parser::unexpected_token): Likewise.
(Parser::skip_after_semicolon): Likewise.
(Parser::skip_token): Likewise.
(Parser::maybe_skip_token): Likewise.
(Parser::expect_token): Likewise.
(Parser::skip_after_end): Likewise.
(Parser::skip_after_end_block): Likewise.
(Parser::skip_after_next_block): Likewise.
(Parser::skip_after_end_attribute): Likewise.
(Parser::done_end_or_else): Likewise.
(Parser::done_end): Likewise.
* parse/rust-parse.h: Change function return type to AttributeBody
instead of a tuple (parse_doc_comment). Move enum binding powers from
impl file.
* parse/rust-parse-impl-attribute.hxx: New file.
* parse/rust-parse-impl-macro.hxx: New file.
* parse/rust-parse-impl-path.hxx: New file.
* parse/rust-parse-impl-pattern.hxx: New file.
* parse/rust-parse-impl-ttree.hxx: New file.
* parse/rust-parse-impl-utils.hxx: New file.
* parse/rust-parse-impl-expr.hxx: New file.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Move function to utils namespace
Pierre-Emmanuel Patry [Wed, 3 Dec 2025 13:05:10 +0000 (14:05 +0100)] 
gccrs: Move function to utils namespace

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (can_tok_start_type): Move function from ...
* parse/rust-parse-utils.h (can_tok_start_type): ... to here.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Move is_right_angle_tok to util namespace
Pierre-Emmanuel Patry [Wed, 3 Dec 2025 13:02:07 +0000 (14:02 +0100)] 
gccrs: Move is_right_angle_tok to util namespace

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (is_right_angle_tok): Move function ...
(Parser::parse_generic_params_in_angles): Change call.
(Parser::parse_for_lifetimes): Likewise.
(Parser::parse_path_generic_args): Likewise.
* parse/rust-parse-utils.h (is_right_angle_tok): ... to here.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Remove static buffer size and improve error message
Pierre-Emmanuel Patry [Tue, 9 Dec 2025 05:52:13 +0000 (06:52 +0100)] 
gccrs: Remove static buffer size and improve error message

gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::enable_dump): Rework error message
and remove magic value.
(Session::handle_excluded_node): Remove static buffer size.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Add dump configuration options, fix node exclusion
Pierre-Emmanuel Patry [Tue, 9 Dec 2025 04:49:03 +0000 (05:49 +0100)] 
gccrs: Add dump configuration options, fix node exclusion

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::begin_describe_node):
Remove function.
(TokenCollector::end_describe_node): Likewise.
(TokenCollector::describe_node): Remove calls to begin/end.
* ast/rust-ast-collector.h: Specialize begin and end collect items. Add
more constructors to begin/end description.
* ast/rust-ast-dump.cc (Dump::Dump): Adapt to new configuration
options.
* ast/rust-ast-dump.h: Add new configuration options.
* rust-session-manager.cc (Session::dump_ast_pretty_internal): Use new
configuration options.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Refactor node description in AST dump
Pierre-Emmanuel Patry [Tue, 9 Dec 2025 03:00:38 +0000 (04:00 +0100)] 
gccrs: Refactor node description in AST dump

Rename the functions and split internal comments from node description.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::comment): Use comment kind
(TokenCollector::begin_internal_comment): Rename from this...
(TokenCollector::begin_describe_node): ... to this.
(TokenCollector::end_internal_comment): Rename from this...
(TokenCollector::end_describe_node): ... to this.
(TokenCollector::internal_comment): Rename from this...
(TokenCollector::describe_node): ... to this.
(TokenCollector::visit): Change name in function calls.
(TokenCollector::visit_closure_common): Likewise.
(TokenCollector::visit_loop_common): Likewise.
* ast/rust-ast-collector.h: Adapt function prototypes, add a new
collect item kind for node description.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Rework code to call one function when add comment
Benjamin Thos [Thu, 12 Dec 2024 13:51:53 +0000 (14:51 +0100)] 
gccrs: Rework code to call one function when add comment

When we want to add an internal comment we know call one function that
wrap the code instead of calling two function, one at the beginning one
at the end.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::internal_comment):
Wrapper function to add both  comment.
(TokenCollector::visit): call of the wrapper function.
(TokenCollector::visit_closure_common): Same.
(TokenCollector::visit_loop_common): Same.
* ast/rust-ast-collector.h: Prototype of the wrapper function

Signed-off-by: Benjamin Thos <benjamin.thos@epita.fr>
6 days agogccrs: Add clarity to the code
Benjamin Thos [Thu, 31 Oct 2024 13:44:29 +0000 (13:44 +0000)] 
gccrs: Add clarity to the code

Use an enum instead of bool to check if a comment is internal, use good
include and replace some variable name.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::begin_internal_comment):
Change a boolean with an enum.
(TokenCollector::end_internal_comment): Likewise.
* ast/rust-ast-collector.h: Likewise + change include.
* ast/rust-ast-dump.cc (Dump::Dump): Change variable name.
* ast/rust-ast-dump.h: Likewise + replace vector with a set.
* rust-session-manager.cc (Session::enable_dump): Change variable
name.
(Session::handle_internal_blacklist): Change function name.
(Session::handle_excluded_node): Likewise.
(Session::dump_ast_pretty_internal): Change vector with a set.
* rust-session-manager.h (struct CompileOptions): Likewise + change
variable name.

Signed-off-by: Benjamin Thos <benjamin.thos@epita.fr>
6 days agogccrs: Add dump option to show node
Benjamin Thos [Tue, 22 Oct 2024 13:06:36 +0000 (13:06 +0000)] 
gccrs: Add dump option to show node

Add a new dump option to show node node as
internal comment with a blacklist to ignore some
node.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::begin_internal_comment):
Add internal comment to print node beginning.
(TokenCollector::end_internal_comment): Add internal comment to print
node end.
(TokenCollector::visit): Add the comments of the node visited.
(TokenCollector::visit_closure_common): Likewise.
(TokenCollector::visit_loop_common): Likewise.
* ast/rust-ast-collector.h: Add internal comment as a nes Kind.
* ast/rust-ast-dump.cc (Dump::Dump): add a Dump constructor to enable
internal.
* ast/rust-ast-dump.h: Add printing of internal comment in the dump
* rust-session-manager.cc (Session::enable_dump): Activate ast dump
and fill the blacklist.
(Session::handle_internal_blacklist): Parse the flag to get node to
be blacklisted.
(Session::compile_crate): Launch ast dump internal when asked.
(Session::dump_ast_pretty_internal): Call the visitor to dump
the internals.
* rust-session-manager.h (struct CompileOptions): add Interal in
Dump option enum.

Signed-off-by: Benjamin Thos <benjamin.thos@epita.fr>
6 days agogccrs: Use the path location for MetaItemPathExpr
Pierre-Emmanuel Patry [Fri, 5 Dec 2025 15:55:47 +0000 (16:55 +0100)] 
gccrs: Use the path location for MetaItemPathExpr

Previously we aborted when querying the location on a MetaItemPathExpr,
the location should start on the path and continue over the expr but we
do not support that kind of location range yet.

gcc/rust/ChangeLog:

* ast/rust-expr.h: Use path locus.

gcc/testsuite/ChangeLog:

* rust/compile/issue-4301.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agogccrs: Use tl::expected in the parser to avoid error state
Pierre-Emmanuel Patry [Mon, 17 Nov 2025 14:01:14 +0000 (15:01 +0100)] 
gccrs: Use tl::expected in the parser to avoid error state

We made heavy use of error state within some AST node and it was the
source of multiple errors, and caused confusion with (null) pointers.
This commit removes some error state use within our parser in an attempt
to remove those error states later.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_inner_attributes): Change
return type to avoid empty/error values that may break invariants in
the AST.
(Parser::parse_inner_attribute): Likewise.
(Parser::parse_outer_attribute): Likewise.
(Parser::parse_outer_attributes): Likewise.
(Parser::parse_attribute_body): Likewise.
(Parser::parse_simple_path): Likewise.
(Parser::parse_macro_invocation): Likewise.
(Parser::parse_visibility): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_delim_token_tree): Likewise.
(Parser::parse_identifier_or_keyword_token): Likewise.
(Parser::parse_token_tree): Likewise.
(Parser::parse_macro_rules_def): Likewise.
(Parser::parse_decl_macro_def): Likewise.
(Parser::parse_macro_invocation): Likewise.
(Parser::parse_macro_rule): Likewise.
(Parser::parse_macro_matcher): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_path_expr_segment): Likewise.
(Parser::parse_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
(Parser::parse_items): Circumvent GCC 5 to 7 bug.
(is_simple_path_segment): Move to utility file.
(token_id_matches_delims): Likewise.
(is_likely_path_next): Remove unused function.
(Parser::parse_attr_input): Return a structure instead of a tuple.
* expand/rust-macro-builtins-offset-of.cc: Adapt call to expected.
* ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Use empty
vector when an error is encountered.
* expand/rust-macro-builtins-include.cc: Likewise.
* parse/rust-parse.h: Update prototypes.
* parse/rust-parse-impl-proc-macro.cc: Likewise.
* ast/rust-ast.h: Remove error state from Visibility.
* ast/rust-item.h: Use private visibility instead of error.
* ast/rust-macro.h: Likewise.
* expand/rust-macro-expand.cc: Likewise.
* hir/rust-ast-lower.cc: Remove error case.
* rust-session-manager.cc: Use private visibility
* parse/rust-parse-utils.h: New file.
* parse/rust-parse-error.h: New file.

gcc/testsuite/ChangeLog:

* rust/compile/macros/mbe/macro-issue3608.rs: Update error messages.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
6 days agox86: Add AMD znver6 processor support
Umesh Kalvakuntla [Tue, 16 Dec 2025 09:28:50 +0000 (09:28 +0000)] 
x86: Add AMD znver6 processor support

For avx512bmm instructions, this patch adds the intrinsics support.
Code-generation and runtime tests will be added in the future patches.

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_amd_cpu): Add znver6 1Ah
family model numbers.
(get_available_features): Set feature AVX512BMM.
* common/config/i386/i386-common.cc (OPTION_MASK_ISA2_AVX512BMM_SET):
New macro.
(OPTION_MASK_ISA2_AVX512BMM_UNSET): New macro.
(OPTION_MASK_ISA2_AVX512BW_UNSET): Unset AVX512BMM.
(ix86_handle_option): Likewise.
* common/config/i386/i386-cpuinfo.h (enum processor_subtypes):
Add AMDFAM1AH_ZNVER6.
(enum processor_features): Add FEATURE_AVX512BMM.
* common/config/i386/i386-isas.h: Likewise.
* config.gcc: Add avx512bmmintrin.h, avx512bmmvlintrin.h,
znver6.
* config/i386/cpuid.h (bit_AVX512BMM): New macro.
* config/i386/driver-i386.cc (host_detect_local_cpu): Likewise.
* config/i386/i386-builtin.def (BDESC): Add AVX512BMM builtins.
* config/i386/i386-c.cc (ix86_target_macros_internal): Likewise.
* config/i386/i386-isa.def (AVX512BMM): Likewise.
* config/i386/i386-options.cc (m_ZNVER6): New macro.
(m_ZNVER): Add m_ZNVER6.
(processor_cost_table): Uses znver5_cost table for
PROCESSOR_ZNVER6 for now.
(ix86_valid_target_attribute_inner_p): Likewise.
* config/i386/i386.cc (ix86_reassociation_width): Likewise.
* config/i386/i386.h (enum processor_type): Likewise.
* config/i386/i386.md: Likewise.
* config/i386/i386.opt: Likewise.
* config/i386/i386.opt.urls: Likewise.
* config/i386/immintrin.h: Likewise.
* config/i386/sse.md (avx512bmm_vbmacor16x16x16_<mode>): New
define_insn.
(avx512bmm_vbmacxor16x16x16_<mode>): Likewise.
(avx512bmm_vbitrevb_<mode>_mask): Likewise.
(avx512bmm_vbitrevb_<mode>): Likewise.
* config/i386/x86-tune-sched.cc (ix86_issue_rate): Likewise.
(ix86_adjust_cost): Likewise.
* config/i386/x86-tune.def (X86_TUNE_FUSE_ALU_AND_BRANCH): Add
m_ZNVER6.
(X86_TUNE_FUSE_MOV_AND_ALU): Likewise.
(X86_TUNE_USE_SCATTER_2PARTS): Likewise.
(X86_TUNE_USE_SCATTER_4PARTS): Likewise.
(X86_TUNE_USE_SCATTER_8PARTS): Likewise.
(X86_TUNE_AVOID_256FMA_CHAINS): Likewise.
(X86_TUNE_AVOID_512FMA_CHAINS): Likewise.
(X86_TUNE_AVX512_MOVE_BY_PIECES): Likewise.
* doc/extend.texi: Likewise.
* doc/invoke.texi: Likewise.
* config/i386/avx512bmmintrin.h: New file.
* config/i386/avx512bmmvlintrin.h: New file.

gcc/testsuite/ChangeLog:

* g++.target/i386/mv29.C: Likewise.
* gcc.target/i386/funcspec-56.inc: Likewise.
* gcc.target/i386/avx512bmm-1.c: New test.
* gcc.target/i386/avx512bmmvl-1.c: New test.

6 days agolibstdc++: Provide conversion between atomic_ref of similar types.
Tomasz Kamiński [Wed, 3 Dec 2025 13:06:59 +0000 (14:06 +0100)] 
libstdc++: Provide conversion between atomic_ref of similar types.

This patch implements the P3860R1 (accepted as DR against C++20) and LWG4472.

The two constraints on the constructor (that T and U are similar types and
is_convertible_v<U*, T*>) are combined into a single check:
is_convertible_v<_Up(*)[1], _Tp(*)[1]>. While this check is not equivalent
for array of known bound to array of unknown bound conversions (T[N] to T[]),
this is irrelevant for atomic_ref, since instantiation with an array type is
ill-formed (due to the return type of load and other members).

The __atomic_ref_base constructor is modified to accept _Tp* instead of _Tp&.
This allows both the atomic_ref(atomic_ref<_Up> __other) and atomic_ref(_Tp& __t)
constructors to delegate to it. Furthermore, such approach does not require
dereferencing *__other._M_ptr, and thus avoid ADL-lookup for operator* and
issues related to it. The precondition check on alignment is moved specifically
to the atomic_ref(_Tp&) constructor, preventing redundant checks during atomic_ref
conversion.

A deleted atomic_ref(_Tp&&) constructor is introduced (per LWG4472).
This prevents the construction of atomic_ref<T> from atomic_ref<volatile T>
via the conversion operator.

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h
(__atomic_ref_base<const _Tp>::__atomic_ref_base): Accept
pointer instead of reference. Remove precondition check and
mark as noexcept.
(__atomic_ref_base<_Tp>::__atomic_ref_base): Accept pointer
insted of reference, and mark as noexcept.
* include/std/atomic (atomic_ref::atomic_ref(_Tp&)): Add
precondition check and take address of argument.
(atomic_ref::atomic_ref(_Tp&&)): Define as deleted.
(atomic_ref::atomic_ref(atomic_ref<_Up>)): Define.
* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count):
Pass address to __atomic_ref constructor.
* include/std/barrier (__tree_barrier_base::_M_arrive)
(__tree_barrier::arrive): Pass address to __atomic_ref constructor.
* testsuite/29_atomics/atomic_ref/ctor.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
6 days agoDaily bump.
GCC Administrator [Wed, 17 Dec 2025 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

6 days agolibstdc++: Optimize compilation time for signed/unsigned integer traits
Jonathan Wakely [Wed, 10 Dec 2025 14:26:17 +0000 (14:26 +0000)] 
libstdc++: Optimize compilation time for signed/unsigned integer traits

Replace the O(n) definitions using __is_one_of with constant-time
checks that look for a static member in the __is_integral_helper class
template. That class template is already specialized for every signed
and unsigned integer type, so we don't need to define any additional
specializations. We can just add a static data member that says whether
the type is a signed integer type, an unsigned integer type, or neither.
The __is_signed_integer and __is_unsigned_integer traits can then
inspect that value.

The new enum type could be extended in future to distinguish the
character types (char, wchar_t, char8_t, char16_t, and char32_t) and
bool from non-integer types, but that isn't needed for now.

libstdc++-v3/ChangeLog:

* include/std/type_traits (_Integer_kind): New enum type.
(__is_integral_helper::_S_kind): New static data member in
primary template and each explicit specialization.
(__is_signed_integer, __is_unsigned_integer): Use _S_kind
instead of O(n) disjunction with is_same.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
6 days agolibstdc++: Do not optimize std::copy to memcpy for bool output [PR122907]
Jonathan Wakely [Tue, 2 Dec 2025 15:26:31 +0000 (15:26 +0000)] 
libstdc++: Do not optimize std::copy to memcpy for bool output [PR122907]

Copying narrow characters to a range of bool using std::copy cannot be
optimized to use std::memcpy. Assignment of an arbitrary integer to a
bool needs to convert all non-zero values to true, so is not a simple
memcpy-like or bit_cast-like operation. We currently get this wrong and
optimize it to memcpy, producing invalid bool values.

By making __memcpyable_integer<bool> false we disable memcpy
optimizations for heterogeneous std::copy and std::move calls where
either the source or destination type is bool. Copies where both types
are bool can still optimize to memcpy, because we don't check
__memcpyable_integer in that case.

This disables the memcpy optimization for bool as the source type,
which isn't actually necessary (the representation of bool in GCC is
0x00 or 0x01 and so copying bool to char is just a bit_cast). We don't
currently have a straightforward way to allow memcpy for bool to char
but disallow the inverse. This seems acceptable as using std::copy with
bool inputs and narrow character outputs is probably not common enough
for this to be an important optimization to do in the library code.

libstdc++-v3/ChangeLog:

PR libstdc++/122907
* include/bits/cpp_type_traits.h (__memcpyable_integer<bool>):
Define as false.
* testsuite/25_algorithms/copy/122907.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
6 days agolibstdc++: Update default -std for testsuite
Jonathan Wakely [Mon, 15 Dec 2025 16:00:20 +0000 (16:00 +0000)] 
libstdc++: Update default -std for testsuite

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (dg-v3-runtest) Set default_std to
20.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
6 days agolibstdc++: Update tzdata to 2025c
Jonathan Wakely [Fri, 12 Jan 2024 16:57:41 +0000 (16:57 +0000)] 
libstdc++: Update tzdata to 2025c

Import the new 2025c tzdata.zi file and new leapseconds expiry date.

libstdc++-v3/ChangeLog:

* include/std/chrono (chrono::__detail::__get_leap_second_info):
Update expiry date for leap seconds list.
* src/c++20/tzdb.cc (tzdb_list::_Node::_S_read_leap_seconds):
Likewise.
* src/c++20/tzdata.zi: Import new file from 2025c release.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
6 days agoa68: fix modules testsuite to not include flags in test name [PR algol68/123131]
Jose E. Marchesi [Tue, 16 Dec 2025 21:50:15 +0000 (22:50 +0100)] 
a68: fix modules testsuite to not include flags in test name [PR algol68/123131]

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/testsuite/ChangeLog

PR algol68/123131
* algol68/compile/modules/compile.exp: Pass module include path
via extra_flags to algol68-dg-runtest.
* algol68/execute/modules/execute.exp: Pass module include path
via algol68_compile_args.
* lib/algol68-dg.exp (MODULES_OPTIONS): Delete.
(algol68-dg-runtest): Do not use MODULE_OPTIONS.
* lib/algol68-torture.exp (BUILT_MODULES_DIR): Delete.
(algol68-torture-execute): Do not use BUILT_MODULES_DIR.

6 days agoanalyzer: fix warnings [PR123136]
David Malcolm [Tue, 16 Dec 2025 21:12:01 +0000 (16:12 -0500)] 
analyzer: fix warnings [PR123136]

gcc/analyzer/ChangeLog:
PR analyzer/123136
* engine.cc
(strongly_connected_components::strongly_connected_components):
Consistently use size_t.
(strongly_connected_components::dump): Likewise.
(strongly_connected_components::to_json): Likewise.
(exploded_graph::print_bar_charts): Likewise.
(exploded_path::feasible_p): Remove unused locals.
(exploded_graph_annotator::exploded_graph_annotator): Use size_t
for iterator var.
(impl_run_checkers): Drop logger param of engine ctor.
* ops.cc (phis_for_edge_op::maybe_make): Drop unused param of
phis_for_edge_op ctor.
(phis_for_edge_op::phis_for_edge_op): Likewise.
* ops.h (operation::~operation): Make virtual.
(control_flow_op::dyn_cast_control_flow_op): Add "final override".
(phis_for_edge_op::phis_for_edge_op): Drop unused param.
(phis_for_edge_op::m_cfg_in_edge): Drop unused field.
* region-model.cc (engine::engine): Drop unused "logger" param.
* region-model.h (engine::engine): Likewise.
* supergraph-fixup-locations.cc (location_fixer::location_fixer):
Drop m_sg field.
(location_fixer::m_sg): Drop unused field.
(location_fixer::m_purge_map): Drop unused field.
* supergraph-sorting.cc (class sorting_worklist): Drop unused
m_worklist field.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
6 days agoanalyzer: escape filenames in supergraph dump
David Malcolm [Tue, 16 Dec 2025 21:11:55 +0000 (16:11 -0500)] 
analyzer: escape filenames in supergraph dump

gcc/analyzer/ChangeLog:
* supergraph.cc (supernode::dump_dot): Escape filename.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
6 days agotestsuite: require dot for diagnostic-test-graphs-html.c [PR123142]
David Malcolm [Tue, 16 Dec 2025 21:11:50 +0000 (16:11 -0500)] 
testsuite: require dot for diagnostic-test-graphs-html.c [PR123142]

gcc/testsuite/ChangeLog:
PR diagnostics/123142
* gcc.dg/plugin/diagnostic-test-graphs-html.c: Add
dg-require-dot directive.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
6 days agolibstdc++: New generate_canonical impl (P0952, LWG2524) [PR119739]
Nathan Myers [Thu, 7 Aug 2025 02:38:44 +0000 (22:38 -0400)] 
libstdc++: New generate_canonical impl (P0952, LWG2524) [PR119739]

Implement P0952R2 "A new specification for
std::generate_canonical", fixing issue LWG 2524.

It has us start over, using new entropy, if the naïve generation
of a value in [0..1) comes up equal to 1.0, which occurs too
rarely for the change to measurably affect performance, but
does affect the number of calls to the underlying random bit
generator.

The old implementation is preserved, guarded by preprocessor
macro _GLIBCXX_USE_OLD_GENERATE_CANONICAL, for use where behavior
exactly matching previous runs is required.

The fix is extended to all of C++11 to 26. The public function
dispatches to variations optimized for requested bit depth `d`,
using minimal integer sizes for exact intermediate calculations.
It is faster than the old implementation, which computed a
floating-point logarithm, and performs all intermediate
calculations on integer types. It does not allow the IEEE half-
precision type `float16_t`, as its range is not large enough to
represent intermediate integer values specified, but does allow
`bfloat16_t`.

This implementation varies from the Standard in retaining in the
output mantissa as much as possible of the entropy obtained from
the provided random bit generator, not just the leading `d` bits
of randomness as specified, and in permitting use on floating
point types beyond float, double, and long double. The macro
_GLIBCXX_GENERATE_CANONICAL_STRICT may be defined to obtain the
exact Standard behavior.

This patch also adds tests for statistical properties, and adds
new static asserts on template argument requirements where
supported.  It adds tests using non-optimal RNGs that yield
values 0..999999 and 0..0x7ffffffe.

A test for the case addressed in LWG 2524 already appeared in
64351.cc.  This change amounts to a different resolution for
bugzilla PR64351 and LWG 2524.

libstdc++-v3/ChangeLog:
PR libstdc++/119739
* include/bits/random.tcc: Add generate_canonical impl for C++26.
* testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc:
Adapt test for both pre- and post- C++26.
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Test for float and double from 32-bit RNG, including 1.0 do-over.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
6 days agoa68: support only one definition module per prelude packet
Jose E. Marchesi [Tue, 16 Dec 2025 17:17:37 +0000 (18:17 +0100)] 
a68: support only one definition module per prelude packet

At this point we only support having a single definition module in
each prelude packet.  It is planned to change this, and also to
support local not-toplevel modules, but not in the next GCC release.
So until that gets fully implemented, it is pointless to support
parsing multiple contracted module definitions.

This commit removes this support from the parser and adjusts several
tests that were making use of it.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68-parser-bottom-up.cc (reduce_prelude_packet): Do not support
multiple module definitions per packet.

gcc/testsuite/ChangeLog

* algol68/compile/error-compile-unknown-tag-1.a68: Use a single
module per packet.
* algol68/compile/error-module-coercions-1.a68: Likewise.
* algol68/compile/error-module-ranges-1.a68: Likewise.
* algol68/compile/module-2.a68: Likewise.
* algol68/compile/module-pub-mangling-1.a68: Likewise.
* algol68/compile/module-pub-mangling-2.a68: Likewise.
* algol68/compile/module-pub-mangling-3.a68: Likewise.
* algol68/compile/module-pub-mangling-4.a68: Likewise.
* algol68/compile/module-pub-mangling-5.a68: Likewise.
* algol68/compile/module-pub-mangling-6.a68: Likewise.
* algol68/compile/warning-module-hidding-1.a68: Likewise.

6 days agoanalyzer: fix state dumps for return_event [PR122003]
David Malcolm [Tue, 16 Dec 2025 17:10:26 +0000 (12:10 -0500)] 
analyzer: fix state dumps for return_event [PR122003]

In the reimplementation of supergraph (r16-6063-g0b786d961d4426) the
class return_event moved from being a subclass of superedge_event to
a subclass of checker_event, thus using checker_event::get_program_state
which returns null.

This stopped e.g. HTML state-graph output showing state at return events
in e.g. event (8) of
https://dmalcolm.fedorapeople.org/gcc/2025-12-15/state-diagram-1.c.html

Fixed by implementing return_event::get_program_state.

gcc/analyzer/ChangeLog:
PR analyzer/122003
* checker-event.cc (return_event::get_program_state): New.
* checker-event.h (return_event::get_program_state): New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
6 days agolibstdc++: Implement P2408R5 C++20 iterators as inputs to STL algos
Patrick Palka [Tue, 16 Dec 2025 16:22:58 +0000 (11:22 -0500)] 
libstdc++: Implement P2408R5 C++20 iterators as inputs to STL algos

From the paper's abstract:

  Change the iterator requirements for non-Ranges algorithms. For
  forward iterators and above that are constant iterators, instead of
  requiring that iterators meet certain Cpp17...Iterator requirements,
  require that the iterators model certain iterator concepts. This makes
  iterators from several standard views usable with non-Ranges
  algorithms that require forward iterators or above, such as the
  parallel overloads of most algorithms.

This patch narrowly implements P2408R5 in C++23 mode and C++20 mode
(as an extension).  "Narrowly" because just as in the paper, we don't
attempt to relax the requirements of mutable iterators even though it's
possible in theory.  Note that the PSTL algorithm requirements have
already been relaxed in r15-3650.  And we don't bother touching the
deprecated parallel mode algorithms under ./include/parallel.

The main workhorse of this paper is a new helper
__iterator_concept_or_category that replaces eligible uses of
__iterator_category and iterator_traits::iterator_category.  This new
helper considers both the iterator_concept and iterator_category of the
given iterator and returns the former if it's at least as strong as the
latter.  It's implemented in terms of the __promotable_iterator concept
added in r16-2588 that made std::advance etc aware of C++20 iterators.
Note that this helper doesn't check the actual C++20 iterator concepts
(which check syntactic requirements along with iterator_concept if it's
defined) and instead just checks for, and fully trusts, the
iterator_concept defined by the iterator type.  This is a slight
deviation from the paper but IMHO it's consistent with the existing
trusting of iterator_category and should be good enough in practice,
though it means C++20 iterators that don't define iterator_concept will
not be recognized as such by this helper even if they otherwise model
the std::foo_iterator concept.  (An undefined iterator_concept
effectively defaults to random_access_iterator_tag.)

Most of the changes made here are effectively optimizations that don't
have a semantic impact, e.g. for std::reduce.  I added tests for a
couple of algorithms where these changes are observable.

The new __iterator_concept_or_category helper can probably also be used
to fix PR100070 "Standard library container iterator-pair constructors
should check C++20 iterator concepts".

As a follow-up to this patch we should either remove the Boost-style
concept checks, or relax them accordingly.  It seems we're leaning
towards removing them outright; see this thread:
https://gcc.gnu.org/pipermail/libstdc++/2025-May/061568.html

As suggested by Tomasz, this patch also introduces a _GLIBCXX_ITER_MOVE
wrapper around ranges::iter_move that also converts to the iterator's
value type (and is usable before C++20 as well).

PR libstdc++/113299

libstdc++-v3/ChangeLog:

* include/bits/deque.tcc (__copy_move_a1): Constrain with
__is_any_random_access_iter instead of __is_random_access_iter.
(__copy_move_backward_a1): Likewise.
(__equal_aux1): Likewise.
* include/bits/stl_algo.h (__search_n): Use
__iter_concept_or_category instead of __iterator_category
or iterator_traits::iterator_category.
(find_end): Likewise.
(__is_permutation): Likewise.
(for_each_n): Likewise.
(unique_copy): Likewise, for constant iterators.
(sample): Likewise, for constant iterators.
* include/bits/stl_algobase.h (__copy_move_a1): Adjust
deque-based forward declaration accordingly.
(__copy_move_backward_a1): Likewise.
(__equal_aux1): Likewise.
(__lexicographical_compare_impl): Use
__iter_concept_or_category instead of __iterator_category or
iterator_traits::iterator_category.
(__equal4): Likewise.
* include/bits/stl_iterator_base_funcs.h
(__iter_concept_or_category): New.
(__is_any_random_access_iter): New.
(_GLIBCXX_ITER_MOVE): New.
* include/bits/stl_uninitialized.h (uninitialized_copy_n):
Use __iterator_concept_or_category instead of
__iterator_category for the constant iterator __first.
(__uninitialized_copy_n_pair): Likewise.
* include/bits/version.def (algorithm_iterator_requirements):
Define.
* include/bits/version.h: Regenerate.
* include/std/algorithm: Provide the FTM
__cpp_lib_algorithm_iterator_requirements.
* include/std/memory: Likewise.
* include/std/numeric: Likewise.  Include
<bits/stl_iterator_base_funcs.h>.
(reduce): Use __is_any_random_access_iter instead of
__is_random_access_iter.
(transform_reduce): Likewise.
(inclusive_scan): Use _GLIBCXX_ITER_MOVE instead of std::move.
* testsuite/25_algorithms/find_end/c++20_iter.cc: New test.
* testsuite/25_algorithms/sample/c++20_iter.cc: New test.
* testsuite/25_algorithms/search_n/c++20_iter.cc: New test.
* testsuite/25_algorithms/unique_copy/c++20_iter.cc: New test.
* testsuite/26_numerics/inclusive_scan/c++20_iter.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
6 days agoaarch64: Make the test for available cached PCS data more robust.
Iain Sandoe [Sun, 14 Dec 2025 11:24:40 +0000 (11:24 +0000)] 
aarch64: Make the test for available cached PCS data more robust.

When we are emitting MI thunks, it can be the case that the
target function of the thunk has already been compiled, and
considered complete, with at least part of the relevant data
freed.

The deal with this, we amend the test for the availability
of the cached PCS value to check for the presence of both the
cfun and the machine content.

Since these functions are in a hot code path, use
gcc_checking_assert().

gcc/ChangeLog:

* config/aarch64/aarch64.cc
(aarch64_function_abi): Use checking assert.
(aarch64_fndecl_abi): Test for the availability of the
machine content before trying to look up the cached PCS.
Use a checking assert.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
6 days agolibga68: Make _libga68_u32_cmp static
Pietro Monteiro [Tue, 16 Dec 2025 12:48:06 +0000 (07:48 -0500)] 
libga68: Make _libga68_u32_cmp static

_libga68_u32_cmp is only used in the same translation unit, so make it
static.

libga68/ChangeLog:

* ga68-unistr.c (_libga68_u32_cmp): Add `static' specifier.
* ga68.h (_libga68_u32_cmp): Remove prototype.

6 days agoGenerate Algol68 frontend online docs
Pietro Monteiro [Tue, 16 Dec 2025 12:48:06 +0000 (07:48 -0500)] 
Generate Algol68 frontend online docs

maintainer-scripts/ChangeLog:

* update_web_docs_git (MANUALS): Add ga68 and ga68-internals.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
6 days agoRegenerate opt-urls
Jose E. Marchesi [Tue, 16 Dec 2025 12:23:55 +0000 (13:23 +0100)] 
Regenerate opt-urls

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/ChangeLog

* common.opt.urls: Regenerate.

gcc/algol68/ChangeLog

* lang.opt.urls: Regenerate.

6 days agoa68: support for -fmodules-map and -fmodules-map-file
Jose E. Marchesi [Sun, 14 Dec 2025 10:22:35 +0000 (11:22 +0100)] 
a68: support for -fmodules-map and -fmodules-map-file

This commit adds support for two new command-line options for the
Algol 68 front-end:

  -fmodules-map=<string>
  -fmodules-map-file=<filename>

These options are used in order to specify a mapping from module
indicants to file basenames.  The compiler will base its search for
the modules on these basenames rather on the default schema of
deriving the basename from the module indicant.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* lang.opt (-fmodules-map): New option.
(-fmodules-map-file): Likewise.
* a68.h: Add prototype for a68_process_module_map.
* a68-imports.cc (SKIP_WHITESPACES): Define.
(PARSE_BASENAME): Likewise.
(PARSE_INDICANT): Likewise.
(a68_process_module_map): New function.
* a68-lang.cc: (a68_init): Move initialization of
A68_MODULE_FILES from there...
(a68_init_options): to here.
(a68_handle_option): Handle OPT_fmodules_map and
OPT_fmodules_map_.
* a68-parser-pragmat.cc (handle_access_in_pragmat): Normalize
module indicants to upper case.
* ga68.texi (Module search options): New section.

6 days agoa68: introduce a68_file_size and a68_file_read
Jose E. Marchesi [Mon, 15 Dec 2025 13:03:01 +0000 (14:03 +0100)] 
a68: introduce a68_file_size and a68_file_read

This commit introduces two new utility functions that replace some
ad-hoc infrastructure in the scanner.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68.h: Prototypes for a68_get_file_size and a68_file_read.
* a68-parser-scanner.cc (a68_file_size): New function.
(a68_file_read): Renamed from io_read.
(get_source_size): Deleted function.
(include_files): Use a68_file_size and a68_file_read.

6 days agoa68: fix dump of encoded string mode
Mohammad-Reza Nabipoor [Mon, 15 Dec 2025 02:27:38 +0000 (03:27 +0100)] 
a68: fix dump of encoded string mode

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
gcc/algol68/ChangeLog

* a68-imports.cc (dump_encoded_mode): Replace "basic" with
"string".

6 days agoxtensa: Improve usage of SALT/SALTU instructions
Takayuki 'January June' Suwa [Sun, 14 Dec 2025 13:08:38 +0000 (22:08 +0900)] 
xtensa: Improve usage of SALT/SALTU instructions

In the expansion of cstoresi4 insn patterns, LT[U] comparisons where the
second operand is an integer constant are canonicalized to LE[U] ones with
one less than the original.

     /* example */
     int test0(int a) {
       return a < 100;
     }
     unsigned int test1(unsigned int a) {
       return a <= 100u;
     }
     void test2(int a[], int b) {
       int i;
       for (i = 0; i < 16; ++i)
a[i] = (a[i] <= b);
     }

     ;; before (TARGET_SALT)
     test0:
      entry sp, 32
      movi a8, 0x63
      salt a2, a8, a2
      addi.n a2, a2, -1 ;; unwanted inverting
      neg a2, a2 ;;
      retw.n
     test1:
      entry sp, 32
      movi a8, 0x64
      saltu a2, a8, a2
      addi.n a2, a2, -1 ;; unwanted inverting
      neg a2, a2 ;;
      retw.n
     test2:
      entry sp, 32
      movi.n a9, 0x10
      loop a9, .L5_LEND
     .L5:
      l32i.n a8, a2, 0
      salt a8, a3, a8
      addi.n a8, a8, -1 ;; immediate cannot be hoisted out
      neg a8, a8
      s32i.n a8, a2, 0
      addi.n a2, a2, 4
      .L5_LEND:
      retw.n

This patch reverts such canonicalization by adding 1 to the comparison value
and then converting it back from LE[U] to LT[U], which better matches the
output machine instructions.  This patch also makes it easier to benefit
from other optimizations such as CSE, constant propagation, or loop-invariant
hoisting by XORing the result with a register that has a value of 1, rather
than subtracting 1 and then negating the sign to invert the truth of the
result.

     ;; after (TARGET_SALT)
     test0:
      entry sp, 32
      movi a8, 0x64
      salt a2, a2, a8
      retw.n
     test1:
      entry sp, 32
      movi a8, 0x65
      saltu a2, a2, a8
      retw.n
     test2:
      entry sp, 32
      movi.n a10, 1 ;; hoisted out
      movi.n a9, 0x10
      loop a9, .L5_LEND
     .L5:
      l32i.n a8, a2, 0
      salt a8, a3, a8
      xor a8, a8, a10
      s32i.n a8, a2, 0
      addi.n a2, a2, 4
      .L5_LEND:
      retw.n

gcc/ChangeLog:

* config/xtensa/xtensa.cc (xtensa_expand_scc_SALT):
New sub-function that emits the SALT/SALTU instructions.
(xtensa_expand_scc): Change the part related to the SALT/SALTU
instructions to a call to the above sub-function.

6 days agoxtensa: Remove variables only used to pass the return of end_sequence()
Takayuki 'January June' Suwa [Sun, 14 Dec 2025 13:04:43 +0000 (22:04 +0900)] 
xtensa: Remove variables only used to pass the return of end_sequence()

As a result of the automatic replacement by commit 4dd13988c93c24ba3605f4b9cafc97515c34f2ac,
there are several code fragments that receive the return value of
end_sequence() and immediately use it as the return value of the function
itself.

   rtx_insn *insn;
   ...
   insn = end_sequence ();
   return insn;

It is clear that in such cases, it would be more natural to pass the return
value of end_sequence() directly to the return statement without passing it
through a variable.

Applying this patch naturally does not change any functionality.

gcc/ChangeLog:

* config/xtensa/xtensa.cc
(xtensa_expand_block_set_libcall,
xtensa_expand_block_set_unrolled_loop,
xtensa_expand_block_set_small_loop, xtensa_call_tls_desc):
Change the return statement to pass the return value of
end_sequence() directly without going through a variable, and
remove the definition of that variable.

6 days agotestsuite/123137 - fix FAIL of g++.dg/vect/pr64410.cc on i?86
Richard Biener [Tue, 16 Dec 2025 12:08:19 +0000 (13:08 +0100)] 
testsuite/123137 - fix FAIL of g++.dg/vect/pr64410.cc on i?86

The following works around SRA not being able to decompose an
aggregate copy of std::complex because with x87 math ld/st pairs
are not bit-preserving by adding -msse -mfpmath=sse.  This avoids
spurious failures of the testcase.

PR testsuite/123137
* g++.dg/vect/pr64410.cc: Add -mfpmath=sse -msse on x86.