]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 weeks agogccrs: Optionally pull in the inherited arguments when required
Philip Herron [Sat, 17 Jan 2026 20:47:29 +0000 (20:47 +0000)] 
gccrs: Optionally pull in the inherited arguments when required

gcc/rust/ChangeLog:

* typecheck/rust-tyty-subst.cc: we can optionally apply inherited arguments

gcc/testsuite/ChangeLog:

* rust/compile/gat2.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 weeks ago[PATCH] RISC-V: Fix dead cpop reservation for spacemit-x60
Jim Lin [Wed, 8 Jul 2026 13:59:30 +0000 (07:59 -0600)] 
[PATCH] RISC-V: Fix dead cpop reservation for spacemit-x60

The type "cpop" was listed in both spacemit_x60_alu (latency 1) and the
dedicated spacemit_x60_alu2c reservation (latency 2).  Since
spacemit_x60_alu appears first, it always matched cpop and left
spacemit_x60_alu2c dead, so cpop was scheduled with the wrong latency.

Remove cpop from spacemit_x60_alu so the dedicated 2-cycle reservation
takes effect.

gcc/ChangeLog:

* config/riscv/spacemit-x60.md (spacemit_x60_alu): Remove cpop
from the type list.

4 weeks agoRemove group_size argument from vect_built_slp_tree* APIs
Richard Biener [Wed, 8 Jul 2026 12:25:08 +0000 (14:25 +0200)] 
Remove group_size argument from vect_built_slp_tree* APIs

The group_size argument is redundant with the stmt vector length.

* tree-vect-slp.cc (vect_build_slp_tree_1): Remove group_size
argument and adjust.
(vect_build_slp_tree_2): Likewise.
(vect_build_slp_tree): Likewise.
(optimize_load_redistribution_1): Likewise.
(vect_build_slp_instance): Likewise.
(vect_analyze_slp_reduc_chain): Likewise.
(vect_analyze_slp_reduction): Likewise.
(vect_analyze_slp_reduction_group): Likewise.
(vect_analyze_slp_instance): Likewise.
(vect_lower_load_permutations): Likewise.

4 weeks agotree-optimization/126150 - ICE with replace_uses_by
Richard Biener [Wed, 8 Jul 2026 11:57:17 +0000 (13:57 +0200)] 
tree-optimization/126150 - ICE with replace_uses_by

replace_uses_by triggers eventual BB removal from inside a
FOR_EACH_IMM_USE_STMT iteration.  That's a no-go since we might
eliminate uses in the list we are currently processing.  The
fix is to defer EH edge purging.

PR tree-optimization/126150
* tree-cfg.cc (replace_uses_by): Delay purging of EH edges
until after FOR_EACH_IMM_USE_STMT finished.

* g++.dg/pr126150.C: New testcase.

4 weeks agoc: harmonize handling of arrays of zero size
Martin Uecker [Sun, 28 Jun 2026 17:29:48 +0000 (19:29 +0200)] 
c: harmonize handling of arrays of zero size

Use common functions for creating and detecting arrays of zero size.
The function to detect arrays of zero size is changed to also accept
C++ style representation that are somtimes created (at least in
complete_array_type).  A future change may switch to only use this
representation.  Other code is refactored to use the new helper functions
and to use flexible_array_member_type_p to properly distinguish between
the two cases (instead of checking for TYPE_MAX_VALUE being NULL_TREE).
As part of this, the explict check for complete types is removed from
composite_type_internal, which may be helpful when potentially allowing
arrays with incomplete element type (which alsoC occur already for
built-in va_arg types).

gcc/c/ChangeLog:
* c-tree.h (zero_length_array_type_p,
c_build_array_type_zero_size) Add prototypes.
* c-decl.cc (zero_length_array_type_p): External linkage.
(c_build_array_type_zero_size): New.
(grokdeclarator): Use new function.
* c-typeck.cc (c_verify_type): New consistency checks.
(c_build_array_type_zero_size): New function
(composite_type_internal): Refactor.
(comptypes_internal): Refactor.

4 weeks agoc: harmonize checking for flex array member type
Martin Uecker [Sun, 28 Jun 2026 18:04:14 +0000 (20:04 +0200)] 
c: harmonize checking for flex array member type

We already have a helper function to detect the type of a flexible
array member.  Rename it for consistency and move it to tree.cc.
Also use the function for some additional cases instead of using a
direct test.  In digest_init the change removes the warning for
zero-sized arrays, but it is misleading and redundant as we already
warn for excess initializers (and with -Wpedantic also for the use
of zero-sized arrays).

gcc/c-family/ChangeLog:
* c-attribs.cc (handle_counted_by_attribute): Adapt.
* c-common.h (c_flexible_array_member_type_p): Remove.
* c-common.cc (c_flexible_array_member_type_p): Remove.

gcc/c/ChangeLog:
* c-decl.cc (grokdeclarator): Add assertion.
(add_flexible_array_elts_to_size): Adapt.
(is_flexible_array_member_p): Adapt.
(verify_counted_by_attribute): Adapt.
(finish_struct): Adapt.
* c-typeck.cc (check_counted_by_attribute): Adapt.
(build_counted_by_ref): Adapt.
(build_access_with_size_for_counted_by): Adapt.
(handle_counted_by_for_component_ref): Adapt.
(c_incomplete_type_error): Use new helper function.
(digest_init): Use new helper function.
(pop_init_level): Use new helper function.

gcc/ChangeLog:
* tree.h (flexible_array_member_type_p): New helper function.
* tree.cc (flexible_array_member_type_p): New helper function.
(flexible_array_type_p): Use new helper function.

4 weeks agotree-optimization/126159 - handle unions in data dependence analysis
Richard Biener [Wed, 8 Jul 2026 08:06:40 +0000 (10:06 +0200)] 
tree-optimization/126159 - handle unions in data dependence analysis

The following implements minimal handling of union accesses in
data reference analysis, namely accesses to non-aggregate fields,
in particular those we are not adding additional subsetting on.

PR tree-optimization/126159
* tree-data-ref.cc (dr_analyze_indices): Handle non-aggregate
union field accesses.
(access_fn_component_p): Adjust.

* gcc.dg/vect/vect-pr126159-1.c: New testcase.
* gcc.dg/vect/vect-pr126159-2.c: Likewise.

4 weeks agofortran: Create a dedicated type for ranks and array dimensions
Mikael Morin [Mon, 22 Jun 2026 14:53:30 +0000 (16:53 +0200)] 
fortran: Create a dedicated type for ranks and array dimensions

This patch adds a type to represent ranks and array dimension, using the
same base type as originally used for the rank in array descriptors
(signed char), but with the stricter bounds (0 to GFC_MAX_DIMENSIONS)
brought to the knowledge of the middle-end.  The new type is used for
the rank in array descriptors, and in various places in the compiler as
well, such as loops on array dimensions.  Conversions to signed char
are added in places where negative intermediary results were possible,
and loops on array dimensions where the new type is used have been
double-checked to not step backwards (in which case the iteration index
would reach -1 after the last iteration).

gcc/fortran/ChangeLog:

* trans-types.h (gfc_array_dim_rank_type): New type node
declaration.
* trans-types.cc (gfc_array_dim_rank_type): Likewise.
(gfc_init_types) : Initialize the new type node.
(get_dtype_type_node): Use the new type for the rank field.
* trans-descriptor.cc (gfc_conv_descriptor_rank): Likewise.
* trans-const.h (gfc_index_zero_node, gfc_index_one_node): Make
each macro a separate node declaration.
* trans-const.cc (gfc_index_zero_node, gfc_index_one_node):
Declare new nodes.
(gfc_init_constants): Initialize them.  Use the new type for the
constants of the gfc_rank_cst array.
* trans-array.cc (gfc_tree_array_size): Use the new type for the
RANK, IDX and DIM variables.  Avoid negative intermediary value
in comparison using the new type.
(gfc_conv_array_parameter): Use the new type when assigning a
value to the descriptor's rank.  Use the new type for the IDX
variable.
* trans-decl.cc (gfc_conv_cfi_to_gfc): Use the new type for the
rank, and the dimension index variable (including loop initial
value and step).
* trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Likewise.
(gfc_conv_variable): Use the new type for the rank variable.
(gfc_trans_structure_assign): Use the new type when assigning a
value to the descriptor's rank.
* trans-openmp.cc (gfc_omp_get_array_size): Use the new type
for the dimension index variable and the loop initialization,
bound and step.
* trans-intrinsic.cc (gfc_conv_intrinsic_bound): Use the new
type for the DIM argument and the rank.
(conv_intrinsic_cobound): Likewise.
(trans_this_image): Likewise.  Use the new type for the loop
variable, initialization, bound and step.
(gfc_conv_intrinsic_sizeof): Likewise.
* trans-stmt.cc (gfc_trans_select_rank_cases): Use signed char
as type for the select value.

4 weeks agomatch.pd: Fold SAD_EXPR with identical inputs
Pengfei Li [Mon, 6 Jul 2026 13:11:32 +0000 (13:11 +0000)] 
match.pd: Fold SAD_EXPR with identical inputs

Normally, SAD_EXPRs with identical first and second operands are not
constructed, since the absolute difference value is zero. However, this
can still appear when vectorizing small iteration-count reduction loops
with an absolute difference operation.

This patch adds a match.pd rule to fold the redundant SAD_EXPR to its
accumulator operand.

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

gcc/ChangeLog:

* match.pd: Simplify SAD(x, x, acc) into acc.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/sad_2.c: New test.

4 weeks agoRename SEH functions for reuse in AArch64
Evgeny Karpov [Fri, 15 Nov 2024 12:36:41 +0000 (13:36 +0100)] 
Rename SEH functions for reuse in AArch64

This patch renames functions related to SEH functionality. These
functions will be reused in the aarch64-w64-mingw32 target.

Signed-off-by: Evgeny Karpov <evgeny@kmaps.co>
gcc/ChangeLog:

* config/i386/cygming.h (TARGET_ASM_FUNCTION_END_PROLOGUE):
Rename.
(TARGET_ASM_EMIT_EXCEPT_PERSONALITY): Likewise.
(TARGET_ASM_INIT_SECTIONS): Likewise.
(SUBTARGET_ASM_UNWIND_INIT): Likewise.
(ASM_DECLARE_FUNCTION_SIZE): Likewise.
(ASM_DECLARE_COLD_FUNCTION_SIZE): Likewise.
* config/i386/i386-protos.h (i386_pe_end_function):
Remove declarations.
(i386_pe_end_cold_function): Likewise.
(i386_pe_seh_init): Likewise.
(i386_pe_seh_end_prologue): Likewise.
(i386_pe_seh_cold_init): Likewise.
(i386_pe_seh_emit_except_personality): Likewise.
(i386_pe_seh_init_sections): Likewise.
* config/mingw/winnt.cc (defined): Update.
(struct seh_frame_state): Move to mingw/winnt.h.
(i386_pe_seh_init): Rename into ...
(mingw_pe_seh_init): ... this.
(i386_pe_seh_end_prologue): Rename into ...
(mingw_pe_seh_end_prologue): ... this.
(i386_pe_seh_cold_init): Rename into ...
(mingw_pe_seh_cold_init): ... this.
(i386_pe_seh_fini): Rename into ...
(mingw_pe_seh_fini): ... this.
(seh_emit_stackalloc): Rename into ...
(mingw_pe_seh_emit_stackalloc): ... this.
(seh_cfa_adjust_cfa): Update.
(seh_frame_related_expr): Update.
(i386_pe_seh_emit_except_personality): Rename into ...
(mingw_pe_seh_emit_except_personality): ... this.
(i386_pe_seh_init_sections): Rename into ...
(mingw_pe_seh_init_sections): ... this.
(i386_pe_end_function): Rename into ...
(mingw_pe_end_function): ... this.
(i386_pe_end_cold_function): Rename into ...
(mingw_pe_end_cold_function): ... this.
* config/mingw/winnt.h (struct seh_frame_state):
Move from mingw/winnt.cc.
(mingw_pe_end_cold_function): Add declarations.
(mingw_pe_end_function): Likewise.
(mingw_pe_seh_init): Likewise.
(mingw_pe_seh_init_sections): Likewise.
(mingw_pe_seh_cold_init): Likewise.
(mingw_pe_seh_emit_except_personality): Likewise.
(mingw_pe_seh_end_prologue): Likewise.

4 weeks agovect: unshare header computation for more CSE
Tamar Christina [Wed, 8 Jul 2026 07:35:45 +0000 (08:35 +0100)] 
vect: unshare header computation for more CSE

The example loop

#define N 512
#define START 1
#define END 505

int x[N] __attribute__((aligned(32)));

int __attribute__((noipa))
foo (void)
{
  for (int *p = x + START; p < x + END; ++p)
    if (*p == 0)
      return START;

  return -1;
}

shows that when we vectorize we generate the following pre-header when doing
peeling for alignment:

  _22 = (unsigned long) &MEM <int[512]> [(void *)&x + 4B];
  _23 = _22 & POLY_INT_CST [15, 16];
  _24 = _23 >> 2;
  _26 = 1 - _24;
  _27 = _26 * 4;
  vectp_x.6_25 = &x + _27;
  _36 = 504 + _24;
  max_mask_37 = .WHILE_ULT (0, _36, { 0, ... });
  _38 = .WHILE_ULT (0, _24, { 0, ... });
  _39 = ~_38;
  _40 = max_mask_37 & _39;

notice how _22 and and the actual vector pointer vectp_x.6_25 start at the
same offset but have a different base.  This happens because in
vect_create_addr_base_for_vector_ref we fold the offset into the base very
early and so we can't form or share the address computation anymore with the
scalar address which needs to be there for the alignment checks.

The patch delays this and forms an explicit base + offset and keeping base as
a separate value.  This allows VN at the end of vect to share the computations
and we get

  _22 = (unsigned long) &MEM <int[512]> [(void *)&x + 4B];
  _23 = _22 & POLY_INT_CST [15, 16];
  _24 = _23 >> 2;
  _27 = _24 * 4;
  _28 = -_27;
  vectp_x.6_26 = &MEM <int[512]> [(void *)&x + 4B] + _28;
  _37 = 504 + _24;
  max_mask_38 = .WHILE_ULT (0, _37, { 0, ... });
  _39 = .WHILE_ULT (0, _24, { 0, ... });
  _40 = ~_39;
  _41 = max_mask_38 & _40;

Notice how they now share the same base address.  This drops two instructions
off the loop pre-header:

from

foo:
        cntb    x0
        sub     x3, x0, #1
        cmp     x0, 4096
        and     x0, x0, x3
        ccmp    x0, 0, 0, ls
        bne     .L7
        adrp    x4, .LANCHOR0
        add     x4, x4, :lo12:.LANCHOR0
        add     x1, x4, 4
        mov     w2, 1
        and     x1, x1, x3
        mov     w0, 0
        cntw    x3
        lsr     x1, x1, 2
        whilelo p15.s, xzr, x1
        sub     x2, x2, x1
        add     x1, x1, 504
        whilelo p7.s, xzr, x1
        not     p7.b, p7/z, p15.b
        add     x2, x4, x2, lsl 2
        b       .L4

to

foo:
        cntb    x0
        sub     x1, x0, #1
        cmp     x0, 4096
        and     x0, x0, x1
        adrp    x2, .LANCHOR0
        ccmp    x0, 0, 0, ls
        add     x2, x2, :lo12:.LANCHOR0
        bne     .L7
        add     x2, x2, 4
        mov     w0, 0
        and     x1, x2, x1
        cntw    x3
        sub     x2, x2, x1
        lsr     x1, x1, 2
        whilelo p15.s, xzr, x1
        add     x1, x1, 504
        whilelo p7.s, xzr, x1
        not     p7.b, p7/z, p15.b
        b       .L4

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_create_addr_base_for_vector_ref):
Restructure computations to force separate base.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/vect-early-break-cbranch_18.c: New test.

4 weeks agovect: replace iterations bounded to length to for_each
Tamar Christina [Wed, 8 Jul 2026 07:34:33 +0000 (08:34 +0100)] 
vect: replace iterations bounded to length to for_each

Replace uses of iterators over length of SLP_TREE_SCALAR_STMTS and
SLP_TREE_SCALAR_OPS with for-each loops when the .length () was just being used
as an index.

This is because we are trying to get rid of the notion of the number of scalar
statement or ops determining the number of lanes in the SLP tree and such
iterators are confusing.

i.e. it was a numbered for each.

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_slp_analyze_store_dependences,
vect_slp_analyze_load_dependences,
vect_slp_analyze_instance_dependence): Use for-each over for with len.
* tree-vect-slp.cc (vect_mark_slp_stmts_relevant,
,vect_find_last_scalar_stmt_in_slp, vect_find_first_scalar_stmt_in_slp,
vect_build_slp_store_interleaving, vect_analyze_slp,
vect_slp_prune_covered_roots, vect_bb_partition_graph_r,
vect_remove_slp_scalar_calls): Likewise.

4 weeks agoImprove variadic function call handling in PTA
Richard Biener [Tue, 7 Jul 2026 06:54:45 +0000 (08:54 +0200)] 
Improve variadic function call handling in PTA

The following fixes handling of __builtin_va_start handling and
implements .VA_ARG handling in PTA constraint generation to
improve precision around variadic calls.  I've added a testcase
for IPA PTA involving an indirect variadic call verifying precision.

The pr99679-1.C no longer emits an expected error that was triggered
by PTA calling aggregate_value_p on the .VA_ARG call which we no
longer do.

* gimple-ssa-pta-constraints.cc (find_func_aliases_for_builtin_call):
Correctly use SCALAR rhs from the variadic argument part of
the function info or from NONLOCAL in case of intra-PTA.
(find_func_aliases_for_call): Handle .VA_ARG.

* gcc.dg/ipa/ipa-pta-20.c: New testcase.
* g++.target/i386/pr99679-1.C: Remove expected error.
* g++.target/i386/pr99679-2.C: Likewise.

4 weeks agoaarch64: populate issue_info for the ampere1 family
Philipp Tomsich [Wed, 8 Jul 2026 06:46:25 +0000 (08:46 +0200)] 
aarch64: populate issue_info for the ampere1 family

The ampere1, ampere1a and ampere1b tunes leave the vector issue_info
in cpu_vector_cost as NULL, so determine_suggested_unroll_factor bails
out early and reduction loops are never multi-accumulator-unrolled on
these cores.  Fill it in from the ampere1 optimization guide (L1D two
128-bit loads plus one store per cycle, four general ops per cycle).

gcc/ChangeLog:

* config/aarch64/tuning_models/ampere1.h (ampere1_scalar_issue_info)
(ampere1_advsimd_issue_info, ampere1_vec_issue_info): New.
(ampere1_vector_cost): Use ampere1_vec_issue_info for issue_info.
* config/aarch64/tuning_models/ampere1b.h (ampere1b_scalar_issue_info)
(ampere1b_advsimd_issue_info, ampere1b_vec_issue_info): New.
(ampere1b_vector_cost): Use ampere1b_vec_issue_info for issue_info.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/ampere1-reduction-unroll-1.c: New test.

4 weeks agox86: Implement TARGET_FNTYPE_ABI
H.J. Lu [Tue, 14 Apr 2026 10:37:20 +0000 (18:37 +0800)] 
x86: Implement TARGET_FNTYPE_ABI

Implement TARGET_FNTYPE_ABI to avoid spills of callee-saved registers
when calling functions with no_caller_saved_registers attribute.

After

commit 754c6600fe058f1026098fde57860bbc38cc28fe
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date:   Wed Jun 3 13:11:17 2026 +0100

    Add CALL_INSN_ABI_ID

there is no need for ix86_expand_call to add clobbers for when one ABI
calls another ABI.

ABI_ALTERNATE is the alternate function ABI from the system ABI.  If
ix86_abi is SYSV_ABI, ABI_ALTERNATE is the function ABI for MS_ABI.
Otherwise, ABI_ALTERNATE is the function ABI for SYSV_ABI.

This target hook also properly marks the implicit __tls_get_addr call:

(call_insn/u 9 8 10 (parallel [
            (set (reg:DI 0 ax)
                (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0  S1 A8])
                    (const_int 0 [0])))
            (unspec:DI [
                    (reg/f:DI 7 sp)
                ] UNSPEC_TLS_LD_BASE)
            (clobber (reg:DI 5 di))
        ]) "x.c":7:16 -1
     (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000])
        (nil))
    (nil) 0)

with ABI_DEFAULT function ABI.

Tested on Linux/x86-64 and with CPython 3.14.4.

gcc/

PR target/124798
PR target/125436
* config/i386/i386-expand.cc: Include "function-abi.h".
(x86_64_ms_sysv_extra_clobbered_registers): Removed.
(ix86_expand_call): Don't add explicit call and ABI-switch
clobbers.
* config/i386/i386-features.cc (ix86_emit_tls_call): Call
ix86_tls_get_addr_abi to get GNU TLS ABI and use it, instead of
default_function_abi, for registers clobbered by GNU TLS call.
(ix86_place_single_tls_call): Set CALL_INSN_ABI_ID on TLS calls.
* config/i386/i386-options.cc (ix86_set_current_function): Don't
call reinit_regs.
* config/i386/i386-protos.h
(ix86_type_no_callee_saved_registers_p): Removed.
(ix86_tls_get_addr_abi): New.
* config/i386/i386.cc (ix86_alternate_abi): New prototype.
(ix86_conditional_register_usage): Changed to describe the
system ABI.
(ix86_type_no_callee_saved_registers_p): Make it static.
(ix86_function_value_regno_p): Replace ix86_cfun_abi () with
ix86_abi.
(ix86_save_reg): Only check TYPE_NO_CALLEE_SAVED_REGISTERS as
a special case.
(ix86_tls_get_addr_abi): New.
(legitimize_tls_address): Set CALL_INSN_ABI_ID on TLS calls.
Call ix86_alternate_abi to initialize the alternate function ABI.
(ix86_initialize_abi): New function.
(ix86_no_callee_saved_abi): Likewise.
(ix86_no_caller_saved_abi): Likewise.
(ix86_standard_abi): Likewise.
(ix86_alternate_abi): Likewise.
(ix86_function_abi_id): Likewise.
(ix86_fntype_abi): Likewise.
(ix86_hard_regno_call_part_clobbered): Handle newly added ABIs.
(TARGET_FNTYPE_ABI): New.
* config/i386/i386.md: Add ABI_ALTERNATE, ABI_NO_CALLEE_SAVED,
ABI_NO_CALLER_SAVED_RETURN_VOID, ABI_NO_CALLER_SAVED_RETURN_AX,
ABI_NO_CALLER_SAVED_RETURN_AX_DX,
ABI_NO_CALLER_SAVED_RETURN_AX_XMM0,
ABI_NO_CALLER_SAVED_RETURN_XMM0 and
ABI_NO_CALLER_SAVED_RETURN_XMM0_XMM1.

gcc/testsuite/

PR target/124798
PR target/125436
* gcc.target/i386/abi-mix-1.c: New test.
* gcc.target/i386/abi-mix-2.c: Likewise.
* gcc.target/i386/no-callee-saved-20.c: Likewise.
* gcc.target/i386/no-caller-saved-1-ms.c: Likewise.
* gcc.target/i386/no-caller-saved-1-sysv.c: Likewise.
* gcc.target/i386/no-caller-saved-1.c: Likewise.
* gcc.target/i386/no-caller-saved-2.c: Likewise.
* gcc.target/i386/no-caller-saved-3.c: Likewise.
* gcc.target/i386/no-caller-saved-4.c: Likewise.
* gcc.target/i386/no-caller-saved-5.c: Likewise.
* gcc.target/i386/no-caller-saved-6.c: Likewise.
* gcc.target/i386/no-caller-saved-7.c: Likewise.
* gcc.target/i386/no-caller-saved-8.c: Likewise.
* gcc.target/i386/no-caller-saved-9.c: Likewise.
* gcc.target/i386/no-caller-saved-10.c: Likewise.
* gcc.target/i386/no-caller-saved-11.c: Likewise.
* gcc.target/i386/pr125436-1a.c: Likewise.
* gcc.target/i386/pr125436-1b.c: Likewise.
* gcc.target/i386/pr125436-2a.c: Likewise.
* gcc.target/i386/pr125436-2b.c: Likewise.
* gcc.target/i386/pr125436-3.c: Likewise.
* gcc.target/i386/pr125436-4.c: Likewise.
* gcc.target/i386/pr119784b.c: Adjusted for unused RBP.
* gcc.target/i386/no-callee-saved-18.c: Don't check frame
register.
* gcc.target/i386/no-callee-saved-19b.c: Update the expected
instruction order.
* gcc.target/i386/no-callee-saved-19d.c: Likewise.
* gcc.target/i386/no-callee-saved-19e.c: Likewise.
* gcc.target/i386/no-callee-saved-2.c: Check frame register isn't
saved nor restored in 64-bit mode.
* gcc.target/i386/no-callee-saved-8.c: Expect no saving nor
restoring caller-saved registers.
* gcc.target/i386/no-callee-saved-9.c: Likewise.
* gcc.target/i386/preserve-none-14.c: Don't check frame register.
* gcc.target/i386/preserve-none-23.c: Likewise.
* gcc.target/i386/preserve-none-7.c: Check frame register isn't
saved nor restored in 64-bit mode.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-by: Richard Sandiford <rdsandiford@googlemail.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoi386: Avoid always-true condition
Richard Sandiford [Thu, 14 May 2026 22:06:39 +0000 (23:06 +0100)] 
i386: Avoid always-true condition

ix86_function_arg is always passed a cumulative argument structure,
so the ?: test in the patch was redundant.

gcc/
* config/i386/i386.cc (ix86_function_arg): Remove always-true
condition.

4 weeks agoi386: Avoid reading call_used_regs
Richard Sandiford [Thu, 14 May 2026 21:43:40 +0000 (22:43 +0100)] 
i386: Avoid reading call_used_regs

call_used_regs is a legacy interface that targets use to tell
init_reg_sets_1 about the default (system) ABI.  In x86 terms,
that means the ABI associated with ix86_abi.

Targets can continue to read call_used_regs directly if they
don't have multiple ABIs.  But now that x86 does, it's better
to be explicit about which ABI is being queried.  This is
currently a nop but becomes important with the upcoming
function_abi patch.

As the comment in ix86_emit_tls_call says:

      /* TLS_GD and TLS_LD_BASE instructions are normal functions which
 clobber caller-saved registers. [...]

So that function really is querying the system ABI.

Similarly, x86_order_regs_for_local_alloc is called when initialising
a target, rather than once per function, so it too should query the
system ABI.

ix86_save_reg and x86_64_select_profile_regnum ask about the
current function's ABI, which is crtl->abi.

gcc/
* config/i386/i386-features.cc: Include function-abi.h.
(ix86_emit_tls_call): Use default_function_abi instead of
call_used_regs.
* config/i386/i386.cc (x86_order_regs_for_local_alloc): Likewise.
(ix86_save_reg, x86_64_select_profile_regnum): Use crtl->abi
instead of call_used_regs.

4 weeks agoi386: Split out call_saved_registers_type detection
Richard Sandiford [Thu, 14 May 2026 21:51:49 +0000 (22:51 +0100)] 
i386: Split out call_saved_registers_type detection

There are currently two places that want to query a function's
call_saved_registers_type: ix86_set_func_type (when setting up
cfun->machine) and ix86_type_no_callee_saved_registers_p
(a derived query).  The upcoming function_abi patch will add
another one, so this patch splits the code out into a subroutine.

ix86_set_func_type did some of the detection first, into
no_callee_saved_registers, but then ignored the result if
cfun->machine->func_type had already been set.  The patch therefore
moves all of the detection after the cfun->machine->func_type test,
rather than moving all of it before.

gcc/
* config/i386/i386-protos.h (ix86_fntype_call_saved_registers):
Declare.
* config/i386/i386-options.cc (ix86_fntype_call_saved_registers): New
function, split out from...
(ix86_set_func_type): ...here.  Avoid calling it if the result
would be ignored.
* config/i386/i386.cc (ix86_type_no_callee_saved_registers_p): Use
ix86_fntype_call_saved_registers instead of querying attributes
directly.

4 weeks agoRISC-V: Add test cases for vzext.vf2 reg overlap
Pan Li [Wed, 1 Jul 2026 05:48:17 +0000 (13:48 +0800)] 
RISC-V: Add test cases for vzext.vf2 reg overlap

Add test cases for vzext.vf2 register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u32-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vzext_vf2-u8-mf8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoRISC-V: Add test cases for vsext.vf2 reg overlap
Pan Li [Wed, 1 Jul 2026 05:39:43 +0000 (13:39 +0800)] 
RISC-V: Add test cases for vsext.vf2 reg overlap

Add test cases for vsext.vf2 register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/rvv.exp: Add group_overlap folder.
* gcc.target/riscv/rvv/autovec/group_overlap/group_overlap.h: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i32-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vsext_vf2-i8-mf8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoRISC-V: Allow RVV register overlap for v[sz]ext.vf2
Pan Li [Tue, 7 Jul 2026 03:52:34 +0000 (11:52 +0800)] 
RISC-V: Allow RVV register overlap for v[sz]ext.vf2

According to the RVV 1.0 spec, the widening ops like vzext.vf2
could have the source registers overlap on constraint, aka:

`
The destination EEW is greater than the source EEW, the source
EMUL is at least 1, and the overlap is in the highest-
numbered part of the destination register group.
`

However, the lra for now doesn't try to overlap as much as
possible.  The overlap rvv register pair(s) in the constraint
is avaiable but the lra is the final decicsion maker to pick
the avaiable register pairs.

Therefore, from the test cases we can see, not all registers
in rvv will overlap for insn vsext.vf, even if it could
overlap up to a point.

gcc/ChangeLog:

* config/riscv/constraints.md (Wtt): Rename to Wvr to
indicate widen vector register constraint.
* config/riscv/riscv-protos.h (riscv_widen_overlap_ok): Rename
from...
(riscv_vector_mode_p): Add new decl for riscv-v.cc visibile.
(riscv_hard_regno_nregs): Ditto.
(riscv_v_widen_constraint_ok): Rename to...
* config/riscv/riscv-v.cc (riscv_v_widen_constraint_ok): Rename
to... and take care of Wvr constraint.
* config/riscv/riscv.cc (riscv_vector_mode_p): Remove static.
(riscv_hard_regno_nregs): Ditto.
(riscv_widen_overlap_ok): Remove.
* config/riscv/vector.md: Rename to Wvr.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoDaily bump.
GCC Administrator [Wed, 8 Jul 2026 00:16:32 +0000 (00:16 +0000)] 
Daily bump.

4 weeks agoc++: handle nullptr_t in can_convert_eh
Egas Ribeiro [Tue, 7 Jul 2026 16:52:08 +0000 (12:52 -0400)] 
c++: handle nullptr_t in can_convert_eh

can_convert_eh implements the [except.handle] matching rules, but did
not cover the case of a std::nullptr_t exception being caught by a
handler of pointer or pointer-to-member type.  Add it.

gcc/cp/ChangeLog:
* except.cc (can_convert_eh): Handle a nullptr_t exception
caught by a pointer or pointer-to-member handler.

gcc/testsuite/ChangeLog:
* g++.dg/eh/can-convert-nullptr.C: New test.

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@gmail.com>
4 weeks agoc++: fix unevaluated operand context for typeid [PR125886]
Vladislav Semykin [Tue, 7 Jul 2026 16:52:08 +0000 (12:52 -0400)] 
c++: fix unevaluated operand context for typeid [PR125886]

Per [expr.typeid]/4-5, a typeid operand is unevaluated by default and
is evaluated only for a glvalue of polymorphic class type whose dynamic
type is not known at compile time.  Previously GCC always parsed the
operand in an evaluated context, which broke unevaluated uses (declval,
non-static data members per DR613, function parameters) and missed
lambda capture diagnostics for evaluated polymorphic operands.

Implement a two-pass parse: first under cp_unevaluated, then - if
typeid_evaluated_p says the operand is evaluated - roll back and
re-parse under cp_evaluated.  Share the evaluated/unevaluated predicate
via typeid_evaluated_p in rtti.cc, used from the parser, tsubst_expr,
and build_typeid.

Also fixes PR c++/68604 and PR c++/116385, and removes a now-stale xfail
in g++.dg/coroutines/unevaluated.C.

PR c++/125886
PR c++/116385
PR c++/68604

gcc/cp/ChangeLog:
* parser.cc (cp_parser_postfix_expression): Two-pass typeid parse.
* pt.cc (tsubst_expr): Same for TYPEID_EXPR.
* rtti.cc (typeid_evaluated_p, build_typeid): Shared predicate.
* cp-tree.h: Declare typeid_evaluated_p.

gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/pr125886.C: New test.
* g++.dg/rtti/typeid14.C, g++.dg/rtti/typeid15.C: New tests.
* g++.dg/coroutines/unevaluated.C: Drop stale xfail.

Signed-off-by: Vladislav Semykin <vladislav.semykin@gmail.com>
4 weeks agoaarch64: Remove +mpamv2 and support for MPAMV2_VID.
Richard Earnshaw [Tue, 7 Jul 2026 10:44:48 +0000 (11:44 +0100)] 
aarch64: Remove +mpamv2 and support for MPAMV2_VID.

There are no known implementations of the MPAMV2_VID extension, and
Arm has decided to remove it from the AArch64 architecture specification.
This patch implements that withdrawal.  The only purpose of the +mpamv2
architectural feature extension was to enable the instructions added
by MPAMV2_VID in the assembler and these have also been removed.  The
feature extension is thus redundant and has been removed.  The sysreg
specifications have been updated to conform with similar sysregs that
have no associated instructions in the feature.

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def (AARCH64_OPT_EXTENSION):
Remove +mpamv2.
* config/aarch64/aarch64-sys-regs.def: Remove sysregs associated
with MPAMv2_VID and adjust other related sysregs to use the
base permitted architecture.
* doc/invoke.texi (aarch64: +mpamv2): Remove option.

4 weeks agofortran: [PR103367] Followup patch to fix related test cases
Jerry DeLisle [Tue, 7 Jul 2026 01:30:05 +0000 (18:30 -0700)] 
fortran: [PR103367] Followup patch to fix related test cases

PR fortran/103367

gcc/fortran/ChangeLog:

* expr.cc (simplify_const_ref): Hoist the call to
remove_subobject_ref up a level.
* primary.cc (gfc_match_rvalue): Don't copy the value expr
if the type is an EXPR_VARIABLE.
not
* trans-array.cc (gfc_conv_array_initializer): Only copy the expr
value if it does not have a ref.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr103367_2.f90: New test.
* gfortran.dg/pr103367_3.f90: New test.
* gfortran.dg/pr103367_4.f90: New test.

4 weeks agoaarch64: Add support for -mcpu=rigel
Dhruv Chawla [Tue, 19 May 2026 05:45:28 +0000 (05:45 +0000)] 
aarch64: Add support for -mcpu=rigel

This adds support for the NVIDIA Rigel core to the AArch64 backend. The
initial patch does not add any special tuning decisions, and those may come
later.

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

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (rigel): New entry.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi (AArch64 Options): Document the above.

4 weeks ago[PATCH v5] RISC-V: Add small loop unrolling support via -munroll-only-small-loops
wangjue [Tue, 7 Jul 2026 14:16:16 +0000 (08:16 -0600)] 
[PATCH v5] RISC-V: Add small loop unrolling support via -munroll-only-small-loops

This patch introduces a conservative loop unrolling heuristic for the
RISC-V backend, controlled by the new -munroll-only-small-loops option.

When -munroll-only-small-loops is active, only small loops (those whose
body does not exceed a per-tune instruction threshold) are unrolled, and
the unroll factor is capped by a per-tune parameter, so that tight loops
benefit from unrolling without exposing larger loops to its code-size and
instruction-cache costs.

Mirroring the i386 model, -funroll-loops and -munroll-only-small-loops are
enabled by default at -O2 and above (for speed).  An explicit -funroll-loops
(or -funroll-all-loops) turns -munroll-only-small-loops off, so a user who
explicitly asks for unrolling still gets loops of any size unrolled.  The
size threshold and the maximum unroll factor come from the -mtune tuning
parameters.

Since -funroll-loops is now enabled by default at -O2 and above, a number
of pre-existing RISC-V tests that scan for a specific code sequence change
their output once loops are unrolled.  As those tests do not aim to exercise
unrolling, add -fno-unroll-loops to their options so they keep validating
their intended property regardless of the unrolling decision.

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc (riscv_option_optimization_table):
Enable -funroll-loops and -munroll-only-small-loops at -O2 and above.
* config/riscv/riscv.cc (struct riscv_tune_param): Add fields
small_loop_unroll_ninsns and small_loop_unroll_factor.
(xt_c9501_tune_info): Set them.
(riscv_loop_unroll_adjust): New function.
(riscv_option_override): Turn off -munroll-only-small-loops when
-funroll-loops or -funroll-all-loops is explicitly given.
(TARGET_LOOP_UNROLL_ADJUST): Define.
* config/riscv/riscv.opt (munroll-only-small-loops): New option.
* config/riscv/riscv.opt.urls: Regenerate.
* doc/invoke.texi (RISC-V Options): Document -munroll-only-small-loops.

gcc/testsuite/ChangeLog:
* gcc.target/riscv/unroll-explicit.c: New test.
* gcc.target/riscv/unroll-large-loop.c: New test.
* gcc.target/riscv/unroll-pragma.c: New test.
* gcc.target/riscv/unroll-small-loop-tune.c: New test.
* gcc.target/riscv/unroll-small-loop.c: New test.
* g++.dg/tree-prof/pr57451.C: Add -fno-unroll-loops.
* g++.target/riscv/pr97682.C: Likewise.
* gcc.dg/tree-ssa/pr117973-1.c: Likewise.
* gcc.dg/vect/vect-alias-check-4.c: Likewise.
* gcc.target/riscv/pr67731.c: Likewise.
* gcc.target/riscv/rvv/autovec/pr113206-1.c: Likewise.
* gcc.target/riscv/rvv/autovec/unop/math-nearbyint-0.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-1u.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-2u.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-3u.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-4u.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c: Likewise.
* gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-39.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-41.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-45.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-46.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-48.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-49.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-50.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-52.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-56.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-59.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-60.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-61.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-62.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-64.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-65.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-66.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-67.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-68.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-69.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-70.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-dynamic-frm-71.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-frm-insert-4.c: Likewise.
* gcc.target/riscv/rvv/base/float-point-frm-insert-5.c: Likewise.
* gcc.target/riscv/rvv/base/pr114352-3.c: Likewise.
* gcc.target/riscv/rvv/base/scalar_move-7.c: Likewise.
* gcc.target/riscv/rvv/base/spill-10.c: Likewise.
* gcc.target/riscv/rvv/base/spill-11.c: Likewise.
* gcc.target/riscv/rvv/base/spill-12.c: Likewise.
* gcc.target/riscv/rvv/base/spill-8.c: Likewise.
* gcc.target/riscv/rvv/base/spill-9.c: Likewise.
* gcc.target/riscv/rvv/base/vwaddsub-1.c: Likewise.
* gcc.target/riscv/rvv/base/zvbb_vandn_vx_constraint.c: Likewise.
* gcc.target/riscv/rvv/base/zvbc_vx_constraint-2.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/avl_multiple-3.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/avl_multiple-4.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/avl_single-4.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/avl_single-6.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/avl_single-66.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-1.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-2.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-3.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-4.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-5.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-6.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-1.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-10.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-14.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-15.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-16.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-17.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-18.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-19.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-20.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-21.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-22.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-23.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-29.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-3.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-30.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-31.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-35.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-37.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-7.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-8.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-9.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-16.c: Likewise.
* gcc.target/riscv/slt-1.c: Likewise.
* gcc.target/riscv/struct_vect_24.c: Likewise.

4 weeks agoaarch64: Add optimization for ADD (ABS (A), B) intrinsics
Alfie Richards [Fri, 3 Jul 2026 14:51:55 +0000 (14:51 +0000)] 
aarch64: Add optimization for ADD (ABS (A), B) intrinsics

gcc/ChangeLog:

* config/aarch64/aarch64-simd.md (*aarch64_abs_plus<mode>): New
define_insn_and_split.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/add_abs.c: New test.

4 weeks agolibstdc++: Validate user-provided stride values for layout_stride.
Tomasz KamiÅ„ski [Fri, 3 Jul 2026 12:41:02 +0000 (14:41 +0200)] 
libstdc++: Validate user-provided stride values for layout_stride.

Converting the __strides values using __index_type_cast asserts
that they are non-negative and each value is representable as
index_type.

libstdc++-v3/ChangeLog:

* include/std/mdspan
(layout_stride::mapping::mapping(const extent_type&, span<...>)):
Convert strides using __index_type_cast, which bring asserts
for negative and unrepresentable values.
* testsuite/23_containers/mdspan/layouts/stride_neg.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 weeks agolibstdc++: Gracefully handle unrecognized _Arg_t values in basic_format_arg.
Tomasz KamiÅ„ski [Tue, 23 Jun 2026 08:00:01 +0000 (10:00 +0200)] 
libstdc++: Gracefully handle unrecognized _Arg_t values in basic_format_arg.

Implementing features from later revision of the standard, may require
extending the set of types stored directly in _Arg_value (without
changing in size and aliment), and thus expanding the values in _Arg_t.
However, any such value would be unrecognized by the TUs compiled with
older release, and would lead to UB (call to __builtin_unreachable).

This patch addresses above by introducing _M_handle_unrecognized method,
that is called instead. As specializations of this method for all
context supported at runtime (format_context and wformat_context) are
exported from libstdc++.so, the newest version (supporting all _Arg_t
values introduced later) will be picked (this is ensured by not providing
template definition in header in such case).
In consequence, the implementation may return handle object referencing
new alternatives (such wrapping is already required to provide standard
compliant behavior of visit_format_arg).
As no new _Arg_t were introduced since GCC16, this method simply throws
format_error now, and contains appropriate comment.

Note that the above is not required for formatting when __do_vformat_to
is exported (Unicode literal encoding and C++20). It remains necessary
in remaining cases or when visit on basic_format_arg is called by user.
In consequence addition of new argument types stored directly does not
have negative impact on performance in most common case.

This patch also removes the __type parameter from the _M_visit and
_M_visit_user, and uses _M_type member instead. This prevents misuse,
as the provided type was always required to match _M_type.

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu.ver (GLIBCXX_3.4.36): Export basic_format_arg
_M_handle_unrecognized method of specializations of
format_context and wformat_context.
* include/std/format (basic_format_arg::_M_handle_unrecognized):
Declare with explicit specializations for (w)format_context
if _GLIBCXX_EXTERN_TEMPLATE, and define otherwise.
(basic_format_arg::_M_visit): Remove __type parameter, and use
_M_type instead. Call _M_handle_unrecognized for unrecognized
_Arg_t values.
(basic_format_arg::_M_visit_user): Remove __type parameter,
and use _M_type instead. Adjust calls to _M_visit.
(basic_format_arg::visit, std::visit_format_arg)
(__format::__visit_format_arg): Remove _M_type argument from
_M_visit(_user) calls.
* src/c++20/format-inst.cc
(basic_format_arg::_M_handle_unrecognized): Define and export
explicit specializations for (w)format_context.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 weeks agolibstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS comments for 2023 issues.
Tomasz KamiÅ„ski [Mon, 6 Jul 2026 14:35:46 +0000 (16:35 +0200)] 
libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS comments for 2023 issues.

Covers issues affecting pre-C++23 features that was accepted during
meetings in year 2023.

libstdc++-v3/ChangeLog:

* include/bits/version.def (allocate_at_least): Add comment
listing papers adding values and LWG3887.
* include/bits/stl_iterator.h: Add comment for LWG3953.
* include/std/format: Add comment for LWG3892.
* include/std/type_traits: Add comment for LWG3655.

4 weeks agoaarch64: Fix ICE in aarch64_function_arg_alignment with may_alias [PR124146]
Kyrylo Tkachov [Wed, 17 Jun 2026 09:03:41 +0000 (02:03 -0700)] 
aarch64: Fix ICE in aarch64_function_arg_alignment with may_alias [PR124146]

aarch64_function_arg_alignment returns the ABI alignment of an argument.
For scalars and vectors this is the natural alignment of the type,
ignoring any user-specified alignment.  The code obtains the natural
alignment from the TYPE_MAIN_VARIANT, relying on the main variant having
no user alignment.  PR108910 showed that this does not hold for pointers,
and that case is handled explicitly.

PR124146 is another counterexample.  An attribute that affects type
identity, such as may_alias, makes a type its own TYPE_MAIN_VARIANT, so
the main variant retains the user alignment requested by the aligned
attribute.  TYPE_MAIN_VARIANT therefore does not strip the alignment and
the gcc_assert (!TYPE_USER_ALIGN (type)) fires.

In the testcase the may_alias+aligned type reaches the argument-passing
code because foo is inlined into bar and forwprop propagates the value
of that type directly into the recursive call to bar.

Fix it by ignoring user alignment explicitly: when the type still has
user alignment, use the natural alignment of its mode, exactly as the
!type path at the top of the function already does.  Behaviour is
unchanged for the existing (non-user-aligned) cases, since the natural
alignment of a scalar or vector equals its mode alignment.  This also
gives the natural alignment when a may_alias typedef lowers the
alignment of a 16-byte type, matching the AAPCS64 (and Clang).

The same applies to _BitInt, which is covered by pr124146-4.c: user
alignment is ignored so a _BitInt up to 64 bits uses a single register,
one between 65 and 128 bits uses a 16-byte two-register container, and
one wider than 128 bits is passed by reference.

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

gcc/
PR target/124146
* config/aarch64/aarch64.cc (aarch64_function_arg_alignment):
Ignore user alignment left on a type's main variant; use the
mode's natural alignment instead.

gcc/testsuite/
PR target/124146
* gcc.target/aarch64/pr124146.c: New test.
* gcc.target/aarch64/pr124146-2.c: New test.
* gcc.target/aarch64/pr124146-3.c: New test.
* gcc.target/aarch64/pr124146-4.c: New test.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
4 weeks agors6000: Add vector uncompress and unpack builtins for -mcpu=future [RFC02691]
Kishan Parmar [Tue, 7 Jul 2026 11:25:09 +0000 (16:55 +0530)] 
rs6000: Add vector uncompress and unpack builtins for -mcpu=future [RFC02691]

Add support for vector uncompress and unpack instructions
proposed in RFC02691.  These instructions may or may not be added to a future
Power processor, and the names of the builtins may change in the future.

The instructions are exposed through new builtins and intrinsics
interfaces and are enabled when compiling with -mcpu=future.

This patch adds RTL patterns for vector uncompress (nibble, byte, and
halfword) and unpack operations in altivec.md, along with the
corresponding builtin definitions in rs6000-builtins.def and overload
entries in rs6000-overload.def.

The following new builtins are provided:

vector unsigned short vec_uncompresshn (vector unsigned char,
vector unsigned int)
vector unsigned int vec_uncompresshb (vector unsigned short,
      vector unsigned short)
vector unsigned long long vec_uncompresshh (vector unsigned int,
    vector unsigned char)
vector unsigned short vec_uncompressln (vector unsigned char,
vector unsigned int)
vector unsigned int vec_uncompresslb (vector unsigned short,
      vector unsigned short)
vector unsigned long long vec_uncompresslh (vector unsigned int,
    vector unsigned char)
vector signed char vec_unpack_hsn_to_byte (vector unsigned long long)
vector signed char vec_unpack_lsn_to_byte (vector unsigned long long)
vector unsigned char vec_unpack_int4_to_bf16 (vector unsigned short,
      const int<2>)
vector unsigned char vec_unpack_int8_to_bf16 (vector unsigned short,
      const int<1>)
vector float vec_unpack_int4_to_fp32 (vector unsigned int, const int<3>)
vector float vec_unpack_int8_to_fp32 (vector unsigned int, const int<2>)

2026-06-23  Kishan Parmar  <kishan@linux.ibm.com>

gcc/ChangeLog:
* config/rs6000/altivec.md (UNSPEC_VUCMPRHN): New unspec entry.
(UNSPEC_VUCMPRLN): Likewise.
(UNSPEC_VUCMPRHB): Likewise.
(UNSPEC_VUCMPRLB): Likewise.
(UNSPEC_VUCMPRHH): Likewise.
(UNSPEC_VUCMPRLH): Likewise.
(UNSPEC_VUPKHSNTOB): Likewise.
(UNSPEC_VUPKLSNTOB): Likewise.
(UNSPEC_VUPKINT4TOBF16): Likewise.
(UNSPEC_VUPKINT8TOBF16): Likewise.
(UNSPEC_VUPKINT4TOFP32): Likewise.
(UNSPEC_VUPKINT8TOFP32): Likewise.
(vu_hl): New attribute.
(vu_lh): Likewise.
(VUPKNTOB): New int iterator.
(altivec_vupkhsntob): New define_insn.
(altivec_vupklsntob): Likewise.
(altivec_vupkint4tobf16): Likewise.
(altivec_vupkint8tobf16): Likewise.
(altivec_vupkint4tofp32): Likewise.
(altivec_vupkint8tofp32): Likewise.
(vucmpr_splat): New attribute.
(vucmpr_pcv): Likewise.
(vucmpr_uim): Likewise.
(VUCMPR_N): New int iterator.
(VUCMPR_B): Likewise.
(VUCMPR_H): Likewise.
(altivec_vucmpr<vu_hl>n): New define_expand.
(altivec_vucmpr<vu_hl>n_direct): New define_insn for vucmpr<vu_hl>n.
(altivec_vucmpr<vu_hl>b): New define_expand.
(altivec_vucmpr<vu_hl>b_direct): New define_insn for vucmpr<vu_hl>b.
(altivec_vucmpr<vu_hl>h): New define_expand.
(altivec_vucmpr<vu_hl>h_direct): New define_insn for vucmpr<vu_hl>h.
* config/rs6000/rs6000-builtins.def: Add vector uncompress and unpack
builtins under [future].
* config/rs6000/rs6000-overload.def: Add vec_uncompress* and vec_unpack*
interfaces.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/future-vucmpr-altivec.c: New test.
* gcc.target/powerpc/future-vucmpr-vsx.c: Likewise.
* gcc.target/powerpc/future-vupk.c: Likewise.

4 weeks agoMAINTAINERS: Add a script to create a new entry in the mainainers data
Richard Earnshaw [Thu, 25 Jun 2026 17:02:47 +0000 (18:02 +0100)] 
MAINTAINERS: Add a script to create a new entry in the mainainers data

This script is intended to help with the most common case of creating
a new entry in the MAINTAINERS.yml data - adding the basic data for a
new account.  It takes care of creating the entry in the canonical
location within the file and collecting the basic data.  It only adds
the write-after role, but it should be trivial to add any additional
roles if necessary following the examples elsewhere.

contrib/ChangeLog:

* add-write-after.py: New file.

4 weeks agoMAINTAINERS: scripts to generate the file from yaml data
Richard Earnshaw [Fri, 29 May 2026 12:54:41 +0000 (13:54 +0100)] 
MAINTAINERS: scripts to generate the file from yaml data

Convert the existing MAINTAINERS data to YAML and add a script to
rebuild the MAINTAINERS file from it.  Rebuild the MAINTAINERS file from
that data.

Update the testsuite to check that the MAINTAINERS file is correctly
generated from the YAML.

Remove contrib/check-MAINTAINERS.py: it's nolonger needed now that
we generate the file automatically.

ChangeLog:

* MAINTAINERS.yml: New file.
* MAINTAINERS: Regenerate from MAINTAINERS.yml.

contrib/ChangeLog:

* gen-MAINTAINERS.py: New file.
* maintainer_utils.py: New file.
* check-MAINTAINERS.py: Delete.

gcc/testsuite/ChangeLog:

* gcc.src/maintainers.exp:

4 weeks agoeditorconfig: Add rules for yaml/yml files.
Richard Earnshaw [Wed, 24 Jun 2026 12:57:40 +0000 (13:57 +0100)] 
editorconfig: Add rules for yaml/yml files.

ChangeLog:

* .editorconfig (*.yaml/.yml): Add rules.

4 weeks agocontrib/download_prerequisites: Use gettext-1.0.tar.gz
Arsen Arsenović [Mon, 6 Jul 2026 14:50:09 +0000 (16:50 +0200)] 
contrib/download_prerequisites: Use gettext-1.0.tar.gz

gettext-0.22 has some configure tests which dump cores, making it so
that building GCC with in-tree gettext triggers core collection
mechanisms like systemd-coredump and pollutes them with useless
coredumps.

This issue appears to be gone in gettext-1.0 so update to that.

We might as well use the new version anyway.

contrib/ChangeLog:

* download_prerequisites (gettext): Set gettext source file to
gettext-1.0.tar.gz.
* prerequisites.md5: Update gettext hash.
* prerequisites.sha512: Update gettext hash.

4 weeks agoor1k: Stop allowing referring to SR_F in SImode and fix cmov
Stafford Horne [Sat, 4 Jul 2026 09:51:59 +0000 (10:51 +0100)] 
or1k: Stop allowing referring to SR_F in SImode and fix cmov

We were seeing compiler errors such as:

    x.c:8:1: error: insn does not satisfy its constraints:
8 | }
  | ^
    (insn 33 28 35 2 (set (reg:SI 34 ?sr_f)
    (reg:SI 16 r17 [52])) "x.c":6:7 discrim 1 28 {*movsi_internal}
 (nil))
    during RTL pass: postreload

This was being caused by previous commit c0694f95f59 ("or1k: Fix ICE in
libgcc caused by recent validate_subreg changes") and commit 710581c80b2
("or1k: Allow SImode for condition flag register") which allow
referecing SR_F in SImode to avoid errors during if conversion.

We can completely avoid this by reverting the changes to allow
referencing SR_F in SImode and fixing the
or1k_noce_conversion_profitable_p function to allow cmov expansion even
when TARGET_CMOV is not enabled.  The *cmov split logic can take care of
lowering the *cmov instructions if l.cmov is not supported during the
later split passes.

gcc/

PR target/126081
* config/or1k/or1k.cc (or1k_hard_regno_mode_ok): Stop allowing
SImode for FLAG_REGS.
(or1k_can_change_mode_class): Stop allowing SImode for
FLAG_REGS.
(or1k_noce_conversion_profitable_p): Always check
or1k_is_cmov_insn.

gcc/testsuite/

PR target/126081
* gcc.target/or1k/pr126081.c: New test.

4 weeks agotree-optimization: Extend CDCE memset shrink-wrapping to {0, N} ranges [PR102202]
Naveen [Tue, 7 Jul 2026 08:41:44 +0000 (01:41 -0700)] 
tree-optimization: Extend CDCE memset shrink-wrapping to {0, N} ranges [PR102202]

The patch extends the CDCE shrink-wrapping support added for PR102202.

The existing transform handles memset calls whose length is known to be
in [0, 1].  It bypasses the call for length zero and specializes the
nonzero path to a constant length of one.

Extend this to exact two-value length ranges {0, N}, where N is a
nonzero integer constant.  The zero-length path is still bypassed and
the nonzero path is specialized to the constant N.  In particular, the
transform does not accept an ordinary interval [0, N] since such an
interval can contain values other than zero and N.

The range query now returns the nonzero member of either a [0, 1] range
or an exact {0, N} range.  The existing [0, 1] behavior is preserved.

gcc/ChangeLog:
PR tree-optimization/102202
* tree-call-cdce.cc: Include "value-query.h" and "value-range.h".
(len_has_boolean_range_p): Remove.
(get_len_nonzero_value): New function. Return the nonzero member of
LEN's value range when it is a boolean range [0, 1] or an exact
two-value set {0, N}.
(can_shrink_wrap_len_p): Replace len_has_boolean_range_p call with
get_len_nonzero_value. Add NONZERO_LEN output parameter and set it
to the returned nonzero value on success.
(shrink_wrap_len_call): Use it to pin the length argument on the
guarded call path instead of build_one_cst.
(shrink_wrap_conditional_dead_built_in_calls): Declare local
nonzero_len and pass it to can_shrink_wrap_len_p and forward it to
shrink_wrap_len_call.
(pass_call_cdce::execute): Pass nullptr as NONZERO_LEN to
can_shrink_wrap_len_p.

gcc/testsuite/ChangeLog:
PR tree-optimization/102202
* gcc.dg/pr102202-3.c: New test.
* gcc.dg/pr102202-4.c: New test.

Signed-off-by: Naveen <naveen.siddegowda@oss.qualcomm.com>
4 weeks agoDaily bump.
GCC Administrator [Tue, 7 Jul 2026 00:16:36 +0000 (00:16 +0000)] 
Daily bump.

4 weeks agoRanger stmt prefill should process dependencies first.
Andrew MacLeod [Tue, 30 Jun 2026 14:43:07 +0000 (10:43 -0400)] 
Ranger stmt prefill should process dependencies first.

Rangers stmt prefill is designed to prevent deep recursion through the
normal range_of_stmt/range_of_expr/Range_on_entry cycle when
dependencies have not yet been processed.  It neglects to do this for
PHI arguments and if the order is wrong, it can undo everything it is
suppose to solve.

Do a proper DFS stack simulation to process all operands properly.

PR tree-optimization/125758
gcc/
* gimple-range.cc (gimple_ranger::gimple_ranger): Create prefill stack.
(gimple_ranger::gimple_ranger): Dispose of prefill stack.
(gimple_ranger::prefill_name): Maybe push name on prefill stack.
(gimple_ranger::prefill_stmt_dependencies): Implement a DFS
stack for dependency satisfaction.
* gimple-range.h (struct prefill_frame): New.
(m_prefill_stack): New.
(prefill_name): Sadjust parameters.
(m_active_prefill): New.

4 weeks agoSplit ranger timestamp into 2 values.
Andrew MacLeod [Thu, 18 Jun 2026 16:23:42 +0000 (12:23 -0400)] 
Split ranger timestamp into 2 values.

Ranger's cache currently uses a timestamp to determine if a value is out
of date and needs recalculating.  This patch splits the timestmap into
2 timestamps:
  - one for when the value was stored last, and
  - one for when the vlaue was last calculated.
This allows us to differentiate when a value is recalculated and does not
change from one which did change the resulting value.

PR tree-optimization/125758
gcc/
* gimple-range-cache.cc (struct time_stamp): New.
(set_timestamp): Deleted.
(set_timestamp_stored): New.
(set_timestamp_calc): New.
(set_always_current): Remove a parameter.
(temporal_value): Remove.
(temporal_value_stored): New.,
(temporal_value_calc): New.
(m_timestamp): Change to vector of struct time_stamp.
(temporal_cache::temporal_cache): Adjust.
(temporal_cache::current_p): Use both timestamps.
(temporal_cache::set_always_current): 0 means always current.
(temporal_cache::always_current_p): Check for 0.
(ranger_cache::get_global_range): adjust params.
(ranger_cache::update_consumers): Set stored timestamp.
(ranger_cache::set_global_range): Use new timestamps.

4 weeks agotree-optimization/124545 - fix pr124545-2.c on ilp32 targets
Philipp Tomsich [Fri, 3 Jul 2026 18:16:38 +0000 (20:16 +0200)] 
tree-optimization/124545 - fix pr124545-2.c on ilp32 targets

The uns_carry() helper used "unsigned int" (32-bit) as the narrow type
and "unsigned long" as the wide type.
Switch to __UINT32_TYPE__ / __UINT64_TYPE__ throughout so that the
narrow-vs-wide test is target-independent.

PR tree-optimization/124545

gcc/testsuite/ChangeLog:

* gcc.dg/pr124545-2.c: Use __UINT32_TYPE__ / __UINT64_TYPE__
instead of unsigned int/long/long long so the runtime check
works on ILP32 targets.

Reported-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Tested-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
4 weeks agoFortran: degree trigonometric functions and procedure pointers [PR121366]
Harald Anlauf [Mon, 6 Jul 2026 18:50:18 +0000 (20:50 +0200)] 
Fortran: degree trigonometric functions and procedure pointers [PR121366]

While libgfortran already provides an implementation of the degree
trigonometric functions and their inverses with argument passed by value,
some situations (e.g. when used as procedure pointer target) need the
variant with Fortran calling conventions where the argument is passed by
reference.  Provide the appropriate specific wrappers.

PR fortran/121366

gcc/fortran/ChangeLog:

* intrinsic.texi: Remove documentation of GNU intrinsic extensions
(CCOSD,ZCOSD,CDCOSD) that were never implemented.
* iresolve.cc (gfc_resolve_trig): Fix resolution of degree
trigonometric functions and generate references to the proper
library functions.
(gfc_resolve_trig2): Likewise.
* trans-decl.cc (gfc_get_extern_function_decl): Ensure that isym
is set when resolving intrinsic procedures.

libgfortran/ChangeLog:

* Makefile.am: Add dependency on wrappers to degree trigonometric
functions.
* Makefile.in: Regenerate.
* gfortran.map: Add references to new wrapper functions.
* intrinsics/trigd_specific.F90: New file.

gcc/testsuite/ChangeLog:

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

4 weeks agocobol: Correct "included from" location.
James K. Lowden [Sun, 5 Jul 2026 18:32:08 +0000 (14:32 -0400)] 
cobol: Correct "included from" location.

When an error occurred in a copybook, the diagnostic reported the
location of the COPY directive incorrectly.  It now reports the
line of the directive.

The symbol table was recording paragraph/section relationships
incorrectly, which was only a problem if the last section PERFORMed.
Corrected.

Fixes PR #33 Fixes RT 3569.

gcc/cobol/ChangeLog:

* cbldiag.h (struct cbl_loc_t): Add as_first_line() function.
(location_dump): Shorten diagnostic message.
* cdf-copy.cc (copybook_elem_t::open_file): Same.
* copybook.h (class copybook_t): Remove debug message.
* lexio.cc (parse_copy_directive): Clarify comment.
(cdftext::lex_open): Set please_push_filename boolean for open_input.
(cdftext::open_input): Issue push directive where COPY appeared.
(cdftext::output_push_directive): New function.
(cdftext::process_file): Relocate PUSH/POP directives.
* lexio.h (class cdftext): Add please_push_filename and output_push_directive().
* parse.y: Improve PERFORM diagnostics.
* parse_ante.h (ast_enter_exit_section): Correct paragraph section ancestor.
* scan.l: Update gcc location for PUSH directive.
* symbols.cc (cbl_perform_tgt_t::recurses): New validation function.
* symbols.h (struct cbl_perform_tgt_t): Same.
* util.cc (cobol_filename): Clarify diagnostic message.
(gcc_location_set_impl): Remove function.
(gcc_location_set): Implement directly.
(gcc_location_dump): Add newline to output.

4 weeks agolibbacktrace: support returning discriminator field
Ian Lance Taylor [Mon, 6 Jul 2026 17:55:52 +0000 (10:55 -0700)] 
libbacktrace: support returning discriminator field

Based on patch from Andi Kleen.

* backtrace.h (backtrace_create_state): Rewrite comment to change
threaded parameter to flags.
(backtrace_full_callback, backtrace_syminfo_callback): Document
behavior change if moredata flag is set.
(struct backtrace_moredata): Define.
* backtrace-supported.h.in (BACKTRACE_SUPPORTS_MOREDATA): Define.
* internal.h (struct backtrace_state): Add moredata field.
(BACKTRACE_MOREDATA_VERSION): Define.
* state.c (backtrace_create_state): Change threaded parameter to
flags.  Set state moredata field based on flags.
* dwarf.c (struct line): Add disc field.
(struct function): Add caller_disc field.
(call_callback): New static function.
(add_line): Add disc parameter.  Change all callers.  Store disc
in new line value.
(read_line_program): Track discriminator value.
(read_line_info): Initialize disc field in final line entry.
(read_function_entry): Handle DW_AT_GNU_discriminator.
(report_inlined_functions): Add disc parameter. Change all
callers. Call call_callback rather than calling callback
directly.
(dwarf_lookup_pc): Handle inlined discriminators. Call
call_callback rather than calling callback directly.
(dwarf_fileline): Call call_callback rather than calling callback
directly.
* elf.c (elf_syminfo): Pass moredata if requested.
* macho.c (macho_syminfo): Likewise.
* pecoff.c (coff_syminfo): Likewise.
* xcoff.c (xcoff_syminfo): Likewise.
(xcoff_lookup_pc): Likewise.
* backtrace.c: #include <string.h>.
(unwind): Pass moredata if requested.
* unknown.c: #include <string.h>.
(unknown_fileline): Pass moredata if requested.
* fileline.c (backtrace_syminfo_to_full_callback): Add comment
about moredata.
* mdtest.c: New test file.
* Makefile.am (mdtest_SOURCES): Define.
(mdtest_CFLAGS, mdtest_LDFLAGS, mdtest_LDADD): Define.
(BUILDTESTS): Add mdtest.
* Makefile.in: Regenerate.

4 weeks ago[PATCH] RISC-V: Fix ext-dce-4.c test_half_sign_needed shift amount
Jim Lin [Mon, 6 Jul 2026 16:44:29 +0000 (10:44 -0600)] 
[PATCH] RISC-V: Fix ext-dce-4.c test_half_sign_needed shift amount

test_half_sign_needed is a negative test expecting a sign-extending
halfword load (lh).  With *p >> 8 on a 16-bit short only the high byte
is needed, so the compiler emits a sign-extending byte load (lb) and the
lh match fails.  Use *p >> 4 so the full halfword load is required.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/ext-dce-4.c (test_half_sign_needed): Shift
by 4 instead of 8 to keep the lh load.

4 weeks ago[PATCH] RISC-V: Skip shift-shift-7.c under -Og
Jim Lin [Mon, 6 Jul 2026 15:37:25 +0000 (09:37 -0600)] 
[PATCH] RISC-V: Skip shift-shift-7.c under -Og

At -Og the a << 1 is kept as a separate slliw instead of being folded
into the zero_extendsidi2_shifted sequence, so the "slli" regex matches
both slliw and slli and the scan-assembler-times "slli" 1 check fails.
Skip the test under -Og.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/shift-shift-7.c: Skip under -Og.

4 weeks agoMAINTAINERS: Add myself to write after approval
Nina Ranns [Mon, 6 Jul 2026 09:04:27 +0000 (10:04 +0100)] 
MAINTAINERS: Add myself to write after approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

4 weeks agoc++/reflection: check type traits preconditions [PR125901]
Marek Polacek [Fri, 26 Jun 2026 15:32:47 +0000 (11:32 -0400)] 
c++/reflection: check type traits preconditions [PR125901]

This PR laments that our meta::is_trivially_copyable_type gives the wrong
result when its argument is a reflection of an uninstantiated template,
because its TYPE_HAS_* flags haven't been properly set.  They are set in
finish_struct_1, called while instantiating the template.

This led to a much broader problem: we're not checking Preconditions in
[meta.unary.prop] and Comments in [meta.rel].  Jason pointed out to me
that check_trait_type and its KIND parameter already does this kind of
checking; our Reflection code just wasn't using it fully.  With this patch
we give an error when finish_trait_expr returns an error node.
finish_trait_expr and check_trait_type need a complain parameter.  Many
metafuncions weren't using the finish_trait_expr mechanism as they
should.  The rest of the patch is adding the extra arguments.

I found PR126073, XFAILd for now.

PR c++/125901

gcc/cp/ChangeLog:

* cp-tree.h (finish_trait_expr): Adjust declaration.
* reflect.cc (eval_constant_of): Adjust the call to
eval_is_array_type.
(eval_reflect_object): Adjust the call to eval_is_object_type.
(eval_type_trait): Emit a diagnostic when finish_trait_expr
returns error_mark_node and set *non_constant_p.  Adjust the
call to eval_type_trait.
(eval_is_array_type): Adjust the call to eval_type_trait.
(eval_is_pointer_type): Likewise.
(eval_is_member_object_pointer_type): Likewise.
(eval_is_member_function_pointer_type): Likewise.
(eval_is_enum_type): Likewise.
(eval_is_union_type): Likewise.
(eval_is_class_type): Likewise.
(eval_is_reference_type): Likewise.
(eval_is_member_pointer_type): Likewise.
(eval_is_object_type): Likewise.
(eval_is_trivially_copyable_type): Use eval_type_trait.
(eval_is_standard_layout_type): Likewise.
(eval_is_empty_type): Adjust the call to eval_type_trait.
(eval_is_polymorphic_type): Likewise.
(eval_is_abstract_type): Use eval_type_trait.
(eval_is_final_type): Adjust the call to eval_type_trait.
(eval_is_aggregate_type): Use eval_type_trait.
(eval_is_structural_type): Adjust the call to eval_type_trait.
(eval_is_bounded_array_type): Likewise.
(eval_is_constructible_type): Use eval_type_trait.
(eval_is_default_constructible_type): Likewise.
(eval_is_copy_constructible_type): Likewise.
(eval_is_move_constructible_type): Likewise.
(eval_is_assignable_type): Adjust the call to eval_type_trait.
(eval_is_copy_assignable_type): Use eval_type_trait.
(eval_is_move_assignable_type): Use eval_type_trait.
(eval_is_destructible_type): Adjust the call to eval_type_trait.
(eval_is_trivially_constructible_type): Use eval_type_trait.
(eval_is_trivially_default_constructible_type): Likewise.
(eval_is_trivially_copy_constructible_type): Likewise.
(eval_is_trivially_move_constructible_type): Likewise.
(eval_is_trivially_assignable_type): Adjust the call to
eval_type_trait.
(eval_is_trivially_copy_assignable_type): Use eval_type_trait.
(eval_is_trivially_move_assignable_type): Likewise.
(eval_is_trivially_destructible_type): Adjust the call to
eval_type_trait.
(eval_is_nothrow_constructible_type): Use eval_type_trait.
(eval_is_nothrow_default_constructible_type): Likewise.
(eval_is_nothrow_copy_constructible_type): Likewise.
(eval_is_nothrow_move_constructible_type): Likewise.
(eval_is_nothrow_assignable_type): Adjust the call to
eval_type_trait.
(eval_is_nothrow_copy_assignable_type): Use eval_type_trait.
(eval_is_nothrow_move_assignable_type): Likewise.
(eval_is_nothrow_destructible_type): Adjust the call to
eval_type_trait.
(eval_is_implicit_lifetime_type): Use eval_type_trait.
(eval_has_virtual_destructor): Likewise.
(eval_has_unique_object_representations): Likewise.
(eval_reference_constructs_from_temporary): Adjust the call to
eval_type_trait.
(eval_reference_converts_from_temporary): Likewise.
(eval_extent): Adjust the call to eval_is_bounded_array_type.
Check != boolean_true_node rather than == boolean_false_node when
checking eval_is_bounded_array_type.
(eval_is_same_type): Adjust the call to eval_type_trait.
(eval_is_base_of_type): Likewise.
(eval_is_virtual_base_of_type): Likewise.
(eval_is_convertible_type): Likewise.
(eval_is_nothrow_convertible_type): Likewise.
(eval_is_layout_compatible_type): Likewise.
(eval_is_pointer_interconvertible_base_of_type): Likewise.
(eval_is_invocable_type): Use eval_type_trait.
(eval_is_nothrow_invocable_type): Likewise.
(eval_data_member_spec): Adjust the calls to eval_is_array_type
and eval_is_object_type.  Check != boolean_true_node rather than
== boolean_false_node when checking eval_is_object_type.
(eval_extract): Adjust the call to eval_is_reference_type.
(process_metafunction): Adjust the calls to various
metafunctions.
* semantics.cc (check_trait_type): Remove a default argument.
Add a complain parameter.  If not emitting error messages, always
return false for incomplete types.
(finish_trait_expr): Add a complain parameter.  Use it.  Call
complete_type_or_maybe_complain instead of
complete_type_or_else.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/type_trait16.C: New test.
* g++.dg/reflect/type_trait17.C: New test.
* g++.dg/reflect/type_trait18.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 weeks agoc++: naming typedef and incomplete class [PR126031]
Jason Merrill [Wed, 1 Jul 2026 15:49:39 +0000 (11:49 -0400)] 
c++: naming typedef and incomplete class [PR126031]

We can't look at the bases and members of a forward-declared nested class,
and such a forward declaration can't contain problematic constructs, so
treat it as OK.

PR c++/126031
PR c++/121552

gcc/cp/ChangeLog:

* decl.cc (maybe_diagnose_non_c_class_typedef_for_linkage): Handle
incomplete type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/typedef2.C: New test.

4 weeks ago[PATCH] RISC-V: Skip zbb-min-max-05.c under -funroll-loops
Jim Lin [Mon, 6 Jul 2026 14:59:30 +0000 (08:59 -0600)] 
[PATCH] RISC-V: Skip zbb-min-max-05.c under -funroll-loops

With -funroll-loops the loop body is duplicated, emitting more than one
minu and breaking the scan-assembler-times {\mminu} 1 expectation.  Skip
the test when -funroll-loops is present, matching zbb-min-max-04.c.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zbb-min-max-05.c: Skip under -funroll-loops.

4 weeks ago[PATCH] RISC-V: Update spacemit-x60 to use rva22u64 profile
Mark Zhuang [Mon, 6 Jul 2026 14:41:11 +0000 (08:41 -0600)] 
[PATCH] RISC-V: Update spacemit-x60 to use rva22u64 profile

From: Mark Zhuang <mark.zhuang@spacemit.com>

Replace the hand-written base with rva22u64 profile shorthand,
aligning with RVA22 standard and X60 hardware capabilities.
This also adds previously unlisted extensions.

gcc/ChangeLog:

* config/riscv/riscv-cores.def (spacemit-x60): Use rva22u64
profile shorthand, add missing entries.

gcc/testsuite/
* gcc.target/riscv/mcpu-spacemit-x60.c: New test.

4 weeks agotestsuite: arm: Properly quote command line arguments
Torbjörn SVENSSON [Mon, 6 Jul 2026 10:58:02 +0000 (12:58 +0200)] 
testsuite: arm: Properly quote command line arguments

gcc/testsuite/ChangeLog:

* gcc.target/arm/tls-disable-literal-pool.c: Add quotation for
command line arguments.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
4 weeks agoMake SLP discovery more verbose
Richard Biener [Mon, 6 Jul 2026 07:26:22 +0000 (09:26 +0200)] 
Make SLP discovery more verbose

The following dumps the first root stmt when analyzing a BB reduction.

* tree-vect-slp.cc (vect_build_slp_instance): For BB reductions
note the first root stmt.

4 weeks agoamdgcn: Add vec_set*ti instructions
Andrew Stubbs [Fri, 19 Jun 2026 15:35:04 +0000 (15:35 +0000)] 
amdgcn: Add vec_set*ti instructions

The TImode vector vec_set instructions were missing, leading to an ICE
compiling testcase gcc.dg/pr78526.c (although it only shows with other patches
not yet committed).

gcc/ChangeLog:

* config/gcn/gcn-valu.md (*vec_set<mode>): Ad TImode instruction.

4 weeks agoRemove obsolete support for ADA_LONG_TYPE_SIZE
Eric Botcazou [Sat, 4 Jul 2026 08:13:13 +0000 (10:13 +0200)] 
Remove obsolete support for ADA_LONG_TYPE_SIZE

The macro was only defined for VMS and VMS is no longer supported in Ada.

gcc/
* config/vms/vms.h (ADA_LONG_TYPE_SIZE): Delete.
* doc/tm.texi.in (ADA_LONG_TYPE_SIZE): Likewise.
* doc/tm.texi: Regenerate.
* system.h (ADA_LONG_TYPE_SIZE): Poison.

gcc/ada/
* gnatlink.adb: Remove clause for System.CRTL.
(Store_File_Context): Remove clause for System.CRTL.long.
* gcc-interface/targtyps.cc (ADA_LONG_TYPE_SIZE): Delete.
(get_target_long_size): Use LONG_TYPE_SIZE.
* libgnat/i-c.ads: Remove clause for System.Parameters.
(long): Declare as derived from Long_Integer.
* libgnat/i-cstrin.ads: Add clause for System.Parameters.
* libgnat/s-crtl.ads: Remove clause for System.Parameters.
(long): Declare as subtype of Long_Integer.
* libgnat/s-parame.ads (long_bits): Delete.
* libgnat/s-parame__hpux.ads (long_bits): Likewise.
* libgnat/s-parame__vxworks.ads (long_bits): Likewise.

4 weeks agoRemove left-overs of WIDEST_HARDWARE_FP_SIZE
Eric Botcazou [Sat, 4 Jul 2026 08:03:34 +0000 (10:03 +0200)] 
Remove left-overs of WIDEST_HARDWARE_FP_SIZE

This removes the single remaining use of WIDEST_HARDWARE_FP_SIZE in GCC,
which has been anectodal for a long time, and all the associated bits.

gcc/
* config/aarch64/aarch64.h (WIDEST_HARDWARE_FP_SIZE): Delete.
* config/alpha/alpha.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/i386/i386.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/ia64/vms.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/pa/pa.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/rs6000/rs6000.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/s390/s390.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/sparc/sparc.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* config/visium/visium.h (WIDEST_HARDWARE_FP_SIZE): Likewise.
* doc/tm.texi.in (WIDEST_HARDWARE_FP_SIZE): Likewise.
* doc/tm.texi: Regenerate.
* system.h (WIDEST_HARDWARE_FP_SIZE): Poison.

gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity): Use the precision of
longest_float_type_node to compute the maximum size of FP types.

4 weeks agoRemove the path-splitting pass and deprecate -fsplit-paths [PR120892]
Kyrylo Tkachov [Tue, 30 Jun 2026 12:04:02 +0000 (14:04 +0200)] 
Remove the path-splitting pass and deprecate -fsplit-paths [PR120892]

pass_split_paths duplicates the join block of an IF-THEN-ELSE that feeds a
loop latch, splitting the two paths to the backedge.  It runs only at -O3.
In practice it interacts badly with later optimizations: it duplicates the
loop body before loads have been commoned and before if-conversion runs, so
it can block both loop unrolling (PR120892) and if-conversion of the
duplicated diamond, while its own heuristic already declines about half of
all candidate blocks, most often to avoid spoiling if-conversion.

Remove the pass and deprecate the -fsplit-paths option.  The option is kept
accepted for backward compatibility via the Ignore flag and now does nothing,
matching how other optimization options have been retired (for example
-ftree-lrs).  param_max_jump_thread_duplication_stmts is retained as it is
shared with the jump-threading passes.

Statistics from the pass on SPEC CPU 2026 (intrate + fprate, counted from the
split-paths dump):

                    candidates   splits   declined   to protect if-conversion
  -O3                  122894    62050     60844           37166
  -O3 -flto=auto        52423    21257     31166           21822

The pass splits about half of the blocks it considers and declines the rest,
most often to avoid spoiling if-conversion.  The duplication grows .text by
0.32% at -O3 and 0.24% at -O3 -flto=auto.

Andrea and Jeff indicated in PR120892 that removing -fsplit-paths may be
the way to go there.

-fsplit-paths also complicates the control-flow and defeats the
load-commoning necessary to get good if-conversion of the hot loop from
Snappy from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125557#c13 .

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

gcc/ChangeLog:

PR tree-optimization/120892
* gimple-ssa-split-paths.cc: Remove.
* passes.def (pass_split_paths): Remove.
* tree-pass.h (make_pass_split_paths): Remove.
* Makefile.in (OBJS): Remove gimple-ssa-split-paths.o.
* timevar.def (TV_SPLIT_PATHS): Remove.
* opts.cc (default_options_table): Remove the OPT_LEVELS_3_PLUS entry
for OPT_fsplit_paths.
* common.opt (fsplit-paths): Make it a deprecated no-op using Ignore.
* doc/invoke.texi (-fsplit-paths): Document as deprecated and remove it
from the option summary and the -O3 list.

gcc/testsuite/ChangeLog:

PR tree-optimization/120892
* gcc.dg/tree-ssa/split-path-1.c: Move to...
* gcc.c-torture/execute/split-path-1.c: ...here.  Adjust to a plain
compile and run test without the split-paths dump scan.
* gcc.dg/tree-ssa/split-path-2.c: Move to...
* gcc.c-torture/compile/split-path-2.c: ...here.  Adjust to a
compile-only test without the split-paths dump scan.
* gcc.dg/tree-ssa/split-path-3.c: Move to...
* gcc.c-torture/compile/split-path-3.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-4.c: Move to...
* gcc.c-torture/compile/split-path-4.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-5.c: Move to...
* gcc.c-torture/compile/split-path-5.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-6.c: Move to...
* gcc.c-torture/compile/split-path-6.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-7.c: Move to...
* gcc.c-torture/compile/split-path-7.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-8.c: Move to...
* gcc.c-torture/compile/split-path-8.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-9.c: Move to...
* gcc.c-torture/compile/split-path-9.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-10.c: Move to...
* gcc.c-torture/compile/split-path-10.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-11.c: Move to...
* gcc.c-torture/compile/split-path-11.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-12.c: Move to...
* gcc.c-torture/compile/split-path-12.c: ...here.  Likewise.
* gcc.dg/tree-ssa/split-path-13.c: Move to...
* gcc.c-torture/compile/split-path-13.c: ...here.  Likewise.
* gcc.dg/tree-ssa/pr69270.c: Move to...
* gcc.c-torture/compile/pr69270.c: ...here.  Likewise.
* g++.dg/tree-ssa/pr88797.C: Move to...
* g++.dg/torture/pr88797.C: ...here.  Adjust to a compile-only test.
* gcc.target/i386/pr106450.c: Remove -fsplit-paths from dg-options.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
4 weeks agox86: Rewrite ix86_find_max_used_stack_alignment
H.J. Lu [Tue, 7 Apr 2026 15:16:38 +0000 (23:16 +0800)] 
x86: Rewrite ix86_find_max_used_stack_alignment

Revert changes in ix86_find_max_used_stack_alignment

7b39d7b3b84 Correct x86: Call ix86_access_stack_p only for larger alignment
c8a84242e4b Update x86: Call ix86_access_stack_p only for larger alignment
f511bf93f94 x86: Call ix86_access_stack_p only for larger alignment
a7cce1afee8 x86: Call ix86_access_stack_p only with symbolic constant load
b54533a2863 x86: Update stack alignment only if stack is used
b9ea3b2ef98 x86: Properly find the maximum stack slot alignment

Rewrite ix86_find_max_used_stack_alignment based on RTL points-to info
with find_base_term and static_reg_base_value.  If RTL points-to info
isn't available,

1. Use ix86_decompose_address to check for symbolic displacement.
2. Check MEM_EXPR for incoming parameter reference and non-local reference.

Update the maximum stack slot alignment from memory alignment only if its
base may point to stack or frame pointers.

The compile times of PR target/124165 and PR target/124684 test are
unchanged.

PR target/109780
PR target/109093
PR target/123210
PR target/124098
PR target/124165
PR target/124684
PR target/124759
PR target/124789
* alias.cc (static_reg_base_value): Moved to rtl.h.
(find_base_term): Remove static.
* alias.h (find_base_term): New prototype.
* function.cc (thread_prologue_and_epilogue_insns): Call
init_alias_analysis and end_alias_analysis.
* rtl.h (static_reg_base_value): Moved from alias.cc.
* config/i386/i386.cc (stack_access_data): Removed.
(ix86_find_all_reg_uses_1): Likewise.
(ix86_find_all_reg_uses): Likewise.
(ix86_access_stack_p): Likewise.
(ix86_need_alignment_p_2): Likewise.
(ix86_need_alignment_p_1): Likewise.
(ix86_need_alignment_p): Likewise.
(ix86_update_stack_alignment_2): New function.
(ix86_update_stack_alignment_1): Likewise.
(ix86_update_stack_alignment): Rewrite.
(ix86_find_max_used_stack_alignment): If check_stack_slot is
true, call ix86_update_stack_alignment on each INSN.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: Richard Biener <rguenther@suse.de>
4 weeks agolibstdc++: Avoid '-Wtype-limits' warnings in 'libstdc++-v3/config/locale/generic...
Thomas Schwinge [Sat, 4 Jul 2026 10:06:41 +0000 (10:06 +0000)] 
libstdc++: Avoid '-Wtype-limits' warnings in 'libstdc++-v3/config/locale/generic/ctype_members.cc'

In a GCC/AIX build I ran into:

    ctype_members.cc: In member function 'virtual char std::ctype<wchar_t>::do_narrow(wchar_t, char) const':
    ctype_members.cc:212:14: error: comparison is always true due to limited range of data type [-Werror=type-limits]
      212 |     if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
          |         ~~~~~^~~~
    ctype_members.cc: In member function 'virtual const wchar_t* std::ctype<wchar_t>::do_narrow(const wchar_t*, const wchar_t*, char, char*) const':
    ctype_members.cc:226:21: error: comparison is always true due to limited range of data type [-Werror=type-limits]
      226 |           if (*__lo >= 0 && *__lo < 128)
          |               ~~~~~~^~~~
    cc1plus: all warnings being treated as errors
    make[5]: *** [Makefile:685: ctype_members.lo] Error 1
    make[5]: Target 'all' not remade because of errors.
    make[5]: Leaving directory '[...]/build-gcc/powerpc-ibm-aix7.3.1.0/libstdc++-v3/src/c++11'

That's '[...]/ctype_members.cc' ->
'[...]/source-gcc/libstdc++-v3/config/locale/generic/ctype_members.cc'.
Apply to that file the very same patch as had been applied to
'libstdc++-v3/config/locale/gnu/ctype_members.cc' in
commit 975025de350bb8cc264fef0a5f88f71abe5b3791
"libstdc++: Avoid -Wtype-limits warnings in locale/gnu/ctype_members.cc".

libstdc++-v3/
* config/locale/generic/ctype_members.cc (use_table): New function.
(ctype<wchar_t>::do_narrow): Use use_table.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
4 weeks agoi386: Enable 512-bit byte dot-product only under AVX512BW [PR126098]
liuhongt [Fri, 3 Jul 2026 13:46:32 +0000 (06:46 -0700)] 
i386: Enable 512-bit byte dot-product only under AVX512BW [PR126098]

The byte sdot_prod/udot_prod expanders used the VI1_AVX512VNNIBW
iterator, which enabled V64QI under AVX512BW || AVX512VNNI.  But VNNI
has no same-sign byte instruction (VPDPBUSD is mixed-sign, i.e. usdot),
so the same-sign byte case always emulates via vec_unpacks/vec_unpacku,
and for V64QI that widening is vpmov[sz]xbw, which needs AVX512BW.  With
-mavx512vnni alone the optab was offered but couldn't be emulated:

  (set (reg:V32HI) (sign_extend:V32HI (reg:V32QI)))

fails to match, ICEing in extract_insn during vregs.

Use the VI1_AVX512 iterator instead (V64QI under AVX512BW), matching the
sibling usdot_prod, and drop VI1_AVX512VNNIBW.  The word sdot_prod uses a
separate iterator (VI2_AVX512VNNIBW) and is left unchanged: its V32HI VNNI
path is vpdpwssd on the 16-bit inputs directly, so no widening is needed.

gcc/ChangeLog:

PR target/126098
* config/i386/sse.md (VI1_AVX512VNNIBW): Remove.
(sdot_prod<ssedvecmodelower><mode>): Use VI1_AVX512 instead of
VI1_AVX512VNNIBW so V64QI is enabled only under AVX512BW.
(udot_prod<ssedvecmodelower><mode>): Likewise.

gcc/testsuite/ChangeLog:

PR target/126098
* gcc.target/i386/pr126098.c: New test.

4 weeks agoDaily bump.
GCC Administrator [Mon, 6 Jul 2026 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

4 weeks agoaarch64: [PR126094] Update aarch64_cmtst* patterns for new simplifications.
Roger Sayle [Sun, 5 Jul 2026 20:19:17 +0000 (21:19 +0100)] 
aarch64: [PR126094] Update aarch64_cmtst* patterns for new simplifications.

The recent patch to simplify/canonicalize (not (neg (eq x y))) as
(neg (ne x y)) [when the relevant STORE_FLAG_VALUE is 1] causes
aarch64's aarch64_cmtst* patterns to fail as they were expecting
the old canonical RTL.  This patch adds the new canonical forms
to aarch64-simd.md which corrects the testsuite failure of
gcc.target/aarch64/mvn-cmeq0-1.c.

Sorry for any inconvenience.

2026-07-05  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/126094
* config/aarch64/aarch64-simd.md (aarch64_cmtst<mode><vczle><vczbe>):
Update pattern to match recent RTL simplification.
(*aarch64_cmtst<mode><vczle><vczbe>): Preserve the original.
(*aarch64_cmtst_same_<mode><vczle><vczbe>): Additional variant.

4 weeks agomatch: Fix #ifdef GIMPLE typo [PR125641]
Kael Andrew Alonzo Franco [Sun, 5 Jul 2026 02:02:25 +0000 (22:02 -0400)] 
match: Fix #ifdef GIMPLE typo [PR125641]

r17-1683-g43356828d897ad uses #ifdef GIMPLE but it should be #if GIMPLE.

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

PR tree-optimization/125641

gcc/ChangeLog:

* match.pd: Fix #ifdef GIMPLE typo.

Signed-off-by: Kael Franco <kaelfandrew@gmail.com>
4 weeks agotestsuite: Add C++ testcase for the recent PTA bug
Jakub Jelinek [Sun, 5 Jul 2026 14:47:47 +0000 (16:47 +0200)] 
testsuite: Add C++ testcase for the recent PTA bug

On Wed, Jul 01, 2026 at 09:47:46AM +0200, Eric Botcazou wrote:
> this is a regression present on mainline, 16, 15 and 14 branches introduced by
> the fix for PR tree-optimization/112653 (PTA and return).  What happens is
> that DSE incorrectly eliminates a call to __builtin_memcpy, whose destination
> is obtained from (an equivalent of) malloc and is ultimately returned from the
> function.  But this happens only when the dynamic allocation is conditional.

For us Ada illiterate, here is a C++ testcase which got fixed by this too.

2026-07-05  Jakub Jelinek  <jakub@redhat.com>

* g++.dg/opt/20260703-1.C: New test.

Reviewed-by: Richard Biener <rguenth@suse.de>
4 weeks agoObjective-C,C++: Rework metadata generation [PR124260].
Iain Sandoe [Sun, 1 Mar 2026 00:12:04 +0000 (00:12 +0000)] 
Objective-C,C++: Rework metadata generation [PR124260].

Objective-C metadata communicates the properties of a compiled module
to the runtime (for example the structure of classes).

These data are compile-time literals, and (from the perspective of the
compiler) read-only.  However, they are not compile-time constants, and
may not be placed into read-only memory - since the runtime will update
them as needed.

They must be preserved even if (at LTO-time) they might appear to be
unused - for the same reason, the runtime does use them.

Throughout the implementation these are represented by CONSTRUCTORS
and the problem reported was that these were lacking suitable indices
(which might be a numerical constant in the case of arrays, or a ref
to a structure member in the case of structure intializer).  Further
the initializers should be typed appropriately.

We also take this opportunity to identify that we are building
metdata objects by renaming the internal APIs accordingly.

While this change is relatively large, it is a repetitive one - add the
indices and type information (and to use the renamed APIs for this).

PR objc/124260

gcc/objc/ChangeLog:

* objc-act.cc (objc_build_constructor): Check sanity of arguments.
Remove special-casing for Objective-C++.
* objc-gnu-runtime-abi-01.cc (build_selector_table_decl,
gnu_runtime_abi_01_class_decl,gnu_runtime_abi_01_metaclass_decl,
gnu_runtime_abi_01_category_decl, gnu_runtime_abi_01_protocol_decl,
gnu_runtime_abi_01_string_decl,
gnu_runtime_abi_01_build_typed_selector_reference,
gnu_runtime_abi_01_get_protocol_reference,
gnu_runtime_abi_01_build_const_string_constructor,
generate_classref_translation_entry, handle_impent,
build_protocol_initializer, generate_protocol_list,
generate_v1_meth_descriptor_table, generate_protocols,
generate_dispatch_table, build_category_initializer,generate_category,
build_shared_structure_initializer, generate_ivars_list,
generate_class_structures, handle_class_ref,
build_gnu_selector_translation_table,generate_static_references,
init_def_list, init_objc_symtab, generate_objc_symtab_decl): Use
revised names for meta-data decl start/finish.  Add integer indicies
to array and field ids to aggregate constructors.
* objc-next-runtime-abi-01.cc (next_runtime_abi_01_class_decl,
next_runtime_abi_01_metaclass_decl, next_runtime_abi_01_category_decl,
next_runtime_abi_01_protocol_decl, next_runtime_abi_01_string_decl,
build_class_reference_decl, build_selector_reference_decl,
build_objc_method_call, next_runtime_abi_01_get_protocol_reference,
next_runtime_abi_01_build_const_string_constructor,
generate_v1_meth_descriptor_table, generate_v1_objc_protocol_extension,
build_v1_property_table_initializer, generate_v1_property_table,
generate_v1_protocol_list, build_v1_protocol_initializer,
generate_v1_protocols, generate_dispatch_table,
build_v1_category_initializer, generate_v1_category,
generate_objc_class_ext, build_v1_shared_structure_initializer,
generate_ivars_list, generate_v1_class_structs, init_def_list,
init_objc_symtab, generate_objc_symtab_decl,
generate_classref_translation_entry,
next_sjlj_build_try_catch_finally): Likewise.
* objc-next-runtime-abi-02.cc (create_extern_decl) Renamed to
create_extern_meta. (create_hidden_decl): Renamed to create_hidden_meta.
(create_global_decl): Renamed to create_global_meta.
(next_runtime_02_initialize, next_runtime_abi_02_class_decl,
next_runtime_abi_02_metaclass_decl, next_runtime_abi_02_category_decl,
next_runtime_abi_02_protocol_decl, next_runtime_abi_02_string_decl,
build_v2_class_reference_decl, build_selector_reference_decl,
build_v2_message_reference_decl, build_v2_protocollist_ref_decl,
objc_v2_build_ivar_ref, build_v2_superclass_ref_decl,
next_runtime_abi_02_setup_const_string_class_decl,
next_runtime_abi_02_build_const_string_constructor,
build_v2_message_ref_translation_table, build_v2_classrefs_table,
build_v2_super_classrefs_table, build_v2_address_table,
build_v2_protocol_list_translation_table,
build_v2_protocol_list_address_table, generate_v2_protocol_list,
build_v2_descriptor_table_initializer,
generate_v2_meth_descriptor_table, generate_v2_meth_type_list,
build_v2_property_table_initializer, generate_v2_property_table,
build_v2_protocol_initializer, generate_v2_protocols,
generate_v2_dispatch_table, build_v2_category_initializer,
generate_v2_category, ivar_offset_ref, build_v2_ivar_list_initializer,
generate_v2_ivars_list, build_v2_class_t_initializer,
build_v2_class_ro_t_initializer, generate_v2_class_structs,
build_v2_ivar_offset_ref_table, objc_generate_v2_next_metadata,
objc2_build_ehtype_initializer, build_ehtype,
build_v2_eh_catch_objects, next_runtime_02_eh_type):Use revised
names for meta-data decl start/finish.  Add integer indicies
to array and field ids to aggregate constructors.
* objc-runtime-shared-support.cc (build_sized_array_type): Update to
use newer APIs.
(start_var_decl): Renamed to start_meta_decl.  Updated to handle
constructors that have indices and are typed.
(finish_var_decl): Renamed to finish_meta_decl.  Updated to handle
constructors that have indices and are typed.
(build_method_list_template, build_descriptor_table_initializer,
build_dispatch_table_initializer, init_module_descriptor,
build_module_descriptor, build_ivar_list_initializer,
build_next_selector_translation_table,
generate_strings): Use revised names for meta-data decl start/finish.
Add integer indicies to array and field ids to aggregate constructors.
* objc-runtime-shared-support.h (start_var_decl): Renamed to
start_meta_decl.
(finish_var_decl): Renamed to finish_meta_decl.
(first_type_field, next_type_field): New.

gcc/objcp/ChangeLog:

* objcp-decl.h (finish_decl): Update to set the flag indicating
that the constructor is a constant init.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
4 weeks agoFortran: Fix ICE-on-invalid in trans_code.
Sandra Loosemore [Sat, 4 Jul 2026 13:58:42 +0000 (13:58 +0000)] 
Fortran: Fix ICE-on-invalid in trans_code.

gcc/fortran/ChangeLog
* trans.cc (trans_code): Do not try to set location on non-expr
tree expressions, e.g. error_mark_node.

4 weeks agoa68: avoid non-unique test names in the Algol 68 testsuite
Jose E. Marchesi [Sun, 5 Jul 2026 13:24:33 +0000 (15:24 +0200)] 
a68: avoid non-unique test names in the Algol 68 testsuite

The contrib/compare_tests script was reporting a few duplicated test
names in the Algol 68 testsuite.  These were all genuine mistakes in
the test cases.

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

* algol68/compile/module-extracts-1.a68: Fix expected regexp for
priority extract.
* algol68/compile/module-pub-mangling-7.a68: Fix expected regexp
for mangled operator name.
* algol68/compile/module-pub-mangling-9.a68: Likewise.

4 weeks agoHardcode Solaris v2 mapfile syntax with Solaris ld
Rainer Orth [Sun, 5 Jul 2026 12:59:27 +0000 (14:59 +0200)] 
Hardcode Solaris v2 mapfile syntax with Solaris ld

GCC uses two linker mapfiles for Solaris ld: clearcap.map and
libgcc-unwind.map.  Currently, both the original v1 mapfile syntax and
the new v2 one are supported, distinguished with configure checks.
However, the v2 mapfile syntax was already introduced in Solaris 11.0,
so with only Solaris 11.4 supported the checks are no longer necessary.

Besides, when doing non-bootstrap builds where the build compiler's
configured linker and the stage1 compiler differ (ld -> gld), the build
compiler was probed for mapfile syntax support, which breaks the stage1
compiler.

Now, the mapfiles are used unconditionally if the freshly built compiler
uses Solaris ld.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 with ld and gld, and x86_64-pc-linux-gnu.

2026-06-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* configure.ac (gcc_cv_ld_clearcap): Remove.
Link clearcap.map to config/sol2-clearcap.map with Solaris ld.

* configure: Regenerate.
* config.in: Likewise.
* config/sol2-clearcap.map: Remove.
* config/sol2-clearcapv2.map: Rename to sol2-clearcap.map.
* config/t-sol2 (install-clearcap-map): Install source file
directly.
* config/sol2.h (LINK_CLEARCAP_SPEC): Guard with HAVE_SOLARIS_LD.

libgcc:
* configure.ac (solaris_ld_v2_maps): Remove.
* configure: Regenerate.
* Makefile.in (solaris_ld_v2_maps): Remove.
* config/t-slibgcc-sld (libgcc-unwind.map): Remove
solaris_ld_v2_maps handling.

4 weeks agoa68: check for overflow in bits denotations
Jose E. Marchesi [Sun, 5 Jul 2026 10:25:28 +0000 (12:25 +0200)] 
a68: check for overflow in bits denotations

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

* a68-low-units.cc (a68_lower_denotation): Check for denotations
too big for bits modes.

gcc/testsuite/ChangeLog

* algol68/compile/error-bits-denotation-1.a68: New test.
* algol68/execute/and-bits-1.a68: Fix invalid bits denotations.
* algol68/execute/bits-shift-2.a68: Likewise.
* algol68/execute/bits-shift-3.a68: Likewise.
* algol68/execute/not-bits-1.a68: Likewise.
* algol68/execute/or-bits-1.a68: Likewise.

4 weeks agoa68: support for decimal radix in bits denotations
Jose E. Marchesi [Sun, 5 Jul 2026 11:00:37 +0000 (13:00 +0200)] 
a68: support for decimal radix in bits denotations

Values of mode LONGSETY bits are often used in order to convey
unsigned quantities which would require a different precision (number
of bits) if they were conveyed in values of mode LONGSETY int.  The
need to do so arises particularly in transput in and in FFI.  In these
cases, it is useful to be able to specify values in decimal.

This commit adds support for radix 10r in bits denotations,
implementing the GNU extension GNU68-2026-003-decimal-radices, and
also adds a compile-time diagnostic that complains about invalid
radices in bits denotations.

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

* ga68.vw: Add syntax for the GNU68-2026-003-decimal-radices
language extension.
* a68-parser-scanner.cc (get_next_token): Recognize decimal bits
denotations.
(get_next_token): Emit an error if an invalid radix is found in a
bits denotation.

gcc/testsuite/ChangeLog

* algol68/compile/error-radix-5.a68: New test.
* algol68/compile/error-radix-6.a68: Likewise.
* algol68/compile/error-radix-7.a68: Likewise.
* algol68/execute/bits-radix-ten-1.a68: Likewise.

4 weeks agoSH: Fix PR 67643 amendment of commit b6b9318ac9e72d6e
Oleg Endo [Sun, 5 Jul 2026 09:10:04 +0000 (18:10 +0900)] 
SH: Fix PR 67643 amendment of commit b6b9318ac9e72d6e

gcc/ChangeLog:
PR target/67643
PR target/126117
* config/sh/sh.cc (fpscr_set_from_mem): Add missing argument to
get_free_reg invocation.

4 weeks agoAdd warnings about deleted PAUSE feature to test case.
Thomas Koenig [Sun, 5 Jul 2026 08:12:34 +0000 (10:12 +0200)] 
Add warnings about deleted PAUSE feature to test case.

gcc/testsuite/ChangeLog:

PR fortran/126090
* gfortran.dg/warn_undefined_vars_6.f90: Add warnings
about deleted feature.

4 weeks agoSH: Fix PR 67643
Oleg Endo [Sun, 5 Jul 2026 07:23:26 +0000 (16:23 +0900)] 
SH: Fix PR 67643

gcc/ChangeLog:
PR target/67643
* config/sh/sh.cc (fpscr_set_from_mem): Specify a post-inc memory
operand for lds_fpscr after RA.

gcc/testsuite/ChangeLog:
PR target/67643
* gcc.target/sh/pr67643.c: New test.

4 weeks agoSH: Remove remaining LRA transition helpers.
Oleg Endo [Sat, 4 Jul 2026 08:59:12 +0000 (17:59 +0900)] 
SH: Remove remaining LRA transition helpers.

gcc/ChangeLog:
PR target/55212
* config/sh/sh-protos.h (sh_lra_p): Remove.
(sh_legitimize_reload_address): Remove.
* config/sh/sh.h (LEGITIMIZE_RELOAD_ADDRESS): Remove.
* config/sh/sh.cc (sh_legitimize_reload_address): Remove.
(prepare_move_operands, broken_move): Remove sh_lra_p uses.
* config/sh/constraints.md (Rab, Rai, Ssd): Likewise.
* config/sh/sh.md: Likewise.  Remove reload-only *addsi3 patterns.

gcc/testsuite/ChangeLog:
PR target/55212
* gcc.target/sh/pr64366.c: Remove -mlra option.
* g++.target/sh/torture/pr55212-c311.C: Likewise.
* g++.target/sh/torture/pr55212-c333.C: Likewise.
* g++.target/sh/torture/pr55212-c373.C: Likewise.
* g++.target/sh/torture/pr55212-c384.C: Likewise.
* g++.target/sh/torture/pr55212-c413.C: Likewise.

4 weeks agoSH: Add test case for PR69765
Oleg Endo [Sat, 4 Jul 2026 07:46:38 +0000 (16:46 +0900)] 
SH: Add test case for PR69765

gcc/testsuite/ChangeLog:

PR target/69765
* gcc.target/sh/pr69765.c: New test.

4 weeks agoSH: Inline emit_fpu_switch into its only caller fpscr_set_from_mem
Oleg Endo [Fri, 3 Jul 2026 16:35:12 +0000 (01:35 +0900)] 
SH: Inline emit_fpu_switch into its only caller fpscr_set_from_mem

PR target/55212
* config/sh/sh.cc (emit_fpu_switch): Delete and merge into...
(fpscr_set_from_mem): ...this.

4 weeks agoSH: Avoid FPUL for fp-constant loads
Oleg Endo [Sat, 4 Jul 2026 06:07:48 +0000 (15:07 +0900)] 
SH: Avoid FPUL for fp-constant loads

For an fp-constant loaded from the constant pool, there is only one
movsf_ie alternative with the multi-class constraint "fy".
Change the FPUL alternative to '*y' so that IRA costs it as FP_REGS.
LRA still accepts the FPUL variant when it is really needed but treats
it as more expensive, which discourages FPUL usage for regular fp-regs.

gcc/ChangeLog:

PR target/116709
* config/sh/sh.md (movsf_ie): Mark constant-pool load FPUL
alternative with '*'.

4 weeks agoSH: Fix T bit set expressions of addc and subc insns.
Oleg Endo [Fri, 3 Jul 2026 16:22:41 +0000 (01:22 +0900)] 
SH: Fix T bit set expressions of addc and subc insns.

gcc/ChangeLog:

PR target/67459
PR target/122948
* config/sh/sh.md (addc): Fix T bit set expression.
(subc): Likewise.

gcc/testsuite/ChangeLog:

PR target/67459
PR target/122948
* gcc.target/sh/pr122948.c: New test.

4 weeks agoSH: Fix PR 124778
Oleg Endo [Fri, 3 Jul 2026 12:17:52 +0000 (21:17 +0900)] 
SH: Fix PR 124778

The lower-subreg pass would bail out in decompose_multiword_subregs because of
the ordering of the insn patterns.

gcc/ChangeLog:

PR target/124778
* config/sh/sh.md (extend<mode>si2_short_mem_disp_z): Move after
'*extend<mode>si2_compact_mem_disp' patterns.

4 weeks agoDaily bump.
GCC Administrator [Sun, 5 Jul 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

4 weeks agolibgcc, Darwin: Fix missing prerequisite [PR123976].
Iain Sandoe [Sat, 4 Jul 2026 18:24:56 +0000 (19:24 +0100)] 
libgcc, Darwin: Fix missing prerequisite [PR123976].

r15-3802-gbdf41d627c13bc added a dependency on md-unwind-def.h to
unwind-dw2.h, which is included in unwind-dw2.c.  However the pre-
requisites in t-darwin-ehs were not updated.  Unfortunately, for
most normal builds (j >= 2) this gets hidden by satisfaction of
the dependency via an alterate path.

This fixes non-parallel builds.

PR libgcc/123976

libgcc/ChangeLog:

* config/t-darwin-ehs: Add md-unwind-def.h as a
pre-requisite.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
4 weeks agoFix two issues with unused/unset variable warnings.
Thomas Koenig [Sat, 4 Jul 2026 17:03:26 +0000 (19:03 +0200)] 
Fix two issues with unused/unset variable warnings.

This patch fixes an ICE and adds correct diagnostics for reading/writing
variables via namelist, plus sets error variables for STOP as used
so incorrect warnings are avoided.

gcc/fortran/ChangeLog:

PR fortran/126058
PR fortran/126090
* gfortran.h (gfc_dt): Add member nml_where.
* io.cc (match_dt_element): Set nml_where.
(gfc_resolve_dt): Mark variable in namelist to be read with
correct locus and VALUE_READ. Mark expression in write namelist as
used.
(match_io): Set nml_where for data transfer.
* resolve.cc: Mark code->expr1 as used for PAUSE, STOP and ERROR
STOP.

gcc/testsuite/ChangeLog:

PR fortran/126058
PR fortran/126090
* gfortran.dg/warn_undefined_vars_5.f90: New test.
* gfortran.dg/warn_undefined_vars_6.f90: New test.

4 weeks agoi386.cc: Add a missing override specifier
Filip Kastl [Sat, 4 Jul 2026 06:01:03 +0000 (08:01 +0200)] 
i386.cc: Add a missing override specifier

When compiling i386.cc, Clang complains that
better_epilogue_loop_than_p is not marked override.  Add the specifier.

Bootstrapped on x86_64 linux.  Committed as obvious.

gcc/ChangeLog:

* config/i386/i386.cc: Add override specifier for
better_epilogue_loop_than_p.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
4 weeks agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 19
Pan Li [Tue, 30 Jun 2026 06:25:32 +0000 (14:25 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 19

The form 19 of unsigned scalar SAT_MUL has supported from
the previous change.  Thus, add the test cases to make sure
it works well

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-20-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-20-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-20-u8-from-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 18
Pan Li [Tue, 30 Jun 2026 06:21:58 +0000 (14:21 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 18

The form 18 of unsigned scalar SAT_MUL has supported from
the previous change.  Thus, add the test cases to make sure
it works well.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-19-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-19-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-19-u8-from-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 17
Pan Li [Tue, 30 Jun 2026 06:18:31 +0000 (14:18 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 17

The form 17 of unsigned scalar SAT_MUL has supported from
the previous change.  Thus, add the test cases to make sure
it works well

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-18-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-18-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-18-u8-from-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 16
Pan Li [Tue, 30 Jun 2026 06:01:18 +0000 (14:01 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 16

The form 16 of unsigned scalar SAT_MUL has supported from
the previous change.  Thus, add the test cases to make sure
it works well.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-17-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-17-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-17-u8-from-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
4 weeks agotestsuite: Fix pr94589-5a.c
Andrew Pinski [Sat, 4 Jul 2026 02:59:19 +0000 (19:59 -0700)] 
testsuite: Fix pr94589-5a.c

I did test this testcase but I must have missed it failing somehow.
Anyways the problem is the scan-tree-dump is missing checking for u< and u>
which can show up in some cases.

Pushed as obvious after a quick test to make sure there is no failure any more.

gcc/testsuite/ChangeLog:

* gcc.dg/pr94589-5a.c: Allow for `u<` and `u>` in the scan too.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 weeks agoDaily bump.
GCC Administrator [Sat, 4 Jul 2026 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

4 weeks agotree-optimization/122569 - recognize CLZ via isolated MSB DeBruijn lookup
Philipp Tomsich [Fri, 8 May 2026 17:24:58 +0000 (19:24 +0200)] 
tree-optimization/122569 - recognize CLZ via isolated MSB DeBruijn lookup

Recognize a CLZ idiom where the OR-cascade is followed by
(value - (value >> 1)) to isolate the MSB as a power of two (2^k), then
a DeBruijn multiply-and-shift maps 2^k back to k:

  value |= value >> 1;
  ...
  value |= value >> 32;
  result = table[((value - (value >> 1)) * MAGIC) >> 58];

After the cascade value is 2^(k+1) - 1, so (value - (value >> 1)) is 2^k
and the multiply-and-shift is a CTZ-style DeBruijn lookup whose table
satisfies table[(magic << k) >> shift] == k.

Add match.pd pattern clz_msb_iso_table_index on top of the
msb_or_cascade_64 helper, so it only spells out the (s - (s >> 1))
isolation and the DeBruijn shape.  simplify_count_zeroes validates the
table with the existing CTZ checkfn (the direct-form check) but emits
IFN_CLZ; both forms store MSB positions, so the CLZ path including
zero_val pre-compensation is unchanged.

Relax the element-type check from "precision <= 32" to "integral and
precision <= 64" so tables declared as unsigned long (64-bit on LP64)
are accepted; the values are bit positions and fit any integer type.

Only a 64-bit variant is added; all known uses (Stockfish, zstd,
cpython, the PR122569 comment 3 reproducer) are 64-bit.

gcc/ChangeLog:

PR tree-optimization/122569
* match.pd (clz_msb_iso_table_index): New match pattern.
* tree-ssa-forwprop.cc (gimple_clz_msb_iso_table_index): Declare.
(simplify_count_zeroes): Recognize the new pattern; route its
table validation through the CTZ checkfn.  Relax the element
type check to accept integer types up to 64 bits.

gcc/testsuite/ChangeLog:

PR tree-optimization/122569
* gcc.dg/tree-ssa/pr122569-3.c: New test.

4 weeks agomatch.pd: factor MSB OR-cascade out of clz_table_index
Philipp Tomsich [Fri, 8 May 2026 17:22:04 +0000 (19:22 +0200)] 
match.pd: factor MSB OR-cascade out of clz_table_index

Factor the 5- and 6-stage MSB OR-cascade -- which sets every bit from 0
to the input's MSB -- into two helper match patterns msb_or_cascade_32
and msb_or_cascade_64, and rewrite the 32-bit and 64-bit clz_table_index
patterns as one-liners over them.  The helpers retain the
integral/unsigned/precision and shift-constant checks, so this is a
no-functional-change refactor.

It prepares a follow-up that recognises a CLZ idiom isolating the MSB
before the DeBruijn multiply, which reuses msb_or_cascade_64 directly.

gcc/ChangeLog:

* match.pd (msb_or_cascade_32, msb_or_cascade_64): New match
helpers.
(clz_table_index): Rewrite the 32-bit and 64-bit forms to use
the cascade helpers.

4 weeks agomatch: Simplify `(a CMP1 b) AND/IOR (a CMP2 b)` [PR126042]
Andrew Pinski [Tue, 30 Jun 2026 19:13:05 +0000 (12:13 -0700)] 
match: Simplify `(a CMP1 b) AND/IOR (a CMP2 b)` [PR126042]

This finishes up simplifications of most comparisons
outside of reassociation. Including but not limited to
many floating point comparisons.
Instead of redoing what is done in fold-cost.cc's combine_comparisons,
this reuses combine_comparisons to find the new CMP.

In the case of `-fno-trapping-math`, this allows to optimize `<=>`
which it was not before.

Changes since v1:
* v2: Fix some typos. Add a C testcase.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/106164
PR tree-optimization/126042
PR tree-optimization/94589

gcc/ChangeLog:

* fold-const.cc (combine_comparisons): Split into
2 versions. Also handle BIT_AND_EXPR and BIT_IOR_EXPR.
* fold-const.h (combine_comparisons): New declaration.
* match.pd (`(a CMP1 b) BITOP (a CMP2 b)`): New pattern.

gcc/testsuite/ChangeLog:

* g++.dg/opt/pr94589-5a.C: New test.
* gcc.dg/pr94589-5.c: Explictly enable -ftrapping-math.
* gcc.dg/pr94589-5a.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 weeks agoc++: Fix structured binding mangling during error recovery [PR126057]
Jakub Jelinek [Fri, 3 Jul 2026 18:45:07 +0000 (20:45 +0200)] 
c++: Fix structured binding mangling during error recovery [PR126057]

The following testcase ICEs during error recovery.  We try to
mangle a structured binding base variable, but because it has
been erroneous, the mangling ICEs as it can't find the corresponding
structured bindings.

Now, we already have a hack in cp_finish_decomp when things are erroneous,
we set assembler name to <decomp> so that mangling isn't done.
But we do that only for DECL_NAMESPACE_SCOPE_P bases and
block scope static structured bindings can be mangled too,
and during instantiation, if tsubst_decomp_names fails, we don't
call cp_finish_decomp at all, so in that case we need to also
avoid the mangling of the structured binding base.

2026-07-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/126057
* decl.cc (cp_finish_decomp): Set assembler name to
<decomp> during error recovery whenever TREE_STATIC
rather than just DECL_NAMESPACE_SCOPE_P.
* pt.cc (tsubst_stmt): If tsubst_decomp_names fails,
set assembler name to <decomp>.

* g++.dg/cpp2a/decomp11.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 weeks agoc++: Implement C++29 P2953R5 - Adding restrictions to defaulted assignment operator...
Jakub Jelinek [Fri, 3 Jul 2026 18:43:22 +0000 (20:43 +0200)] 
c++: Implement C++29 P2953R5 - Adding restrictions to defaulted assignment operator functions [PR125826]

The following patch attempts to implement the C++29 P2953R5
Adding restrictions to defaulted assignment operator functions
paper.
The paper seems to be misnamed to me because it changes the validity
of defaulted constructors as well in some cases.

What the patch does is that it calls maybe_delete_defaulted_fn
also for the FUNCTION_RVALUE_QUALIFIED case for C++29, and then in
maybe_delete_defaulted_fn for C++29 errors rather than making the
function deleted in most cases, with the exception of
[dcl.fct.def.default]/(2.5) case which ought to be still deleted
rather than ill-formed (but only if that is the sole change that
is not on the whitelist of possible differences).

I've tried to include all the tests I found in the paper (referenced or
directly in it) with the exception of the https://gcc.gnu.org/PR86646
case, added some further ones and tweaked anything in the existing
test that behaves differently for -std=c++29 with the patch.

2026-07-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/125826
* method.cc: Implement C++29 P2953R5 - Adding restrictions to
defaulted assignment operator functions.
(maybe_delete_defaulted_fn): For C++29, error instead of
deleting always, with the exception of F1 having parmtype
const C & and F2 having implicit_parmtype C & and no other
non-permitted changes.  Move checks whether defaulted fn
should be deleted or ill-formed at all from defaulted_late_check
to this function.  Also error for C++29 if
FUNCTION_RVALUE_QUALIFIED.
(defaulted_late_check): Call maybe_delete_defaulted_fn
unconditionally.

* g++.dg/cpp0x/defaulted51.C: Adjust expected diagnostics
for C++29.
* g++.dg/cpp0x/defaulted55.C: Likewise.
* g++.dg/cpp0x/defaulted56.C: Likewise.
* g++.dg/cpp0x/defaulted57.C: Likewise.
* g++.dg/cpp0x/defaulted63.C: Likewise.
* g++.dg/cpp0x/defaulted64.C: Likewise.
* g++.dg/cpp0x/defaulted65.C: Likewise.
* g++.dg/cpp0x/defaulted66.C: Likewise.
* g++.dg/cpp0x/defaulted67.C: Likewise.
* g++.dg/cpp0x/defaulted68.C: Likewise.
* g++.dg/cpp1y/defaulted2.C: Likewise.
* g++.dg/cpp29/defaulted1.C: New test.
* g++.dg/cpp29/defaulted2.C: New test.
* g++.dg/cpp29/defaulted3.C: New test.
* g++.dg/cpp29/defaulted4.C: New test.
* g++.dg/cpp29/defaulted5.C: New test.
* g++.dg/cpp29/defaulted6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
4 weeks agoc++: Fix up ICEs with some metafns with non-dependent args in templates [PR126036]
Jakub Jelinek [Fri, 3 Jul 2026 18:41:45 +0000 (20:41 +0200)] 
c++: Fix up ICEs with some metafns with non-dependent args in templates [PR126036]

The following testcase ICEs, because potential_constant_expression_1 handles
some forms of CAST_EXPR, but cxx_eval_constant_expression doesn't.
Normally, if we have e.g. a non-dependent compound literal in a template,
finish_compound_literal will create a CAST_EXPR, but
fold_non_dependent_expr_template -> instantiate_non_dependent_expr_internal
will fold that away, so constexpr.cc evaluation doesn't see it.
reflect.cc calls finish_compound_literal in 3 spots, one is to create
std::array <type, 0> {}, another one is when creating the
std::meta::exception object to throw and the last one when creating
std::vector <std::meta::info> object to return from various metafns.
If that is done with processing_template_decl, finish_compound_literal
will again return a CAST_EXPR, but unlike the usual case it is during
constant evaluation and so instantiate_non_dependent_expr_internal
will not be invoked on it to clean that up.

Now, in the get_meta_exception_object case, we already have
  /* Don't throw in a template.  */
  if (processing_template_decl)
    {
      *non_constant_p = true;
      return NULL_TREE;
    }
This patch uses the same thing (i.e. avoid folding even non-dependent
metafn calls that would need finish_compound_literal during
processing_template_decl) to fix this.
I think in both cases it is fine to defer the constant evaluation,
the return type from those metafns is not dependent (std::meta::info
in the reflect_constant_array case, std::vector <std::meta::info>
otherwise).

2026-07-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/126036
* reflect.cc (get_range_elts): Avoid calling finish_compound_literal
when processing_template_decl, instead set *non_constant_p and
return NULL_TREE.
(process_metafunction): Likewise.

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

Reviewed-by: Jason Merrill <jason@redhat.com>
4 weeks agoAVR: Adding +/-1 to a lower reg doesn't need a scratch.
Georg-Johann Lay [Fri, 3 Jul 2026 15:30:04 +0000 (17:30 +0200)] 
AVR: Adding +/-1 to a lower reg doesn't need a scratch.

Adding +/-1 to a lower register can be performed by sequences like
   sec
   adc r14, __zero_reg__
   adc r15, __zero_reg__
resp.
   sec
   sbc r14, __zero_reg__
   sbc r15, __zero_reg__
that don't need a scratch reg.  The code size is unchanged but
the register pressure goes down.

gcc/
* config/avr/avr.cc (avr_out_plus_1): Handle +/-1 on the
lower regs without needing a scratch.
* config/avr/avr.md (add<mode>3_clobber, *add<mode>3_clobber)
(add<mode>3, *add<mode>3, addpsi3, *addpsi3): Add constraint
alternative "Y01 Ym1" for +/-1 without scratch.

4 weeks agolibstdc++: fix allocate_at_least test for small alignments [PR126072]
Nathan Myers [Thu, 2 Jul 2026 01:00:04 +0000 (21:00 -0400)] 
libstdc++: fix allocate_at_least test for small alignments [PR126072]

A test for P0401 allocate_at_least fails on target cris-elf,
which has a default allocator with alignment 4. This patch
adjusts tests to accommodate alignments down to 1, and removes
assumptions about short int.

Tested on x86 -m64 and -m32. Need assistance for cris-elf.

libstdc++-v3/Changelog:
PR libstdc++/126072
* testsuite/20_util/allocator/allocate_at_least.cc: Fix.