Jeff Law [Tue, 17 Feb 2026 14:45:57 +0000 (07:45 -0700)]
[RISC-V][PR target/124048] Fix RTL generated by conditional AND splitter
The recently added patterns for recovering good code generation of conditional
operations on RISC-V with Zicond had a nasty little bug causing this bootstrap
failure.
The main patterns are fine -- in those cases the czero produces a neutral
value. So for example a conditional IOR can use a czero to select between an
IOR's operand and zero, then we do an unconditional IOR of the common value and
the result of the czero.
For AND the neutral value is -1 rather than 0. So we need a different
sequence. We emit the AND into a temporary. Then select between the common
term and zero. Then IOR the temporary with the selected value. That sequence
requires the tense of the selection to be inverted which I failed to do in the
split RTL output of the pattern.
Those had been tested by inspection only and the tense flip was missed. Doko's
bootstrap test with zicond enabled by default was able to trip this problem.
Thankfully it was easy to reproduce and bisect and was mostly a matter of
waiting for builds to run.
I've bootstrapped this on one of my BPIs with B, V and Zicond enabled by
default. I'll be pushing it to the trunk momentarily. I never actually
compared assembly or debugged the resulting code, it was found purely by
inspection once I knew where to look. ie, I don't have a testcase for the
testsuite, but this is covered by bootstrapping with Zicond enabled.
I'd been somewhat worried about this possibility for a while -- the B, V and
Zicond extensions are not well represented by CI systems for bootstrap testing.
Given the Pioneer here is still limping along, it's a good test of rv64gc and
I've hacked things up so that the BPI will enable B, V and Zicond by default.
The baseline run is still in progress (bootstrapping and regression testing on
the BPI is up to 30 hours now), but we'll have coverage going forward.
Obviously when the K3 systems come out the hope is this cycle time will drop
meaningfully.
PR target/124048
gcc/
* config/riscv/zicond.md (conditional AND patterns): Fix missed
flipping the condition's test in RTL output.
Richard Biener [Tue, 17 Feb 2026 14:08:54 +0000 (15:08 +0100)]
Transition gfortran.dg/vect to dg-additional-sources
The following changes gfortran.dg/vect/vect.exp to glob all files
(catching unhandled mask-store-1.f90) and handling additional
flags via dg-additional-sources.
Richard Biener [Tue, 17 Feb 2026 10:05:45 +0000 (11:05 +0100)]
tree-optimization/124132 - fix type problem in loop splitting
The following fixes the computation of the 2nd loop IV bound after
loop splitting when only one of the split IV and the loop control
variable is a pointer.
Tomasz Kamiński [Mon, 16 Feb 2026 14:07:54 +0000 (15:07 +0100)]
libstdc++: Correct requirements for atomic/cons/zero_padding.cc tests [PR124124].
This test uses atomic<T>::compare_exchange_strong and thus may require
libatomic and atomic-cmpxchg-word. The requirement on thread-fence and
non_pch were superfulous.
Jakub Jelinek [Tue, 17 Feb 2026 10:43:43 +0000 (11:43 +0100)]
bswap: Handle VEC_PACK_TRUNC_EXPR [PR120233]
With r16-531 we've regressed
FAIL: gcc.target/i386/pr108938-3.c scan-assembler-times bswap[\t ]+ 3
on ia32 and also made 2 separate regressions in the same testcase
on x86_64-linux (which in scan-assembler-times cancel out; previously
we were generating one 64-bit bswap + rotate in one function and
one 32-bit bswap + rotate in another function, now we emit 2 32-bit bswaps
in the first one and really horrible code in the second one).
The following patch fixes the latter function by emitting 32-bit bswap
+ 32-bit rotate on both ia32 and x86_64. This fixes the
above FAIL (and introduces
FAIL: gcc.target/i386/pr108938-3.c scan-assembler-times bswap[\t ]+ 2
on x86_64).
The problem is that the vectorizer now uses VEC_PACK_TRUNC_EXPR and
bswap/store_merging was only able to handle vectors in a CONSTRUCTOR.
The patch adds handling of VEC_PACK_TRUNC_EXPR if its operands are
CONSTRUCTORs. Without a testcase, I wasn't confident enough to write
BYTES_BIG_ENDIAN support, for CONSTRUCTOR { A, B, C, D } we make
DCBA out of it on little endian but ABCD on big endian and that would
need to be combined with picking up the most significant halves of each
element.
I'll look incrementally at the other function.
2026-02-17 Jakub Jelinek <jakub@redhat.com>
PR target/120233
* gimple-ssa-store-merging.cc (find_bswap_or_nop_2): New function.
(find_bswap_or_nop): Move CONSTRUCTOR handling to above function,
call it instead of find_bswap_or_nop_1.
(bswap_replace): Handle VEC_PACK_TRUNC_EXPR like CONSTRUCTOR.
(maybe_optimize_vector_constructor): Likewise.
(pass_optimize_bswap::execute): Likewise.
(get_status_for_store_merging): Likewise.
(pass_store_merging::execute): Likewise.
When using Solaris as, the .loc directives aren't present. Their use is
guarded by dwarf2out.cc (dwarf2out_default_as_loc_support), which
ultimately depends on HAVE_AS_DWARF2_DEBUG_LINE
To avoid this, this patch restricts the scans to gas targets, which is
better than what we currently have.
Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (as and gas),
and x86_64-pc-linux-gnu.
It turns out the target selectors of the x86 scans are badly confused:
* Using an i?86-*-* target selector is always wrong given the existance of
biarch i?86-*-* targets. They should use the x86 effective target with
ilp32 instead.
* dg directives don't heed the preprocessor, so scans were duplicated
for i?86-*-* and x86-*-*, sometimes with different target selectors.
This patch simplifies and fixes the target selectors, removing
duplication.
Tested on i386-pc-solaris2.11 with -m32/-m64 and x86_64-pc-linux-gnu
with -m64/-m32/-mx32, and i686-pc-linux-gnu with -m32/-m64.
Jakub Jelinek [Tue, 17 Feb 2026 08:00:08 +0000 (09:00 +0100)]
c++: Fix up is_type_alias2.C testcase for Solaris [PR124119]
Given https://eel.is/c++draft/expr.reflect#5.1
we error on
typedef __SIZE_TYPE__ A;
namespace B {
using ::A;
typedef __SIZE_TYPE__ C;
}
using B::C;
constexpr auto a = ^^A;
constexpr auto b = ^^B::A;
constexpr auto c = ^^B::C;
constexpr auto d = ^^C;
on ^^B::A and ^^C (note, clang++ fork only errors on ^^B::A).
Now, whether size_t is
typedef __SIZE_TYPE__ size_t;
namespace std {
using ::size_t;
}
or
namespace std {
typedef __SIZE_TYPE__ size_t;
}
using std::size_t;
depends on the target and clearly is the latter on Solaris, so testing
whether ^^size_t is a type alias doesn't work there - it is found as
a using decl there.
So the following patch stops testing it for size_t and tests yet another
user alias (a typedef is already tested - ^^T).
2026-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/124119
* g++.dg/reflect/is_type_alias2.C (W): New type alias.
Assert is_type_alias (^^W). Don't assert is_type_alias (^^size_t).
Jakub Jelinek [Tue, 17 Feb 2026 07:59:06 +0000 (08:59 +0100)]
c++: Don't support auto{x} and auto(x) for C++ < 23 in SFINAE contexts [PR120685]
The following testcase ICEs in C++ 20 and older, because during
diagnostics dump_template_bindings attempts to tsubst with tf_none
something and we try to emit a pedwarn during that.
While the pedwarn could be just guarded with if (complain & tf_warning),
I thought we shouldn't support extensions for tf_none and should
instead return error_mark_node.
The following patch does that.
2026-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/120685
* typeck2.cc (build_functional_cast_1): For C++23 auto(x)
without tf_warning or tf_error return error_mark_node instead of
emitting pedwarn and handling it.
* semantics.cc (finish_compound_literal): Similarly for C++26
auto{x}.
Jakub Jelinek [Tue, 17 Feb 2026 07:37:34 +0000 (08:37 +0100)]
c++: For reflection look through DECL_LOCAL_DECL_P decls and fix up has_default_argument [PR123612]
Based on discussions in the PR that C++ 26 reflection is
entity based rather than declaration based, the following patch
ensures we reflect DECL_LOCAL_DECL_ALIAS of DECL_LOCAL_DECL_P vars
or function decls.
Additionally, while default arguments are intentionally not merged
from the block scope externs to their corresponding namespace scope
function decls, for std::meta::has_default_argument the wording
requires to return true even if there is at least one block scope
extern with default argument for the particular parameter.
So, the patch also records in a new flag whether a default argument
has been present in a block scope extern and propagates it through
further duplicate_decls. eval_has_default_arguments then uses
both this new flag (for the block scope externs) and the preexisting
search for default arguments in the corresponding type.
2026-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/123612
* cp-tree.h (DECL_HAS_DEFAULT_ARGUMENT_P): Define.
* decl.cc (merge_decl_arguments): For -freflection and
extern_alias set DECL_HAS_DEFAULT_ARGUMENT_P (oldarg)
if newdecl has a default argument for that parameter,
otherwise propagate the flag.
* reflect.cc (get_reflection): For DECL_LOCAL_DECL_P
use its DECL_LOCAL_DECL_ALIAS.
(eval_has_default_argument): Return boolean_true_node
also if DECL_HAS_DEFAULT_ARGUMENT_P flag is set.
David Malcolm [Tue, 17 Feb 2026 02:55:55 +0000 (21:55 -0500)]
c++: fix missing file:line:column on "required from here" [PR122001]
PR diagnostics/122001 notes that in GCC 15 we emit:
<source>: In instantiation of 'void foo(T) [with T = std::nullptr_t]':
<source>:7:8: required from here
7 | foo(nullptr);
| ~~~^~~~~~~~~
<source>:3:7: error: invalid operands of types 'int' and 'std::nullptr_t' to binary 'operator+'
3 | 1 + t;
| ~~^~~
whereas in GCC 16 we emit:
<source>: In instantiation of 'void foo(T) [with T = std::nullptr_t]':
required from here
<source>:7:8:
7 | foo(nullptr);
| ~~~^~~~~~~~~
<source>:3:7: error: invalid operands of types 'int' and 'std::nullptr_t' to binary 'operator+'
3 | 1 + t;
| ~~^~~
where the "required from line" has lost its file:line:column prefix,
with the latter appearing on a follow line.
The root cause is that in r15-5995-g339246fb9ef4ca I changed
cp/error.cc's print_instantiation_partial_context_line from using
print_location to using auto_context_line, so that the location
information would be better integrated with nested diagnostics,
and enabled this by default in r16-3092-gd3fe5a560f0bcc.
text_sink::build_indent_prefix is returning the empty string for such
lines, rather than an indented bullet point.
This patch tweaks things so that such lines print the location before
the message at the top nesting level, and on a separate line at nested
nesting levels, and always the latter with
-fno-diagnostics-show-nesting.
gcc/cp/ChangeLog:
PR diagnostics/122001
* error.cc (auto_context_line::auto_context_line): Initialize
m_nesting_level and m_location_printed. Update the condition
for printing location in ctor to also do it at top-level
nesting level. Record into m_location_printed if we did
print the location.
(auto_context_line::~auto_context_line): Don't call print_location
if we already printed it in the ctor.
(auto_context_line::m_nesting_level): New field.
(auto_context_line::m_location_printed): New field.
gcc/testsuite/ChangeLog:
PR diagnostics/122001
* g++.dg/diagnostic/instantiation-context-pr122001-1.C: New test.
* g++.dg/diagnostic/instantiation-context-pr122001-2.C: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jose E. Marchesi [Mon, 16 Feb 2026 20:32:59 +0000 (21:32 +0100)]
a68: fix uninitialized memory in get_hole_symbol [PR algol68/124115]
The function get_hole_symbol is supposed to set *addrp to either true
or false. However it was only setting it to false, causing
uninitialized memory.
This patch also removes a gcc_asser tfrom a68_make_formal_hole_decl.
If the formal hole results in an empty symbol then it may result into
invalid assembly being generated, but that is akin to use an invalid
asm template.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
PR algol68/124115
* a68-low-holes.cc (get_hole_symbol): Always set *addrp to avoid
uninitialized memory.
* a68-low.cc (a68_make_formal_hole_decl): Remove assert.
gcc/testsuite/ChangeLog
PR algol68/124115
* algol68/compile/formal-hole-2.a68: New test.
Tomasz Kamiński [Mon, 16 Feb 2026 09:18:34 +0000 (10:18 +0100)]
libstdc++: Implement rvalue overload for basic_string::substr() [PR119745]
This paper implement the changes from P2438R2 basic_string::substr() &&
paper into C++26. The additional substr and constructor overload are
implemented only for SSO string, as they require mutating the content
(if reused), and thus would require copy of the string anyway for COW
strings. (In consequence allocators implicitly constructible from int
remain ambiguous for C++11 ABI strings, see r16-7497-gfa1149534d8580).
In addition to cases when the allocators are not compatible (equal),
this patch does not reuse (transfer) allocator storage, if the selected
substring fits inside the SSO buffer, so we do not risk keeping large
chunk of memory for few characters. (This also covers cases when the
source stored the content in the local buffer).
As this additional overloads are meant to be optimization, in contrast
to move constructor, the source is left unmodified if the allocation
is not transferred. This avoid introducing a write (of null terminator)
to previously untouched, heap allocated, memory.
Separate overloads for substr(size_type __pos, size_type __n) and
substr(size_type __pos == 0), that delegate to corresponding constructor,
are provided to avoid the check of __n against the length() in the later
case.
Finally, the signatures of existing substr() overload are not modified
(no longer required since C++20), which avoid any impact on the ABI.
Ivan Lazaric [Mon, 9 Feb 2026 12:26:36 +0000 (13:26 +0100)]
libstdc++: implement formatter for std::filesystem::path
This patch implements formatting for std::filesystem::path from P2845R8,
and defines the feature test macro __cpp_lib_format_path to 202403L,
provided only in <filesystem>.
Formatting options are performed (if applicable) in order:
'g', '?', transcoding, fill-and-align & width
The standard specifies transcoding behaviour only when literal encoding
is UTF-8, leaving all other cases implementation defined.
Current implementation of filesystem::path assumes:
* char encoding is UTF-8
* wchar_t encoding is either UTF-32 or UTF-16
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Ivan Lazaric <ivan.lazaric1@gmail.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Eric Botcazou [Mon, 16 Feb 2026 09:17:30 +0000 (10:17 +0100)]
Ada: Fix subpool dropped from allocator initialized by aggregate
This plugs an annoying loophole, whereby the subpool indication present
in an allocator is dropped in some circumstances, most notably when the
allocator is initialized by an aggregate with defaulted components.
gcc/ada/
PR ada/124106
* exp_ch4.adb (Expand_N_Allocator): Minor fix in commentary.
(Expand_Allocator_Expression): Propagate the Subpool_Handle_Name
of the original allocator onto the newly built allocators.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
Use Preserve_Comes_From_Source to propagate Comes_From_Source.
(Make_CPP_Constructor_Call_In_Allocator): Likewise.
Rainer Orth [Sun, 15 Feb 2026 22:11:44 +0000 (23:11 +0100)]
Change int8_t to signed char on Solaris [PR113450,PR123176]
int8_t is currently defined as char in Solaris <sys/int_types.h>
/*
* Basic / Extended integer types
*
* The following defines the basic fixed-size integer types.
*
* Implementations are free to typedef them to Standard C integer types or
* extensions that they support. If an implementation does not support one
* of the particular integer data types below, then it should not define the
* typedefs and macros corresponding to that data type. Note that int8_t
* is not defined in -Xs mode on ISAs for which the ABI specifies "char"
* as an unsigned entity because there is no way to define an eight bit
* signed integral.
*/
typedef char int8_t;
typedef signed char int8_t;
and _CHAR_IS_SIGNED defined as 1 in <sys/isa_defs.h>. As has long been
known, this violates C99, 7.18.1.1, Exact-width integer types.
While this works in general nonetheless, it creates constant trouble for
C++ code as can be seen in PRs libstdc++/113450 and recently
libstdc++/123176, but also in LLVM.
While Oracle Solaris engineering is amenable to changing int8_t to
signed char, this will take time. However, it proved easy to do so now
using fixincludes.
This works for a GCC bootstrap just fine with one exception: as
documented in PR d/123509, libdruntime has its own definition of int8_t
which is now inconsistent with GCC's. This leads to some gdc.test and
libphobos testsuite failures, which can easily be fixed with the patch
attached to that PR. I wouldn't consider this a showstopper for GCC 16
if that patch wouldn't make it to the release.
However, the failures point to another problem: with this change, the
mangling of
void func(int8_t);
changes in C++, creating an ABI break. Fortunately, this isn't seen in
libstdc++, so the impact should be reasonable compared to the constant
trouble the current definition causes for C++.
Besides, clang already uses
#define __INT8_TYPE__ signed char
apparently without problems.
In case users do run into the incompatiblity, the fixed definitions are
wrapped in #if !defined(_LEGACY_INT8_T)/#endif so there's an easy way back
to the original definition.
Bootstrapped on i386-pc-solaris2.11, amd64-pc-solaris2.11,
sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11 with only the D
failure described above.
I've also run 1-stage and bootstrap builds of LLVM main using a patched
GCC 16 as bootstrap compiler on amd64-pc-solaris2.11 and
sparcv9-sun-solaris2.11 without regressions.
Iain Sandoe [Sun, 15 Feb 2026 08:59:33 +0000 (08:59 +0000)]
diagnostics: Fix bootstrap on 32b Darwin hosts.
The change in r16-7507 misses a cast on the value to pp_scalar which
leads to a bootstrap fail on 32b hosts where size_t has a different
declaration from the value. Fixed by applying the fmt_size_t cast.
gcc/ChangeLog:
* json.cc (pointer::token::print): Cast the value to pp_scalar
with (fmt_size_t).
Jan Hubicka [Sun, 15 Feb 2026 19:19:57 +0000 (20:19 +0100)]
Disable simpe-call devirtualization of already devirtualized calls
Fix ICE caused by speculating already speculated target with auto-fdo.
ipa_devirt is supposed to consistently skip devirtualized edges (or just check
if devirtualization agrees with the static prediction when dumping). This was
not hecked correctly in the simpe call path.
gcc/ChangeLog:
* ipa-devirt.cc (ipa_devirt): Improve statistics for multi-target
devirtualization; do not simple-call devirtualize already devirtualized calls.
Patrick Palka [Sun, 15 Feb 2026 17:36:38 +0000 (12:36 -0500)]
c++: non-trivial by-value deducing this lambda [PR121500]
Here the lambda has a by-value capture of non-trivial type, which
in turn makes the closure type non-trivial. This means its by-value
'this' parameter, which gets deduced to the closure type, becomes an
invisiref parameter, and so when lowering the operator() body we need to
adjust uses of 'this' by adding implicit dereferences.
But the GIMPLE dump for operator() shows that we miss some adjustments:
bool main()::<lambda(this auto:1)>::operator()<main()::<lambda(this auto:1)> > (struct ._anon_0 & self)
{
bool D.3091;
struct ._anon_0 & self.1;
struct A a [value-expr: self.__a]; // should be self->__a
self.1 = self;
_1 = self.1.__a.n; // should be self.1->__a
D.3091 = _1 == 42;
return D.3091;
}
Apparently this is because cp_genericize_r, which is responsible for the
invisiref use adjustments, never walks DECL_VALUE_EXPR. This patch makes
us walk it. For GCC 16, restrict the walking to xobj lambdas.
PR c++/121500
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_genericize_r): Walk DECL_VALUE_EXPR within
an xobj lambda.
Rainer Orth [Sun, 15 Feb 2026 10:33:41 +0000 (11:33 +0100)]
Remove HAVE_AS_FMAF_HPC_VIS3 etc. on SPARC
The SPARC ISA extensions guarded by HAVE_AS_FMAF_HPC_VIS3 etc. have been
supported both in the Solaris as and GNU as for a long time. The
original Solaris 11.4 as supports all of them, and gas support has been
added over time:
Solaris requires binutils 2.30 already on trunk, and 2.29 can be
expected on other SPARC targets, too, so this patch removes all code
that checks for their presence.
Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas),
sparcv9-sun-solaris2.11 (as), and sparc64-unknown-linux-gnu.
Andrew Pinski [Sat, 14 Feb 2026 19:33:01 +0000 (11:33 -0800)]
forwprop: Fix copy prop aggregates into return statements slightly [PR124099]
So a few more restrictions are needed here.
First we don't need to change if the return statement is already
a RESULT_DECL nor deference of the RESULT_DECL.
Second proping a global variable into the return is ok for the most
part except enumtls does not know how to expand that correctly and things
go down hill. So restrict to non global vars now.
Bootstrapped and tested on x86_64-linux-gnu.
Also tested the testcase with TLS turned off so enumtls ran.
PR tree-optimization/124099
gcc/ChangeLog:
* tree-ssa-forwprop.cc (optimize_agr_copyprop_return): Don't do anything
if the return is already result decl or a deference of result decl.
Also reject non local var decls.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/tls-return-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Paul Thomas [Sun, 15 Feb 2026 08:11:31 +0000 (08:11 +0000)]
Fortran: Prevent direct references to PDT instances [PR108663]
2026-02-15 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/108663
* decl.cc (gfc_get_pdt_instance): Use PDT_PREFIX and
PDT_PREFIX_LEN.
* gfortran.h : Define PDT_PREFIX and PDT_PREFIX_LEN. Note that
PDT_PREFIX must have at least two upper case letters.
* module.cc (read_module): Use PDT_PREFIX and PDT_PREFIX_LEN.
* resolve.cc (resolve_typebound_procedure): Both pdt_template
and pdt_type resolve_bindings_derived dummies should be tested
for LEN type parameters being assumed.
* symbol.cc (gfc_pdt_is_instance_of): Update preceding comment
and use PDT_PREFIX_LEN.
gcc/testsuite
PR fortran/108663
* gfortran.dg/pdt_15.f03: Modify tree dump test for new prefix.
* gfortran.dg/pdt_71.f03: Ditto.
* gfortran.dg/pdt_79.f03: Ditto.
* gfortran.dg/pdt_84.f03: New test.
Andrew Pinski [Sun, 15 Feb 2026 06:29:18 +0000 (22:29 -0800)]
testsuite: Fix pr124086-1.c for ia32 (and maybe others)
On some targets (ia32 for an example), sizeof long double
is not a power of 2, this means you can't create a vector
of it. So let's disable this testcase for non power of 2
sizeof long double. This needs to be done via a preprocessor
macro as vector_size would cause an error otherwise.
Committed as obvious after a test on x86_64 with -m32.
gcc/testsuite/ChangeLog:
* c-c++-common/torture/pr124086-1.c: Only enable
for power of 2 long double.
The following patch adds new configure options similar to ObjC/Algol68
--with-bdw-gc{,-lib,-include}= configure options where one can override
the default of -I /usr/include/libxml2 and -lxml2 for finding libxml2
headers and library. Similarly to the bdw-gc options, the override can
be for all multilibs or just specific to each multilib.
Tested also with
../configure --enable-languages=c,c++,cobol --with-target-libxml2=/tmp/libxml2 \
--disable-bootstrap --disable-libsanitizer --disable-libgomp
2026-02-14 Jakub Jelinek <jakub@redhat.com>
PR cobol/122839
* configure.ac (--with-target-libxml2, --with-target-libxml2-include,
--with-target-libxml2-lib): New configure options, use those to find
libxml2.
(LIBXML2_CPPFLAGS, LIBXML2_LIBS): New AC_SUBSTs.
* Makefile.am (AM_CPPFLAGS): Add $(LIBXML2_CPPFLAGS) rather than
-I /usr/include/libxml2.
(libgcobol_la_LDFLAGS): Add $(LIBXML2_LIBS).
* configure: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
Rainer Orth [Sat, 14 Feb 2026 15:21:23 +0000 (16:21 +0100)]
Remove HAVE_AS_SPARC_GOTDATA_OP
Since the introduction of gcc_cv_as_flags on SPARC,
HAVE_AS_SPARC_GOTDATA_OP became undefined on sparcv9-sun-solaris2.11
with the native assembler. This happens because /bin/as is now invoked
with -m64, but the test fails to assemble:
/bin/as: "gotdata_op.s", line 8: error: detect global register use not covered .register pseudo-op
While the test can be adjusted by the addition of
.register %g2, #scratch
which makes it work with both as -m32/-m64 and gas --32/--64, it
turns out the whole workaround has become unnecessary:
When trying all combinations of as/ld with -m32/-m64, with both the
original Solaris 11.4 as/ld and the current one, as well as gas/gld
2.20.1, 2.30, and 2.46, the only cases where the test fails are when
using gld 2.20.1. Solaris/SPARC requires binutils 2.30 now, and 2.20.1
can be considered ancient history on Linux/sparc64, too. Therefore the
test and the code guarded by it can just go.
Bootstrapped without regressions on sparc{,v9}-sun-solaris2.11 and
sparc64-unknown-linux-gnu.
VAX: Fix ICE in fixup_reorder_chain when building gimple_match.cc [PR112400]
When cross-compiling itself for VAX, GCC terminates abruptly with an ICE
when compiling gimple_match.cc; the root cause seems to be an
incompletely removed computed jump instruction, which causes the
assertion in cfgrtl.cc around line 4083, to no longer hold.
I have verified that the problem is present in GCC 15.2.0 and believe
that it's also present in trunk (based on the fact that the patterns for
the "casesi1" and "*casesi1" instructions in 15.2.0 and trunk are the
same).
To fix this issue wrap the limit operand in a USE, to allow `single_set'
to identify it as an RTL expression setting PC. This allows the
optimizer to optimize away case statements branching only to a basic
block, removing the ICE.
Include a test case reduced from gimple_match.cc, which demonstrates the
problem in GCC 15.2.0 on NetBSD/amd64 cross-compiling for VAX.
gcc/
PR target/112400
* config/vax/vax.md (casesi1): Wrap naked operand 1 with a USE
where used with the insn split to.
(*casesi1): Likewise naked incoming operand 1.
gcc/testsuite/
PR target/112400
* g++.dg/torture/pr112400.C: New file.
VAX: Fix invalid RTX operand access in `nonindexed_address_p'
Replace an unguarded early access to the incoming RTX's operand 0 in
`nonindexed_address_p' with direct accesses at the actual use places,
fixing a libgcc build error:
during RTL pass: reload
.../libgcc/libgcc2.c: In function '__udiv_w_sdiv':
.../libgcc/libgcc2.c:649:1: internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'r' (rtx reg) in nonindexed_address_p, at config/vax/vax.cc:1826
where `--enable-checking=rtl' has been specified so as to enable RTL
consistency checks.
gcc/
* config/vax/vax.cc (nonindexed_address_p): Move incoming RTX's
operand 0 access to the actual use places.
fortran: Fix DO CONCURRENT nested-in-block iterator counting [PR123943]
Fix iterator-depth pre-counting in gfc_resolve_forall for nested
DO CONCURRENT/FORALL constructs inside block arms (e.g. IF/ELSE,
SELECT CASE). The previous logic only scanned a flat next-chain,
which could undercount and trigger an ICE assertion.
Add a regression test based on a reduced testcase from Harald Anlauf.
Adjust wording in one comment to avoid GNU-style checker complaints.
PR fortran/123943
gcc/fortran/ChangeLog:
* resolve.cc (gfc_max_forall_iterators_in_chain): New helper
function for factorization of iterator-depth counting.
(gfc_count_forall_iterators): Use it.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr123943.f90: New test.
Co-authored-by: Harald Anlauf <anlauf@gcc.gnu.org> Signed-off-by: Christopher Albert <albert@tugraz.at>
Paul Thomas [Sat, 14 Feb 2026 08:48:11 +0000 (08:48 +0000)]
Fortran: Implement the COSHAPE intrinsic [PR99250]
2026-02-14 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/99250
* check.cc (gfc_check_coshape): New function.
* gfortran.h: Add GFC_ISYM_COSHAPE to gfc_isym_id.
* intrinsic.cc (add_functions): Add the coshape prototype and
its 'make_generic'.
* intrinsic.h: Add prototypes for gfc_check_coshape and
gfc_resolve_coshape.
* intrinsic.texi : Add entries for coshape.
* iresolve.cc (gfc_resolve_coshape): New function.
* trans-array.cc (gfc_conv_ss_startstride): Add 'case
GFC_ISYM_COSHAPE' in two places.
* trans-intrinsic.cc (conv_intrinsic_cobound): Modify assert in
scalarized section for lbound. Set bound to zero for scalar
case of coshape. Keep the lbound and use it together with the
scalarized ubound to obtain the coshape.
(gfc_conv_intrinsic_function, gfc_add_intrinsic_ss_code and
gfc_walk_intrinsic_function): Add 'case GFC_ISYM_COSHAPE' as
appropriate.
gcc/testsuite/
PR fortran/99250
* gfortran.dg/coshape_1.f90: New test.
Andrew Pinski [Fri, 13 Feb 2026 19:30:53 +0000 (11:30 -0800)]
complex-lowering: Fix up extraction with VCEs [PR124086]
This was an oversight on my part when I converted extract_component
to use gimple_build_assign instead of force_gimple_operand_gsi.
I had provided a special case for VCE of a SSA_NAME but I missed
that the same issue would be caused with invariants too and invariants
would show up with VCE; I assumed they would be folded.
This changes the check to include invariants too.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/124086
gcc/ChangeLog:
* tree-complex.cc (extract_component): Extend the check
for ssa names for VCE to include invariants.
gcc/testsuite/ChangeLog:
* c-c++-common/torture/pr124086-1.c: New test.
* g++.dg/torture/pr124086-1.C: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Recent patch for PR121191 broke compilation of s390 SPEC benchmarks.
This patch fixes it. The patch uses existing lra_constraint_offset to
calculate offsets. The same function is used to find invalid matching
reloads.
gcc/ChangeLog:
PR rtl-optimization/124079
* lra-constraints.cc (get_matching_reload_reg_subreg): Add new arg
rclass. Use another condition to use lowpart_subreg. Use lra_constraint_offset
to calculate the subreg offset.
(get_reload_reg, match_reload): Pass the new arg.
Robert Dubner [Fri, 13 Feb 2026 18:26:47 +0000 (13:26 -0500)]
cobol: Optimized alpha-to-alpha moves. [PR119455]
Code for implementing many common scenarios of "MOVE <literal> TO
<alphanumeric>" and " MOVE <alphanumeric> to <alphanumeric> " is created
directly through GENERIC rather than by calling the general-purpose
libgcobol __gg__move routine.
gcc/cobol/ChangeLog:
PR cobol/119455
* genapi.cc (mh_source_is_group): Formatting.
(mh_source_is_literalA): Implement accelerated move.
(mh_alpha_to_alpha): New function; implements accelerated move.
(move_helper): Calls new mh_alpha_to_alpha.
Andrew Pinski [Fri, 13 Feb 2026 04:36:33 +0000 (20:36 -0800)]
forwprop: Add copy prop for aggregates into a return [PR95825]
I didn't implement this before today as I had not see any code
where this would make a difference. I noticed while looking into
regressions an uninitialized warning that shows up only with
-fsanitize=address. This because SRA causes some extra total
scalaization when using -fsanitize=address. Which in turn exposes
an uninitialized warning. This fixes the uninitialized warning
by doing a simple copy prop into the return statement.
That is if we have:
```
D.3407 = D.3418;
return D.3407;
```
turn it into:
```
D.3407 = D.3418;
return D.3418;
```
This forces SRA not to do total scalarization on D.3418 and allows for better code
too.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/95825
gcc/ChangeLog:
* tree-ssa-forwprop.cc (optimize_agr_copyprop_return): New function.
(optimize_agr_copyprop): Call optimize_agr_copyprop_return
for return statements.
gcc/testsuite/ChangeLog:
* g++.dg/warn/uninit-pr95825-1.C: New test.
* gcc.dg/tree-ssa/copy-prop-aggregate-return-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Marek Polacek [Tue, 10 Feb 2026 18:24:44 +0000 (13:24 -0500)]
c++/reflection: various diagnostic tweaks
This patch improves various reflection diagnostics as discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704168.html>.
In particular:
- reword "not usable" diagnostics to say what kind of reflections we
expected,
- use the new inform_tree_category to better describe what kind of reflection
we actually got,
- when we see a missing 'template' keyword, emit a -Wmissing-template-keyword
warning instead of giving a hard error (this should only happen when the
code would be valid with the 'template' added.
gcc/cp/ChangeLog:
* cp-tree.h (inform_tree_category): Declare.
* error.cc (inform_tree_category): New.
* parser.cc (cp_parser_splice_specifier): Use OVL_FIRST when checking
for TEMPLATE_DECL.
(cp_parser_splice_type_specifier): Reword an error message. Call
inform_tree_category.
(cp_parser_splice_expression): Check check_splice_expr earlier. Reword
error messages. Call inform_tree_category. Turn an error into an
assert. Use missing_template_diag instead of giving an error about
a missing 'template' keyword.
(cp_parser_splice_scope_specifier): Reword an error message. Call
inform_tree_category.
(missing_template_diag): Forward declare. Drop "enum" in a parameter.
* reflect.cc (check_splice_expr): Reword error messages. Call
inform_tree_category.
Jakub Jelinek [Fri, 13 Feb 2026 15:11:07 +0000 (16:11 +0100)]
c++: Fix up consteval-only diagnostics with structured bindings [PR124012]
We ICE on the following testcase, because a constexpr structured binding
with consteval-only initializer of the whole struct but not for this exact
structured binding is used in a context where it is not constant evaluated
and folded into a constant.
The problem is that check_out_of_consteval_use during walking didn't walk
DECL_VALUE_EXPR of vars it sees being used. So we haven't noticed invalid
consteval-only use, the consteval-only base of the structured binding isn't
gimplified but the structured binding referencing that in its
DECL_VALUE_EXPR is and so we ICE during gimplification.
In order to fix that, I had to move the lambda into a separate function
(similarly to why consteval_only_type_r is not a lambda) so that it can
recurse with that.
That isn't the only problem though. DECL_VALUE_EXPR in this case is just
COMPONENT_REF with the underlying VAR_DECL (which is consteval-only).
But walker had:
if (VAR_P (t)
&& (DECL_DECLARED_CONSTEXPR_P (t) || DECL_DECLARED_CONSTINIT_P (t)))
/* This is fine, don't bother checking the type. */
return NULL_TREE;
and so wouldn't report anything even after the fix.
The reason why it works correctly in the
constexpr auto a = A {};
foo (a.a); // { dg-error "consteval-only expressions are only allowed in a constant-evaluated context" }
case is that in that case (no DECL_VALUE_EXPR) there is COMPONENT_REF
of VIEW_CONVERT_EXPR of the VAR_DECL (i.e. location wrapper) and so we
diagnose it on the location wrapper. That is just weird, we really
shouldn't depend on location wrappers being there for correct behavior
(rather than just for better locations). That if is there because
cp_finish_decl calls check_out_of_consteval_use on the whole VAR_DECL
and in that case we want to avoid diagnosing anything if it is
constexpr/constinit var. Maybe we just shouldn't call
check_out_of_consteval_use at all, though this patch moves that check to
an early out in that function rather than during the walk (similarly
to early out for expr == NULL_TREE which also happens occassionally).
If we see a constexpr/constinit VAR_DECL which is consteval-only
nested somewhere deep inside of other expressions, we should diagnose
that.
On Wed, Feb 11, 2026 at 08:58:26PM +0900, Jason Merrill wrote:
> I'd drop constinit, that doesn't seem to qualify under
> [basic.types.general]/12.1.
You're right. Seems constinit was still in P2996R9 but P2996R10
has removed it except for one occurrence in the revision history (that
is ok, but surprisingly the P2996R10 change that removed it is not
mentioned). So, this patch additionally stops special casing constinit
for consteval-only checks anywhere, only constexpr is significant.
There is an unresolved part of the PR, if there is
constexpr auto a = A {};
int b = a.a;
then we don't reject that (similarly after the patch with constexpr
structured binding). The problem in that case is that we try to
constant evaluate initializers of vars (and a few other spots) and
if they fold to constants (like in this case to 0) even when it is
not manifestly constant-evaluated, we just replace it with the constant
and so don't see there was a consteval-only use that should have
been reported. Of course, if it is something manifestly constant-evaluated
and folds into constant, it shouldn't be rejected.
So I wonder if we don't need to call check_out_of_consteval_use in
further spots...
2026-02-13 Jakub Jelinek <jakub@redhat.com>
PR c++/124012
* reflect.cc (check_out_of_consteval_use_r): New function.
(check_out_of_consteval_use): Use it instead of lambda. Don't ignore
constexpr/constinit vars in the walker and walk DECL_VALUE_EXPR of
vars which have it. Ignore expr equal to constexpr VAR_DECL. In
diagnostics only complain about missing constexpr on VAR_DECLs without
that flag and never suggest constinit. Remove constinit traces from
function comment.
* g++.dg/reflect/pr124012.C: New test.
* g++.dg/reflect/init1.C (r): Change constinit to constexpr.
(p): Change constinit to constexpr const.
* g++.dg/reflect/init6.C: Expect diagnostics for constinit
consteval-only vars.
* g++.dg/reflect/init7.C: Likewise.
* g++.dg/reflect/init10.C: Likewise.
* g++.dg/reflect/diag3.C: Likewise. Don't expect suggestion to
add constinit.
Richard Biener [Fri, 13 Feb 2026 14:16:28 +0000 (15:16 +0100)]
testsuite/115827 - avoid false negative because of CCP
The following adjusts two uninit testcases to avoid a false negative
that appears when using -msoft-float on arm because the testcase
then mutates into a classical case of CCP eliding
# _11 = PHI <1.0e+0(2), f$real_9(D)(3)>
Avoid this by using a non-constant. And avoid flipping locations
for the diagnostic by not duplicating the return statement.
David Malcolm [Fri, 13 Feb 2026 13:26:50 +0000 (08:26 -0500)]
diagnostics: don't cache logical_loc_mgr in html_sink [PR124014]
r16-7422-g13c2da6cdbd1a3 fixed an ICE that was due to caching of the
logical_locations::manager * in sarif_sink.
Do the same for html_sink.
gcc/ChangeLog:
PR diagnostics/124014
* diagnostics/html-sink.cc (html_builder::get_logical_loc_mgr):
New.
(html_builder::m_logical_loc_mgr): Drop field.
(html_builder::html_builder): Drop initialization of
m_logical_loc_mgr.
(html_builder::maybe_make_state_diagram): Use get_logical_loc_mgr
rather than m_logical_loc_mgr.
(html_builder::make_element_for_diagnostic): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Tobias Burnus [Fri, 13 Feb 2026 11:29:03 +0000 (12:29 +0100)]
Fix gcc/testsuite/*/gomp/pr113436* [PR113436]
Testcases in gcc/testsuite/ may not '#include <omp.h>' or 'use omp_lib';
instead, now a local declaration of the enum/Fortran-parameter values is
used.
gcc/testsuite/ChangeLog:
PR middle-end/113436
* c-c++-common/gomp/pr113436-1.c: Replace '#include <omp.h>' by
local declaration for omp_allocator_handle_t.
* c-c++-common/gomp/pr113436-2.c: Likewise.
* g++.dg/gomp/pr113436.C: Likewise.
* gfortran.dg/gomp/pr113436-1.f90: Replace 'use omp_lib' by local
omp_*_mem_alloc parameter declarations.
* gfortran.dg/gomp/pr113436-2.f90: Likewise.
* gfortran.dg/gomp/pr113436-3.f90: Likewise.
* gfortran.dg/gomp/pr113436-4.f90: Likewise.
Tomasz Kamiński [Thu, 12 Feb 2026 21:50:16 +0000 (22:50 +0100)]
libstdc++: Make __gnu_test:uneq_allocator(int) constructor explicit.
Presence implicit conversion from int to it's allocator, makes constructing
string from rvalue of same string type and int ambiguous, as none of following
candidates is better:
basic_string(basic_string&&, allocator_type)
// conversion from int to allocator for second argument
basic_string(const basic_string&, int, allocator_type)
// reference adjustment for first argument
This makes __gnu_test:uneq_allocator(int) constructor explicit, to avoid
above issues.
libstdc++-v3/ChangeLog:
* testsuite/20_util/scoped_allocator/construct_pair_c++2a.cc
(__gnu_test::uneq_allocator(int)): Declare as explicit.
* testsuite/std/memory/indirect/ctor.cc: Construct uneq_allocator
from int explicitly.
* testsuite/std/memory/polymorphic/ctor.cc: Likewise.
* testsuite/std/memory/polymorphic/ctor_poly.cc: Likewise.
* testsuite/util/testsuite_allocator.h: Likewise.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Jonathan Wakely [Wed, 11 Feb 2026 22:39:52 +0000 (22:39 +0000)]
libstdc++: Make CTAD ignore tuple(const Types&...) constructor [PR121771]
This is similar to the r16-3536-g0bb0d1d2880d56 change for std::pair, so
that CTAD ignores the tuple(const Types&...) constructor and only uses
the tuple(Types...) -> tuple<Types...> deduction guide. This ensures
that the deduced type comes from the decayed argument types.
libstdc++-v3/ChangeLog:
PR libstdc++/121771
* include/std/tuple (tuple::tuple(const Elements&...)): Use
type_identity_t to prevent constructor being used for CTAD.
(tuple::tuple(allocator_arg_t, const A&, const Elements&...)):
Likewise.
* testsuite/20_util/tuple/cons/121771.cc: New test.
Reviewed-by: Ville Voutilainen <ville.voutilainen@gmail.com>
Andrew Pinski [Thu, 12 Feb 2026 17:07:10 +0000 (09:07 -0800)]
c: Handle REALPART_EXPR and IMAGPART_EXPR in fold_offsetof [PR105555]
In some cases the C front-end calls into fold_offsetof to fold
an address but that does not handle REALPART_EXPR nor IMAGPART_EXPR so
gcc produces an internal compiler error. For offsetof, REALPART_EXPR/IMAGPART_EXPR
won't show up which is why they were not there before.
Bootstrapped and tested on x86_64-linux-gnu.
PR c/105555
gcc/c-family/ChangeLog:
* c-common.cc (fold_offsetof): Handle REALPART_EXPR
and IMAGPART_EXPR.
gcc/testsuite/ChangeLog:
* gcc.dg/complex-10.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Patrick Palka [Thu, 12 Feb 2026 23:20:36 +0000 (18:20 -0500)]
c++: constrained auto NTTP vs associated constraints
According to [temp.param], the constraint on an auto NTTP is an
associated constraint and so should be checked as part of satisfaction
of the overall associated constraints, but we currently don't include
them in the template's associated constraints and instead check them
separately during template argument coercion/deduction.
Fixing this is mostly a matter of storing the NTTP's constraint inside
TEMPLATE_PARM_CONSTRAINTS instead of PLACEHOLDER_TYPE_CONSTRAINTS and
generalizing the relevant template parameter processing subroutines to
also handle such NTTPs.
While this is straightfoward for "simple" constrained autos, it was
later noticed that for e.g. 'C auto* P' or 'D auto& Q' it's not clear
how to express their constraint as an associated constraint. For P an
option would be C<decltype(*P)>, but for Q it's not clear how to pass
the referenced type to C. C<decltype(auto(Q))> would be wrong because
we don't want to decay function/array types.
So this patch sidesteps this question by preserving the existing
behavior for such "non-simple" constrained auto (i.e. don't add them
to the associated constraints, and continue ad-hoc checking them during
do_auto_deduction). The simple case is by far the most common anyway.
The main observeable difference with this change is that such
constrained auto NTTPs are now involved in the "more constrained"
determination during partial ordering.
gcc/cp/ChangeLog:
* constraint.cc (finish_shorthand_constraint): Add is_non_type
parameter. Handle constrained auto NTTPs.
* cp-tree.h (copy_template_args): Declare.
(expand_template_argument_pack): Declare.
(finish_shorthand_constraint): Adjust declaration.
* mangle.cc (write_template_param_decl): Obtain constraints of
an auto NTTP through TEMPLATE_PARM_CONSTRAINTS instead of
PLACEHOLDER_TYPE_CONSTRAINTS.
* parser.cc (cp_parser_constrained_type_template_parm): Inline
into its only caller and remove.
(cp_parser_constrained_non_type_template_parm): Likewise.
(finish_constrained_parameter): Simplify after the above. Replace
the type of an ordinary constrained auto NTTP with a
non-constrained one and set TEMPLATE_PARM_CONSTRAINTS for it.
(cp_parser_template_parameter): Dispatch to
finish_constrained_parameter for a constrained auto NTTP.
* pt.cc (process_template_parm): Pass is_non_type to
finish_shorthand_constraint. Use TEMPLATE_PARM_CONSTRAINTS
instead of TREE_TYPE for clarity.
(expand_template_argument_pack): Remove forward declaration.
(copy_template_args): Likewise.
(make_constrained_placeholder_type): Return the type not the
TYPE_NAME for consistency with make_auto_1 etc.
(do_auto_deduction): Assert we no longer see simple constrained
autos during coercion/deduction.
gcc/testsuite/ChangeLog:
* g++.dg/cpp26/pack-indexing15.C: Adjust expected error upon
constrained auto NTTP satisfaction failure.
* g++.dg/cpp2a/concepts-placeholder12.C: Likewise.
* g++.dg/cpp2a/concepts-pr97093.C: Likewise.
* g++.dg/cpp2a/concepts-template-parm2.C: Likewise.
* g++.dg/cpp2a/concepts-template-parm6.C: Likewise.
* g++.dg/cpp2a/concepts-template-parm12.C: New test.
Patrick Palka [Thu, 12 Feb 2026 20:17:57 +0000 (15:17 -0500)]
libstdc++/regex: Avoid -Wunused-parameter warnings in _Executor
Now that _Executor is non-recursive most subroutines no longer use their
_Match_mode parameter (previously it was just passed to recursive _M_dfs
calls). For now, just make them unnamed to avoid warnings.
Patrick Palka [Thu, 12 Feb 2026 20:14:11 +0000 (15:14 -0500)]
c++: adjust comment from previous commit r16-7487
The comment from r16-7487 is confused, the object argument of PMF
calls _must_ be sequenced first by [expr.call]/7 since syntactically
it appears in the postfix-expression: (a.*pmf)(...).
It's indirect calls to a (known) xobj memfn that don't need such
sequencing, since syntactically the object argument isn't in the
postfix-expression: (&A::f)(a, ...).
Patrick Palka [Thu, 12 Feb 2026 19:44:56 +0000 (14:44 -0500)]
c++: evaluation order of xobj memfn call [PR123989]
The object argument of an xobj memfn call needs to be evaluated before its
formal arguments, like with an iobj memfn call. This patch generalizes the
existing such handling in cp_gimplify_expr for METHOD_TYPE callees to also
accept xobj memfn callees.
PR c++/123989
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_gimplify_expr) <case CALL_EXPR>: Evaluate
the object argument of an xobj memfn call first too.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/explicit-obj-eval-order.C: New test.
Reviewed-by: Marek Polacek <polacek@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Jonathan Wakely [Thu, 12 Feb 2026 18:52:12 +0000 (18:52 +0000)]
libstdc++: Fix fallback definitions of std::is_member_*_pointer
When the builtins aren't used we need a declaration of std::is_function
for the fallback definitions of std::is_member_function_pointer and
std::is_member_object_pointer.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_function): Declare before first
use.
CRIS: Make sure cstore<mode>4, cbranch<mode>4 don't have two memory operands
Yet more testing showed that compare insns too, were prone to catching
double-memory operands, for example with
c-c++-common/vector-compare-3.c -O2, from gcc.dg. So, better try to
fix them, helping current and future optimization passes that are
reluctant or unable to operate on patterns with two memory operands.
This just happens at expansion time by hacking the force_reg stuff to
conveniently happen in the operand-massaging function
cris_reduce_compare. Together, this and the two previous CRIS patches
did improve coremark results, but by a miniscule factor: speed by
0.002% (from 4887074 to 4886993 cycles) and size by 0.1% (code from
58199 to 58143 bytes) and as you can see, with rounding doing heavy
lifting.
* config/cris/cris.cc (cris_reduce_compare): Add forcing the first
operand to be a register, unless the second operand is 0, to scope.
* config/cris/cris.md ("*cstore<mode><code>4")
("*cbranch<mode><code>4"): Add guards to condition, for either operand
to be a register unless the last operand is zero.
CRIS: For HI, QI, make sure move patterns don't have two memory operands
Further testing showed that the two-memory-operands case that could
happen for movsf happened for the HI and QI modes as well, for example
in gcc.dg/Wrestrict-5.c. So, for improved performance they'd better
get guards as well. The movstrict<m> case is just tagging along for
summetry; I don't know of test-cases that expose that.
* config/cris/cris.md (BWDSF): New mode_iterator replacing SISF.
All callers changed.
("*movhi_internal<setcc><setnz><setnzvc>"): Anonymized from
"<acc><anz><anzvc>movhi<setcc><setnz><setnzvc>" to make it a
match-only pattern. Add conditions to guard from source and
destination both being memory operands.
("*movstricthi_internal", "*movstrictqi_internal"): Similarly
for "movstricthi" and "movstrictqi".
("movstrict<mode>"): Add common expander for BW, forcing one operand
to be a register or source being zero.
CRIS: Make sure movsf doesn't have two memory operands
Experimenting, I noticed movsf could get two memory operands, and
when the pass I was hacking, adjusted both operands, the rtl-ssa
framework didn't like the situation and signalled failure, for
example compiling gcc.c-torture/compile/pr85945.c. While that's
arguably a wart in rtl-ssa and may be a problem by itself, this
shouldn't happen: one operand should be either a register or
constant 0. It usually doesn't matter because RA fixes up
operands per the constraints. Still, this is low-handing fruit
for improved performance, letting the RTL passes work on more
correct information ...and also, a plausible excuse for not also
hacking rtl-ssa proper. Either way, the port is responsible for
guarding operand validity, so tweak it. Incidental observation:
the two-memory-operands case happened already at expand time.
This mem-to-mem situation doesn't happen for movsi, because it has
special precautions to keep one operand a register or const_int 0,
which were added for reasons of condition-code handling. That
particular condition, checking for REG_P or the subreg being REG_P
looks too restrictive though, not allowing the (subreg mem) case
that register_operand deliberately allows.
* config/cris/cris.md (SISF): New mode_iterator for SI and SF.
("mov<mode>"): Make "movsi" a define_expand to include SFmode by
means of the SISF iterator and adjust to also handle SFmode.
("*movsf_internal"): Anonymize "movsf"; make it a match-only pattern.
Add conditions to guard from source and destination both being memory
operands.
openmp: Allocate memory for private/firstprivate clauses as directed by allocate clauses in target constructs [PR113436]
This patch generates calls to GOMP_alloc to allocate memory for firstprivate
and private clauses on target constructs with an allocator and alignment
as specified by the allocate clause.
The decl values of the clause need to be adjusted to refer to the allocated
memory, and the initial values of variables need to be copied into the
allocated space for firstprivate variables.
For variable-length arrays, the size of the array is stored in a separate
variable, so the allocation and initialization need to be delayed until the
size is made available on the target.
gcc/
PR middle-end/113436
* omp-low.cc (is_variable_sized): Add extra is_ref argument. Check
referenced type if true.
(lower_omp_target): Call lower_private_allocate to generate code to
allocate memory for firstprivate/private clauses with allocators, and
insert code after dependent variables have been initialized.
Construct calls to free allocate memory and insert after target block.
Adjust decl values for clause variables. Copy value of firstprivate
variables to allocated memory.
Robert Dubner [Thu, 12 Feb 2026 16:11:51 +0000 (11:11 -0500)]
cobol: Repair CALL ... USING BY VALUE.
These changes cause CALL ... USING BY VALUE to work properly for a
wider range of COBOL variables types, values, and sizes. Some sizes
of numeric-display variables didn't work, some didn't work for negative
values, and floating-extended didn't work at all. Now they do.
Fourteen new DejaGnu tests cover this repaired capability.
gcc/cobol/ChangeLog:
* genapi.cc (establish_using): Use a 128-bit type for
float-extended; handle numeric-edited values of different sizes
and signs correctly.
(create_and_call): Use a 128-bit type for float-extended.
libgcobol/ChangeLog:
* Makefile.am: Temporarily continue to use -fno-strict-aliasing.
* Makefile.in: Likewise.
* libgcobol.cc (__gg__fetch_call_by_value_value): Simplify handling
of FldFloat.
(__gg__assign_value_from_stack): Likewise.
(__gg__unstring): Avoid uninitialized variable error.
(__gg__look_at_int128): New function useful for debugging.
(__gg__look_at_pointer): Likewise.
* xmlparse.cc (xml_event): Implement namespace XML.
(cdataBlock): Likewise.
(characters): Likewise.
(__gg__xml_parse): Likewise.
gcc/testsuite/ChangeLog:
* cobol.dg/group2/USING_COMP-3_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_COMP-3_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_COMP-3_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_COMP-3_BY_VALUE.out: New test.
* cobol.dg/group2/USING_FLOAT-SLX_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_FLOAT-SLX_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_FLOAT-SLX_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_FLOAT-SLX_BY_VALUE.out: New test.
* cobol.dg/group2/USING_NumericDisplay_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_NumericDisplay_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_NumericDisplay_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_NumericDisplay_BY_VALUE.out: New test.
* cobol.dg/group2/USING_Signed_-_COMP-3_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_Signed_-_COMP-3_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_Signed_-_COMP-3_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_Signed_-_COMP-3_BY_VALUE.out: New test.
* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_VALUE.out: New test.
* cobol.dg/group2/USING_Signed___COMP-3_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_Signed___COMP-3_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_Signed___COMP-3_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_Signed___COMP-3_BY_VALUE.out: New test.
* cobol.dg/group2/USING_Signed___NumericDisplay_BY_REFERENCE.cob: New test.
* cobol.dg/group2/USING_Signed___NumericDisplay_BY_REFERENCE.out: New test.
* cobol.dg/group2/USING_Signed___NumericDisplay_BY_VALUE.cob: New test.
* cobol.dg/group2/USING_Signed___NumericDisplay_BY_VALUE.out: New test.
The commit r16-7202-gb129ff0880c6d1 broke running libitm’s testsuite
using combinations of options because it didn’t clean up all the
global variables set in c++.exp. Fix the regression by using g++ for
the C++ tests and cleaning up the variables shared between C and C++
tests.
libitm/ChangeLog:
PR libitm/69018
* testsuite/lib/libitm.exp (libitm_init): Check
GXX_UNDER_TEST. Add "${blddir}/.libs" to
always_ld_library_path if blddir is not empty. Use
"-fdiagnostics-plain-output". Don't set compiler to GCC_UNDER_TEST.
* testsuite/libitm.c++/c++.exp: If $blddir is not empty set
libstdc++_library_path, shlib_ext, lang_include_flags, add
"${blddir}/${lang_library_paths}" to ld_library_path.
Unset libstdc++_library_path and shlib_ext if we skip C++
tests and at the end of the test run.
* testsuite/libitm.c/c.exp: Update the FSF address to the
website in the license text. Unset lang_library_paths and
lang_include_flags. Set the compiler to $GCC_UNDER_TEST.
Co-authored-by: Jakub Jelinek <jakub@redhat.com> Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
LIU Hao [Mon, 9 Feb 2026 13:44:07 +0000 (21:44 +0800)]
libiberty: Preserve `errno` across calls to `libiberty_vprintf_buffer_size()`
The MSVCRT `strtoul()` function resets `errno` to zero upon success. On such
a system, `libiberty_vprintf_buffer_size()` could clobber `errno` like this:
Richard Biener [Thu, 12 Feb 2026 10:08:53 +0000 (11:08 +0100)]
Move gcc.dg/vect/vec-scal-*.c and simplify globbing of the rest
The following creates a subdirectory gcc.dg/vect/veclower/ and moves
the vector lowering tests vec-scal-*.c there. This simplifies
globbing of gcc.dg/vect/ testcases, partitioning them into
bb-slp-*.c and non-bb-slp-*.c sets. I needed to rename bb-slp
files in complex/ and skip templates that are just included there.
Marek Polacek [Wed, 11 Feb 2026 20:58:46 +0000 (15:58 -0500)]
c++: missing type-only context [PR124045]
[temp.res.general]/4.4.1 says that a decl-specifier of the
decl-specifier-seq of a simple-declaration in namespace scope is
a type-only context. I think this goes back to P0634R3. So
[: ^^int :] a = 42;
shouldn't require a 'typename' when in a namespace scope.
The _diagnose_invalid_type_name change is so that we don't emit extra
error: '<expression error>' in '...' does not name a type
in concepts-return-req4.C, variadic74.C, and variadic-nested3.C.
PR c++/124045
gcc/cp/ChangeLog:
* parser.cc (cp_parser_parse_and_diagnose_invalid_type_name): Also
abort the tentative parse when id is error_mark_node.
(cp_parser_simple_declaration): Set CP_PARSER_FLAGS_TYPENAME_OPTIONAL
when in a namespace scope.
(cp_parser_single_declaration): Use cp_parser_flags instead of int.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/type1.C: Don't expect an error for a missing typename
in a namespace scope.
Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
James Bohl [Thu, 12 Feb 2026 03:42:20 +0000 (22:42 -0500)]
algol68: Fix assignment of union overhead values [PR algol68/124049]
This patch sorts union packs in the a68-parser function so that
equivalent unions defined in different packets are assigned the same
mapping of mode to overhead value.
Signed-off-by: James Bohl <bohlj47@gmail.com>
gcc/algol68/ChangeLog
PR algol68/124049
* Make-lang.in (ALGOL68_OBJS): Add algol68/a68-moids-sorting.o.
* a68.h: Add prototype for a68_sort_union_packs.
* a68-moids-sorting.cc: New file.
* a68-parser-modes.cc (a68_make_moid_list): Call a68_sort_union_packs.
* ga68-exports.pk (ga68_mode_64): Add comment on union mode ordering.
gcc/testsuite/ChangeLog
PR algol68/124049
* algol68/execute/modules/program-25.a68: New test.
* algol68/execute/modules/module25a.a68: New file.
* algol68/execute/modules/module25b.a68: New file.
Andrew Pinski [Wed, 11 Feb 2026 21:24:04 +0000 (13:24 -0800)]
ifcvt: Fix rtl checking due to reversed_comparison_code returning UNKNOWN [PR124062]
This was an oversight on my part (after r16-6435-g594f2cbf30f0a3)
where I forgot that sometimes reversed_comparison_code will return
UNKNOWN when the floating point comparison can't be reversed.
This seems only to show up with RTL checking only; at least as far
as I can tell because it is rejected later on but I could be wrong.
Bootstrapped and tested on x86_64-linux-gnu.
PR rtl-optimization/124062
gcc/ChangeLog:
* ifcvt.cc (noce_try_cond_arith): Check the conditional code
for UNKNOWN.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr124062-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Soumya AR [Tue, 10 Feb 2026 08:58:47 +0000 (08:58 +0000)]
aarch64: Fix ICE in JSON tuning schema with dispatch scheduling and update schema for SVE costs.
This patch fixes the following bugs:
1) For SVE vector costs [sve_vec_cost], the JSON schema did not list the
inherited members from the base structure, only the SVE specific ones. Updated
the schema to include all the members and regenerated the printing/parsing
routines.
2) After dispatch scheduling, if someone uses -fdump-tuning-model with
mcpu=olympus, it will have the flag for dispatch scheduling enabled. Then, if
someone uses that dump against any -mcpu other than Olympus for tuning, it will
ICE as we enable dispatch scheduling but don't provide the data. Updated this
to clear the flag if dispatch_constraints is NULL.
Signed-off-by: Soumya AR <soumyaa@nvidia.com>
gcc/ChangeLog:
* config/aarch64/aarch64-json-schema.h: Include inherited members for
SVE vector costs.
* config/aarch64/aarch64-json-tunings-parser-generated.inc
(parse_vec_costs_sve): Regenerate.
* config/aarch64/aarch64-json-tunings-parser.cc
(aarch64_load_tuning_params_from_json_string): Clear dispatch scheduling
flag if dispatch_constraints is NULL.
* config/aarch64/aarch64-json-tunings-printer-generated.inc
(serialize_vec_costs_sve): Regenerate.
Patrick Palka [Thu, 12 Feb 2026 02:35:35 +0000 (21:35 -0500)]
c++: relax ref-qual overloading rules for C++20 [PR98939]
As explained in one of Tomasz's library papers P2438R2[1], C++20 allows
ref-qualified member overloads to coexist with non-ref-qualified ones,
but at the time of writing no compiler supported that. This patch
implements this C++20 relaxation so that we can in turn implement
P2438R2 as originally intended -- without needing to change the
signature of the main string::substr overload.
Patrick Palka [Thu, 12 Feb 2026 02:35:21 +0000 (21:35 -0500)]
libstdc++: Clear padding bits in std::atomic ctor in C++11 [PR114865]
After the front end change r16-7199 both GCC and Clang allow non-empty
constexpr constructor bodies in C++11 as an extension, so we can now
unconditionally enable the __builtin_clear_padding logic in std::atomic's
constructor.
PR libstdc++/114865
libstdc++-v3/ChangeLog:
* include/std/atomic (atomic<_Tp>::atomic(_Tp)) [C++11]:
Enable __builtin_clear_padding logic.
* testsuite/29_atomics/atomic/compare_exchange_padding.cc: Enable
this test in earlier modes, including C++11.
* testsuite/29_atomics/atomic/cons/zero_padding.cc [C++11]:
Enable tests verifying cleared padding bits for a non-static-init
std::atomic object.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
David Malcolm [Thu, 12 Feb 2026 01:49:44 +0000 (20:49 -0500)]
analyzer: fix false +ve buffer overflow on sprintf [PR117369]
gcc/analyzer/ChangeLog:
PR analyzer/117369
* kf.cc (kf_sprintf::impl_call_pre): Use the capacity of the
region when "faking" a write to the destination buffer, to
avoid buffer overflow false +ves.
gcc/testsuite/ChangeLog:
PR analyzer/117369
* c-c++-common/analyzer/sprintf-pr117369.c: New test.
* gcc.dg/analyzer/doom-d_main-IdentifyVersion.c: Update expected
results to reflect complexity limits being hit earlier.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Thu, 12 Feb 2026 01:49:43 +0000 (20:49 -0500)]
analyzer: fix ICE in push_frame with missing return statement [PR124073]
gcc/analyzer/ChangeLog:
PR analyzer/124073
* region-model.cc (region_model::push_frame): Bulletproof against
DECL_RESULT having null SSA on function missing a return
statement (-Wreturn-type).
gcc/testsuite/ChangeLog:
PR analyzer/124073
* g++.dg/analyzer/ice-pr124073.C: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Joseph Myers [Wed, 11 Feb 2026 23:53:41 +0000 (23:53 +0000)]
testsuite: Use color=never for more sanitizer tests
The sanitizer tests have logic to set ASAN_OPTIONS and UBSAN_OPTIONS
to color=never to avoid problems checking against output patterns, in
test configurations where the output is otherwise coloured by default.
This does not however cover all sanitizer tests with issues in such
configurations. There is no corresponding logic to set TSAN_OPTIONS
for tsan tests, and environment variable settings in
dg-set-target-env-var override the globally set color=never.
Add logic to set TSAN_OPTIONS similarly (following the UBSAN_OPTIONS
logic, that saves and restores any previous setting or lack thereof,
rather than the ASAN_OPTIONS logic, that just sets ASAN_OPTIONS in the
environment so that it remains set for all the rest of the possibly
unrelated tests included in the same runtest execution). Also add
color=never to dg-set-target-env-var in two such tests where I've seen
coloured output causing failures (but not for other tests where I
haven't seen the default producing such fallures).
Tested for x86_64-pc-linux-gnu, and with a cross to aarch64-linux
(together with other testsuite fixes) in a configuration where I
previously saw failures related to colour output from sanitizer tests.
* lib/tsan-dg.exp (orig_tsan_options_saved, orig_tsan_options):
New global variables.
(tsan_init): Save TSAN_OPTIONS and set it to color=never.
(tsan_finish): Restore TSAN_OPTIONS.
* c-c++-common/asan/pr64820.c: Include color=never in
ASAN_OPTIONS.
* c-c++-common/asan/use-after-return-1.c: Likewise.
[PR121191, LRA]: Check int modes to generate the right subreg offset when matching reload regs of different modes
In the PR test case (gcc.c-torture/compile/pr35318.c), LRA chose to
match operands in DFmode and SImode modes. On big endian targets,
this resulted in wrong subreg offset generation and wrong insn
generation. The offset would be right if the both operands were
scalar integers (see call of reload.cc:operands_match_p in
recog.cc:constrain_operands). The patch solves the problem.
gcc/ChangeLog:
PR rtl-optimization/121191
* lra-constraints.cc (get_matching_reload_reg_subreg): New.
(get_reload_reg, match_reload): Use it.
Tomasz Kamiński [Mon, 2 Feb 2026 09:19:51 +0000 (10:19 +0100)]
libstdc++: Make function_ref non-dangling for stateless wrappers
This patch makes the function_ref non-dangling for the stateless
wrappers:
* any functor for which operator() selected for arguments is static,
* standard functors, including pre-C++20 ones.
In other words, any function_ref fr, that is constructed from stateless
wrapper w, can be still called after the object w is destroyed, e.g.:
std::function_ref<bool(int, int)> fr(std::ranges::less{});
fr(1, 2); // OK, previously UB because fr referred to already destroyed
// temporary
As function_ref's operator() is not constexpr, we test the change by checking
if the above declaration can be made constexpr, as such variable cannot contain
dangling pointer values.
We adjust the function_ref generic constructor from any functor, to use more
specialized invoker:
* _S_static (newly added) if the called operator() overload is static,
after changes r16-5624-g0ea9d760fbf44c, this covers all post-c++20 functors;
* _S_nttp<_Fd{}> for pre-C++20 standard functors.
In both above cases the value of _M_ptrs is ignored and simply set to nullptr.
This follows same technique (checking _Fd::operator()(args...)), and support
the same set of types, as for one used for the transform views iterators in r16-5625-g9ed821d107f7a1.
As after this change we provide well-defined behavior for the code, that
previous was undefined, this changes is pure quality-of-implementation.
As illustrated by the test cases, it has observable side effects, where
non-longer dangling constructs can be used to define constexpr function_ref.
However, the standard does not define when the constructors defined constexpr
are actually usable at compile time, and the already have precedent in form
of SSO string for validity such constructs being implementation specific.
libstdc++-v3/ChangeLog:
* include/bits/funcref_impl.h (function_ref::function_ref(_Fn&&)):
Use _S_static and _S_nttp invokers.
* include/bits/funcwrap.h (_Base_invoker::_S_static):
Define.
* include/bits/stl_function.h (std::__is_std_op_template)
(std::__is_std_op_wrapper) [__cplusplus > 201703L]:
Moved from std/ranges.
* include/std/ranges (__detail::__is_std_op_template)
(__detail::__is_std_op_wrapper): Moved to bits/stl_function.h.
* testsuite/20_util/function_ref/dangling.cc: New test.
* testsuite/20_util/function_ref/dangling_neg.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Chris Bazley [Wed, 11 Feb 2026 15:53:22 +0000 (15:53 +0000)]
AArch64: Add tests to ensure rev is produced
If the compiler mistakenly vectorizes byte order reversal
then the resultant code is inevitably less efficient than a
rev instruction. This kind of error will become more likely if
SVE predication is ever used to vectorize smaller groups
than could be vectorized using ASIMD instructions. Add tests to
guard against future regressions.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/rev_32_1.c: New test.
* gcc.target/aarch64/rev_32_2.c: New test.
* gcc.target/aarch64/rev_32_3.c: New test
David Malcolm [Wed, 11 Feb 2026 13:51:16 +0000 (08:51 -0500)]
analyzer: fix uninit in null-termination checking [PR124055]
gcc/analyzer/ChangeLog:
PR analyzer/124055
* kf.cc (kf_strcpy::impl_call_pre): Ensure bytes_to_copy is
initialized. Assert that it was written to with non-null if
check_for_null_terminated_string_arg returns non-null.
* region-model.cc (region_model::scan_for_null_terminator):
Initialize *out_sval, and assert it is written to when
returning non-null.
(region_model::check_for_null_terminated_string_arg): Assert
that scan_for_null_terminator wrote to *out_sval if it
returns non-null.
gcc/testsuite/ChangeLog:
PR analyzer/124055
* gcc.dg/analyzer/ice-pr124055-1.c: New test.
* gcc.dg/analyzer/ice-pr124055-2.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Richard Biener [Wed, 11 Feb 2026 08:50:55 +0000 (09:50 +0100)]
Use dg-additional-options in vect.exp, simplify file globbing
This makes use of dg-additional-options for the remainder of tests
that were still getting those by filename based rules. This moves
all those under the vect option iteration and slightly simplifies
globbing by moving some files. I've kept the the veclower test glob.
IMO remaining simplification either needs mass renaming of files or/and moving
them into subdirectories. Possibly some regex or TCL expert can
figure out how to filter bb-slp-*.c and vec-scal-*.c from everything
else that's now catched by 17 inclusive regexp.
Tamar Christina [Wed, 11 Feb 2026 11:36:50 +0000 (11:36 +0000)]
middle-end: partially revert fix for PR123898 after fix for PR123940 [PR124038]
There were two mutually incompatible changes reviewed and
merged around the same time for different issues in
convert_mult_to_fma.
the change in r16-7353 keeps result in it's unpromoted form
and deals with it as such but the change in r16-7304 expects
it to be in it's promoted form.
This causes the assert to fail again and the SVE testcase I
added before to fail.
Since the value is now kept in it's unpromoted form, and result
is not used as any LHS side, I've partially reverted the
convert stripping to make use of it.
Eric Botcazou [Wed, 11 Feb 2026 10:38:24 +0000 (11:38 +0100)]
Ada: Fix internal error on access attribute used as subpool in allocator
This is a regression present for quite a long time: the compiler aborts
on an allocator whose subpool name is an access attribute and when an
allocation procedure must be generated, for example when the allocation
is controlled.
The fix is to do what is done elsewhere in Build_Allocate_Deallocate_Proc,
that is to say pass the allocation procedure as the new scope in the call
to the New_Copy_Tree function.
gcc/ada/
PR ada/124054
* exp_util.adb (Build_Allocate_Deallocate_Proc): Tidy up and pass
Proc_Id as the new scope in the call to the New_Copy_Tree function.
gcc/testsuite/
* gnat.dg/allocator4.adb: New test.