]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 months agolibstdc++: Disable __cpp_lib_reflection for old CXX ABI
Jakub Jelinek [Tue, 20 Jan 2026 11:01:07 +0000 (12:01 +0100)] 
libstdc++: Disable __cpp_lib_reflection for old CXX ABI

Reflection currently doesn't work with -D_GLIBCXX_USE_CXX11_ABI=0.
The problem is that std::meta::exception currently uses under the
hood std::string and std::u8string and those aren't constexpr in
the old ABI.
While those members are in the standard exposition-only and so
we could make it to work by writing a custom class template that
just remembers const char{,8_t} * and size_t, there shouldn't be
many people trying to use C++26 features with the ABI that isn't
even compatible with C++11.

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

* include/bits/version.def (reflection): Add cxx11abi = yes;.
* include/bits/version.h: Regenerate.

4 months agotestsuite, cobol, modula2, rust, algol68: Extend help.exp testing and fix reported...
Jakub Jelinek [Tue, 20 Jan 2026 10:55:32 +0000 (11:55 +0100)] 
testsuite, cobol, modula2, rust, algol68: Extend help.exp testing and fix reported bugs

Last night I was surprised because make check help.exp reported the missing
dot at the end of cobol/lang.opt description below:

Wmove-index
Cobol Warning Var(move_index, 1) Init(1)
Warn if MOVE INDEX is used

but has not reported

fexec-national-charset=
Cobol Joined Var(cobol_national_charset) RejectNegative
Set the default execution character set for NATIONAL data items

a few lines earlier.

The problem is that help.exp verified output of
--help={common,optimizers,param,target,warnings} and just selected FEs:
--help={ada,c,c++,d,fortran,go} and no other languages.
Wmove-index above got reported because it appears in --help=warnings,
but fexec-national-charset= didn't, because it only appears in --help=cobol

So, the following patch adds 6 further languages to what help.exp tests
and fixes the reported bugs.

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

gcc/testsuite/
* gcc.misc-tests/help.exp: Check for descriptions without terminating
dot or semicolon also for objc, objc++, rust, modula-2, cobol and
algol68.
gcc/rust/
* lang.opt (frust-crate=, frust-extern=,
frust-incomplete-and-experimental-compiler-do-not-use,
frust-max-recursion-depth=, frust-crate-type=, frust-mangling=,
frust-cfg=, frust-edition=, frust-embed-metadata,
frust-metadata-output=, frust-compile-until=,
frust-name-resolution-2.0, frust-panic=, frust-overflow-checks): Add
dot at the end of the description.
gcc/cobol/
* lang.opt (fexec-national-charset=): Add dot at the end of the
description.
gcc/algol68/
* lang.opt (std=algol68, std=gnu68): Add dot at the end of the
description.
gcc/m2/
* lang.opt (Wpedantic-param-names, Wpedantic-cast, Wverbose-unbounded,
Wstyle, fauto-init, fbounds, fcase, fcpp, fcpp-end, fcpp-begin,
fdebug-builtins, fd, fdebug-function-line-numbers, fdef=,
fdump-system-exports, fextended-opaque, ffloatvalue,
fgen-module-list=, findex, fiso, flocation=, fm2-debug-trace=,
fm2-dump=, fm2-dump-decl=, fm2-dump-gimple=, fm2-dump-quad=,
fm2-dump-filter=, fm2-file-offset-bits=, fm2-g, fm2-lower-case,
fm2-pathname=, fm2-pathname-root=, fm2-pathname-rootI=, fm2-plugin,
fm2-prefix=, fm2-statistics, fm2-strict-type, fm2-strict-type-reason,
fm2-whole-program, fmod=, fnil, fpim, fpim2, fpim3, fpim4,
fpositive-mod-floor-div, fpthread, fq, frange, freturn,
fruntime-modules=, fscaffold-dynamic, fscaffold-c, fscaffold-c++,
fscaffold-main, fscaffold-static, fshared, fsoft-check-all, fsources,
fswig, fuse-list=, fwideset, fwholediv, fwholevalue, save-temps,
save-temps=): Add dot at the end of the description.

4 months agotree-optimization/123729 - fix reduction epilog flowing into abnormal edge
Richard Biener [Tue, 20 Jan 2026 09:24:20 +0000 (10:24 +0100)] 
tree-optimization/123729 - fix reduction epilog flowing into abnormal edge

When we vectorize a reduction and the reduction value flows across
an abnormal edge we have to make sure to mark the final SSA properly.
The following serves as a recipie how to avoid blindly copying
SSA_NAME_OCCURS_IN_ABNORMAL_PHI but instead set it when needed during
use replacement.

PR tree-optimization/123729
* tree-vect-loop.cc (vect_create_epilog_for_reduction): Set
SSA_NAME_OCCURS_IN_ABNORMAL_PHI if the reduction flows
across an abnomal edge.

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

4 months agoAdd phi_arg_edge_from_use helper
Richard Biener [Tue, 20 Jan 2026 09:22:49 +0000 (10:22 +0100)] 
Add phi_arg_edge_from_use helper

I've needed this a few times now and indenting nested
phi_arg_index_from_use inside gimple_phi_arg_edge is difficult.

* tree-phinodes.h (phi_arg_index_from_use): Use gphi *.
(phi_arg_edge_from_use): New helper composing
phi_arg_index_from_use and gimple_phi_arg_edge.

4 months agolibgomp: Ensure memory sync after performing tasks
Matthew Malcolmson [Tue, 20 Jan 2026 03:54:51 +0000 (03:54 +0000)] 
libgomp: Ensure memory sync after performing tasks

As described in PR 122356 there is a theoretical bug around not
"publishing" user data written in a task when that task has been
executed by a thread after entry to a barrier.

Key points of the C memory model that are relevant:
1) Memory writes can be seen in a different order in different threads.
2) When one thread (A) reads a value with acquire memory ordering that
   another thread (B) has written with release memory ordering, then all
   data written in thread (B) before the write that set this value will
   be visible to thread (A) after that read.
3) This point requires that the read and write operate on the same
   value.  The guarantee is one-way:  It specifies that thread (A) will
   see the writes that thread (B) has performed before the specified
   write.  It does not specify that thread (B) will see writes that
   thread (A) has performed before reading this value.

Outline of the issue:
1) While there is a memory sync at entry to the barrier, user code can
   be ran after threads have all entered the barrier.
2) There are various points where a memory sync can occur after entry to
   the barrier:
   - One thread getting the `task_lock` mutex that another thread has
     released.
   - Last thread incrementing `bar->generation` with `MEMMODEL_RELEASE`
     and some other thread reading it with `MEMMODEL_ACQUIRE`.
   However there are code paths that can avoid these points.
3) On the code-paths that can avoid these points we could have no memory
   synchronisation between a write to user data that happened in a task
   executed after entry to the barrier, and some other thread running
   the implicit task after the barrier.  Hence that "other thread" may
   read a stale value that should have been overwritten in the explicit
   task.

There are two code-paths that I believe I've identified:
1) The last thread sees `task_count == 0` and increments the generation
   with `MEMMODEL_RELEASE` before continuing on to the next implicit
   task.
   If some other thread had executed a task that wrote user data I
   don't see any way in which an acquire-release ordering *from* the
   thread writing user data *to* the last thread would have been formed.
2) After all threads have entered the barrier.  Some thread (A) is
   waiting in `do_wait`.  Some other thread (B) completes a task writing
   user data.  Thread (B) increments the generation using
   `gomp_team_barrier_done` (non atomically -- hence not allowing the
   formation of any acquire-release ordering with this write).  Thread
   (A) reads that data with `MEMMODEL_ACQUIRE`, but since the write was
   not atomic that does not form an ordering.

This patch makes two changes:
1) The write of `task_count == 0` in `gomp_barrier_handle_tasks` is done
   atomically while the read of `task_count` in
   `gomp_team_barrier_wait_end` is also made atomic.  This addresses the
   first case by forming an acquire-release ordering *from* the thread
   executing tasks *to* the thread that will increment the generation
   and continue.
2) The write of `bar->generation` via `gomp_team_barrier_done` called
   from `gomp_barrier_handle_tasks` is done atomically.  This means that
   it will form an acquire-release synchronisation with the existing
   atomic read of `bar->generation` in the main loop of
   `gomp_team_barrier_wait_end`.

Testing done:
- Bootstrap & regtest on aarch64 and x86_64.
  - With & without _LIBGOMP_CHECKING_.
  - Testsuite with & without OMP_WAIT_POLICY=passive
- Cross compilation & regtest on arm.
- TSAN done on this as part of all my upstream patches.

libgomp/ChangeLog:
PR libgomp/122356
* config/gcn/bar.c (gomp_team_barrier_wait_end): Atomically read
team->task_count.
(gomp_team_barrier_wait_cancel_end): Likewise.
* config/gcn/bar.h (gomp_team_barrier_done): Atomically write
bar->generation.
* config/linux/bar.c (gomp_team_barrier_wait_end): Atomically
read team->task_count.
(gomp_team_barrier_wait_cancel_end): Likewise.
* config/linux/bar.h (gomp_team_barrier_done): Atomically write
bar->generation.
* config/posix/bar.c (gomp_team_barrier_wait_end): Atomically
read team->task_count.
(gomp_team_barrier_wait_cancel_end): Likewise.
* config/posix/bar.h (gomp_team_barrier_done): Atomically write
bar->generation.
* config/rtems/bar.h (gomp_team_barrier_done): Atomically write
bar->generation.
* task.c (gomp_barrier_handle_tasks): Atomically write
team->task_count when decrementing to zero.
* testsuite/libgomp.c/pr122356.c: New test.

Signed-off-by: Matthew Malcomson <mmalcomson@nvidia.com>
4 months agolibgomp: Enforce tasks executed lexically after scheduled
Matthew Malcolmson [Tue, 20 Jan 2026 03:29:04 +0000 (03:29 +0000)] 
libgomp: Enforce tasks executed lexically after scheduled

In PR122314 we noticed that our implementation of a barrier could
execute tasks from the next "Task scheduling" region.  This was because
of a race condition where a barrier could be "completed", and some
thread raced ahead to schedule another task on the "next" barrier all
before some other thread checks for a bit on the generation number to
tell if there is a task pending.

The solution provided here is to check whether the generation number has
"incremented" past the state that this barrier was entered with.  As it
happens the `state` variable already provided to
`gomp_barrier_handle_tasks` is enough for the targets to tell whether
the current global generation has incremented from the existing one.

This requires some changes in the two loops in bar.c that are waiting on
tasks being available.  These loops now need to check for "generation
has incremented" rather than "generation is identical to one increment
forward".  Without such an adjustment of the check a thread that is
refusing to execute tasks because they have been scheduled for the next
barrier will not continue into the next region until some other thread
has completed the task (and removed the BAR_TASK_PENDING flag).

This problem could be seen by a hang in testcases like
task-reduction-13.c.

Testing done:
- Bootstrap & regtest on aarch64 and x86_64.
  - With & without _LIBGOMP_CHECKING_.
  - Testsuite with & without OMP_WAIT_POLICY=passive
- Cross compilation & regtest on arm.
- TSAN done on this as part of all my upstream patches.

libgomp/ChangeLog:
PR libgomp/122314
PR libgomp/88707
* config/gcn/bar.c (gomp_team_barrier_wait_end): Use
gomp_barrier_state_is_incremented.
(gomp_team_barrier_wait_cancel_end): Likewise.
* config/gcn/bar.h (gomp_barrier_state_is_incremented,
gomp_barrier_has_completed): New.
* config/linux/bar.c (gomp_team_barrier_wait_end): Use
gomp_barrier_state_is_incremented.
(gomp_team_barrier_wait_cancel_end): Likewise.
* config/linux/bar.h (gomp_barrier_state_is_incremented,
gomp_barrier_has_completed): New.
* config/nvptx/bar.h (gomp_barrier_state_is_incremented,
gomp_barrier_has_completed): New.
* config/posix/bar.c (gomp_team_barrier_wait_end): Use
gomp_barrier_state_is_incremented.
(gomp_team_barrier_wait_cancel_end): Likewise
* config/posix/bar.h (gomp_barrier_state_is_incremented,
gomp_barrier_has_completed): New.
* config/rtems/bar.h (gomp_barrier_state_is_incremented,
gomp_barrier_has_completed): New.
* task.c (gomp_barrier_handle_tasks): Use
gomp_barrier_has_completed.
* testsuite/libgomp.c/pr122314.c: New test.

Signed-off-by: Matthew Malcomson <mmalcomson@nvidia.com>
4 months agocobol: Fix up -Wmove-index option description
Jakub Jelinek [Tue, 20 Jan 2026 00:18:51 +0000 (01:18 +0100)] 
cobol: Fix up -Wmove-index option description

I'm seeing
FAIL: compiler driver --help=warnings option(s): "^ +-.*[^:.]\$" absent from output: "  -Wmove-index                Warn if MOVE INDEX is used"
That is a test which verifies all option descriptions end with a dot or semicolon.

Fixed thusly:

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

* lang.opt (Wmove-index): Add missing dot at the end of description.

4 months agoDaily bump.
GCC Administrator [Tue, 20 Jan 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

4 months agoalgol68: Add allocation function for leaf objects
Pietro Monteiro [Tue, 20 Jan 2026 00:00:44 +0000 (19:00 -0500)] 
algol68: Add allocation function for leaf objects

Boehm GC has a malloc_atomic function that doesn't clear the new
allocation and doesn't scan it for pointers.

Add a wrapper for the GC malloc_atomic in the run-time library and use it to
allocate GC-collectable strings in the library.

Change the lowering of malloc on the front end to select the run-time GC malloc
function to be used based on the mode having pointers or not.  Use leaf
allocations for modes that are not refs or that don't contain refs.

A boolean `has_refs' member was added to MOID_T and the computation of the
atrribute is done by the parser when generating the mode list.

gcc/algol68/ChangeLog:

* a68-low-clauses.cc (a68_lower_collateral_clause): Update
call to a68_lower_alloca.
* a68-low-coercions.cc (a68_lower_widening): Likewise.
* a68-low-generator.cc (allocator_t): Adjust typedef.
(fill_in_buffer): Adjust call to allocator.
(gen_mode): Likewise.
* a68-low-multiples.cc (a68_row_malloc): Change type parameter to MOID_T
from tree. Adjust call to a68_lower_malloc.
* a68-low-posix.cc (a68_posix_fgets): Adjust call to a68_row_malloc.
(a68_posix_gets): Likewise.
* a68-low-runtime.def (MALLOC_LEAF): Add definition for
_libga68_malloc_leaf.
* a68-low-strings.cc (a68_string_concat): Adjust call to
a68_lower_malloc.
(a68_string_from_char): Likewise.
* a68-low-units.cc (a68_lower_slice): Likewise.
* a68-low.cc (a68_low_dup): Adjust calls to a68_lower_malloc
and a68_lower_alloca.
(a68_lower_alloca): Change type parameter to MOID_T from tree.
(a68_lower_malloc): Likewise. Use _libga68_malloc_leaf if the MOID_T
doesn't have refs, use _libga68_malloc otherwise.
* a68-parser-modes.cc (a68_create_mode): Set has_refs on the new mode.
(is_mode_has_refs): New function.
(compute_derived_modes): Set has_refs on the chain of modes.
* a68-parser.cc (a68_new_moid): Set has_refs to false by
default.
* a68-types.h (struct MOID_T): Add member `has_refs`.
(HAS_REFS): New macro.
* a68.h (a68_row_malloc): Update prototype.
(a68_lower_alloca): Likewise.
(a68_lower_malloc): Likewise.

libga68/ChangeLog:

* ga68-alloc.c (_libga68_malloc_leaf): New function.
* ga68-posix.c (_libga68_posixfgets): Use _libga68_malloc_leaf
instead of _libga68_malloc.
* ga68-unistr.c (_libga68_u32_to_u8): Likewise.
(_libga68_u8_to_u32): Likewise.
* ga68.h (_libga68_malloc_leaf): New prototype.
* ga68.map: Add _libga68_malloc_leaf to the global map.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
4 months agoa68: set enable_algol68_gc to `auto' instead of `no'
Mohammad-Reza Nabipoor [Mon, 19 Jan 2026 23:05:07 +0000 (00:05 +0100)] 
a68: set enable_algol68_gc to `auto' instead of `no'

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

* configure.ac (--enable-algol68-gc): Change default value to `auto'.
* configure: Re-generate.

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
4 months ago[RISC-V][PR rtl-optimization/121787] Work around bad cfglayout interaction with asm...
Jeff Law [Mon, 19 Jan 2026 22:53:22 +0000 (15:53 -0700)] 
[RISC-V][PR rtl-optimization/121787] Work around bad cfglayout interaction with asm goto

This is a suggestion from Richi in the PR.

The RISC-V backend calls the loop initialization routines during setup for
vsetvl insertion/optimization.  Right now that uses LOOPS_NORMAL which allows
various adjustments to the loop structure.  The interaction between those CFG
adjustments and asm goto support is putting the CFG into an undesirable state.

There's potentially an issue in the CFG layout bits, but we can punt that out
by using AVOID_CFG_MODIFICATIONS when calling loop_optimizer_init.  My review
of the vsetvl code doesn't show any direct need for clean preheaders, latches,
etc -- the biggest thing it needs is for infinite loops to be connected to the
exit block which is handled outside of loop_optimizer_init.

So this is a workaround, but enough to get the PR off the regression list.

Waiting for pre-commit CI to do its thing, though it has already passed
riscv{32,64}-elf for me.  Bootstrap on the Pioneer is in flight.

PR rtl-optimization/121787
gcc/
* config/riscv/riscv-vsetvl.cc (pre_vsetvl): Adjust call to
loop_optimizer_init to avoid making CFG changes.

gcc/testsuite/
* gcc.target/riscv/pr121787-1.c: New test.
* gcc.target/riscv/pr121787-2.c: New test.

4 months agoUpdate gcc es.po
Joseph Myers [Mon, 19 Jan 2026 22:43:01 +0000 (22:43 +0000)] 
Update gcc es.po

* es.po: Update.

4 months agoRegenerate sol2.opt.urls etc.
Rainer Orth [Mon, 19 Jan 2026 21:29:49 +0000 (22:29 +0100)] 
Regenerate sol2.opt.urls etc.

gcc:
* config/sol2.opt.urls: Regenerate.
* config/darwin.opt.urls: Likewise.
* config/dragonfly.opt.urls: Likewise.
* config/freebsd.opt.urls: Likewise.
* config/gnu-user.opt.urls: Likewise.
* config/hpux11.opt.urls: Likewise.
* config/i386/cygwin.opt.urls: Likewise.
* config/mingw/mingw.opt.urls: Likewise.
* config/netbsd.opt.urls: Likewise.
* config/openbsd.opt.urls: Likewise.
* config/rs6000/aix64.opt.urls: Likewise.
* config/rtems.opt.urls: Likewise.

4 months agotestsuite: Do not restrict five tests to { target native }
Joseph Myers [Mon, 19 Jan 2026 21:16:46 +0000 (21:16 +0000)] 
testsuite: Do not restrict five tests to { target native }

Five miscellaneous tests use { target native }, while not doing
anything that actually needs some kind of special handling for cross
testing.  Remove the { target native } restriction from those tests.

Tested for x86_64-pc-linux-gnu, and with cross to aarch64-linux.

* g++.old-deja/g++.mike/eh30.C, g++.old-deja/g++.mike/p4750.C,
g++.old-deja/g++.robertl/eb106.C, g++.old-deja/g++.robertl/eb83.C,
gcc.dg/20020201-1.c: Do not use { target native }.

4 months agoSilently ignore -pthread etc. on Solaris
Rainer Orth [Mon, 19 Jan 2026 20:51:28 +0000 (21:51 +0100)] 
Silently ignore -pthread etc. on Solaris

gcc supports -pthread/-pthreads on Solaris to provide a way to
transparently handle the platform-specific needs of multitheaded
programs.  In the past, this used to link with -lpthread.  However, this
has been removed in

config: -pthread shouldn't link with -lpthread on Solaris
        https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615080.html

since libpthread had been folded into libc.

The only thing these options do now is to define _REENTRANT and
_PTHREADS.  In Solaris 11.4, the system headers no longer reference the
former.  Checking gnulib as an important source of portability
information, I find that _REENTRANT is used for two purposes:

* Ensure that strerror_r, localtime_r and gmtime_r are declared.
  However, these declarations are no longer guarded by _REENTRANT, so
  this is moot.

* Besides, _REENTRANT is defined on Solaris in general, but this has no
  longer any effect.

There's no reference _PTHREADS at all, so this seems to be an ancient
relic no longer needed at all.

This patch silently ignores both options, keeping them for portability's
sake.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

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

gcc:
* config/sol2.h (CPP_SUBTARGET_SPEC): Remove.
* config/sol2.opt (pthread): Ignore.
(pthreads): Likewise.
* config/i386/sol2.h (CPP_SPEC): Remove.
(SUBTARGET_CPU_EXTRA_SPECS): Remove cpp_subtarget.
* doc/invoke.texi (Solaris 2 Options, pthread): Remove.

4 months agotestsuite/123175 - Use int32_t instead of int in vec-type construction.
Georg-Johann Lay [Mon, 19 Jan 2026 17:33:30 +0000 (18:33 +0100)] 
testsuite/123175 - Use int32_t instead of int in vec-type construction.

gcc/testsuite/
PR testsuite/123175
* gcc.dg/torture/pr123175-1.c: Use int32_t instead of int in
vec-type construction.
* gcc.dg/torture/pr123175-2.c: Same.

4 months ago[PR target/113666] Simplify VEC_EXTRACT from a uniform vector
Jeff Law [Mon, 19 Jan 2026 14:44:54 +0000 (07:44 -0700)] 
[PR target/113666] Simplify VEC_EXTRACT from a uniform vector

This fixes a P3 regression relative to gcc-13 on the RISC-V platform for this code:

> unsigned char a;
>
> int main() {
>   short b = a = 0;
>   for (; a != 19; a++)
>     if (a)
>       b = 32872 >> a;
>
>   if (b == 0)
>     return 0;
>   else
>     return 1;
> }
>
> -march=rv64gcv_zvl256b -mabi=lp64d -O3 -ftree-vectorize

Doesn't need vector at all.  Good code generation here looks like:

>         lui     a5,%hi(a)
>         li      a4,19
>         sb      a4,%lo(a)(a5)
>         li      a0,0
>         ret

gcc-14 and gcc-15 produce horrific code here, roughly 20 instructions,
over half of which are vector.  It's not even worth posting, it's
atrocious.

The trunk improves things, but not quite to the quality of gcc-13:

>         vsetivli        zero,8,e16,mf2,ta,ma
>         vmv.v.i v1,0
>         lui     a5,%hi(a)
>         li      a4,19
>         vslidedown.vi   v1,v1,1
>         sb      a4,%lo(a)(a5)
>         vmv.x.s a0,v1
>         snez    a0,a0
>         ret

If we look at the .optimized dump we have this nugget:

>   _26 = .VEC_EXTRACT ({ 0, 0, 0, 0, 0, 0, 0, 0 }, 1);

If we're extracting an element out of a uniform vector, then any element
will do and it's conveniently returned by uniform_vector_p.    So with a
simple match.pd pattern that simplifies to _26 = 0.  That in turn allows
elimination of all the vector code and simplify the return value to a
constant as well, resulting in the desired code shown earlier.

One could easily argue that this need not be restricted to a uniform
vector and I would totally agree.  But given we're in stage4, the
minimal fix for the regression seems more appropriate.  But I could
certainly be convinced to handle the more general case here.

Bootstrapped and regression tested on x86 & riscv64.  Tested across the
cross configurations as well with no regressions.

PR target/113666
gcc/
* fold-const-call.cc (fold_const_vec_extract): New function.
(fold_const_call, case CFN_VEC_EXTRACT): Call it.
* match.pd (IFN_VEC_EXTRACT): Handle extraction from a uniform
vector.

gcc/testsuite
* gcc.target/riscv/rvv/base/pr113666.c: New test.

Co-authored-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 months agotree-optimization/123061 - invalid hoisting of division
Richard Biener [Wed, 7 Jan 2026 09:23:22 +0000 (10:23 +0100)] 
tree-optimization/123061 - invalid hoisting of division

The following fixes the computation of always-exeecuted-in in the LIM
pass which was enhanced to handle inner loops in a better way but
in this process ended up setting inner loop always-executed-in state
based on outer loop analysis, which is wrong because an inner loop
block needs to be proven to be always executed for all inner loop
iterations as well, not only for all outer loop iterations.

The fix is to iterate over inner loops first and when processing
an outer loop only update always-executedness if a block belongs
to the very same loop or an immediately nested loop and always
executed inside that.

PR tree-optimization/123061
PR tree-optimization/123636
* tree-ssa-loop-im.cc (fill_always_executed_in_1): Change
outer-to-inner to inner-to-outer iteration.  Update inner
loop state only when always executed in an immediately
nested loop.

* gcc.dg/torture/pr123061.c: New testcase.
* gcc.dg/torture/pr123636.c: Likewise.
* gcc.dg/tree-ssa/ssa-lim-26.c: Likewise.

4 months agoGCN - doc/install.texi: Fix gfx9-4-generic llvm-mc requirements
Tobias Burnus [Mon, 19 Jan 2026 11:17:59 +0000 (12:17 +0100)] 
GCN - doc/install.texi: Fix gfx9-4-generic llvm-mc requirements

gcc/ChangeLog:

* doc/install.texi (GCN): gfx9-4-generic requires LLVM 20.

4 months agolibstdc++: Use overload operator<=> when provided in relational functors [PR114153]
Tomasz Kamiński [Fri, 16 Jan 2026 13:01:53 +0000 (14:01 +0100)] 
libstdc++: Use overload operator<=> when provided in relational functors [PR114153]

The implementation of less<> did not consider the possibility of t < u being
rewritten from overloaded operator<=>. This lead to situation when for t,u that:
* provide overload operator<=>, such that (t < u) is rewritten to (t <=> u) < 0,
* are convertible to pointers,
the expression std::less<>(t, u) would incorrectly result in call of
std::less<void*> on values converted to the pointers, instead of t < u.
The similar issues also occurred for greater<>, less_equal<>, greater_equal<>,
their range equivalents, and in three_way_compare for heterogeneous calls.

This patch addresses above, by also checking for free-functions and member
overloads of operator<=>, before falling back to pointer comparison. We do
not put any constraints on the return type of selected operator, in particular
in being one of the standard defined comparison categories, as the language
does not put any restriction of returned type, and if (t <=> u) is well
formed, (t op u) is interpreted as (t <=> u) op 0. If that later expression
is ill-formed, the expression using op also is (see included tests).

The relational operator rewrites try both order of arguments, t < u,
can be rewritten into operator<=>(t, u) < 0 or 0 < operator<=>(u, t), it
means that we need to test both operator<=>(T, U) and operator<=>(U, T)
if T and U are not the same types. This is now extracted into
__not_overloaded_spaceship helper concept, placed in <concepts>, to
avoid extending set of includes.

The compare_three_way functor defined in compare, already considers overloaded
operator<=>, however it does not consider reversed candidates, leading
to situation in which t <=> u results in 0 <=> operator<=>(u, t), while
compare_three_way{}(t, u) uses pointer comparison. This is also addressed by
using __not_overloaded_spaceship, that check both order of arguments.

Finally, as operator<=> is introduced in C++20, for std::less(_equal)?<>,
std::greater(_equal)?<>, we use provide separate __ptr_cmp implementation
in that mode, that relies on use of requires expression. We use a nested
requires clause to guarantee short-circuiting of their evaluation.
The operator() of aforementioned functors is reworked to use if constexpr,
in all standard modes (as we allow is as extension), eliminating the need
for _S_cmp function.

PR libstdc++/114153

libstdc++-v3/ChangeLog:

* include/bits/ranges_cmp.h (__detail::__less_builtin_ptr_cmp):
Add __not_overloaded_spaceship spaceship check.
* include/bits/stl_function.h (greater<void>::operator())
(less<void>::operator(), greater_equal<void>::operator())
(less_equal<void>::operator()): Implement using if constexpr.
(greater<void>::__S_cmp, less<void>::__S_cmp)
(greater_equal<void>::__ptr_comp, less_equal<void>::S_cmp):
Remove.
(greater<void>::__ptr_cmp, less<void>::__ptr_cmp)
(greater_equal<void>::__ptr_comp, less_equal<void>::ptr_cmp): Change
tostatic constexpr variable. Define in terms of requires expressions
and __not_overloaded_spaceship check.
* include/std/concepts: (__detail::__not_overloaded_spaceship):
Define.
* libsupc++/compare: (__detail::__3way_builtin_ptr_cmp): Use
__not_overloaded_spaceship concept.
* testsuite/20_util/function_objects/comparisons_pointer_spaceship.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 months agoc++: Make metafns.{gperf,h} usable in C++14
Jakub Jelinek [Mon, 19 Jan 2026 11:04:01 +0000 (12:04 +0100)] 
c++: Make metafns.{gperf,h} usable in C++14

Jonathan mentioned on IRC I've used static_asserts with a single argument
in metafns.gperf.  That is valid in C++17, but not in C++14 we still
support.

Fixed by adding "" as second operand.

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

* metafns.gperf: Add "" as second operand of 2 static_asserts.
* metafns.h: Regenerate.

4 months agotree-optimization/123602 - avoid PRE-inserting abnormal SSA refs
Richard Biener [Mon, 19 Jan 2026 09:21:10 +0000 (10:21 +0100)] 
tree-optimization/123602 - avoid PRE-inserting abnormal SSA refs

The following fixes an omission in find_or_generate_expression to
check for SSA_NAME_OCCURS_IN_ABNORMAL_PHI as already done in
create_expression_by_pieces.

PR tree-optimization/123602
* tree-ssa-pre.cc (find_or_generate_expression): Do not
generate references to abnormal SSA names.

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

4 months agolibstdc++: Fix std::erase_if for std::string with -D_GLIBCXX_USE_CXX11_ABI=0.
Tomasz Kamiński [Mon, 19 Jan 2026 09:03:08 +0000 (10:03 +0100)] 
libstdc++: Fix std::erase_if for std::string with -D_GLIBCXX_USE_CXX11_ABI=0.

The __cow_string used with -D_GLIBCXX_USE_CXX11_ABI=0, does not provide
erase accepting const_iterator, so we adjust  __detail::__erase.if
(introduced in r16-6889-g3287) to call __cont.erase with mutable iterators.

libstdc++-v3/ChangeLog:

* include/bits/erase_if.h (__detail::__erase_if): Pass mutable
iterators to __cont.erase.

4 months agos390: Deprecate -m31
Stefan Schulze Frielinghaus [Mon, 19 Jan 2026 08:56:51 +0000 (09:56 +0100)] 
s390: Deprecate -m31

Support for -m31 is deprecated and will be removed in a future release.

In order to let users know, emit an error/warning during configure.  An
error is thrown if --enable-multilib is given implicitly, or if
explicitly but not --enable-obsolete.

ChangeLog:

* configure: Regenerate.
* configure.ac: Deprecate -m31.

gcc/ChangeLog:

* config.gcc: Deprecate -m31.
* doc/invoke.texi: Deprecate -m31.

4 months agovect-generic: Fix up expand_vector_mult [PR123656]
Jakub Jelinek [Mon, 19 Jan 2026 08:46:36 +0000 (09:46 +0100)] 
vect-generic: Fix up expand_vector_mult [PR123656]

The alg_sub_factor handling in expand_vector_mult had the arguments
reversed.
As documented in expmed.h, the algorithms should be
   These are the operations:
   alg_zero             total := 0;
   alg_m                total := multiplicand;
   alg_shift            total := total * coeff
   alg_add_t_m2         total := total + multiplicand * coeff;
   alg_sub_t_m2         total := total - multiplicand * coeff;
   alg_add_factor       total := total * coeff + total;
   alg_sub_factor       total := total * coeff - total;
   alg_add_t2_m         total := total * coeff + multiplicand;
   alg_sub_t2_m         total := total * coeff - multiplicand;

   The first operand must be either alg_zero or alg_m.  */
So, alg_sub_factor should be identical to alg_sub_t2_m with the
difference that one subtracts accumulator and the other subtracts
op0.  I went through all the other ones and they seem to match
the description except for alg_sub_factor and tree-vect-patterns.cc
seems to be fully correct.  expand_vector_mult at times has
pretty random order of PLUS_EXPR arguments, but that is a commutative
operation, so makes no difference.

Furthermore, I saw weird formatting in the alg_add_t_m2 case, so fixed
that too.

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

PR tree-optimization/123656
* tree-vect-generic.cc (expand_vector_mult): Fix up alg_sub_factor
handling.  Fix up formatting in alg_add_t_m2 handling.

* gcc.dg/pr123656.c: New test.

4 months agolibatomic: Change installed libatomic_asneeded.a into a symlink [PR123650]
Jakub Jelinek [Mon, 19 Jan 2026 08:45:10 +0000 (09:45 +0100)] 
libatomic: Change installed libatomic_asneeded.a into a symlink [PR123650]

So, apparently I've tripped over not just one linker bug with the
libatomic/libgcc_s asneeded workaround for libtool bug, but two.
One is that mold doesn't parse INPUT ( AS_NEEDED ( -latomic ) )
or INPUT ( AS_NEEDED ( -lgcc_s ) ) correctly, I think that just
should be fixed in mold.

Another one is that ld.bfd doesn't handle correctly INPUT ( libatomic.a )
when doing static linking with -flto.  While that bug should be fixed too
in the linker, the reason to install a linker script for a static library
has been just my laziness, a symbolic link is more efficient, and even on
hosts without symbolic link for a very small library like libatomic.a
we can live with a cp -pR copy of it.

Furthermore, when I was checking in the last patch (i.e. r16-6736 PR123396),
git was loudly complaining about libatomic_asneeded.a being checked
into repository when *.a is in .gitignored.

So, the following patch revamps the libatomic_asneeded* handling.
libatomic_asneeded.so is rewritten in the way that libgcc_s_asneeded.so
is done and libatomic_asneeded.a installed using $(LN_S).

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

PR libgcc/123650
* Makefile.am (toolexeclib_DATA): Remove.
(all-local): For LIBAT_BUILD_ASNEEDED_SOLINK instead of installing
libatomic_asneeded.{so,a} from top_srcdir cd into the destination
directory, use echo to write libatomic_asneeded.so and $(LN_S) to
symlink libatomic_asneeded.a to libatomic.a.
(install-data-am): For LIBAT_BUILD_ASNEEDED_SOLINK depend on
install-asneeded.
(install-asneeded): New goal.
* libatomic_asneeded.so: Remove.
* libatomic_asneeded.a: Remove.
* Makefile.in: Regenerate.

4 months agotarget/123603 - add --param ix86-vect-compare-costs
Richard Biener [Fri, 16 Jan 2026 09:22:17 +0000 (10:22 +0100)] 
target/123603 - add --param ix86-vect-compare-costs

The following allows to switch the x86 target to use the vectorizer
cost comparison mechanic to select between different vector mode
variants of vectorizations.  The default is still to not do this
but this allows an opt-in.

On SPEC CPU 2017 for -Ofast -march=znver4 this shows 2463 out of
39706 vectorized loops changing mode.  In 503 out of 12378 cases
we decided to not use masked epilogs.  Compile-time increases by ~1% overall.
With a quick 1-run there does not seem to be off-noise effects
for INT, this particular optimization and target option combination
and actual hardware to run on.  For FP 549.fotonik3d_r improves by 6%
(confirmed with a 2-run).

This was triggered by PR123190 and PR123603 which have cases where
comparing costs would have resulted in the faster vector size to be
used.  Both were reported for -O2 -march=x86-64-v3 -flto and with PGO.
The PR123603 recorded regression of 548.exchange2_r with these flags
is resolved with the flag (performance improves by 13%).  I don't
have SPEC 2006 on that machine so did not verify the PR123190 433.milc
regression, but that has been improved with the two earlier patches.
The --param has no effect on the testcase in the PR.

I do expect that some of our tricks in the x86 cost model to make
larger vector sizes unprofitable will be obsolete or are
counter-productive with cost comparison turned on.

PR target/123603
* config/i386/i386.opt (-param=ix86-vect-compare-costs=): Add.
* config/i386/i386.cc (ix86_autovectorize_vector_modes): Honor it.
* doc/invoke.texi (ix86-vect-compare-costs): Document.

* gcc.dg/vect/costmodel/x86_64/costmodel-pr123603.c: New testcase.

4 months agoLoongArch: Fix bug117575.
Lulu Cheng [Sat, 17 Jan 2026 07:12:46 +0000 (15:12 +0800)] 
LoongArch: Fix bug117575.

In the template "vec_set<mode>", a call is made to
"lasx_xvinsve0_<lasxfmt_f>_scalar", but there is an issue due to
the different ranges of operand1 between the two templates.
The range of operand1 in the template
"lasx_xvinsve0_<lasxfmt_f>_scalar" is now set to be the same as
that in "vec_set<mode>".

PR target/117575

gcc/ChangeLog:

* config/loongarch/lasx.md: Modify the range of operand1.

gcc/testsuite/ChangeLog:

* g++.target/loongarch/pr117575.C: New test.

4 months agolibstdc++: Fix std::erase_if behavior for std::__debug containers
François Dumont [Wed, 10 Dec 2025 18:12:58 +0000 (19:12 +0100)] 
libstdc++: Fix std::erase_if behavior for std::__debug containers

Complete fix of std::erase_if/std::erase for all std::__debug containers and
__gnu_debug::basic_string. Make sure that iterators erased by this function
will be properly detected as such by the debug container and so considered as
invalid.

Doing so introduce a new std::__detail::__erase_if function dealing, similarly
to std::__detail::__erase_node_if, with non-node containers.

libstdc++-v3/ChangeLog:

* include/bits/erase_if.h (__detail::__erase_if): New.
* include/debug/deque (std::erase_if<>(__debug::deque<>&, _Pred)): Use latter.
* include/debug/inplace_vector (std::erase_if<>(__debug::inplace_vector<>&, _Pred)):
Likewise.
* include/debug/vector (std::erase_if<>(__debug::vector<>&, _Pred)): Likewise.
* include/std/deque: Include erase_if.h.
(std::erase_if<>(std::vector<>&, _Pred)): Adapt to use __detail::__erase_if.
* include/std/inplace_vector (std::erase_if<>(std::inplace_vector<>&, _Pred)):
Likewise.
* include/std/string (std::erase_if<>(std::basic_string<>&, _Pred)): Likewise.
* include/std/vector (std::erase_if<>(std::vector<>&, _Pred)): Likewise.
* include/debug/forward_list
(std::erase_if<>(__debug::forward_list<>&, _Pred)): New.
(std::erase<>(__debug::forward_list<>&, const _Up&)): New.
* include/debug/list
(std::erase_if<>(__debug::list<>&, _Pred)): New.
(std::erase<>(__debug::list<>&, const _Up&)): New.
* include/debug/map (std::erase_if<>(__debug::map<>&, _Pred)): New.
(std::erase_if<>(__debug::multimap<>&, _Pred)): New.
* include/debug/set (std::erase_if<>(__debug::set<>&, _Pred)): New.
(std::erase_if<>(__debug::multiset<>&, _Pred)): New.
* include/debug/string
(std::erase_if<>(__gnu_debug::basic_string<>&, _Pred)): New.
(std::erase<>(__gnu_debug::basic_string<>&, const _Up&)): New.
* include/debug/unordered_map
(std::erase_if<>(__debug::unordered_map<>&, _Pred)): New.
(std::erase_if<>(__debug::unordered_multimap<>&, _Pred)): New.
* include/debug/unordered_set
(std::erase_if<>(__debug::unordered_set<>&, _Pred)): New.
(std::erase_if<>(__debug::unordered_multiset<>&, _Pred)): New.
* include/std/forward_list (std::erase_if<>(std::forward_list<>&, _Pred)):
Adapt to work exclusively for normal implementation.
(std::erase<>(std::forward_list<>&, const _Up&)): Likewise.
* include/std/list (std::erase_if<>(std::list<>&, _Pred)): Likewise.
(std::erase<>(std::list<>&, const _Up&)): Likewise.
* include/std/map (std::erase_if<>(std::map<>&, _Pred)): Likewise.
(std::erase_if<>(std::multimap<>&, _Pred)): Likewise.
Guard functions using __cpp_lib_erase_if.
* include/std/set (std::erase_if<>(std::set<>&, _Pred)): Likewise.
(std::erase_if<>(std::multiset<>&, _Pred)): Likewise.
Guard functions using __cpp_lib_erase_if.
* include/std/unordered_map
(std::erase_if<>(std::unordered_map<>&, _Pred)): Likewise.
(std::erase_if<>(std::unordered_multimap<>&, _Pred)): Likewise.
Guard functions using __cpp_lib_erase_if.
* include/std/unordered_set
(std::erase_if<>(std::unordered_set<>&, _Pred)): Likewise.
(std::erase_if<>(std::unordered_multiset<>&, _Pred)): Likewise.
Guard functions using __cpp_lib_erase_if.
* testsuite/21_strings/basic_string/debug/erase.cc: New test case.
* testsuite/23_containers/forward_list/debug/erase.cc: New test case.
* testsuite/23_containers/forward_list/debug/invalidation/erase.cc: New test case.
* testsuite/23_containers/list/debug/erase.cc: New test case.
* testsuite/23_containers/list/debug/invalidation/erase.cc: New test case.
* testsuite/23_containers/map/debug/erase_if.cc: New test case.
* testsuite/23_containers/map/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/multimap/debug/erase_if.cc: New test case.
* testsuite/23_containers/multimap/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/multiset/debug/erase_if.cc: New test case.
* testsuite/23_containers/multiset/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/set/debug/erase_if.cc: New test case.
* testsuite/23_containers/set/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/unordered_map/debug/erase_if.cc: New test case.
* testsuite/23_containers/unordered_map/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/unordered_multimap/debug/erase_if.cc: New test case.
* testsuite/23_containers/unordered_multimap/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/unordered_multiset/debug/erase_if.cc: New test case.
* testsuite/23_containers/unordered_multiset/debug/invalidation/erase_if.cc: New test case.
* testsuite/23_containers/unordered_set/debug/erase_if.cc: New test case.
* testsuite/23_containers/unordered_set/debug/invalidation/erase_if.cc: New test case.

4 months agoFortran: Fix ICE on invalid code
Steven G. Kargl [Sun, 18 Jan 2026 02:30:44 +0000 (18:30 -0800)] 
Fortran: Fix ICE on invalid code

This patch tests whether a symbol imported into an interface
is already available in local scope.

PR fortran/123375

gcc/fortran/ChangeLog:

* decl.cc (gfc_match_import): Check that imported entity within
a interface is not from local scope.

gcc/testsuite/ChangeLog:

* gfortran.dg/import.f90: Run code testing for a warning that
is now an error.
* gfortran.dg/pr123375.f90: New test.

4 months agoDaily bump.
GCC Administrator [Mon, 19 Jan 2026 00:16:22 +0000 (00:16 +0000)] 
Daily bump.

4 months agoc++/reflection: adjust error message
Marek Polacek [Fri, 16 Jan 2026 20:50:38 +0000 (15:50 -0500)] 
c++/reflection: adjust error message

Now that the condition includes all captures, let's not talk about
init-capture.  Also print the decl.

gcc/cp/ChangeLog:

* reflect.cc (get_reflection): Adjust the error message for the
is_capture_proxy check.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/expr6.C: Adjust dg-error.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoc++: rename direct_base_parent to direct_base_derived
Marek Polacek [Fri, 16 Jan 2026 21:26:09 +0000 (16:26 -0500)] 
c++: rename direct_base_parent to direct_base_derived

During Reflection review Jason wanted this function renamed.

gcc/cp/ChangeLog:

* cp-tree.h (direct_base_parent): Rename to...
(direct_base_derived): ...this.
* decl2.cc (min_vis_expr_r): Call direct_base_derived instead of
direct_base_parent.
* pt.cc (iterative_hash_template_arg): Likewise.
* reflect.cc (direct_base_parent_binfo): Rename to...
(direct_base_derived_binfo): ...this.
(direct_base_parent): Rename to...
(direct_base_derived): ...this.
(eval_is_expected_access): Call direct_base_derived_binfo instead
of direct_base_parent_binfo.
(eval_source_location_of): Call direct_base_derived instead of
direct_base_parent.
(eval_parent_of): Likewise.
(eval_offset_of): Likewise.
(eval_display_string_of): Likewise.
(eval_annotations_of): Call direct_base_derived_binfo instead
of direct_base_parent_binfo.
(eval_is_accessible): Call direct_base_derived instead of
direct_base_parent.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoc++/reflection: use context_for_name_lookup
Marek Polacek [Fri, 16 Jan 2026 22:22:58 +0000 (17:22 -0500)] 
c++/reflection: use context_for_name_lookup

We can simplify the code here by using context_for_name_lookup.

gcc/cp/ChangeLog:

* reflect.cc (check_splice_expr): Use context_for_name_lookup.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoc++: don't crash determining linkage of invalid TYPE_DECL [PR122391]
Simon Martin [Sun, 18 Jan 2026 10:07:10 +0000 (11:07 +0100)] 
c++: don't crash determining linkage of invalid TYPE_DECL [PR122391]

We currently ICE in decl_linkage for the following invalid input
because we access the TYPE_MAIN_VARIANT of error_mark_node

===
extern "C" {
  template <a> class b;
  struct {
    typedef b:
===

This patch fixes this by returning no linkage for any TYPE_DECL with an
erroneous type.

PR c++/122391

gcc/cp/ChangeLog:

* tree.cc (decl_linkage): Return lk_none for TYPE_DECLs with
erroneous type.

gcc/testsuite/ChangeLog:

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

4 months agophiopt: Rewrite cond_removal_in_builtin_zero_pattern canonicalization args code ...
Andrew Pinski [Sat, 17 Jan 2026 20:55:04 +0000 (12:55 -0800)] 
phiopt: Rewrite cond_removal_in_builtin_zero_pattern canonicalization args code [PR123645]

The canonicalization of args code was originally thinking edges e1/e2
were edges out going from the cond block but they were the edges
coming into the join block. This rewrites the canonicalization of arg0/1
args to correct that mistake. And it fixes the wrong code that would
happen in this case.

PR tree-optimization/123645

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_removal_in_builtin_zero_pattern): Rewrite
the canonicalization of the args code based on e1/e2 being edges into
the join block.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr123645-1.c: New test.
* gcc.dg/torture/pr123645-2.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 months agoDaily bump.
GCC Administrator [Sun, 18 Jan 2026 00:16:31 +0000 (00:16 +0000)] 
Daily bump.

4 months agoa68: do not use `^' for the pow operator
Jose E. Marchesi [Sat, 17 Jan 2026 22:50:31 +0000 (23:50 +0100)] 
a68: do not use `^' for the pow operator

The RR mentions all of "**", "^" and "UP" as the representation of the
several pow operators for integral, real and complex operations.  This
patch removes "^" from the list (and a remnant of "UP") and thus frees
that worthy character to be used for some other purpose in the future.

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

* a68-parser-prelude.cc (stand_prelude): Remove definitions for ^
operator.
* ga68.texi (Real operators): Remove entries for ^.
(Integral operators): Likewise.

gcc/testsuite/ChangeLog

* algol68/execute/pow-real-1.a68: Adapt test to use ** rather than
^ for pow operator.

4 months agoa68: new Coding Guidelines manual for Algol 68
Jose E. Marchesi [Sat, 17 Jan 2026 22:03:34 +0000 (23:03 +0100)] 
a68: new Coding Guidelines manual for Algol 68

This commit adds a new manual containing a few coding guidelines and
recommendations for writing Algol 68 code.  The primary goal of the
document is to be used in the context of GCC development to achieve a
coherent style among the code base.  However, other people may want to
adopt these coding conventions as well, so we are distributing them in
their own manual rather than as part of the ga68 internals manual.

Thanks to Chris Hermansen, Mohammad-Reza Nabipoor, Pietro Monteiro and
'jpl' James for their help and nice discussions in the algol68@
mailing list.

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

* ga68-coding-guidelines.texi: New file.
* Make-lang.in (A68_CODING_GUIDE_MANUAL_FILES): Define.
(A68_TEXI_FILES): Add A68_CODING_GUIDE_MANUAL_FILES.
(doc/ga68-coding-guidelines.info): New rule.
(doc/ga68-coding-guidelines.dvi): Likewise.
(doc/ga68-coding-guidelines.pdf): Likewise.
($(build_htmldir)/ga68-coding-guidelines/index.html): Likewise.
(algol68.info): Add ga68-coding-guidelines.info.
(algol68.srcinfo): Likewise.
(algol68.install-info): Likewise.
(algol68.install-html): Likewise.
(algol68.dvi): Add ga68-coding-guielines.dvi.
(algol68.pdf): Add ga68-coding-guidelines.pdf.

4 months agoAda: Fix packed boolean array with Default_Component_Value aspect
Eric Botcazou [Sat, 17 Jan 2026 21:27:53 +0000 (22:27 +0100)] 
Ada: Fix packed boolean array with Default_Component_Value aspect

Putting the Default_Component_Value aspect on a bit-packed array type has
never worked, so this plugs the loophole.  For the sake of consistency,
the recent fix for PR ada/68179 is adjusted to use Has_Default_Aspect too.

gcc/ada/
PR ada/68179
PR ada/123589
* exp_ch3.adb (Expand_Freeze_Array_Type): Build an initialization
procedure for a bit-packed array type if Has_Default_Aspect is set
on the base type, but make sure not to build it twice.  Also test
Has_Default_Aspect for a type derived from String.

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

Co-authored-by: Lisa Felidae <lisa@felidae.bam.moe>
4 months agodoc: make regenerate-opt-urls
Sandra Loosemore [Sat, 17 Jan 2026 20:45:45 +0000 (20:45 +0000)] 
doc: make regenerate-opt-urls

Mechanical update to reflect recent batch of commits to clean up options
documentation.

gcc/ChangeLog
* config/darwin.opt.urls: Regenerated.
* config/dragonfly.opt.urls: Regenerated.
* config/freebsd.opt.urls: Regenerated.
* config/gnu-user.opt.urls: Regenerated.
* config/hpux11.opt.urls: Regenerated.
* config/i386/cygwin.opt.urls: Regenerated.
* config/i386/i386.opt.urls: Regenerated.
* config/mingw/mingw.opt.urls: Regenerated.
* config/nds32/nds32.opt.urls: Regenerated.
* config/netbsd.opt.urls: Regenerated.
* config/nvptx/nvptx.opt.urls: Regenerated.
* config/openbsd.opt.urls: Regenerated.
* config/pru/pru.opt.urls: Regenerated.
* config/riscv/riscv.opt.urls: Regenerated.
* config/rl78/rl78.opt.urls: Regenerated.
* config/rs6000/aix64.opt.urls: Regenerated.
* config/rs6000/rs6000.opt.urls: Regenerated.
* config/rs6000/sysv4.opt.urls: Regenerated.
* config/rtems.opt.urls: Regenerated.
* config/rx/rx.opt.urls: Regenerated.
* config/s390/s390.opt.urls: Regenerated.
* config/s390/tpf.opt.urls: Regenerated.
* config/sh/sh.opt.urls: Regenerated.
* config/sol2.opt.urls: Regenerated.
* config/sparc/sparc.opt.urls: Regenerated.
* config/v850/v850.opt.urls: Regenerated.
* config/vax/vax.opt.urls: Regenerated.
* config/vxworks.opt.urls: Regenerated.

4 months agodoc, nds32: Add missing documentation for nds32 options [PR122243]
Sandra Loosemore [Sat, 10 Jan 2026 20:27:36 +0000 (20:27 +0000)] 
doc, nds32: Add missing documentation for nds32 options [PR122243]

This back end had numerous options defined that were not documented in
the manual.  Descriptions were taken from the .opt file.  I also did some
editorial cleanups in the .opt file text where appropriate.

gcc/ChangeLog
PR other/122243
* config/nds32/nds32.opt: Tidy documentation strings.
(mbig-endian, mlittle-endian): Remove "Undocumented" flag since
these are, in fact, documented.
* doc/invoke.texi (Option Summary) <NDS32 Options>: Document
-EB, -EL, -mabi, -mfloat-abi, -malways-align, -malign-functions,
-mfp-as-gp, -mext-dsp, -mext-fpu-fma, -mext-fpu-sp, -mext-fpu-dp,
-misr-vector-size, -misr-secure, -mcpu, -mconfig-fpu,
-mconfig-mul, -mconfig-register-ports, -mrelax-hint,
-msched-prolog-epilog, -mno-ret-in-naked-func, -malways-save-lp,
-munaligned-access, and -minline-asm-r15.
(NDS32 Options): Likewise.

4 months agodoc, xtensa: Clean up Xtensa options documentation [PR122243]
Sandra Loosemore [Thu, 8 Jan 2026 17:24:56 +0000 (17:24 +0000)] 
doc, xtensa: Clean up Xtensa options documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/xtensa/uclinux.opt (elf2flt, elf2flt=): Mark as Undocumented.
* config/xtensa/xtensa.opt (mlra): Likewise.
* doc/invoke.texi (Option Summary) <Xtensa Options>: Remove
redundant negative forms plus obsolete -mfused-madd option.
(Xtensa Options): Likewise undocument -mfused-madd.  List
negative form of -mforce-no-pic.

4 months agodoc, x86: Clean up x86 options documentation [PR122243]
Sandra Loosemore [Tue, 6 Jan 2026 23:49:27 +0000 (23:49 +0000)] 
doc, x86: Clean up x86 options documentation [PR122243]

Besides the usual fixes in this series to make the options summary
agree with the options listed in the detailed documentation and add
missing @opindex entries, I decided it was not very helpful to users
to have dozens of ISA extension options documented as a group spanning
multiple pages in the manual.  I broke that up so each of those
options is described separately, using the documentation string from
the .opt file.

gcc/ChangeLog
PR other/122243
* config/i386/i386.opt (malign-functions): Mark undocumented/unused
option as Undocumented.
(malign-jumps): Likewise.
(malign-loops): Likewise.
(mbranch-cost, mforce-drap): Mark undocumented options likely
intended for developer use only as Undocumented.
(mstv): Correct sense of option in doc string.
(mavx512cd): Remove extra "and" from doc string.
(mavx512dq): Likewise.
(mavx512bw): Likewise.
(mavx512vl): Likewise.
(mavx512ifma): Likewise.
(mavx512bvmi): Likewise.
* doc/invoke.texi (Options Summary) <x86 Options>: Add
missing options.  Correct whitespace and re-wrap long lines.
Remove -mthreads which is now classed as a MinGW option.
(Cygwin and MinGW Options): Replace existing documentation of
-mthreads with the more detailed text moved from x86 Options.
(x86 Options): Move introductory text about ISA extensions before
the individual options instead of after.  Document them all
individually instead of as a group, and move immediately after
-march/-mtune documentation.  Rewrap long lines.  Document
interaction between SSE and AVX with -mfpmath=sse.  Move -masm
documentation farther down instead of grouped with options
affecting floating-point behavior.  Add missing @opindex
entries.  Rewrite the -mdaz-ftz documentation.  Document
-mstack-arg-probe.  Copy-editing.  Document -mstv.  Remove
obsolete warning about -mskip-rax-setup in very old GCC versions.
Rewrite the -mapx-inline-asm-use-gpr32 documentation.
Document -mgather and -mscatter.  Split -miamcu documentation
from -m32/-m64/etc.  Rewrite -munroll-only-small-loops documentation.
Document -mdispatch-scheduler.

4 months agodoc, VxWorks: Clean up VxWorks option documentation [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 23:46:12 +0000 (23:46 +0000)] 
doc, VxWorks: Clean up VxWorks option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <VxWorks Options>: Add -mvthreads.
(VxWorks Options): Likewise.

4 months agodoc, vms: Clean up VMS options [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 22:26:08 +0000 (22:26 +0000)] 
doc, vms: Clean up VMS options [PR122243]

gcc/ChangeLog
PR other/122243
* config/vms/vms.opt (map): Mark as Undocumented.

4 months agodoc, visium: Clean up Visium options documentation [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 21:39:07 +0000 (21:39 +0000)] 
doc, visium: Clean up Visium options documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/visium/visium.opt (menable-trampolines): Mark Undocumented.
* doc/invoke.texi (Options Summary) <Visium Options>: Remove
redundant -mno- option.
(Visium Options): Copy-editing to put in active voice and add markup.

4 months agodoc, vax: Clean up VAX option documentation [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 21:12:26 +0000 (21:12 +0000)] 
doc, vax: Clean up VAX option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/vax/elf.opt (mno-asm-pic): Mark as Undocumented.
* doc/invoke.texi (Option Summary) <VAX Options>: Add
-mvaxc-alignment and -mqmath.
(VAX Options): Likewise.

4 months agodoc, v850: Clean up V850 options and documentation [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 15:48:00 +0000 (15:48 +0000)] 
doc, v850: Clean up V850 options and documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/v850/v850.opt: Copy-edit documentation strings.
(mdebug): Make Undocumented.
(mno-strict-align): Add RejectNegative.
(mUS-bit-set): Make Undocumented.
* doc/invoke.texi (Option Summary) <V850 Options>: Remove
redundant -mno- forms from list.  Add missing entries.
(V850 Options): Add @opindex for negative forms.  Combine
entries for -mapp-regs and -mno-app-regs.  Document -msmall-sld,
-mno-strict-align, and -mjump-tables-in-data-section.

4 months agodoc, sparc: Clean up SPARC option documentation [PR122243]
Sandra Loosemore [Mon, 5 Jan 2026 01:09:22 +0000 (01:09 +0000)] 
doc, sparc: Clean up SPARC option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <SPARC Options>: Remove
redundant -mno- forms from the list.  Add -mptr32 and -mptr64.
(SPARC Options): Document -mptr32 and -mptr64.

4 months agodoc, Solaris: Clean up documentation of Solaris 2 options [PR122243]
Sandra Loosemore [Sun, 4 Jan 2026 23:03:46 +0000 (23:03 +0000)] 
doc, Solaris: Clean up documentation of Solaris 2 options [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <Solaris 2 Options>:
Remove redundant negative option forms from list.  List both
-pthread and -pthreads.
(Solaris 2 Options): Index and list the negative forms here.
Combine the two @table environments.  Document both -pthread
and -pthreads.

4 months agodoc, sh: Clean up SH options documentation [PR122243]
Sandra Loosemore [Sun, 4 Jan 2026 20:48:26 +0000 (20:48 +0000)] 
doc, sh: Clean up SH options documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/sh/sh.opt (mhitachi, mpadstruct): Mark obsolete options
as Undocumented.
* doc/invoke.texi (Option Summary) <SH Options>: Add missing
entries for -m4-* and other options.  Remove redundant -mno- entries
and obsolete options.  Add missing options -mfdpic, -mlra.
(SH Options): Combine entries for -mrenesas and -mno-renesas.
Index and list -mno- forms for other options that have them.
Remove documentation for obsolete options -mpadstruct and
-mfused-madd.  Add documentation for -mlra.  Copy-edit and wrap long
lines throughout the section.

4 months agodoc, s390: Clean up S/390 and z series options [PR122243]
Sandra Loosemore [Fri, 2 Jan 2026 17:38:52 +0000 (17:38 +0000)] 
doc, s390: Clean up S/390 and z series options [PR122243]

There were numerous S/390 options missing entries in the manual.
Fortunately the documentation strings in the .opt file and previous
commit messages and patch mails explained these well enough that I
was able to fill in the missing material without too much trouble.
I marked a few that seemed to be for internal use or intentially not
exposed to the user as "Undocumented".

gcc/ChangeLog
PR other/122243
* config/s390/s390.opt (mbranch-cost): Mark as Undocumented.
* config/s390/tpf.opt (mtpf-trace-hook-prologue-check=): Likewise.
(mtpf-trace-hook-prologue-target=): Likewise.
(mtpf-trace-hook-epilogue-check=): Likewise.
(mtpf-trace-hook-epilogue-target=): Likewise.
* doc/invoke.texi (Option Summary) <S/390 and zSeries Options>:
Remove redundant -mno- entries and add missing options.  Make
entries with arguments match the syntax in the main documentation.
(S/390 and zSeries Options): Light copy-editing.  Wrap overly-long
lines.  Add missing @opindex entries.  Add documention for
-mmain, -mno-pic-data-is-text-relative, -mindirect-branch,
-mindirect-branch-jump, -mindirect-branch-call,
-mfunction-return, -mfunction-return-mem, -mfunction-return-reg,
-mindirect-branch-table, -mfentry, -mrecord-mcount, -mnop-mcount,
-mpreserve-args, and -munaligned-symbols.

4 months agodoc, rx: Clean up RX options documentation [PR122243]
Sandra Loosemore [Thu, 1 Jan 2026 18:29:54 +0000 (18:29 +0000)] 
doc, rx: Clean up RX options documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/rx/rx.opt (mgcc-abi, mrx-abi): Mark as Undocumented.
* doc/invoke.texi (Option Summary) <RX Options>: Remove redundant
entries for -mno-forms, correct name of -msmall-data-limit option,
add -mlra, clean up formatting.
(RX Options): Minor copy-editing, add -mlra.

4 months agodoc, rs6000: Clean up RS/6000 options documentation [PR122243]
Sandra Loosemore [Wed, 31 Dec 2025 16:28:38 +0000 (16:28 +0000)] 
doc, rs6000: Clean up RS/6000 options documentation [PR122243]

Similar to other patches in this series, the focus is on ensuring all
options are either documented or marked "Undocumented", listed in both
the options summary and detailed documentation, and both positive and
negative forms have entries in the table of contents.

gcc/ChangeLog
PR other/122243
* config/rs6000/darwin.opt (Waltivec-long-deprecated): Mark as
Undocumented.
(faltivec, ffix-and-continue, findirect-data): Likewise.
* config/rs6000/rs6000.opt (mvrsave): Likewise.
* config/rs6000/sysv4.opt (mno-toc, mtoc, mno-traceback): Likewise.
(mshlib, mnewlib): Likewise.
* doc/invoke.texi (Option Summary) <RS/6000 and PowerPC Options>:
Document only one form of each option.  Add missing options.
Correct whitespace.
(RS/6000 and PowerPC Options): Separately document -mpowerpc-gpopt,
-mpowerpc-gfxopt, -mpowerpc64, -mmfcrf, -mpopcntb, -mpopcntd,
-mfprnd, -mcmpb, and -mhard-dfp and move their documentation after
-mcpu=.  Remove documentation for -mtoc which is unimplemented.
Add missing @opindex entries.  Minor copy-editing and whitespace
fixes.

4 months agodoc, rl78: Clean up RL78 option documentation [PR122243] [PR71340]
Sandra Loosemore [Sat, 27 Dec 2025 21:03:55 +0000 (21:03 +0000)] 
doc, rl78: Clean up RL78 option documentation [PR122243] [PR71340]

This target is probably dead (no listed maintainer and no support for
LRA).  There seems to be no interest in reviving the 2014 patch for
the documented but never-committed -m64bit-doubles and -m32bit-doubles
options, so I've removed those docs instead, along with some other
routine housekeeping to keep the docs in sync with the options file.

gcc/ChangeLog
PR other/122243
PR target/71340
* doc/invoke.texi (Option Summary) <RL78 Options>: Remove
never-implemented -m64bit-doubles and -m32bit-doubles options.
Add missing entries for -mrelax, -mes0, -mmul=rl78, -mcpu=rl78,
and -mrl78.
(RL78 Options): Likewise.  Add missing @opindex entries.
Light copy-editing.

4 months agoa68: add explicative comment to are_packs_equivalent
Jose E. Marchesi [Sat, 17 Jan 2026 20:56:20 +0000 (21:56 +0100)] 
a68: add explicative comment to are_packs_equivalent

While fixing PR algol68/123653 I noticed that there was a struct mode
interned in the compiler with the form `struct (ref int)'.  This is
odd because fields are supposed to have names in struct modes.

Turns out that the culprit is:

    (void) a68_add_mode_to_pack (&z, M_REF_INT, NO_TEXT, NO_NODE);

    EQUIVALENT (M_SEMA) = a68_add_mode (&TOP_MOID (&A68_JOB),
                                        STRUCT_SYMBOL,
                                        a68_count_pack_members (z),
                                        NO_NODE, NO_MOID, z);

i.e. it is the standard mode `sema'.  The report says that it is a
struct that hold a reference to int within, but you are not allowed to
access it.

This patch adds a comment to are_packs_equivalent explaining why the
name of a pack may be NULL.

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

* a68-parser-moids-equivalence.cc (are_packs_equivalent): Add
explicative comment.

4 months agoa68: fix logic for name comparison in are_packs_equivalent [PR algol68/123653]
Jose E. Marchesi [Sat, 17 Jan 2026 20:12:24 +0000 (21:12 +0100)] 
a68: fix logic for name comparison in are_packs_equivalent [PR algol68/123653]

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

PR algol68/123653
* a68-parser-moids-equivalence.cc (are_packs_equivalent): Fix
logic in name comparison.

4 months agoRegenerate cobol lang.opt.urls
Jakub Jelinek [Sat, 17 Jan 2026 18:27:54 +0000 (19:27 +0100)] 
Regenerate cobol lang.opt.urls

r16-6851 added -fexec-charset= option to cobol/lang.opt but hasn't
regenerated lang.opt.urls.  While the other options don't match
anything, -fexec-charset= is C/C++ option.

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

* lang.opt.urls: Regenerate.

4 months agoa68: do not define Number and whole as built-ins
Jose E. Marchesi [Sat, 17 Jan 2026 17:28:34 +0000 (18:28 +0100)] 
a68: do not define Number and whole as built-ins

Now that we have the support of adding Algol 68 code to the run-time
library libga68, we are writing most of the Transput in Algol 68.  In
particular, both the Number mode and the standard procedure `whole',
among others, are already implemented in transput.a68.in.

This patch removed remnant code that used to define these as compiler
built-ins.

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

* a68-parser-prelude.cc (stand_transput): Do not define
`Number' and `whole' as built-ins.

4 months agoFortran: Add new test case
Jerry DeLisle [Sat, 17 Jan 2026 18:02:26 +0000 (10:02 -0800)] 
Fortran: Add new test case

PR fortran/94377

gcc/testsuite/ChangeLog:

* gfortran.dg/pr94377.f90: New test, failed on gcc-15

4 months agoFortran: Documentation update on -fdefault-real-8 and family
Jerry DeLisle [Sat, 17 Jan 2026 17:23:53 +0000 (09:23 -0800)] 
Fortran: Documentation update on -fdefault-real-8 and family

PR fortran/122957

gcc/fortran/ChangeLog:

* invoke.texi: Add note that these features are incompatible
with user defined derived type I/O. (DTIO)

4 months agoFortran: Fix accepts invalid implicit none (external)
Steven G. Kargl [Sat, 17 Jan 2026 02:09:56 +0000 (18:09 -0800)] 
Fortran: Fix accepts invalid implicit none (external)

This patch yields an error for the test case which was
previously being accepted even though implicit none (external)
was being specified.

PR fortran/109512

gcc/fortran/ChangeLog:

* resolve.cc (resolve_function): Check if an external
attribute is required on a call to an external procedure.
(resolve_call): Likewise.

gcc/testsuite/ChangeLog:

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

4 months agotree: Handle ::operator {new,delete} function templates as uncertain matches [PR123513]
Jakub Jelinek [Sat, 17 Jan 2026 13:37:30 +0000 (14:37 +0100)] 
tree: Handle ::operator {new,delete} function templates as uncertain matches [PR123513]

We have for some reason two different ways to check for matching
::operator new vs. ::operator delete kind.  One is a dumb one in
tree.cc (valid_new_delete_pair_p) and another one is in
gimple-ssa-warn-access.cc (new_delete_mismatch_p).
The former is used both in the latter and in optimizations,
the latter only for warnings.
The former just handles the easy cases, global operator new and
the latter can handle everything as it uses the demangler.
The former has essentially a tri-state return even when it has just bool
return type, it has another bool * optional argument, so can return
true for this is definitely ok, false with false with this might be
not matching and false with true for this definitely doesn't match.
false with false is returned e.g. for the class scope operator new/delete,
where we definitely need the demangler to figure stuff out.
false with true is returned for mismatches which are guaranteed, e.g.
when one mangled name starts with _Znw and the other with _Zda,
one is ::operator new and the other is ::operator delete[].
valid_new_delete_pair_p expects that after the _Znw/_Zna/_Zdl/_Zda
prefix (or two _ at the start instead of one) it sees [jmy] for
the size_t argument resp. Pv for void* for delete, for delete
then optionally the same [jmy] for sized deallocation and
optionally RKSt9nothrow_t after it for nothrow versions or
also something with St11align_val_t.  If it has some extra arguments
after it, it also returns false/false.

The following testcase shows another case where I'm afraid we need
to return the maybe mismatch - when the global operators are function
templates.
_ZnwILm1024EEPvmR13BumpAllocatorIXT_EE
_ZdlILm1024EEvPvR13BumpAllocatorIXT_EE
where the Ilm1024EE here mean <1024ul> and Pv after it means function
return type void *.  As valid_new_delete_pair_p needs to find the m
after it, it would need to know everything about what can appear
in between I and E for the template arguments (which is a lot) and
also be able to skip over mangling of arbitrary function return types
(though perhaps it could hardcode those Pv vs. v cases for those).

So, the following patch just returns false/false instead of false/true
if known _Z{nw,na,dl,da} is followed by I, i.e. if it is a function
template.  For optimizations it makes no difference, those care just
about the return value and not on *pcertain, and for the warning it
means it will use the demangler which will figure stuff hopefully right.

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

PR tree-optimization/123513
* tree.cc (valid_new_delete_pair_p): If new_name[3] or delete_name[3]
is 'I', return false with *pcertain set to false rather than true.

* g++.dg/warn/Wmismatched-new-delete-10.C: New test.

4 months agoc++/modules: Fix local type handling when not streaming function definitions [PR123627]
Nathaniel Shead [Fri, 16 Jan 2026 23:41:58 +0000 (10:41 +1100)] 
c++/modules: Fix local type handling when not streaming function definitions [PR123627]

r14-9948-g716af95fd45487 added support for merging local types of
functions.  This however causes the linked PR to crash, because when
restreaming the local type from a partition for the primary module
interface's CMI, we no longer have the DECL_INITIAL for a function.

This patch fixes the issue by reusing the MK_keyed merge kind, as used
for lambda types.  This is required so that if a module partition
imports both the primary module interface and a different module
partition that both provide the same local type it can properly dedup
the declarations.

We only need to do this if !has_definition; in cases where a definition
is available we keep using the MK_local_type behaviour as that avoids
the need to maintain a separately allocated chain of keyed decls.

An additional change is to further the modifications made in r16-4671
and always attempt to key to the top-most decl, including going through
possibly many nested class and function definitions.  This avoids any
similar issues to that bug where we read a keyed decl before we see the
decl it's keyed to now that we support keying to functions as well.

PR c++/123627

gcc/cp/ChangeLog:

* class.cc (finish_struct): Maybe key function-local types.
* module.cc (trees_out::get_merge_kind): Choose whether to use
MK_local_type or MK_keyed for a local type based on if the
immediate context's definition will be streamed.
(trees_in::key_mergeable): Allow key decls on FUNCTION_DECL.
(adjust_key_scope): New function.
(maybe_key_decl): Handle key decls on FUNCTION_DECL; check that
we only key a given decl to a context at most once.
(get_keyed_decl_scope): Support non-lambda decls.

gcc/testsuite/ChangeLog:

* g++.dg/modules/block-decl-4_a.C: New test.
* g++.dg/modules/block-decl-4_b.C: New test.
* g++.dg/modules/block-decl-4_c.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoa68: handle TImode in a68_type_for_{mode,size}
Mohammad-Reza Nabipoor [Sat, 17 Jan 2026 02:36:47 +0000 (03:36 +0100)] 
a68: handle TImode in a68_type_for_{mode,size}

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

PR algol68/123007
* a68-lang.cc (a68_type_for_mode): Handle TImode.
(a68_type_for_size): Handle unsigned_intTI_type_node.

4 months agocobol: Support National characters and Unicode runtime encoding.
Robert Dubner [Fri, 16 Jan 2026 20:42:50 +0000 (15:42 -0500)] 
cobol: Support National characters and Unicode runtime encoding.

The last few months have seen an evolution in the COBOL compiler.  Up
until now it could use either CP1252/ASCII or CP1140/EBCDIC to represent
alphanumeric variables and numeric types that are stored as character
strings.  With these changes, those types can be represented in many
other single-byte encodings, as well as UTF16 and UTF32 encodings.

These changes required extensive changes.

1) The initial parsing has to handle the extended capabilities.

2) Each run-time variable designates its character set.

3) The run-time code has to be able to handle wide characters.

Since the development took place over a period of time, other changes
crept in. In particular, there is an expansion of bindings making
certain POSIX functions available to the COBOL programmer.

There has also been an expansion of gcobol's use of the GCC diagnostic
framework.

Co-Authored-By: Robert Dubner <rdubner@symas.com>
Co-Authored-By: James K. Lowden <jklowden@cobolworx.com>
gcc/cobol/ChangeLog:

* cbldiag.h (struct cbl_loc_t): Diagnostics.
(enum cbl_diag_id_t): Diagnostics.
* cdf.y: Includes.
* cobol1.cc (cobol_warning_suppress): Diagnostics.
(cobol_langhook_handle_option): Implement -fexec-charset.  Expand
the use of diagnostics.
* gcobc: Expand options and warnings.
* gcobol.1: Documentation.
* genapi.cc (level_88_helper): Charsets.
(get_level_88_domain): Charsets.
(get_class_condition_string): Charsets.
(function_pointer_from_name): Charsets.
(initialize_variable_internal):  Charsets.
(parser_initialize): Charsets.
(get_binary_value_from_float): Charsets.
(get_bytes_needed): Charsets.
(cobol_compare): Charsets.
(move_tree): Eliminate function.
(move_tree_to_field): Eliminate function.
(get_string_from): Eliminate function.
(parser_init_list): Charsets.
(psa_FldLiteralN): Charsets.
(parser_accept_date_yymmdd): Charsets.
(parser_accept_date_yyyymmdd): Charsets.
(parser_accept_date_yyddd): Charsets.
(parser_accept_date_yyyyddd): Charsets.
(parser_accept_date_dow): Charsets.
(parser_accept_date_hhmmssff): Charsets.
(parser_alphabet): Charsets.
(parser_alphabet_use): Charsets.
(parser_display_internal): Charsets.
(get_literalN_value): Charsets.
(tree_type_from_field_type): Charsets.
(program_end_stuff): Charsets.
(walk_initialization): Charsets.
(parser_xml_parse): Charsets.
(initialize_the_data): Charsets.
(establish_using): Charsets.
(parser_setop): Charsets.
(parser_set_conditional88): Charsets.
(parser_file_add): Charsets.
(get_the_filename): Eliminate function.
(parser_file_open): Charsets.
(parser_file_delete_file): Charsets.
(parser_file_start): Charsets.
(parser_module_name): Charsets.
(parser_intrinsic_find_string): New function.
(parser_intrinsic_numval_c): Charsets.
(parser_intrinsic_convert): New function.
(parser_intrinsic_call_1): Charsets.
(create_and_call): Charsets.
(mh_identical): Charsets.
(mh_source_is_literalN): Charsets.
(float_type_of): Charsets.
(mh_dest_is_float): Charsets.
(mh_numeric_display): Charsets.
(mh_little_endian): Charsets.
(mh_source_is_group): Charsets.
(mh_source_is_literalA): Charsets.
(move_helper): Charsets.
(binary_initial): Eliminate function.
(digits_from_int128): Eliminate function.
(digits_from_float128): Eliminate function.
(initial_from_initial):  Eliminate function.
(convert_data_initial): New function.
(actually_create_the_static_field): Charsets.
(psa_new_var_decl): Charsets.
(psa_FldLiteralA): Charsets.
(parser_local_add): Charsets.
(parser_symbol_add): Charsets.
* genapi.h (parser_intrinsic_convert): New function.
(parser_intrinsic_find_string): New function.
* genmath.cc (arithmetic_operation): Charsets.
(largest_binary_term): Charsets.
(fast_add): Charsets.
(fast_subtract): Charsets.
(fast_multiply): Charsets.
(fast_divide): Charsets.
(parser_subtract): Fix subtract float from float.
* genutil.cc (get_any_capacity): Charsets.
(get_and_check_refstart_and_reflen): Charsets.
(get_data_offset): Charsets.
(get_binary_value): Charsets.
(tree_type_from_field): Charsets.
(copy_little_endian_into_place): Charsets.
(get_literal_string): Charsets.
(refer_is_clean): Charsets.
(refer_fill_depends): Charsets.
(refer_size_source): Comment.
* lang-specs.h: Charsets.
* lang.opt: Charsets.
* lexio.cc (parse_copy_directive): Diagnostics.
* messages.cc (cbl_diagnostic_kind): Diagnostics.
(cobol_warning_suppress): Diagnostics.
* parse.y: Many changes for charsets and diagnostics.
* parse_ante.h (MAXLENGTH_FORMATTED_DATE): Charsets.
(MAXLENGTH_FORMATTED_TIME): Charsets.
(MAXLENGTH_CALENDAR_DATE): Charsets.
(MAXLENGTH_FORMATTED_DATETIME): Charsets.
(consistent_encoding_check): Charsets.
(enum data_clause_t): Charsets.
(new_alphanumeric): Charsets.
(name_of): Charsets.
(class eval_subject_t): Charsets.
(struct domain_t): Charsets.
(struct file_list_t): Charsets.
(current_encoding): Charsets.
(new_tempnumeric): Charsets.
(is_integer_literal): Charsets.
(new_literal): Charsets.
(new_constant): Charsets.
(conditional_set): Charsets.
(field_find): Charsets.
(valid_redefine): Charsets.
(field_value_all): Charsets.
(parent_has_picture): Charsets.
(parent_has_value): Charsets.
(blank_pad_initial): Charsets.
(blankit): Charsets.
(cbl_field_t::blank_initial): Charsets.
(value_encoding_check): Charsets.
(cbl_field_t::set_initial): Charsets.
(field_alloc): Charsets.
(parser_move_carefully): Charsets.
(data_division_ready): Charsets.
(anybody_redefines): Charsets.
(procedure_division_ready): Charsets.
(file_section_parent_set): Charsets.
(field_binary_usage): Charsets.
(goodnight_gracie): Formatting.
* scan.l: Charsets.
* scan_ante.h (numstr_of): Charsets.
(typed_name): Charsets.
* show_parse.h: Charsets.
* structs.cc (create_cblc_file_t): Charsets.
* symbols.cc (symbol_table_extend): Charsets.
(WARNING_FIELD): Diagnostics.
(constq): Charsets.
(elementize): Charsets.
(field_size): Charsets.
(cbl_field_t::set_attr): Eliminate run-time component.
(cbl_field_t::clear_attr): Eliminate run-time component.
(field_memsize): Charsets.
(cbl_encoding_str): Charsets.
(symbols_dump): Charsets.
(is_variable_length): Formatting.
(field_str): Charsets.
(extend_66_capacity): Charsets.
(operator<<): Charsets.
(symbols_update): Charsets.
(symbol_field_parent_set): Charsets.
(symbol_table_init): Charsets.
(numeric_group_attrs): Charsets.
(symbol_field_add): Charsets.
(symbol_field_alias): Charsets.
(fd_record_size_cmp): Charsets.
(symbol_file_record_sizes): Charsets.
(cbl_alphabet_t::reencode): Charsets.
(symbol_temporary_location): Charsets.
(new_literal_2): Charsets.
(new_alphanumeric): Charsets.
(standard_internal): Charsets.
(cbl_field_t::codeset_t::stride): Charsets.
(cobol_alpha_encoding): Charsets.
(cobol_national_encoding): Charsets.
(new_temporary): Charsets.
(new_literal_float): Charsets.
(cbl_field_t::is_ascii): Charsets.
(cbl_field_t::internalize): Eliminate function.
(cbl_field_t::source_code_check): Charsets.
(iconv_cd): Charsets.
(cbl_field_t::encode): New function for charsets.
(cbl_field_t::set_capacity): Charsets.
(cbl_field_t::add_capacity): Charsets.
(cbl_field_t::char_capacity): Charsets.
(symbol_label_section_exists): Charsets.
(size): Charsets.
(validate_numeric_edited): Charsets.
* symbols.h (cobol_alpha_encoding): Charsets.
(cobol_national_encoding): Charsets.
(consistent_encoding_check): Charsets.
(class cbl_domain_elem_t): Charsets.
(struct cbl_domain_t): Charsets.
(struct cbl_field_data_t): Charsets.
(class cbl_field_data_t): Charsets.
(struct cbl_subtable_t): Charsets.
(struct cbl_field_t): Charsets.
(new_literal_float): Charsets.
(new_temporary): Charsets.
(new_literal_2): Charsets.
(symbol_temporary_location): Charsets.
(class temporaries_t): Charsets.
(struct symbol_elem_t): Charsets.
(symbol_elem_of): Charsets.
(symbol_unique_index): Charsets.
(cbl_field_type_name): Charsets.
(validate_numeric_edited): Charsets.
* token_names.h: Charsets.
* util.cc (cdf_literalize): Charsets.
(cbl_field_type_name): Charsets.
(determine_intermediate_type): Charsets.
(is_alpha_edited): Charsets.
(cbl_field_data_t::is_alpha_edited): Charsets.
(symbol_field_type_update): Charsets.
(redefine_field): Charsets.
(FIXED_WIDE_INT): Charsets.
(dirty_to_binary): Charsets.
(digits_from_int128): Charsets.
(binary_initial): Charsets.
(cbl_field_t::encode_numeric): Charsets.
(FOR_JIM): Temporary conditional demonstration code.
(parse_error_inc): Diagnostics.
(parse_error_count): Diagnostics.
(cbl_field_t::report_invalid_initial_value): Diagnostics.
(valid_move): Diagnostics.
(type_capacity): Charsets.
(symbol_unique_index): New function.
(cbl_unimplementedw): Formatting.

libgcobol/ChangeLog:

* charmaps.cc (__gg__encoding_iconv_name): Charsets.
(__gg__encoding_iconv_valid): Charsets.
(__gg__encoding_iconv_type): Charsets.
(encoding_descr): Charsets.
(__gg__encoding_iconv_descr): Charsets.
(__gg__iconverter): Charsets.
(__gg__miconverter): Charsets.
* charmaps.h (NOT_A_CHARACTER): Charsets.
(ascii_nul): Charsets.
(ascii_bang): Charsets.
(__gg__encoding_iconv_type): Charsets.
(__gg__iconverter): Charsets.
(__gg__miconverter): Charsets.
(DEFAULT_32_ENCODING): Charsets.
(class charmap_t): Charsets.
(__gg__get_charmap): Charsets.
* common-defs.h (enum cbl_field_attr_t):
(enum cbl_figconst_t): Formatting.
(LOW_VALUE_E): Handle enum arithmetic.
(ZERO_VALUE_E): Handle enum arithmetic.
(SPACE_VALUE_E): Handle enum arithmetic.
(QUOTE_VALUE_E): Handle enum arithmetic.
(HIGH_VALUE_E): Handle enum arithmetic.
(enum convert_type_t): Enum for new FUNCTION CONVERT.
(struct cbl_declarative_t): Formatting.
* encodings.h (struct encodings_t): Charsets.
* gcobolio.h: Charsets.
* gfileio.cc (get_filename): Rename to establish filename.
(establish_filename): Renamed from get_filename.
(relative_file_delete):  Charsets.
(__io__file_remove): Moved.
(trim_in_place): Charsets.
(relative_file_start): Charsets.
(relative_file_rewrite): Charsets.
(relative_file_write): Charsets.
(sequential_file_write): Charsets.
(line_sequential_file_read): Charsets.
(sequential_file_read): Charsets.
(relative_file_read): Charsets.
(__gg__file_reopen): Charsets.
(__io__file_open): Charsets.
(__io__file_close): Charsets.
(gcobol_fileops): Charsets.
(__gg__file_open): Charsets.
(__gg__file_remove): Charsets.
* gfileio.h (__gg__file_open): Charsets.
* gmath.cc (__gg__subtractf1_float_phase2): Comment.
(__gg__subtractf2_float_phase1): Comment.
(__gg__multiplyf1_phase2): Comment.
* intrinsic.cc (is_zulu_format): Charsets.
(string_to_dest): Charsets.
(get_all_time): Charsets.
(ftime_replace): Charsets.
(__gg__char): Charsets.
(__gg__current_date): Charsets.
(__gg__formatted_current_date): Charsets.
(__gg__formatted_date): Charsets.
(__gg__formatted_datetime): Charsets.
(__gg__formatted_time): Charsets.
(change_case): Charsets.
(__gg__upper_case): Charsets.
(numval): Charsets.
(numval_c): Charsets.
(__gg__trim): Charsets.
(__gg__reverse): Charsets.
(fill_cobol_tm): Charsets.
(__gg__seconds_from_formatted_time): Charsets.
(__gg__hex_of): Charsets.
(__gg__numval_f): Charsets.
(__gg__test_numval_f): Charsets.
(__gg__locale_date): Charsets.
(__gg__locale_time): Charsets.
(__gg__locale_time_from_seconds): Charsets.
* libgcobol.cc (NO_RDIGITS): Alias for (0).
(__gg__move): Forward reference.
(struct program_state): Charsets.
(cstrncmp): Charsets.
(__gg__init_program_state): Charsets.
(edited_to_binary): Charsets.
(var_is_refmod): Comment.
(__gg__power_of_ten): Reworked data initialization.
(__gg__scale_by_power_of_ten_1): Likewise.
(__gg__scale_by_power_of_ten_2): Likewise.
(value_is_too_big): Likewise.
(binary_to_big_endian): Likewise.
(binary_to_little_endian): Likewise.
(int128_to_int128_rounded): Likewise.
(get_binary_value_local): Likewise.
(get_init_value): Likewise.
(f128_to_i128_rounded): Likewise.
(__gg__initialization_values): Likewise.
(int128_to_field): Likewise.
(__gg__get_date_yymmdd): Charsets.
(__gg__field_from_string): Charsets.
(field_from_ascii): Charsets.
(__gg__get_date_yyyymmdd): Charsets.
(__gg__get_date_yyddd): Charsets.
(__gg__get_yyyyddd): Charsets.
(__gg__get_date_dow): Charsets.
(__gg__get_date_hhmmssff): Charsets.
(collation_position): Charsets.
(uber_compare): Charsets.
(__gg__dirty_to_binary): Charsets.
(__gg__dirty_to_float): Charsets.
(format_for_display_internal): Charsets.
(compare_88): Charsets.
(get_float128): Reworked.
(compare_field_class): Charsets.
(interconvert): Charsets.
(compare_strings): Charsets.
(__gg__compare_2): Charsets.
(compare_two_records): Charsets.
(__gg__sort_table): Charsets.
(init_var_both): Charsets.
(__gg__initialize_variable_clean): Charsets.
(alpha_to_alpha_move_from_location): Charsets.
(__gg__memdup): New function.
(alpha_to_alpha_move): Charsets.
(__gg__sort_workfile): Charsets.
(__gg__merge_files): Charsets.
(funky_find_wide): Charsets.
(funky_find_wide_backward): Charsets.
(normalize_id): Charsets.
(match_lengths): Charsets.
(the_alpha_and_omega): Charsets.
(the_alpha_and_omega_backward): Charsets.
(inspect_backward_format_1): Charsets.
(__gg__inspect_format_1): Charsets.
(inspect_backward_format_2): Charsets.
(__gg__inspect_format_2): Charsets.
(normalize_for_inspect_format_4): Charsets.
(__gg__inspect_format_4): Charsets.
(move_string): Charsets.
(brute_force_trim): Charsets.
(__gg__string): Charsets.
(display_both): Charsets.
(__gg__display_string): Charsets.
(__gg__bitwise_op): Charsets.
(is_numeric_display_numeric): Charsets.
(is_alpha_a_number): Charsets.
(classify_numeric_type): Charsets.
(classify_alphabetic_type): Charsets.
(__gg__classify): Charsets.
(__gg__convert_encoding): Charsets.
(accept_envar): Charsets.
(__gg__accept_envar): Charsets.
(__gg__get_argc): Charsets.
(__gg__get_argv): Charsets.
(__gg__get_command_line): Charsets.
(__gg__parser_set_conditional): Charsets.
(__gg__literaln_alpha_compare): Charsets.
(string_in): Charsets.
(__gg__unstring): Charsets.
(__gg__integer_from_float128): Charsets.
(__gg__adjust_dest_size): Charsets.
(__gg__just_mangle_name): Charsets.
(__gg__function_handle_from_name): Charsets.
(get_the_byte): Charsets.
(__gg__refer_from_string): Charsets.
(__gg__refer_from_psz): Charsets.
(__gg__find_string): Charsets.
(convert_for_convert): Charsets.
(__gg__convert): Charsets.
* libgcobol.h (__gg__compare_2): Charsets.
(__gg__field_from_string): Charsets.
(__gg__memdup): Charsets.
* posix/bin/Makefile: Posix bindings.
* posix/bin/scrape.awk: Posix bindings.
* posix/bin/udf-gen: Posix bindings.
* posix/udf/posix-lseek.cbl: Posix bindings.
* posix/udf/posix-unlink.cbl: Posix bindings.
* stringbin.cc (__gg__binary_to_string_encoded): Charsets.
(__gg__numeric_display_to_binary): Charsets.
* stringbin.h (__gg__binary_to_string_encoded): Charsets.
* valconv.cc (__gg__string_to_numeric_edited): Charsets.
* posix/cpy/psx-lseek.cpy: New file.
* posix/shim/lseek.cc: New file.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob:
Change diagnostics message.
* cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.cob:
Change diagnostics message.
* cobol.dg/group2/floating-point_SUBTRACT_FORMAT_2.out:
Change diagnostics message.
* cobol.dg/group2/floating-point_literals.out:
Change diagnostics message.

4 months agoDaily bump.
GCC Administrator [Sat, 17 Jan 2026 00:16:34 +0000 (00:16 +0000)] 
Daily bump.

4 months agoc++/reflection: amend comment
Marek Polacek [Fri, 16 Jan 2026 22:30:05 +0000 (17:30 -0500)] 
c++/reflection: amend comment

Clarify that the current code seems fine.

gcc/cp/ChangeLog:

* reflect.cc (eval_variable_of): Update comment.

4 months ago[AutoFDO] Walk function body to to find existing max copyids per location
Kugan Vivekanandarajah [Fri, 16 Jan 2026 20:59:57 +0000 (07:59 +1100)] 
[AutoFDO] Walk function body to to find existing max copyids per location

This patch addresses the review comment and walks the function body to
find existing max copyids per location in init_copyid_allocator.

gcc/ChangeLog:

2026-01-15  Kugan Vivekanandarajah  <kvivekananda@nvidia.com>

* hierarchical_discriminator.cc (init_copyid_allocator): Walks the function
body to find existing max copyids per location.
(record_existing_copyid): New.

gcc/testsuite/ChangeLog:

2026-01-15  Kugan Vivekanandarajah  <kvivekananda@nvidia.com>

* gcc.dg/hierarchical-discriminator-loop-version.c: Simplify.
* gcc.dg/hierarchical-discriminator-unroll.c: Likewise
* gcc.dg/hierarchical-discriminator-vect-version.c: Likewise.

Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
4 months agoaarch64: Accept hyphenated extensions in --with-arch [PR123460]
Alice Carlotti [Wed, 7 Jan 2026 18:55:46 +0000 (18:55 +0000)] 
aarch64: Accept hyphenated extensions in --with-arch [PR123460]

Add "-" to the list of valid characters in an extension name that is
used when removing the first extension from an extension string.

gcc/ChangeLog:

PR target/123460
* config.gcc: Accept hyphens in aarch64 --with-arch extensions.

4 months agogccrs: Fix empty struct constructors causing ICE during type checking
Yap Zhi Heng [Sun, 28 Dec 2025 13:03:13 +0000 (21:03 +0800)] 
gccrs: Fix empty struct constructors causing ICE during type checking

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (visit(StructExprStruct)): Update to properly
unwrap enum variants for type checking.
* typecheck/rust-tyty.cc (VariantDef::get_fields) : Remove NUM assert.
* backend/rust-compile-expr.cc: Update to properly unwrap enum variants for type
resolution checking.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
4 months agogccrs: Adds and fixes tests for outer attributes in expression
lenny.chiadmi-delage [Tue, 6 Jan 2026 14:57:47 +0000 (14:57 +0000)] 
gccrs: Adds and fixes tests for outer attributes in expression

Adds test of issue 3904 and fix test of the issue 3874 to follows rust
1.49 behavior.

Fixes GCC-Rust/gccrs#3904

gcc/testsuite/ChangeLog:

* rust/compile/issue-3874.rs: Fixes test.
* rust/compile/issue-3904.rs: New test.

Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
4 months agogccrs: handle outer attributes in expression parsing
lenny.chiadmi-delage [Tue, 6 Jan 2026 14:51:14 +0000 (14:51 +0000)] 
gccrs: handle outer attributes in expression parsing

Fix parsing of outer attributes in expressions.

Fixes Rust-GCC/gccrs#3904

gcc/rust/ChangeLog:

* parse/rust-parse-impl-expr.hxx(Parser::null_denotation): Add
HASH case to handle outer attributes in expressions.

Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
4 months agogccrs: add unused label lint
Lucas Ly Ba [Wed, 7 Jan 2026 11:46:50 +0000 (11:46 +0000)] 
gccrs: add unused label lint

gcc/rust/ChangeLog:

* checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit_loop_label):
Add warning for unused label in LoopLabel expr.
* checks/lints/unused/rust-unused-checker.h: Likewise.
* checks/lints/unused/rust-unused-collector.cc (UnusedCollector::visit):
Check in BreakExpr and ContinueExpr if a label is used.
* checks/lints/unused/rust-unused-collector.h: Likewise.
* checks/lints/unused/rust-unused-context.cc (UnusedContext::add_label):
Method helper.
(UnusedContext::is_label_used): Likewise
* checks/lints/unused/rust-unused-context.h: Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/unused-label_0.rs: New test.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
4 months agogccrs: util/attributes: error on malformed #[no_mangle] input
Jayant Chauhan [Tue, 6 Jan 2026 18:12:58 +0000 (23:42 +0530)] 
gccrs: util/attributes: error on malformed #[no_mangle] input

Emit a diagnostic when #[no_mangle] is used with arguments,
matching rustc behavior. The no_mangle attribute is a word
attribute and should not accept any input values.

Fixes Rust-GCC#4230

gcc/rust/ChangeLog:

* util/rust-attributes.cc (AttributeChecker::visit): Emit diagnostic.

gcc/testsuite/ChangeLog:

* rust/compile/no_mangle-malformed.rs: New test.

Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>
4 months agogccrs: util/attributes: error on malformed #[target_feature] input
Jayant Chauhan [Tue, 6 Jan 2026 16:25:02 +0000 (21:55 +0530)] 
gccrs: util/attributes: error on malformed #[target_feature] input

Emit a diagnostic when #[target_feature] is used without arguments,
matching rustc behavior. This prevents silent acceptance of empty
attributes and provides a helpful diagnostic that shows the expected form.

Fixes Rust-GCC#4233

gcc/rust/ChangeLog:

* util/rust-attributes.cc (AttributeChecker::visit): Emit diagnostic.

gcc/testsuite/ChangeLog:

* rust/compile/target_feature-malformed-4233.rs: New test.

Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>
4 months agogccrs: add redudant semicolon lint
Lucas Ly Ba [Tue, 6 Jan 2026 11:21:13 +0000 (11:21 +0000)] 
gccrs: add redudant semicolon lint

gcc/rust/ChangeLog:

* checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit):
Emit warning in empty statement visitor.
* checks/lints/unused/rust-unused-checker.h:
Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/redundant-semicolons_0.rs: New test.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
4 months agogccrs: util/attributes: error on malformed #[link_name] input
Jayant Chauhan [Sat, 3 Jan 2026 23:36:53 +0000 (05:06 +0530)] 
gccrs: util/attributes: error on malformed #[link_name] input

Emit a diagnostic when #[link_name] is used without arguments,
matching rustc behavior. This prevents silent acceptance of empty
attributes and provides a helpful diagnostic that shows the expected form.

Fixes Rust-GCC#4228

gcc/rust/ChangeLog:

* util/rust-attributes.cc: Emit diagnostic.

gcc/testsuite/ChangeLog:

* rust/compile/link_name-malformed.rs: New test.

Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>
4 months agogccrs: nr: Ignore errors when doing prelude resolution
Arthur Cohen [Wed, 1 Oct 2025 10:10:58 +0000 (12:10 +0200)] 
gccrs: nr: Ignore errors when doing prelude resolution

We only want to emit the ones from regular name resolution as otherwise
they will be doubled for the user for no good reason.

gcc/rust/ChangeLog:

* resolve/rust-name-resolution-context.h:

Co-authored-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: nr: Do prelude resolution for Identifiers
Arthur Cohen [Fri, 12 Sep 2025 14:11:15 +0000 (16:11 +0200)] 
gccrs: nr: Do prelude resolution for Identifiers

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: New function.
* resolve/rust-forever-stack.hxx: Implement it.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Call it if the prelude exists
and we have an unresolved Identifier Call it if the prelude exists and we have
an unresolved Identifier.

4 months agogccrs: forever-stack: Add extra path resolution from a known NodeId.
Arthur Cohen [Wed, 10 Sep 2025 07:39:18 +0000 (09:39 +0200)] 
gccrs: forever-stack: Add extra path resolution from a known NodeId.

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: Add new resolve_path function.
* resolve/rust-forever-stack.hxx: Implement it.

4 months agogccrs: nr: Add prelude field to NRCtx, and fill it upon encountering a prelude.
Arthur Cohen [Wed, 10 Sep 2025 07:07:55 +0000 (09:07 +0200)] 
gccrs: nr: Add prelude field to NRCtx, and fill it upon encountering a prelude.

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_glob_import): Save prelude
if we find one.
* resolve/rust-name-resolution-context.h: Add field.
* resolve/rust-toplevel-name-resolver-2.0.cc (has_prelude_import): New function.
(TopLevel::visit): Create a prelude glob import if necessary.
* resolve/rust-toplevel-name-resolver-2.0.h: Allow glob imports to be prelude imports.

4 months agogccrs: forever-stack: Display depth in debug string
Arthur Cohen [Wed, 31 Dec 2025 15:29:23 +0000 (16:29 +0100)] 
gccrs: forever-stack: Display depth in debug string

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: Add depth parameter to function.
* resolve/rust-forever-stack.hxx: Likewise and use it.

4 months agogccrs: Explicitely specify templates for GCC5
Pierre-Emmanuel Patry [Mon, 5 Jan 2026 16:03:27 +0000 (17:03 +0100)] 
gccrs: Explicitely specify templates for GCC5

GCC5 does not infer correctly the type to use within the template.

gcc/rust/ChangeLog:

* parse/rust-parse-impl-expr.hxx: Use explicit template.
* parse/rust-parse-impl-path.hxx: Likewise.
* parse/rust-parse-impl-ttree.hxx: Likewise.
* parse/rust-parse-impl.hxx: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Use error wrapper when required instead of nullptr
Pierre-Emmanuel Patry [Fri, 26 Dec 2025 03:38:52 +0000 (04:38 +0100)] 
gccrs: Use error wrapper when required instead of nullptr

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::visit): Update function
name.
* ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (BreakExpr::as_string): Use getter function.
(AttributeParser::parse_path_meta_item): Convert to expected type.
(ReturnExpr::as_string): Change access to returned expr.
* ast/rust-desugar-for-loops.cc (DesugarForLoops::DesugarCtx::make_break_arm):
Likewise.
* ast/rust-expr.h (class BreakExpr): Make expr in break optional.
(class ReturnExpr): Make returned expr explicitely optional. Change the
getters and introduce a  const getter.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Convert to expected type.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Update
constructor call to new expected types.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_llvm_operands): Likewise.
* expand/rust-macro-builtins-format-args.cc (format_args_parse_expr):
Likewise.
(format_args_parse_arguments): Likewise.
* expand/rust-macro-builtins-helpers.cc (try_expand_many_expr): Update
value for tl::expected.
* expand/rust-macro-builtins-include.cc (MacroBuiltin::include_handler):
Likewise.
* expand/rust-macro-expand.cc (transcribe_expression): Update
constructor call with expected value.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* parse/rust-parse-error.h (enum class): Add new error types for Expr
and StructExprField.
* parse/rust-parse-impl-expr.hxx: Explicitely handle return expr
parsing failure. Update to fit new expected types.
* parse/rust-parse-impl.hxx: Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Adapt to
tl::expected.
* ast/rust-desugar-while-let.cc (DesugarWhileLet::DesugarCtx::make_break_arm):
Use optional for break expressions when missing instead of nullptr.
* parse/rust-parse.h: Change function return type with expected. Remove
error state from ExprOrStmt.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Remove redundant error types
Pierre-Emmanuel Patry [Fri, 12 Dec 2025 12:17:22 +0000 (13:17 +0100)] 
gccrs: Remove redundant error types

Some error types in the parser had the exact same meaning and could be
grouped under one same type.

gcc/rust/ChangeLog:

* ast/rust-ast.cc (AttributeParser::parse_meta_item_lit): Use
tl::expected
* expand/rust-macro-builtins-helpers.cc (parse_single_string_literal):
Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_fragment):
Likewise.
* parse/rust-cfg-parser.cc (parse_cfg_option): Likewise.
* parse/rust-parse-error.h (struct SimplePath): Remove error type.
(struct DelimTokenTree): Likewise.
(struct Token): Likewise.
(struct TokenTree): Likewise.
(class LifetimeParam): Move from here ...
(struct LifetimeParam): ... to here. Add ctor.
(class Lifetime): Add error type.
(enum class): Remove AnonConst.
(struct BlockExpr): Change BlockExpr to generic node error.
* parse/rust-parse-impl-expr.hxx: Use tl::expected for errors.
* parse/rust-parse-impl-path.hxx: Likewise.
* parse/rust-parse-impl-ttree.hxx: Likewise.
* parse/rust-parse-impl.hxx: Likewise.
* parse/rust-parse.h: Update function return types with tl::expected
to propagate errors.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Use tl::expected for parse_block_expr results
Pierre-Emmanuel Patry [Wed, 10 Dec 2025 14:24:58 +0000 (15:24 +0100)] 
gccrs: Use tl::expected for parse_block_expr results

gcc/rust/ChangeLog:

* parse/rust-parse-error.h (struct BlockExpr): Add BlockExpr error type
* parse/rust-parse-impl-expr.hxx: Update return types.
* parse/rust-parse-impl.hxx: Likewise.
* parse/rust-parse.h: Update function prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Use error collector in the parser
Pierre-Emmanuel Patry [Wed, 10 Dec 2025 12:59:13 +0000 (13:59 +0100)] 
gccrs: Use error collector in the parser

Errors in the parser needs to be collected instead of emitted directly.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.hxx: Collect errors instead of emitting them.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Move old parser error classes to error header
Pierre-Emmanuel Patry [Wed, 10 Dec 2025 12:38:24 +0000 (13:38 +0100)] 
gccrs: Move old parser error classes to error header

A parser error header with Parse::Error namespace has recently been
introduced. Move some old parser error classes to this namespace.

gcc/rust/ChangeLog:

* parse/rust-parse.h (class ParseLifetimeParamError): Move error from
here ...
(class ParseLifetimeError): Likewise.
(enum class): Likewise.
* parse/rust-parse-error.h (class LifetimeParam): ... to here.
here.
(class Lifetime): Likewise.
(enum class): Likewise.
(struct LoopLabel): Likewise and make it a full struct with ctors.
(struct Self): Likewise.
* parse/rust-parse-impl-expr.hxx: Make error point to new namespace.
* parse/rust-parse-impl.hxx: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Fix rogue macro error during lowering on expansion failure
Harishankar [Thu, 1 Jan 2026 05:17:23 +0000 (10:47 +0530)] 
gccrs: Fix rogue macro error during lowering on expansion failure

When a macro expansion fails (e.g. due to a parsing error like invalid
syntax in the macro body), the expander previously returned an error
fragment but did not update the AST. This left the original macro
invocation in place, which subsequently caused an ICE (rogue macro
detected) during the lowering phase.

This patch updates `expand_invoc` to replace the macro invocation with
an empty fragment if expansion fails, ensuring the compiler can proceed
(or exit gracefully) without crashing.

Fixes Rust-GCC/gccrs#4213

gcc/rust/ChangeLog:

* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Handle
error fragments by replacing them with empty fragments.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Harishankar <harishankarpp7@gmail.com>
4 months agogccrs: remove match arm pattern vector to single pattern
Lucas Ly Ba [Thu, 20 Nov 2025 14:01:08 +0000 (14:01 +0000)] 
gccrs: remove match arm pattern vector to single pattern

This patch refactors all uses of vector patterns since a vector of
patterns would be considered as an alt pattern, a vector is considered
useless.

gcc/rust/ChangeLog:

* ast/rust-ast-builder.cc (Builder::match_arm): Moves the vector of patterns
to a single pattern.
* ast/rust-ast-collector.cc (TokenCollector::visit):Likewise.
* ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit):Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):Likewise.
* ast/rust-ast.cc (IfLetExpr::as_string):Likewise.
(WhileLetLoopExpr::as_string):Likewise.
(MatchArm::as_string):Likewise.
* ast/rust-desugar-question-mark.cc (make_match_arm):Likewise.
* ast/rust-desugar-while-let.cc (DesugarWhileLet::desugar):Likewise.
* ast/rust-expr.h (class WhileLetLoopExpr):Likewise.
(class IfLetExpr):Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit):Likewise.
* checks/errors/rust-hir-pattern-analysis.cc (lower_arm):Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit):Likewise.
* hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::desugar_iflet):Likewise.
(ASTLoweringExprWithBlock::visit):Likewise.
* hir/rust-hir-dump.cc (Dump::do_matcharm):Likewise.
(Dump::visit):Likewise.
* hir/tree/rust-hir-expr.cc (OperatorExpr::operator=):Likewise.
(ArithmeticOrLogicalExpr::operator=):Likewise.
(ComparisonExpr::operator=):Likewise.
(LazyBooleanExpr::operator=):Likewise.
(TypeCastExpr::operator=):Likewise.
(AssignmentExpr::operator=):Likewise.
(CompoundAssignmentExpr::operator=):Likewise.
(GroupedExpr::operator=):Likewise.
(ArrayExpr::operator=):Likewise.
(ArrayIndexExpr::operator=):Likewise.
(CallExpr::operator=):Likewise.
(MethodCallExpr::operator=):Likewise.
(FieldAccessExpr::operator=):Likewise.
(BlockExpr::operator=):Likewise.
(BreakExpr::operator=):Likewise.
(ReturnExpr::operator=):Likewise.
(UnsafeBlockExpr::operator=):Likewise.
(BaseLoopExpr::operator=):Likewise.
(WhileLetLoopExpr::WhileLetLoopExpr):Likewise.
(WhileLetLoopExpr::operator=):Likewise.
(MatchArm::MatchArm):Likewise.
(MatchArm::operator=):Likewise.
(MatchExpr::operator=):Likewise.
* hir/tree/rust-hir-expr.h (class WhileLetLoopExpr):Likewise.
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk):Likewise.
(DefaultHIRVisitor::visit_match_arm):Likewise.
* hir/tree/rust-hir.cc (WhileLetLoopExpr::as_string):Likewise.
(MatchArm::as_string):Likewise.
* parse/rust-parse-impl-expr.hxx: Likewise.
* parse/rust-parse-impl.hxx: Likewise.
* parse/rust-parse.h:Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit_if_let_patterns):Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit):Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):Likewise.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
4 months agogccrs: nr: Add better error to unresolved attribute macro
Arthur Cohen [Tue, 16 Sep 2025 08:47:05 +0000 (10:47 +0200)] 
gccrs: nr: Add better error to unresolved attribute macro

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Mention the name
of the attribute macro that hasn't been found.

4 months agoanalyzer: fix check against --param=analyzer-bb-explosion-factor=0
David Malcolm [Fri, 16 Jan 2026 15:54:32 +0000 (10:54 -0500)] 
analyzer: fix check against --param=analyzer-bb-explosion-factor=0

analyzer.texi documents --param=analyzer-bb-explosion-factor=0 as a way
to make the analysis bail out early, but I broke this in
r16-6063-g0b786d961d4426.

Fix thusly.

gcc/analyzer/ChangeLog:
* engine.cc (exploded_graph::process_worklist): Remove guard on
limit being non-zero when checking for -Wanalyzer-too-complex
on overall number of exploded nodes.  Allow for the origin enode.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 months agoanalyzer: add timevar values for supergraph manipulation [PR123145]
David Malcolm [Fri, 16 Jan 2026 15:54:31 +0000 (10:54 -0500)] 
analyzer: add timevar values for supergraph manipulation [PR123145]

Whilst tracking down the slowdown of PR analyzer/123145, I noticed that
the various supergraph manipulations introduced in
r16-6063-g0b786d961d4426 can take non-trivial amounts of time on
complicated TUs.  Add timevars to track each of them.

gcc/analyzer/ChangeLog:
PR analyzer/123145
* supergraph-fixup-locations.cc: Include "timevar.h".
(supergraph::fixup_locations): Track time spent as
TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS.
* supergraph-simplify.cc: Include "timevar.h".
(supergraph::simplify): Track time spent as
TV_ANALYZER_SUPERGRAPH_SIMPLIFY.
* supergraph-sorting.cc: Include "timevar.h".
(supergraph::sort_nodes): Track time spent as
TV_ANALYZER_SUPERGRAPH_SORTING.
* supergraph.cc (supergraph::supergraph): Track time spent as
TV_ANALYZER_SUPERGRAPH_CREATION rather than
TV_ANALYZER_SUPERGRAPH.

gcc/ChangeLog:
PR analyzer/123145
* timevar.def (TV_ANALYZER_SUPERGRAPH): Rename to...
(TV_ANALYZER_SUPERGRAPH_CREATION): ...this.
(TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS): New.
(TV_ANALYZER_SUPERGRAPH_SIMPLIFY): New.
(TV_ANALYZER_SUPERGRAPH_SORTING): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 months agoanalyzer: eliminate unused field eh_dispatch_edge_op::m_dst_snode [PR123540]
David Malcolm [Fri, 16 Jan 2026 15:54:31 +0000 (10:54 -0500)] 
analyzer: eliminate unused field eh_dispatch_edge_op::m_dst_snode [PR123540]

gcc/analyzer/ChangeLog:
PR analyzer/123540
* ops.cc (eh_dispatch_edge_op::make): Drop dst_snode param to
ctor.
(eh_dispatch_edge_op::eh_dispatch_edge_op): Likewise, dropping
field eh_dispatch_edge_op::m_dst_snode.
(eh_dispatch_try_edge_op::eh_dispatch_try_edge_op): Likewise.
(eh_dispatch_allowed_edge_op::eh_dispatch_allowed_edge_op):
Likewise.
* ops.h (eh_dispatch_edge_op::eh_dispatch_edge_op): Likewise.
(eh_dispatch_edge_op::m_dst_snode): Drop unused field.
(eh_dispatch_try_edge_op::eh_dispatch_try_edge_op): Drop unused
dst_snode param.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 months ago[PR123092, LRA]: Reprocess insn after equivalence substitution
Vladimir N. Makarov [Fri, 16 Jan 2026 15:09:52 +0000 (10:09 -0500)] 
[PR123092, LRA]: Reprocess insn after equivalence substitution

LRA in the test case substituted equivalence in an insn but did not
process the insn on satisfying constraints after that.  It resulted in
error "insn does not satisfy its constraints"

gcc/ChangeLog:

PR target/123092
* lra-constraints.cc (lra_constraints): Push insn on processing
stack after equivalence substitution.

gcc/testsuite/ChangeLog:

PR target/123092
* gcc.target/riscv/pr123092.c: New.

4 months agoc++/reflection: enable more testing
Marek Polacek [Thu, 15 Jan 2026 19:57:13 +0000 (14:57 -0500)] 
c++/reflection: enable more testing

These TODOs already work fine so let's enable more testing.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/member15.C: Enable commented-out test.
* g++.dg/reflect/splice5.C: Likewise.  Add XFAIL.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoProvide gt_pch_get_address etc. on FreeBSD [PR110746]
Rainer Orth [Fri, 16 Jan 2026 12:12:03 +0000 (13:12 +0100)] 
Provide gt_pch_get_address etc. on FreeBSD [PR110746]

On FreeBSD/amd64, more than 700 tests FAIL like

FAIL: gcc.dg/pch/common-1.c  -O0 -g -I. -Dwith_PCH (test for excess errors)
Excess errors:
gcc/testsuite/gcc.dg/pch/common-1.c:1: sorry, unimplemented: PCH allocation failure

This can easily be fixed by implementing the
host_hooks.gt_pch_get_address hook.  The code is shamelessly stolen from
the openbsd implementation, only changing the names and omitting the
hppa and i386 code.  The former isn't supported by FreeBSD at all AFAIK,
while the latter has just been removed in FreeBSD 15.0.

Bootstrapped without regressions on x86_64-unknown-freebsd14.3: all PCH
failures are gone.

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

gcc:
PR pch/110746
* config/host-freebsd.cc: New file.
* config.host <*-*-freebsd*>: Use it.
* config/x-freebsd: New file.

4 months agoipa-cp: Fix devirt bonus for targets that cannot be inlined
Martin Jambor [Fri, 16 Jan 2026 11:04:23 +0000 (12:04 +0100)] 
ipa-cp: Fix devirt bonus for targets that cannot be inlined

PR 123412 has been filed because since commit
r16-3990-gad3fb999a1b568 (Jan Hubicka: Improve ipa-cp devirtualization
costing), there is accidentally zero devirtualization bonus for
functions which cannot be inlined.  This has resulted in
g++.dg/ipa/devirt-2.C failing since it has been pushed because the
required function is not cloned even with --param max-devirt-targets=1.

The intention was that we do get at least some small benefit boost and
so this patch adds an addition of the indirect edge frequency once
before the early continue statements.

gcc/ChangeLog:

2026-01-14  Martin Jambor  <mjambor@suse.cz>

PR ipa/123412
* ipa-cp.cc (devirtualization_time_bonus): Do add the indirect
edge frequency at least once even for targets which cannot be
inlined.