]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 weeks agomiddle-end: clear the user unroll flag if the cost model has overriden it
Tamar Christina [Fri, 12 Sep 2025 07:28:44 +0000 (08:28 +0100)] 
middle-end: clear the user unroll flag if the cost model has overriden it

If the user has requested loop unrolling through pragma GCC unroll then at the
moment we only set LOOP_VINFO_USER_UNROLL if the vectorizer has not overrode the
unroll factor (through backend costing) or if the VF made the requested unroll
factor be 1.

When we have a loop of say int and a pragma unroll 4

If the vectorizer picks V4SI as the mode, the requested unroll ended up exactly
matching the VF. As such the requested unroll is 1 and we don't clear the pragma.

So it did honor the requested unroll factor. However since we didn't set the
unroll amount back and left it at 4 the rtl unroller won't use the rtl cost
model at all and just unroll the vector loop 4 times.

But of these events are costing related, and so it stands to reason that we
should set LOOP_VINFO_USER_UNROLL to we return the RTL unroller to use the
backend costing for any further unrolling.

gcc/ChangeLog:

* tree-vect-loop.cc (vect_analyze_loop_1): If the unroll pragma was set
mark it as handled.
* doc/extend.texi (pragma GCC unroll): Update documentation.

3 weeks agoDaily bump.
GCC Administrator [Fri, 12 Sep 2025 00:20:54 +0000 (00:20 +0000)] 
Daily bump.

3 weeks agodoc: Correct the return type of float comparison
Trevor Gross [Thu, 11 Sep 2025 20:50:04 +0000 (20:50 +0000)] 
doc: Correct the return type of float comparison

Documentation for `__cmpsf2` and similar functions currently indicate a
return type of `int`. This is not correct however; the `libgcc`
functions return `CMPtype`, the size of which is determined by the
`libgcc_cmp_return` mode.

Update documentation to use `CMPtype` and indicate that this is
target-dependent, also mentioning the usual modes.

Reported-by: beetrees <b@beetr.ee>
Fixes: https://github.com/rust-lang/compiler-builtins/issues/919#issuecomment-2905347318
Signed-off-by: Trevor Gross <tmgross@umich.edu>
* doc/libgcc.texi (Comparison functions): Document functions as
returning CMPtype.

3 weeks agoFortran: fix assignment to allocatable scalar polymorphic component [PR121616]
Harald Anlauf [Thu, 11 Sep 2025 18:17:31 +0000 (20:17 +0200)] 
Fortran: fix assignment to allocatable scalar polymorphic component [PR121616]

PR fortran/121616

gcc/fortran/ChangeLog:

* primary.cc (gfc_variable_attr): Properly set dimension attribute
from a component ref.

gcc/testsuite/ChangeLog:

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

3 weeks agolibstdc++: Trap on std::shared_ptr reference count overflow [PR71945]
Jonathan Wakely [Wed, 16 Jul 2025 23:21:54 +0000 (00:21 +0100)] 
libstdc++: Trap on std::shared_ptr reference count overflow [PR71945]

This adds checks when incrementing the shared count and weak count and
will trap if they would be be incremented past its maximum. The maximum
value is the value at which incrementing it produces an invalid
use_count(). So that is either the maximum positive value of
_Atomic_word, or for targets where we now allow the counters to wrap
around to negative values, the "maximum" value is -1, because that is
the value at which one more increment overflows the usable range and
resets the counter to zero.

For the weak count the maximum is always -1 as we always allow that
count to use nagative values, so we only tap if it wraps all the way
back to zero.

libstdc++-v3/ChangeLog:

PR libstdc++/71945
* include/bits/shared_ptr_base.h (_Sp_counted_base::_S_chk):
Trap if a reference count cannot be incremented any higher.
(_Sp_counted_base::_M_add_ref_copy): Use _S_chk.
(_Sp_counted_base::_M_add_weak_ref): Likewise.
(_Sp_counted_base<_S_mutex>::_M_add_ref_lock_nothrow): Likewise.
(_Sp_counted_base<_S_atomic>::_M_add_ref_lock_nothrow): Likewise.
(_Sp_counted_base<_S_single>::_M_add_ref_copy): Use _S_chk.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Allow std::shared_ptr reference counts to be negative [PR71945]
Jonathan Wakely [Wed, 16 Jul 2025 23:21:54 +0000 (00:21 +0100)] 
libstdc++: Allow std::shared_ptr reference counts to be negative [PR71945]

This change doubles the effective range of the std::shared_ptr and
std::weak_ptr reference counts for most 64-bit targets.

The counter type, _Atomic_word, is usually a signed 32-bit int (except
on Solaris v9 where it is a signed 64-bit long). The return type of
std::shared_ptr::use_count() is long. For targets where long is wider
than _Atomic_word (most 64-bit targets) we can treat the _Atomic_word
reference counts as unsigned and allow them to wrap around from their
most positive value to their most negative value without any problems.
The logic that operates on the counts only cares if they are zero or
non-zero, and never performs relational comparisons. The atomic
fetch_add operations on integers are required by the standard to behave
like unsigned types, so that overflow is well-defined:

  "the result is as if the object value and parameters were converted to
  their corresponding unsigned types, the computation performed on those
  types, and the result converted back to the signed type."

So if we allow the counts to wrap around to negative values, all we need
to do is cast the value to make_unsigned_t<_Atomic_word> before
returning it as long from the use_count() function.

In practice even exceeding INT_MAX is extremely unlikely, as it would
require billions of shared_ptr or weak_ptr objects to have been
constructed and never destroyed. However, if that happens we now have
double the range before the count returns to zero and causes problems.

Some of the member functions for the _Sp_counted_base<_S_single>
specialization are adusted to use the __atomic_add_single and
__exchange_and_add_single helpers instead of plain ++ and -- operations.
This is done because those helpers use unsigned arithmetic, where the
plain increments and decrements would have undefined behaviour on
overflow.

libstdc++-v3/ChangeLog:

PR libstdc++/71945
* include/bits/shared_ptr_base.h
(_Sp_counted_base::_M_get_use_count): Cast _M_use_count to
unsigned before returning as long.
(_Sp_counted_base<_S_single>::_M_add_ref_copy): Use atomic
helper function to adjust ref count using unsigned arithmetic.
(_Sp_counted_base<_S_single>::_M_weak_release): Likewise.
(_Sp_counted_base<_S_single>::_M_get_use_count): Cast
_M_use_count to unsigned before returning as long.
(_Sp_counted_base<_S_single>::_M_add_ref_lock_nothrow): Use
_M_add_ref_copy to do increment using unsigned arithmetic.
(_Sp_counted_base<_S_single>::_M_release): Use atomic helper and
_M_weak_release to do decrements using unsigned arithmetic.
(_Sp_counted_base<_S_mutex>::_M_release): Add comment.
(_Sp_counted_base<_S_single>::_M_weak_add_ref): Remove
specialization.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Make atomicity helpers use unsigned arithmetic [PR121148]
Jonathan Wakely [Thu, 17 Jul 2025 21:02:45 +0000 (22:02 +0100)] 
libstdc++: Make atomicity helpers use unsigned arithmetic [PR121148]

The standard requires that std::atomic<integral-type>::fetch_add does
not have undefined behaviour for signed overflow, instead it wraps like
unsigned integers. The compiler ensures this is true for the atomic
built-ins that std::atomic uses, but it's not currently true for the
__gnu_cxx::__exchange_and_add and __gnu_cxx::__atomic_add functions
defined in libstdc++, which operate on type _Atomic_word.

For the inline __exchange_and_add_single function (used when there's
only one thread in the process), we can copy the value to an unsigned
long and do the addition on that, then assign it back to the
_Atomic_word variable.

The __exchange_and_add in config/cpu/generic/atomicity_mutex/atomicity.h
locks a mutex and then performs exactly the same steps as
__exchange_and_add_single.  Calling __exchange_and_add_single instead of
duplicating the code benefits from the fix just made to
__exchange_and_add_single.

For the remaining config/cpu/$arch/atomicity.h implementations, they
either use inline assembly which uses wrapping instructions (so no
changes needed), or we can fix them by compiling with -fwrapv.

After ths change, UBsan no longer gives an error for:

  _Atomic_word i = INT_MAX;
  __gnu_cxx::__exchange_and_add_dispatch(&i, 1);

/usr/include/c++/14/ext/atomicity.h:85:12: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'

libstdc++-v3/ChangeLog:

PR libstdc++/121148
* config/cpu/generic/atomicity_mutex/atomicity.h
(__exchange_and_add): Call __exchange_and_add_single.
* include/ext/atomicity.h (__exchange_and_add_single): Use an
unsigned type for the addition.
* libsupc++/Makefile.am (atomicity.o): Compile with -fwrapv.
* libsupc++/Makefile.in: Regenerate.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agopr107421.f90: Require PIE and pass -fPIE for non-x86 targets
H.J. Lu [Mon, 8 Sep 2025 14:47:35 +0000 (07:47 -0700)] 
pr107421.f90: Require PIE and pass -fPIE for non-x86 targets

-mno-direct-extern-access is used to disable direct access to external
symbol from executable with and without PIE for x86.  Require PIE and
pass -fPIE to disable direct access to external symbol for other targets.

PR fortran/107421
PR testsuite/121848
* gfortran.dg/gomp/pr107421.f90: Require PIE and pass -fPIE for
non-x86 targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agolibstdc++: Use consteval for _S_noexcept() helper functions
Jonathan Wakely [Thu, 11 Sep 2025 08:55:12 +0000 (09:55 +0100)] 
libstdc++: Use consteval for _S_noexcept() helper functions

These _S_noexcept() functions are only used in noexcept-specifiers and
never need to be called at runtime. They can be immediate functions,
i.e. consteval.

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h (_IterMove::_S_noexcept)
(_IterSwap::_S_noexcept): Change constexpr to consteval.
* include/bits/ranges_base.h (_Begin::_S_noexcept)
(_End::_S_noexcept, _RBegin::_S_noexcept, _REnd::_S_noexcept)
(_Size::_S_noexcept, _Empty::_S_noexcept, _Data::_S_noexcept):
Likewise.
* include/std/concepts (_Swap::_S_noexcept): Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Add always_inline to ranges iterator ops and access functions
Jonathan Wakely [Thu, 11 Sep 2025 08:34:02 +0000 (09:34 +0100)] 
libstdc++: Add always_inline to ranges iterator ops and access functions

Most of the basis operations for ranges such as ranges::begin and
ranges::next are trivial one-line function bodies, so can be made
always_inline to reduce the abstraction penalty for -O0 code.

Now that we no longer need to support the -fconcepts-ts grammar, we can
also move some [[nodiscard]] attributes to the more natural position
before the function declaration, instead of between the declarator-id
and the function parameters, e.g. we can use:

  template<typename T> requires C<T> [[nodiscard]] auto operator()(T&&)

instead of:

  template<typename T> requires C<T> auto operator() [[nodiscard]] (T&&)

The latter form was necessary because -fconcepts-ts used a different
grammar for the requires-clause, parsing 'C<T>[[x]]' as a subscripting
operator with an ill-formed argument '[x]'. In the C++20 grammar you
would need to use parentheses to use a subscript in a constraint, so
without parentheses it's parsed as an attribute.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (__detail::__to_unsigned_like)
(__access::__possible_const_range, __access::__as_const)
(__distance_fn::operator(), __next_fn::operator())
(__prev_fn::operator()): Add always_inline attribute.
(_Begin::operator(), _End::operator(), _RBegin::operator())
(_REnd::operator(), _Size::operator(), _SSize::operator())
(_Empty::operator(), _Data::operator(), _SSize::operator()):
Likewise. Move nodiscard attribute to start of declaration.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agotestsuite: Add tests for PR c/107419 and PR c++/107393
H.J. Lu [Mon, 8 Sep 2025 22:10:02 +0000 (15:10 -0700)] 
testsuite: Add tests for PR c/107419 and PR c++/107393

Both C and C++ frontends should set a tentative TLS model in grokvardecl
and update TLS mode with the default TLS access model after a TLS variable
has been fully processed if the default TLS access model is stronger.

PR c/107419
PR c++/107393
* c-c++-common/tls-attr-common.c: New test.
* c-c++-common/tls-attr-le-pic.c: Likewise.
* c-c++-common/tls-attr-le-pie.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agolibstdc++: optimize weak_ptr converting constructor/assignment
Giuseppe D'Angelo [Wed, 2 Oct 2024 16:14:34 +0000 (18:14 +0200)] 
libstdc++: optimize weak_ptr converting constructor/assignment

Converting a weak_ptr<Derived> to a weak_ptr<Base> requires calling
lock() on the source object in the general case.

Although the source weak_ptr<Derived> does contain a raw pointer to
Derived, we can't just get it and (up)cast it to Base, as that will
dereference the pointer in case Base is a virtual base class of Derived.

We don't know if the managed object is still alive, and therefore if
this operation is safe to do; we therefore temporarily lock() the source
weak_ptr, do the cast using the resulting shared_ptr, and then discard
this shared_ptr. Simply checking the strong counter isn't sufficient,
because if multiple threads are involved then we'd have a race / TOCTOU
problem; the object may get destroyed after we check the strong counter
and before we cast the pointer.

However lock() is not necessary if we know that Base is *not* a virtual
base class of Derived; in this case we can avoid the relatively
expensive call to lock() and just cast the pointer. This commit uses
the newly added builtin to detect this case and optimize std::weak_ptr's
converting constructors and assignment operations.

Apart from non-virtual bases, there's also another couple of interesting
cases where we can also avoid locking. Specifically:

1) converting a weak_ptr<T[N]> to a weak_ptr<T cv[]>;
2) converting a weak_ptr<T*> to a weak_ptr<T const * const> or similar.

Since this logic is going to be used by multiple places, I've
centralized it in a new static helper.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_base.h (__weak_ptr): Avoid calling
lock() when converting or assigning a weak_ptr<Derived> to
a weak_ptr<Base> in case Base is not a virtual base of Derived.
This logic is centralized in _S_safe_upcast, called by the
various converting constructors/assignment operators.
(_S_safe_upcast): New helper function.
* testsuite/20_util/weak_ptr/cons/virtual_bases.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
3 weeks agoc++: Don't upgrade TLS model if TLS model isn't set.
H.J. Lu [Wed, 10 Sep 2025 19:47:47 +0000 (12:47 -0700)] 
c++: Don't upgrade TLS model if TLS model isn't set.

Don't upgrade TLS model when cplus_decl_attributes is called on a thread
local variable whose TLS model isn't set yet.

gcc/cp/

PR c++/121889
* decl2.cc (cplus_decl_attributes): Don't upgrade TLS model if
TLS model isn't set yet.

gcc/testsuite/

PR c++/121889
* g++.dg/tls/pr121889.C: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoAArch64: Add isfinite expander [PR 66462]
Wilco Dijkstra [Wed, 27 Aug 2025 17:20:21 +0000 (17:20 +0000)] 
AArch64: Add isfinite expander [PR 66462]

Add an expander for isfinite using integer arithmetic.  This is
typically faster and avoids generating spurious exceptions on
signaling NaNs.  This fixes part of PR66462.

int isfinite1 (float x) { return __builtin_isfinite (x); }

Before:
fabs    s0, s0
mov     w0, 2139095039
fmov    s31, w0
fcmp    s0, s31
cset    w0, hi
eor     w0, w0, 1
ret

After:
fmov    w1, s0
mov     w0, -16777216
cmp     w0, w1, lsl 1
cset    w0, hi
ret

gcc:
PR middle-end/66462
* config/aarch64/aarch64.md (isfinite<mode>2): Add new expander.

gcc/testsuite:
PR middle-end/66462
* gcc.target/aarch64/pr66462.c: Add tests for isfinite.

3 weeks agotree-optimization/121595 - new fabs(a+0.0) -> fabs(a) pattern
Matteo Nicoli [Fri, 22 Aug 2025 18:42:12 +0000 (20:42 +0200)] 
tree-optimization/121595 - new fabs(a+0.0) -> fabs(a) pattern

With -fno-trapping-math it is safe to optimize fabs(a + 0.0) as
fabs (a).

PR tree-optimization/121595
* match.pd (fabs(a + 0.0) -> fabs (a)): Optimization pattern limited to
the -fno-trapping-math case.

* gcc.dg/fabs-plus-zero-1.c: New testcase.
* gcc.dg/fabs-plus-zero-2.c: Likewise.

Signed-off-by: Matteo Nicoli <matteo.nicoli001@gmail.com>
Reviewed-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks agotestsuite: LoongArch: Enable 16B atomic tests if the test machine supports LSX and SCQ
Xi Ruoyao [Tue, 19 Aug 2025 03:01:56 +0000 (11:01 +0800)] 
testsuite: LoongArch: Enable 16B atomic tests if the test machine supports LSX and SCQ

Enable those tests so we won't make too stupid mistakes in 16B atomic
implementation anymore.

All these test passed on a Loongson 3C6000/S except
atomic-other-int128.c.  With GDB patched to support sc.q
(https://sourceware.org/pipermail/gdb-patches/2025-August/220034.html)
this test also XPASS.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_loongarch_scq_hw): New.
(check_effective_target_sync_int_128_runtime): Return 1 on
loongarch64-*-* if hardware supports both LSX and SCQ.
* gcc.dg/atomic-compare-exchange-5.c: Pass -mlsx -mscq for
loongarch64-*-*.
* gcc.dg/atomic-exchange-5.c: Likewise.
* gcc.dg/atomic-load-5.c: Likewise.
* gcc.dg/atomic-op-5.c: Likewise.
* gcc.dg/atomic-store-5.c: Likewise.
* gcc.dg/atomic-store-6.c: Likewise.
* gcc.dg/simulate-thread/atomic-load-int128.c: Likewise.
* gcc.dg/simulate-thread/atomic-other-int128.c: Likewise.
(dg-final): xfail on loongarch64-*-* because  gdb does not
handle sc.q properly yet.

3 weeks agoLoongArch: Fix the semantic of 16B CAS
Xi Ruoyao [Mon, 18 Aug 2025 09:18:32 +0000 (17:18 +0800)] 
LoongArch: Fix the semantic of 16B CAS

In a CAS operation, even if expected != *memory we still need to do an
atomic load of *memory into output.  But I made a mistake in the initial
implementation, causing the output to contain junk in this situation.

Like a normal atomic load, the atomic load embedded in the CAS semantic
is required to work on read-only page.  Thus we cannot rely on sc.q to
ensure the atomicity of the load.  Use LSX to perform the load instead,
and also use LSX to compare the 16B values to keep the ll-sc loop body
short.

gcc/ChangeLog:

* config/loongarch/sync.md (atomic_compare_and_swapti_scq):
Require LSX.  Change the operands for the output, the memory,
and the expected value to LSX vector modes.  Add a FCCmode
output to indicate if CAS has written the desired value into
memory.  Use LSX to atomically load both words of the 16B value
in memory.
(atomic_compare_and_swapti): Pun the modes to satisify
the new atomic_compare_and_swapti_scq implementation.  Read the
bool return value from the FCC instead of performing a
comparision.

3 weeks agoLoongArch: Fix the "%t" modifier handling for (const_int 0)
Xi Ruoyao [Tue, 19 Aug 2025 03:14:42 +0000 (11:14 +0800)] 
LoongArch: Fix the "%t" modifier handling for (const_int 0)

This modifier is intended to output $r0 for (const_int 0), but the
logic:

GET_MODE (op) != TImode || (op != CONST0_RTX (TImode) && code != REG)

will reject (const_int 0) because (const_int 0) actually does not have
a mode and GET_MODE will return VOIDmode for it.

Use reg_or_0_operand instead to fix the issue.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_print_operand): Call
reg_or_0_operand for checking the sanity of %t.

3 weeks agolibstdc++: Remove trailing whitespace in <syncstream>
Jonathan Wakely [Thu, 11 Sep 2025 09:36:22 +0000 (10:36 +0100)] 
libstdc++: Remove trailing whitespace in <syncstream>

libstdc++-v3/ChangeLog:

* include/std/syncstream: Remove trailing whitespace.

3 weeks agotree-optimization/121703 - UBSAN error with moving from uninit data
Richard Biener [Fri, 5 Sep 2025 12:47:33 +0000 (14:47 +0200)] 
tree-optimization/121703 - UBSAN error with moving from uninit data

The PR reports

vectorizer.h:276:3: runtime error: load of value 32695, which is not a valid value for type 'internal_fn'

which I believe is from

      slp_node->data = new vect_load_store_data (std::move (ls));

where 'ls' can be partly uninitialized (and that data will be not
used, but of course the move CTOR doesn't know this).  The following
tries to fix that by using value-initialization of 'ls'.

PR tree-optimization/121703
* tree-vect-stmts.cc (vectorizable_store): Value-initialize ls.
(vectorizable_load): Likewise.

3 weeks agoRISC-V: Suppress cross CC sibcall optimization from vector
Tsukasa OI [Tue, 9 Sep 2025 01:51:18 +0000 (01:51 +0000)] 
RISC-V: Suppress cross CC sibcall optimization from vector

In general, tail call optimization requires that the callee's saved
registers are a superset of the caller's.

The Standard Vector Calling Convention Variant (assembler: .variant_cc)
requires that a function with this calling convention preserves vector
registers v1-v7 and v24-v31 across calls (i.e. callee-saved).  However,
the same set of registers are (function-local) temporary registers
(i.e. caller-saved) on the normal (non-vector) calling convention.

Even if a function with this calling convention variant calls another
function with a non-vector calling convention, those vector registers
are correctly clobbered -- except when the sibling (tail) call
optimization occurs as it violates the general rule mentioned above.

If this happens, following function body:

1.  Save v1-v7 and v24-v31 for clobbering
2.  Call another function with a non-vector calling convention
    (which may destroy v1-v7 and/or v24-v31)
3.  Restore v1-v7 and v24-v31
4.  Return.

may be incorrectly optimized into the following sequence:

1.  Save v1-v7 and v24-v31 for clobbering
2.  Restore v1-v7 and v24-v31 (?!)
3.  Jump to another function with a non-vector calling convention
    (which may destroy v1-v7 and/or v24-v31).

This commit suppresses cross CC sibling call optimization from
the vector calling convention variant.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_function_ok_for_sibcall):
Suppress cross calling convention sibcall optimization from
the vector calling convention variant.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/abi-call-variant_cc-sibcall.c: New test.
* gcc.target/riscv/rvv/base/abi-call-variant_cc-sibcall-indirect-1.c: Ditto.
* gcc.target/riscv/rvv/base/abi-call-variant_cc-sibcall-indirect-2.c: Ditto.

3 weeks agotree-optimization/121829 - bogus CFG with asm goto
Richard Biener [Mon, 8 Sep 2025 10:40:30 +0000 (12:40 +0200)] 
tree-optimization/121829 - bogus CFG with asm goto

When the vectorizer removes a forwarder created earlier by split_edge
it uses redirect_edge_pred for convenience and efficiency.  That breaks
down when the edge split is originating from an asm goto as that is
a jump that needs adjustments from redirect_edge_and_branch.  The
following factores a simple vect_remove_forwarder handling this
situation appropriately.

PR tree-optimization/121829
* cfgloopmanip.cc (create_preheader): Ensure we can insert
at the end of a preheader.

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

3 weeks agoDeal with prior EH/abormal cleanup when fixing up noreturn calls
Richard Biener [Wed, 10 Sep 2025 15:14:07 +0000 (17:14 +0200)] 
Deal with prior EH/abormal cleanup when fixing up noreturn calls

When a dead EH or abnormal edge makes a call queued for noreturn fixup
unreachable, just skip processing it.

PR tree-optimization/121870
* tree-ssa-propagate.cc
(substitute_and_fold_engine::substitute_and_fold): Skip
removed stmts from noreturn fixup.

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

3 weeks agoada: add BACKLOG_MAX OS constant
Marc Poulhiès [Mon, 8 Sep 2025 14:42:48 +0000 (16:42 +0200)] 
ada: add BACKLOG_MAX OS constant

BACKLOG_MAX represents the number of outstanding connections in the
socket's listen queue.

gcc/ada/ChangeLog:

* libgnat/g-socket.adb (Listen_Socket): Change default value.
* libgnat/g-socket.ads (Listen_Socket): Likewise.
* s-oscons-tmplt.c (BACKLOG_MAX): New.

3 weeks agoada: Minor comment tweaks
Marc Poulhiès [Mon, 8 Sep 2025 14:21:37 +0000 (16:21 +0200)] 
ada: Minor comment tweaks

gcc/ada/ChangeLog:

* env.c (__gnat_clearenv): Adjust comment.
* libgnarl/a-intnam__bsd.ads: Fix copyright date.

3 weeks agoada: Give a warning for huge imported objects
Eric Botcazou [Thu, 21 Aug 2025 08:21:59 +0000 (10:21 +0200)] 
ada: Give a warning for huge imported objects

This is a follow-up to a recent change, where a warning was implemented
for huge library-level objects.  However it is not given if the objects
are imported, although an indirection is also added for them under the
hood to match the export side.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Give a
warning for huge imported objects as well.

3 weeks agoada: Get rid of TYPE_ALIGN_OK flag in gcc-interface
Eric Botcazou [Tue, 5 Aug 2025 07:14:44 +0000 (09:14 +0200)] 
ada: Get rid of TYPE_ALIGN_OK flag in gcc-interface

The TYPE_ALIGN_OK flag had originally been a GCC flag tested in the RTL
expander and was at some point kicked out of the middle-end to become a
pure Gigi flag.  But it's only set for tagged types and CW-equivalent
types and can be replaced by a explicit predicate without too much work.

gcc/ada/ChangeLog:

* gcc-interface/ada-tree.h (TYPE_ALIGN_OK): Delete.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Do not set it.
* gcc-interface/gigi.h (standard_datatypes): Add ADT_tag_name_id.
(tag_name_id): New macro.
(type_is_tagged_or_cw_equivalent): New inline predicate.
* gcc-interface/trans.cc (gigi): Initialize tag_name_id.
(gnat_to_gnu) <N_Unchecked_Type_Conversion>: Replace tests on
TYPE_ALIGN_OK with calls to type_is_tagged_or_cw_equivalent.
(addressable_p): Likewise.
* gcc-interface/utils.cc (convert): Likewise.
* gcc-interface/utils2.cc (build_binary_op): Likewise.

3 weeks agoada: Fix crash on reference to aliased object of packed array type with -g
Eric Botcazou [Mon, 28 Jul 2025 20:16:08 +0000 (22:16 +0200)] 
ada: Fix crash on reference to aliased object of packed array type with -g

This happens when the object is declared in another compilation unit.

gcc/ada/ChangeLog:

* gcc-interface/misc.cc (gnat_get_array_descr_info): In the record
type case, bail out if the original array type cannot be retrieved.

3 weeks agoada: Implement overflow checking for unsigned types
Eric Botcazou [Tue, 22 Jul 2025 22:19:10 +0000 (00:19 +0200)] 
ada: Implement overflow checking for unsigned types

The implementation is essentially mirrored from the one for signed types.

gcc/ada/ChangeLog:

* gcc-interface/gigi.h (standard_datatypes): Add ADT_uns_mulv64_decl
and ADT_uns_mulv128_decl.
(uns_mulv64_decl): New macro.
(uns_mulv128_decl): Likewise.
* gcc-interface/trans.cc (gigi): Create the uns_mulv64_decl and
uns_mulv128_decl declarations.
(gnat_to_gnu) <N_Op_Add>: Perform an overflow check for unsigned
integer addition, subtraction and multiplication if required.
<N_Op_Minus>: Perform an overflow check for unsigned integer
negation if required.
(build_unary_op_trapv): Add support for unsigned types.
(build_binary_op_trapv): Likewise.
<MINUS_EXPR>: Perform the check if the LHS is zero in the signed
case as well.

3 weeks agoada: Perform predicate check before, not after, parameter copy back.
Steve Baird [Thu, 21 Aug 2025 21:20:51 +0000 (14:20 -0700)] 
ada: Perform predicate check before, not after, parameter copy back.

In the case of a call to a subprogram that has an out (or in-out) parameter
that is passed by copy, the caller performs copy-back after the call returns.
If the actual parameter is a view conversion to a subtype that has an enabled
predicate, then the predicate check performed at that point should be
performed before, not after, the operand of the view conversion is updated.

gcc/ada/ChangeLog:

* exp_ch6.adb (Expand_Actuals): After building the tree for a
predicate check, call Prepend_To instead of Append_To so that the
check is performed before, instead of after, the corresponding
parameter copy-back.

3 weeks agoada: Create a ghost region for pragma annotate
Viljar Indus [Fri, 22 Aug 2025 08:31:56 +0000 (11:31 +0300)] 
ada: Create a ghost region for pragma annotate

Create a ghost region for pragma annotate so that we are able to analyze
the entity references correctly inside the pragma.

gcc/ada/ChangeLog:

* sem_prag.adb: Create a ghost region for pragma annotate before
analyzing its arguments.

3 weeks agoada: Check instantces of ghost iterator functions
Viljar Indus [Thu, 21 Aug 2025 09:14:08 +0000 (12:14 +0300)] 
ada: Check instantces of ghost iterator functions

Since we do not analyze the policy errors for expanded code we need to
check the functions specified in the Iterable aspect whenever we are
analyzing an iterator spcification with that aspect.

gcc/ada/ChangeLog:

* sem_ch5.adb (Analyze_Iterator_Specification): Check ghost context
of Iterable functions when handling iterator specifications with an
Iterable aspect.

3 weeks agoada: Update coding style
Viljar Indus [Mon, 25 Aug 2025 08:55:29 +0000 (11:55 +0300)] 
ada: Update coding style

gcc/ada/ChangeLog:

* ghost.adb (Check_Ghost_Policy): Update coding style.

3 weeks agoada: Ignore ghost policy errors inside aspect Iterable
Viljar Indus [Mon, 25 Aug 2025 08:52:06 +0000 (11:52 +0300)] 
ada: Ignore ghost policy errors inside aspect Iterable

It is OK to define a checked ghost type with an iterable aspect
that has ignored Iterable functions.

gcc/ada/ChangeLog:

* ghost.adb (Check_Ghost_Policy): Avoid triggering a ghost
policy error if the policy is referenced within the Iterable
aspect.

3 weeks agoada: Check ghost level dependencies inside assignments
Viljar Indus [Mon, 25 Aug 2025 07:13:02 +0000 (10:13 +0300)] 
ada: Check ghost level dependencies inside assignments

Check that entities on the RHS are ghost level dependent on the
entities on the LHS of the assignemnt.

gcc/ada/ChangeLog:

* ghost.adb (Is_OK_Statement): Check the levels of the
assignee with the levels of the entity are ghost level dependent.
(Check_Assignement_Levels): New function for checking the level
dependencies.

3 weeks agoada: Tune description of Ghost_Assertion_Level
Piotr Trojanek [Fri, 22 Aug 2025 13:08:33 +0000 (15:08 +0200)] 
ada: Tune description of Ghost_Assertion_Level

Fix grammar in comment.

gcc/ada/ChangeLog:

* einfo.ads (Ghost_Assertion_Level): Fix comment.

3 weeks agoada: Apply ghost regions for assigmnents correctly
Viljar Indus [Thu, 21 Aug 2025 11:24:04 +0000 (14:24 +0300)] 
ada: Apply ghost regions for assigmnents correctly

When frontend is operating in GNATprove mode (where expander is disabled), it
should check ghost policy for assignment statements just like it does for other
statements. This is because we want ghost policy errors to be reported not just
by GNAT, but also by GNATprove.

Additionally we need to perform the checks for valid location of ghost assigments
based on the region around the assigment before we create the region for
the assignment itself.

gcc/ada/ChangeLog:

* ghost.adb (Mark_And_Set_Ghost_Assignment): Create a ghost region
for an assigment irregardless of whether the expander is active.
Relocate the Assignment validity checks from Is_OK_Statement to
this subprogram.

3 weeks agoada: Compiler crash on container aggregate association with nonstatic key choice
Gary Dismukes [Thu, 21 Aug 2025 18:48:12 +0000 (18:48 +0000)] 
ada: Compiler crash on container aggregate association with nonstatic key choice

The compiler blows up on a container aggregate with a container element
association that has a key_choice given by a nonstatic key expression.
This happens in the size computation for the aggregate due to calling
Update_Choices with the nonstatic expression.  The fix is simply to
condition the call to Update_Choices on whether the choice expression
is static.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Container_Aggr_Code.Build_Size_Expr): In the case
of an association with a single choice, only call Update_Choices when
the choice expression is nonstatic.

3 weeks agoada: Fix visibility bug related to target name
Bob Duff [Wed, 20 Aug 2025 18:07:14 +0000 (14:07 -0400)] 
ada: Fix visibility bug related to target name

This patch fixes the following bug:
If the right-hand side of an expression contains a target name
(i.e. "@"), and also contains a reference to a user-defined operator
that is directly visible because of a "use type" clause on a renaming of
the package where the operator is declared, the compiler gives an
incorrect error saying that the renamed package is not visible.

It turns out that setting Entity of resolved nodes is unnecessary
and wrong; the fix is to simply remove that code.

gcc/ada/ChangeLog:

* exp_ch5.adb
(Expand_Assign_With_Target_Names.Replace_Target):
Remove code setting Entity to Empty.
* sinfo.ads (Has_Target_Names):
Improve comment: add "@" to clarify what "target name"
means, and remove the content-free phrase "and must
be expanded accordingly."

3 weeks agoada: Fix regression in Root_Type -- adjustment
Bob Duff [Tue, 19 Aug 2025 16:22:38 +0000 (12:22 -0400)] 
ada: Fix regression in Root_Type -- adjustment

Recent changes "Fix regression in Root_Type" and
"Crash on b3a1004 with assertions enabled" are partially
redundant; they are addressing the same bug.
This patch adjusts the former in the case of Root_Type.
But we leave Root_Type_If_Set alone; debugging printouts
should survive bugs when possible.

gcc/ada/ChangeLog:

* einfo-utils.adb (Root_Type): Do not deal with missing Etype.

3 weeks agoada: Fix regression in Root_Type
Bob Duff [Mon, 18 Aug 2025 18:35:35 +0000 (14:35 -0400)] 
ada: Fix regression in Root_Type

Previous change, "Make pp and friends more robust (base type only)"
introduced a bug in Root_Type. Etype (T) can, in fact, be Empty
(but only in case of errors.) This patch fixes it.

gcc/ada/ChangeLog:

* einfo-utils.adb (Root_Type): Deal with missing Etype.
(Root_Type_If_Set): Likewise.

3 weeks agoada: Crash on b3a1004 with assertions enabled
Javier Miranda [Sun, 17 Aug 2025 09:45:31 +0000 (09:45 +0000)] 
ada: Crash on b3a1004 with assertions enabled

The compilation of files b3a10041.ads and b3a10042.adb crash when
the compiler is built with assertions enabled.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Entity): Protect call to Associated_Storage_Pool
since it cannot be used when the Etype is not set.
* sem_ch3.adb (Access_Type_Declaration): Ditto.
* sem_aux.adb (Is_Derived_Type): Protect call to Root_Type since it
cannot be used when the Etype is not set.

3 weeks agoada: Fix argument type of read() and write() on windows
Tonu Naks [Fri, 15 Aug 2025 10:04:27 +0000 (10:04 +0000)] 
ada: Fix argument type of read() and write() on windows

gcc/ada/ChangeLog:

* libgnat/s-crtl.ads: define unsigned
* libgnat/s-crtl__mingw.adb (read, write): change arg type

3 weeks agoada: Allow implicit packing of arrays when larger than needed
Bob Duff [Sun, 17 Aug 2025 15:23:23 +0000 (11:23 -0400)] 
ada: Allow implicit packing of arrays when larger than needed

For Implicit_Packing, do not require the Size clause to exactly match
the packed size.

For example, an array of 7 Booleans will fit in
7 bits if packed, or 7*8=56 bits if not packed.
This patch allows "for T'Size use 8;" to force packing
in Implicit_Packing mode; previously, the compiler
ignored Implicit_Packing unless it was exactly "use 7".

Apparently, customers have that sort of code, and the
whole point of Implicit_Packing is to allow such legacy
code to work.

We already do the right thing for records, at least in
cases tested.

We deliberately avoid changing the error messages given here.
They could possibly use some work, but there are subtle interactions
with the messages given in Sem_Ch13 for the same thing.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Entity): Change "=" to ">=" in
size comparison for Implicit_Packing mode.
Keep it as "=" for giving error messages.
* opt.ads (Implicit_Packing): Minor: correct obsolete
comment.

3 weeks agoada: Crash on null aggregate of multidimensional type
Javier Miranda [Fri, 15 Aug 2025 10:33:46 +0000 (10:33 +0000)] 
ada: Crash on null aggregate of multidimensional type

A compiler built with assertions enabled crashes processing
a null aggregate of multidimensional type.

gcc/ada/ChangeLog:

* sem_aggr.adb (Report_Null_Array_Constraint_Error): Adjust code
for reporting the error on enumeration types.
(Resolve_Null_Array_Aggregate): On multidimiensional arrays, avoid
reporting the same error several times. Flag the node as raising
constraint error when the bounds are known and some of them is
known to raise constraint error.

3 weeks agoada: Make pp and friends more robust (base type only)
Bob Duff [Fri, 15 Aug 2025 15:15:23 +0000 (11:15 -0400)] 
ada: Make pp and friends more robust (base type only)

Prior to this fix, if pp(N) tried to print a "base type only" field, and
Base_Type(N) was not yet set, it would raise an exception, which was
confusing. This patch makes it simply ignore such fields. Similarly
for Impl_Base_Type_Only and Root_Type_Only fields.

We do this by having alternative versions of Base_Type,
Implementation_Base_Type, and Root_Type that return Empty
in error cases, and call these alteratives from Treepr.
We don't want to Base_Type and friends to return Empty;
we want them to blow up when called from anywhere but
Treepr.

gcc/ada/ChangeLog:

* atree.ads (Node_To_Fetch_From_If_Set): Alternative to
Node_To_Fetch_From that returns Empty in error cases.
For use only in Treepr.
* treepr.adb (Print_Entity_Field): Avoid printing field
if Node_To_Fetch_From_If_Set returns Empty.
* einfo-utils.ads (Base_Type_If_Set): Alternative to
Base_Type that returns Empty in error cases.
(Implementation_Base_Type_If_Set): Likewise.
(Root_Type_If_Set): Likewise.
(Underlying_Type): Use more accurate result subtype.
* einfo-utils.adb (Base_Type): Add Asserts.
(Implementation_Base_Type): Add Assert; minor cleanup.
(Root_Type): Add Assert; minor cleanup. Remove Assert that
is redundant with predicate.
(Base_Type_If_Set): Body of new function.
(Implementation_Base_Type_If_Set): Body of new function.
(Root_Type_If_Set): Body of new function.

3 weeks agoada: Disable signals when calling pthread_create on QNX
Johannes Kliemann [Wed, 9 Jul 2025 15:40:55 +0000 (17:40 +0200)] 
ada: Disable signals when calling pthread_create on QNX

The QNX Certified Products Defect Notification from February 2025
mentions a potential memory leak when pthread_create is interrupted by a
signal. It recommends to disable signals for this function call.

gcc/ada/ChangeLog:

* adaint.c: Add functions to disable and enable signals on QNX.
* libgnarl/s-taprop__qnx.adb (Create_Task): Disable
signals when calling pthread_create.

3 weeks agoada: Refine condition for reporting warnings on components with abstract equality
Gary Dismukes [Thu, 14 Aug 2025 20:29:20 +0000 (20:29 +0000)] 
ada: Refine condition for reporting warnings on components with abstract equality

The initial implementation of the warning resulted in unwanted false
positives for types that have a user-defined equality function (in
which case abstract equality on components will typically not ever
be invoked).  The conditions for reporting the warning are refined
by this change to exclude checking for presence of abstract component
equality functions in the case where the containing type has a user-defined
equality.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Op_Eq): Test for absence of user-defined
equality on type being compared (for both array and record types)
as a condition for checking for abstract equality on component
types. Add a "???" comment about current limitations on issuing
the new warning.
(Warn_On_Abstract_Equality_For_Component): Remove temporary disabling
of the warning. Improve comment on declaration.

3 weeks agoada: Fix comments
Ronan Desplanques [Wed, 13 Aug 2025 09:13:07 +0000 (11:13 +0200)] 
ada: Fix comments

This patch fixes a reference to an Ada RM clause, fixes an occurrence of
"unconstrained" that should have been "indefinite", and removes an
incorrect claim that completing a partial view without discriminants
with a full view with defaulted discriminants is an error situation.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Discriminants, Process_Full_View): Fix
comments.

3 weeks agoada: Fix compile time evaluation needed for static unfoldings
Denis Mazzucato [Wed, 13 Aug 2025 15:14:35 +0000 (17:14 +0200)] 
ada: Fix compile time evaluation needed for static unfoldings

Unfolding of static expressions is needed when evaluating static bounds, even in
the presence of strict analysis. Otherwise, we may wrongly identify static
predicates as dynamic ones, and thus require unnecessary "others" default case.

gcc/ada/ChangeLog:

* sem_attr.adb (Eval_Attribute): Remove strict analysis condition.

3 weeks agoada: Better warning when single letter package conflicts with predefined unit naming
Denis Mazzucato [Tue, 12 Aug 2025 08:57:03 +0000 (10:57 +0200)] 
ada: Better warning when single letter package conflicts with predefined unit naming

This patch improves the warning message when the actual file name of a child
package with a single letter parent isn't the expected one because it may
collide with a predefined unit name. The warning explain why in this specific
case the expected name is not the standard one using the minus to separate
parents with children.

gcc/ada/ChangeLog:

* par-load.adb (Load): Better warning message.

3 weeks agoada: Set Related_Expression on compiler-generated Valid_Scalars functions
Tucker Taft [Mon, 11 Aug 2025 21:33:52 +0000 (21:33 +0000)] 
ada: Set Related_Expression on compiler-generated Valid_Scalars functions

When creating the local functions to implement the Valid_Scalars
attribute for array and record types, set a Related_Expression that
points to the original attribute reference (blah'Valid_Scalars).
This allows the Inspector to give a more user-friendly name
when these functions are called and they are known, for example,
to always return True.

gcc/ada/ChangeLog:

* exp_attr.adb
(Build_Array_VS_Func and Build_Record_VS_Func): Pass in the
Attr as the Related_Node parametr when calling
Make_Temporary for the Func_Id for the array and record
Valid_Scalars local functions.

3 weeks agoada: Improve documentation comment of Find_Type_Name
Ronan Desplanques [Fri, 8 Aug 2025 12:18:16 +0000 (14:18 +0200)] 
ada: Improve documentation comment of Find_Type_Name

The meaning of the return value of Find_Type_Name depends greatly on
whether the declaration it's passed is a completion. This patch adds a
description of this to the documentation comment of Find_Type_Name.

gcc/ada/ChangeLog:

* sem_ch3.ads (Find_Type_Name): Improve documentation comment.

3 weeks agoada: Disable new warning for composite equality ops that can raise Program_Error
Gary Dismukes [Tue, 12 Aug 2025 22:45:43 +0000 (22:45 +0000)] 
ada: Disable new warning for composite equality ops that can raise Program_Error

The new warning is spuriously flagged on membership tests in
vss-xml-implementation-html_writer_data.adb, leading to the GNAT CB
failing, so we disable it until that issue can be resolved.

gcc/ada/ChangeLog:

* exp_ch4.adb (Warn_On_Abstract_Equality_For_Component): Temporarily
disable warning.

3 weeks agolibstdc++: Tests of %W/%V/%U and %G for !ok date values.
Tomasz Kamiński [Wed, 10 Sep 2025 14:53:58 +0000 (16:53 +0200)] 
libstdc++: Tests of %W/%V/%U and %G for !ok date values.

libstdc++-v3/ChangeLog:

* testsuite/std/time/year_month_day/io.cc: Additional tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agoRISC-V: Add min/max patterns for ifcvt.
Robin Dapp [Fri, 31 May 2024 12:28:00 +0000 (14:28 +0200)] 
RISC-V: Add min/max patterns for ifcvt.

ifcvt likes to emit

(set
  (if_then_else)
    (ge (reg 1) (reg2))
    (reg 1)
    (reg 2))

which can be recognized as min/max patterns in the backend.
This patch adds such patterns and the respective iterators as well as a
test.

gcc/ChangeLog:

* config/riscv/bitmanip.md (*<bitmanip_minmax_cmp_insn>_cmp_<mode>3):
New min/max ifcvt pattern.
* config/riscv/iterators.md (minu): New iterator.
* config/riscv/riscv.cc (riscv_noce_conversion_profitable_p):
Remove riscv-specific adjustment.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zbb-min-max-04.c: New test.

3 weeks agoifcvt: Clarify if_info.original_cost.
Robin Dapp [Tue, 9 Sep 2025 14:15:48 +0000 (16:15 +0200)] 
ifcvt: Clarify if_info.original_cost.

Before noce_find_if_block processes a block it sets up an if_info
structure that holds the original costs.  At that point the costs of
the then/else blocks have not been added so we only care about the
"if" cost.

The code originally used BRANCH_COST for that but was then changed
to COST_N_INSNS (2) - a compare and a jump.

This patch computes the jump costs via
  insn_cost (if_info.jump, ...)
under the assumption that the target takes BRANCH_COST into account
when costing a jump instruction.

In noce_convert_multiple_sets we keep track of the need for the initial
CC comparison.  If needed for the generated sequence we add its
cost in default_noce_conversion_profitable_p.

gcc/ChangeLog:

* ifcvt.cc (noce_convert_multiple_sets_1): Add use_cond_earliest
param.
(noce_convert_multiple_sets): Set use_cond_earliest.
(noce_process_if_block): Just use original cost.
(noce_find_if_block): Use insn_cost (jump_insn).

gcc/testsuite/ChangeLog:

* gcc.target/riscv/addsieq.c: Remove xfail and expect conversion
through noce_convert_multiple_sets.
* gcc.target/riscv/addsifeq.c: Ditto.
* gcc.target/riscv/addsifge.c: Ditto.
* gcc.target/riscv/addsifgt.c: Ditto.
* gcc.target/riscv/addsifle.c: Ditto.
* gcc.target/riscv/addsiflt.c: Ditto.
* gcc.target/riscv/addsifne.c: Ditto.
* gcc.target/riscv/addsige.c: Ditto.
* gcc.target/riscv/addsigeu.c: Ditto.
* gcc.target/riscv/addsigt.c: Ditto.
* gcc.target/riscv/addsigtu.c: Ditto.
* gcc.target/riscv/addsile.c: Ditto.
* gcc.target/riscv/addsileu.c: Ditto.
* gcc.target/riscv/addsilt.c: Ditto.
* gcc.target/riscv/addsiltu.c: Ditto.

3 weeks agotestsuite: Fix asm-hard-reg-error-{4,5}.c for non-LRA targets
Stefan Schulze Frielinghaus [Thu, 11 Sep 2025 08:04:04 +0000 (10:04 +0200)] 
testsuite: Fix asm-hard-reg-error-{4,5}.c for non-LRA targets

Hard register constraints are only supported for LRA and not old reload.
Targets hppa, m68k, pdp11, rx, sh, vax do not default to LRA which is
why these tests fail there.  Limit the tests to LRA targets, although,
this means that currently on these targets the tests are skipped by
default.  Since the tests are about general logic, the extra coverage we
loose by skipping these targets is negligible.

For hppa, register 0 cannot be used as a general register.  Therefore,
use temporary registers r20 and r21 instead.  Likewise, for AVR use r20
and r24 instead.

gcc/testsuite/ChangeLog:

* gcc.dg/asm-hard-reg-error-4.c: Limit the test to LRA targets.
Use registers r20 and r21 for hppa.  Likewise, for AVR use r20
and r24 instead.
* gcc.dg/asm-hard-reg-error-5.c: Ditto.

3 weeks agoRISC-V: Fix can_find_related_mode_p for VLS types
Kito Cheng [Thu, 14 Aug 2025 13:29:38 +0000 (21:29 +0800)] 
RISC-V: Fix can_find_related_mode_p for VLS types

can_find_related_mode_p incorrectly handled VLS (Vector Length Specific)
types by using TARGET_MIN_VLEN directly, which is in bits, instead of
converting it to bytes as required.

This patch fixes the issue by dividing TARGET_MIN_VLEN by 8 to convert
from bits to bytes when calculating the number of units for VLS modes.

The fix enables proper vectorization for several test cases:
- zve32f-1.c: Now correctly finds vector mode for SF mode in foo3,
  enabling vectorization of an additional loop.
- zve32f_zvl256b-1.c and zve32x_zvl256b-1.c: Added -mrvv-max-lmul=m2
  option to handle V8SI[2] (vector array mode) requirements during
  vectorizer analysis, which needs V16SI to pass, and V16SI was enabled
  incorrectly before.

Changes since V4:
- Fix testsuite, also triaged why changed.

gcc/ChangeLog:

* config/riscv/riscv-selftests.cc (riscv_run_selftests): Call
run_vectorize_related_mode_selftests.
(test_vectorize_related_mode): New function to test
vectorize_related_mode behavior.
(run_vectorize_related_mode_selftests): New function to run all
vectorize_related_mode tests.
(run_vectorize_related_mode_vla_selftests): New function to test
VLA modes.
(run_vectorize_related_mode_vls_rv64gcv_selftests): New function to
test VLS modes on rv64gcv.
(run_vectorize_related_mode_vls_rv32gc_zve32x_zvl256b_selftests):
New function to test VLS modes on rv32gc_zve32x_zvl256b.
(run_vectorize_related_mode_vls_selftests): New function to run all
VLS mode tests.
* config/riscv/riscv-v.cc (can_find_related_mode_p): Fix VLS type
handling by converting TARGET_MIN_VLEN from bits to bytes.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/zve32f-1.c: Update expected
vectorization count from 2 to 3.
* gcc.target/riscv/rvv/autovec/zve32f_zvl256b-1.c: Add
-mrvv-max-lmul=m2 option.
* gcc.target/riscv/rvv/autovec/zve32x_zvl256b-1.c: Add
-mrvv-max-lmul=m2 option.

3 weeks agoLoongArch: testsuite: Modify the tests to make the test pass.
Lulu Cheng [Wed, 10 Sep 2025 07:30:45 +0000 (15:30 +0800)] 
LoongArch: testsuite: Modify the tests to make the test pass.

Committing r16-3673 cause the test cases in the list to fail.
Make the test pass by modifying the test case or adding compilation
options.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/cmodel-extreme-1.c: Add -fPIC.
* gcc.target/loongarch/cmodel-extreme-2.c: Likewise.
* gcc.target/loongarch/tls-gd-noplt.c: Likewise.
* gcc.target/loongarch/tls-extreme-macro.c: Likewise.
* gcc.target/loongarch/func-call-medium-2.c: Modify.
* gcc.target/loongarch/func-call-medium-3.c: Modify.
* gcc.target/loongarch/func-call-medium-4.c: Removed.

3 weeks agoDaily bump.
GCC Administrator [Thu, 11 Sep 2025 00:20:14 +0000 (00:20 +0000)] 
Daily bump.

3 weeks agolibstdc++: Remove blank line from bits/unique_ptr.h
Jonathan Wakely [Mon, 8 Sep 2025 11:55:03 +0000 (12:55 +0100)] 
libstdc++: Remove blank line from bits/unique_ptr.h

libstdc++-v3/ChangeLog:

* include/bits/unique_ptr.h: Remove blank line.

3 weeks agolibstdc++: Enforce Mandates: for Boyer-Moore searchers
Jonathan Wakely [Fri, 5 Sep 2025 10:44:57 +0000 (11:44 +0100)] 
libstdc++: Enforce Mandates: for Boyer-Moore searchers

C++17 has a 'Requires:' precondition that the two random access iterator
types have the same value type. In C++20 that is a 'Mandates:'
requirement which we must diagnose.

Although we could diagnose it in C++17, that might be a breaking change
for any users relying on it today. Also I am lazy and wanted to use
C++20's std::iter_value_t for the checks. So this only enforces the
requirement for C++20 and later.

libstdc++-v3/ChangeLog:

* include/std/functional (boyer_moore_searcher::operator()): Add
static_assert.
(boyer_moore_horspool_searcher::operator()): Likewise.
* testsuite/20_util/function_objects/121782.cc: New test.

3 weeks agoc: Add tests for some C2Y removals of undefined behavior
Joseph Myers [Wed, 10 Sep 2025 20:48:05 +0000 (20:48 +0000)] 
c: Add tests for some C2Y removals of undefined behavior

C2Y removes various instances of undefined behavior, typically making
them either constraint violations or implementation-defined.

In many but not all such cases, GCC's existing behavior is compatible
with the C2Y changes.  For an initial batch of such cases, add
explicit tests for how GCC behaves in C2Y mode; more such cases will
need tests added in future patches, and there are also some such
changes that will need changes to how GCC behaves, not just new tests.
(Some of the individual examples in these tests may have been
constraint violations even before C2Y.)

Tested for x86_64-pc-linux-gnu.

* gcc.dg/c2y-function-qual-1.c, gcc.dg/c2y-incomplete-1.c,
gcc.dg/c2y-inline-1.c, gcc.dg/c2y-pointer-1.c,
gcc.dg/c2y-register-array-1.c, gcc.dg/c2y-storage-class-1.c,
gcc.dg/c2y-struct-empty-1.c: New tests.

3 weeks agoAVR: Disable tree-switch-conversion per default.
Georg-Johann Lay [Sat, 6 Sep 2025 11:38:48 +0000 (13:38 +0200)] 
AVR: Disable tree-switch-conversion per default.

There are at least two cases where tree-switch-conversion leads
to unpleasant resource allocation:

PR49857
    The lookup table lives in RAM.  This is the case for all
    devices that locate .rodata in RAM, which is for almost
    all AVR devices.

PR81540
    Code is bloated for 64-bit inputs.

As far as PR49857 is concerned, a target hook that may add an
address-space qualifier to the lookup table is the obvious
solution, though a respective patch has always been rejected by
global maintainers for non-technical reasons.

gcc/
PR target/81540
PR target/49857
* common/config/avr/avr-common.cc: Disable -ftree-switch-conversion.

3 weeks agoxtensa: Correct a typo
Takayuki 'January June' Suwa [Tue, 9 Sep 2025 14:36:44 +0000 (23:36 +0900)] 
xtensa: Correct a typo

That was introduced in commit 42db504c2fb2b460e24ca0e73b8559fc33b3cf33,
over 15 years ago!

gcc/ChangeLog:

* config/xtensa/xtensa.h (TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P):
Change "Xtrnase" in the comment to "Xtensa".

3 weeks agoRISC-V: Fix typo in tt-ascalon-d8's pipeline description [PR121878]
Peter Bergner [Tue, 9 Sep 2025 19:43:28 +0000 (14:43 -0500)] 
RISC-V: Fix typo in tt-ascalon-d8's pipeline description [PR121878]

PR121878 shows a typo in the tt-ascalon-d8's pipeline description that
leads to an ICE.  The problem is that the vector define_insn_reservation
patterns test for scalar modes rather than vector modes, meaning the
insns don't get handled correctly.  We could correct the modes, but given
we could have multiple VLEN values, the number of modes we'd have to check
can be large and mode iterators are not allowed in the mode attribute check.
Instead, I've removed the mode check and replaced it with a test of the
Selected Elenent Width (SEW).

2025-09-09  Peter Bergner  <bergner@tenstorrent.com>

gcc/
PR target/121878
* config/riscv/tt-ascalon-d8.md (tt_ascalon_d8_vec_idiv_half): Test the
Selected Element Width (SEW) rather than the mode.
(tt_ascalon_d8_vec_idiv_single): Likewise.
(tt_ascalon_d8_vec_idiv_double): Likewise.
(tt_ascalon_d8_vec_float_divsqrt_half): Likewise.
(tt_ascalon_d8_vec_float_divsqrt_single): Likewise.
(tt_ascalon_d8_vec_float_divsqrt_double): Likewise.

gcc/testsuite/
PR target/121878
* gcc.target/riscv/pr121878.c: New test.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
3 weeks agoFix -Wlto-type-mismatch warning during GNAT LTO build
Eric Botcazou [Wed, 10 Sep 2025 13:00:59 +0000 (15:00 +0200)] 
Fix -Wlto-type-mismatch warning during GNAT LTO build

The recent addition of Pragma_Unsigned_Base_Range to the enumeration type
Pragma_Id has made it exceed 256 enumeration values and thus overflow the
unsigned 8-bit type used for it on the C side.  This should have stopped
the build, except that a glitch in the Snames machinery causes one value
to be dropped on the C side, leaving it at just 256 enumeration values.

This fixes both issues, i.e. ensures that the number of enumeration values
is the same on both sides and bumps the size of the C type to 16 bits.

gcc/ada/
PR ada/121885
* snames.ads-tmpl (Pragma_Id): Rename Unknown_Pragma to
Pragma_Unknown for the sake of XSnamesT.
* snames.adb-tmpl (Get_Pragma_Id): Adjust to above renaming.
* snames.h-tmpl (Attribute_Id): Change underlying type to Byte.
(Get_Attribute_Id): Use Byte as return value.
(Pragma_Id): Change underlying type to Word.
(Get_Pragma_Id): Use Word as return value.
* types.h (Word): New typedef.
* exp_prag.adb (Expand_N_Pragma): Remove useless comment.
* par-prag.adb (Prag): Adjust to above renaming.
* sem_prag.adb (Analyze_Pragma): Likewise.
(Sig_Flags): Likewise.

3 weeks agoFix load/store bias handling for extractlast.
Juergen Christ [Mon, 1 Sep 2025 09:29:45 +0000 (11:29 +0200)] 
Fix load/store bias handling for extractlast.

The length returned by vect_get_loop_len is REALLEN + BIAS, but was
assumed to be REALLEN - BIAS.  If BIAS is -1, this leads to wrong
code.

gcc/ChangeLog:

* tree-vect-loop.cc (vectorizable_live_operation_1): Fix
load/store bias handling.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/nodump-extractlast-1.c: New test.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
3 weeks agoc: Warn when returning nested functions that require a non-local context.
Martin Uecker [Mon, 28 Jul 2025 23:05:00 +0000 (01:05 +0200)] 
c: Warn when returning nested functions that require a non-local context.

This patch adds a mechanism to keep track whether nested functions require
non-local context because they reference a variable of an enclosing
scope.  This is used for extending the existing -Wreturn-address warning
to also warn for such nested functions.  Certain exceptions are implemented
for functions that do not requite a non-local context, because they reference
only static variables, named constants, non-local variables in unevaluated
sizeof, typeof or countof operators, or typedef.  The logic is based on the
existing infrastructure for determining use of undeclared static functions.
Finally, To make sure that no trampolines are generated even when not using
optimization, we mark the exempt functions with TREE_NO_TRAMPOLINE.

gcc/c/ChangeLog:
* c-tree.h: Add new macro C_DECL_NONLOCAL_CONTEXT and prototype
for mark_decl_used.
* c-typeck.cc (mark_decl_used): New function.
(function_to_pointer_conversion): Mark exempt functions.
(record_maybe_used_decl): Add `address' parameter.
(build_external_ref): Change to mark_decl_used.
(pop_maybe_used): Call mark_decl_used.
(c_mark_addressable): Ditto.
(c_finish_goto_label): Ditto.
(c_finish_return): Add warning.
* c-decl.cc (declspecs_add_type): Ditto.
(grokdeclarator): Don't set C_DECL_REGISTER on function
declarators.

gcc/testsuite/ChangeLog:
* gcc.dg/Wreturn-nested-1.c: New test.
* gcc.dg/Wreturn-nested-2.c: New test.
* gcc.dg/Wtrampolines-2.c: New test.
* gcc.dg/Wtrampolines-3.c: New test.

3 weeks agoRISC-V: Add pattern for vector-scalar single widening floating-point sub
Paul-Antoine Arras [Wed, 10 Sep 2025 08:47:36 +0000 (10:47 +0200)] 
RISC-V: Add pattern for vector-scalar single widening floating-point sub

This pattern enables the combine pass (or late-combine, depending on the case)
to merge a float_extend'ed vec_duplicate into a minus RTL instruction. The other
minus operand is already wide.

Before this patch, we have four instructions, e.g.:
  fcvt.d.s        fa0,fa0
  vsetvli         a5,zero,e64,m1,ta,ma
  vfmv.v.f        v2,fa0
  vfsub.vv        v1,v1,v2

After, we get only one:
  vfwsub.wf       v1,v1,fa0

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*vfwsub_wf_<mode>): New pattern to
combine float_extend + vec_duplicate + vfsub.vv into vfwsub.wf.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwsub.wf.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_binop.h
(DEF_VF_BINOP_WIDEN_CASE_2, DEF_VF_BINOP_WIDEN_CASE_3): Swap operands.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-2-f16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-2-f32.c: New test.

3 weeks agocompare_tests: Improve non-unique tests report
Christophe Lyon [Wed, 10 Sep 2025 09:41:28 +0000 (09:41 +0000)] 
compare_tests: Improve non-unique tests report

If the results include several configurations (schedule of
variations), do not report summary lines as duplicates.  Indeed with
several configurations, it's likely that the results contain the same

   # of expected passes            XXXXX

The patch just keeps lines starting with test state prefix to avoid
this problem.

contrib/ChangeLog:

* compare_tests: Improve non-unique tests report when testing
several configurations.

3 weeks agoc++: Fix null deref in maybe_diagnose_standard_trait [PR121859]
Nathaniel Shead [Tue, 9 Sep 2025 23:59:23 +0000 (09:59 +1000)] 
c++: Fix null deref in maybe_diagnose_standard_trait [PR121859]

A static member template doesn't always have a DECL_INITIAL, as in the
below testcase, and so checking its TREE_CODE performs a null-pointer
dereference.  I don't think we need to specially detect this case as
traits we care about are unlikely to be members, so this just adds the
missing null check.

PR c++/121859

gcc/cp/ChangeLog:

* constraint.cc (maybe_diagnose_standard_trait): Check if expr
is non-null.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-traits5.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
3 weeks agolibstdc++: Rename _S-prefixed identifiers in <mdspan>.
Luc Grosheintz [Wed, 10 Sep 2025 10:10:29 +0000 (12:10 +0200)] 
libstdc++: Rename _S-prefixed identifiers in <mdspan>.

In libstdc++ the prefix _S is used for static members only. In <mdspan>
there's several type aliases that also used the prefix _S. They now use
a single leading underscore follow by a capital letter instead.

libstdc++-v3/ChangeLog:

* include/std/mdspan (_ExtentsStorage::_Base): New name for
_S_base.
(_ExtentsStorage::_Storage): New name for _S_storage.
(extents::_Storage): New name for _S_storage.
(layout_stride::mapping::_Strides): New name for
_S_stries_t.
* testsuite/23_containers/mdspan/class_mandate_neg.cc: Update
test to the new error message.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
3 weeks agolibstdc++: Apply LWG4351 to CTAD of span/mdspan.
Luc Grosheintz [Sat, 6 Sep 2025 13:11:57 +0000 (15:11 +0200)] 
libstdc++: Apply LWG4351 to CTAD of span/mdspan.

The concept __integral_constant_like doesn't consider traits with a
boolean member `value` as an integer constant. This is done to reject
various completely unrelated traits like is_const, is_abstract, etc.

LWG4351 adjusts the check to strip references and cv qualifiers before
checking if `value` is bool. The immediate context is constant_wrapper
which defines:

    template<...>
    struct constant_wrapper
    {
      static constexpr const auto& value = ...;
    };

Without LWG4351, std::cw<true> and std::cw<false> would both be
considered integer constants (by __integral_constant_like); but both
std::{true,false}_type are not considered integer constants. Hence,
LWG4351 removes inconsistent behaviour between std::integral_constant
and std::constant_wrapper.

libstdc++-v3/ChangeLog:

* include/std/span (__integral_constant_like): Use
remove_cvref_t before checking if _Tp::value is boolean.
* testsuite/23_containers/mdspan/extents/misc.cc: Update test.
* testsuite/23_containers/mdspan/mdspan.cc: Ditto.
* testsuite/23_containers/span/deduction.cc: Ditto.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
3 weeks agotestsuite: Only scan for known file extensions in lto.exp
Jakub Jelinek [Wed, 10 Sep 2025 10:39:11 +0000 (12:39 +0200)] 
testsuite: Only scan for known file extensions in lto.exp

This is something that has bothered me for a few years but I've only found
time for it now.
The glob used for finding *_1.* etc. counterparts to the *_0.* tests is too
broad, so if one has say next to *_1.c file also *_1.c~ or *_1.c.~1~
or *_1.c.orig or *_1.c.bak etc. files, lto.exp will report a warning and the
test will fail.
So, e.g. in rpm build if some backported commit in patch form adds some
gcc/testsuite/*.dg/lto/ test and one uses -b option to patch, if one doesn't
remove the backup files, the test will fail.

Looking through all the *.dg/lto/ directories, I only see c, C, ii, f, f90
and d extensions used right now for the *_1.* files (and higher), while for
the *_0.* files also m, mm and f03 extensions are used.

So, the following patch only searches for those (plus for Fortran uses the
extensions searched by the gfortran.dg/lto/ driver, i.e. \[fF\]{,90,95,03,08}
, not just f, f90 and f03).

Tested on x86_64-linux and verified I got exactly the same number of
grep '^Executing.on.host.*_[1-9]\.' testsuite/*/*.log
before/after this patch when doing make check RUNTESTFLAGS=lto.exp
except for 2 new ones which were previously failed because I had backup
files for 2 tests.

2025-09-10  Jakub Jelinek  <jakub@redhat.com>

* lib/lto.exp (lto-execute-1): Search for _1.* etc. files
only with a list of known extensions.

3 weeks agobitint: Fix up lowering optimization of .*_OVERFLOW ifns [PR121828]
Jakub Jelinek [Wed, 10 Sep 2025 10:34:50 +0000 (12:34 +0200)] 
bitint: Fix up lowering optimization of .*_OVERFLOW ifns [PR121828]

THe lowering of .{ADD,SUB,MUL}_OVERFLOW ifns is optimized, so that we don't
in the common cases uselessly don't create a large _Complex _BitInt
temporary with the first (real) part being the result and second (imag) part
just being a huge 0 or 1, although we still do that if it can't be done.
The optimizable_arith_overflow function checks when that is possible, like
whether the ifn result is used at most twice, once in REALPART_EXPR and once
in IMAGPART_EXPR in the same bb, etc.  For IMAGPART_EXPR it then checks
if it has a single use which is a cast to some integral non-bitint type
(usually bool or int etc.).  The final check is whether that cast stmt
appears after the REALPART_EXPR (the usual case), in that case it is
optimizable, otherwise it is not (because the lowering for optimizable
ifns of this kind is done at the location of the REALPART_EXPR and it
tweaks the IMAGPART_EXPR cast location at that point, so otherwise it
would be set after use.

Now, we also have an optimization for the REALPART_EXPR lhs being used
in a single stmt - store in the same bb, in that case we don't have to
store the real part result in a temporary but it can go directly into
memory.
Except that nothing checks for the IMAGPART_EXPR cast being before or after
the store in this case, so the following testcase ICEs because we have
a use before a def stmt.

In bar (the function handled right already before this patch) we have
  _6 = .SUB_OVERFLOW (y_4(D), x_5(D));
  _1 = REALPART_EXPR <_6>;
  _2 = IMAGPART_EXPR <_6>;
  a = _1;
  _3 = (int) _2;
  baz (_3);
before the lowering, so we can just store the limbs of the .SUB_OVERFLOW
into the limbs of a variable and while doing that compute the value we
eventually store into _3 instead of the former a = _1; stmt.
In foo we have
  _5 = .SUB_OVERFLOW (y_3(D), x_4(D));
  _1 = REALPART_EXPR <_5>;
  _2 = IMAGPART_EXPR <_5>;
  t_6 = (int) _2;
  baz (t_6);
  a = _1;
and we can't do that because the lowering would be at the a = _1; stmt
and would try to set t_6 to the overflow flag at that point.  We don't
need to punt completely and mark _5 as _Complex _BitInt VAR_DECL though
in this case, all we need is not merge the a = _1; store with the
.SUB_OVERFLOW and REALPART_EXPR/IMAGPART_EXPR lowering.  So, add _1
to m_names and lower the first 3 stmts at the _1 = REALPART_EXPR <_5>;
location, optimizable_arith_overflow returned non-zero and so the
cast after IMAGPART_EXPR was after it and then a = _1; will copy from
the temporary VAR_DECL to memory.

2025-09-10  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/121828
* gimple-lower-bitint.cc (gimple_lower_bitint): For REALPART_EXPR
consumed by store in the same bb and with REALPART_EXPR from
optimizable_arith_overflow, don't add REALPART_EXPR lhs to
the m_names bitmap only if the cast from IMAGPART_EXPR doesn't
appear in between the REALPART_EXPR and the store.

* gcc.dg/bitint-126.c: New test.

3 weeks agoexpr: Handle RAW_DATA_CST in store_constructor [PR121831]
Jakub Jelinek [Wed, 10 Sep 2025 10:33:14 +0000 (12:33 +0200)] 
expr: Handle RAW_DATA_CST in store_constructor [PR121831]

I thought this wouldn't be necessary because RAW_DATA_CST can only appear
inside of (array) CONSTRUCTORs within DECL_INITIAL of TREE_STATIC vars,
so there shouldn't be a need to expand it.  Except that we have an
optimization when reading ARRAY_REF from such a CONSTRUCTOR which will
try to expand the constructor if it either can be stored by pieces
(I think that is just fine) or if it is mostly zeros (which is at least
75% of the initializer zeros).  Now the second case is I think in some
cases desirable (say 256MB initializer and just 20 elements out of that
non-zero, so clear everything and store 20 elements must be fastest and
short), but could be really bad as well (say 40GB initializer with
10GB non-zero in it, especially if it doesn't result in the original
variable being optimized away).  Maybe it would help if expand_constructor
and store_constructor* etc. had some optional argument with addresses into
the original VAR_DECL so that it could be copying larger amounts of data
like larger RAW_DATA_CSTs from there instead of pushing those into new
.rodata again.  And another problem is that we apparently expand the
initializes twice, expand_constructor in store_constructor can expand
the stores one and if expand_constructor returns non-NULL, we then
expand_expr the CONSTRUCTOR again. to the same location.

This patch doesn't address either of those issues, just adds RAW_DATA_CST
support to store_constructor for now.  For the can_store_by_pieces
cases it stores those by pieces using a new callback very similar to
string_cst_read_str, for the rest (unfortunately) forces it into a memory
and copies from there.

2025-09-10  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/121831
* expr.cc (raw_data_cst_read_str): New function.
(store_constructor) <case ARRAY_TYPE>: Handle RAW_DATA_CST.

* g++.dg/lto/pr121831_0.C: New test.
* g++.dg/lto/pr121831_1.C: New test.

3 weeks agolibstdc++: Use _Drop_iter<_CharT> for formattable concept checking [PR121765]
Tomasz Kamiński [Thu, 4 Sep 2025 11:58:23 +0000 (13:58 +0200)] 
libstdc++: Use _Drop_iter<_CharT> for formattable concept checking [PR121765]

When producing output, the libstdc++ format implementation only uses _Sink_iter
specializations. Since users cannot construct basic_format_context, this is the
only iterator type actually used. The __format_padded helper relies on this
property to efficiently pad sequences from tuples and ranges.

However, the standard's formattable concept requires a generic format function
in formatters that works with any iterator type. This is intended to
future-proof the implementation by allowing new format_context types. Previously,
libstdc++ used back_insert_iterator<basic_string<_CharT>> for this purpose.

Normally, concept checks only instantiate function signatures, but with
user-defined formatters and deduced return types, the function body and all
called functions are instantiated. This could trigger a static assertion error
in the range/tuple formatter that assumed the iterator was a _Sink_iter
(see included test).

This patch resolves the issue by replacing the _Iter_for_t alias with the
internal _Drop_iter. This iterator's sematnics is to drop elements, so
__format_padded can handle it by simply returning the input iterator, which
still produces the required behavior [1].

An alternative of using _Sink_iter was considered but rejected because it would
allow formatters to pass formattable requirements while only supporting
format_context and wformat_context, which seems counter to the design intent
(the std/format/formatter/concept.cc fails).

[1] The standard's wording defines format functions as producing an output
representation, but does not explicitly require a formatter to be invoked
for each element. This allows the use of _Drop_iter to pass the concept check
without generating any output.

PR libstdc++/121765

libstdc++-v3/ChangeLog:

* include/std/format (__format::_Drop_iter): Define.
(_Iter_for_t::type): Change alias to _Drop_iter.
(__format::__format_padded): Return __fc.out() for
_Drop_iter.
* testsuite/std/format/pr121765.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agos390: Implement clz and ctz for SI mode
Juergen Christ [Thu, 28 Aug 2025 13:48:31 +0000 (15:48 +0200)] 
s390: Implement clz and ctz for SI mode

To properly implement __builtin_ffs for SI mode, implement clz and
(for >= z17) ctz for SI mode.  Otherwise, gcc falls back to a libcall
which causes problems for Linux kernel code.

Also adjust the C?Z_DEFINED_VALUE_AT_ZERO macros to return 2.  Since
the optabs now return exactly the value set by these macros, return
value 2 is more appropriate and leads to better code.

gcc/ChangeLog:

* config/s390/s390.h (CLZ_DEFINED_VALUE_AT_ZERO): Adjust and
return 2.
(CTZ_DEFINED_VALUE_AT_ZERO): Return 2.
* config/s390/s390.md (clzsi2): Implement.
(ctzsi2): Implement.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr109011-2.c: Fix expected outcome.
* gcc.dg/vect/pr109011-4.c: Fix expected outcome.
* gcc.target/s390/ffs-1.c: New test.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
3 weeks agoc++: Change mangling of Intel/Motorola extended long double literals
Jakub Jelinek [Wed, 10 Sep 2025 08:48:31 +0000 (10:48 +0200)] 
c++: Change mangling of Intel/Motorola extended long double literals

On Fri, Sep 05, 2025 at 09:57:06PM +0200, Matthias Kretz wrote:
> > Hmm, would this fail for x86 long double, which is 80 bits? OK, just
> > checked. It's mangled as 12/16 bytes on i686/x86_64.
>
> It seems that Clang and GCC disagree on mangling 80-Bit long double:
>
> I like Clang's interpretation of https://itanium-cxx-abi.github.io/cxx-abi/
> abi.html#mangle.float better.

This patch changes the mangling of 80-bit long double literals from
24 or 32 digits (on m68k with padding bits in the middle, on x86
at the start) to just 20 hex digits.

2025-09-10  Jakub Jelinek  <jakub@redhat.com>

* mangle.cc (write_real_cst): Mangle Intel/Motorola extended
80-bit formats using 20 hex digits instead of 24 or 32.

* g++.target/i386/mangle-ldbl-1.C: New test.
* g++.target/i386/mangle-ldbl-2.C: New test.
* g++.target/m68k/mangle-ldbl-1.C: New test.
* g++.target/m68k/mangle-ldbl-2.C: New test.

3 weeks agos390: fix vec_extract_plus define insn
Maximilian Immanuel Brandtner [Tue, 9 Sep 2025 14:21:14 +0000 (16:21 +0200)] 
s390: fix vec_extract_plus define insn

Because of a wrong define_insn for vec_extract_plus a vector access wasn't
combined with a preceeding plus operation which set the offset at which
to perform the vector access even though the instruction offers that capability.

Bootstrapped and regtested on s390x.

gcc/ChangeLog:

* config/s390/vector.md (*vec_extract<mode>_plus_zero_extend):
Fix define insn.

gcc/testsuite/ChangeLog:

* gcc.target/s390/vector/vec-extract-3.c: New test.

Signed-off-by: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
3 weeks agolibstdc++: Document remaining C++20 implementation-defined behavior.
Tomasz Kamiński [Mon, 8 Sep 2025 11:33:57 +0000 (13:33 +0200)] 
libstdc++: Document remaining C++20 implementation-defined behavior.

I have double checked that implementation-defined behavior in the [compliance]
(whether the implementation is freestanding) and [stringbuf.const] (initialization
of sequence pointers) are indeed null, and there are no corresponding entires in
earlier standards.

libstdc++-v3/ChangeLog:

* doc/html/manual/status.html: Regenerate.
* doc/xml/manual/status_cxx2020.xml: Add more entires.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Document C++20 atomic_ref implementation-defined behavior.
Tomasz Kamiński [Mon, 8 Sep 2025 09:08:09 +0000 (11:08 +0200)] 
libstdc++: Document C++20 atomic_ref implementation-defined behavior.

Also introduce Implementation Specific Behavior section for C++20.

libstdc++-v3/ChangeLog:

* doc/html/index.html: Regenerated.
* doc/html/manual/index.html: Regenerated.
* doc/html/manual/intro.html: Regenerated.
* doc/html/manual/status.html: Regenatered.
* doc/xml/manual/status_cxx2020.xml: Add iso.2020.specific
section with atomic_ref documentation.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agoDaily bump.
GCC Administrator [Wed, 10 Sep 2025 00:22:24 +0000 (00:22 +0000)] 
Daily bump.

3 weeks agoc++/modules: Cleanup import handling [PR99682]
Nathaniel Shead [Tue, 9 Sep 2025 14:28:36 +0000 (00:28 +1000)] 
c++/modules: Cleanup import handling [PR99682]

This patch fixes some issues with import handling.

The main functional change is to allow importing a module's interface
file into its implementation file indirectly.  [module.import] p9
forbids an explicit 'import M;' declaration, but there's no provision
against having 'import X;' where module X itself imports M, so this
patch splits up the detection of circular imports to handle this better.
I also updated the errors to be closer to the standard wording.

A second issue I found while testing this is that we don't properly
handle name visibility when a partition implementation unit imports its
primary module interface (g++.dg/modules/part-10).  This is resolved by
setting 'module_p' on the primary interface when it gets imported.

Solving this I incidentally removed the assertion that PR121808 was
failing on, which was never valid: we can enter import_module for a
module previously seen as a module-declaration if parsing bails before
declare_module is called.  I experimented with guaranteeing that
declare_module always gets called for a module_state generated during
preprocessing if at all possible, but the resulting errors didn't seem a
lot better so I've left it as-is for now.

I did make a small adjustment so that a direct import of a module
doesn't overwrite the location of a module-declaration from earlier in
the file; this is important because preprocessing (and thus the
assigning of these locations) seems to happen for the whole file before
parsing begins, which can otherwise cause confusing locations referring
to later in the file than parsing would otherwise indicate.

PR c++/99682
PR c++/121808

gcc/cp/ChangeLog:

* module.cc (class module_state): Add comment to 'parent'.
(module_state::check_not_purview): Rename to...
(module_state::check_circular_import): ...this.  Only handle
interface dependencies, adjust diagnostic message.
(module_state::read_imports): Use new function.  Pass location
of import as from_loc instead of the module location.
(module_state::do_import): Set module_p when importing the
primary interface for the current module.
(import_module): Split out check for imports in own unit.
Remove incorrect assertion.
(preprocess_module): Don't overwrite module-decl location with
later import.

gcc/testsuite/ChangeLog:

* g++.dg/modules/circ-1_c.C: Adjust diagnostic.
* g++.dg/modules/mod-decl-1.C: Likewise.
* g++.dg/modules/mod-decl-2_b.C: Likewise.
* g++.dg/modules/pr99174.H: Likewise.
* g++.dg/modules/import-3_a.C: New test.
* g++.dg/modules/import-3_b.C: New test.
* g++.dg/modules/import-3_c.C: New test.
* g++.dg/modules/mod-decl-9.C: New test.
* g++.dg/modules/part-10_a.C: New test.
* g++.dg/modules/part-10_b.C: New test.
* g++.dg/modules/part-10_c.C: New test.
* g++.dg/modules/part-10_d.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 weeks agoc++/modules: Create helper to get current TU's module_state
Nathaniel Shead [Tue, 9 Sep 2025 14:26:46 +0000 (00:26 +1000)] 
c++/modules: Create helper to get current TU's module_state

A lot of places use (*modules)[0] to refer to the module state for the
current TU.  This is a bit awkward to type and not particularly clear
what it represents; make a helper function to clarify it.

gcc/cp/ChangeLog:

* module.cc (this_module): New function.
(import_entity_module): Use it.
(trees_out::decl_node): Likewise.
(get_module): Likewise.
(module_state::check_not_purview): Likewise.
(module_state::read_imports): Likewise.
(module_state::read_using_directives): Likewise.
(module_state::read_initial): Likewise.
(get_import_bitmap): Likewise.
(module_may_redeclare): Likewise.
(direct_import): Likewise.
(declare_module): Likewise.
(name_pending_imports): Likewise.
(preprocess_module): Likewise.
(finish_module_processing): Likewise.
(late_finish_module): Likewise.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
3 weeks agotestsuite: Fix UNRESOLVEDs for mistakenly dg-run test [PR121872]
Nathaniel Shead [Tue, 9 Sep 2025 12:55:35 +0000 (22:55 +1000)] 
testsuite: Fix UNRESOLVEDs for mistakenly dg-run test [PR121872]

PR testsuite/121872

gcc/testsuite/ChangeLog:

* g++.dg/modules/default-arg-4_b.C: Change run to compile.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
3 weeks agoFortran: fix bootstrap with -Werror=maybe-uninitialized
Harald Anlauf [Tue, 9 Sep 2025 19:16:18 +0000 (21:16 +0200)] 
Fortran: fix bootstrap with -Werror=maybe-uninitialized

gcc/fortran/ChangeLog:

* trans-intrinsic.cc (conv_intrinsic_fstat_lstat_stat_sub): Init
some variables.

3 weeks agoc++: non-dep cmp op rewritten from <=> returning int [PR121779]
Patrick Palka [Tue, 9 Sep 2025 18:39:57 +0000 (14:39 -0400)] 
c++: non-dep cmp op rewritten from <=> returning int [PR121779]

Apparently an explicitly defined operator<=> isn't required to return
std::foo_ordering, so build_min_non_dep_op_overload needs to be able
to rebuild forms of (x <=> y) @ 0 where the @ resolved to a built-in and
in turn isn't expressed as a function call.

PR c++/121779

gcc/cp/ChangeLog:

* tree.cc (build_min_non_dep_op_overload): Handle comparison
operator expressions rewritten from a <=> that returns a
non-class type.

gcc/testsuite/ChangeLog:

* g++.dg/lookup/operator-8.C: Remove outdated comment about
this test failing.
* g++.dg/lookup/operator-8a.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 weeks agoamdgcn: fix GFX10/GFX11 VGPR counts
Andrew Stubbs [Tue, 9 Sep 2025 13:48:16 +0000 (13:48 +0000)] 
amdgcn: fix GFX10/GFX11 VGPR counts

The previous definition had all the GFX11 register counts doubled to fix a bug
that was encountered in early testing.  This seems to have been a
misunderstanding of the problem (which is no longer reproducible).

gcc/ChangeLog:

* config/gcn/gcn-devices.def: Correct the Max ISA VGPRs counts for
GFX10 and GFX11 devices.
* config/gcn/gcn.cc (gcn_hsa_declare_function_name): Remove the wave64
VGPR count fudge.

3 weeks agoamdgcn: fix builtin codegen at -O0
Andrew Stubbs [Tue, 2 Sep 2025 09:17:18 +0000 (09:17 +0000)] 
amdgcn: fix builtin codegen at -O0

Fix an unrecognised insn ICE that only shows while using builtins at -O0.

gcc/ChangeLog:

* config/gcn/gcn.cc (gcn_expand_builtin_1): Enable the "mode" parameter
and ensure that "target" is a register for most of the builtins.

3 weeks agoFortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]
Harald Anlauf [Mon, 8 Sep 2025 19:21:15 +0000 (21:21 +0200)] 
Fortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]

PR fortran/82480

gcc/fortran/ChangeLog:

* check.cc (error_unsupported_kind): Helper function to report an
unsupported kind of an argument.
(check_minrange4): Helper function to report if an integer variable
does not have a decimal range of at least four.
(gfc_check_fstat): Adjust checks for generalization of instrinsic
function FSTAT.
(gfc_check_fstat_sub): Likewise for subroutine FSTAT.
(gfc_check_stat): Likewise for functio STAT.
(gfc_check_stat_sub): Likewise for subroutine STAT.
* intrinsic.texi: Document generalized versions of intrinsics
STAT/LSTAT/FSTAT.
* iresolve.cc (gfc_resolve_stat): STAT function result shall have
the same kind as the VALUES argument.
(gfc_resolve_lstat): Likewise for LSTAT.
(gfc_resolve_fstat): Likewise for FSTAT.
(gfc_resolve_stat_sub): Resolve proper library subroutine for STAT.
(gfc_resolve_lstat_sub): Likewise for LSTAT.
* trans-decl.cc (gfc_build_intrinsic_function_decls): Declare
fndecls for required subroutines in runtine library.
* trans-intrinsic.cc (conv_intrinsic_fstat_lstat_stat_sub): Emit
runtime wrapper code for the library functions, taking care of
possible kind conversion of the optional STATUS argument of the
subroutine versions of the intrinsics.
(gfc_conv_intrinsic_subroutine): Use it.
* trans.h (GTY): Declare prototypes.

gcc/testsuite/ChangeLog:

* gfortran.dg/stat_3.f90: Extend argument checking.
* gfortran.dg/stat_4.f90: New test.

3 weeks agoctf: fix integer truncations in very large structs [PR121411]
David Faust [Thu, 28 Aug 2025 16:12:55 +0000 (09:12 -0700)] 
ctf: fix integer truncations in very large structs [PR121411]

DWARF to CTF translation for type bit sizes was using uint32_t, and for
member offsets was inadvertently using unsigned int via get_AT_unsigned.
For very large struct types, at least one of these could be truncated
causing incorrect encoding of the struct type and member offsets.

Use HOST_WIDE_INT to avoid these truncation issues and fix the encoding
for large structs.

PR debug/121411

gcc/

* dwarf2ctf.cc (ctf_get_AT_data_member_location) Use AT_unsigned
when fetching AT_bit_offset and AT_data_member_location.  Simplify.
(ctf_die_bitsize): Return unsigned HOST_WIDE_INT instead of
uint32_t.
(gen_ctf_base_type, gen_ctf_sou_type, gen_ctf_enumeration_type):
Adapt accordingly.

gcc/testsuite/

* gcc.dg/debug/ctf/ctf-struct-3.c: New test.

3 weeks agoRISC-V: Add pattern for vector-scalar dual widening floating-point sub
Paul-Antoine Arras [Tue, 9 Sep 2025 14:29:09 +0000 (16:29 +0200)] 
RISC-V: Add pattern for vector-scalar dual widening floating-point sub

This pattern enables the combine pass (or late-combine, depending on the case)
to merge a float_extend'ed vec_duplicate into a minus RTL instruction. Both
minus operands are widened.

Before this patch, we have six instructions, e.g.:
  fcvt.d.s        fa0,fa0
  vsetvli         a5,zero,e64,m1,ta,ma
  vfmv.v.f        v3,fa0
  vfwcvt.f.f.v    v1,v2
  vsetvli         zero,zero,e64,m1,ta,ma
  vfsub.vv        v1,v1,v3

After, we get only one:
  vfwsub.vf       v1,v2,fa0

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*vfwsub_vf_<mode>): New pattern to
combine float_extend + vec_duplicate + vfwsub.vv into vfwsub.vf.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwsub.vf.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_binop.h
(DEF_VF_BINOP_WIDEN_CASE_0, DEF_VF_BINOP_WIDEN_CASE_1): Swap operands.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_binop_widen_run.h: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-1-f16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-1-f32.c: New test.

3 weeks agoc, c++: Allow &__real__ static_var in constant expressions [PR121678]
Jakub Jelinek [Tue, 9 Sep 2025 14:44:48 +0000 (16:44 +0200)] 
c, c++: Allow &__real__ static_var in constant expressions [PR121678]

When looking at constexpr references, I've noticed staticp handles
COMPONENT_REFs and ARRAY_REFs (the latter if the index is INTEGER_CST),
but not {REAL,IMAG}PART_EXPR.  I think that is incorrect and causes
rejection of constexpr (for C++) or static const (for C) addresses
of __real__ or __imag__ parts of static vars.

2025-09-09  Jakub Jelinek  <jakub@redhat.com>

PR c++/121678
* tree.cc (staticp): Handle REALPART_EXPR and IMAGPART_EXPR.

* g++.dg/ext/pr121678.C: New test.
* gcc.dg/pr121678.c: New test.

3 weeks agolibstdc++: Rename _CwFixedValue::_S_type member
Jonathan Wakely [Tue, 9 Sep 2025 12:57:54 +0000 (13:57 +0100)] 
libstdc++: Rename _CwFixedValue::_S_type member

Rename _S_type to __type as it's not a static member.

Also rename _Tp to _Xv because it's not a type.

libstdc++-v3/ChangeLog:

* include/std/type_traits (_CwFixedValue::_S_type): Rename to
__type.
(constant_wrapper): Rename template parameter in declaration to
match later definition.

3 weeks agodoc: Adjust -Wextra description for -Wunterminated-string-initialization
Jonathan Wakely [Tue, 9 Sep 2025 12:59:41 +0000 (13:59 +0100)] 
doc: Adjust -Wextra description for -Wunterminated-string-initialization

Say that -Wunterminated-string-initialization is for C and ObjC only
when it appears in the -Wextra documentation.

gcc/ChangeLog:

* doc/invoke.texi (Warning Options): Note that an option
enabled by -Wextra is for C and ObjC only.

3 weeks agoRISC-V: Add pattern for vector-scalar single widening floating-point add
Paul-Antoine Arras [Tue, 9 Sep 2025 09:43:44 +0000 (11:43 +0200)] 
RISC-V: Add pattern for vector-scalar single widening floating-point add

This pattern enables the combine pass (or late-combine, depending on the case)
to merge a float_extend'ed vec_duplicate into a plus RTL instruction. The other
plus operand is already wide.

Before this patch, we have four instructions, e.g.:
  fcvt.d.s        fa0,fa0
  vsetvli         a5,zero,e64,m1,ta,ma
  vfmv.v.f        v2,fa0
  vfadd.vv        v1,v1,v2

After, we get only one:
  vfwadd.wf       v1,v1,fa0

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*vfwadd_wf_<mode>): New pattern to
combine float_extend + vec_duplicate + vfadd.vv into vfwadd.wf.
* config/riscv/vector.md
(@pred_single_widen_<plus_minus:optab><mode>_scalar): Swap and reorder
operands to match the RTL emitted by expand.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwadd.wf.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_binop.h: Add support for single
widening variants.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_binop_widen_run.h: Add support
for single widening variants.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwadd-run-2-f16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwadd-run-2-f32.c: New test.

3 weeks agoRevert "aarch64: Handle DImode BCAX operations"
Kyrylo Tkachov [Tue, 9 Sep 2025 13:14:51 +0000 (15:14 +0200)] 
Revert "aarch64: Handle DImode BCAX operations"

This reverts commit 1b7bcac0327ccd84f1966c748f4d1aedef64a9c5.

PR target/121785

gcc/

* config/aarch64/aarch64-simd.md (*bcaxqdi4): Delete.

gcc/testsuite/

* gcc.target/aarch64/simd/bcax_d.c: Remove tests for DImode arguments.