]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 months agolibstdc++: Reject using views::iota on iota_view.
Tomasz Kamiński [Fri, 24 Apr 2026 11:02:22 +0000 (13:02 +0200)] 
libstdc++: Reject using views::iota on iota_view.

Resolves LWG4096, views::iota(views::iota(0)) should be rejected.

For __e of type _Tp that is specialization of iota_view, the CTAD based
expression iota_view(__e) is well formed, and creates a copy of __e.
As iota_view<decay_t<_Tp>> is ill-formed in this case (iota_view is not
weakly_incrementable), using that type in return type explicitly, removes
the overload from overload resolution in this case.

The (now redudant) __detail::__can_iota_view constrain in template head is
preserved, to provide error messages consistent with adaptors for other
non-incrementable types.

libstdc++-v3/ChangeLog:

* include/std/ranges (_Iota::operator()(_Tp&&)): Replace
auto return type and CTAD with iota_view<decay_t<_Tp>>.
* testsuite/std/ranges/iota/iota_view.cc: Tests if
views::iota(iota_view) is rejected.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Constrain views::adjacent(_transform)?<0> to forward_ranges.
Tomasz Kamiński [Fri, 24 Apr 2026 09:58:39 +0000 (11:58 +0200)] 
libstdc++: Constrain views::adjacent(_transform)?<0> to forward_ranges.

This resolves LWG 4098, "views::adjacent<0> should reject non-forward ranges"
which was approved in Sofia 2024.

libstdc++-v3/ChangeLog:

* include/std/ranges (_AdjacentTransform::operator())
(_Adjacent::operator()): Require forward_range for N == 0.
* testsuite/std/ranges/adaptors/adjacent/1.cc: Test if input_ranges
are rejected.
* testsuite/std/ranges/adaptors/adjacent_transform/1.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment for LWG4083.
Tomasz Kamiński [Fri, 24 Apr 2026 09:13:02 +0000 (11:13 +0200)] 
libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment for LWG4083.

The LWG4083, "views::as_rvalue should reject non-input ranges" is resolved,
as input_range<_Range> is implied by __detail::__can_as_rvalue_view<_Range>.

libstdc++-v3/ChangeLog:

* include/std/ranges: Add comment for LWG4083.

3 months agox86_cse: Use integer load for CONST_VECTOR load
H.J. Lu [Thu, 23 Apr 2026 22:39:44 +0000 (06:39 +0800)] 
x86_cse: Use integer load for CONST_VECTOR load

CONST_VECTOR load no larger than integer register

(set (reg:V2QI 294)
     (const_vector:V2QI [(const_int 0 [0]) repeated x2]))

can use integer load.  Use inner mode as the scalar mode for CONST_VECTOR
load source.

gcc/

PR target/125009
* config/i386/i386-features.cc (ix86_place_single_vector_set):
Support CONST_VECTOR load no larger than integer register.
(ix86_broadcast_inner): Use inner mode as the scalar mode for
CONST_VECTOR load source.
(pass_x86_cse::x86_cse): Generate CONST_VECTOR broadcast source
for CONST_VECTOR load no larger than integer register.

gcc/testsuite/

PR target/125009
* g++.target/i386/pr125009.C: New test.
* gcc.target/i386/pr125009.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months agolibstdc+: Provide iterator type for basic_const_iterator.
Tomasz Kamiński [Fri, 24 Apr 2026 08:40:19 +0000 (10:40 +0200)] 
libstdc+: Provide iterator type for basic_const_iterator.

This resolves LWG 4253, "basic_const_iterator should provide iterator_type"
which was approved in Kona 2025.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (basic_const_iterator::iterator_type):
Define.
* testsuite/24_iterators/const_iterator/1.cc: Tests for
iterator_type.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agotree-optimization/124843 - vectorize inversion of scalar bools
Richard Biener [Wed, 15 Apr 2026 09:10:56 +0000 (11:10 +0200)] 
tree-optimization/124843 - vectorize inversion of scalar bools

Scalar bool inversion vectorization fails due to bools having
bit precision.  The following adds a pattern to rewrite it
to the corresponding BIT_XOR_EXPR operation which we can vectorize
just fine.

PR tree-optimization/124843
* tree-vect-patterns.cc (vect_recog_bool_pattern): Recognize
BIT_NOT_EXPR of scalar bools and rewrite with BIT_XOR_EXPR.

* gcc.dg/vect/vect-bool-4.c: New testcase.

3 months agoImprove points-to after vectorization
Richard Biener [Mon, 13 Apr 2026 12:07:39 +0000 (14:07 +0200)] 
Improve points-to after vectorization

The following teaches the vectorizer to create points-to info from
non-pointer accesses like copy_ref_info does.

* tree-vect-data-refs.cc (vect_duplicate_ssa_name_ptr_info):
Create points-to info from decl-based accesses.
(vect_create_addr_base_for_vector_ref): Adjust.
(vect_create_data_ref_ptr): Likewise.
(bump_vector_ptr): Likewise.

3 months agoSLP pattern TLC
Richard Biener [Thu, 9 Apr 2026 13:18:16 +0000 (15:18 +0200)] 
SLP pattern TLC

The following removes STMT_VINFO_SLP_VECT_ONLY_PATTERN which only
exists so we can do some cleanup that doesn't seem to be necessary.
We've been cleaning the original to pattern stmt link, but
add_pattern_stmt never sets that up - it only sets up the pattern
to original stmt link, so the SLP pattern is only reachable from
the pattern SLP nodes representative.

* tree-vectorizer.h (_stmt_vec_info::slp_vect_pattern_only_p):
Remove.
(STMT_VINFO_SLP_VECT_ONLY_PATTERN): Likewise.
* tree-vectorizer.cc (vec_info::new_stmt_vec_info): Do not
initialize STMT_VINFO_SLP_VECT_ONLY_PATTERN.
* tree-vect-loop.cc (vect_analyze_loop_2): Nothing to do
for SLP pattern stmts that are not reachable from scalar
stmts anyway.  Remove dead code.
* tree-vect-slp-patterns.cc (complex_pattern::build): Do not
set STMT_VINFO_SLP_VECT_ONLY_PATTERN.
(addsub_pattern::build): Likewise.
* tree-vect-slp.cc (vect_free_slp_tree): Remove dead code.

3 months agoSLP pattern TLC
Richard Biener [Thu, 9 Apr 2026 13:01:14 +0000 (15:01 +0200)] 
SLP pattern TLC

The following removes setting of STMT_VINFO_REDUC_DEF on pattern
stmts - those are only ever checked on original scalar stmts now.
But for that to work we have to make the related stmt of the new
SLP pattern stmts the original stmt of a possible pattern.

The only valid SLP_TREE_CODE are VEC_PERM_EXPR and ERROR_MARK,
do not set it to CALL_EXPR.

* tree-vect-slp-patterns.cc (complex_pattern::build):
Add pattern for the original stmt, do not set
STMT_VINFO_REDUC_DEF.
(addsub_pattern::build): Likewise.

3 months agolibstdc++: Update tzdata to 2026a
Jonathan Wakely [Fri, 12 Jan 2024 16:57:41 +0000 (16:57 +0000)] 
libstdc++: Update tzdata to 2026a

Import the new 2026a tzdata.zi file and new leapseconds expiry date.

libstdc++-v3/ChangeLog:

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

3 months agoDo not use DEFAULT_CFLAGS in ieee.exp [PR125003]
feedable [Thu, 23 Apr 2026 21:38:41 +0000 (00:38 +0300)] 
Do not use DEFAULT_CFLAGS in ieee.exp [PR125003]

ieee.exp tries to inherit flags from DEFAULT_CFLAGS, which is sometimes set and sometimes unset
When it is set, it is set to "-ansi -pedantic-errors", which causes spurious failures.

Introduce a new variable, DEFAULT_IEEE_CFLAGS, which is independent of
DEFAULT_CFLAGS, but which boards may still override if needed.
It includes the default of "-w -fno-inline" as it was in the old style testcases.

Then the target specific flags should not be stored out in DEFAULT_IEEE_CFLAGS but they
are needed for the default flags passed to the compiler. They can't be stored out to
DEFAULT_IEEE_CFLAGS as for x86, depending on if -m32 or -m64 is first, -ffloat-store might
be included for -m64 or not. We don't want it to be there for -m64.

PR testsuite/125003

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/ieee/ieee.exp: Rewrite the default flags
and set DEFAULT_IEEE_CFLAGS if not already set.

Co-authored-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agomatch.pd: x != -CST ? x + CST : 0 -> x + CST [PR122996]
Netanel Komm [Sat, 11 Apr 2026 11:15:44 +0000 (14:15 +0300)] 
match.pd: x != -CST ? x + CST : 0 -> x + CST [PR122996]

This patch simplifies expressions of the form x != CST1 ? x + CST2 : 0
into x + CST2 when CST1 == -CST2. This comes up, for example, when
dealing with 'rtrim'-style operations.

Bootstrapped and regression tested on x86_64-pc-linux-gnu.

PR tree-optimization/122996

gcc/ChangeLog:

* match.pd (x != CST1 ? x + CST2 : 0 -> x + CST2): New pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr122996.c: New test.

Signed-off-by: Netanel Komm <netanelkomm@gmail.com>
3 months agotree-optimization/124947 - IVOPTs emits uninit use
Richard Biener [Tue, 21 Apr 2026 08:21:34 +0000 (10:21 +0200)] 
tree-optimization/124947 - IVOPTs emits uninit use

The following prevents IVOPTs from rewriting a compare using an IV
that involves undefined SSA vars.

PR tree-optimization/124947
* tree-ssa-loop-ivopts.cc (may_eliminate_iv): Do not use
a candidate that involves undefs.

* gcc.dg/pr124947.c: New testcase.

3 months agotree-optimization/124946 - signed overflow with emulated mixed dot-prod
Richard Biener [Tue, 21 Apr 2026 07:54:31 +0000 (09:54 +0200)] 
tree-optimization/124946 - signed overflow with emulated mixed dot-prod

When biasing the unsigned vector operand we have to perform that in
an unsigned type to avoid possible signed overflow.

PR tree-optimization/124946
* tree-vect-loop.cc (vect_emulate_mixed_dot_prod): Perform the
constant biasing in an unsigned type.

3 months agoDaily bump.
GCC Administrator [Fri, 24 Apr 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

3 months agoc++/modules: stream PTRMEM_CST_LOCATION and TRAIT_EXPR_LOCATION
Patrick Palka [Thu, 23 Apr 2026 22:31:56 +0000 (18:31 -0400)] 
c++/modules: stream PTRMEM_CST_LOCATION and TRAIT_EXPR_LOCATION

gcc/cp/ChangeLog:

* module.cc (trees_out::core_vals) <case PTRMEM_CST>:
Stream PTRMEM_CST_LOCATION.
<case TRAIT_EXPR>: Stream TRAIT_EXPR_LOCATION.
(trees_in::core_vals): As in trees_out::core_vals.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/modules: PTRMEM_CST member considered unused [PR124981]
Patrick Palka [Thu, 23 Apr 2026 22:31:53 +0000 (18:31 -0400)] 
c++/modules: PTRMEM_CST member considered unused [PR124981]

Here in _b.C the needed specialization A<B, &B::g> has already been
instantiated in module M, so we stream it in rather than instantiate it.
We then proceed to instantiate A<B, &B::g>::f() whose definition invokes
the pointer-to-member &B::g but it turns out that nothing has marked
B::g as used in this TU so we neglect to emit it and linking fails.

We do mark B::g as used during instantiation of A<B, &B::g> via
mark_template_arguments_used, but this instantiaton happens in module M
not the importer, and TREE_USED is deliberately not streamed.

This patch fixes this by setting TREE_USED on PTRMEM_CST_MEMBER during
stream-in, via the RTU macro, which seems sufficient to ensure B::g gets
emitted.  This macro is already used for streaming in subexpressions and
BASELINK_FUNCTIONS so using it for PTRMEM_CST_MEMBER doesn't seem too
out of place.

PR c++/124981

gcc/cp/ChangeLog:

* module.cc (trees_in::core_vals) <case PTRMEM_CST>: Use RTU
instead of RT to stream PTRMEM_CST_MEMBER.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++: introduce lookup_annotation
Marek Polacek [Thu, 23 Apr 2026 16:43:06 +0000 (12:43 -0400)] 
c++: introduce lookup_annotation

This patch introduces a new helper for looking up annotations.

gcc/cp/ChangeLog:

* cp-tree.h (lookup_annotation): Declare.
* decl.cc (grokfndecl): Use lookup_annotation.
(grokdeclarator): Likewise.
* name-lookup.cc (push_local_extern_decl_alias): Likewise.
* parser.cc (cp_parser_decomposition_declaration): Likewise.
* reflect.cc (eval_annotations_of): Likewise.
* tree.cc (lookup_annotation): New.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++: add lk_module
Marek Polacek [Tue, 20 Jan 2026 21:16:33 +0000 (16:16 -0500)] 
c++: add lk_module

During Reflection review it came up that we don't have lk_module.
Instead, we're checking lk_external && DECL_MODULE_ATTACH_P &&
!DECL_MODULE_EXPORT_P.  This patch adds lk_module which allows further
cleanups.

I'm not sure the cp_parser_template_argument change is required.

gcc/cp/ChangeLog:

* cp-tree.h (enum linkage_kind): Add lk_module.
* module.cc (check_module_decl_linkage): Use DECL_EXTERNAL_LINKAGE_P.
* name-lookup.cc (check_can_export_using_decl): Don't check for
attachment.
* parser.cc (cp_parser_template_argument): Check that linkage isn't
lk_module.
* reflect.cc (eval_has_module_linkage): Check lk_module.
(eval_has_external_linkage): Use DECL_EXTERNAL_LINKAGE_P.
* tree.cc (decl_linkage): Return lk_module if appropriate.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++: CWG 2229, cv-qualified unnamed bit-fields [PR123935]
Marek Polacek [Tue, 3 Feb 2026 03:07:47 +0000 (22:07 -0500)] 
c++: CWG 2229, cv-qualified unnamed bit-fields [PR123935]

This implements [class.bit]/2: An unnamed bit-field shall not be
declared with a cv-qualified type.  This was clarified in DR 2229.

DR 2229
PR c++/123935

gcc/cp/ChangeLog:

* decl2.cc (grokbitfield): Add pedwarn for cv-qualified unnamed
bit-fields.

gcc/testsuite/ChangeLog:

* g++.dg/DRs/dr2229.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: erroneous access check on dependent splice [PR124989]
Marek Polacek [Wed, 22 Apr 2026 21:17:05 +0000 (17:17 -0400)] 
c++/reflection: erroneous access check on dependent splice [PR124989]

When processing &[:R:] in cp_parser_splice_expression, we call
build_offset_ref with access checking turned off via push_ and
pop_deferring_access_checks, but the same pair of calls is not
present around the call to build_offset_ref in tsubst_splice_expr
and so the following test fails to compile due to access control
checking failures.

PR c++/124989

gcc/cp/ChangeLog:

* pt.cc (tsubst_splice_expr): Turn off access checking for the
build_offset_ref call.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
3 months ago[PATCH] RISC-V: Omit ghost from the pipeline-checker output
Michiel Derhaeg [Thu, 23 Apr 2026 14:54:07 +0000 (08:54 -0600)] 
[PATCH] RISC-V: Omit ghost from the pipeline-checker output

I noticed some pipelines erroneously provide reservations for ghost.
Likely because the pipeline-checker will report it as missing.

This patch filters out all default reservations (only ghost now) from
riscv.md.

gcc/ChangeLog:

* config/riscv/pipeline-checker: Filter tuneless insn types.

Signed-off-by: Michiel Derhaeg <michiel@synopsys.com>
3 months agoc++: revert fix for PR41127 [PR118374]
Ben Wu [Tue, 21 Apr 2026 00:08:49 +0000 (20:08 -0400)] 
c++: revert fix for PR41127 [PR118374]

Previously, we did not parse definitely in cp_parser_enum_specifier
after seeing CPP_COLON, since we allowed for bitfield widths to follow
"enum identifier :" in member-declarations. However, ISO says that in
such a situation, the colon should be parsed as an enum-base
([dcl.enum]/a), which means bitfield widths are not allowed. This
patch reverts the changes which allowed for bitfield widths, since
parsing definitely improves diagnostics for errant underlying types.

This reverts SVN r151246.

PR c++/118374
PR c++/41127

gcc/cp/ChangeLog:

* parser.cc (cp_parser_enum_specifier): Parse definitely
before cp_parser_type_specifier_seq.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/enum1.C: Update test.
* g++.dg/parse/enum5.C: Expect error with bitfield width
and enum-key in member.
* g++.dg/cpp0x/enum45.C: New test.

3 months agoc++: Add support for [[gnu::trivial_abi]] attribute [PR107187]
Yuxuan Chen [Tue, 21 Apr 2026 00:08:49 +0000 (20:08 -0400)] 
c++: Add support for [[gnu::trivial_abi]] attribute [PR107187]

Implement the trivial_abi attribute for GCC to fix ABI compatibility
issues with Clang. Currently, GCC silently ignores this attribute,
causing call convention mismatches when linking GCC-compiled code with
Clang-compiled object files that use trivial_abi types.

This attribute allows types to be treated as trivial for ABI purposes,
enabling pass in registers instead of invisible references. The
attribute is supported with `__attribute__((trivial_abi))` and
`[[clang::trivial_abi]]` spellings.

PR c++/107187

gcc/cp/ChangeLog:

* cp-tree.h (has_trivial_abi_attribute): New function.
(validate_trivial_abi_attribute): Declare.
(classtype_has_non_deleted_copy_or_move_ctor): Declare.
(cxx_clang_attribute_table): Declare.
* tree.cc (handle_trivial_abi_attribute): New function.
(handle_gnu_trivial_abi_attribute): New function.
(classtype_has_trivial_abi): New function.
(validate_trivial_abi_attribute): New function.
(cxx_gnu_attributes): Add trivial_abi entry.
(cxx_clang_attributes): New table for [[clang::trivial_abi]].
* class.cc (finish_struct_bits): Skip BLKmode for types with
trivial_abi attribute.
(classtype_has_non_deleted_copy_or_move_ctor): New function.
(finish_struct_1): Call validate_trivial_abi_attribute before
finish_struct_bits.
* cp-objcp-common.h (cp_objcp_attribute_table): Register
cxx_clang_attribute_table.
* decl.cc (store_parm_decls): Register cleanups for trivial_abi
parameters.

gcc/ChangeLog:

* doc/extend.texi: Document __attribute__((trivial_abi)).

Signed-off-by: Yuxuan Chen <i@yuxuan.ch>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++: fix typo in consteval, array, modules [PR124973]
Jason Merrill [Thu, 23 Apr 2026 13:20:57 +0000 (09:20 -0400)] 
c++: fix typo in consteval, array, modules [PR124973]

Argh, I must have typoed when I realized that we wanted to check
ff_genericize here rather than !ff_only_non_odr.  And didn't notice the
problem because I also forgot the -O in the testcase.

PR c++/124973

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_fold_r): Fix typo.

gcc/testsuite/ChangeLog:

* g++.dg/modules/consteval-1_b.C: Add -O.

3 months agoRISC-V: Add SUBREG_PROMOTED annotation to min/max si3 expansion
Philipp Tomsich [Thu, 23 Apr 2026 13:31:32 +0000 (07:31 -0600)] 
RISC-V: Add SUBREG_PROMOTED annotation to min/max si3 expansion

The <bitmanip_optab>si3 expansion for smin/smax/umin/umax sign-extends
both inputs and then performs the DImode min/max, which returns one of
its inputs unchanged.  The result is therefore always sign-extended,
but the missing SUBREG_PROMOTED annotation on the lowpart caused GCC
to emit a redundant sext.w.

Add the SUBREG_PROMOTED_VAR_P / SUBREG_PROMOTED_SET(SRP_SIGNED)
annotation, matching rotrsi3, rotlsi3, and other si3 expansions.

gcc/ChangeLog:

* config/riscv/bitmanip.md (<bitmanip_optab>si3): Add
SUBREG_PROMOTED annotation to lowpart result.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zbb-min-max-05.c: New test.
* gcc.target/riscv/zbb-min-max-06.c: New test.
* gcc.target/riscv/zbb-min-max-07-run.c: New test.

3 months ago[PR target/124029][RISC-V] Adjust cost of comparisons
Andrew Pinski [Wed, 22 Apr 2026 19:29:26 +0000 (13:29 -0600)] 
[PR target/124029][RISC-V] Adjust cost of comparisons

> Given this is a relatively straightforward define_split, it is likely a good
> case for Austin to chase down.

Actually it is easier than that
The middle-end has a costing mechism for this already:
```
;; cmp: le, old cst: (const_int 268435455 [0xfffffff]) new cst: (const_int 268435456 [0x10000000])
;; old cst cost: 4, new cst cost: 4
```

You need to implement a COMPARE cost part of the riscv_rtx_costs like it is
done for aarch64_rtx_costs.

It won't be 100% exact because in riscv case there is no COMPARE instruction.
But at least it might be more about the costs of generating which constant and
all.

PR target/124029
gcc/
* config/riscv/riscv.cc (riscv_rtx_costs): Improve costing of COMPARE
nodes.

gcc/testsuite
* gcc.target/riscv/pr124029.c: New test.
* gcc.target/riscv/rvv/autovec/struct/struct_vect-2.c: Adjust
expected output.

Co-authored-by: Jeff Law <jeffrey.law@oss.qualcomm.com>
3 months agoc++/reflection: reflect on dependent class template [PR124926]
Marek Polacek [Wed, 22 Apr 2026 15:36:37 +0000 (11:36 -0400)] 
c++/reflection: reflect on dependent class template [PR124926]

Here we issue a bogus error for

  ^^Cls<T>::template Inner

where Inner turns out to be a class type, but we created a SCOPE_REF
because we can't know in advance what it will substitute into, and

  ^^typename Cls<T>::template Inner

is invalid.  The typename can only be used in

  ^^typename Cls<T>::template Inner<int>

We're taking a reflection so both types and non-types are valid, so
I think we shouldn't give the error for ^^, and take the reflection
of the TEMPLATE_DECL.

PR c++/124926

gcc/cp/ChangeLog:

* pt.cc (tsubst_qualified_id): Rename name_lookup_p parameter to
reflecting_p.  Check !reflecting_p instead of name_lookup_p.  Do
not give the "instantiation yields a type" error when reflecting_p
is true.
(tsubst_expr) <case REFLECT_EXPR>: Adjust the call to
tsubst_qualified_id.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
3 months agotestsuite: Check configured assembler in gcc.misc-tests/options.exp
Rainer Orth [Thu, 23 Apr 2026 11:47:42 +0000 (13:47 +0200)] 
testsuite: Check configured assembler in gcc.misc-tests/options.exp

When I recently dropped --with-gnu-as from my builds which had become
unnecessary, several tests started to FAIL, e.g.

FAIL: compiler driver --coverage option(s) (assembler options)

and all other "(assembler options)" tests in gcc.misc-tests/options.exp.

This happends because my builds use something like
--with-as=/vol/gcc/bin/gas-2.46 instead of relying on a random bundled
version of gas.  Therefore the configured assembler name doesn't end in
"as".

The assembler options check in options.exp (check_for_all_options) looks
for

" *as(\\.exe)? .*$as_pattern"

in the gcc -v output, with an empty as_pattern.

While gcc was configured with --with-gnu-as, the gcc -v output starts
with

Configured with:...---with-gnu-as ...

later followed by

 /vol/gcc/bin/gas-2.46 -v -V -Qy -s --32 -o /var/tmp//ccr7.tAa.o /var/tmp//ccRnpmxb.s

Since Tcl does multiline matching by default, the first line did match
the pattern although the actual assembler invokation does not.

To avoid this, this patch does two things:

* Use newline-sensitive matching.

* Check for the actual configured assembler instead of assuming its name
  ends in as.

Tested on i386-pc-solaris2.11 configured with --with-as as above and
x86_64-pc-linux-gnu without --with-as, thus picking up as from PATH.

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

gcc/testsuite:
* gcc.misc-tests/options.exp (check_for_all_options): Check for
configured assembler.

3 months agolibstdc++: Include bool conversion in noexcept specification of indirect::operator==.
Tomasz Kamiński [Wed, 22 Apr 2026 14:10:26 +0000 (16:10 +0200)] 
libstdc++: Include bool conversion in noexcept specification of indirect::operator==.

This expands the resolution of LWG4325 to heterogenous comparision
with T per standard draft (see corresponding commit [1]).

[1] https://github.com/cplusplus/draft/pull/8935/changes/833d635d648cdbd06c9935acccf925ee0aea3c79

libstdc++-v3/ChangeLog:

* include/bits/indirect.h (indirect::operator==): Adjust
noexcept specification.
* testsuite/std/memory/indirect/relops.cc: New test for noexcept
specification.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Implement __integral_constant_like in terms of __constexpr_wrapper_like.
Tomasz Kamiński [Tue, 21 Apr 2026 12:34:40 +0000 (14:34 +0200)] 
libstdc++: Implement __integral_constant_like in terms of __constexpr_wrapper_like.

This implements LWG4486. integral-constant-like and constexpr-wrapper-like
exposition-only concept duplication.

libstdc++-v3/ChangeLog:

* include/bits/simd_details.h (simd::__constexpr_wrapper_like):
Move to...
* include/std/concepts (std::__constexpr_wrapper_like): Moved
from bits/simd_details.h.
* include/std/span (std::__integral_constant_like): Define in
terms of __constexpr_wrapper_like.
* testsuite/std/simd/traits_impl.cc: Added using declaration
for std::__constexpr_wrapper_like.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agoi386: Bump STACK_CHECK_PROTECT for 64-bit Windows
Eric Botcazou [Thu, 23 Apr 2026 07:37:18 +0000 (09:37 +0200)] 
i386: Bump STACK_CHECK_PROTECT for 64-bit Windows

This is required for -fstack-check to be able to properly recover from a
stack overflow condition on (some configurations of) Windows Server 2025.

gcc/
* config/i386/cygming.h (STACK_CHECK_PROTECT): Define.

3 months agolibgcc: Honor LDFLAGS_FOR_TARGET for shared libgcc on Windows
Eric Botcazou [Thu, 23 Apr 2026 07:29:46 +0000 (09:29 +0200)] 
libgcc: Honor LDFLAGS_FOR_TARGET for shared libgcc on Windows

Unlike for other targets, LDFLAGS_FOR_TARGET is not honored on Windows when
the shared libgcc is built.

libgcc/
* config/i386/t-slibgcc-cygming (SHLIB_LINK): Add $(LDFLAGS).

3 months agox86: Don't check SSE2 in x86_cse::gate
H.J. Lu [Wed, 22 Apr 2026 22:48:22 +0000 (06:48 +0800)] 
x86: Don't check SSE2 in x86_cse::gate

commit 5cf1b9a03ec5b617af8c50c1e9c0d223083fd7f2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Aug 19 11:50:41 2022 -0700

    x86-64: Remove redundant TLS calls

changed the x86_cse pass to also remove redundant TLS calls.  Remove the
SSE2 check in x86_cse::gate so that redundant TLS calls are removed when
SSE is disabled.

gcc/

PR target/124994
* config/i386/i386-features.cc (x86_cse::gate): Drop TARGET_SSE2.

gcc/testsuite/

PR target/124994
* gcc.target/i386/pr124994.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 months ago[PATCH] RISC-V: Remove redundant CALL_P check
Bohan Lei [Thu, 23 Apr 2026 00:25:22 +0000 (18:25 -0600)] 
[PATCH] RISC-V: Remove redundant CALL_P check

Ready for trunk (or gcc-17 since it's stage4 for gcc-16 now)?

------------------------------------------------------------------
From:钟居哲 <juzhe.zhong@rivai.ai>
Send Time:Thu, Jan 8, 2026, 10:51
To:Bohan Lei<garthlei@linux.alibaba.com>
CC:"gcc-patches"<gcc-patches@gcc.gnu.org>; "pan2.li"<pan2.li@intel.com>; Bohan Lei<garthlei@linux.alibaba.com>
Subject:Re: [PATCH] RISC-V: Remove redundant CALL_P check

LGTM

From:  "Bohan Lei"<garthlei@linux.alibaba.com>
Date:  Thu, Jan 8, 2026, 10:49
Subject:  [PATCH] RISC-V: Remove redundant CALL_P check
To:  <gcc-patches@gcc.gnu.org>
Cc: <juzhe.zhong@rivai.ai>, <pan2.li@intel.com>, "Bohan Lei"<garthlei@linux.alibaba.com>
Since we are using `reg_set_p` to check VXRM definition, the `CALL_P`
check has become redundant.  VXRM is marked as call-used in riscv.h, and
`reg_set_p` in `vxrm_unknown_p` should always return true when a call is
encountered.

gcc/ChangeLog:

* config/riscv/riscv.cc (vxrm_unknown_p): Remove `CALL_P` check

3 months agoDaily bump.
GCC Administrator [Thu, 23 Apr 2026 00:16:32 +0000 (00:16 +0000)] 
Daily bump.

3 months agoc++: consteval, array, modules [PR124973]
Jason Merrill [Wed, 22 Apr 2026 18:53:14 +0000 (14:53 -0400)] 
c++: consteval, array, modules [PR124973]

Here the consteval holder constructor calls the defaulted element_array
constructor, which uses a VEC_INIT_EXPR to call the defaulted element
constructor.

When we read in the holder constructor, we need to clone it, so we call
finish_function, which calls cp_fold_function_non_odr_use, which tries to
constant-evaluate the call to the element_array constructor.  This
eventually wants to evaluate the VEC_INIT_EXPR, which wants to call the
element constructor (complete object clone).  But we haven't cloned the
element constructor yet, so mark_used tries to synthesize it again, which
breaks because the constructor is already defined, just not cloned yet.

We should have cloned the element constructor first, but we didn't know that
the element_array constructor depends on it because VEC_INIT_EXPR doesn't
express that; build_vec_init_expr calls build_vec_init_elt and then throws
it away.  Perhaps we want to add the elt_init as an additional operand that
is used to express dependencies, but ignored in expansion?

It would also be nice not to repeat all the finish_function passes when
loading a function from a module; we already did
cp_fold_function_non_odr_use and such for this function before writing out
the module, doing it again is a waste of time.

But also, trying to constant-evaluate the element_array constructor is wrong
for _non_odr_use, it shouldn't be doing any optimization folding.

Furthermore, since the TARGET_EXPR is wrapped in an INIT_EXPR, we should
never have tried to fold it by itself, before cp_genericize_init_expr has a
chance to elide it.  So let's only do that folding when ff_genericize, like
the other TARGET_EXPR transformations.  This is a much simpler fix for this
testcase.

While we're at it, let's also suppress the other flag_no_inline-conditional
folding when ff_only_non_odr.

PR c++/124973
PR c++/120502
PR c++/120005

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_fold_r) <case TARGET_EXPR>: Only
do optimization folding when ff_genericize.
(cp_fold) <case CALL_EXPR>: Don't do
optimization folding when ff_only_non_odr.

gcc/testsuite/ChangeLog:

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

3 months agoipa: fix 'writing' typo in comment
Sam James [Thu, 31 Oct 2024 02:50:27 +0000 (02:50 +0000)] 
ipa: fix 'writing' typo in comment

gcc/ChangeLog:

* ipa-prop.cc (param_type_may_change_p): Fix comment typo.

3 months agolto: fix spelling in comment
Sam James [Tue, 29 Oct 2024 05:23:23 +0000 (05:23 +0000)] 
lto: fix spelling in comment

gcc/lto/ChangeLog:

* lto-symtab.cc (lto_varpool_replace_node): Fix spelling of 'warning'.

3 months agocontrib: header-tools: fix spelling
Sam James [Tue, 29 Oct 2024 05:22:51 +0000 (05:22 +0000)] 
contrib: header-tools: fix spelling

contrib/header-tools/ChangeLog:

* show-headers: Fix spelling of 'additional'.

3 months agoi386: fix typo in comment
Sam James [Sat, 30 Aug 2025 17:58:23 +0000 (18:58 +0100)] 
i386: fix typo in comment

Followup to r16-2675-gdf82965344f641.

gcc/ChangeLog:

* config/i386/i386.cc (ix86_get_callcvt): Say 'regparm' in comment,
not 'regparam'.

3 months agoa68: Fix make install-html
Thiago Jung Bauermann [Tue, 21 Apr 2026 04:29:44 +0000 (01:29 -0300)] 
a68: Fix make install-html

Currently, trying to do "make install-html" after a build results in an
error:

  $ make install-html
    ⋮
  Doing install-html in gcc
  make[2]: Entering directory '/tmp/build/gcc'
  make[2]: *** No rule to make target '/tmp/build/gcc/HTML/gcc-16.0.1/ga68-coding-guidelines.info', needed by 'algol68.install-html'.  Stop.
  make[2]: Leaving directory '/tmp/build/gcc'
  make[1]: *** [Makefile:5054: install-html-gcc] Error 1
  make[1]: Leaving directory '/tmp/build'
  make: *** [Makefile:1929: do-install-html] Error 2

The problem is a typo in a dependency of the algol68.install-html rule.
Fix it by removing the ".info" suffix.

With this change, "make install-html" succeeds but ga68-internals and
ga68-coding-guidelines don't get installed.  Assuming this is
unintentional, extend the for loop to also install them.

gcc/algol68/ChangeLog:
* Make-lang.in (algol68.install-html): Fix
ga68-coding-guidelines dependency.  Install all dependencies.

3 months agoRegenerate gcc.pot
Joseph Myers [Wed, 22 Apr 2026 17:17:44 +0000 (17:17 +0000)] 
Regenerate gcc.pot

* gcc.pot: Regenerate.

3 months agocfghooks: Pass data to callback function of make_forwarder_block
Andrew Pinski [Wed, 15 Apr 2026 20:39:51 +0000 (13:39 -0700)] 
cfghooks: Pass data to callback function of make_forwarder_block

This makes a cleanup that is way overdue and should have been done
years ago. Instead of setting some global/static variables for the
callback function to check here, we pass down the data to the callback
function.  This reduces the number of global variables (which should help
with Parallel GCC project). Plus since mfb_keep_just was exported outside
of cfgloopmanip.cc (it was used in tree-ssa-threadupdate.cc), it reduces
is shared between files.

I found this useful when working on PR 123113 as I needed a new callback
function.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* cfghooks.cc (make_forwarder_block): New data argument,
pass it down to redirect_edge_p.
* cfghooks.h (make_forwarder_block): Add void* argument.
* cfgloop.cc (mfb_reis_set): Remove.
(mfb_redirect_edges_in_set): Add new data argument.
Use it instead of mfb_reis_set.
(form_subloop): Create a local variable instead of
mfb_areis_set. Update call to make_forwarder_block.
(merge_latch_edges): Likewise.
* cfgloopmanip.cc (mfb_kj_edge): Remove.
(mfb_keep_just):  Add new data argument.
Use it instead of mfb_kj_edge.
(create_preheader): Use local variable instead of
mfb_kj_edge. Update call to make_forwarder_block.
* cfgloopmanip.h (mfb_keep_just): Add void* argument.
* tree-cfgcleanup.cc (mfb_keep_latches): Add unused void* arugment.
(cleanup_tree_cfg_noloop): Update call to make_forwarder_block.
* tree-ssa-threadupdate.cc
(fwd_jt_path_registry::thread_through_loop_header): Use local
variable instead of mfb_kj_edge. Update call to make_forwarder_block.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agocfghooks: Remove new_bb_cbk callback from make_forwarder_block
Andrew Pinski [Wed, 15 Apr 2026 00:57:49 +0000 (17:57 -0700)] 
cfghooks: Remove new_bb_cbk callback from make_forwarder_block

This callback seems to be unused since it was allowed to be NULL
in r0-78960-g89f8f30f356532 (19 years ago), so let's just remove it.
this is also the first step in changing the callback to make_forwarder_block.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* cfghooks.cc (make_forwarder_block): Remove new_bb_cbk argument.
* cfghooks.h (make_forwarder_block): Remove last argument.
* cfgloop.cc (form_subloop): Update call to make_forwarder_block.
(merge_latch_edges): Likewise.
* cfgloopmanip.cc (create_preheader): Likewise.
* tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Likewise.
* tree-ssa-threadupdate.cc
(fwd_jt_path_registry::thread_through_loop_header): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agodoc: grammar fix for -ffunction-cse
Sam James [Tue, 11 Nov 2025 04:52:48 +0000 (04:52 +0000)] 
doc: grammar fix for -ffunction-cse

gcc/ChangeLog:

* doc/invoke.texi (-ffunction-cse): Add missing full stop.

3 months agodoc: grammar fix for -Wduplicate-decl-specifier
Sam James [Thu, 9 Oct 2025 03:27:02 +0000 (04:27 +0100)] 
doc: grammar fix for -Wduplicate-decl-specifier

gcc/ChangeLog:

* doc/invoke.texi (-Wduplicate-decl-specifier): Say 'a duplicate'.

3 months agodoc: cleanup for -Waddress
Sam James [Thu, 9 Oct 2025 03:25:58 +0000 (04:25 +0100)] 
doc: cleanup for -Waddress

We usually don't say 'warning' after @option{-Wxyz}.

gcc/ChangeLog:

* doc/invoke.texi (-Waddress): Drop unnecessary 'warning'.

3 months agodoc: fix whitespace
Sam James [Thu, 9 Oct 2025 03:24:40 +0000 (04:24 +0100)] 
doc: fix whitespace

gcc/ChangeLog:

* doc/invoke.texi: Fix whitespace.

3 months agodoc: grammar tweak with 'in C(++),'
Sam James [Thu, 9 Oct 2025 03:23:59 +0000 (04:23 +0100)] 
doc: grammar tweak with 'in C(++),'

Consistently use a comma after 'In C' or 'In C++'.

gcc/ChangeLog:

* doc/invoke.texi: Write 'In C,' and 'In C++,' with a comma
consistently.

3 months agodoc: simplify phrasing for -Walloca, -Walloca-larger-than
Sam James [Thu, 9 Oct 2025 03:21:05 +0000 (04:21 +0100)] 
doc: simplify phrasing for -Walloca, -Walloca-larger-than

It's more common for us to say 'Warn on ...' directly, not 'This option ...'.

gcc/ChangeLog:

* doc/invoke.texi (-Walloca): Simplify phrasing.
(-Walloca-larger-than=-): Ditto.

3 months agotestsuite: Fix test requirements
feedable [Tue, 24 Feb 2026 00:36:53 +0000 (02:36 +0200)] 
testsuite: Fix test requirements

Add missing dg-require-effective-target

gcc/testsuite/ChangeLog:

* c-c++-common/Wdangling-pointer-9.c: Reqiure label_values.
* c-c++-common/analyzer/computed-goto-1.c: Likewise.
* c-c++-common/analyzer/pr102695.c: Likewise.
* c-c++-common/attr-used-7.c: Likewise.
* c-c++-common/attr-used-8.c: Likewise.
* c-c++-common/attr-used-9.c: Likewise.
* gcc.dg/analyzer/boxed-malloc-1.c: Likewise.
* gcc.dg/analyzer/computed-goto-pr110529.c: Likewise.
* gcc.dg/analyzer/malloc-1.c: Likewise.
* gcc.dg/pr106421.c: Likewise.
* gcc.dg/pr110506.c: Likewise.
* gcc.dg/pr122773.c: Likewise.
* gcc.dg/torture/pr108076.c: Likewise.
* gcc.c-torture/compile/pr120250.c: Likewise.
* c-c++-common/analyzer/feasibility-3.c: Require named_sections.
* c-c++-common/attr-used-5.c: Likewise.
* c-c++-common/attr-used-6.c: Likewise.
* g++.dg/charset/attribute1.c: Likewise.
* gcc.dg/charset/attribute1.c: Likewise.
* gcc.dg/pr116887.c: Likewise.
* gcc.dg/pr83100-2.c: Likewise.
* gcc.dg/pr83100-3.c: Likewise.
* gcc.dg/pr87793.c: Likewise.
* gcc.dg/special/gcsec-1.c: Likewise.
* gcc.dg/tls/data-sections-1.c: Likewise.
* c-c++-common/analyzer/infinite-recursion-5.c: Require
nonlocal_goto.
* gcc.dg/Winfinite-recursion-2.c: Likewise.
* gcc.dg/Winfinite-recursion.c: Likewise.
* gcc.dg/pr97986-1.c: Likewise.
* gcc.dg/pr101156.c: Likewise.
* gcc.dg/callgraph-info-1.c: Require alias.
* gcc.dg/plugin/diagnostic-test-paths-4.c: Require signal.

3 months agotestsuite: Fix invalid float test
feedable [Tue, 24 Feb 2026 00:36:52 +0000 (02:36 +0200)] 
testsuite: Fix invalid float test

Make floating point test compile on platforms without FE_UPWARD

gcc/testsuite/ChangeLog:

* gcc.dg/torture/fp-double-convert-float-1.c: Move declaration
before the #ifdef

3 months agotestsuite: Move float tests to ieee directory
feedable [Tue, 24 Feb 2026 00:36:51 +0000 (02:36 +0200)] 
testsuite: Move float tests to ieee directory

Move tests for signaling floats to ieee directory

gcc/testsuite/ChangeLog:

* gcc.dg/torture/builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/builtin-issignaling-1.c: ...here.
* gcc.dg/torture/bfloat16-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/bfloat16-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float128-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float128-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float128x-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float128x-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float16-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float16-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float32-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float32-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float32x-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float32x-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float64-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float64-builtin-issignaling-1.c: ...here.
* gcc.dg/torture/float64x-builtin-issignaling-1.c: Move to...
* gcc.c-torture/execute/ieee/float64x-builtin-issignaling-1.c: ...here.

3 months agotestsuite: Convert gcc.c-torture/execute/ieee to the new test format
feedable [Sat, 11 Apr 2026 00:20:04 +0000 (03:20 +0300)] 
testsuite: Convert gcc.c-torture/execute/ieee to the new test format

Make the ieee directory use dg-* annotations instead of separate test setup files

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/ieee/ieee.exp: Replace with slightly adapted copy of
execute/execute.exp.
* gcc.c-torture/execute/ieee/20000320-1.c: Port to the new format.
* gcc.c-torture/execute/ieee/20001122-1.c: Likewise.
* gcc.c-torture/execute/ieee/20010114-2.c: Likewise.
* gcc.c-torture/execute/ieee/20010226-1.c: Likewise.
* gcc.c-torture/execute/ieee/20011123-1.c: Likewise.
* gcc.c-torture/execute/ieee/20030331-1.c: Likewise.
* gcc.c-torture/execute/ieee/20041213-1.c: Likewise.
* gcc.c-torture/execute/ieee/920518-1.c: Likewise.
* gcc.c-torture/execute/ieee/920810-1.c: Likewise.
* gcc.c-torture/execute/ieee/930529-1.c: Likewise.
* gcc.c-torture/execute/ieee/980619-1.c: Likewise.
* gcc.c-torture/execute/ieee/acc1.c: Likewise.
* gcc.c-torture/execute/ieee/acc2.c: Likewise.
* gcc.c-torture/execute/ieee/builtin-nan-1.c: Likewise.
* gcc.c-torture/execute/ieee/cdivchkd.c: Likewise.
* gcc.c-torture/execute/ieee/cdivchkf.c: Likewise.
* gcc.c-torture/execute/ieee/cdivchkld.c: Likewise.
* gcc.c-torture/execute/ieee/compare-fp-1.c: Likewise.
* gcc.c-torture/execute/ieee/compare-fp-2.c: Likewise.
* gcc.c-torture/execute/ieee/compare-fp-3.c: Likewise.
* gcc.c-torture/execute/ieee/compare-fp-4.c: Likewise.
* gcc.c-torture/execute/ieee/copysign1.c: Likewise.
* gcc.c-torture/execute/ieee/copysign2.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-1.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-2.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-3.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-4.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-4e.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-4f.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-4l.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-5.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-6.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-7.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-8.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-8e.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-8f.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-8l.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-9.c: Likewise.
* gcc.c-torture/execute/ieee/fp-cmp-cond-1.c: Likewise.
* gcc.c-torture/execute/ieee/hugeval.c: Likewise.
* gcc.c-torture/execute/ieee/inf-1.c: Likewise.
* gcc.c-torture/execute/ieee/inf-2.c: Likewise.
* gcc.c-torture/execute/ieee/inf-3.c: Likewise.
* gcc.c-torture/execute/ieee/inf-4.c: Likewise.
* gcc.c-torture/execute/ieee/minuszero.c: Likewise.
* gcc.c-torture/execute/ieee/mul-subnormal-single-1.c: Likewise.
* gcc.c-torture/execute/ieee/mzero2.c: Likewise.
* gcc.c-torture/execute/ieee/mzero3.c: Likewise.
* gcc.c-torture/execute/ieee/mzero4.c: Likewise.
* gcc.c-torture/execute/ieee/mzero5.c: Likewise.
* gcc.c-torture/execute/ieee/mzero6.c: Likewise.
* gcc.c-torture/execute/ieee/pr108540-1.c: Likewise.
* gcc.c-torture/execute/ieee/pr108540-2.c: Likewise.
* gcc.c-torture/execute/ieee/pr109008.c: Likewise.
* gcc.c-torture/execute/ieee/pr109386.c: Likewise.
* gcc.c-torture/execute/ieee/pr119002.c: Likewise.
* gcc.c-torture/execute/ieee/pr28634.c: Likewise.
* gcc.c-torture/execute/ieee/pr29302-1.c: Likewise.
* gcc.c-torture/execute/ieee/pr30704.c: Likewise.
* gcc.c-torture/execute/ieee/pr36332.c: Likewise.
* gcc.c-torture/execute/ieee/pr38016.c: Likewise.
* gcc.c-torture/execute/ieee/pr50310.c: Likewise.
* gcc.c-torture/execute/ieee/pr67218.c: Likewise.
* gcc.c-torture/execute/ieee/pr72824-2.c: Likewise.
* gcc.c-torture/execute/ieee/pr72824.c: Likewise.
* gcc.c-torture/execute/ieee/pr84235.c: Likewise.
* gcc.c-torture/execute/ieee/rbug.c: Likewise.
* gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c: Likewise.
* gcc.c-torture/execute/ieee/unsafe-fp-assoc.c: Likewise.
* gcc.c-torture/execute/ieee/20000320-1.x: Removed.
* gcc.c-torture/execute/ieee/920810-1.x: Removed.
* gcc.c-torture/execute/ieee/980619-1.x: Removed.
* gcc.c-torture/execute/ieee/cdivchkd.x: Removed.
* gcc.c-torture/execute/ieee/cdivchkf.x: Removed.
* gcc.c-torture/execute/ieee/cdivchkld.x: Removed.
* gcc.c-torture/execute/ieee/compare-fp-3.x: Removed.
* gcc.c-torture/execute/ieee/compare-fp-4.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-1.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-2.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-3.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-4.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-4f.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-4l.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-6.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-7.x: Removed.
* gcc.c-torture/execute/ieee/fp-cmp-9.x: Removed.
* gcc.c-torture/execute/ieee/hugeval.x: Removed.
* gcc.c-torture/execute/ieee/mul-subnormal-single-1.x: Removed.
* gcc.c-torture/execute/ieee/mzero2.x: Removed.
* gcc.c-torture/execute/ieee/pr108540-1.x: Removed.
* gcc.c-torture/execute/ieee/pr29302-1.x: Removed.
* gcc.c-torture/execute/ieee/pr30704.x: Removed.
* gcc.c-torture/execute/ieee/pr38016.x: Removed.
* gcc.c-torture/execute/ieee/rbug.x: Removed.
* gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x: Removed.

3 months agoaarch64 testsuite: Merge exts_sve2 into exts
Alice Carlotti [Tue, 21 Apr 2026 18:53:57 +0000 (19:53 +0100)] 
aarch64 testsuite: Merge exts_sve2 into exts

Now that we support enabling +sme without +sve2, we no longer need to
include armv9-a when checking assembler support for SME extensions.
Merge exts_sve2 back into exts, and remove the separate handling for
exts_sve2.  This is a partial revert of r16-2660-g9793ffce933234.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Merge exts_sve2 handling into exts.

3 months agoaarch64 testsuite: Fix gating of sme-lutv2 asm tests
Alice Carlotti [Tue, 21 Apr 2026 18:31:22 +0000 (19:31 +0100)] 
aarch64 testsuite: Fix gating of sme-lutv2 asm tests

These tests were configured to try assembling whenever the assembler
supports sme2.  Add dg-do directives to restrict this assemblers that
support sme-lutv2 (and otherwise just compile the test).

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sme2/acle-asm/svluti4_zt_1.c: Add dg-do.
* gcc.target/aarch64/sme2/acle-asm/svwrite_lane_zt_1.c: Ditto.
* gcc.target/aarch64/sme2/acle-asm/svwrite_zt_1.c: Ditto.
* lib/target-supports.exp: Add sme-lutv2 to exts_sve2.

3 months agoOutput mode switching transitions to dump file
Alice Carlotti [Thu, 16 Apr 2026 10:34:05 +0000 (11:34 +0100)] 
Output mode switching transitions to dump file

I found this output useful while debugging some incorrect codegen.

gcc/ChangeLog:

* mode-switching.cc (optimize_mode_switching): Add dump output.

3 months agoaarch64: Extend comment about saving/restoring zt0
Alice Carlotti [Thu, 16 Apr 2026 11:37:53 +0000 (12:37 +0100)] 
aarch64: Extend comment about saving/restoring zt0

Explain why aarch64_start_call_args only needs to save and restore zt0
if the callee shares ZA state.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_start_call_args): Extend
comment.

3 months agoFix some mode switching doc/comment typos
Alice Carlotti [Fri, 27 Mar 2026 15:21:58 +0000 (15:21 +0000)] 
Fix some mode switching doc/comment typos

I found a few typos and inconsistent variable names in mode switching
comments and documentation.  Fix them.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_mode_confluence): Fix
comment typo.
* target.def (mode_switching): Fix incorrect variable names in
documentation.
* doc/tm.texi: Regenerate.

3 months agoaarch64: Fix ZA state transition [PR119210]
Alice Carlotti [Thu, 16 Apr 2026 12:02:35 +0000 (13:02 +0100)] 
aarch64: Fix ZA state transition [PR119210]

In the INACTIVE_CALLER -> INACTIVE LOCAL transition, ensure ZA is active
and zeroed before setting tpidr2_el0.

gcc/ChangeLog:

PR target/119210
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
Add PSTATE.ZA enablement, and zero it if already enabled.

gcc/testsuite/ChangeLog:

PR target/119210
* gcc.target/aarch64/sme/za_state_8.c: New test.

3 months agoaarch64: Add ZTO_REGNUM and SME_STATE_REGNUM use to movt
Alice Carlotti [Fri, 17 Apr 2026 18:00:57 +0000 (19:00 +0100)] 
aarch64: Add ZTO_REGNUM and SME_STATE_REGNUM use to movt

Also replace unspec_volatile with plain unspec - there no need to
prevent dead code elimination if the dependencies are correct.

gcc/ChangeLog:

* config/aarch64/aarch64-sme.md (aarch64_sme_write_zt): Add
ZTO_REGNUM use and make unspec non-volatile.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sme/zt0_state_8.c: New test.

3 months agoAda: Fix problematic trailing separator for Containing_Directory
Eric Botcazou [Wed, 22 Apr 2026 15:15:24 +0000 (17:15 +0200)] 
Ada: Fix problematic trailing separator for Containing_Directory

Adding a trailing directory separator should arguably not change the result
of a call to Ada.Directories.Containing_Directory.

gcc/ada/
PR ada/85766
* libgnat/a-direct.adb (Containing_Directory): Streamline and strip
a trailing directory separator from the name.

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

3 months agoaarch64: PR124908 Fix ICE in svld1rq fold with -msve-vector-bits=128
Kyrylo Tkachov [Mon, 20 Apr 2026 07:56:01 +0000 (00:56 -0700)] 
aarch64: PR124908 Fix ICE in svld1rq fold with -msve-vector-bits=128

svld1rq is a replicated-quadword load: it loads 16 bytes and
replicates them to fill the SVE register.  When -msve-vector-bits=128
the instruction can be folded to a normal load.

The GIMPLE fold for svld1rq transforms the intrinsic into a 128-bit
memory load followed by a VEC_PERM_EXPR that replicates the loaded
value.  When VL == 128, the VEC_PERM_EXPR becomes an identity
permutation.  The checking assertion that validates the permutation
(can_vec_perm_const_p) fails for this degenerate case because the
vec_perm_const hook does not recognise the cross-mode identity
permutation (e.g. V16QI -> VNx16QI).

Fix by detecting when the SVE vector has the same number of elements as
the 128-bit quadword (known_eq (lhs_len, source_nelts)) and emitting a
VIEW_CONVERT_EXPR instead of a VEC_PERM_EXPR.

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
gcc/ChangeLog:

PR target/124908
* config/aarch64/aarch64-sve-builtins-base.cc
(svld1rq_impl::fold): When the SVE vector length equals the
quadword width, emit VIEW_CONVERT_EXPR instead of VEC_PERM_EXPR.

gcc/testsuite/ChangeLog:

PR target/124908
* gcc.target/aarch64/sve/acle/general/ld1rq_2.c: New test.

3 months agoada: bump Library_Version to 17.
Jakub Jelinek [Wed, 22 Apr 2026 13:46:11 +0000 (15:46 +0200)] 
ada: bump Library_Version to 17.

gcc/ada/ChangeLog

* gnatvsn.ads: Bump Library_Version to 17.  Bump Current_Year to 2026.

3 months agoUpdate crontab and git_update_version.py
Jakub Jelinek [Wed, 22 Apr 2026 13:44:28 +0000 (15:44 +0200)] 
Update crontab and git_update_version.py

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

maintainer-scripts/
* crontab: Snapshots from trunk are now GCC 17 related.
Add GCC 16 snapshots from the respective branch.
contrib/
* gcc-changelog/git_update_version.py (active_refs): Add
releases/gcc-16.

3 months agoBump BASE-VER. basepoints/gcc-17
Jakub Jelinek [Wed, 22 Apr 2026 13:29:04 +0000 (15:29 +0200)] 
Bump BASE-VER.

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

* BASE-VER: Change from 16.0.1 to 17.0.0.

3 months agoc++, libstc++: Bump __cpp_impl_reflection and __cpp_lib_reflection
Jakub Jelinek [Wed, 22 Apr 2026 13:03:48 +0000 (15:03 +0200)] 
c++, libstc++: Bump __cpp_impl_reflection and __cpp_lib_reflection

Both __cpp_impl_reflection and __cpp_lib_reflection were increased from
202506L to 202603L post Croydon, I assume to show that P3795R2 (maybe some
issues too) have been implemented.
Now, we do implement P3795R2 except for the is_applicable_type,
is_nothrow_applicable_type and apply_result metafunctions, but Jonathan says
there is agreement in LWG that to test for availability of those one should
test __cpp_lib_reflection >= 202603L && __cpp_lib_apply >= 202603L.

So, this patch bumps both FTMs.

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Bump __cpp_impl_reflection value
from 202506L to 202603L.
gcc/testsuite/
* g++.dg/DRs/dr2581-2.C: Adjust for __cpp_impl_reflection bump from
202506L to 202603L.
* g++.dg/reflect/feat1.C: Likewise.  Also adjust for
__cpp_lib_reflection bump from 202506L to 202603L.
* g++.dg/reflect/feat2.C: Likewise.
* g++.dg/reflect/feat3.C: Likewise.
libstdc++-v3/
* include/bits/version.def (reflection): Bump 202506L to 202603L
for both v and in extra_cond.
* include/bits/version.h: Regenerate.
* include/std/meta: Compare __glibcxx_reflection against
202603L rather than 202506L.
* src/c++23/std.cc.in: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 months agotestsuite: Adjust for short-enums in match-shift-cmp-3 [PR124909]
Richard Earnshaw [Fri, 17 Apr 2026 13:39:14 +0000 (14:39 +0100)] 
testsuite: Adjust for short-enums in match-shift-cmp-3 [PR124909]

On targets that use short enums, this test produces different output
since the fold optimization does not apply to sizes smaller than a word.

Adjust the expected results until such time as this optimization can
be expanded to support shorter input values.

gcc/testsuite/ChangeLog:

PR tree-optimization/124909

* gcc.dg/match-shift-cmp-3.c:  Adjust expected results for
target short_enums.

3 months agolibstdc++: Mandate power of two alignment for std::is_sufficiently_aligned.
Tomasz Kamiński [Wed, 22 Apr 2026 11:26:30 +0000 (13:26 +0200)] 
libstdc++: Mandate power of two alignment for std::is_sufficiently_aligned.

This implements LWG4290. Missing Mandates clauses on is_sufficiently_aligned.

libstdc++-v3/ChangeLog:

* include/bits/align.h (is_sufficiently_aligned): Mandate
that _Align is power of two.
* testsuite/20_util/is_sufficiently_aligned/2_neg.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agoarm: fix mov<mode>_vfp_<mode>16 for fp16-only devs [PR124933]
Richard Earnshaw [Mon, 20 Apr 2026 15:57:22 +0000 (16:57 +0100)] 
arm: fix mov<mode>_vfp_<mode>16 for fp16-only devs [PR124933]

We should only be using VLD1/VST1 instructions when we have an
auto-inc address of some suitable form and only when we have
NEON_FP16INST.  At other times we should just use VLDR/VSTR.  This
ensures that the code will assemble on targets that lack Advanced
SIMD.  Also correct the constraint so that we can use offset
addressing on platforms that also have Neon.

gcc/ChangeLog:

PR target/124933
* config/arm/constraints.md (Uj): Allow offset addressing for
all targets, only allow Neon addressing when we have both Neon
and FP16INST.
* config/arm/vfp.md (mov<mode>_vfp_<mode>16): Only use vld1/vst1
when the pattern needs address write-back.

gcc/testsuite/ChangeLog:

PR target/124933
* lib/target-supports.exp (v8_1m_main_fp_hard): New arm
architecture variant.
* gcc.target/arm/pr124933.c: New test.
* gcc.target/arm/armv8_2-fp16-move-1.c: Update expected output.

3 months agolibstdc++: Accept data_handle_type by value in mdspan deduction guide.
Tomasz Kamiński [Wed, 22 Apr 2026 07:23:37 +0000 (09:23 +0200)] 
libstdc++: Accept data_handle_type by value in mdspan deduction guide.

This makes the deduction guide accepting data_handle_type, mapping
and accessor consistent with corresponding constructor.
Resolves LWG4511.

libstdc++-v3/ChangeLog:

* include/std/mdspan (mdspan): Remove reference from
_AccessorType::data_handle_type parameteter of deduction
guide.
* testsuite/23_containers/mdspan/mdspan.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS for already implemented issues.
Tomasz Kamiński [Wed, 22 Apr 2026 08:21:54 +0000 (10:21 +0200)] 
libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS for already implemented issues.

This covers issue affecting pre-C+26 features that were resolved
during 2026 Croydon meeting.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h: Add comment for LWG3831.
* include/bits/print.h: Add comment for LWG4549.
* include/std/condition_variable: Add comment for LWG3504.
* include/std/format: Add comments for LWG4522.
* include/std/mdspan: Add comment for LWG4314.
* include/std/optional: Add comment for LWG2746.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agogensupport: Fix // comment handling [PR124971]
Jakub Jelinek [Wed, 22 Apr 2026 05:56:38 +0000 (07:56 +0200)] 
gensupport: Fix // comment handling [PR124971]

The while (*templ != '\n' || *templ != '\0') ++templ; loop
is due to a wrong logical operator an endless loop, so clearly
we don't have any // comments in the new syntax *.md files that
are using it in the relevant parts of the patterns.

Fixed by using && instead.

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/124971
* gensupport.cc (convert_syntax): Fix up // comment handling.

Reviewed-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agoc: Fix counted_by attribute error recovery [PR124969]
Jakub Jelinek [Wed, 22 Apr 2026 05:54:27 +0000 (07:54 +0200)] 
c: Fix counted_by attribute error recovery [PR124969]

The last patch made me try also pointer arithmetics on incomplete
type.  And here we ICE before actually diagnosing the error
because we try to dereference element_size.

Furthermore, TYPE_SIZE_UNIT (element_type) is in sizetype, so
we shouldn't use build_one_cst (size_type_node) for the void *
case, but size_one_node (aka size_int (1)).

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/124969
* c-typeck.cc (build_access_with_size_for_counted_by): Use
size_one_node instead of build_one_cst (size_type_node).  Punt
if element_size is NULL_TREE.

* gcc.dg/ubsan/pr124969-2.c: New test.

Reviewed-by: Marek Polacek <polacek@redhat.com>
3 months agoc-family: Fix ICE with counted_by attribute [PR124969]
Jakub Jelinek [Wed, 22 Apr 2026 05:52:25 +0000 (07:52 +0200)] 
c-family: Fix ICE with counted_by attribute [PR124969]

The following valid testcase ICEs, because we try to use
TREE_CODE (NULL_TREE).
We document that counted_by is supported on pointers to void
and that it behaves like the GNU pointer to void arithmetics
extension in that case.  build_access_with_size_for_counted_by
already uses 1 in that case as element_size.

The following patch fixes it, plus for error recovery punts
if it is a pointer to incomplete type other than void (pointer
arithmetics on such type will be diagnosed as error later on).

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/124969
* c-ubsan.cc (get_index_from_pointer_addr_expr): For
VOID_TYPE_P (pointee_type) use size_one_node instead of
TYPE_SIZE_UNIT (pointee_type) as pointee_size.  Punt for
!COMPLETE_OR_VOID_TYPE_P (pointee_type).  Formatting fix.  Use
CONVERT_EXPR_P (x) instead of CONVERT_EXPR_CODE_P (TREE_CODE (x)).

* gcc.dg/ubsan/pr124969-1.c: New test.

Reviewed-by: Marek Polacek <polacek@redhat.com>
3 months agotestsuite: Xfails for aarch64/sme/streaming_mode_1.c and aarch64/sme/za_state_[12...
Jakub Jelinek [Wed, 22 Apr 2026 05:48:13 +0000 (07:48 +0200)] 
testsuite: Xfails for aarch64/sme/streaming_mode_1.c and aarch64/sme/za_state_[12].c [PR122483]

This patch xfails some dg-errors in the tests and adds two xfailed
dg-bogus, so that we can downgrade this PR to P2 and defer resolution
hopefully for GCC 17.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR target/122483
* gcc.target/aarch64/sme/streaming_mode_1.c: Xfail errors for
sc_a, sc_c, sc_e, s_a, s_c, s_e and keyword_contradiction_1.
* gcc.target/aarch64/sme/za_state_1.c: Xfail errors for shared_a,
shared_c, shared_e, preserved_a, preserved_c, preserved_e and
keyword_conflict_1.
* gcc.target/aarch64/sme/za_state_2.c: Xfail errors for shared_b,
shared_d, shared_f and shared_h.  Add xfailed dg-bogus for
extra diagnostics on shared_f and shared_h.

Reviewed-by: Alex Coplan <alex.coplan@arm.com>
3 months agoFix PR124959, gcc.dg/hoist-register-pressure-1.c, *-[23].c, failing
Hans-Peter Nilsson [Tue, 21 Apr 2026 18:06:49 +0000 (20:06 +0200)] 
Fix PR124959, gcc.dg/hoist-register-pressure-1.c, *-[23].c, failing

These test-cases got typo-corrected in
r16-8316-g630b53cd4ff1c3, which exposed them failing for
cris-elf.  Though, at one time they were passing for the
right reason, and bisection shows they'd start failing when
the CRIS target was CC0-converted, and for the same reason
the S/390 32-bit fails.  See the pre-existing comment in the
test and also see the PR for details, including a suggested
plan how to fix the optimization pass, if someone is
interested in an "easy hack".  Though admittedly, the missed
optimization doesn't affect many targets.

Regarding the target pattern selector expression, I went for
the simplest possible, even though I'm including CRIS in the
64-bit exception.

PR target/124959
* gcc.dg/hoist-register-pressure-1.c,
gcc.dg/hoist-register-pressure-2.c,
gcc.dg/hoist-register-pressure-3.c: Exclude cris-*-*.

3 months agoDaily bump.
GCC Administrator [Wed, 22 Apr 2026 00:16:28 +0000 (00:16 +0000)] 
Daily bump.

3 months agod: Merge upstream dmd, druntime d1fbbb1a2f
Iain Buclaw [Tue, 21 Apr 2026 19:48:22 +0000 (21:48 +0200)] 
d: Merge upstream dmd, druntime d1fbbb1a2f

Imports latest bug fixes from the v2.113.0 release branch.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd d1fbbb1a2f.
* expr.cc (ExprVisitor::visit (StringExp *)): Don't generate a
STRING_CST for a mutable array type.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime d1fbbb1a2f.

3 months agoc++: #include rewrite and installed compiler [PR123879]
Jason Merrill [Tue, 21 Apr 2026 20:23:37 +0000 (16:23 -0400)] 
c++: #include rewrite and installed compiler [PR123879]

In an installed compiler, the pathname in the expanded_location might be
canonicalized while the pathname in the cpp_dir is not, e.g. eloc.file is
".../include/c++/16.0.1/stdbit.h" while dir->name is
".../lib/gcc/x86_64-pc-linux-gnu/16.0.1/../../../../include/c++/16.0.1".  So
let's use lrealpath to compare canonical paths for both.  And filename_ncmp,
while we're at it.

PR c++/123879

gcc/cp/ChangeLog:

* module.cc (maybe_translate_include): Use lrealpath in check
whether we're including something in the same directory.

3 months agolibstdc++: fix allocator_traits<>::allocate_at_least
Nathan Myers [Mon, 13 Apr 2026 18:48:22 +0000 (14:48 -0400)] 
libstdc++: fix allocator_traits<>::allocate_at_least

allocator_traits<>::allocate_at_least has taken its allocator
by value, incorrectly. This patch makes it take its allocator
by reference, as specified.

libstdc++-v3/ChangeLog:
* include/bits/alloc_traits.h (allocate_at_least):
Take allocator argument by reference, per Standard.

3 months agolibsanitizer: fix __sanitizer::struct_sock_fprog_sz availability (#183411) [PR124248]
Marian Buschsieweke [Thu, 9 Apr 2026 03:11:15 +0000 (05:11 +0200)] 
libsanitizer: fix __sanitizer::struct_sock_fprog_sz availability (#183411) [PR124248]

Cherry picked from LLVM commit dabd8cc2334917272fe73b70626fd3a5f9e63cf5.

`struct sock_fprog` is not provided by glibc, but rather by the linux
headers (`#include <linux/filter.h`). It seems that glibc due to an
implementation detail internally includes `<linux/filter.h>` somewhere
other C libs (e.g. musl) do not, which previously caused build failures
and let to disabling `struct sock_fprog` on non-glibc Linux systems.

This adds the missing include and provides it again for all Linux
systems regardless of C lib.

libsanitizer/ChangeLog:
PR sanitizer/124248

* sanitizer_common/sanitizer_platform_limits_posix.cpp (struct_sock_fprog_sz):
Make available on non-glibc Linux systems.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
3 months agoPR modula2/120189 Bugfix to documentation and fix prototypes in m2rts.h
Gaius Mulley [Tue, 21 Apr 2026 20:13:17 +0000 (21:13 +0100)] 
PR modula2/120189 Bugfix to documentation and fix prototypes in m2rts.h

This is a tidyup patch for a define in m2rts.h DEFAULT_RUNTIME_MODULE_OVERRIDE
and it is used in the documentation example gcc/doc/gm2.texi.

gcc/ChangeLog:

PR modula2/120189
* doc/gm2.texi (Building a shared library): Replace
constant string with DEFAULT_RUNTIME_MODULE_OVERRIDE.

gcc/m2/ChangeLog:

PR modula2/120189
* gm2-compiler/M2Options.mod (DefaultRuntimeModuleOverride): Add
reference comment to libgm2/libm2iso/m2rts.h.

libgm2/ChangeLog:

PR modula2/120189
* libm2iso/m2rts.h (Copyright): Correct dates.
(DEFAULT_RUNTIME_MODULE_OVERRIDE): New define.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
3 months agolibstdc++: Fix comment on std::print helper __open_terminal
Jonathan Wakely [Tue, 21 Apr 2026 20:04:23 +0000 (21:04 +0100)] 
libstdc++: Fix comment on std::print helper __open_terminal

The comment describes an earlier version of the function which I
experimented with when implementing the std::print feature. Update it to
describe the current semantics.

libstdc++-v3/ChangeLog:

* src/c++23/print.cc (__open_terminal): Fix comment.

3 months agoc++: Parse splice-type-specifier in cp_parser_mem_initializer_id [PR124944]
Jakub Jelinek [Tue, 21 Apr 2026 17:32:22 +0000 (19:32 +0200)] 
c++: Parse splice-type-specifier in cp_parser_mem_initializer_id [PR124944]

The grammar has:
mem-initializer-id:
        class-or-decltype
        identifier
class-or-decltype:
        nested-name-specifier[opt] type-name
        nested-name-specifier template simple-template-id
        computed-type-specifier
computed-type-specifier:
        decltype-specifier
        pack-index-specifier
        splice-type-specifier
but we weren't parsing splice-type-specifier in there, just in
cp_parser_base_specifier.  So, the following patch defers
similarly to cp_parser_base_specifier the typename diagnostics
because we don't know whether typename [: will be valid or not
- it could be splice-scope-specifier and in that case typename
is not valid, or splice-type-specifier, in which case it is valid
but not required.  And calls cp_parser_splice_type_specifier too
when nested-name-specifier nor :: don't appear.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR c++/124944
* parser.cc (cp_parser_mem_initializer_id): Parse
splice-type-specifier.

* g++.dg/reflect/splice13.C: New test.
* g++.dg/reflect/splice14.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoUpdate gcc sv.po
Joseph Myers [Tue, 21 Apr 2026 16:42:46 +0000 (16:42 +0000)] 
Update gcc sv.po

* sv.po: Update.

3 months agoc++: Fix up iterating expansion stmt b and e var handling [PR124927]
Jakub Jelinek [Tue, 21 Apr 2026 16:31:36 +0000 (18:31 +0200)] 
c++: Fix up iterating expansion stmt b and e var handling [PR124927]

The following testcase ICEs, because the TARGET_EXPR it had has VOID_TYPE
TARGET_EXPR_INITIAL and force_target_expr obviously ICEs when trying to
create a VOID_TYPE TARGET_EXPR.

This patch fixes it by taking the cv_unqualified type of the TARGET_EXPRs
before we extract their TARGET_EXPR_INITIAL, so it does the desirable thing
of recreating the TARGET_EXPRs with cv unqualified types.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR c++/124927
* pt.cc (finish_expansion_stmt): Compute types for force_target_expr
from b and e before extracting TARGET_EXPR_INITIAL from it.

* g++.dg/cpp26/expansion-stmt41.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: bogus -Wmissing-field-initializers with <meta> [PR124950]
Marek Polacek [Mon, 20 Apr 2026 19:55:50 +0000 (15:55 -0400)] 
c++/reflection: bogus -Wmissing-field-initializers with <meta> [PR124950]

We emit -Wmissing-field-initializers warnings for code like

  data_member_spec (^^int, { .name = "dms" })

which seems undesirable.  We can initialize the members of
std::meta::data_member_options to suppress that warning (clang's <meta>
has these initializers too).

PR c++/124950

libstdc++-v3/ChangeLog:

* include/std/meta (std::meta::data_member_options): Initialize
alignment, bit_width, and annotations members.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 months agolibstdc++: Use 32-bit platform wait type for OpenBSD and DragonFly [PR120527]
Jonathan Wakely [Tue, 25 Nov 2025 14:29:50 +0000 (14:29 +0000)] 
libstdc++: Use 32-bit platform wait type for OpenBSD and DragonFly [PR120527]

This defines __platform_wait_t as unsigned int for OpenBSD and
DragonFly. This means that std::semaphore will use unsigned int by
default, and so will benefit from more efficient wait/notify ops if we
start to use the OpenBSD futex(2) syscall or the DragonFly umtx(2)
syscalls. We don't currently use them, but if we start to in future, it
would be an ABI break to change __platform_wait_t later.

libstdc++-v3/ChangeLog:

PR libstdc++/120527
* include/bits/atomic_wait.h [__OpenBSD__ || __DragonFly]: Use
unsigned int for __platform_wait_t.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Add platform wait functions for Darwin [PR120527]
Jonathan Wakely [Fri, 5 Dec 2025 15:47:10 +0000 (15:47 +0000)] 
libstdc++: Add platform wait functions for Darwin [PR120527]

Darwin has kernel support for this facility from 10.12 (macOS Sierra).

From 10.15 (macOS Catalina) 64bit qualitities are supported.

When the library is built for 10.12+ both 32b and 64b quantities will be
supported by the DSO which means it can be installed on 10.12+ with support
for 64bit available when the instalation is >= 10.15.

The header will only recognise 64b quantities when the deployment version
is >= 10.15.

If the library is built for <= 10.11, the support will be missing and attempts
to use it wlll result in link errors.

The platform wait type is unconditionally set to 32bits, since this is compatible
across supported OS editions.

PR libstdc++/120527

libstdc++-v3/ChangeLog:

* include/bits/atomic_wait.h:
* src/c++20/atomic.cc (__ulock_wait): Enable supported Darwin versions.
(__ulock_wake): Likewise.
(UL_COMPARE_AND_WAIT): New.
(UL_COMPARE_AND_WAIT64): New.
(ULF_WAKE_ALL): New.
(_GLIBCXX_HAVE_PLATFORM_WAIT): Enable for suppported Darwin versions.

Co-authored-by: Iain Sandoe <iain@sandoe.co.uk>
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
3 months agolibcpp: fix typos in iconv_close [PR124930]
Marek Polacek [Mon, 20 Apr 2026 22:01:28 +0000 (18:01 -0400)] 
libcpp: fix typos in iconv_close [PR124930]

This patch fixes two typos: the reverse_ prefix is missing in the
iconv_close calls.

PR preprocessor/124930

libcpp/ChangeLog:

* charset.cc (_cpp_destroy_iconv): Correct two calls to
iconv_close.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
3 months agolibstdc++: Implement P4012R1 while reverting P3844R2 (consteval simd broadcast)
Matthias Kretz [Wed, 15 Apr 2026 16:04:29 +0000 (18:04 +0200)] 
libstdc++: Implement P4012R1 while reverting P3844R2 (consteval simd broadcast)

P3844R2 added consteval conversion for value-preserving conversion from
constants. It had been approved by LEWG in Kona. Therefore, the current
implementation has the consteval broadcast constructor. In Croydon, LEWG
reversed the decision but changed the overload set to keep the design
space open for C++29.

This patch implements the removal of the consteval constructor and
changes the broadcast constructor according to P4012R1, to keep the
design space open.

libstdc++-v3/ChangeLog:

* include/bits/simd_details.h (__value_preserving_cast): Remove.
* include/bits/simd_mask.h (basic_mask): Replace plain 0 and 1
literals with cw<0> and cw<1>. Replace explicit basic_vec
construction from 0 and 1 with default init and broadcast from
_Up(1).
(_M_to_uint): Replace 1 with cw<1>.
* include/bits/simd_vec.h (basic_vec): Remove consteval
broadcast overload. Remove explicit broadcast from
non-value-preserving types.
* testsuite/std/simd/arithmetic.cc: Replace ill-formed integer
literals with explicit cast to T or use cw.
* testsuite/std/simd/mask.cc: Likewise.
* testsuite/std/simd/simd_alg.cc: Likewise.
* testsuite/std/simd/traits_common.cc: Adjust for resulting
traits changes.
* testsuite/std/simd/traits_math.cc: Likewise.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
3 months agolibstdc++: Restrict engaged -> disengaged std::optional fix [PR124910]
Patrick Palka [Tue, 21 Apr 2026 13:33:50 +0000 (09:33 -0400)] 
libstdc++: Restrict engaged -> disengaged std::optional fix [PR124910]

It turns out a union without an active member does not violate C++20 core
constant expression rules and r16-8748 was really just a workaround for a
front end bug.  The actual underlying problem -- that the constexpr
evaluator treated an explicitly destroyed union member as still active --
has been fixed by r16-8767 which makes this workaround unnecessary for GCC.
Rather than remove the workaround, restrict it to Clang which seems to have
a similar bug making it still needed for e.g. the r16-8748 testcase.

PR c++/124910

libstdc++-v3/ChangeLog:

* include/std/optional (_Optional_payload_base::_M_destroy):
Restrict r16-8748 workaround to Clang, and adjust comment.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 months agotestsuite: Fix up builtin-math-6.c for mpc 1.4.* [PR124682]
Jakub Jelinek [Tue, 21 Apr 2026 11:20:00 +0000 (13:20 +0200)] 
testsuite: Fix up builtin-math-6.c for mpc 1.4.* [PR124682]

MPC 1.4.0 changed the handling of signed zeros in cpow results.
These changes broke the builtin-math-6.c test.
Looking at the differences, MPC 1.3.1 to 1.4.0 changes folding of
the following calls in the test (it is always about the sign of
the imag zero part, +-0.0 means below that MPC 1.3.1 returned
positive 0.0 and MPC 1.4.0 returns -0.0 instead, and -+0.0 means
conversely that MPC 1.3.1 returned -0.0 and MPC 1.4.0 returns positive
0.0.
__builtin_cpow (__complex__ (-1.5e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-3.375e+0, +-0.0);
__builtin_cpow (__complex__ (-1.5e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-2.96296296296296279848547783331014215946197509765625e-1, -+0.0);
__builtin_cpow (__complex__ (1.5e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (3.375e+0, -+0.0);
__builtin_cpow (__complex__ (-2.0e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-8.0e+0, +-0.0);
__builtin_cpow (__complex__ (-2.0e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-1.25e-1, -+0.0);
__builtin_cpow (__complex__ (2.0e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (8.0e+0, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.2345679012345678327022824305458925664424896240234375e-2, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, 0.0), __complex__ (4.0e+0, -0.0)) = __complex__ (8.1e+1, +-0.0);
__builtin_cpow (__complex__ (3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, 0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (-2.43e+2, +-0.0);
__builtin_cpow (__complex__ (-3.0e+0, 0.0), __complex__ (-5.0e+0, -0.0)) = __complex__ (-4.11522633744856002058210009408867335878312587738037109375e-3, -+0.0);
__builtin_cpow (__complex__ (3.0e+0, -0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (2.43e+2, -+0.0);
__builtin_cpow (__complex__ (-4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpow (__complex__ (-4.0e+0, 0.0), __complex__ (2.0e+0, -0.0)) = __complex__ (1.6e+1, +-0.0);
__builtin_cpow (__complex__ (4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpow (__complex__ (1.5e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (2.96296296296296279848547783331014215946197509765625e-1, -+0.0);
__builtin_cpow (__complex__ (-1.5e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-2.96296296296296279848547783331014215946197509765625e-1, +-0.0);
__builtin_cpow (__complex__ (-1.5e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-3.375e+0, -+0.0);
__builtin_cpow (__complex__ (2.0e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (1.25e-1, -+0.0);
__builtin_cpow (__complex__ (-2.0e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-1.25e-1, +-0.0);
__builtin_cpow (__complex__ (-2.0e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-8.0e+0, -+0.0);
__builtin_cpow (__complex__ (3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.2345679012345678327022824305458925664424896240234375e-2, -+0.0);
__builtin_cpow (__complex__ (3.0e+0, 0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (4.11522633744856002058210009408867335878312587738037109375e-3, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, -0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (-4.11522633744856002058210009408867335878312587738037109375e-3, +-0.0);
__builtin_cpow (__complex__ (-3.0e+0, -0.0), __complex__ (5.0e+0, -0.0)) = __complex__ (-2.43e+2, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpow (__complex__ (-3.0e+0, -0.0), __complex__ (-4.0e+0, -0.0)) = __complex__ (1.2345679012345678327022824305458925664424896240234375e-2, +-0.0);
__builtin_cpow (__complex__ (4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpow (__complex__ (-4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpow (__complex__ (-4.0e+0, -0.0), __complex__ (-2.0e+0, -0.0)) = __complex__ (6.25e-2, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-3.375e+0, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-2.96296298503875732421875e-1, -+0.0);
__builtin_cpowf (__complex__ (1.5e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (3.375e+0, -+0.0);
__builtin_cpowf (__complex__ (-2.0e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-8.0e+0, +-0.0);
__builtin_cpowf (__complex__ (-2.0e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-1.25e-1, -+0.0);
__builtin_cpowf (__complex__ (2.0e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (8.0e+0, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.2345679104328155517578125e-2, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (4.0e+0, -0.0)) = __complex__ (8.1e+1, +-0.0);
__builtin_cpowf (__complex__ (3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (-2.43e+2, +-0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (-5.0e+0, -0.0)) = __complex__ (-4.1152262128889560699462890625e-3, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, -0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (2.43e+2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, 0.0), __complex__ (2.0e+0, -0.0)) = __complex__ (1.6e+1, +-0.0);
__builtin_cpowf (__complex__ (4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpowf (__complex__ (1.5e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (2.96296298503875732421875e-1, -+0.0);
__builtin_cpowf (__complex__ (-1.5e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-2.96296298503875732421875e-1, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-3.375e+0, -+0.0);
__builtin_cpowf (__complex__ (2.0e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (1.25e-1, -+0.0);
__builtin_cpowf (__complex__ (-2.0e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-1.25e-1, +-0.0);
__builtin_cpowf (__complex__ (-2.0e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-8.0e+0, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.2345679104328155517578125e-2, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, 0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (4.1152262128889560699462890625e-3, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (-4.1152262128889560699462890625e-3, +-0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (5.0e+0, -0.0)) = __complex__ (-2.43e+2, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (-4.0e+0, -0.0)) = __complex__ (1.2345679104328155517578125e-2, +-0.0);
__builtin_cpowf (__complex__ (4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, -0.0), __complex__ (-2.0e+0, -0.0)) = __complex__ (6.25e-2, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-3.375e+0, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-2.96296296296296296301315750798544002009293762966990470886e-1, -+0.0);
__builtin_cpowf (__complex__ (1.5e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (3.375e+0, -+0.0);
__builtin_cpowf (__complex__ (-2.0e+0, 0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (-8.0e+0, +-0.0);
__builtin_cpowf (__complex__ (-2.0e+0, 0.0), __complex__ (-3.0e+0, -0.0)) = __complex__ (-1.25e-1, -+0.0);
__builtin_cpowf (__complex__ (2.0e+0, -0.0), __complex__ (3.0e+0, 0.0)) = __complex__ (8.0e+0, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.23456790123456790122724786341878999706977992900647222996e-2, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (4.0e+0, -0.0)) = __complex__ (8.1e+1, +-0.0);
__builtin_cpowf (__complex__ (3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (-2.43e+2, +-0.0);
__builtin_cpowf (__complex__ (-3.0e+0, 0.0), __complex__ (-5.0e+0, -0.0)) = __complex__ (-4.11522633744855967075749287806263332356593309668824076653e-3, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, -0.0), __complex__ (5.0e+0, 0.0)) = __complex__ (2.43e+2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, 0.0), __complex__ (2.0e+0, -0.0)) = __complex__ (1.6e+1, +-0.0);
__builtin_cpowf (__complex__ (4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpowf (__complex__ (1.5e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (2.96296296296296296301315750798544002009293762966990470886e-1, -+0.0);
__builtin_cpowf (__complex__ (-1.5e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-2.96296296296296296301315750798544002009293762966990470886e-1, +-0.0);
__builtin_cpowf (__complex__ (-1.5e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-3.375e+0, -+0.0);
__builtin_cpowf (__complex__ (2.0e+0, 0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (1.25e-1, -+0.0);
__builtin_cpowf (__complex__ (-2.0e+0, -0.0), __complex__ (-3.0e+0, 0.0)) = __complex__ (-1.25e-1, +-0.0);
__builtin_cpowf (__complex__ (-2.0e+0, -0.0), __complex__ (3.0e+0, -0.0)) = __complex__ (-8.0e+0, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, 0.0), __complex__ (-4.0e+0, 0.0)) = __complex__ (1.23456790123456790122724786341878999706977992900647222996e-2, -+0.0);
__builtin_cpowf (__complex__ (3.0e+0, 0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (4.11522633744855967075749287806263332356593309668824076653e-3, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (-5.0e+0, 0.0)) = __complex__ (-4.11522633744855967075749287806263332356593309668824076653e-3, +-0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (5.0e+0, -0.0)) = __complex__ (-2.43e+2, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (4.0e+0, 0.0)) = __complex__ (8.1e+1, -+0.0);
__builtin_cpowf (__complex__ (-3.0e+0, -0.0), __complex__ (-4.0e+0, -0.0)) = __complex__ (1.23456790123456790122724786341878999706977992900647222996e-2, +-0.0);
__builtin_cpowf (__complex__ (4.0e+0, 0.0), __complex__ (-2.0e+0, 0.0)) = __complex__ (6.25e-2, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, -0.0), __complex__ (2.0e+0, 0.0)) = __complex__ (1.6e+1, -+0.0);
__builtin_cpowf (__complex__ (-4.0e+0, -0.0), __complex__ (-2.0e+0, -0.0)) = __complex__ (6.25e-2, +-0.0);

The following patch adjusts the testcase, so that it ignores the sign of
zero imag part.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/124682
* gcc.dg/torture/builtin-math-6.c (TESTIT_COMPLEX_R2_ISZ): Define.
(TESTIT_COMPLEX_R2_ALLNEG): Use TESTIT_COMPLEX_R2_ISZ instead of
TESTIT_COMPLEX_R2.

Reviewed-by: Richard Biener <rguenth@suse.de>
3 months agobitintlower: Padding bit fixes, part 4 [PR123635]
Jakub Jelinek [Tue, 21 Apr 2026 09:53:52 +0000 (11:53 +0200)] 
bitintlower: Padding bit fixes, part 4 [PR123635]

As the following testcase shows, not clearing the padding bits after
signed MULT_EXPR (or signed division) is reasonable when overflow actually is
undefined behavior because then anything can happen.  But when it is not
undefined behavior due to -fwrapv, we need to clear the padding bits
on targets which chose that behavior.  It isn't only signed MULT_EXPR,
but also division because smallest negative / -1 overflows and in that
case the padding bits aren't correct for bitint_extended targets either.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/123635
* gimple-lower-bitint.cc (bitint_large_huge::lower_muldiv_stmt):
Extend the padding bits not just for unsigned MULT_EXPR but for any
TYPE_OVERFLOW_WRAPS MULT_EXPR and signed TYPE_OVERFLOW_WRAPS division.

* gcc.dg/torture/bitint-90.c: New test.

Reviewed-by: Richard Biener <rguenth@suse.de>
3 months agosccvn: Use build_bitint_type in another SCCVN spot [PR124941]
Jakub Jelinek [Tue, 21 Apr 2026 09:49:23 +0000 (11:49 +0200)] 
sccvn: Use build_bitint_type in another SCCVN spot [PR124941]

The following testcase ICEs on riscv.
tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def) already uses
build_bitint_type instead of build_nonstandard_integer_type for larger
BITINT_TYPE types:
  /* Make sure to interpret in a type that has a range covering the whole
     access size.  */
  if (INTEGRAL_TYPE_P (vr->type) && maxsizei != TYPE_PRECISION (vr->type))
    {
      if (TREE_CODE (vr->type) == BITINT_TYPE
          && maxsizei > MAX_FIXED_MODE_SIZE)
        type = build_bitint_type (maxsizei, TYPE_UNSIGNED (type));
      else
        type = build_nonstandard_integer_type (maxsizei, TYPE_UNSIGNED (type));
    }
and the same change in vn_reference_lookup_3 fixes the ICE.

2026-04-21  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/124941
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Use build_bitint_type
rather than build_nonstandard_integer_type for
maxsizei larger than MAX_FIXED_MODE_SIZE.

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

Reviewed-by: Richard Biener <rguenth@suse.de>
3 months agoFortran: ICE due to allocatable component in hidden type [PR117077]
Paul Thomas [Tue, 21 Apr 2026 14:00:14 +0000 (15:00 +0100)] 
Fortran: ICE due to allocatable component in hidden type [PR117077]

2026-03-19  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/117077
* trans-expr.cc (gfc_trans_scalar_assign): If the lhs and rhs
TYPE_MAIN_VARIANTs are not the same, convert the rhs to the lhs
type via a VIEW_CONVERT_EXPR.

gcc/testsuite/
PR fortran/117077
* gfortran.dg/pr117077.f90: New test.

3 months agoRevert gcc.dg/torture/pr113026-1.c XFAILs/XPASSes [PR113524]
Alexandre Oliva [Tue, 21 Apr 2026 05:17:50 +0000 (02:17 -0300)] 
Revert gcc.dg/torture/pr113026-1.c XFAILs/XPASSes [PR113524]

commit 14cd2833b27a9700aa8679fd0a090e8ae7a5f44a added xfails, but
2025-12-05's Richard Biener <rguenther@suse.de>'s PR
tree-optimization/120939 patch to skip gcc.dg/torture/pr113026-1.c
when -ftracer had already taken care of them without XPASSes.

for  gcc/testsuite/ChangeLog

PR tree-optimization/113524
* gcc.dg/torture/pr113026-1.c: Revert 2026-01-21's
XFAIL of bogus warning on various 32-bit targets.

3 months agotestsuite: arm: update fast-math-complex-mls-{float,double}.c [PR116463]
Alexandre Oliva [Tue, 21 Apr 2026 05:17:43 +0000 (02:17 -0300)] 
testsuite: arm: update fast-math-complex-mls-{float,double}.c [PR116463]

Changes to arm_v8_3a_complex_neon options and to
vect_complex_add_{float,double} enabled these tests and caused them to
fail with the same failure mode as -half-float.c, namely, reassoc
makes ADD_ROT270 unrecognizable in fms_elemconjsnd after complex
lowering and dce's removal of the original complex assignments.

for  gcc/testsuite/ChangeLog

PR tree-optimization/116463
* gcc.dg/vect/complex/fast-math-complex-mls-float.c:
Don't expect COMPLEX_ADD_ROT270.
* gcc.dg/vect/complex/fast-math-complex-mls-double.c:
Likewise.