]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 days agoImprove fold_plusminus_mult_expr for 64bit and larger types
Richard Biener [Mon, 15 Jun 2026 09:29:08 +0000 (11:29 +0200)] 
Improve fold_plusminus_mult_expr for 64bit and larger types

The following enhances fold_plusminus_mult_expr to catch
a * -4U + b * 4 and factor it as (a * -1u + b) * 4.  This
does not work currently because we're using HOST_WIDE_INT
arithmetic.  Switch that to wide_int, which makes the
folding apply more consistently.

For gcc.dg/loop-versioning-13.c the heuristics in
gimple-loop-versioning.cc get confused as they fail to
truncate some computations.  I did not inverstigate further.

* fold-const.cc (fold_plusminus_mult_expr): Use
wide_int for the case of two INTEGER_CST multiplicands.

* gcc.dg/loop-versioning-13.c: XFAIL one transfor for ilp32.
* gcc.dg/pr109393.c: Remove XFAIL for ilp32.

3 days agoaarch64: Fix wrong code for high-64-zero Advanced SIMD constants [PR125794]
Kyrylo Tkachov [Tue, 16 Jun 2026 07:58:28 +0000 (00:58 -0700)] 
aarch64: Fix wrong code for high-64-zero Advanced SIMD constants [PR125794]

r17-1491-gf152cf1734f808 (PR113926) taught aarch64_simd_valid_imm to
materialize a 128-bit Advanced SIMD MOV constant whose high 64 bits are
zero with a 64-bit MOVI/FMOV, which zeroes the upper half of the
register.  It records this with simd_immediate_info::width == 64
(output_width).

However, when the low 64 bits are not themselves a valid Advanced SIMD
(MOVI/MVNI/FMOV) immediate, the function fell through to the SVE
immediate forms (aarch64_sve_valid_immediate).  Those use a replicating
"mov zN.<T>, #imm", which sets the whole vector, including the high 64
bits that were required to be zero, to the repeated low-64-bit value.
For e.g. the V4SI constant { 0, 1, 0, 0 } this emitted

mov z31.d, #4294967296 // 0x100000000, i.e. { 0, 1, 0, 1 }

instead of the intended { 0, 1, 0, 0 }, producing wrong code.

Fix it by not falling through to the SVE forms when output_width is set:
such a constant must be formed by a 64-bit Advanced SIMD MOVI/FMOV
(handled by the Advanced SIMD and floating-point paths just above) or
not at all, in which case the caller materializes it some other way
(e.g. a literal-pool load), which is the pre-r17-1491 behavior for these
constants.

The PR113926 optimization is unaffected: it only applies when the
Advanced SIMD or floating-point path accepts the low 64 bits, and those
still return true before the new check.

Bootstrapped and regression-tested on aarch64-linux-gnu.
Pushing to trunk.

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

PR target/125794
* config/aarch64/aarch64.cc (aarch64_simd_valid_imm): Do not fall
through to the replicating SVE immediate forms for a 128-bit
Advanced SIMD constant whose high 64 bits are zero (output_width
!= 0).

gcc/testsuite/ChangeLog:

PR target/125794
* gcc.target/aarch64/sve/pr125794.c: New test.

3 days agoa68: Avoid redirect for web link to Jargon File
Gerald Pfeifer [Tue, 16 Jun 2026 07:36:57 +0000 (09:36 +0200)] 
a68: Avoid redirect for web link to Jargon File

gcc/algol68:
* README: Avoid redirect for web link to Algol 68 Jargon File.
* ga68-coding-guidelines.texi (Top): Ditto.

3 days agomatch.pd: Recognize integer spaceship operator patterns
Avinash Jayakar [Wed, 10 Jun 2026 07:16:50 +0000 (12:46 +0530)] 
match.pd: Recognize integer spaceship operator patterns

There are certain patterns that are not recognized by the method
optimize_spaceship. For example,
  a == b ? 0 : (a > b) : 1 : -1;
is rightly recognized as spaceship operator. But
  a <= b ? -(a < b) : 1 or
  a >= b ? (a > b) : -1
is not being currently recognized.

This patch recognizes such patterns and chooses to emit the spaceship
optab if target supports it, which improves code-generation for such
targets.

2026-06-16  Avinash Jayakar  <avinashd@linux.ibm.com>

gcc/ChangeLog:
PR tree-optimization/59429
* match.pd: New match patterns to recognize spaceship variants.
* tree-ssa-math-opts.cc (gimple_spaceship): Match function declaration.
(match_spaceship): New function to recognize spaceship given phi node.
(math_opts_dom_walker::after_dom_children): Add match_spaceship check.

gcc/testsuite/ChangeLog:
PR tree-optimization/59429
* lib/target-supports.exp (check_effective_target_spaceship): Add new
proc for spaceship optab. x86, aarch64 and s390 included.
* gcc.dg/spaceship_int_variants.c: New test.
* gcc.dg/spaceship_uint_variants.c: New test.
* gcc.dg/spaceship_mixed_variants.c: New test.

3 days agox86: Replace gen_rtx_SUBREG with gen_lowpart
H.J. Lu [Mon, 15 Jun 2026 22:51:29 +0000 (06:51 +0800)] 
x86: Replace gen_rtx_SUBREG with gen_lowpart

Replace gen_rtx_SUBREG with gen_lowpart when generating E_HImode RTX on
destination of

(subreg:V2QI (reg:HI 111 [ vect__6.14_46 ]) 0)

with CONST_INT source.

gcc/

PR target/125614
* config/i386/i386-features.cc (replace_vector_const): Replace
gen_rtx_SUBREG with gen_lowpart.

gcc/testsuite/

PR target/125614
* gcc.target/i386/pr125614.c: New file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 days agoRISC-V: Adjust testcase asm check for vx-[5|6]-i[8|16].c
Zhongyao Chen [Fri, 12 Jun 2026 03:59:56 +0000 (11:59 +0800)] 
RISC-V: Adjust testcase asm check for vx-[5|6]-i[8|16].c

After commit 9f8409f2e2c, SLP discovery can retry swapped operands for
commutative parents before falling back to an external scalar.
These tests can be vectorized again, so update asm check.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Expect vadd.vx,
vmul.vx, vsadd.vx and vssub.vx.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Likewise.

Signed-off-by: Zhongyao Chen <chen.zhongyao@zte.com.cn>
3 days agoDaily bump.
GCC Administrator [Tue, 16 Jun 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

3 days agolibstdc++: Switch link to www.opengroup.org to https
Gerald Pfeifer [Mon, 15 Jun 2026 20:59:18 +0000 (22:59 +0200)] 
libstdc++: Switch link to www.opengroup.org to https

libstdc++-v3:
* doc/xml/manual/using_exceptions.xml: Switch link to
www.opengroup.org to https.
* doc/html/manual/using_exceptions.html: Regenerate.

3 days agoi386: Tweak cost of SSE fabs/fneg in ix86_insn_cost.
Roger Sayle [Mon, 15 Jun 2026 19:09:55 +0000 (20:09 +0100)] 
i386: Tweak cost of SSE fabs/fneg in ix86_insn_cost.

This patch fixes a poor interaction between the splitters for SSE
floating point abs/neg in the i386 backend, and the late-combine pass.
Before reload, these patterns exist as a PARALLEL containing the USE
of a value (pseudo) holding the sign-bit.  Currently late-combine
propagates this sign-bit mask from the constant pool, changing the
USE of a REG to the USE of a MEM.  This unCSE is reasonable if this
MEM is used only once, but less than optimal if this MEM is accessed
many times.

The problem is that this USE doesn't currently have a cost in
ix86_insn_cost, so propagating this load from memory into the USE
makes if free (to combine's profitable replacement calculation).
This patch improve things by providing a nominal cost for USEs of
MEM.

As an example, consider the following function:

float x, y, z;
void foo()
{
  x = -x;
  y = -y;
  z = -z;
}

Currently with -O2 GCC generates three loads from the constant pool:

        movss   x(%rip), %xmm0
        xorps   .LC0(%rip), %xmm0
        movss   %xmm0, x(%rip)
        movss   y(%rip), %xmm0
        xorps   .LC0(%rip), %xmm0
        movss   %xmm0, y(%rip)
        movss   z(%rip), %xmm0
        xorps   .LC0(%rip), %xmm0
        movss   %xmm0, z(%rip)
        ret

With the patch below, this load remains CSEd.

        movss   x(%rip), %xmm0
        movss   .LC0(%rip), %xmm1
        xorps   %xmm1, %xmm0
        movss   %xmm0, x(%rip)
        movss   y(%rip), %xmm0
        xorps   %xmm1, %xmm0
        movss   %xmm0, y(%rip)
        movss   z(%rip), %xmm0
        xorps   %xmm1, %xmm0
        movss   %xmm0, z(%rip)
        ret

Note this is one more instruction, but code size is smaller and
the total cost (as calculated by the i386 backend) is lower.
For a single neg/abs the memory address is still propagated.

2026-06-15  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386.cc (ix86_insn_cost): Add a suitable penalty
for USE of a MEM in a PARALLEL (for *<absneg>[sd]f2_1 splitter).

gcc/testsuite/ChangeLog
* gcc.target/i386/fabsneg-2.c: New test case.

3 days agoaarch64: Fix early-ra wrong code with full-width FPR color groups [PR125795]
Kyrylo Tkachov [Mon, 15 Jun 2026 11:53:34 +0000 (04:53 -0700)] 
aarch64: Fix early-ra wrong code with full-width FPR color groups [PR125795]

early_ra::allocate_colors marks the FPRs occupied by a color with

  m_allocated_fprs |= ((1U << color->group->size) - 1) << best;

When a color group spans the whole register file (size == 32), as can
happen for a heavily unrolled, vectorized loop, "1U << 32" is undefined
and evaluates to 1 on AArch64 hosts, so the expression sets no bits at all.
The 32 FPRs of the group are therefore not recorded as allocated.
Subsequent colors (and broaden_colors) then reuse those registers, which
breaks the invariant that distinct colors receive disjoint FPRs.

In PR125795 this let the loop-invariant TBL permute index, which is live
across the whole loop, share v28 with the LD2 tuple destinations, so the
index was clobbered mid-loop and the loop produced wrong results.

Fix this by using a 64-bit shift base: unsigned long long is at least
64 bits on every host, so "1ULL << 32" is well-defined.
best + size <= 32 is guaranteed by the candidate search, which the patch
also asserts, so the result still fits in the 32-bit m_allocated_fprs
When the full-width group can no longer be hidden, allocate_colors correctly
fails to find a register for the other color and the region is left to the
real register allocator, matching -mearly-ra=none.

Bootstrapped and tested on aarch64-none-linux-gnu.
Pushing to trunk and later to the branches after testing.

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

PR target/125795
* config/aarch64/aarch64-early-ra.cc (early_ra::allocate_colors):
Compute the allocated-FPR mask as
((1ULL << color->group->size) - 1) << best.

gcc/testsuite/ChangeLog:

PR target/125795
* gcc.target/aarch64/pr125795.c: New test.

3 days agoa68: provide more detail in multiple declaration diagnostics
Jose E. Marchesi [Mon, 15 Jun 2026 14:36:32 +0000 (16:36 +0200)] 
a68: provide more detail in multiple declaration diagnostics

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

* a68-parser-taxes.cc (attr_descr): New function.
(already_declared): Use attr_descr for diagnostic.
(already_declared_hidden): Likewise.

3 days agoa68: handle duplicated modes in module imports
Jose E. Marchesi [Mon, 15 Jun 2026 14:02:57 +0000 (16:02 +0200)] 
a68: handle duplicated modes in module imports

In principle all the modes emitted by the module exporter are
deduplicated.  However, in certain cases in which the same unions
result from unraveling, duplicates may occur.

This patch makes a68_open_packet to deduplicate duplicated modes from
the same moif.

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

* a68-imports.cc (INCLUDE_VECTOR): Define.
(a68_open_packet): Deduplicate within-moif modes while importing.

gcc/testsuite/ChangeLog

* algol68/execute/modules/module26.a68: New file.
* algol68/execute/modules/program-26.a68: New test.

3 days ago[PATCH] match: For nonnegative X and Y, relax condition on X % Y < Y to true [PR125737]
Kael Andrew Franco [Mon, 15 Jun 2026 17:18:32 +0000 (11:18 -0600)] 
[PATCH] match: For nonnegative X and Y, relax condition on X % Y < Y to true [PR125737]

From ae75421fd6c7d50e5b1e9aafea2ae3cbcd4ebc1c Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <kaelfandrew@gmail.com>
Date: Sun, 14 Jun 2026 06:28:01 -0400
Subject: [PATCH] match: For nonnegative X and Y, relax condition on X % Y < Y to true [PR125737]

tree_expr_nonnegative_p covers TYPE_UNSIGNED (type) or when X and Y are known to be nonnegative.

Bootstrapped and tested on x86_64-pc-linux-gnu

PR tree-optimization/125737

gcc/ChangeLog:

PR tree-optimization/125737
* match.pd: Use tree_expr_nonnegative_p for X % Y < Y to true.

gcc/testsuite/ChangeLog:

PR tree-optimization/125737
* gcc.dg/pr125737.c: New test.

3 days ago[PATCH] match: For nonnegative X, relax condition on X < (typeof X)(X != 0) to false...
Kael Andrew Franco [Mon, 15 Jun 2026 17:13:18 +0000 (11:13 -0600)] 
[PATCH] match: For nonnegative X, relax condition on X < (typeof X)(X != 0) to false [PR125756]

From 0d094722ecdb86aa8373134a36392c60e6bb2b69 Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <kaelfandrew@gmail.com>
Date: Sat, 13 Jun 2026 08:56:34 -0400
Subject: [PATCH] match: For nonnegative X, relax condition on X < (typeof X)(X != 0) to false [PR125756]

tree_expr_nonnegative_p covers both TYPE_UNSIGNED (type) or when X is known to be nonnegative.

Bootstrapped and tested on x86_64-pc-linux-gnu

PR tree-optimization/125756

gcc/ChangeLog:

* match.pd: Use tree_expr_nonnegative_p for X < (typeof X)(X != 0) to false.

gcc/testsuite/ChangeLog:

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

3 days agophiopt: reorganize factoring/cselim-limited for phiopt
Andrew Pinski [Fri, 12 Jun 2026 18:40:35 +0000 (11:40 -0700)] 
phiopt: reorganize factoring/cselim-limited for phiopt

This is in preparation for adding factoring out loads
for phiopt were we want to loop over all 3 factoring
cases if one of them made a change so that a load elimination
might allow for a store elimination.

This moves the cs-elim limited loop into the factoring out
operation into the same loop.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (factor_out_all): New function.
(pass_phiopt::execute): Call factor_out_all isntead
of factor_out_conditional_operation and
cond_if_else_store_replacement_limited.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 days agostore_integral_bit_field: Graceful fallback when SUBREG narrowing fails [PR123754]
Konstantinos Eleftheriou [Fri, 22 May 2026 13:09:49 +0000 (15:09 +0200)] 
store_integral_bit_field: Graceful fallback when SUBREG narrowing fails [PR123754]

The multi-word narrowing path in store_integral_bit_field uses
simplify_gen_subreg followed by gcc_assert (op0).  The symmetric path
in extract_integral_bit_field was switched to force_subreg, but the
store side was deliberately left on simplify_gen_subreg because op0
is an lvalue.  When the subreg simplification fails (e.g. a vector
op0 punned through an int mode whose word-aligned subregs are rejected
by validate_subreg, as happens for V8SI on -mbig-endian aarch64),
the assert fires.

The avoid-store-forwarding pass (-favoid-store-forwarding) triggers
this: it routes such a vector op0 through store_integral_bit_field.

Replace the assert with a graceful fallback to store_split_bit_field,
mirroring the cross-word branch immediately above.  No change for
inputs where the narrowing succeeds.

Tested on AArch64, x86-64 and PowerPC BE.

PR rtl-optimization/123754

gcc/ChangeLog:

* expmed.cc (store_integral_bit_field): When the SUBREG
narrowing fails, defer to store_split_bit_field instead of
asserting.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr123754.c: New test.
* gcc.target/aarch64/avoid-store-forwarding-be-2.c: New test.

3 days agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 12
Pan Li [Thu, 4 Jun 2026 14:47:49 +0000 (22:47 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 12

The form 12 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-13-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-13-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-13-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-13-u8.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-13-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-13-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-13-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-13-u8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
3 days agoRISC-V: Run smart multilib match even when generic matcher picked a dir
Jim Tsung-Chun Lin [Wed, 3 Jun 2026 01:03:10 +0000 (09:03 +0800)] 
RISC-V: Run smart multilib match even when generic matcher picked a dir

The generic textual matcher in gcc.cc:set_multilib_dir does not
understand RISC-V arch supersetting and treats MULTILIB_DEFAULTS
entries as if they were on the command line via default_arg().  When
the user passes a -march= that is a superset of one of MULTILIB_OPTIONS'
arches but does not textually match, default_arg can rescue the wrong
entry and pick a multilib that is not the closest match.

riscv_compute_multilib used to early-return whenever multilib_dir was
already set, accepting that incorrect generic pick.  Drop the early
return and run the match-score-based selection unconditionally.

There is no need to fall back to the generic-matched multilib_dir
after the smart matcher runs: the default "." multilib is parsed into
multilib_infos with the compiler's default arch/abi, so the smart
matcher handles every case the generic matcher can reach.  If it
still returns NULL the request is genuinely incompatible with all
configured multilibs and riscv_multi_lib_check fires the proper
"Cannot find suitable multilib" diagnostic instead of silently
linking against incompatible default-arch libraries.

Reproduce with:

./configure --enable-multilib --with-abi=lp64d --with-arch=rv64gc \
  --with-multilib-generator="rv64gc-lp64f--;rv64g_zcmp_zcmt-lp64f--"

With the pre-fix driver, "-march=rv64g_zba_zcmp_zcmt -mabi=lp64f"
selects the rv64gc multilib (textual default rescue); after the fix
the smart matcher correctly picks the rv64g_zcmp_zcmt multilib.

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc (riscv_select_multilib):
Don't set riscv_no_matched_multi_lib here; let the caller own
the flag.
(riscv_compute_multilib): Drop the early return that accepted
the generic-matched multilib_dir; always run the smart matcher
and set riscv_no_matched_multi_lib when it finds no candidate.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/multilib.exp: New test.

3 days agotoplev: Ask for 128MB stack when compiled with ASAN [PR124206]
Filip Kastl [Mon, 15 Jun 2026 12:20:58 +0000 (14:20 +0200)] 
toplev: Ask for 128MB stack when compiled with ASAN [PR124206]

64MB stack is not enough for running
gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c with an
ASAN-instrumented GCC.  Ask for more stack if GCC was compiled with ASAN
instrumentation.

PR sanitizer/124206

gcc/ChangeLog:

* gcc.cc (driver::global_initializations): Ask for 128MB stack
instead of just 64MB when __SANITIZE_ADDRESS__ is defined.
* toplev.cc (toplev::main): Ditto.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
3 days agolibgcc: Fix _mcount on 32-bit Solaris/x86 [PR38239]
Rainer Orth [Mon, 15 Jun 2026 12:18:59 +0000 (14:18 +0200)] 
libgcc: Fix _mcount on 32-bit Solaris/x86 [PR38239]

Profiling on 32-bit Solaris/x86 has been broken since

Save call-clobbered registers in _mcount on 32-bit Solaris/x86 (PR target/38239)
https://gcc.gnu.org/pipermail/gcc-patches/2016-March/444175.html

This was only recently noticed when setting up a Solaris/i386 binutils
buildbot.

Since internal_mcount is a regular function on Solaris, the selfpc and
frompcindex args need to pushed to the stack.  Besides, the patch fixes
a couple of warnings in gmon.c

Bootstrapped withoug regressions on i386-pc-solaris2.11.  With this
patch, the binutils gprof tests PASS.

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

libgcc:
PR target/38239
* config/sol2/gmon.c [__i386__] (_mcount): Pass selfpc, frompc to
internal_mcount.
(internal_mcount): Remove already_setup.
Remove obsolete comment.
(moncontrol): Disable profil(2) deprecation warning.

3 days agotestsuite: Skip gcc.dg/lto/toplevel-extended-asm-1 etc. on 64-bit Solaris/SPARC
Rainer Orth [Mon, 15 Jun 2026 12:16:37 +0000 (14:16 +0200)] 
testsuite: Skip gcc.dg/lto/toplevel-extended-asm-1 etc. on 64-bit Solaris/SPARC

Two LTO tests FAIL on 64-bit Solaris/SPARC:

FAIL: gcc.dg/lto/toplevel-extended-asm-1 c_lto_toplevel-extended-asm-1_0.o-c_lto_toplevel-extended-asm-1_1.o link, -O2 -flto -flto-partition=1to1 -no-pie
FAIL: gcc.dg/lto/toplevel-simple-asm-1 c_lto_toplevel-simple-asm-1_0.o-c_lto_toplevel-simple-asm-1_1.o link, -O2 -flto -flto-toplevel-asm-heuristics -flto-partition=1to1 -no-pie
FAIL: gcc.dg/lto/toplevel-simple-asm-1 c_lto_toplevel-simple-asm-1_0.o-c_lto_toplevel-simple-asm-1_1.o link, -O2 -flto -flto-toplevel-asm-heuristics -flto-partition=cache -no-pie
FAIL: gcc.dg/lto/toplevel-simple-asm-1 c_lto_toplevel-simple-asm-1_0.o-c_lto_toplevel-simple-asm-1_1.o link, -O2 -flto -flto-toplevel-asm-heuristics -flto-partition=max -no-pie

They always fail to link like

ld: fatal: relocation error: R_SPARC_32: file c_lto_toplevel-extended-asm-1_1.o: symbol .text (section): value 0x100001340 does not fit

The same error has been present with gld all along, but was only
recently introduced in Solaris ld as discussed in binutils PR ld/25802.
It doesn't occur on Linux/sparc64 which uses a different text start
address.

Tested on sparcv9-sun-solaris2.11, sparc64-unknown-linux-gnu, and
x86_64-pc-linux-gnu.

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

gcc/testsuite:
* gcc.dg/lto/toplevel-extended-asm-1_0.c: Skip on 64-bit
Solaris/SPARC.
* gcc.dg/lto/toplevel-simple-asm-1_0.c: Likewise.

3 days agotestsuite: Fix multiply scan regex in mult-negate-zeroone-1.C
Kyrylo Tkachov [Mon, 15 Jun 2026 00:00:00 +0000 (00:00 +0000)] 
testsuite: Fix multiply scan regex in mult-negate-zeroone-1.C

Fix the escaping in the scan in hte testscase.
Applying as obvious after testing on x86-linux

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

PR tree-optimization/125750
* g++.dg/tree-ssa/mult-negate-zeroone-1.C: Fix escaping.

3 days agoFix VEC_COND_EXPR matching with inverted compare
Richard Biener [Mon, 15 Jun 2026 08:40:10 +0000 (10:40 +0200)] 
Fix VEC_COND_EXPR matching with inverted compare

The following fixes detecting of VEC_COND_EXPR <cmp, {0,..}, {-1,...}>
which we recognize in ovce_extract_ops by inverting 'cmp'.  But
after checking that the false value is {-1,...} we then continue
verifying it is also {0,...} which it of course is not.  Fixed
by checking the true value in that case.

* tree-ssa-reassoc.cc (ovce_extract_ops): Fixup
false value matching for the inverted comparison case.

3 days agotree-optimization/125786 - do not rewrite stmts in reassoc
Richard Biener [Mon, 15 Jun 2026 08:37:29 +0000 (10:37 +0200)] 
tree-optimization/125786 - do not rewrite stmts in reassoc

We may not simply rewrite def stmts of associative operands as
they might have multiple uses.  The following appropriately
creates a new stmt instead.

PR tree-optimization/125786
* tree-ssa-reassoc.cc (optimize_vec_cond_expr): Create a new
stmt instead of rewriting an existing possibly multi-use one.

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

4 days agoAVR: Overhaul __builtin_avr_delay_cycles code generation.
Georg-Johann Lay [Mon, 15 Jun 2026 08:51:23 +0000 (10:51 +0200)] 
AVR: Overhaul __builtin_avr_delay_cycles code generation.

In 2-byte loops, don't force scratch regs into constraint "w".
Use a C function for asm output.  It will emit SBIW if possible.

gcc/
* config/avr/avr-protos.h (avr_out_delay_loop): New proto.
* config/avr/avr.cc (avr_out_delay_loop): New function.
(avr_adjust_insn_length) [ADJUST_LEN_DELAY_LOOP]: Handle case.
(avr_expand_delay_cycles): Overhaul.  Allow loop counts of
zero; they represent a power of 2.
* config/avr/avr.md (adjust_len) [delay_loop]: Add.
(*delay_cycles_1): Use avr_out_delay_loop for asm out.
(*delay_cycles_4): Same.
(*delay_cycles_3): Same.
(*delay_cycles_2): Same.  Relax constraints to "d".
Use two QImode scratch regs instead of one HImode one.

4 days agoa68: do not pub non-publicized indicants in exports
Jose E. Marchesi [Mon, 15 Jun 2026 07:38:57 +0000 (09:38 +0200)] 
a68: do not pub non-publicized indicants in exports

Even non-publicized modes were being added to the module interfaces.
This was because for all other kind of taxes (identifiers, operator
indicants, etc) the PUBLICIZED tax attribute is set at taxes
collection time, but for mode indicants the flag shall be set at
extraction time.

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

* a68-parser-extract.cc (a68_extract_indicants): Set PUBLICIZED in
the new tags for mode indicants.
* a68-parser.cc (a68_new_tag): Initialize PUBLICIZED to false.

4 days agomatch: Fix up `(~x) >> (type)x` pattern for truncation [PR125790]
Andrew Pinski [Sun, 14 Jun 2026 20:19:47 +0000 (13:19 -0700)] 
match: Fix up `(~x) >> (type)x` pattern for truncation [PR125790]

I missed this during the review and when I suggest adding support
for the cast. But a truncation of the shifter operand the value
could be defined.
Since the front-end adds a cast to unsigned int, we need to split
pr125707.c into two and xfail the long case and change it to
`long long` so it would xfail for ilp32 [and llp64il32] targets.

PR tree-optimization/125790

gcc/ChangeLog:

* match.pd (`(~x)>>x`): Reject truncation of shifter.

gcc/testsuite/ChangeLog:

* gcc.dg/pr125707.c: Move the long over to pr125707-1.c.
* gcc.dg/pr125707-1.c: New test; xfailed.
* gcc.dg/pr125790-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 days agoRISC-V: Ensure Zicfilp lpad 4-byte alignment
Monk Chiang [Wed, 21 Jan 2026 03:29:13 +0000 (11:29 +0800)] 
RISC-V: Ensure Zicfilp lpad 4-byte alignment

Add LABEL_ALIGN to align non-local goto target labels, removing the
explicit gen_lpad_align () call.  Extend gpr_save to emit the full
CFI guard (.p2align 2, .option push/norelax/norvc, call, .option pop,
lpad 0) when Zicfilp is active.  Add lpad_align before the thunk
entry lpad.

gcc/ChangeLog:

* config/riscv/riscv-zicfilp.cc (rest_of_insert_landing_pad):
Remove gen_lpad_align before non-local goto labels; LABEL_ALIGN
now handles their alignment.  Simplify gpr_save handling: the
pattern now outputs the full CFI sequence itself.
* config/riscv/riscv.cc (riscv_output_mi_thunk): Add
gen_lpad_align before entry lpad.
* config/riscv/riscv.h (LABEL_ALIGN): New macro; ensures 4-byte
alignment for Zicfilp non-local goto target labels.
* config/riscv/riscv.md (gpr_save): When is_zicfilp_p, output
.p2align 2, .option push/norelax/norvc, call, .option pop, lpad 0.

gcc/testsuite/ChangeLog:

* g++.target/riscv/zicfilp-thunk.C: New test.
* gcc.target/riscv/zicfilp-func-entry.c: New test.
* gcc.target/riscv/zicfilp-gpr-save.c: New test.
* gcc.target/riscv/zicfilp-nonlocal-goto.c: New test.

4 days agoRISC-V: Add Zicfilp LPAD protection for setjmp and indirect_return
Monk Chiang [Wed, 10 Jun 2026 01:34:44 +0000 (18:34 -0700)] 
RISC-V: Add Zicfilp LPAD protection for setjmp and indirect_return

Add call-site LPAD insertion for two cases:

1. setjmp / __attribute__((returns_twice)) calls, which may return a
   second time via longjmp.
2. A new "indirect_return" attribute for functions that may return to
   an unexpected address.

Detection uses riscv_call_needs_lpad_p() at expand time.  When needed,
call_internal_cfi / call_value_internal_cfi emit .p2align 2,
.option push/norelax/norvc, the call, .option pop, and lpad 0 as a
single insn.  This prevents the assembler (c.jal) or linker (jal
relaxation) from shifting the return address off the lpad.

Indirect calls to returns_twice or indirect_return functions are not
covered.

Changes in v4:
- Revert the v2 change, make indirect_return a type attribute.

Changes in v3:
- Fix coding style in riscv.cc

Changes in v2:
- Change indirect_return from a type attribute to a decl attribute,
  consistent with returns_twice.
- Add length attributes to call_internal_cfi and call_value_internal_cfi
  to reflect the multi-instruction sequence.
- Copy the explaining comment to call_value_internal_cfi.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (riscv_call_needs_lpad_p): Declare.
* config/riscv/riscv.cc (riscv_gnu_attributes): Register new
indirect_return attribute for function declarations.
(riscv_call_needs_lpad_p): New function.
* config/riscv/riscv.md (call_internal_cfi): New insn pattern with
length attribute.
(call_value_internal_cfi): Likewise for call-with-return-value,
with comment and length attribute.
(define_expand "call"): Emit call_internal_cfi when
riscv_call_needs_lpad_p returns true.
(define_expand "call_value"): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zicfilp-indirect-return.c: New test.
* gcc.target/riscv/zicfilp-setjmp.c: New test.

4 days agoDaily bump.
GCC Administrator [Mon, 15 Jun 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

4 days agoor1k: Fix improper placement of cbranchsi4 instructions
Stafford Horne [Sun, 14 Jun 2026 00:45:43 +0000 (01:45 +0100)] 
or1k: Fix improper placement of cbranchsi4 instructions

When investigating a builtin-arith-overflow-12.c test failure I found
the cause to be improper placement of a cbranchsi4 instruction.

In openrisc a cbranchsi4 instruction will be split to something like:

    (set (reg:BI ?sr_f)
    (cmp:BI (reg:SI x) (reg:SI y)))
    (set (pc)
    (if_then_else (eq (reg:BI ?sr_f)
    (const_int 0 [0]))
(label_ref:SI z)
(pc)))

Between combine and late_combine1 optimization passes I found a case
where a cbranchsi4 was getting injected between the "set sr_f" and
"jump if sr_f" instructions.  The middle-end thought this was ok as it
could not see that the cbranchsi4 pattern will clobber the sr_f register
after splitting.

Add a clause to the cbranchsi4 pattern to indicate that it will clobber
sr_f.  This allows the middle-end to avoid placing the cbranchsi4
pattern incorrectly.

After this patch these tests pass.
  make check-gcc RUNTESTFLAGS='dg-torture.exp=builtin-arith-overflow-12.c'

gcc/ChangeLog:

* config/or1k/or1k.md (cbranchsi4): Add clobber clause.

Signed-off-by: Stafford Horne <shorne@gmail.com>
4 days agoor1k: Fix 64-bit shifts on OpenRISC
Stafford Horne [Thu, 4 Jun 2026 17:36:39 +0000 (18:36 +0100)] 
or1k: Fix 64-bit shifts on OpenRISC

On OpenRISC, 64-bit shift tests shiftdi-2.c and vshift-1.c were failing
and it looks to always have been broken.

After investigation it was found that OpenRISC fails to define
SHIFT_COUNT_TRUNCATED which is needed as both register and immediate
shift amounts are unsigned and only use the low-order 5 bits.  Also,
the immediate used for 32-bit shifts is an unsigned 5-bit value not a
6-bit value; update the predicate.

After these changes these tests pass.
  make check-gcc RUNTESTFLAGS='dg.exp=vshift-1.c execute.exp=shiftdi-2.c'

gcc/ChangeLog:

* config/or1k/or1k.h (SHIFT_COUNT_TRUNCATED): Define.
* config/or1k/or1k.md (rotrsi3): Rename reg_or_u6_operand to
reg_or_u5_operand.
(<shift_op>si3): Ditto.
* config/or1k/predicates.md (reg_or_u6_operand): Remove.
(reg_or_u5_operand): New predicate.

Signed-off-by: Stafford Horne <shorne@gmail.com>
4 days agocobol: Improve MOVE routines.
Robert Dubner [Sun, 14 Jun 2026 20:25:38 +0000 (16:25 -0400)] 
cobol: Improve MOVE routines.

Implement MOVE COMP-3 to NumericDisplay.  Expand test routines verifying SIZE
ERROR behavior for the new MOVE algorithms.  Fix long-standing errors in
processing truncated MOVEs to numeric-display and packed-decimal that resulted
in "negative zero" constructions.

gcc/cobol/ChangeLog:

* move.cc (hex_of): Move the routine.
(hex_msg): Likewise.
(clear_negative_zero): New routine for clearing "negative zero"
after certain MOVEs.
(mh_numeric_display): Use clear_negative_zero().
(mh_packed_to_packed): Check for SIZE-ERROR; use
clear_negative_zero().
(mh_packed_to_numdisp): New routine.
(move_helper): Use mh_packed_to_numdisp().
(parser_move): Move the parser_move routine.
(parser_move_multi): Likewise.
(mh_numdisp_to_packed): Move routine; use clear_negative_zero;
* parse.y: Set separate_e for COMP-6 variables.

libgcobol/ChangeLog:

* libgcobol.cc (int128_to_field): Set packed-decimal sign nybble to
"positive" when value is zero.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/COMP-3_to_COMP-3_size_error.cob: New test.
* cobol.dg/group2/COMP-3_to_COMP-3_size_error.out: New test.
* cobol.dg/group2/COMP-3_to_numeric-display_size_error.cob: New test.
* cobol.dg/group2/COMP-3_to_numeric-display_size_error.out: New test.
* cobol.dg/group2/Clear_negative_zero_after_truncated_MOVE.cob: New test.
* cobol.dg/group2/Clear_negative_zero_after_truncated_MOVE.out: New test.
* cobol.dg/group2/numeric-display_to_COMP-3_size_error.cob: New test.
* cobol.dg/group2/numeric-display_to_COMP-3_size_error.out: New test.

4 days agofortran: Fix double free in ASSOCIATE over allocatable char function [PR125782]
Jerry DeLisle [Sun, 14 Jun 2026 02:10:04 +0000 (19:10 -0700)] 
fortran: Fix double free in ASSOCIATE over allocatable char function [PR125782]

When an ASSOCIATE selector is a function call returning an allocatable
deferred-length character, trans_associate_var unconditionally added an
extra free of the associate-name's backend decl.  That free was added in
2017 (PR60458/77296) to release the result of a POINTER-valued character
function, which is not otherwise freed.  For an ALLOCATABLE-valued
character function, however, the result temporary is already freed by the
procedure call's own cleanup code, and the associate name aliases that
same temporary, so the extra free caused a double free at the end of the
ASSOCIATE block.

Restrict the extra free to POINTER-valued function results, where it is
still needed.

Assisted by: Claude Sonnet 4.6

PR fortran/125782

gcc/fortran/ChangeLog:

* trans-stmt.cc (trans_associate_var): Only free the associate
name's backend decl for a deferred-length character function
result when the result is a POINTER, not when it is
ALLOCATABLE, since the latter is already freed by the
procedure call's cleanup.

gcc/testsuite/ChangeLog:

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

4 days agoDarwin: account for macOS 27
Francois-Xavier Coudert [Sun, 14 Jun 2026 15:18:17 +0000 (17:18 +0200)] 
Darwin: account for macOS 27

macOS 27 (Golden Gate) corresponds to darwin27. Previously, macOS 26 was
darwin25, and darwin26 never existed. We need to adapt the driver to
this new numbering scheme.

2025-07-14  François-Xavier Coudert  <fxcoudert@gcc.gnu.org>

gcc/ChangeLog:

PR target/120645
* config/darwin-driver.cc: Account for latest macOS numbering
scheme.

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-minversion-link.c: Account for macOS 27.

4 days agoa68: use INCLUDE_FOO before system.h for standard C++ headers
Jose E. Marchesi [Sun, 14 Jun 2026 15:31:16 +0000 (17:31 +0200)] 
a68: use INCLUDE_FOO before system.h for standard C++ headers

Define INCLUDE_* preprocessor symbols rather than including some
standard C++ headers directly.

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

* a68-parser-brackets.cc (INCLUDE_STRING): Define.
Do not include <string.
* a68-parser-bottom-up.cc (INCLUDE_STRING): Define.
Do not include <string>.
* a68-moids-diagnostics.cc (INCLUDE_STRING): Define.
Do not include <string>.
* a68-imports.cc (INCLUDE_STRING): Define.
Do not include <string>.
* a68-imports-archive.cc (INCLUDE_MAP): Define.
(INCLUDE_STRING): Likewise.
Do not include <string> nor <map>.

4 days agoAVR: lib1funcs.S: Use PC_SIZE instead of a magic number.
Georg-Johann Lay [Sun, 14 Jun 2026 13:24:12 +0000 (15:24 +0200)] 
AVR: lib1funcs.S: Use PC_SIZE instead of a magic number.

libgcc/
* config/avr/asm-defs.h (REGNO): Recognize: x, y, z, X, Y, Z.
(PC_SIZE): New define.
* config/avr/lib1funcs.S (__mulpsi3, __mulsi3): Use it.

4 days agoa68: fix type of flex.sub_offset in struct encoded_mode
Jose E. Marchesi [Sun, 14 Jun 2026 11:03:19 +0000 (13:03 +0200)] 
a68: fix type of flex.sub_offset in struct encoded_mode

The type of flex.sub_offset in struct encoded_mode shall of course be
uint64_t rather than uint8_t.  This was triggering corrupted exports
sections once a certain amount of modes were reached.

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

* a68-imports.cc (struct encoded_mode): Type of flex.sub_offset
shall be uint64_t.

5 days agoa68: escape %< and %> in call to sprintf
Jose E. Marchesi [Sun, 14 Jun 2026 08:27:04 +0000 (10:27 +0200)] 
a68: escape %< and %> in call to sprintf

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

* a68-parser-brackets.cc (bracket_check_error): Escape %< and
%> in call to printf.

5 days agoAdd a few cases where -Wwarn-unused-but-set-variable should not warn.
Thomas Koenig [Sun, 14 Jun 2026 07:33:41 +0000 (09:33 +0200)] 
Add a few cases where -Wwarn-unused-but-set-variable should not warn.

When variables are use-associated, volatile or asynchronous,
reference or definition may not be visible in the local namespace.
Thus, they need to be excluded from unused vs set warnings.

gcc/fortran/ChangeLog:

PR fortran/30438
* resolve.cc (find_unused_vs_set): Exclude variables from
cwarnings if use_assoc, volatile_ or asynchronous are set.

gcc/testsuite/ChangeLog:

PR fortran/30438
* gfortran.dg/warn_unused_but_set_variable_3.f90: New test.

5 days agolibcpp/init: remove unnecessary `struct` keyword
Ben Boeckel [Tue, 2 Apr 2024 02:14:44 +0000 (22:14 -0400)] 
libcpp/init: remove unnecessary `struct` keyword

The initial P1689 patches were written in 2019 and ended up having code
move around over time ended up introducing a `struct` keyword to the
implementation of `cpp_finish`. Remove it to match the rest of the file
and its declaration in the header.

Fixes: 024f135a1e9 (p1689r5: initial support, 2023-09-01)
Reported-by: Roland Illig <roland.illig@gmx.de>
libcpp/

* init.cc (cpp_finish): Remove unnecessary `struct` keyword.

5 days agolibcpp/mkdeps: fix indentation
Ben Boeckel [Tue, 2 Apr 2024 02:12:00 +0000 (22:12 -0400)] 
libcpp/mkdeps: fix indentation

Fixes: 024f135a1e9 (p1689r5: initial support, 2023-09-01)
Reported-by: Roland Illig <roland.illig@gmx.de>
libcpp/

* mkdeps.cc (fdeps_add_target): Fix indentation.

5 days agotree-optimization: Add bitop reduction simplifications against zero
Souradipto Das [Mon, 8 Jun 2026 03:45:24 +0000 (09:15 +0530)] 
tree-optimization: Add bitop reduction simplifications against zero

This patch introduces a simplification rule in match.pd to reduce bitwise
expressions against zero. Specifically, it simplifies patterns where a
variable checked against zero is combined via bitwise AND/OR with a compounded
bitwise OR check against zero.

        PR tree-optimization/125442

gcc/ChangeLog:

* match.pd: Add simplification rules for
(a == 0) | ((a | b) == 0) -> (a == 0) and
(a != 0) & ((a | b) != 0) -> (a != 0).

gcc/testsuite/ChangeLog:

* gcc.dg/int-bwise-opt-3.c: New test.
* gcc.dg/int-bwise-opt-4.c: New test.

Suggested-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Signed-off-by: Souradipto Das <souradiptodas6@gmail.com>
5 days agorange fold: Fix relation folding of |/& when reversed operands [PR125774]
Andrew Pinski [Sat, 13 Jun 2026 21:42:30 +0000 (14:42 -0700)] 
range fold: Fix relation folding of |/& when reversed operands [PR125774]

This showed up in GCC 13 in the original testcase but became latent in GCC 14.
So I created a simple gimple testcase to show the issue.
So what we have is:
  _21 = _20 > lower_9;
  _22 = lower_9 > _20;
  _23 = _21 | _22;

And this would incorrectly be folded into 1 and that is because we treated one of
those `>` as `<=` rather than as just `<`. This was due to an incorrect use
of relation_negate rather than relation_swap when dealing with swapping the operands.

Pushed as obvious after a bootstrap/test on x86_64-linux-gnu.

PR tree-optimization/125774

gcc/ChangeLog:

* gimple-range-fold.cc (fold_using_range::relation_fold_and_or): Use
relation_swap rather than relation_negate when the operands are exchanged.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 days agoDaily bump.
GCC Administrator [Sun, 14 Jun 2026 00:16:28 +0000 (00:16 +0000)] 
Daily bump.

5 days agoa68: fix brackets parser diagnostics
Jose E. Marchesi [Sat, 13 Jun 2026 23:42:02 +0000 (01:42 +0200)] 
a68: fix brackets parser diagnostics

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

* a68-parser-brackets.cc: Include <string>.
(bracket_check_error): Get additional argument `item'.
(bracket_check_diagnose): Likewise.
(bracket_check_parse): Fix call to a68_error passing the `item'.

5 days agoa68: fix testsuite/algol68/execute/modules/program-1.a68
Jose E. Marchesi [Sat, 13 Jun 2026 23:39:57 +0000 (01:39 +0200)] 
a68: fix testsuite/algol68/execute/modules/program-1.a68

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

* algol68/execute/modules/program-1.a68: Fix test.

5 days agoa68: fix typo in a68_demangle_symbol
Jose E. Marchesi [Sat, 13 Jun 2026 22:27:45 +0000 (00:27 +0200)] 
a68: fix typo in a68_demangle_symbol

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

* a68-low.cc (a68_demangle_symbol): Fix typo, 'p' is the mangling
of '%', not of '+'.

gcc/testsuite/ChangeLog

* algol68/execute/modules/module1.a68: Add an operator %.
* algol68/execute/modules/program-1.a68: Use operator %.

5 days agophiopt: Fix is_factor_profitable for debug stmts [PR125776]
Andrew Pinski [Sat, 13 Jun 2026 16:38:08 +0000 (09:38 -0700)] 
phiopt: Fix is_factor_profitable for debug stmts [PR125776]

This is a latent bug in is_factor_profitable where we would
consider a debug statement as an use for lifetime usage
afterwards. So you would get a compare debug failure in some
cases. pr125776-2.c fails since r15-4503-g8d6d6d537fdc75.

Pushed as obvious after a bootstrap/test.

PR tree-optimization/125776

gcc/ChangeLog:

* tree-ssa-phiopt.cc (is_factor_profitable): An
usage in a debug stmt should be ignored.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 days agolibstdc++: Implement P4206R0: Revert string support in std::constant_wrapper.
Tomasz Kamiński [Thu, 30 Apr 2026 18:07:14 +0000 (20:07 +0200)] 
libstdc++: Implement P4206R0: Revert string support in std::constant_wrapper.

We need to apply remove_cvref_t on decltype(_Xv) for default template argument
due PR115314. The constant_wrapper::value is declared as decltype((__Xv)) due
PR125188.

libstdc++-v3/ChangeLog:

* include/bits/version.def (constant_wrapper): Bump to 202606L.
* include/bits/version.h: Regenerate.
* include/bits/funcref_impl.h (function_ref::function_ref): Rename
template parameter from __cwfn to __fn and use it direclty.
* include/bits/funcwrap.h (function_ref): Rename template parameter
to __fn.
(std::constant_wrapper): Use auto as non-type template parameter,
and refeference it as value.
* include/bits/utility.h (__CwFixedValue): Remove.
* testsuite/20_util/constant_wrapper/generic.cc: Remove arrays
and string literal tests. Add test for address of value.
* testsuite/20_util/constant_wrapper/other_wrappers.cc:
Remove test_array.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 days agoa68: avoid coalescing of stmt_lists in a68_lower_unit_list
Jose E. Marchesi [Sat, 13 Jun 2026 16:44:27 +0000 (18:44 +0200)] 
a68: avoid coalescing of stmt_lists in a68_lower_unit_list

At it happens, a68_lower_unit_list collects units as members of a
stmt_list, lowering them and appending them.  Problem is, stmt_lists
get coalesced when appended (or prepended) to another stmt_list.

One of the units that may lower in a stmt_list are generators, and the
coalescing manifests itself when the generators are found in
collateral clauses.

This patch puts in place a temporary workaround for this, which is to
wrap the stmt_list into a NOP_EXPR.  This avoid the coalescing, but a
less hackish solution will probably consist on changing the way
unit_lists get collected instead.

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

* a68-low-generator.cc (a68_low_generator): Wrap the resulting
stmt_list into a nop_expr.

gcc/testsuite/ChangeLog

* algol68/execute/gen-in-constructor-1.a68: New test.
* algol68/execute/gen-in-constructor-2.a68: Likewise.

5 days agoa68: add assert after calling a68_lower_tree on a unit list
Jose E. Marchesi [Sat, 13 Jun 2026 15:53:33 +0000 (17:53 +0200)] 
a68: add assert after calling a68_lower_tree on a unit list

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

* a68-low-clauses.cc (a68_lower_collateral_clause): Check that
a68_lower_tree on the units list return NULL_TREE.

5 days agoAVR: Overhaul libf7/asm-defs.h
Georg-Johann Lay [Sat, 13 Jun 2026 16:16:06 +0000 (18:16 +0200)] 
AVR: Overhaul libf7/asm-defs.h

libgcc/config/avr/libf7/
* asm-defs.h (REGNO): New .macro.
(wmov): Use it.
(do_epilogue_restores) <\n_frame>: Put in () where needed.

5 days ago[PATCH v6 4/4] find_a_program: Search with machine prefix in some cases
Jeff Law [Sat, 13 Jun 2026 15:05:32 +0000 (09:05 -0600)] 
[PATCH v6 4/4] find_a_program: Search with machine prefix in some cases

Prefatory note:

I've since learned that this quite similar to
https://inbox.sourceware.org/gcc-patches/20240522095404.1825269-1-syq@gcc.gnu.org/,
postdating my original patch series, but predating this version. See
that thread for additional motivation. That patch updated a few specific
callsite for various programs; I instead opted to enhance find_a_program
(which I myself originally factored out of find_a_file in
5fee8a0a9223d030c66d53c104fb0a431369248f for this purpose) to catch all
such cases programmatically.

Behavior Change:

Today, GCC will search for:

1. path/$machine/$version/prog
2. path/$machine/prog
3. path/prog

This means, we might search for:

1. path/$machine/$version/prog
2. path/$machine/prog
3. path/$machine-prog # new
4. path/prog

But it will not search for:

- path/$machine/$version/$machine-prog
- path/$machine/$machine-prog

I want this change because when cross compiling, users expect prefixed
tools, like

 - $AS = $machine-as
 - $LD = $machine-ld

etc. and it would be less confusing if GCC would find those same tools
in a similar way. GCC instead looking for its own (less widely used than
prefixing) nested-directory way of disambiguating, and then falling back
looking for *unprefixed* tools (which typically are for the wrong
platform in cross cases) is quite confusing. In my distro, Nixpkgs, and
elsewhere, I've seen people draw the wrong conclusions because of this,
which is that one must use absolute paths hard-coded at build time in
order to get the right behavior, and dodge the incorrect unprefixed
tools.

For what its worth, Clang/LLVM also look for prefixed tools in this
manner, so this isn't the first time it would be done. The difference is
that they will look for prefixed tools in *all* cases --- i.e. also
within the machine-specific locations as I outlined above (as things
this patch does *not* do). I think that was done for mere coding
convenience, and there is no actual motivation "doubly disambiguating"
tools with machine directories and machine prefixes. So in the interest
of sticking strictly to the motivation / being conservative in how much
new behavior is implemented, I did not implement that part.

gcc/ChangeLog:

* gcc.cc (find_a_program): Implement the new behavior described
above.
(driver::set_up_specs): Initilize variable. It would be nice to
have less spooky-action-at-a-distince using C++ features, but I
just matched how the corresponding suffix variable worked for
now for uniformity.

Signed-off-by: John Ericson <git@JohnEricson.me>
5 days ago[PATCH v6 3/4] for_each_path: Pass to callback whether dir is machine-disambiguated
John Ericson [Sat, 13 Jun 2026 14:56:16 +0000 (08:56 -0600)] 
[PATCH v6 3/4] for_each_path: Pass to callback whether dir is machine-disambiguated

We will use this in the subsequent patch to control what filenames we
search for.

gcc/ChangeLog:

* gcc.cc (for_each_path): Pass an additional boolean argument to
the callback specifying whether the current directly being
searched is machine-specific, as described above.
(build_search_list): Add unused parameter to lambda match new
callback type.
(find_a_file): Add unused parameter to lambda match new callback
type.
(find_a_program): Add unused parameter to lambda match new
callback type.
(spec_path::operator()): Add unused parameter to match new
callback type.

Signed-off-by: John Ericson <git@JohnEricson.me>
5 days ago[PATCH] Fix data type iterator of pack rs reg
panciyan@eswincomputing.com [Sat, 13 Jun 2026 14:40:29 +0000 (08:40 -0600)] 
[PATCH] Fix data type iterator of pack rs reg

This patch would like to Fix data type iterator of pack rs reg

Signed-off-by: Ciyan Pan <panciyan@eswincomputing.com>
gcc/ChangeLog:

* config/riscv/crypto.md (riscv_pack): Change HISI iterator to
HX as we must match half a target word for pack.

5 days agoinstall: Use AE spelling for "behavior"
Gerald Pfeifer [Sat, 13 Jun 2026 10:21:45 +0000 (12:21 +0200)] 
install: Use AE spelling for "behavior"

gcc:
* doc/install.texi (Configuration): Use AE spelling for "behavior".

6 days agomatch.pd: fold (0/1) * -(0/1) into -((0/1) & (0/1))
Kyrylo Tkachov [Fri, 12 Jun 2026 00:00:00 +0000 (00:00 +0000)] 
match.pd: fold (0/1) * -(0/1) into -((0/1) & (0/1))

For operands known to be in the range [0, 1], multiplying a 0/1 value by a
negated 0/1 value is the negation of their bitwise AND:

  x * -y == -(x & y)   when x, y are in { 0, 1 }.

This complements the existing "{ 0, 1 } * { 0, 1 } -> { 0, 1 } & { 0, 1 }"
simplification, which does not handle a negated operand.  For the
comparison-derived 0/1 masks produced by if-conversion this exposes a plain
bitwise AND of the original conditions to later passes (replacing a
COND_EXPR).

This triggers a few times in astcenc in SPEC2026 where it simplifies the
codegen of one of the hot kernels and gives a ~2.4% improvement on
aarch64, though the real winners for that kernel are described in
PR125750. This is just a small cleanup.

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

PR tree-optimization/125750
* match.pd (mult of a 0/1 value by a negated 0/1 value): New
simplification.

gcc/testsuite/ChangeLog:

PR tree-optimization/125750
* g++.dg/tree-ssa/mult-negate-zeroone-1.C: New test.
* g++.dg/tree-ssa/mult-negate-zeroone-2.C: New test.

6 days agomatch: Optimize (~a) >> a to -1 for signed a [PR125707]
Kael Andrew Alonzo Franco [Fri, 12 Jun 2026 09:55:56 +0000 (05:55 -0400)] 
match: Optimize (~a) >> a to -1 for signed a [PR125707]

For signed a, (~a) >> a is the same as ~(a>>a) which is ~0 aka -1.

Bootstrapped and tested on x86_64-pc-linux-gnu

PR tree-optimization/125707

gcc/ChangeLog:

PR tree-optimization/125707
* match.pd: Add (~a) >> a to -1 for signed a.

gcc/testsuite/ChangeLog:

PR tree-optimization/125707
* gcc.dg/pr125707.c: New test.

Signed-off-by: Kael Franco <kaelfandrew@gmail.com>
6 days agodriver: Spill long COLLECT_GCC_OPTIONS to a response file [PR111527]
Sunil Dora [Thu, 11 Jun 2026 12:50:20 +0000 (18:20 +0530)] 
driver: Spill long COLLECT_GCC_OPTIONS to a response file [PR111527]

Many kernels enforce a per-string length limit on argv and envp
strings passed to execve().  On Linux, MAX_ARG_STRLEN limits each
string to 32 * PAGE_SIZE (~128KB); Windows limits individual
environment variables to 32767 characters.  When the assembled
value exceeds such a limit, the build fails.

When the assembled value would exceed COLLECT2_OPTIONS_MAX_LENGTH
(default 1024, host-overridable via defaults.h), the driver writes
the option list to a temporary response file via writeargv() and
exports "COLLECT_GCC_OPTIONS=@<path>" instead.  collect2,
lto-wrapper and lto-plugin transparently expand the @file form using
existing expandargv() infrastructure, so the change is invisible to
normal builds.

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

PR driver/111527

gcc/ChangeLog:

* defaults.h (COLLECT2_OPTIONS_MAX_LENGTH): New macro.
* collect-utils.cc (read_collect_gcc_options): New function.
* collect-utils.h (read_collect_gcc_options): Declare.
* collect2.cc (main): Use read_collect_gcc_options instead
of getenv.
* doc/hostconfig.texi (Host Misc): Document
COLLECT2_OPTIONS_MAX_LENGTH.
* doc/invoke.texi (Environment Variables): Document the
@file form of COLLECT_GCC_OPTIONS.
* gcc.cc (xsetenv_collect_gcc_options): New function.
(set_collect_gcc_options): Use xsetenv_collect_gcc_options.
* lto-wrapper.cc (run_gcc): Use read_collect_gcc_options
instead of getenv.

gcc/testsuite/ChangeLog:

* gcc.misc-tests/pr111527.exp: New test.

include/ChangeLog:

* libiberty.h (expandargstr): Declare.

libiberty/ChangeLog:

* argv.c (expandargstr): New function.

lto-plugin/ChangeLog:

* lto-plugin.c (read_collect_gcc_options): New function.
(onload): Use read_collect_gcc_options instead of getenv.

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
6 days agoa68: consolidate refs when lowering formulas
Jose E. Marchesi [Sat, 13 Jun 2026 00:24:48 +0000 (02:24 +0200)] 
a68: consolidate refs when lowering formulas

It is necessary to consolidate operands of both monadic and dyadic
formulas so that paremeters expecting references will get an address.

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

* a68-low-units.cc (a68_lower_formula): Consolidate operands of
formula before call.
(a68_lower_monadic_formula): Likewise.

gcc/testsuite/ChangeLog

* algol68/execute/formula-3.a68: New test.
* algol68/execute/formula-4.a68: Likewise.
* algol68/execute/formula-5.a68: Likewise.

6 days agoDaily bump.
GCC Administrator [Sat, 13 Jun 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

6 days agoOpenMP/Fortran: Fix module-use renaming with declare mapper/reduction
Tobias Burnus [Fri, 12 Jun 2026 21:30:35 +0000 (23:30 +0200)] 
OpenMP/Fortran: Fix module-use renaming with declare mapper/reduction

Use the same logic as in gfc_compare_derived_types to compare the
types. Additionally, the 'declare' part only permits derived types
(per syntax) and not class - while using the mapper/reduction with
CLASS variables is possible.

gcc/fortran/ChangeLog:

* openmp.cc (gfc_omp_udm_find, gfc_omp_udr_find): Fix
to handle derived-type renaming via module use.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/declare-mapper-6.f90: New test.
* gfortran.dg/gomp/declare-mapper-7.f90: New test.
* gfortran.dg/gomp/declare-reduction-3.f90: New test.
* gfortran.dg/gomp/declare-reduction-4.f90: New test.

6 days agoc++: Diagnose invalid type of bitfield widths in templates [PR125674]
Jakub Jelinek [Fri, 12 Jun 2026 20:43:06 +0000 (22:43 +0200)] 
c++: Diagnose invalid type of bitfield widths in templates [PR125674]

As the first testcase shows, outside of templates or when
the bitfield width is not type dependent, we diagnose it
in grokbitfield:
  if (width != error_mark_node)
    {
      /* The width must be an integer type.  */
      if (!type_dependent_expression_p (width)
          && !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width)))
        error ("width of bit-field %qD has non-integral type %qT", value,
               TREE_TYPE (width));
      else if (!check_for_bare_parameter_packs (width))
        {
          /* Temporarily stash the width in DECL_BIT_FIELD_REPRESENTATIVE.
             check_bitfield_decl picks it from there later and sets DECL_SIZE
             accordingly.  */
          DECL_BIT_FIELD_REPRESENTATIVE (value) = width;
          SET_DECL_C_BIT_FIELD (value);
        }
    }
Later on in check_bitfield_decl we verify it is a constant expression,
folded into INTEGER_CST, non-negative etc.
But during instantiation, we don't repeat that check, so only call
check_bitfield_decl later on which can sometimes emit different diagnostics
(so e.g.
bit-field ‘D<1.0e+0>::d’ width not an integer constant
instead of
width of bit-field ‘D<N>::d’ has non-integral type ‘double’
) but what the second testcase shows, we can ICE during cxx_constant_value
even before that if the type is even more problematic.

The following patch fixes that by repeating the test from grokbitfield
during tsubst_decl.

2026-06-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/125674
* pt.cc (tsubst_decl): Diagnose bit-field widths
with invalid type.

* g++.dg/template/bitfield5.C: New test.
* g++.dg/template/bitfield6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
6 days agoaarch64: Add initial tuning model for cortex-a320 core
Claudio Bantaloukas [Fri, 12 Jun 2026 17:32:28 +0000 (17:32 +0000)] 
aarch64: Add initial tuning model for cortex-a320 core

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (cortex-a320): Update core.
* config/aarch64/aarch64.cc: Add cortexa320.h.
* config/aarch64/tuning_models/cortexa320.h: New file.

6 days agoFortran: Improve OpenMP/OpenACC syntax diagnostic
Tobias Burnus [Fri, 12 Jun 2026 17:12:58 +0000 (19:12 +0200)] 
Fortran: Improve OpenMP/OpenACC syntax diagnostic

The way the OpenMP and OpenACC parser is written is such that
when the directive name has been successfully matched, any error returned
by the match function should be real.

However, 'match_word' resets he locus to the before-match locus such
that all information is lost, except that error vs. no match data is
still available. Thus, for OpenMP and OpenACC, the error often was

  Unclassifiable OpenMP directive at (1)

which is odd when knowing that one used a supported directive; that
the caret pointed to the directive name did not really help, either.

With this commit, the match errors for OpenMP and OpenACC yield the
following error if no buffered message exists:

  Syntax error in statement at (1)

pointing the the current locus. (Still, a more explicit error
would be better, e.g. for many errors in 'omp declare reduction',
but still better than previously.)

gcc/fortran/ChangeLog:

* parse.cc (match_word): Add no_substring and
reject_stmt_on_error arguments, defaulting to false and true,
respectively.
(match_word_omp_simd): Do not reject_statement on error and
enable no-substring matching.
(matcha, matcho, matchdo): Call match_word with no_substring
set to true and reject_stmt_on_error set to false.
(decode_omp_directive): Distinguish unknown directive name from
errors found during matching.
(decode_oacc_directive): Likewise; use matcha not match.
(matcha, matcho, matchdo, matchs, matchds): #undef after use.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/asyncwait-4.f95: Update dg-error.
* gfortran.dg/goacc/routine-6.f90: Likewise.
* gfortran.dg/gomp/udr1.f90: Likewise.
* gfortran.dg/gomp/udr2.f90: Likewise.
* gfortran.dg/gomp/udr4.f90: Likewise.
* gfortran.dg/gomp/declare-reduction-2.f90: New test.

6 days agoFortran/OpenMP: Add module support for 'declare mapper'
Julian Brown [Fri, 12 Jun 2026 17:08:43 +0000 (19:08 +0200)] 
Fortran/OpenMP: Add module support for 'declare mapper'

This commits fixes some issues, moves resolution to the mapper_id
from parsing to resolution stage and saves the mapper in the
module file.

As a side effect, there is no longer a 'sorry, unimplemented'
for 'declare mapper'; the 'sorry' is now printed when using
explicit map clauses that require a mapper. Note that no
error is printed if the code only uses implicit maps, even
though the mapper is ignored.

Co-authored-by: Tobias Burnus <tburnus@baylibre.com>
gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_namelist): Change udm member into
a pointer type.
(gfc_omp_namelist_udm): Add mapper_id member and move
down in the file below the related ..._udr struct.
(gfc_get_omp_namelist_udm): New convenience macro.
* match.cc (gfc_free_omp_namelist): Free udm.
* module.cc (MOD_VERSION_NUMERIC): Add.
(load_omp_udrs): Add diagnostic_group.
(omp_map_clause_ops, load_omp_udms, check_omp_declare_mappers,
write_omp_udm, write_omp_udms): New.
(read_module, write_module): Support 'declare mapper'.
* openmp.cc (gfc_find_omp_udm, gfc_match_omp_clauses,
resolve_omp_clauses): Handle mapper_id and do later
resolution.
* resolve.cc (resolve_types): Remove 'declare mapper' sorry.
* trans-openmp.cc (gfc_trans_omp_clauses): Add sorry for
map clauses with mapper.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/declare-mapper-1.f90: Remove no longer
expect 'sorry, unimplemented'.
* gfortran.dg/gomp/declare-mapper-3.f90: New test.
* gfortran.dg/gomp/declare-mapper-31.f90: New test.
* gfortran.dg/gomp/declare-mapper-4.f90: New test.
* gfortran.dg/gomp/declare-mapper-5.f90: New test.

6 days agomicroblaze: add Linux signal frame unwinding support
Ramin Moussavi [Tue, 2 Jun 2026 22:00:00 +0000 (00:00 +0200)] 
microblaze: add Linux signal frame unwinding support

libgcc has no MD_FALLBACK_FRAME_STATE_FOR for microblaze*-linux*, so the
DWARF unwinder cannot step through signal frames at all.  Anything that
unwinds out of a signal handler -- most prominently NPTL asynchronous
pthread cancellation (SIGCANCEL) -- either stops early with
_URC_END_OF_STACK (cleanup handlers below the signal frame never run) or
misinterprets the on-stack signal trampoline and crashes with SIGSEGV.

Add the standard fallback: recognize the two-instruction trampoline the
kernel writes into struct rt_sigframe on the stack

addik r12, r0, __NR_rt_sigreturn
brki  r14, 0x8

and rebuild the frame state from the sigcontext's pt_regs.  The ucontext
is anchored relative to the trampoline (its last member) rather than to
the CFA, so the layout of the frame head does not matter.

The interrupted PC is recorded in DWARF column 36, one past the hard
registers, because column 15 must keep the interrupted r15 (unrelated to
the resume address of a signal frame).  Declaring it as
DWARF_ALT_FRAME_RETURN_COLUMN makes init_dwarf_reg_size_table size the
column; without that _Unwind_GetGR reads a zero size and aborts.

Tested with a microblazeel-linux-uclibc cross compiler against uClibc-ng
git, running its NPTL test suite under qemu-system-microblazeel -M
petalogix-s3adsp1800.  Without the fix 17 tests fail (tst-cancel{1..5,7,
9,16,20,x4,x7}, tst-cleanup{1..3}, tst-cond{16,17}) by SIGSEGV or by
hanging in the unwinder; with it all 17 pass and the rest of the suite
is unchanged.  The implementation follows the mips/aarch64
linux-unwind.h pattern.

gcc/ChangeLog:

* config/microblaze/microblaze.h (DWARF_ALT_FRAME_RETURN_COLUMN):
Define.

libgcc/ChangeLog:

* config.host (microblaze*-linux*): Set md_unwind_header.
* config/microblaze/linux-unwind.h: New file.

Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
6 days agoDe-duplicate '#define _GNU_SOURCE' in 'libgomp/config/linux/allocator.c'
Thomas Schwinge [Thu, 21 May 2026 18:31:18 +0000 (20:31 +0200)] 
De-duplicate '#define _GNU_SOURCE' in 'libgomp/config/linux/allocator.c'

Minor fix-up for commit 348874f0baac0f22c98ab11abbfa65fd172f6bdd
"libgomp: basic pinned memory on Linux".

libgomp/
* config/linux/allocator.c: De-duplicate '#define _GNU_SOURCE'.

6 days ago'#define _GNU_SOURCE' in 'libgomp/plugin/plugin-gcn.c'
Thomas Schwinge [Thu, 21 May 2026 16:54:08 +0000 (18:54 +0200)] 
'#define _GNU_SOURCE' in 'libgomp/plugin/plugin-gcn.c'

'#define _GNU_SOURCE' in 'libgomp/plugin/plugin-gcn.c', like all other
libgomp source files do, instead of via the 'Makefile'.  Minor fix-up for
Subversion r278138 (Git commit 237957cc2c1818f30207f02747a880bd1cd28d0b)
"GCN Libgomp Plugin" (..., which, back then, likely had inherited that
from the HSA libgomp plugin).

libgomp/
* plugin/plugin-gcn.c: '#define _GNU_SOURCE'.
* plugin/Makefrag.am (libgomp_plugin_gcn_la_CPPFLAGS): Don't add
'-D_GNU_SOURCE'.
* Makefile.in: Regenerate.

6 days agoGCN: Implement 'TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID' [PR101484]
Thomas Schwinge [Thu, 11 Jun 2026 19:41:10 +0000 (21:41 +0200)] 
GCN: Implement 'TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID' [PR101484]

This is the proper fix to replace
commit 9f2bc5077debef2b046b6c10d38591ac324ad8b5
"[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]",
commit 8168338684fc2bed576bb09202c63b3e9e678d92
"[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' some more [PR101484]".

PR target/101484
gcc/
* config/gcn/gcn.cc (TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID): Implement.
libgomp/
* configure.tgt [GCN] (XCFLAGS): Don't add '-Wno-error=array-bounds'.

6 days agolra: Reloading section anchors
Stefan Schulze Frielinghaus [Mon, 8 Jun 2026 07:10:20 +0000 (09:10 +0200)] 
lra: Reloading section anchors

Currently an "entire" address is reloaded even in cases where section
anchors are involved.  This makes it harder to share section anchors
which is the whole point of them.  For example, in cases where
offsetable MEMs are valid do not reload .LANCHOR42+offset but only
.LANCHOR42 and replace the address with the resulting reload register
and the offset.  As a consequence subsequent passes only have to deal
with register equivalences in order to share section anchors.  For
example, consider testsuite/gcc.target/s390/section-anchors-4.c.
Without this patch, after LRA we end up with

   20: %r1:DI=`*.LANCHOR0'
   17: %f0:DF=[%r1:DI]
   19: %r1:DI=const(`*.LANCHOR0'+0x8)
   12: {%f0:DF=%f0:DF+[%r1:DI];clobber %cc:CC;}

and with this patch

   20: %r1:DI=`*.LANCHOR0'
   17: %f0:DF=[%r1:DI]
   19: %r1:DI=`*.LANCHOR0'
   12: {%f0:DF=%f0:DF+[%r1:DI+0x8];clobber %cc:CC;}

In insn 19 only the section anchor is reloaded.  This allows postreload
to remove the redundant load such that we end up with

   20: %r1:DI=`*.LANCHOR0'
   17: %f0:DF=[%r1:DI]
   12: {%f0:DF=%f0:DF+[%r1:DI+0x8];clobber %cc:CC;}

gcc/ChangeLog:

* lra-constraints.cc (reload_section_anchor_p): New function.
(curr_insn_transform): For offsetable MEMs, try reloading the
section anchor only.

gcc/testsuite/ChangeLog:

* gcc.target/s390/section-anchors-4.c: New test.

6 days agoalgol68: Use correct library file extension on darwin and windows
Pietro Monteiro [Fri, 12 Jun 2026 12:09:16 +0000 (08:09 -0400)] 
algol68: Use correct library file extension on darwin and windows

Changes from v1:
  - Use TARGET_MACHO and TARGET_PECOFF guards instead of __APPLE__ and
  _WIN32.
-- >8 -
Darwin uses .dylib as extension for libraries.  Windows uses .dll, and
sometimes doesn't prefix the library filename with "lib".

Use those extensions when opening library files to search for imports
on those OSes.  Search for file with both the lib prefix and without
on Windows.

gcc/algol68/ChangeLog:

* a68-imports.cc (a68_try_suffixes): Use .dylib suffix on Darwin.
Use .dll suffix and optional lib prefix on Windows.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
6 days agotestsuite, c++: Account for missing stong symbol aliases.
Iain Sandoe [Thu, 11 Jun 2026 19:40:51 +0000 (20:40 +0100)] 
testsuite, c++: Account for missing stong symbol aliases.

Darwin does not have strong symbol aliases and therefore must emit complete
constructors (which might, or might not call others).  Several tests assume
that a base constructor is emitted (which is fine for targets with strong
symbol aliases that emit the complete constructor symbol as an alias to the
base etc.).

Handle the two cases with separate matches.

gcc/testsuite/ChangeLog:

* g++.dg/modules/clone-4_b.C: Account for missing strong symbol
aliases.
* g++.dg/template/explicit-instantiation8.C: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
6 days agovect: use .VARYING for early break IV [PR125597]
Tamar Christina [Fri, 12 Jun 2026 10:56:54 +0000 (11:56 +0100)] 
vect: use .VARYING for early break IV [PR125597]

Similar to the mask control variable, this replaces and adds the temporary SSA
var for early break scalar IVs with an IFN_VARYING until the replacement is done
when we start vectorization.

This prevents similar issues as the mask control variable when the IV
expressions are folded.

gcc/ChangeLog:

PR tree-optimization/125597
* tree-vect-loop-manip.cc (vect_do_peeling): Create IFN_VARYING for
early break scalar IV.
* tree-vect-loop.cc (vect_update_ivs_after_vectorizer_for_early_breaks):
Replace the IFN_VARYING with actual value.

6 days agovect: use .VARYING for loop iteraion mask [PR125597]
Tamar Christina [Fri, 12 Jun 2026 10:56:33 +0000 (11:56 +0100)] 
vect: use .VARYING for loop iteraion mask [PR125597]

This replaces the gimple_build_nop () used for making loop control mask variable
with an IFN_VARYING and then actually adding the statement to the IL.

The bug happens because the mask def statement itself is not in the IL but
computations that use it are.  As such dataflow analysis fails as it tries to
analyze the use/def chain of these expressions.

When the value if known we replace the IFN_VARYING with the final statement.

gcc/ChangeLog:

PR tree-optimization/125597
(vect_do_peeling): Create IFN_VARYING for masks.
* tree-vect-loop-manip.cc (vect_set_loop_condition): Replace the
IFN_VARYING.

gcc/testsuite/ChangeLog:

PR tree-optimization/125597
* gcc.target/aarch64/pr125597.c: New test.

6 days agomiddle-end: introduce IFN_VARYING for temporary statements [PR125597]
Tamar Christina [Fri, 12 Jun 2026 10:55:46 +0000 (11:55 +0100)] 
middle-end: introduce IFN_VARYING for temporary statements [PR125597]

This defines a new IFN "VARYING" to indicate that the operation has no current
defining statement and so things like range analysis should just not report
anything yet.

In the vectorizer we can create new SSA variables that are only defined after
vectorization is finishing.  For instance the actual control statement for
masked loops.

However intermediate values need to be able to perform build expressions using
this SSA name but since GCC 16 ranger now tries to analyze these and we ICE.

This replaces the uses of gimple_nop in the definition with a value with a more
defined semantics.

gcc/ChangeLog:

PR tree-optimization/125597
* internal-fn.def (VARYING): New.
* doc/ifn.texi: Document it.
* internal-fn.cc (expand_VARYING): New.
* internal-fn.h (expand_VARYING): New.
* tree-cfg.cc (verify_gimple_call): Check for leaked IFN_VARYING.

7 days agoira: Allow multiple uses within an insn [PR125173]
Stefan Schulze Frielinghaus [Fri, 12 Jun 2026 09:15:14 +0000 (11:15 +0200)] 
ira: Allow multiple uses within an insn [PR125173]

For the attached test we end up during IRA with

6: r99:DI=`s'
  REG_EQUIV `s'
7: {[`b']=asm_operands;
    [const(`s'+0x4)]=asm_operands;
    [`a']=asm_operands;clobber flags:CC;}
  REG_DEAD r99:DI
  REG_UNUSED flags:CC

where r99 is used in each asm_operands

(mem/c:SI (plus:DI (reg/f:DI 99)
                   (const_int 4 [0x4])) [2 s.d+0 S4 A32])

This in turn means that we hit multiple times the very same insn while
iterating over all uses of r99 which in the end triggers the assert.

This patch relaxes the assert since what we want to ensure here is that
a register is not used by multiple insns since otherwise we cannot
trivially move or delete the definition.

PR rtl-optimization/125173

gcc/ChangeLog:

* ira.cc (combine_and_move_insns): Allow multiple uses within
an insn.

gcc/testsuite/ChangeLog:

* gcc.dg/pr125173-1.c: New test.

7 days agophiopt: Allow factoring out of more than just single operand operations
Andrew Pinski [Thu, 4 Jun 2026 23:09:41 +0000 (16:09 -0700)] 
phiopt: Allow factoring out of more than just single operand operations

This takes https://gcc.gnu.org/pipermail/gcc-patches/2026-June/719384.html
and merge it into factor_out_conditional_operation. Also expands it to
allow for more than just unary and binary operands.
It handles as similar as what ifcvt does in factor_out_operators
but rejects some cases due to those not being profitable.
The cases which are not profitable:
* pointer plus in early with constant operand 1 (except if equal).
* division/mod with constant operand 1
* Complex expr, it would cause to lose an unitialization warning
(gcc.dg/uninit-17.c)

some cases needed to be rejected for validity (copied from ifcvt):
* BIT_FIELD_REF/BIT_INSERT_EXPR (non first operand)
* VEC_PERM_EXPR with constant operand 2

Notes on the testcase changes:
The recip-*.c testcases need to be disable phiopt since it removes
a division in some cases which causes the recip pass not to run.

slsr-12.c and slsr-34.c need to be xfailed. SLSR pass is mostly
in maintaince mode and is not getting improved.

pr122629-1.c and vect-reduc-cond-2.c are now handled in phiopt
rather than ifcvt.

cinc_common_1.c is xfailed because of missing pattern in the aarch64
backend, PR112304.

fuse_cmp_csel.c needed to be updated since the add is now after the
cmp/csel pair and ira puts the constants formation inbetween the cmp/csel.
fuse_cmp_csel-1.c is new version where there is no constant formation.

changes since v1:
* v2: Fix some comments. Add CEIL_MOD_EXPR and ROUND_MOD_EXPR to
is_divide_or_mod_p. Remove operand_equal from POINTER_PLUS case.
xfail cinc_common_1.c. Fixed up fuse_cmp_csel.c testcase.
* v3: Fix up cost model, was only calling is_factor_profitable on
the different operands when it needs to be on all operands.
* v4: Move is_divide_or_mod_p to tree.h with a rename to int_divide_or_mod_p.
Move find_different_opnum to gimple-match-exports.cc/gimple-match.h.

PR tree-optimization/125557
PR tree-optimization/64700
PR tree-optimization/29144
PR tree-optimization/94274
gcc/ChangeLog:

* tree-if-conv.cc (find_different_opnum): Move to ...
* gimple-match-exports.cc (find_different_opnum): Here.
* gimple-match.h (find_different_opnum): New decl.
* tree-ssa-phiopt.cc (is_factor_profitable): Take
gimple_match_op instead of one operand.
Rearrange the code to check the lifetime of the operands last.
(factor_out_conditional_operation): Handle operands > 1,
including operands communitive operands. Add early_p argument
for costing. Update call of is_factor_profitable.
(pass_phiopt::execute): Pass early_p to
factor_out_conditional_operation.
* tree.h (int_divide_or_mod_p): New function.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/recip-3.c: Disable phiopt since it removes
one division and recip pass needs 3.
* gcc.dg/tree-ssa/recip-5.c: Likewise.
* gcc.dg/tree-ssa/recip-6.c: Likewise.
* gcc.dg/tree-ssa/recip-7.c: Likewise.
* gcc.dg/tree-ssa/slsr-12.c: xfail.
* gcc.dg/tree-ssa/slsr-34.c: Likewise.
* gcc.dg/tree-ssa/pr122629-1.c: Update to scan phiopt1.
* gcc.dg/vect/vect-reduc-cond-2.c: Likewise.
* gcc.dg/tree-ssa/phi-factor-binary-1.c: New test.
* gcc.dg/tree-ssa/phi-factor-binary-2.c: New test.
* gcc.target/aarch64/phi-factor-binary-1.c: New test.
* gcc.target/aarch64/cinc_common_1.c: xfail.
* gcc.target/aarch64/fuse_cmp_csel.c: xfail.
* gcc.target/aarch64/fuse_cmp_csel-1.c: New test.

Co-authored-by: Kyrylo Tkachov <ktkachov@nvidia.com>
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
7 days agolibgomp.fortran/rwlock_1.f90: Ensure unique file name with many threads [PR113005]
Lipeng Zhu [Fri, 12 Jun 2026 08:40:39 +0000 (10:40 +0200)] 
libgomp.fortran/rwlock_1.f90: Ensure unique file name with many threads [PR113005]

libgomp/ChangeLog:

PR testsuite/113005
* testsuite/libgomp.fortran/rwlock_1.f90: Enlarge buffer size of
'file_name' handling 5 instead of 3 digit I/O unit numbers.

7 days agoAlign IRA and LRA when it comes to rejecting equivalences
Stefan Schulze Frielinghaus [Fri, 12 Jun 2026 07:53:48 +0000 (09:53 +0200)] 
Align IRA and LRA when it comes to rejecting equivalences

During costing of IRA, pseudos with an equivalence are taken out of the
equation by assigning MEM to those.  However, during LRA, some
equivalences are rejected which means those previously spilled pseudos
are then definitely spilled.  In some cases, like for PIC, we already
know during IRA that an equivalence will be rejected during LRA.
Therefore, do not assign MEM to those pseudos during IRA which means
there is a fair chance that they get a register assigned in the end.

The attached tests are all derived from glibc.  Without this patch some
pseudos are spilled resulting in stack frames just due to those spills.
With this patch, no pseudos are spilled and no unnecessary stack frames
are set up.

Note, the added conjunct in find_costs_and_classes() is basically the
negated form of the disjunct from lra_constraints()

  || (pic_offset_table_rtx
      && ((const_pool_ok_p (PSEUDO_REGNO_MODE (i), x)
           && (targetm.preferred_reload_class
               (x, lra_get_allocno_class (i)) == NO_REGS))
          || contains_symbol_ref_p (x))))

except that IRAs reg_allocno_class() is used instead of LRAs
lra_get_allocno_class().

gcc/ChangeLog:

* ira-costs.cc (find_costs_and_classes): Do not honour equivs if
they get rejected by LRA anyway.
* ira-int.h (CONST_POOL_OK_P): Move CONST_POOL_OK_P here ...
* lra-constraints.cc (CONST_POOL_OK_P): from there.

gcc/testsuite/ChangeLog:

* gcc.target/s390/ira-pic-spill-1.c: New test.
* gcc.target/s390/ira-pic-spill-2.c: New test.
* gcc.target/s390/ira-pic-spill-3.c: New test.

7 days agoDaily bump.
GCC Administrator [Fri, 12 Jun 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

7 days agoAVR: Tweak __floatdidf, __floatundidf.
Georg-Johann Lay [Thu, 11 Jun 2026 19:31:05 +0000 (21:31 +0200)] 
AVR: Tweak __floatdidf, __floatundidf.

libgcc/config/avr/libf7/
* libf7.c (__floatdidf, __floatundidf): Minor tweak.

7 days agoImplement warnings based on variable definition and use.
Thomas Koenig [Tue, 9 Jun 2026 05:09:23 +0000 (07:09 +0200)] 
Implement warnings based on variable definition and use.

This patch grew from trying to implement PR 30438 into something bigger.
This now warns about variables which were never defined, but are used
via a new option -Wundefined-vars and implements
-Wunused-but-set-variable for Fortran.

It works by keeping tabls of several things in the attributes of a
variable: If and how it has been set (via value_set), used (via
value_used), if it has been allocated (via allocated) and if a
warning has already been emitted for the symbol.  This looks at
statements in a namespace only; control flow is *not* considered.

In every corner of the compiler that I could find where values are
set or used, flags are set accodingly. Updates are done if the new
use is considered to be more "important" than the old one. The
location of use or definition is also recorded, as is the place
where a variable may be allocated.

After all the flags have been correctly set (one at least hopes)
gfc_resolve then calls warn_unused_vs_set, which then iterates
over the symbols, calling find_unused_vs_set where all warnings
are emitted. I tried to be conservative here to avoid false
positives, so a whole lot of conditions are excluded (see the top
of the function).

I thought a bit on where to put -Wunused-read and -Wunused-intent-out.
While reading in a value and then not using it, or getting it from an
INTENT(OUT) argument may be dubious, people could use it for skipping
over unneeded data or because an API requires it. Hence, I feld that -Wall
would be too harsh, but I am open to discussion here.

The warn_undefined_vars_* tests are split because the testsuite would
not find warnings in certain lines even though they were issued and
I tried out ! { dg-warning ".+" } . I suspect some strangeness/bug
in gfortran.dg, but did not investigate further.

gcc/fortran/ChangeLog:

PR fortran/30438
PR fortran/28004
* dump-parse-tree.cc (gfc_debug_code_node): New function.
(show_attr): Add select_rank_temporary. Fix typo. Add referenced,
value_set, allocated and value_used.
* gfortran.h (enum value_set): New enum.
(enum value_used): New enum.
(gfc_symbol): Add value_set, value_used, allocated and
warning_emitted attributes.  Rename formal_at to other_loc.
Add extra_loc.
(gfc_value_set_at): Add prototype.
(gfc_lvalue_allocated_at): Likewise.
(gfc_mark_lhs_as_used): Likewise.
(gfc_value_used_expr): Likewise.
(gfc_value_set_and_used): Likewise.
(gfc_used_in_allocate_expr): Likewise.
* interface.cc (gfc_compare_actual_formal): Mark actual arguments
according to INTENT and VALUE on formal arguments.
(gfc_procedure_use): Add VALUE_ARG/VALUE_MAYBE_USED for
implicit arguments.
* intrinsic.cc (mark_args_as_used): New function.
(init_arglist): Adjust comment.
(gfc_intrinsic_sub_interface): Use mark_args_as_used.
* invoke.texi: Document -Wundefined-vars, -Wunused-intent-out and
-Wunused-read.
* io.cc (resolve_tag_format): Mark expressions as used.
(resolve_tag): Mark as used or set, depending on tag.
(gfc_resolve_dt): Mark internal unit as set.
(gfc_resolve_inquire): Mark value as set for INQUIRE_RESOLVE_TAG macro.
* lang.opt: Add -Wundefined-vars, -Wunused-intent-out and -Wunused-read.
* lang.opt.urls: Regenerated.
* resolve.cc (resolve_function): Replace formal_at by other_loc.
(resolve_call): Likewise.
(gfc_resolve_iterator): Mark iterator variable as set and used and
other expressions as used.
(resolve_forall_iterators): Likewise.
(resolve_allocate_expr): On success, call gfc_used_in_allocate_expr
and mark value as set if source is present.
(resolve_transfer): Mark set/read according to context.
(gfc_resolve_blocks): Mark expr1 and expr2 as used.
(mark_lhs_assignments_set): Prototype / new function.
(gfc_resolve_code): Mark expr2, expr3 and expr4 as used.
(var_value_is_used): New function.
(var_value_is_set): New function.
(find_unused_vs_set): New function.
(warn_unused_vs_set): New function.
(gfc_resolve): Call warn_unused_vs_set.
* symbol.cc (gfc_value_set_at): New function.
(mark_vars_as_used): New function.
(gfc_value_used_expr): New function.
(gfc_value_set_and_used): New function.
(gfc_used_in_allocate_expr): new function.
(gfc_lvalue_allocated_at): New function.
* trans-decl.cc (gfc_finish_var_decl): If we already emitted a warning,
suppress further middle-end warning o that variable.

libgfortran/ChangeLog:

PR fortran/30438
PR fortran/28004
* mk-kinds-h.sh: Add print statement so test will compile with -Wall -Werror.
* mk-sik-inc.sh: Likewise.
* mk-srk-inc.sh: Likewise.

libgomp/ChangeLog:

PR fortran/30438
PR fortran/28004
* testsuite/libgomp.fortran/alloc-1.F90: Shut up -Wunused-but-set-variable.
* testsuite/libgomp.fortran/alloc-12.f90: Likewise.

gcc/testsuite/ChangeLog:

PR fortran/30438
PR fortran/28004
* gfortran.dg/allocatable_length.f90: Add -Wno-undefined-vars.
* gfortran.dg/allocatable_scalar_6.f90: Likewise.
* gfortran.dg/allocatable_uninitialized_1.f90: Add -Wno-unused-but-set-variable
-Wno-undefined-vars.
* gfortran.dg/assignment_4.f90: Add -Wno-undefined-vars.
* gfortran.dg/attr_deprecated-2.f90: Likewise.
* gfortran.dg/c_by_val_5.f90: Add -Wno-unused-but-set-variable.
* gfortran.dg/char_component_initializer_2.f90: Shut up warning.
* gfortran.dg/char_length_1.f90: Add statement to shut up warning.
* gfortran.dg/constructor_9.f90: Add -Wno-unused-but-set-variable.
* gfortran.dg/gamma_2.f90: Add statement to shut up warning.
* gfortran.dg/gomp/allocate-10.f90: Add -Wno-unused-but-set-variable.
* gfortran.dg/io_constraints_8.f90: Likewise.
* gfortran.dg/label_5.f90: Likewise.
* gfortran.dg/len_trim.f90: Likewise.
* gfortran.dg/linefile.f90: Likewise.
* gfortran.dg/pointer_check_13.f90: Add dg-warning.
* gfortran.dg/pr102366.f90: Add -Wno-unused-but-set-variable.
* gfortran.dg/pr103475.f90: Likewise.
* gfortran.dg/pr91497.f90: Likewise.
* gfortran.dg/pr91497_2.f90: Likewise.
* gfortran.dg/pr96312.f90: Likewise.
* gfortran.dg/pr98411.f90: Likewise.
* gfortran.dg/transfer_check_4.f90: Likewise.
* gfortran.dg/warnings_are_errors_1.f90: Add print statement.
* gfortran.dg/warn_undefined_vars_1.f90: New test.
* gfortran.dg/warn_undefined_vars_2.f90: New test.
* gfortran.dg/warn_undefined_vars_3.f90: New test.
* gfortran.dg/warn_undefined_vars_4.f90: New test.
* gfortran.dg/warn_unused_intent_out_1.f90: New test.
* gfortran.dg/warn_unused_read_1.f90: New test.

7 days agotestsuite, c++: Account for emulated TLS in attr tests.
Iain Sandoe [Thu, 11 Jun 2026 18:30:41 +0000 (19:30 +0100)] 
testsuite, c++: Account for emulated TLS in attr tests.

The output for emulated TLS does not match that of native.

gcc/testsuite/ChangeLog:

* c-c++-common/tls-attr-common.c: Add emulated TLS
matches.
* c-c++-common/tls-attr-le-pic.c: Likewise.
* c-c++-common/tls-attr-le-pie.c: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 days agoRevert "testsuite, i386: add win64 AVX indirect alignment tests [PR54412]"
Jonathan Yong [Thu, 11 Jun 2026 18:47:48 +0000 (18:47 +0000)] 
Revert "testsuite, i386: add win64 AVX indirect alignment tests [PR54412]"

This reverts commit fc811192bb897b3244da0d99894a3909281e3b63.
Remove mingw specific test cases in preparation for reworks.

gcc/testsuite:

* gcc.target/i386/pr54412-avx512-aligned64.c: Remove.
* gcc.target/i386/pr54412-callee-byref-param.c: Remove.
* gcc.target/i386/pr54412-o2-by-value-cases.c: Remove.
* gcc.target/i386/pr54412-sret-no-args.c: Remove.
* gcc.target/i386/pr54412-v4d-o0-aligned-locals.c: Remove.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
7 days agoaarch64: Make assembler bug workaround configurable.
Iain Sandoe [Fri, 20 Oct 2023 08:57:28 +0000 (09:57 +0100)] 
aarch64: Make assembler bug workaround configurable.

Some assmblers have a bug that requires +crc to be emitted even
though the base architecture supports it.  However, that also
triggers a different bug in another assembler.  So make the fix
configurable.

gcc/ChangeLog:

* common/config/aarch64/aarch64-common.cc: Make the asm
crc bug workaround configurable.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 days agotestsuite, c++, Darwin: Use scan-weak and scan-not-weak for portability.
Iain Sandoe [Thu, 11 Jun 2026 15:31:06 +0000 (16:31 +0100)] 
testsuite, c++, Darwin: Use scan-weak and scan-not-weak for portability.

In order to get this test to work on Darwin, I would need to edit pretty much
every line.  We have portability helpers for weak symbol scans, let's use them.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/visibility1.C: Use scan-weak/scan-not-weak to
improve portability.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 days agoAVR: target/125751 -- Fix too short insns lengths in avr_out_fract.
Georg-Johann Lay [Thu, 11 Jun 2026 17:51:12 +0000 (19:51 +0200)] 
AVR: target/125751 -- Fix too short insns lengths in avr_out_fract.

PR target/125751
gcc/
* config/avr/avr.cc (avr_out_fract): Fix too small sequence
lengths in avr_asm_len calls.

7 days agoAVR: target/125752 - Add 64-bit fixed point <-> 64-bit double conversions.
Georg-Johann Lay [Thu, 11 Jun 2026 17:35:09 +0000 (19:35 +0200)] 
AVR: target/125752 - Add 64-bit fixed point <-> 64-bit double conversions.

PR target/125752
libgcc/config/avr/libf7/
* libf7-asm.sx (ufx64_to_d, d_to_fx64): New DEFUNs.
(__fractdadf, __fractudadf, __fracttadf, __fractutadf)
(__fractdqdf, __fractudqdf): New _DEFUNs.
* libf7-common.mk (F7_ASM_PARTS) Add: fx2D, D2fx,
dq2D, udq2D, da2D, uda2D, ta2D uta2D.
(F7F): Add d_to_fx64, ufx64_to_d, sfx64_to_d.
* libf7.c (d_to_ufx, d_to_sfx): New protos.
(__fractdfda, __fractdfuda, __fractdfta, __fractdfuta)
(__fractdfdq, __fractdfudq): New modules.
* t-libf7 (LIBF7_DF_CONV): Add fractdfda,
fractdfta, fractdfdq, fractdfuda, fractdfuta, fractdfudq.
* f7-renames.h: Rebuild.

gcc/testsuite/
* gcc.target/avr/torture/fx-to-double.c: New test.

7 days ago[PATCH] gcov: Fix correctness check for control flow graph solving
Roman Beliaev [Thu, 11 Jun 2026 15:41:25 +0000 (09:41 -0600)] 
[PATCH] gcov: Fix correctness check for control flow graph solving

The check did not actually work due to the wrong condition in a for loop, which
was always false.

gcc/ChangeLog:

* gcov.cc (solve_flow_graph): Fix condition.

7 days agodoc: Replace "fixed-point" with "integral"
Karl Meakin [Thu, 29 May 2025 11:55:34 +0000 (11:55 +0000)] 
doc: Replace "fixed-point" with "integral"

In some places the documentation refers to "fixed-point" types or values
when talking about plain integer types (eg `int` or `uint32_t`).

Although this is meant to mean "the opposite of floating-point", it is
misleading and can be confused with the fractional types that are also known as
"fixed-point".

For the avoidance of doubt, refer to plain integer types and values as "integral"
throughout.

Testing done:
`make info` and `make dvi`

gcc/ChangeLog:
* doc/rtl.texi: Replace "fixed-point" with "integral" where
appropriate.

7 days agoRefine modulo range operations with fixed quotient.
Andrew MacLeod [Wed, 10 Jun 2026 13:41:27 +0000 (09:41 -0400)] 
Refine modulo range operations with fixed quotient.

When all combines of x / y produce the same quotient Q, further refine
modulo operations by treating x % y ==  x - Q * y

PR tree-optimization/125706
gcc/
* range-op.cc (operator_trunc_mod::wi_fold): Apply fixed
quotient refinement.
gcc/testsuite/
* gcc.dg/pr125706.c: New.

7 days agoamdgcn: Fix missing comma from REG_CLASS_NAMES
Andrew Stubbs [Thu, 11 Jun 2026 13:24:20 +0000 (13:24 +0000)] 
amdgcn: Fix missing comma from REG_CLASS_NAMES

There was a comma missing from Arsen's patch, but the only affect was in dump
files so it wasn't immediately obvious.

gcc/ChangeLog:

* config/gcn/gcn.h (REG_CLASS_NAMES): Add missing comma.

7 days ago[AArch64]: Use MOVI for low‑64‑bit integer SIMD constant vectors [PR113926]
Naveen [Thu, 11 Jun 2026 13:26:23 +0000 (06:26 -0700)] 
[AArch64]: Use MOVI for low‑64‑bit integer SIMD constant vectors [PR113926]

Extend AdvSIMD constant materialization to recognize 128‑bit integer vector
constants where the low 64 bits contain a duplicated scalar value and the high
64 bits are zero.
Bootstrapped and tested on aarch64-linux-gnu.

gcc/ChangeLog:
PR target/113926
* config/aarch64/aarch64.cc (struct simd_immediate_info): Add width
field to record AdvSIMD output vector width.
(simd_immediate_info::simd_immediate_info): Initialize width to zero
in all constructors.
(aarch64_simd_valid_imm): Allow 128-bit AdvSIMD MOV immediates with
zero high 64 bits to be materialized using 64-bit MOVI.
(aarch64_output_simd_imm): Use recorded immediate width when outputting
AdvSIMD immediates.

gcc/testsuite/ChangeLog:
PR target/113926
* gcc.target/aarch64/pr113926.c: New test.
* gcc.target/aarch64/pr113926_1.c: New test.

Signed-off-by: Naveen <naveen.siddegowda@oss.qualcomm.com>
7 days agotree-optimization - Require size > 1 for SLP reduction subgroups
Zhongyao Chen [Wed, 14 Jan 2026 11:38:02 +0000 (11:38 +0000)] 
tree-optimization - Require size > 1 for SLP reduction subgroups

The SLP reduction subgroup analysis can succeed for size-1 groups,
but this leads to poor code generation.  Size-1 cases should fall
back to single-lane reduction instead.

Handle size-1 groups by returning false from the analysis function,
and add a loop exit check to avoid unnecessary processing.

PR tree-optimization/123343

gcc/ChangeLog:

* tree-vect-slp.cc (vect_analyze_slp_reduction_group): Return
false for group_size <= 1 at entry.
(vect_analyze_slp_reductions): Add loop exit check for
group_size <= 1.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/slp-reduc-var.c: New testcase.

Signed-off-by: Zhongyao Chen <chen.zhongyao@zte.com.cn>
7 days agodoc: testsuite: Simplify implementation and document arm_mixed_fp [PR113276]
Torbjörn SVENSSON [Fri, 10 Apr 2026 09:47:56 +0000 (11:47 +0200)] 
doc: testsuite: Simplify implementation and document arm_mixed_fp [PR113276]

The documentation should have been part of r16-8549-g3d30fc2f73ccc1.

gcc/ChangeLog:

PR testsuite/113276
* doc/sourcebuild.texi (arm_mixed_fp): Document.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (arm_mixed_fp): Simplify
implementation.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
8 days agocobol: Improve execution speed of MOVE NumericDisplay TO COMP-3
Robert Dubner [Thu, 11 Jun 2026 03:42:20 +0000 (23:42 -0400)] 
cobol: Improve execution speed of MOVE NumericDisplay TO COMP-3

gcc/cobol/ChangeLog:

* move.cc (mh_packed_to_packed): Moved.
(mh_numdisp_to_packed): New function.
(move_helper): Use mh_numdisp_to_packed().
(hex_msg): New debugging function.
* parse.y: Enable __gg__char_national().

libgcobol/ChangeLog:

* intrinsic.cc (__gg__char_national): New function.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/MOVE_NumericDisplay_to_COMP-3.cob: New test.
* cobol.dg/group2/MOVE_NumericDisplay_to_COMP-3.out: New test.

8 days agoFortran: [PR93727] Add EX format READ (read_ex)
Jerry DeLisle [Tue, 26 May 2026 04:13:19 +0000 (21:13 -0700)] 
Fortran: [PR93727] Add EX format READ (read_ex)

Implement read_ex in libgfortran to handle EX edit-descriptor input
per Fortran 2023 13.7.2.3.6.  The input field may contain:

  * a hexadecimal-significand form (0X<sig>P<exp>) passed directly
    to the C strtod/strtold family for exact bit-for-bit conversion;
  * any form acceptable for Fw.d input (decimal fallback), including
    INF and NAN representations.

For decimal input without a decimal point the d field of the EX.w.d
descriptor adjusts the exponent exactly as for Fw.d.  BN/BZ blank
handling and the kP scale factor are also supported via the shared
decimal path.

Assisted by: Claude Sonnet 4.6

PR fortran/93727

libgfortran/ChangeLog:

* io/read.c (read_ex): New function implementing EX format read.
* io/io.h (read_ex): Declare.
* io/transfer.c (formatted_transfer_scalar_read): Add FMT_EX case
dispatching to read_ex.

gcc/testsuite/ChangeLog:

* gfortran.dg/EXformat_4.F90: New test covering EX format read
for kind=4 and 8 (always) and kind=10, 16 (when available):
hex-significand literals, lowercase prefix, negative binary
exponent, decimal fallback, d-field adjustment, INF/NAN, zero
field, and round-trips through write_ex.

8 days agoi386: Add FMV support for avx10.2 and apxf
Hongyu Wang [Wed, 3 Jun 2026 02:21:11 +0000 (07:51 +0530)] 
i386: Add FMV support for avx10.2 and apxf

Add function multiversioning priority for avx10.2 and apxf features,
and add P_PROC_AVX10_2 for processors that support these, like
diamondrapids and novalake.

The priority order is:
  P_AVX10_1 < P_PROC_AVX10_1 < P_AVX10_2 < P_APX_F < P_PROC_AVX10_2

gcc/ChangeLog:

* common/config/i386/i386-cpuinfo.h (enum feature_priority):
Add P_AVX10_2, P_APX_F, P_PROC_AVX10_2.
* common/config/i386/i386-isas.h: Set P_AVX10_2 for avx10.2
and P_APX_F for apxf.
* common/config/i386/i386-common.cc (processor_alias_table):
Use P_PROC_AVX10_2 for diamondrapids and novalake.

gcc/testsuite/ChangeLog:

* gcc.target/i386/mvc18.c: New test for target_clones with
avx10.2, apxf, and arch=diamondrapids/novalake.