]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 hours agoa68: add TEST operator for bits to expanded prelude master trunk
Jose E. Marchesi [Sat, 31 Jan 2026 17:34:11 +0000 (18:34 +0100)] 
a68: add TEST operator for bits to expanded prelude

This patch adds support for a TEST operator for L bits.  Documentation
and tests are included.

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

* a68.h: Prototypes for a68_bits_test and a68_lower_test3.
* a68-low-bits.cc (a68_bits_test): New function.
* a68-low-prelude.cc (a68_lower_test3): Likewise.
* a68-parser-prelude.cc (gnu_prelude): Declare TEST operators and
their priority.
* ga68.texi (Extended bits operators): New section.

gcc/testsuite/ChangeLog

* algol68/execute/bits-test-1.a68: New test.

3 hours agoa68: add SET and CLEAR operators for L bits
Jose E. Marchesi [Fri, 30 Jan 2026 10:41:05 +0000 (11:41 +0100)] 
a68: add SET and CLEAR operators for L bits

This commit adds two more operators to the extended standard prelude
that work on L bits values.

Tests and documention included.

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

* ga68.texi (POSIX files): Document SET and CLEAR operators.
* a68.h: Prototypes for a68_bits_set, a68_bits_clear,
a68_lower_set3 and a68_lower_clear3.
* a68-low-bits.cc (a68_bits_set): New function.
(a68_bits_clear): Likewise.
* a68-low-prelude.cc (a68_lower_set3): Likewise.
(a68_lower_clear3): Likewise.
* a68-parser-prelude.cc (gnu_prelude): Declare operators SET and
CLEAR and their priorities.

gcc/testsuite/ChangeLog

* algol68/execute/bits-clear-1.a68: New test.
* algol68/execute/bits-set-1.a68: Likewise.

7 hours ago[PATCH] picolibc: Use %:find-file for both test and access to picolibc.ld
Keith Packard [Sat, 31 Jan 2026 14:00:26 +0000 (07:00 -0700)] 
[PATCH] picolibc: Use %:find-file for both test and access to picolibc.ld

If the gcc driver and linker don't agree on what the search path for
linker scripts is, then the driver may discover a file that
the linker won't end up using. This results in linking failures
when applications don't specific an explicit linker script.

Fix this by duplicating the call to %:find-file for both
test and in the parameter passed to the linker.

gcc/
* config/picolibc-spec.h (LIBC_LINK_SPEC): Use find-file for test
and access to picolibc.ld.

9 hours agomiddle-end/123887 - fix another missing side-effect check
Richard Biener [Fri, 30 Jan 2026 18:30:40 +0000 (19:30 +0100)] 
middle-end/123887 - fix another missing side-effect check

The following fixes up another pattern lacking a check for
side-effects on operands made evaluated unconditional.

PR middle-end/123887
* match.pd ((a ? x : y) !=/== (b ? x : y)): Make sure
x and y have no side-effects before evaluating them
unconditionally.

* gcc.dg/torture/pr123887-2.c: New testcase.

10 hours agoFortran: Introduce macros IS_PDT and IS_CLASS_PDT
Paul Thomas [Sat, 31 Jan 2026 10:34:26 +0000 (10:34 +0000)] 
Fortran: Introduce macros IS_PDT and IS_CLASS_PDT

2026-01-31  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
* array.cc (resolve_array_list): Use macro IS_PDT.
* gfortran.h : Supply macros IS_PDT and IS_CLASS_PDT.
* match.cc (gfc_match_type_is): Use IS_PDT and IS_CLASS_PDT as
appropriate.
* resolve.cc (gfc_resolve_ref, build_init_assign,
resolve_component): Likewise.
* trans-array.cc (gfc_trans_array_constructor_value,
trans_array_constructor, structure_alloc_comps,
has_parameterized_comps): Likewise.
* trans-decl.cc (gfc_get_symbol_decl, gfc_init_default_dt,
gfc_trans_deferred_vars, gfc_generate_function_code): Likewise.
* trans-expr.cc (conv_dummy_value, gfc_conv_structure,
gfc_trans_assignment_1): Likewise.
* trans-stmt.cc (trans_associate_var, gfc_trans_allocate,
gfc_trans_deallocate): Likewise.

11 hours agoc++: Fix cp_fold_non_odr_use_1 [PR123557,PR123738]
Nathaniel Shead [Sat, 24 Jan 2026 08:34:53 +0000 (19:34 +1100)] 
c++: Fix cp_fold_non_odr_use_1 [PR123557,PR123738]

This fixes two issues with cp_fold_non_odr_use_1:

- When called to fold away a reference, it considers the use to not be
  an lvalue and so 'maybe_constant_value' folds all the way through the
  nested INDIRECT_REF to a prvalue.  Fixed by folding the op0 of the
  INDIRECT_REF rather than the ref itself and avoiding a double
  cp_fold_non_odr_use_1.

- When used to fold away the initializing expression for an INIT_EXPR,
  it doesn't mark any new TARGET_EXPRs as eliding.  Fixed by reapplying
  'set_target_expr_eliding' for the initializer of an INIT_EXPR if it
  got modified during ff_only_non_odr walk.

PR c++/123557
PR c++/123738

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_fold_maybe_rvalue): Call
cp_fold_non_odr_use_1 before recursing cp_fold.
(cp_fold): Pass op0 to cp_fold_non_odr_use_1 when folding a
reference.  Reapply set_target_expr_eliding on the initializing
expression of an INIT_EXPR.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-ice22.C: New test.
* g++.dg/cpp2a/constexpr-ref2.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
11 hours agoc++: Handle argument merging push_local_extern_decl_alias [PR123825]
Jakub Jelinek [Sat, 31 Jan 2026 09:19:26 +0000 (10:19 +0100)] 
c++: Handle argument merging push_local_extern_decl_alias [PR123825]

The first testcase comes directly from
https://eel.is/c++draft/meta.reflection#names-1.8.2
and shows that we don't handle for -freflection the function
argument name difference handling isn't performed for local externs,
which doesn't go the duplicate_decls route but directly remembers
the alias.
The following patch handles outlines the DECL_ARGUMENTS handling
from duplicate_decls and uses it in push_local_extern_decl_alias
(with some minor differences and for now not propagating attributes
back for the push_local_extern_decl_alias case unless -freflection).

ALso, I found that the addition of a new alias created completely broken
DECL_ARGUMENTS (copied at most the first PARM_DECL, never more than that).
That is because copy_decl clears DECL_CHAIN, so the loop always stopped
after the first iteration.

2026-01-31  Jakub Jelinek  <jakub@redhat.com>

PR c++/123825
* cp-tree.h (merge_decl_arguments): Declare.
* decl.cc (duplicate_decls): Outline DECL_ARGUMENTS handling
into ...
(merge_decl_arguments): ... new function.
* name-lookup.cc (push_local_extern_decl_alias): Call
merge_decl_arguments.  Don't copy just the first PARM_DECL when
creating a new alias FUNCTION_DECL.

* g++.dg/reflect/has_identifier3.C: New test.
* g++.dg/reflect/identifier_of3.C: New test.
* g++.dg/cpp26/attr-indeterminate5.C: New test.

12 hours agod: Merge upstream dmd, druntime e1f6680f50, phobos f87979028
Iain Buclaw [Fri, 30 Jan 2026 16:30:33 +0000 (17:30 +0100)] 
d: Merge upstream dmd, druntime e1f6680f50, phobos f87979028

D front-end changes:

- Import latest fixes from v2.112.0-beta.1.
- Associative array operations are now lowered to templates
  defined in `core.internal.newaa'.

D runtime changes:

- Import latest fixes from v2.112.0-beta.1.

Phobos changes:

- Import latest fixes from v2.112.0-beta.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd e1f6680f50.
* Make-lang.in (D_FRONTEND_OBJS): Remove d/gluelayer.o, d/iasm.o,
d/iasmgcc.o.  Add d/iasm-package.o, d/iasm-gcc.o.
(d/iasm-%.o): New recipe.
* d-convert.cc (convert_expr): Remove library call to dynamic_cast.
* d-lang.cc (d_init_options): Set errorSupplementLimit parameter.
* decl.cc (DeclVisitor::visit): Update for new front-end interface.
* expr.cc (ExprVisitor::visit (EqualExp *)): Update for front-end
lowering expression using templates.
(ExprVisitor::visit (InExp *)): Likewise.
(ExprVisitor::visit (IndexExp *)): Likewise.
(ExprVisitor::visit (CastExp *)): Likewise.
(ExprVisitor::visit (RemoveExp *)): Likewise.
(ExprVisitor::visit (AddrExp *)): Likewise.
(ExprVisitor::visit (NewExp *)): Likewise.
(ExprVisitor::visit (ArrayLiteralExp *)): Likewise.
(ExprVisitor::visit (AssocArrayLiteralExp *)): Likewise.
* imports.cc (ImportVisitor::visit (AliasDeclaration *)): Update for
new front-end interface.
* runtime.def (DYNAMIC_CAST): Remove.
(INTERFACE_CAST): Remove.
(ARRAYLITERALTX): Remove.
(ADEQ2): Remove.
(ASSOCARRAYLITERALTX): Remove.
(AANEW): Remove.
(AAEQUAL): Remove.
(AAINX): Remove.
(AAGETY): Remove.
(AAGETRVALUEX): Remove.
(AADELX): Remove.
* typeinfo.cc (TypeInfoVisitor::visit): Layout xopEquals and xtoHash
in TypeInfo_AssociativeArray.
(create_typeinfo): Add new fields to internal typeinfo.
(check_typeinfo_type): Print instantiation trace of error.
* types.cc (TypeVisitor::visit (TypeStruct *)): Update for new
front-end interface.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime e1f6680f50.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
core/internal/cast_.d.  Remove rt/aaA.d, rt/adi.d, rt/cast_.d.
(DRUNTIME_DSOURCES_POSIX): Add core/sys/posix/endian.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos f87979028.
* src/Makefile.am (PHOBOS_DSOURCES): Add std/internal/entropy.d.
* src/Makefile.in: Regenerate.
* testsuite/libphobos.aa/test_aa.d: Adjust test.
* testsuite/libphobos.init_fini/custom_gc.d: Likewise.

gcc/testsuite/ChangeLog:

* gdc.dg/asm1.d: Adjust test.
* gdc.dg/asm5.d: Likewise.
* gdc.dg/pr100967.d: Likewise.
* gdc.dg/rtti1.d: Likewise.
* gdc.dg/rtti2.d: New test.

13 hours agodoc: Switch delorie.com to https
Gerald Pfeifer [Sat, 31 Jan 2026 07:40:28 +0000 (08:40 +0100)] 
doc: Switch delorie.com to https

gcc:
* doc/install.texi (Binaries): Switch delorie.com to https.

16 hours agotestsuite: arm: crypto-vsha1*_u32 tests got late-combine improvements
Alexandre Oliva [Sat, 31 Jan 2026 04:52:10 +0000 (01:52 -0300)] 
testsuite: arm: crypto-vsha1*_u32 tests got late-combine improvements

The late-combine pass enabled some of the vdup.32 instructions
expected in crypto-vsha1*_u32 tests to use d registers, so accept them
as well.

While at that, drop the excess + after ] in d register matches in
vmov.32 instructions.

for  gcc/testsuite/ChangeLog

* gcc.target/arm/crypto-vsha1cq_u32.c: Accept d regs in
vdup.32.  Drop extraneous + after ] in vmov.32 pattern.
* gcc.target/arm/crypto-vsha1h_u32.c: Likewise.
* gcc.target/arm/crypto-vsha1mq_u32.c: Likewise.
* gcc.target/arm/crypto-vsha1pq_u32.c: Likewise.

16 hours agotestsuite: arm: add -mcpu=unset before -march
Alexandre Oliva [Sat, 31 Jan 2026 04:52:05 +0000 (01:52 -0300)] 
testsuite: arm: add -mcpu=unset before -march

Reset the cpu selection to the default on tests that set -march
explicitly instead of using dg-add-options.  The latter would reset
the cpu selection to avoid interference from TOOL_OPTIONS.

Also add +fp to -march in tests that don't override float-abi and fpu,
so that -mfloat-abi=hard -mfpu=auto in TOOL_OPTIONS won't cause a
failure.

for  gcc/testsuite/ChangeLog

* gcc.target/arm/bfloat16_simd_1_2.c: Add -mcpu=unset.
* gcc.target/arm/bfloat16_simd_2_2.c: Likewise.
* gcc.target/arm/bfloat16_simd_3_2.c: Likewise.
* gcc.dg/torture/pr120347.c: Likewise.  Add +fp to -march.

16 hours agotestsuite: arm: update fast-math-complex-mls-half-float.c
Alexandre Oliva [Sat, 31 Jan 2026 04:51:53 +0000 (01:51 -0300)] 
testsuite: arm: update fast-math-complex-mls-half-float.c

Since the addition of DCE after complex lowering, reassoc1 has no
longer been impeded by COMPLEX_EXPRs, so it changes (a - (b + c)),
where (b + c) is the imaginary part of an intermediate complex value,
to ((a - b) - c), and this prevents the vectorizer from recognizing
the expected COMPLEX_ADD_ROT270 pattern in fms_elemconjsnd.

Stop expecting that pattern to be found on that test.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/complex/fast-math-complex-mls-half-float.c:
Don't expect COMPLEX_ADD_ROT270.

16 hours agoanalyzer: fix ICE on rethrow without throw [PR123880]
David Malcolm [Sat, 31 Jan 2026 04:27:40 +0000 (23:27 -0500)] 
analyzer: fix ICE on rethrow without throw [PR123880]

gcc/analyzer/ChangeLog:
PR analyzer/123880
* engine.cc (throw_custom_edge::update_model): Gracefully handle
not knowing the current exception in a rethrow.
(exploded_node::on_throw): Likewise.

gcc/testsuite/ChangeLog:
PR analyzer/123880
* g++.dg/analyzer/exception-rethrow-3.C: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
17 hours agocompare_tests: Don't hardcode grep -E
Pietro Monteiro [Sat, 31 Jan 2026 03:27:14 +0000 (22:27 -0500)] 
compare_tests: Don't hardcode grep -E

The non-unique test names report is broken on systems where 'grep -E' is
not supported.  Use egrep if a simple test for 'grep -E' fails.

contrib/ChangeLog:

* compare_tests: Use egrep if 'grep -E' is not supported.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
18 hours agoc++: defer DECL_ONE_ONLY vs consteval-only [PR122785]
Jason Merrill [Wed, 28 Jan 2026 06:17:13 +0000 (14:17 +0800)] 
c++: defer DECL_ONE_ONLY vs consteval-only [PR122785]

The failure in the given PR occurs because when setting up an
imported vague-linkage variable, we currently call 'maybe_commonize_var'
which for -freflection checks 'consteval_only_p'.  Unfortunately this
latter function needs to call 'complete_type_p' which can perform
recursive loading of the (possibly yet-to-be-streamed) class type,
breaking modules assumptions.

If we just remove the consteval_only_p early exit from maybe_commonize_var,
we end up crashing at EOF while trying to mangle its comdat group, so we
need to undo maybe_commonize_var along with setting DECL_EXTERN.

PR c++/122785

gcc/cp/ChangeLog:

* decl.cc (maybe_commonize_var): Don't check consteval_only_p.
(make_rtl_for_nonlocal_decl): Undo make_decl_one_only for
consteval-only variables.

gcc/testsuite/ChangeLog:

* g++.dg/modules/reflect-1_a.H: New test.
* g++.dg/modules/reflect-1_b.C: New test.

Co-authored-by: Nathaniel Shead <nathanieloshead@gmail.com>
19 hours agolibstdc++/regex: Suppress -Wpedantic warning about anonymous structs
Patrick Palka [Sat, 31 Jan 2026 02:01:08 +0000 (21:01 -0500)] 
libstdc++/regex: Suppress -Wpedantic warning about anonymous structs

Fixes some modules testsuite compilation errors.

libstdc++-v3/ChangeLog:

* include/bits/regex_executor.tcc (_ExecutorFrameBase): Add
#pragma GCC diagnostic to suppress -Wpedantic warning about
anonymous structs.

19 hours agolibitm: testsuite: don't include libstdc++ paths in test names [PR69018]
Pietro Monteiro [Sat, 31 Jan 2026 01:22:49 +0000 (20:22 -0500)] 
libitm: testsuite: don't include libstdc++ paths in test names [PR69018]

Libitm C++ tests pass -B/full/path/to/build/libstc++/src/.libs on the
options argument to dg-runtest and the libstdc++ include paths as
the default-extra-options.  This causes 2 problems:

1) If a test uses `dg-options' then the libstdc++ include paths are
not passed to the compiler.

2) The `-B/full/path/to/build/libstc++/src/.libs' gets added to the
test name.  This makes comparing build done in different directories
harder because the hardcoded full path.

Stop passing options and default-extra-options to dg-runtest and move
dealing with the path-releated flags to libitm_target_compile in
libitm.exp, where they are added to additional_flags.

Also change the FSF address to the website in the license text.

libitm/ChangeLog:
PR libitm/69018
* testsuite/lib/libitm.exp (libitm_target_compile): Add
lang_include_flags and `-B${blddir}/${lang_library_paths}' to
additional_flags.
* testsuite/libitm.c++/c++.exp: Set lang_library_paths and lang_include_flags.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
20 hours agoDaily bump.
GCC Administrator [Sat, 31 Jan 2026 00:16:35 +0000 (00:16 +0000)] 
Daily bump.

23 hours agoFortran: Fix PR123868
Jerry DeLisle [Fri, 30 Jan 2026 21:25:23 +0000 (13:25 -0800)] 
Fortran: Fix PR123868

When copying derived types with allocatable array components where the
array element type also has allocatable components, the condition at
line 11071 was incorrectly triggering a call to gfc_duplicate_allocatable.
However, for allocatable arrays with nested allocatables (where
cmp_has_alloc_comps && c->as is true), the add_when_allocated code
already includes a gfc_duplicate_allocatable call (generated by the
recursive structure_alloc_comps call at lines 10290-10293).

This caused the outer array to be allocated twice: first by the explicit
gfc_duplicate_allocatable call at line 11099, and then again by the
gfc_duplicate_allocatable embedded in add_when_allocated.  The first
allocation was leaked when the second allocation overwrote the data
pointer.

PR121628 added "add_when_allocated != NULL_TREE ||" to the condition,
which was redundant for scalars (already handled by !c->as) and wrong
for arrays (caused double allocation).  Simply removing this clause
restores the correct pre-PR121628 behavior.

PR fortran/123868

gcc/fortran/ChangeLog:

* trans-array.cc (structure_alloc_comps): For COPY_ALLOC_COMP,
remove the add_when_allocated != NULL_TREE clause that PR121628
added.  This clause was redundant for scalars and caused double
allocation for arrays with nested allocatable components.

gcc/testsuite/ChangeLog:

* gfortran.dg/array_memcpy_2.f90: Update expected memcpy count
from 4 to 3, as the double allocation bug is now fixed.
* gfortran.dg/pr123868.f90: New test.

Signed-off-by: Christopher Albert <albert@alumni.tugraz.at>
24 hours agoc++: non-empty constexpr constructor bodies in C++11 [PR123845]
Patrick Palka [Fri, 30 Jan 2026 20:25:43 +0000 (15:25 -0500)] 
c++: non-empty constexpr constructor bodies in C++11 [PR123845]

This patch makes us support C++14 non-empty constexpr constructor bodies
in C++11, as an extension.  This will make it trivial to safely fix the
C++11 library regression PR114865 that requires us to do
__builtin_clear_padding after initializing _M_i in std::atomic's
single-parameter constructor, and that's not really possible with the
C++11 constexpr restrictions.

Since we lower member initializers to constructor body statements
internally, and so constructor bodies are already effectively non-empty
internally even in C++11, supporting non-empty bodies in user code is
mostly a matter of relaxing the parse-time error.

But constexpr-ex3.C revealed that by accepting the non-empty body of A's
constructor, build_data_member_initialization goes on to mistake the
'i = _i' assignment as a member initializer, and we incorrectly accept
the constructor in C++11 mode (even though omitting mem-inits is only
valid since C++20).  Turns out this is caused by that function
recognizing MODIFY_EXPR only in C++11 mode, logic that was last changed
by r5-5013 (presumably to limit impact of the patch at the time) but I
reckon could just be removed outright.  This should be safe because the
result of build_data_member_initialization is only used by
cx_check_missing_mem_inits for validation; evaluation is in terms of
the entire lowered constructor body.

PR c++/123845
PR libstdc++/114865

gcc/cp/ChangeLog:

* constexpr.cc (build_data_member_initialization): Remove
C++11-specific recognition of MODIFY_EXPR.
(check_constexpr_ctor_body): Relax error diagnostic to a
pedwarn and don't clear DECL_DECLARED_CONSTEXPR_P upon
error.  Return true if complaining.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-ex3.C: Adjust C++11 non-empty
constexpr constructor dg-error to a dg-warning.  Expect
a follow-up missing member initializer diagnostic in C++11 mode.
* g++.dg/cpp2a/constexpr-try1.C: Expect a follow-up
compound-statement in constexpr function diagnostic in C++11
mode.
* g++.dg/cpp2a/constexpr-try2.C: Likewise.  Adjust C++11
non-empty constexpr constructor dg-error to a dg-warning.
* g++.dg/cpp2a/constexpr-try3.C:  Adjust C++11 non-empty
constexpr constructor dg-error to a dg-warning.
* g++.dg/cpp0x/constexpr-ctor23.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
26 hours agomiddle-end/123887 - trapping conditional operand turned unconditional
Richard Biener [Fri, 30 Jan 2026 14:32:39 +0000 (15:32 +0100)] 
middle-end/123887 - trapping conditional operand turned unconditional

The following properly checks expr_no_side_effects_p on two patterns
that turns a conditionally evaluated operand into unconditonal.

PR middle-end/123887
* match.pd ((zero_one ==/!= 0) ? .. z <op> y .. -> zero_one * z ..):
Check evaluating z unconditionally has no side-effects, like
trapping.

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

26 hours agodebug/123886 - remove GTY((skip)) from external_die_map entry
Richard Biener [Fri, 30 Jan 2026 13:55:58 +0000 (14:55 +0100)] 
debug/123886 - remove GTY((skip)) from external_die_map entry

The following avoids GCing IDENTIFIER_POINTERs referenced from
external_die_map after we clear ggc_protect_identifiers.  I never
expected those to be GCed.

PR debug/123886
* dwarf2out.cc (sym_off_pair::sym): Remove GTY((skip)).

26 hours agolibstdc++/regex: add [[gnu::always_inline]] to _Executor::_M_node
Patrick Palka [Fri, 30 Jan 2026 18:16:20 +0000 (13:16 -0500)] 
libstdc++/regex: add [[gnu::always_inline]] to _Executor::_M_node

The compiler understandably doesn't know that _M_node only ever has a
single call site, _M_dfs, (and is not directly called from other library
headers or user code) and so decides not to inline it.  So use the
always_inline attribute to force the inlining.  This seems sufficient to
make all _M_dfs subroutines get inlined away, and speeds up the executor
by 30% on some microbenchmarks.

libstdc++-v3/ChangeLog:

* include/bits/regex_executor.tcc (__detail::_Executor::_M_node)
[__OPTIMIZE__]: Add [[gnu::always_inline]] attribute.  Declare
inline.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
27 hours agoAda: Fix regression in visibility for nested use_type_clauses
Gary Dismukes [Fri, 30 Jan 2026 16:55:16 +0000 (17:55 +0100)] 
Ada: Fix regression in visibility for nested use_type_clauses

An earlier fix for wrong handling of visibility when a use_type_clause
with "all" occurs within a nested scope when there's a use_type_clause
in an enclosing scope without "all" was incorrect and led to primitives
being visible in a later nested scope that has a use_type_clause with
"all" for the same type.  We now properly restore Current_Use_Clause
to refer to the outer use_type_clause when ending the scope of nested
use_type_clauses.

gcc/ada/
* sem_ch8.adb (End_Use_Type): Remove test of Prev_Use_Clause as
as a condition for resetting In_Use and Current_Use_Clause, and
change setting of that flag and field based on Prev_Use_Clause
rather than setting them to Empty. Revise preceding comment.

27 hours agolibstdc++/regex: Defer _M_current restoration to backtracking nodes [PR86164]
Patrick Palka [Fri, 30 Jan 2026 17:29:17 +0000 (12:29 -0500)] 
libstdc++/regex: Defer _M_current restoration to backtracking nodes [PR86164]

The incrementing of the current input string position (_M_current) is
done by _M_handle_match, which also makes sure to restore it afterwards,
via a restore_current frame.  But restoring _M_current is naturally only
necessary when backtracking is involved, not after every single match.

So this patch moves the responsibility of saving/restoring _M_current
from _M_handle_match to the branching nodes _M_handle_alternative and
_M_handle_repeat.  This is done by storing _M_current within the
fallback_next, fallback_rep_once_more and posix_alternative frames.
In turn we can get rid of the now unused restore_current frame kind.

This reduces the maximum size of the _M_frames stack by 15% for

  regex_match(string(200000, 'a'), "(a|b|c)*")

PR libstdc++/86164

libstdc++-v3/ChangeLog:

* include/bits/regex_executor.tcc (__detail::_ExecutorFrameOpcode):
Remove _S_fopcode_restore_current.
(__detail::_Executor::_M_handle_repeat): Pass _M_current when
pushing a fallback_next or fallback_rep_once_more frame.
(__detail::_Executor::_M_handle_match): Don't push a
restore_current frame.
(__detail::_Executor::_M_handle_backref): Likewise and simplify
accordingly.
(__detail::_Executor::_M_handle_alternative): Pass _M_current when
pushing a fallback_next or posix_alternative frame.
(__detail::_Executor::_M_dfs) <case _S_fopcode_fallback_next>:
Restore _M_current.
<case _S_fopcode_fallback_rep_once_more>: Likewise.
<case _S_fopcode_posix_alternative>: Likewise.
<case _S_fopcode_restore_current>: Remove.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
27 hours agolibstdc++/regex: Make DFS executor non-recursive [PR86164]
Patrick Palka [Fri, 30 Jan 2026 17:23:40 +0000 (12:23 -0500)] 
libstdc++/regex: Make DFS executor non-recursive [PR86164]

This patch replaces the recursive implementation of the DFS executor
with an iterative one using an explicit heap-based stack.  System
stack usage of the executor is now constant with respect to input size
rather than linear, avoding stack overflow errors when processing
long inputs.

PR libstdc++/86164

libstdc++-v3/ChangeLog:

* include/bits/regex.h (__detail::_Executor): Use inline
namespace _V2.
* include/bits/regex_executor.h (__detail::_ExecutorFrame):
Declare.
(__detail::_Executor): Use inline namespace _V2.
(__detail::_Executor::_M_node): Declare.
(__detail::_Executor::_M_frames): New data member.
* include/bits/regex_executor.tcc (__detail::_ExecutorFrameOpcode):
New.
(__detail::_ExecutorFrameBase): New.
(__detail::_ExecutorFrame): New.
(__detail::_Executor): Use inline namespace _V2.
(__detail::_Executor::_M_rep_once_more): Replace recursive
_M_dfs calls with an _S_opcode_next frame push, and any work
after such calls with an appropriate frame push.
(__detail::_M_handle_repeat): Likewise.
(__detail::_M_handle_subexpr_begin): Likewise.
(__detail::_M_handle_subexpr_end): Likewise.
(__detail::_M_handle_line_begin_assertion): Likewise.
(__detail::_M_handle_line_end_assertion): Likewise.
(__detail::_M_handle_word_boundary): Likewise.
(__detail::_M_handle_subexpr_lookahead): Likewise.
(__detail::_M_handle_match): Likewise.
(__detail::_M_handle_backref): Likewise.
(__detail::_M_handle_accept): Likewise.
(__detail::_M_handle_alternative): Likewise.
(__detail::_M_node): Factored out from _M_dfs.
(__detail::_M_dfs): Push an initial frame to _M_frames that
visits the starting node and pass this stack each subroutine.
Pop the latest _ExecutorFrame from _M_frames and handle
appropriately according to its _ExecutorFrameOpcode.  Loop until
_M_frames is empty.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
29 hours agodoc: Explain flto-toplevel-asm-heuristics
Michal Jires [Thu, 29 Jan 2026 14:07:49 +0000 (15:07 +0100)] 
doc: Explain flto-toplevel-asm-heuristics

This patch adds documentation for flto-toplevel-asm-heuristics
and mentions it in Remarks in Basic Asm.

gcc/ChangeLog:

* doc/extend.texi: Mention flto-toplevel-asm-heuristics.
* doc/invoke.texi: Add flto-toplevel-asm-heuristics.

31 hours agoc++/reflection: check TYPE_BEING_DEFINED in define_aggregate
Marek Polacek [Wed, 28 Jan 2026 22:05:46 +0000 (17:05 -0500)] 
c++/reflection: check TYPE_BEING_DEFINED in define_aggregate

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>,
we should check TYPE_BEING_DEFINED along with COMPLETE_TYPE_P in
eval_define_aggregate.  It seems that with this check added, we don't
need this code anymore:

      if (c == type)
        {
          auto_diagnostic_group d;
          error_at (loc, "%<define_aggregate%> evaluated from "
                         "%<consteval%> block enclosed by %qT being "
                         "defined", type);
  //...
}

so I'm removing that in this patch.

gcc/cp/ChangeLog:

* reflect.cc (eval_define_aggregate): Also give an error when
TYPE_BEING_DEFINED is true for the first argument.  Remove code
that did the same.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/define_aggregate3.C: Adjust expected diagnostic.
* g++.dg/reflect/p2996-21.C: Likewise.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
31 hours agoc++/reflection: tweak eval_can_substitute
Marek Polacek [Wed, 28 Jan 2026 21:33:34 +0000 (16:33 -0500)] 
c++/reflection: tweak eval_can_substitute

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>,
we should check for undeduced_auto_decl after performing
resolve_nondeduced_context_or_error.  Also add a test to exercise
the new check.

gcc/cp/ChangeLog:

* reflect.cc (eval_can_substitute): Check undeduced_auto_decl after
resolve_nondeduced_context_or_error.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jakub Jelinek <jakub@redhat.com>
32 hours agolibga68: Use the internal malloc for UTF-32 to UTF-8 conversion
Pietro Monteiro [Fri, 30 Jan 2026 12:57:02 +0000 (07:57 -0500)] 
libga68: Use the internal malloc for UTF-32 to UTF-8 conversion

_libga68_u32_to_u8 called free on the result buffer on error, but the
buffer is allocated by the GC, so calling free on it is incorrect.

Instead of using the GC, use the internal malloc because this is an
internal function.

Remove the resultbuf parameter from the _libga68_u32_to_u8 since all
callers used NULL for it.

Last but not least, return a null-terminated char* from
_libga68_u32_to_u8.

libga68/ChangeLog:

* ga68-alloc.c (_libga68_realloc_internal): New function.
* ga68-posix.c (_libga68_posixperror): Adjust calls to _libga68_u32_to_u8.
(_libga68_posixfopen): Likewise.
(_libga68_posixcreat): Likewise.
(_libga68_posixgetenv): Likewise.
(_libga68_posixfputs): Likewise.
(_libga68_posixfconnect): Likewise.
* ga68-unistr.c (_libga68_u32_to_u8): Use internal allocator.
* ga68.h (_libga68_realloc_internal): New prototype.
(_libga68_u32_to_u8): Update prototype.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
33 hours agoa68: Minor typo fix in doc
Marc Poulhiès [Fri, 30 Jan 2026 11:52:16 +0000 (12:52 +0100)] 
a68: Minor typo fix in doc

gcc/algol68/ChangeLog:
* ga68-coding-guidelines.texi: Typo fix.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
33 hours agoAdd missing PR reference
Eric Botcazou [Fri, 30 Jan 2026 11:43:53 +0000 (12:43 +0100)] 
Add missing PR reference

34 hours agoAda: Fix spurious visibility error from limited_with clause in hierarchy
Eric Botcazou [Fri, 30 Jan 2026 10:58:58 +0000 (11:58 +0100)] 
Ada: Fix spurious visibility error from limited_with clause in hierarchy

The problem is that the compiler installs the limited view of a package that
is already installed by the virtue of being an ancestor of the main unit.

gcc/ada/
PR ada/123867
* sem_ch10.adb (Analyze_Compilation_Unit): Output info message
when -gnatdi is specified.
(Install_Parents): Likewise.  Set the Is_Visible_Lib_Unit flag
on the unit.
(Install_Private_With_Clauses): Do not output info message here.
(Remove_Parents): Output info message when -gnatdi is specified
and clear the Is_Visible_Lib_Unit flag on the unit.

gcc/testsuite/
* gnat.dg/specs/limited_with3.ads: New test.
* gnat.dg/specs/limited_with3-child.ads: New helper.
* gnat.dg/specs/limited_with3-child-grandchild.ads: Likewise.
* gnat.dg/specs/limited_with3-child-grandchild-grandgrandchild.ads:
Likewise.

34 hours agodebug/110885 - fix split-dwarf / debug-types interaction
Richard Biener [Fri, 30 Jan 2026 08:55:38 +0000 (09:55 +0100)] 
debug/110885 - fix split-dwarf / debug-types interaction

The following fixes a link failure due to missing skeleton
ancestors.

PR debug/110885
* dwarf2out.cc (generate_skeleton_bottom_up): Generate the
skeleton ancestor tree when moving a new child to the parent
even for template instantiations.

* g++.dg/debug/dwarf2/pr110885.C: New testcase.

34 hours agolibatomic: Don't install libatomic_asneeded.{so,a} if corresponding libatomic.{so...
Jakub Jelinek [Fri, 30 Jan 2026 10:43:49 +0000 (11:43 +0100)] 
libatomic: Don't install libatomic_asneeded.{so,a} if corresponding libatomic.{so,a} wasn't installed

Filip complained on IRC that libatomic_asneeded.a is installed as
stale symlink in --disable-static build.

The following patch makes sure to install the libatomic_asneeded.{so,a}
script and/or symlink only if the corresponding libatomic.{so,a} has been
installed.

2026-01-30  Jakub Jelinek  <jakub@redhat.com>

* Makefile.am (all-local, install-asneeded): Only create
libatomic_asneeded.so script if libatomic.so exist, only
create libatomic_asneeded.a symlink if libatomic.a exist.
* Makefile.in: Regenerate.

34 hours agomatch.pd: Fix up __imag__ .MUL_OVERFLOW simplification [PR123864]
Jakub Jelinek [Fri, 30 Jan 2026 10:42:41 +0000 (11:42 +0100)] 
match.pd: Fix up __imag__ .MUL_OVERFLOW simplification [PR123864]

The integer_minus_onep case is really meant for multiplication by
-1, not by (unsigned char)0xff or (unsigned short)0xffff or 0xffffffffU etc.
We've already tested that the first operand is signed (otherwise the
earlier case is used) and also that int_fits_type_p (@1, TREE_TYPE (@0)),
but if @0 is signed and @1 is unsigned all ones with smaller precision
than that, it fits into @0's type, integer_minus_onep will be true
and it still should be handled through the ranges, not as @0 == min.

2026-01-30  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/123864
* match.pd (__builtin_mul_overflow_p (x, cst, (stype) 0) ->
x > stype_max / cst || x < stype_min / cst): Only check
integer_minus_onep for signed types.

* gcc.c-torture/execute/pr123864.c: New test.
* gcc.dg/torture/pr123864.c: New test.

34 hours agofold-const: Fix implicit cast to nullptr_t typedef [PR123790]
Jakub Jelinek [Fri, 30 Jan 2026 10:40:17 +0000 (11:40 +0100)] 
fold-const: Fix implicit cast to nullptr_t typedef [PR123790]

The following testcase is incorrectly rejected, because since r15-6744
it adds build_nop to preserve the exact typedef type and
cxx_eval_constant_expression can't fold NOP_EXPR from integer_zerop of one
NULLPTR_TYPE to another NULLPTR_TYPE, while cxx_eval_constant_expression
relies on fold to do such folding.

I see 3 options to fix that, one is deal with this in the r15-6744 spot
and special case NULLPTR_TYPE there and build_zero_cst instead of build_nop
(with similar condition like in the patch below), another possibility is
special case this in cxx_eval_constant_expression, and
another one (done in this patch) is to handle this in fold-const.cc -
fold_convert_loc and also in fold_convert_const.

2026-01-30  Jakub Jelinek  <jakub@redhat.com>

PR c++/123790
* fold-const.cc (fold_convert_const): Handle conversion of
integer_zerop to NULLPTR_TYPE.
(fold_convert_loc): Likewise.

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

34 hours agod: Merge upstream dmd, druntime 1017635a96, phobos 5a142da0a
Iain Buclaw [Fri, 30 Jan 2026 09:25:49 +0000 (10:25 +0100)] 
d: Merge upstream dmd, druntime 1017635a96, phobos 5a142da0a

D front-end changes:

- Import dmd v2.112.0-beta.1.

D runtime changes:

- Import druntime v2.112.0-beta.1.
- Added 64-bit `mul' and `udivmod' overloads to `core.int128'.

Phobos changes:

- Added `lazyCache' to `std.algorithm.iteration'.
- Added `writeText', `writeWText', and `writeDText' to
  `std.conv'.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 1017635a96.
* dmd/VERSION: Bump version to v2.112.0-beta.1.
* decl.cc (DeclVisitor::finish_vtable): Update for new front-end
interface.
(DeclVisitor::visit): Likewise.
* typeinfo.cc (TypeInfoVisitor::visit): Likewise.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 1017635a96.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Add
core/sys/linux/sys/syscall.d, core/sys/linux/syscall.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 5a142da0a.
* src/Makefile.am (PHOBOS_DSOURCES): Remove
std/internal/windows/bcrypt.d.
* src/Makefile.in: Regenerate.

gcc/testsuite/ChangeLog:

* gdc.dg/asm1.d: Adjust test.

34 hours agoPermit const counters in flush_on_edges [PR123855]
Jørgen Kvalsvik [Wed, 28 Jan 2026 19:33:21 +0000 (20:33 +0100)] 
Permit const counters in flush_on_edges [PR123855]

Relax the (accidental) requirement and permit that function-local
counters don't have SSA names.  We really only look up the def
statement to check if it is a phi node, in which case we need to
resolve the counter from there.  This obviously doesn't apply when it
is a constant.

PR gcov-profile/123855

gcc/ChangeLog:

* path-coverage.cc (flush_on_edges): Only look up SSA name def
stmt when counter is non-const.

gcc/testsuite/ChangeLog:

* gcc.misc-tests/gcov-pr123855.c: New test.

34 hours agogcov-dump: Print PATHS tag
Jørgen Kvalsvik [Mon, 3 Nov 2025 23:05:04 +0000 (00:05 +0100)] 
gcov-dump: Print PATHS tag

Print the record associated with the PATHS tag.  While it just prints
the number of prime paths for the function, this is more useful than
the UNKNOWN it would otherwise print.

Before:
...
demo.gcno:    01450000:  31:LINES
demo.gcno:                  block 6:`demo.c':13
demo.gcno:    01490000:   4:UNKNOWN

After:
...
demo.gcno:    01450000:  31:LINES
demo.gcno:                  block 6:`demo.c':13
demo.gcno:    01490000:   4:PATHS 5 paths

gcc/ChangeLog:

* gcov-dump.cc (tag_paths): New function.

34 hours agogcc: -f*-coverage implies -ftest-coverage
Jørgen Kvalsvik [Mon, 3 Nov 2025 22:48:25 +0000 (23:48 +0100)] 
gcc: -f*-coverage implies -ftest-coverage

The --coverage flag is a useful alias for -fprofile-arcs
-ftest-coverage where the latter makes gcc output the .gcno file.
While it makes sense to use -fprofile-arcs without a .gcno file (pgo,
maybe more), it never really makes sense to request -fpath-coverage or
-fcondition-coverage without also wanting the .gcno to interpret the
results.

gcc/ChangeLog:

* common.opt: ftest-coverage enabled by fpath-coverage or
fcondition-coverage

gcc/testsuite/ChangeLog:

* g++.dg/gcov/gcov-18.C: Remove --coverage.
* g++.dg/gcov/gcov-22.C: Likewise.
* gcc.misc-tests/gcov-19.c: Remove -ftest-coverage.
* gcc.misc-tests/gcov-29.c: Likewise.

34 hours agogcov-dump: Print start-position for conditions
Jørgen Kvalsvik [Tue, 14 Oct 2025 08:52:54 +0000 (10:52 +0200)] 
gcov-dump: Print start-position for conditions

The printed position should be the start of the record, as is the case
with lines.

Before:
ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
ex.gcno:  811:                  block 2: 1
ex.gcno:  819:                  block 5: 1
ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...

After:
ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
ex.gcno:  803:                  block 2: 1
ex.gcno:  811:                  block 5: 1
ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...

gcc/ChangeLog:

* gcov-dump.cc (tag_conditions):  Read position before blocks,
terms.

34 hours agoUpdate expected number of prime paths in test case
Jørgen Kvalsvik [Wed, 5 Nov 2025 19:48:29 +0000 (20:48 +0100)] 
Update expected number of prime paths in test case

This test has been failing since this commit which introduces an extra
block in the loop, increasing the number of prime paths:

FAIL: gcc.misc-tests/gcov-29.c line 826: expected 0/5 covered paths, was 0/6

commit 385d9937f0e23cbf9c62f0b2553a33ff70e56ecf
Author: Jan Hubicka <hubicka@ucw.cz>
Date:   Fri Jul 11 13:01:13 2025 +0200
    Rewrite assign_discriminators

I have looked at the CFGs of this function before and after Jan's
patch and both cases are fine, this test breaking is not a real
regression.

gcc/testsuite/ChangeLog:

* gcc.misc-tests/gcov-29.c: Expect 6 prime paths in test.
* gcc.misc-tests/gcov-30.c: Likewise.

34 hours agogcov: Only consider pure locations in line mapping
Jørgen Kvalsvik [Wed, 5 Nov 2025 19:15:50 +0000 (20:15 +0100)] 
gcov: Only consider pure locations in line mapping

Fixes a regression introduced I bisected to this commit:

commit 385d9937f0e23cbf9c62f0b2553a33ff70e56ecf
Author: Jan Hubicka <hubicka@ucw.cz>
Date:   Fri Jul 11 13:01:13 2025 +0200
    Rewrite assign_discriminators

That patch adds discriminators to edge->goto_locus which will map to
the right source location, but breaks the equality comparison used in
the hash set.

Fixes these tests:

gcc/testsuite/gcc.misc-tests/gcov-pr83813.c
gcc/testsuite/gcc.misc-tests/gcov-pr84758.c
gcc/testsuite/gcc.misc-tests/gcov-pr85332.c
gcc/testsuite/gcc.misc-tests/gcov-pr85372.c

PR gcov-profile/121084
PR gcov-profile/121123
PR gcov-profile/121409

gcc/ChangeLog:

* profile.cc (branch_prob): Record seen_locations without
discriminators.

35 hours agoopenmp: Handle asm goto in diagnose_sb_2 [PR123876]
Jakub Jelinek [Fri, 30 Jan 2026 10:00:41 +0000 (11:00 +0100)] 
openmp: Handle asm goto in diagnose_sb_2 [PR123876]

We weren't handling asm goto in diagnose_sb_2, so could ICE
on invalid code instead of diagnosing it as invalid.

Note, for C++ the FE already diagnoses that instead of deferring
it will omp-low.cc.

2026-01-30  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/123876
* omp-low.cc (diagnose_sb_2): Handle GIMPLE_ASM.

* gcc.dg/gomp/pr123876.c: New test.

35 hours agolibcpp: Fix up comment handling in -fdirectives-only preprocessing [PR123273]
Jakub Jelinek [Fri, 30 Jan 2026 09:56:10 +0000 (10:56 +0100)] 
libcpp: Fix up comment handling in -fdirectives-only preprocessing [PR123273]

Back in 2020 Nathan rewrote the -E -fdirectives-only preprocessing.
In PR103130 a year and half later I've fixed the handling of comments
so that /* \*/ is considered as full comment even when * is escaped,
to match the normal preprocessing.
The following testcases shows further bugs in the comment handling.
One is that /* *\/ should not be considered as full comment (i.e.
when the / after * is escaped).  And another one is that the code
was treating any number of backslashes as escape, which is wrong,
only a single backslash is an escape, two backslashes preprocess as
one backslash, three as one backslash and one escape, etc.
So, while /* *\
/ is a full comment, /* *\\
/ or /* *\\\\\\\\\\\\\
/ is not.

2026-01-30  Jakub Jelinek  <jakub@redhat.com>

PR preprocessor/123273
* lex.cc (cpp_directive_only_process): Only go to done_comment
for '/' if star is true and esc is false.  When seeing '\\' with
esc set to true, clear esc as well as star instead of keeping esc
set.

* c-c++-common/cpp/dir-only-10.c: New test.
* c-c++-common/cpp/dir-only-11.c: New test.

36 hours agoaarch64: Fix gating of fp8 intrinsics [PR123206]
Alex Coplan [Fri, 19 Dec 2025 13:51:04 +0000 (13:51 +0000)] 
aarch64: Fix gating of fp8 intrinsics [PR123206]

As it stands, there are several intrinsics in
aarch64-simd-pragma-builtins.def which have the following form:

  #define REQUIRED_EXTENSIONS nonstreaming_only (TARGET_SIMD)
  [...]
  #undef REQUIRED_EXTENSIONS

the problem being that nonstreaming_only expects an instance of
aarch64_feature_flags which (statically) describes the required
extensions for the intrinsics.  Instead, we were passing TARGET_SIMD,
which computes a boolean telling us dynamically whether the simd feature
is currently available.

This patch fixes the issue by simply doing
s/TARGET_SIMD/AARCH64_FL_SIMD/ in that file.  We also add a simple test
which checks that we now diagnose the missing extension instead of
ICEing when compiling with +nosimd.

As an additional conservative hardening step (to prevent a similar issue
from re-occurring), this patch adjusts the aarch64_pragma_builtins table
to make it constexpr.  This makes the bug a compile-time error.

The next patch in the series adjusts the ctor of bbitmap to make it
explicit (and deals with the fallout), this patch however is
deliberately a minimal fix which is suitable for backporting.

gcc/ChangeLog:

PR target/123206
* config/aarch64/aarch64-builtins.cc (struct aarch64_pragma_builtins_data):
Declare array as CONSTEXPR.
* config/aarch64/aarch64-simd-pragma-builtins.def: Update
incorrect uses of TARGET_SIMD to use AARCH64_FL_SIMD instead.

gcc/testsuite/ChangeLog:

PR target/123206
* gcc.target/aarch64/pr123206.c: New test.

37 hours agod: Refactor for changes to dmd front-end inteface
Iain Buclaw [Fri, 30 Jan 2026 08:06:39 +0000 (09:06 +0100)] 
d: Refactor for changes to dmd front-end inteface

There are a number of interface changes being made to the dmd front-end
interface. This makes any necessary refactorings ahead of the merge to
reduce the size of the diff.

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::visit (EnumDeclaration *)): Treat sinit member
field as a generic pointer.
(enum_initializer_decl): Likewise.
* expr.cc (ExprVisitor::visit (ArrayLiteralExp *)): Compute static
array length separately from creating type.
* modules.cc (struct module_info): Add ctor_decl, dtor_decl,
sharedctor_decl, shareddtor_decl, standalonector_decl, and
unittest_decl.
(layout_moduleinfo_fields): Add mi argument. Use it to check whether
module helpers have been generated.
(layout_moduleinfo): Likewise.
(build_module_tree): Cache generated module helpers in module_info.
* typeinfo.cc (cpp_type_info_ptrs): New variable.
(get_cpp_typeinfo_decl): Cache generated C++ type_info references in
cpp_type_info_ptrs.
* types.cc (TypeVisitor::visit (TypeEnum *)): Separate getting
front-end member value from building its CST tree.

37 hours agod: Fix ICE in dwarf2out_abstract_function, at dwarf2out.cc:23771 [PR123263]
Iain Buclaw [Fri, 30 Jan 2026 07:14:34 +0000 (08:14 +0100)] 
d: Fix ICE in dwarf2out_abstract_function, at dwarf2out.cc:23771 [PR123263]

Emit artificial functions as being part of the module context, so that
they are unaffected by dwarf early_finish pass removing the parent type
that they were generated for.

PR d/123263

gcc/d/ChangeLog:

* d-codegen.cc (d_decl_context): Set DECL_CONTEXT of compiler
generated functions to that of parent module.

gcc/testsuite/ChangeLog:

* gdc.dg/debug/pr123263.d: New test.

38 hours agotree-optimization/109410 - ICE with noreturn and -g
Richard Biener [Thu, 29 Jan 2026 14:43:01 +0000 (15:43 +0100)] 
tree-optimization/109410 - ICE with noreturn and -g

This fixes the -g variant of the original testcase.

PR tree-optimization/109410
* tree-ssa-reassoc.cc (build_and_add_sum): Use
gsi_start_nondebug_after_labels_bb to look for a possible
returns-twice call.

* gcc.dg/pr109410-2.c: New testcase.

38 hours agod, darwin: Add Apple as a predefined version
Iain Buclaw [Fri, 30 Jan 2026 06:34:04 +0000 (07:34 +0100)] 
d, darwin: Add Apple as a predefined version

This is a new predefined version identifier intended to be turned on if
any of the OSX, iOS, TVOS, WatchOS, or VisionOS versions are predefined.

gcc/ChangeLog:

* config/darwin-d.cc (darwin_d_os_builtins): Add Apple.

38 hours agod: Fix infinite loop in dump_generic_node [PR123264]
Iain Buclaw [Thu, 29 Jan 2026 17:07:57 +0000 (18:07 +0100)] 
d: Fix infinite loop in dump_generic_node [PR123264]

PR d/123264

gcc/d/ChangeLog:

* types.cc (finish_aggregate_type): Propagate struct TYPE_NAME to all
TYPE_NEXT_VARIANT types.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123264.d: New test.

41 hours agoifcvt: Improve noce_can_force_operand in ifcvt [PR122170]
Andrew Pinski [Wed, 28 Jan 2026 20:32:12 +0000 (12:32 -0800)] 
ifcvt: Improve noce_can_force_operand in ifcvt [PR122170]

Currently if the rtl is either an arithmetic or an unary
rtl, noce_can_force_operand checks to see if there is an
optab for that rtl code. This works for more things except
on some targets they have a ss_minus instruction but don't
implement the optab for it. In the case of arm you can
generate a ss_minus with a builtin and then when it comes
to trying to do ifcvt, force_operand fails over.
In this case the optab, sssub was only supported for
fixed-point modes before and it was working as code_to_optab
would return there was not optabs. But after r15-1030-gabe6d39365476e,
the optab will be return. What the backend is doing is correct and will
most likely happen with other rtl codes/optabs later on.

To fix this instead of just returning true if the optab exists, we need
to check if the optab entry for the mode exists.

PR rtl-optimization/122170

gcc/ChangeLog:

* ifcvt.cc (noce_can_force_operand): Don't only check if
there is an optab for the code check the entry for the
mode is non-null. Handle non integral div by checking
optab like force_operand does.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
42 hours agoLoongArch: Remove unused function type.
Lulu Cheng [Tue, 27 Jan 2026 02:31:37 +0000 (10:31 +0800)] 
LoongArch: Remove unused function type.

gcc/ChangeLog:

* config/loongarch/loongarch-ftypes.def: Remove unused type.

42 hours agoLoongArch: Fix bug123766.
Lulu Cheng [Tue, 27 Jan 2026 02:31:36 +0000 (10:31 +0800)] 
LoongArch: Fix bug123766.

The pointer parameter type for the original store class builtin
functions is CVPOINTER (const volatile void *).
Taking the following test as an example:

```
v4i64 v = {0, 0, 0, 0};
void try_store() {
     long r[4];
     __lasx_xvst(v, r, 0);
}
```
At this point, the type of r is CVPOINTER, which means data in memory
can only be read through r.  Therefore, if the array r is not
initialized, an uninitialized warning will be issued.
This patch changes the pointer type of store-class builtin functions
from CVPOINTER to VPOINTER (volatile void *).

PR target/123766

gcc/ChangeLog:

* config/loongarch/loongarch-builtins.cc
(loongarch_build_vpointer_type): New function.  Return a type
for 'volatile void *'.
(LARCH_ATYPE_VPOINTER): New macro.
* config/loongarch/loongarch-ftypes.def: Change the pointer
type of the store class function from CVPOINTER to VPOINTER.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vector/lasx/pr123766.c: New test.
* gcc.target/loongarch/vector/lsx/pr123766.c: New test.

43 hours agoLoongArch: Fix bug123807.
Lulu Cheng [Mon, 26 Jan 2026 03:38:59 +0000 (11:38 +0800)] 
LoongArch: Fix bug123807.

In the function loongarch_expand_vector_init_same, if same is MEM and
the mode of same does not match imode, it will cause an ICE
in force_reg (imode, same).

PR target/123807

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_expand_vector_init_same): When same is MEM and
GET_MODE(same) != imode, first load the data from memory
and then process it further.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vector/lsx/pr123807.c: New test.

43 hours agoLoongArch: Fix movsf in lp64s abi
mengqinggang [Fri, 23 Jan 2026 07:00:58 +0000 (15:00 +0800)] 
LoongArch: Fix movsf in lp64s abi

When adding LoongArch32 ilp32s abi support, add TARGET_HARD_FLOAT condition for
movsf to prevent matching in target without FPU.
But movsf also needs to be used in lp64s abi, it can expand to some
non float instructions.
Delete TARGET_HARD_FLOAT condition.

gcc/ChangeLog:

* config/loongarch/loongarch.md: Delete movsf TARGET_HARD_FLOAT
condition.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/la64/movsf.c: New test.

44 hours agoDaily bump.
GCC Administrator [Fri, 30 Jan 2026 00:16:31 +0000 (00:16 +0000)] 
Daily bump.

47 hours agooptabs: Fix expansion of abs and neg for Float16 [PR123869]
Andrew Pinski [Thu, 29 Jan 2026 00:50:52 +0000 (16:50 -0800)] 
optabs: Fix expansion of abs and neg for Float16 [PR123869]

The problem here is we try to use the widening type before
doing the bitwise expansion of neg/and for floating point types.
This moves the code around to try the bitwise expansion first.

Note this mostly matters for NaNs where you widening (promotion)
would cause a NaN to be slightly different when doing the rounding
back.

Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/123869

gcc/ChangeLog:

* optabs.cc (expand_unop): Move the NEG optab
handling before the widening code.
Move the ABS bitwise expansion from expand_abs_nojump
to before the widening code.
(expand_abs_nojump): Remove the bitwise expansion trial
since expand_unop is called right above.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 days agolibstdc++: Make std::expected trivially copy/move assignable (LWG 4026)
Jonathan Wakely [Wed, 28 Jan 2026 12:33:46 +0000 (12:33 +0000)] 
libstdc++: Make std::expected trivially copy/move assignable (LWG 4026)

This is the subject of two NB comments on C++26 which seem likely to be
approved. We're allowed to make this change as QoI anyway, even if it
isn't approved for the standard, and it should apply to C++23 as well to
avoid ABI changes between C++23 and C++26.

As shown in the updates to the test, defaulted special members can have
noexcept(false) even if they would be noexcept(true) by default. The new
defaulted operator= overloads added by this commit have conditional
noexcept-specifiers that match the conditions of the non-trivial
assignments, propagating any noexcept(false) on trivial special members
of the T and E types. We could strengthen the noexcept for the trivial
operators, but propagating the conditions from the underlying types is
probably what users expect, if they've bothered to put noexcept(false)
on their defaulted special members.

libstdc++-v3/ChangeLog:

* include/std/expected (__expected::__trivially_replaceable)
(__expected::__usable_for_assign)
(__expected::__usable_for_trivial_assign)
(__expected::__can_reassign_type): New concepts.
(expected::operator=): Adjust constraints
on existing overloads and add defaulted overload.
(expected<cv void, E>::operator=): Likewise.
* testsuite/20_util/expected/requirements.cc: Check for trivial
and nothrow properties of assignments.

2 days agotestsuite: Move pr116353.c from being x86 specific to being generic
Andrew Pinski [Wed, 28 Jan 2026 20:16:43 +0000 (12:16 -0800)] 
testsuite: Move pr116353.c from being x86 specific to being generic

While working on ifcvt's noce_can_force_operand, I noticed that
the testcase pr116353.c was added as x86 specific testcase but
it has nothing in it that is x86 specific. It is currently
compiled at -O2 but there is no reason why it can't be compiled
at any other optimization level.
So this moves the testcase to be a torture testcase.

The original issue showed up on x86 with respect to ifcvt
where there was a vec_select which does not have an optab for it
but it might show up on other targets too.

Tested on x86_64-linux-gnu.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr116353.c: Move to...
* gcc.dg/torture/pr116353.c: ...here.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 days agoAllow CONCATs in emit_group_load_1.
Roger Sayle [Thu, 29 Jan 2026 18:48:14 +0000 (18:48 +0000)] 
Allow CONCATs in emit_group_load_1.

This one line patch is a pre-requisite to a solution to PR target/123506;
an effort to improve middle-end code for returning structures.  Currently,
emit_group_load_1 contains code to handle a CONCAT returned by force_reg.
This tweak avoids the call for force_reg if the source is already a CONCAT,
which allows this subroutine to be re-used by target-specific implementations
of emit_group_load.  Many thanks to Jeff Law for cross-platform testing.

2026-01-29  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* expr.cc (emit_group_load_1): Don't call force_reg if orig_src
is already a CONCAT.

2 days agoAda: Fix internal error on equality test with empty container
Eric Botcazou [Thu, 29 Jan 2026 15:16:08 +0000 (16:16 +0100)] 
Ada: Fix internal error on equality test with empty container

This is a regression present on the mainline and 15 branch, although the
root cause has been present for years: the Sem_Type.Covers predicate
returns true for the type of an aggregate (Any_Composite) and any type
declared with the Aggregate aspect (when invoked in Ada 2022 or later),
but its companion function Sem_Type.Specific_Type punts when it is called
on the same combination.

gcc/ada/
PR ada/123861
* sem_type.adb (Covers): Fix couple of typos in comment.
(Specific_Type): Adjust to Covers' handling of types declared
with the Aggregate aspect in Ada 2022.

gcc/testsuite/
* gnat.dg/specs/aggr11.ads: New test.

2 days agotestsuite: arm: rework some target-supports checks to use -mfpu=auto
Richard Earnshaw [Thu, 29 Jan 2026 10:25:41 +0000 (10:25 +0000)] 
testsuite: arm: rework some target-supports checks to use -mfpu=auto

Several target-supports checks for Arm are still using the antiquated
-mfpu=... setting rather than picking up FPU extensions via the
architecture specification.  This causes problems when tests are
layered because they do not consistently override each other.

Arguably, that is incorrect anyway: you can't test two sets of flag
combinations independently and then expect to be able to apply both
of them, but this change at least makes this behave in a reasonable
way provided the second set of flags fully overrides the first.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp:
(check_effective_target_arm_v8_3a_complex_neon_ok_nocache):
Split and fill in arm and aarch64 compile options.  Remove the
cpu_unset variable.
(check_effective_target_arm_v8_2a_fp16_neon_ok_nocache): Likewise.
(check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache):
Likewise.
(check_effective_target_arm_neon_ok_nocache): Rework to use
-mfpu=auto.
(check_effective_target_arm_neon_fp16_ok_nocache): Likewise.

Co-authored-by: Artemiy Volkov <artemiy.volkov@arm.com>
2 days agotestsuite: require arm_v8_3a_fp16_complex_neon for complex fp16 tests
Artemiy Volkov [Thu, 8 Jan 2026 11:51:06 +0000 (11:51 +0000)] 
testsuite: require arm_v8_3a_fp16_complex_neon for complex fp16 tests

Changes to target-supports.exp from r16-6519-g56dd47c073cabf introduced
some new failures for complex fp16 tests with some arm-eabi targets
configured with -mfpu=auto.  This patch fixes those by (a) requiring the
full arm_v8_3a_fp16_complex_neon_ok target instead of just float16 in
vect/complex fp16 tests, and (b) simplifying down to one
dg-require-effective-target and one dg-add-options and removing the
explicit -march in advsimd-intrinsics/vector-complex_f16.c.

Regtested on aarch64, and the Linaro CI also delivers a positive verdict
for the relevant cortex-m33/-m3/-m55/-m7 configurations (after the
accompanying patch to target-supports.exp that follows).  Huge thanks to
Christophe for testing this on arm.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/complex/fast-math-bb-slp-complex-add-half-float.c:
Adjust testcase.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-add-pattern-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-complex-add-half-float.c: Likewise.
* gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-complex-mla-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-complex-mls-half-float.c:
Likewise.
* gcc.dg/vect/complex/fast-math-complex-mul-half-float.c:
Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vector-complex_f16.c:
Likewise.

2 days agolibstdc++: Fix use of feature test macro in <source_location>
Jonathan Wakely [Thu, 29 Jan 2026 17:02:43 +0000 (17:02 +0000)] 
libstdc++: Fix use of feature test macro in <source_location>

libstdc++-v3/ChangeLog:

* include/std/source_location: Check __glibcxx_contracts instead
of __cpp_lib_contracts.
* testsuite/18_support/contracts/includes.cc: New test.

2 days agolibstdc++: fix a wrong export of a contracts facility in std module
vspefs [Thu, 29 Jan 2026 16:58:19 +0000 (16:58 +0000)] 
libstdc++: fix a wrong export of a contracts facility in std module

This patch fixes a wrong export name in std module. std module currently
exports std::contracts::invoke_default_violation_handler, which is wrong.
The correct name is std::contracts::invoke_default_contract_violation_handler.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in (invoke_default_violation_handler): Change
to invoke_default_contract_violation_handler.

Signed-off-by: Xie Han <vspefs@protonmail.com>
2 days agoarm: testsuite: Use test framework to set arch in stack-protector-7
Christopher Bazley [Thu, 29 Jan 2026 15:55:15 +0000 (15:55 +0000)] 
arm: testsuite: Use test framework to set arch in stack-protector-7

This test was trying to set the architecture directly instead of
using the framework. The queried options were previously ignored.

gcc/testsuite/ChangeLog:
* gcc.target/arm/stack-protector-7.c: Fix dgdirectives.

2 days agodoc: Add "user experience" documentation for options
Sandra Loosemore [Thu, 29 Jan 2026 16:41:07 +0000 (16:41 +0000)] 
doc: Add "user experience" documentation for options

After working through PR122243, it seems appropriate to write down
some guidelines for adding/maintaining options and options
documentation so that we can at least point to procedures to keep
things from getting out of sync again.

Thanks to jemarch@gnu.org and dmalcolm@redhat.com for their suggestions
to improve this patch.

gcc/ChangeLog
* doc/options.texi (Options): Point to the "user experience"
documentation.
* doc/ux.texi (Guidelines for Options): Add some.

2 days agoRISC-V: Handle VL-setting FoF loads. [PR123806]
Robin Dapp [Mon, 26 Jan 2026 14:24:10 +0000 (15:24 +0100)] 
RISC-V: Handle VL-setting FoF loads. [PR123806]

For PR122869 I thought I fixed the issue of VL-spills clobbering
explicit VL reads after fault-only-first (FoF) loads but it turns
out the fix is insufficient.  Even though it avoided the original
issue, we can still have spills that clobber VL before the read_vl
RTL pattern.  That's mostly due to us hiding the VL data flow from
the optimizers so a regular spill to memory can and will introduce
a VL clobber.  In vsetvl we catch all the regular cases but not the
FoF-load case of PR123806 and PR122869.

This patch adds specific FoF patterns that emit the same instruction but
have a register-setting VL pattern inside the insn's PARALLEL.
It serves as a marker for the vsetvl pass that can recognize that we
clobber VL before reading its value.  In that case we now emit an
explicit csrr ..,vl.

After vsetvl it's safe to emit the read_vls because at that point the
VL dataflow has been established and we can be sure to not clobber VL
anymore.

Thus, the main changes are:
 - Unify read_vl si and di and make it an UNSPEC.  We don't optimize
   it anyway so a unified one is easier to include in the new FoF
   VL-setter variants.
 - Introduce VL-setting variants of FoF loads and handle them like
   read_vl()s in the vsetvl pass.
 - Emit read_vl()s after vsetvl insertion is done.

What this doesn't get rid of is the XFAIL in ff-load-3.c that I
introduced for PR122869.  The code is still "good" at -O1 and
"bad" at -O2 upwards.

PR target/123806

gcc/ChangeLog:

* config/riscv/riscv-string.cc (expand_rawmemchr): Use unified
vl_read.
(expand_strcmp): Ditto.
* config/riscv/riscv-vector-builtins-bases.cc:
* config/riscv/riscv-vector-builtins.cc (function_expander::use_fof_load_insn):
Only emit the store and not the VL read.
* config/riscv/riscv-vsetvl.cc (get_fof_set_vl_reg): New
function.
(init_rtl_ssa): New wrapper.
(finish_rtl_ssa): Ditto.
(emit_fof_read_vls): Emit read_vl after each fault-only-first
load.
(pass_vsetvl::simple_vsetvl): Call emit_fof_read_vls ().
(pass_vsetvl::lazy_vsetvl): Ditto.
* config/riscv/vector-iterators.md: Add read_vl unspec.
* config/riscv/vector.md (read_vlsi): Unify.
(@read_vl<mode>): Ditto.
(read_vldi_zero_extend): Ditto.
(@pred_fault_load_set_vl<V_VLS:mode><P:mode>): New FoF variant
that saves VL in a register.
(@pred_fault_load_set_vl<VT:mode><P:mode>): Ditto.

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/pr123806.C: New test.
* g++.target/riscv/rvv/base/pr123808.C: New test.
* g++.target/riscv/rvv/base/pr123808-2.C: New test.

2 days agoRISC-V: testsuite: Add zvl requirement to PR123626.
Robin Dapp [Wed, 28 Jan 2026 16:54:42 +0000 (17:54 +0100)] 
RISC-V: testsuite: Add zvl requirement to PR123626.

This adds a new require-effective-target check to pr123626.c.
As the test is a run test compiled with _zvl256b we need
to ensure the target actually supports 256b vectors.

We can only check for exactly 256b right now
(rvv_zvl256b_ok), i.e. "VLS".  Therefore, the patch also adds
a new target check rvv_zvl_ge_256b_ok where ge means greater
or equal.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Add rvv_zvl_ge_256b_ok.
* gcc.target/riscv/rvv/base/pr123626.c: Use new target check.

2 days agod: Fix Segmentation fault with redeclared symbols [PR123407]
Iain Buclaw [Thu, 29 Jan 2026 15:26:21 +0000 (16:26 +0100)] 
d: Fix Segmentation fault with redeclared symbols [PR123407]

Issue an error if two symbols with the same assembler name have a
mismatched TREE_CODE.

PR d/123407

gcc/d/ChangeLog:

* decl.cc (get_symbol_decl): Handle declarations with matching
assembler names, but different TREE_CODE.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123407a.d: New test.
* gdc.dg/pr123407b.d: New test.

2 days agopta: Fix comment of intra_create_variable_infos
Filip Kastl [Thu, 29 Jan 2026 15:01:33 +0000 (16:01 +0100)] 
pta: Fix comment of intra_create_variable_infos

The comment says that this function creates varinfos for *all*
variables in a function.  Meanwhile, it only creates varinfos for
parameters, the return value and the static chain.

Commiting as obvious.

gcc/ChangeLog:

* gimple-ssa-pta-constraints.cc (make_param_constraints): Adjust
comment: The function only creates varinfos for the parameters,
the return value and the static chain.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
2 days agoc++/reflection: add fixed test [PR123871]
Marek Polacek [Thu, 29 Jan 2026 14:39:12 +0000 (09:39 -0500)] 
c++/reflection: add fixed test [PR123871]

Incredibly, a patch that I just pushed (r16-7140-g101f2970adc0a7) fixed
this ICE.

I notice that we don't emit the diag_array_subscript diagnostic because
slice calls fold_non_dependent_expr which calls _eval_outermost with
allow_non_constant=true.  I wonder if we want to change this.

PR c++/123871

gcc/testsuite/ChangeLog:

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

2 days agod: Fix ICE in gimplify_expr with const ref noreturn parameters [PR123046]
Iain Buclaw [Thu, 29 Jan 2026 13:06:14 +0000 (14:06 +0100)] 
d: Fix ICE in gimplify_expr with const ref noreturn parameters [PR123046]

The ICE was caused by references to const/immutable qualified `noreturn'
declarations that were being leaked to the code generation when they
should have been omitted or replaced with `assert(0)'.

PR d/123046

gcc/d/ChangeLog:

* d-codegen.cc (build_address): Return `null' when generating the
address of a `noreturn' declaration.
(d_build_call): Compare TYPE_MAIN_VARIANT of type with `noreturn'.
* decl.cc (get_fndecl_arguments): Likewise.
* types.cc (finish_aggregate_mode): Likewise.
(TypeVisitor::visit (TypeFunction *)): Likewise.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123046.d: New test.

2 days agotree-optimization/122537 - do not elide maybe_zero condition for wrapping IV
Richard Biener [Thu, 29 Jan 2026 12:56:11 +0000 (13:56 +0100)] 
tree-optimization/122537 - do not elide maybe_zero condition for wrapping IV

The following removes the optimization eliding the maybe_zero condition
from number_of_iterations_lt_to_ne when the IV can overflow since the
IV delta input is not accurately reflecting this.

PR tree-optimization/122537
* tree-ssa-loop-niter.cc (number_of_iterations_lt_to_ne): Register
may_be_zero condition when the IV may overflow.

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

2 days agoc++/reflection: tweak for eval_has_template_arguments
Marek Polacek [Wed, 28 Jan 2026 20:43:35 +0000 (15:43 -0500)] 
c++/reflection: tweak for eval_has_template_arguments

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>:

> For reflection it's probably best to go with
>
> if (TYPE_P (r) && typedef_variant_p (r))
>   return alias_template_specialization_p (r, nt_opaque);
>
> and not get into primary_template_specialization_p at all.

Here in a patch form.

gcc/cp/ChangeLog:

* reflect.cc (eval_has_template_arguments): Return immediately after
checking alias_template_specialization_p.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++/reflection: add assert to eval_type_trait
Marek Polacek [Wed, 28 Jan 2026 21:26:35 +0000 (16:26 -0500)] 
c++/reflection: add assert to eval_type_trait

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>.

Since we check eval_is_type in process_metafunction:

  if (eval_is_type (ht) != boolean_true_node)
     return throw_exception_nontype (loc, ctx, fun, non_constant_p,
     jump_target);

finish_trait_expr should never return error_mark_node.  We can ensure
that it's so by adding an assert.

gcc/cp/ChangeLog:

* reflect.cc (eval_type_trait): Assert that finish_trait_expr didn't
return error_mark_node.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++/reflection: enhance splice error checking
Marek Polacek [Wed, 28 Jan 2026 22:30:06 +0000 (17:30 -0500)] 
c++/reflection: enhance splice error checking

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>:

> Absolutely, I mean anything other than REFLECT_EXPR or error_mark_node
> should be an error.

I'm not giving another error for error_mark_node since we've already
complained (but make sure we have).

gcc/cp/ChangeLog:

* reflect.cc (class_members_of): Adjust comment.
(splice): Give an error if the expression doesn't evaluate to
a REFLECT_EXPR_P.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoFix AIX build break in gcc/diagnostics/sarif-sink.cc.
Sangamesh Mallayya [Thu, 29 Jan 2026 13:04:40 +0000 (07:04 -0600)] 
Fix AIX build break in gcc/diagnostics/sarif-sink.cc.

In AIX, build fails while trying to compile gcc/diagnostics/sarif-sink.cc.
Here is the snapshot of the error we are getting.

In file included from /opt/freeware/src/packages/BUILD/gcc/gcc/system.h:46,
                 from /opt/freeware/src/packages/BUILD/gcc/gcc/diagnostics/sarif-sink.cc:34:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/include-fixed/stdio.h:593:12: error: conflicting declaration of C function 'int fgetpos64(FILE*, fpos64_t*)'
  593 | extern int fgetpos64(FILE *, fpos64_t *);
      |            ^~~~~~~~~

This happens when we include sys/types.h before defining _LARGE_FILES.
We can see similar errors with this sample program.

#include <sys/types.h>
#define _LARGE_FILES 1
#include <stdio.h>
int main()
{
   return 0;
}

In gcc/diagnostics/sarif-sink.cc we are including config.h after #include <sys/un.h> which intern
 including sys/types.h and causing the conflicting errors.
Including config.h before including sys/un.h should solve this error.

The patch is to fix the build break on AIX.

gcc/ChangeLog:
* diagnostics/sarif-sink.cc: Move config.h at the begining.

2 days agod: Fix buffer overflow detected with -defaultlib= and -debuglib= [PR123349]
Iain Buclaw [Thu, 29 Jan 2026 09:11:43 +0000 (10:11 +0100)] 
d: Fix buffer overflow detected with -defaultlib= and -debuglib= [PR123349]

PR d/123349

gcc/d/ChangeLog:

* d-spec.cc (lang_specific_driver): Use xstrdup to copy -defaultlib
and -debuglib argument, and unconditionally free the old value.

gcc/testsuite/ChangeLog:

* gdc.dg/driver_debuglib.d: New test.
* gdc.dg/driver_defaultlib.d: New test.

2 days agolibstdc++: Fix non-ASCII characters in <contracts> header
Jonathan Wakely [Thu, 29 Jan 2026 12:12:45 +0000 (12:12 +0000)] 
libstdc++: Fix non-ASCII characters in <contracts> header

This fixes:
FAIL: 17_intro/headers/c++1998/charset.cc  -std=gnu++26 (test for excess errors)

libstdc++-v3/ChangeLog:

* include/std/contracts: Replace non-ASCII characters.

2 days agotree-optimization/123596 - fix partial virtual SSA update in eh_cleanup
Richard Biener [Thu, 29 Jan 2026 09:41:16 +0000 (10:41 +0100)] 
tree-optimization/123596 - fix partial virtual SSA update in eh_cleanup

The following replaces the not quite correct use of
mark_virtual_operand_for_renaming by an appropriate way of dealing
with a possibly partially up-to-date virtual SSA form.  Namely
when we just move stmts and not remove a VDEF we should arrange
for missing virtual PHIs to be created and just queue its arguments
for possible renaming.  For the testcase at hand there's no renaming
necessary in the end when done this way.

PR tree-optimization/123596
* tree-eh.cc (sink_clobbers): Create a virtual PHI when
one is required but not present, queuing arguments
for renaming.

* g++.dg/torture/pr123596.C: New testcase.

2 days agotree-optimization/116747 - ICE in cselim due to duplicate sinking
Richard Biener [Thu, 29 Jan 2026 07:47:44 +0000 (08:47 +0100)] 
tree-optimization/116747 - ICE in cselim due to duplicate sinking

The following avoids queueing duplicate stmts in the set of sinkings
to consider as well as pick candidates in an order that ensures
we don't unnecessarily re-order stores.  While we currently only can
trigger the ICE with out-of-bound accesses future enhancements
to how we deal with dependence analysis in this pass could expose
the issue to a wider range of testcases, so this makes it future-proof.

PR tree-optimization/116747
* tree-ssa-phiopt.cc (cond_if_else_store_replacement): Avoid
duplicate stmts in the set of store pairs to process.

* gcc.dg/tree-ssa/cselim-4.c: New testcase.

2 days agoc++: Fix ICE in eval_annotations_of [PR123866]
Jakub Jelinek [Thu, 29 Jan 2026 11:34:59 +0000 (12:34 +0100)] 
c++: Fix ICE in eval_annotations_of [PR123866]

eval_annotations_of throws if the passed in reflection handle is not
eval_is_function (and various others).  Now, eval_is_function uses
maybe_get_first_fn to look through BASELINK/OVERLOAD etc., but
eval_annotations_of wasn't doing that and ICEd on
  else if (TYPE_P (r))
    r = TYPE_ATTRIBUTES (r);
  else if (DECL_P (r))
    r = DECL_ATTRIBUTES (r);
  else
    gcc_unreachable ();
because r isn't a decl nor type (nor REFLECT_BASE earlier).

2026-01-29  Jakub Jelinek  <jakub@redhat.com>

PR c++/123866
* reflect.cc (eval_annotations_of): Use maybe_get_first_fn.

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

2 days agoa68: implement GNU68-2026-001-short-of-symbol
Jose E. Marchesi [Thu, 29 Jan 2026 02:33:17 +0000 (03:33 +0100)] 
a68: implement GNU68-2026-001-short-of-symbol

This patch implements the GNU extension:

  GNU68-2026-001-brief-selection - Brief style for selection

which adds the preferred brief style for selection recommended by
Hansen in "ALGOL 68 Hardware Represenatation Recommendations"
published in the Algol Bulletin issue 42.

This extension is already listed in https://algol68-lang.org.

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

* ga68.vw: Update formal grammar to express the GNU extension.
* a68-parser.cc (a68_dont_mark_here): Likewise.
* a68-parser-scanner.cc (SINGLE_QUOTE_CHAR): Define.
(get_next_token): Recognize ' as QUOTE_SYMBOL.
(tokenise_source): Acknowledge QUOTE_SYMBOL.
* a68-parser-keywords.cc (a68_set_up_tables): Likewise.
* a68-parser-bottom-up.cc (reduce_primary_parts): Adjust parser to
brief form of selection.
* a68-parser-attrs.def (QUOTE_SYMBOL): New attribute.
* ga68.texi (Brief selection): New section.

gcc/testsuite/ChangeLog

* algol68/compile/error-selector-1.a68: New test.
* algol68/execute/selection-2.a68: Update test.
* algol68/execute/selection-5.a68: Likewise.

2 days agoc++: Implement CWG3131 - Value categories and types for the range in iterable expansi...
Jakub Jelinek [Thu, 29 Jan 2026 08:49:51 +0000 (09:49 +0100)] 
c++: Implement CWG3131 - Value categories and types for the range in iterable expansion statements

For the https://gcc.gnu.org/pipermail/gcc/2025-November/246977.html
issues I've filed https://github.com/cplusplus/CWG/issues/805
which resulted in two CWG issues,
https://cplusplus.github.io/CWG/issues/3131.html
and
https://cplusplus.github.io/CWG/issues/3140.html
This patch implements the former, changing
the iterating expansion statement http://eel.is/c++draft/stmt.expand#5.2
line from
constexpr auto&& range = expansion-initializer;
to
constexpr decltype(auto) range = (expansion-initializer);
(for our partly pre-CWG3044 implementation with static before it).

2026-01-29  Jakub Jelinek  <jakub@redhat.com>

* cp-tree.h (build_range_temp): Implement CWG3131 - Value
categories and types for the range in iterable expansion statements.
Add bool argument defaulted to false.
* parser.cc (build_range_temp): Add expansion_stmt_p argument,
if true build const decltype(auto) __for_range = range_expr instead of
auto &&__for_range = range_expr.
(cp_build_range_for_decls): For expansion stmts build __for_range as
static constexpr decltype(auto) __for_range = (range_expr);
rather than static constexpr auto &&__for_range = range_expr;.

* g++.dg/cpp26/expansion-stmt1.C (N::begin, N::end, O::begin,
O::end): Change argument type from B & to const B & or from
D & to const D &.
* g++.dg/cpp26/expansion-stmt2.C (N::begin, N::end, O::begin,
O::end): Likewise.
* g++.dg/cpp26/expansion-stmt3.C (N::begin, N::end, O::begin,
O::end): Likewise.
* g++.dg/cpp26/expansion-stmt16.C: Expect different diagnostics
for C++11.
* g++.dg/cpp26/expansion-stmt18.C (N::begin, N::end): Change
argument type from B & to const B &.
* g++.dg/cpp26/expansion-stmt25.C (N::begin, N::end): Likewise.
* g++.dg/cpp26/expansion-stmt26.C: New test.
* g++.dg/reflect/p3491-2.C (baz): Move workaround to a new
function garply, use the previously #if 0 guarded implementation.
(garply): New function.

2 days agolibffi: Remove more unneeded files when merging
Pietro Monteiro [Thu, 29 Jan 2026 01:16:04 +0000 (20:16 -0500)] 
libffi: Remove more unneeded files when merging

Delete .allow-ai-service and .gail-labels which are present in newer
versions of libffi.

libffi/ChangeLog:
PR libffi/117635
* merge.sh: Delete .allow-ai-service and .gail-labels when
merging new upstream versions.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2 days agolibffi: Add missing GCC patches to LOCAL_PATCHES
Pietro Monteiro [Thu, 29 Jan 2026 01:16:04 +0000 (20:16 -0500)] 
libffi: Add missing GCC patches to LOCAL_PATCHES

Add all the patches to GCC's copy of libffi to LOCAL_PATCHES.  I
skipped patches that only regenerate the configure script because it
doesn't come from upstream.

libffi/ChangeLog:
PR libffi/117635
* LOCAL_PATCHES: Add missing patches.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2 days agoa68: support FFI with C via formal holes
Jose E. Marchesi [Sat, 24 Jan 2026 19:10:10 +0000 (20:10 +0100)] 
a68: support FFI with C via formal holes

This commit adds FFI support to access C variables and call C
functions from Algol 68, using the construct specified by the Modules
and Separated compilation facilities intended to that effect: formal
holes (`nest' constructs).

Briefly put, an `int foo' C variable can be accessed from Algol 68
like:

  int foo = nest C "foo";
  if foo > 10 then ... fi;

A ref to a C variable `int counter', that allows to modify it as well
as read it:

  ref int counter = nest C "&counter";
  counter +:= 1;

The address stored in an `int *ptr' variable, as an Algol 68
reference:

  ref int ptr = nest C "ptr";
  ptr := 100; { Changes the integer pointed by the C ptr }

Calling the standard C `random' function:

  proc long int random = nest C "random";
  if random < 100 then ... fi;

Some tests and an sketchy section in the manual are also included.

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

* ga68.vw: Fix grammar for formal holes.
* ga68.texi (Particular programs): New section.
(Comments): Likewise.
* a68.h: Prototypes for a68_is_c_mode, a68_make_fomal_hole_decl,
a68_lower_formal_hole.
* a68-parser-attrs.def (FORMAL_HOLE): New attribute.
(LANGUAGE_INDICANT): Likewise.
* a68-parser-extract.cc (a68_elaborate_bold_tags): Elaborate
language indicants.
* a68-parser-moids-check.cc (mode_check_unit): Check mode in
formal holes.
* a68-low-units.cc (a68_lower_formal_hole): New function.
* a68-low.cc (a68_make_formal_hole_decl): Likewise.
* a68-moids-misc.cc (a68_is_c_mode): Likewise.
* a68-parser-bottom-up.cc (reduce_formal_holes): Likewise.

gcc/testsuite/ChangeLog

* algol68/compile/error-nest-1.a68: New test.
* algol68/compile/nest-c-1.a68: Likewise.
* algol68/compile/error-nest-5.a68: Likewise.
* algol68/compile/error-nest-4.a68: Likewise.
* algol68/compile/error-nest-3.a68: Likewise.
* algol68/compile/error-nest-2.a68: Likewise.

2 days agoDaily bump.
GCC Administrator [Thu, 29 Jan 2026 00:16:45 +0000 (00:16 +0000)] 
Daily bump.

2 days agoAda: Fix crash on Unchecked_Union parameter with -gnateV -gnata
Eric Botcazou [Wed, 28 Jan 2026 22:52:41 +0000 (23:52 +0100)] 
Ada: Fix crash on Unchecked_Union parameter with -gnateV -gnata

The problem is that the compiler generates 'Valid_Scalars for a formal
parameter of an Unchecked_Union type, which cannot work because it is not
possible to find out where the scalars are in it, given that the parameter
does not contain the discriminants of its Unchecked_Union type.  This also
changes -gnateV to work without the need for -gnata, as there is no mention
of this dependence in the documentation.

gcc/ada/
PR ada/123857
* checks.adb (Apply_Parameter_Validity_Checks.Add_Validity_Check):
Set Is_Checked on the generated {Pre,Post}_Condition pragma and
bail out if the parameter is of an Unchecked_Union type.

gcc/testsuite/
* gnat.dg/unchecked_union4.adb: New test.

2 days agoAda: Fix stack corruption with concatenation and 'Image of composite type
Eric Botcazou [Wed, 28 Jan 2026 22:31:49 +0000 (23:31 +0100)] 
Ada: Fix stack corruption with concatenation and 'Image of composite type

The issue is that the expansion of 'Image for composite types is heavyweight
and involves a mix of Expression_With_Actions and controlled object that
does not work properly when it is the argument of a call to a subprogram,
so this replaces it by the canonical scheme used for controlled temporaries.

gcc/ada/
PR ada/123832
* exp_imgv.adb: Add with and use clauses for Exp_Ch7.
(Expand_Image_Attribute): Establish a transient scope before
rewriting the attribute as a call to Put_Image.
(Expand_Wide_Image_Attribute): Likewise.
(Expand_Wide_Wide_Image_Attribute): Likewise.
* exp_put_image.ads (Build_Image_Call): Add note about the
need for a transient scope when the function is invoked.
* exp_put_image.adb (Build_Image_Call): Call Insert_Actions
to immediately insert the actions instead of wrapping them
in an Expression_With_Actions node.

gcc/testsuite/
* gnat.dg/put_image2.adb: New test.

2 days agod: Fix ICE in ExprVisitor::visit, at d/expr.cc:2224 [PR123419]
Iain Buclaw [Wed, 28 Jan 2026 22:06:23 +0000 (23:06 +0100)] 
d: Fix ICE in ExprVisitor::visit, at d/expr.cc:2224 [PR123419]

The original assert expected the type of `__traits(initSymbol)' to be
exactly `const(void[])', but because D strips const from arrays to allow
passing slices as mutable ranges to template functions, so it got turned
into `const(void)[]'.

PR d/123419

gcc/d/ChangeLog:

* expr.cc (ExprVisitor::visit (VarExp *)): Adjust assertion.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123419.d: New test.

2 days agod: Fix ICE: in output_constructor_regular_field, at varasm.cc:5500 [PR123798]
Iain Buclaw [Wed, 28 Jan 2026 21:09:37 +0000 (22:09 +0100)] 
d: Fix ICE: in output_constructor_regular_field, at varasm.cc:5500 [PR123798]

PR d/123798

gcc/d/ChangeLog:

* types.cc (insert_aggregate_bitfield): Set DECL_NONADDRESSABLE_P and
DECL_PADDING_P on bit-field decls.
(finish_aggregate_type): Pass the aligned bit offset to layout_decl.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123798.d: New test.

3 days agoi386: Use x >> ~y for x >> 31-y [PR36503]
Uros Bizjak [Wed, 28 Jan 2026 20:57:47 +0000 (21:57 +0100)] 
i386: Use x >> ~y for x >> 31-y [PR36503]

x86 targets mask 32-bit shifts with a 5-bit mask (and 64-bit with 6-bit mask),
so they can use x >> ~y instead of x >> 31-y.

The optimization converts:

movl    $31, %ecx
        subl    %esi, %ecx
        sall    %cl, %eax

to:
        notl    %ecx
        sall    %cl, %eax

PR target/36503

gcc/ChangeLog:

* config/i386/i386.md (*<insn:any_shift><mode:SWI48>3_sub):
Also allow operands[3] & (<mode_bitsize>-1) == (<mode_bitsize>-1)
in insn condition. Emit NOT RTX instead of NEG RTX in this case.
(*<insn:any_shift><mode:SWI48>3_sub_1): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr36503-5.c: New test.
* gcc.target/i386/pr36503-6.c: New test.

3 days agoRISC-V: Fix ABI vector passing on stack and GPR [PR123824].
Robin Dapp [Mon, 26 Jan 2026 16:59:58 +0000 (17:59 +0100)] 
RISC-V: Fix ABI vector passing on stack and GPR [PR123824].

Krister reported that we violate the psABI when one vector argument
halfway fits into a register:

"Aggregates whose total size is no more than 2×XLEN bits are passed in a
pair of registers; if only one register is available, the first XLEN
bits are passed in a register and the remaining bits are passed on the
stack. If no registers are available, the aggregate is passed on the
stack."

This patch fixes this oversight and adds a few tests.

Regtested on rv64gcv_zvl512b.

PR target/123824

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_vls_mode_fits_in_gprs_p): New
helper.
(riscv_pass_vls_aggregate_in_gpr): Use helper and distribute
half-fitting vector to GPR and stack.
(riscv_pass_aggregate_in_vr): Reformat comment.
(riscv_get_arg_info): Use helper.
(riscv_pass_by_reference): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/abi/vls-gpr-1.c: New test.
* gcc.target/riscv/abi/vls-gpr-10.c: New test.
* gcc.target/riscv/abi/vls-gpr-11.c: New test.
* gcc.target/riscv/abi/vls-gpr-12.c: New test.
* gcc.target/riscv/abi/vls-gpr-13.c: New test.
* gcc.target/riscv/abi/vls-gpr-14.c: New test.
* gcc.target/riscv/abi/vls-gpr-2.c: New test.
* gcc.target/riscv/abi/vls-gpr-3.c: New test.
* gcc.target/riscv/abi/vls-gpr-4.c: New test.
* gcc.target/riscv/abi/vls-gpr-5.c: New test.
* gcc.target/riscv/abi/vls-gpr-6.c: New test.
* gcc.target/riscv/abi/vls-gpr-7.c: New test.
* gcc.target/riscv/abi/vls-gpr-8.c: New test.
* gcc.target/riscv/abi/vls-gpr-9.c: New test.

3 days agoC/C++: Better notification if misused a function like macro [PR102846]
Andrew Pinski [Wed, 15 Oct 2025 00:50:13 +0000 (17:50 -0700)] 
C/C++: Better notification if misused a function like macro [PR102846]

Currently if assert is misused, e.g. like passing to a function like a
function pointer, GCC suggests to include assert.h/cassert. But since
it is already included that is just a bogus suggestion. Instead we should
see if a function-like macro is that same name (in the case of assert it will be),
and inform the user that it is being mis-used.

PR c++/102846
PR c/102846

gcc/c-family/ChangeLog:

* known-headers.cc (macro_like_function_used::macro_like_function_used): New.
(macro_like_function_used::~macro_like_function_used): New.
* known-headers.h (class macro_like_function_used): New class.

gcc/c/ChangeLog:

* c-decl.cc (lookup_name_fuzzy): Lookup function-like macro and
notify of misuse there.

gcc/cp/ChangeLog:

* name-lookup.cc (lookup_name_fuzzy): Lookup function-like macro and
notify of misuse there.

gcc/testsuite/ChangeLog:

* c-c++-common/function-like-macro-1.c: New test.
* c-c++-common/function-like-macro-2.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 days agod: Fix ICE: in expand_asm_stmt, at cfgexpand.cc:3445 [PR121477]
Iain Buclaw [Wed, 28 Jan 2026 17:34:21 +0000 (18:34 +0100)] 
d: Fix ICE: in expand_asm_stmt, at cfgexpand.cc:3445 [PR121477]

The d_mark_addressable routine that sets TREE_ADDRESSABLE in the D
front-end did not handle DECL_BIT_FIELD.

PR d/121477

gcc/d/ChangeLog:

* d-codegen.cc (d_mark_addressable): Give an error if taking the
address of a DECL_BIT_FIELD.

gcc/testsuite/ChangeLog:

* gdc.dg/pr121477.d: New test.

3 days ago[PR121571, LRA]: Reprocess asm insn with different preferences when there are no...
Vladimir N. Makarov [Wed, 28 Jan 2026 15:52:21 +0000 (10:52 -0500)] 
[PR121571, LRA]: Reprocess asm insn with different preferences when there are no enough regs for the asm-insn

The test for the PR contains asm insn requiring 7 general regs but
three operands can be in memory too ('g' constraint).  There are only
6 available general regs.  IRA in the test case assigns a mask reg to
one pseudo.  When LRA reloads the pseudo assigned to mask reg, it
frees general reg assigned to another pseudo in the asm and assigns
mask reg to another pseudo.  After a few iterations, we have asm all
operands of which are reload pseudos assigned to general regs and one
pseudo assigned to mask reg.  After that LRA can do nothing and
reports "not enough regs".  The patch recognizes situation when there
are not enough regs for an asm insn and makes 2nd attempt to find
reloads when memory for operands with 'g' or 'rm' constraint is
preferred.

gcc/ChangeLog:

PR target/121571
* lra-constraints.cc (process_alt_operands): Reprocess asm insn
when there are no enough regs for the asm-insn.

gcc/testsuite/ChangeLog:

PR target/121571
* gcc.target/i386/pr121571.c: New.