]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
20 hours agoDaily bump. releases/gcc-15
GCC Administrator [Thu, 6 Nov 2025 00:29:43 +0000 (00:29 +0000)] 
Daily bump.

44 hours agoDaily bump.
GCC Administrator [Wed, 5 Nov 2025 00:26:25 +0000 (00:26 +0000)] 
Daily bump.

2 days agoAda: Fix visibility bug related to target name
Bob Duff [Wed, 20 Aug 2025 18:07:14 +0000 (14:07 -0400)] 
Ada: Fix visibility bug related to target name

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

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

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

2 days agoc++: Don't constrain template visibility using no-linkage variables [PR122253]
Nathaniel Shead [Thu, 16 Oct 2025 11:51:23 +0000 (22:51 +1100)] 
c++: Don't constrain template visibility using no-linkage variables [PR122253]

When finding the minimal visibility of a template, any reference to a
dependent automatic variable will cause the instantiation to be marked
as internal linkage.  However, when processing the template decl we
don't yet know whether that should actually be the case, as a given
instantiation may not require referencing the local decl in its
mangling.

This patch fixes the issue by checking for no-linkage decls first, in
which case we just constrain using the type of the entity.  We can't use
a check for lk_external/lk_internal in the other cases, as
instantiations referring to internal types can still have external
linkage as determined by the language, but should still constrain the
visibility of any declarations that refer to them.

PR c++/122253

gcc/cp/ChangeLog:

* decl2.cc (min_vis_expr_r): Don't mark no-linkage declarations
as VISIBILITY_ANON.

gcc/testsuite/ChangeLog:

* g++.dg/modules/internal-16.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit f062a6b7985fcee82e02b626aada4e0824850bd0)

2 days agoDaily bump.
GCC Administrator [Tue, 4 Nov 2025 00:26:35 +0000 (00:26 +0000)] 
Daily bump.

3 days ago[PR rtl-optimization/122321][RISC-V] Bounds check another access to ira_reg_equiv...
Jeff Law [Sat, 1 Nov 2025 14:30:41 +0000 (08:30 -0600)] 
[PR rtl-optimization/122321][RISC-V] Bounds check another access to ira_reg_equiv array

So another case where we're indexing into the ira_reg_equiv array without
checking bounds.  I sincerely hope we're not playing wack-a-mole here, but two
failures in a couple months for the same core problem is worrisome.

Bootstrapped and regression tested on x86_64 and riscv64 as well as run through
all the embedded targets in my tester without regressions.

PR rtl-optimization/122321
gcc/
* lra-constraints.cc (update_equiv): Make sure REGNO is in
ira_reg_equiv before trying to update ira_reg_equiv.

gcc/testsuite/
* gcc.target/riscv/rvv/autovec/pr122321.c: New test.

(cherry picked from commit ac3eeb987ad04923ddc57a9dc9bd4ec98146a981)

3 days agoriscv: Fix gimple folding of the vset* intrinsics [PR122270]
Andrew Pinski [Wed, 15 Oct 2025 16:59:25 +0000 (09:59 -0700)] 
riscv: Fix gimple folding of the vset* intrinsics [PR122270]

The problem here is that when the backend folds the vset intrinsics,
it tries to keep the lhs of the new statement to be the same as the old statement
due to the check in gsi_replace. The problem is with a MEM_REF vset::fold was
unsharing the new lhs here and using the original lhs in the other new statement.
This meant the check in gsi_replace would fail.
This fixes that oversight by switching around which statement gets the unshared
version.

Note the comment in vset::fold was already correct just not matching the code:
    /* Replace the call with two statements: a copy of the full tuple
       to the call result, followed by an update of the individual vector.

       The fold routines expect the replacement statement to have the
       same lhs as the original call, so return the copy statement
       rather than the field update.  */

Changes since v1:
* v2: Fix testcase.

PR target/122270

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc (vset::fold): Use the
unshare_expr for the statement that will be added seperately rather
the one which will be used for the replacement.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr122270-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(cherry picked from commit 42f5f1004ff16ab25b97d3315a365614c68c6201)

3 days agoDaily bump.
GCC Administrator [Mon, 3 Nov 2025 00:26:17 +0000 (00:26 +0000)] 
Daily bump.

4 days agoAVR: target/122527 -- Don't use __load_N to load from __flash1.
Georg-Johann Lay [Sun, 2 Nov 2025 14:12:59 +0000 (15:12 +0100)] 
AVR: target/122527 -- Don't use __load_N to load from __flash1.

This patch fixes a case where a 3 byte or 4 byte load from __flash1
uses __load_3/4 to read the value, which is wrong.

This only occured when the device has ELPM but not ELPMx (avr31).

PR target/122527
gcc/
* config/avr/avr.cc (avr_load_libgcc_p): Return false if
the address-space is not ADDR_SPACE_FLASH.
(avr_out_lpm_no_lpmx [addr=REG]): Handle sizes of 3 and 4 bytes.

(cherry picked from commit 0b2c031cca4017c5f87af519f0977b33b4bcb284)

4 days agoAVR: PR122505 - Fix bloated mulpsi3 in the wake of hacking around PR118012.
Georg-Johann Lay [Sat, 1 Nov 2025 16:33:13 +0000 (17:33 +0100)] 
AVR: PR122505 - Fix bloated mulpsi3 in the wake of hacking around PR118012.

Since the PR118012 work-around patch, there is an SImode insn also for
the non-MUL case, but there is no mulpsi3.  This makes the middle-end
use the mulsi3 insn for 24-bit multipications like in:

__uint24 mul24 (__uint24 a, __uint24 b)
{
    return a * b;
}

which will be compiled to:

mul24:
    push r28         ;  34  [c=4 l=1]  pushqi1/0
    push r29         ;  35  [c=4 l=1]  pushqi1/0
    in r28,__SP_L__  ;  47  [c=4 l=2]  *movhi/7
    in r29,__SP_H__
    sbiw r28,8   ;  48  [c=8 l=1]  *addhi3/2
    in __tmp_reg__,__SREG__  ;  38  [c=8 l=5]  movhi_sp_r/2
    cli
    out __SP_H__,r29
    out __SREG__,__tmp_reg__
    out __SP_L__,r28
/* prologue: function */
/* frame size = 8 */
/* stack size = 10 */
    std Y+1,r22  ;  49  [c=4 l=1]  movqi_insn/2
    std Y+2,r23  ;  50  [c=4 l=1]  movqi_insn/2
    std Y+3,r24  ;  51  [c=4 l=1]  movqi_insn/2
    std Y+5,r18  ;  52  [c=4 l=1]  movqi_insn/2
    std Y+6,r19  ;  53  [c=4 l=1]  movqi_insn/2
    std Y+7,r20  ;  54  [c=4 l=1]  movqi_insn/2
    ldd r18,Y+1  ;  55  [c=4 l=1]  movqi_insn/3
    ldd r19,Y+2  ;  56  [c=4 l=1]  movqi_insn/3
    ldd r20,Y+3  ;  57  [c=4 l=1]  movqi_insn/3
    ldd r21,Y+4  ;  58  [c=4 l=1]  movqi_insn/3
    ldd r22,Y+5  ;  59  [c=4 l=1]  movqi_insn/3
    ldd r23,Y+6  ;  60  [c=4 l=1]  movqi_insn/3
    ldd r24,Y+7  ;  61  [c=4 l=1]  movqi_insn/3
    ldd r25,Y+8  ;  62  [c=4 l=1]  movqi_insn/3
    call __mulsi3    ;  33  [c=20 l=2]  *mulsi3_call_pr118012
/* epilogue start */
    adiw r28,8   ;  63  [c=8 l=1]  *addhi3/2
    in __tmp_reg__,__SREG__  ;  42  [c=8 l=5]  movhi_sp_r/2
    cli
    out __SP_H__,r29
    out __SREG__,__tmp_reg__
    out __SP_L__,r28
    pop r29      ;  43  [c=4 l=1]  popqi
    pop r28      ;  44  [c=4 l=1]  popqi
    ret

where the expected code is simply:

mul24:
    call __mulpsi3   ;  9   [c=20 l=2]  call_value_insn/1
/* epilogue start */
    ret      ;  24  [c=0 l=1]  return

The patch just allows the mulpsi3 insn for the non-MUL case, except for
AVR_TINY which passes the 2nd argument on the stack so no insn can be used.

The change might be beneficial even in the absence of PR118012 because
the __mulpsi3 footprint is leaner than a libcall.

PR tree-optimization/118012
PR tree-optimization/122505
gcc/
* config/avr/avr.md (mulpsi3): Also allow the insn condition
in the case where avropt_pr118012 && !AVR_TINY.
(*mulpsi3): Handle split for the !AVR_HAVE_MUL case.
(*mulpsi3-nomul.libgcc_split, *mulpsi3-nomul.libgcc): New insns.

(cherry picked from commit ad8de026441c3e57c4761b1c595ace92ed21c254)

4 days agoc++/modules: Track all static class variables [PR122421]
Nathaniel Shead [Sun, 26 Oct 2025 11:27:33 +0000 (22:27 +1100)] 
c++/modules: Track all static class variables [PR122421]

The linker error in the PR is caused because when a static is defined
out of the class body, it doesn't yet have a definition and so
read_var_def (which would otherwise have noted it) never gets called.

This instead moves the responsibility for noting class-scope variables
to read_class_def.

PR c++/122421

gcc/cp/ChangeLog:

* module.cc (trees_in::read_var_def): Don't handle class-scope
variables anymore.
(trees_in::read_class_def): Handle them here instead.

gcc/testsuite/ChangeLog:

* g++.dg/modules/inst-6_a.C: New test.
* g++.dg/modules/inst-6_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit fd5c057c2d01346d69119f88ca94debf27842e4e)

4 days agoDaily bump.
GCC Administrator [Sun, 2 Nov 2025 00:27:20 +0000 (00:27 +0000)] 
Daily bump.

5 days agoFortran: IS_CONTIGUOUS and pointers to non-contiguous targets [PR114023]
Harald Anlauf [Fri, 24 Oct 2025 19:33:08 +0000 (21:33 +0200)] 
Fortran: IS_CONTIGUOUS and pointers to non-contiguous targets [PR114023]

PR fortran/114023

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_trans_pointer_assignment): Always set dtype
when remapping a pointer.  For unlimited polymorphic LHS use
elem_len from RHS.
* trans-intrinsic.cc (gfc_conv_is_contiguous_expr): Extend inline
generated code for IS_CONTIGUOUS for pointer arguments to detect
when span differs from the element size.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 3f8b6373f48af0eabbc2efe04df8f6856add3111)

5 days agoFortran: fix TRANSFER of subarray component references [PR122386]
Harald Anlauf [Thu, 23 Oct 2025 19:21:04 +0000 (21:21 +0200)] 
Fortran: fix TRANSFER of subarray component references [PR122386]

Commit r16-518 introduced a change that fixed inquiry references of complex
arrays as argument to the TRANSFER intrinsic by forcing a temporary.  The
solution taken however turned out not to be generalizable to component
references of nested derived-type arrays.  A better way is the revert that
patch and force the generation of a temporary when the SOURCE expression is
a not simply-contiguous array.

PR fortran/122386

gcc/fortran/ChangeLog:

* dependency.cc (gfc_ref_needs_temporary_p): Revert r16-518.
* trans-intrinsic.cc (gfc_conv_intrinsic_transfer): Force temporary
for SOURCE not being a simply-contiguous array.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 2febf3b968329aceeeea7805af98ed98a8c67e75)

5 days agoc++/modules: Stream BASELINK_OPTYPE [PR122381]
Nathaniel Shead [Sat, 1 Nov 2025 11:59:33 +0000 (22:59 +1100)] 
c++/modules: Stream BASELINK_OPTYPE [PR122381]

This is used in template conversion operators to determine what type the
user requested.

PR c++/122381

gcc/cp/ChangeLog:

* module.cc (trees_out::core_vals): Write BASELINK_OPTYPE (aka
TREE_CHAIN).
(trees_in::core_vals): Read it.

gcc/testsuite/ChangeLog:

* g++.dg/modules/convop-2_a.H: New test.
* g++.dg/modules/convop-2_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
(cherry picked from commit b466450c6d502557921f03527cc165fb3402aaa9)

5 days agoDaily bump.
GCC Administrator [Sat, 1 Nov 2025 00:25:36 +0000 (00:25 +0000)] 
Daily bump.

6 days agovect: Fix operand swapping on complex multiplication detection [PR122408]
Tamar Christina [Mon, 27 Oct 2025 17:55:38 +0000 (17:55 +0000)] 
vect: Fix operand swapping on complex multiplication detection [PR122408]

For

SUBROUTINE a( j, b, c, d )
  !GCC$ ATTRIBUTES noinline :: a
  COMPLEX*16         b
  COMPLEX*16         c( * ), d( * )
  DO k = 1, j
     c( k ) = - b * CONJG( d( k ) )
  END DO
END

we incorrectly generate .IFN_COMPLEX_MUL instead of .IFN_COMPLEX_MUL_CONJ.

The issue happens because in the call to vect_validate_multiplication the
operand vectors are passed by reference and so the stripping of the NEGATE_EXPR
after matching modifies the input vector.  If validation fail we flip the
operands and try again.  But we've already stipped the negates and so if we
match we would match a normal multiply.

This fixes the API by marking the operands as const and instead pass an explicit
output vec that's to be used.  This also reduces the number of copies we were
doing.

With this we now correctly detect .IFN_COMPLEX_MUL_CONJ.  Weirdly enough I
couldn't reproduce this with any C example because they get reassociated
differently and always succeed on the first attempt.  Fortran is easy to
trigger though so new fortran tests added.

gcc/ChangeLog:

PR tree-optimization/122408
* tree-vect-slp-patterns.cc (vect_validate_multiplication): Cleanup and
document interface.
(complex_mul_pattern::matches, complex_fms_pattern::matches): Update to
new interface.

gcc/testsuite/ChangeLog:

PR tree-optimization/122408
* gfortran.target/aarch64/pr122408_1.f90: New test.
* gfortran.target/aarch64/pr122408_2.f90: New test.

(cherry picked from commit c5fa3d4c88fc4f8799318e463c47941eb52b7546)

6 days agoLoongArch: Only allow valid binary op when optimize conditional move
Jinyang He [Wed, 29 Oct 2025 08:07:35 +0000 (16:07 +0800)] 
LoongArch: Only allow valid binary op when optimize conditional move

It is wrong that optimize from `if (cond) dest op= 1 << shift` to
`dest op= (cond ? 1 : 0) << shift` when `dest op 0 != dest`.
Like `and`, `mul` or `div`.
And in this optimization `mul` and `div` is optimized to shift.

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_expand_conditional_move): Only allow valid binary
op when optimize conditional move.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/conditional-move-opt-1.c: Remove mul.
* gcc.target/loongarch/conditional-move-opt-2.c: Remove and.
* gcc.target/loongarch/conditional-move-opt-3.c: New test.

Co-Authored-By: Peng Fan <fanpeng@loongson.cn>
(cherry picked from commit 824eae920f0f64dd7687c969a2436b129161fdc9)

6 days agoDaily bump.
GCC Administrator [Fri, 31 Oct 2025 00:28:14 +0000 (00:28 +0000)] 
Daily bump.

7 days agoLoongArch: Standard instruction template fnmam4 correction
Guo Jie [Wed, 29 Oct 2025 08:38:54 +0000 (16:38 +0800)] 
LoongArch: Standard instruction template fnmam4 correction

The current implementation of the fnmam4 instruction template requires
the third source operand to be assigned the same hard register as the
target operand, but the constraint is not documented in the instruction
manual or standard template definitions. The current constraint will
generate additional data dependencies and extra instructions.

gcc/ChangeLog:

* config/loongarch/lasx.md (fnma<mode>4): Remove.
* config/loongarch/lsx.md (fnma<mode>4): Remove.
* config/loongarch/simd.md (fnma<mode>4): Simplify and correct.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/fnmam4-vec.c: New test.

(cherry picked from commit 7811fb6fa35fd3c3694eba34fbfc992eed1d3e67)

7 days agoDaily bump.
GCC Administrator [Thu, 30 Oct 2025 00:26:13 +0000 (00:26 +0000)] 
Daily bump.

8 days agoDaily bump.
GCC Administrator [Wed, 29 Oct 2025 00:25:03 +0000 (00:25 +0000)] 
Daily bump.

9 days agoc++: mem-initializer-id qualified name lookup is type-only [PR122192]
Patrick Palka [Tue, 14 Oct 2025 16:56:23 +0000 (12:56 -0400)] 
c++: mem-initializer-id qualified name lookup is type-only [PR122192]

Since a mem-initializer needs to be able to initialize any base class,
lookup for which is type-only, we in turn need to make mem-initializer-id
qualified name lookup type-only too.

PR c++/122192

gcc/cp/ChangeLog:

* parser.cc (cp_parser_mem_initializer_id): Pass class_type
instead of typename_type to cp_parser_class_name in the
nested-name-specifier case.

gcc/testsuite/ChangeLog:

* g++.dg/template/dependent-base6.C: Verify mem-initializer-id
qualified name lookup is type-only too.

Reported-by: Vincent X
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 97da8fece19caf0277c2be523520d09252821973)

9 days agoc++: base-specifier name lookup is type-only [PR122192]
Patrick Palka [Fri, 10 Oct 2025 14:25:25 +0000 (10:25 -0400)] 
c++: base-specifier name lookup is type-only [PR122192]

The r13-6098 change to make TYPENAME_TYPE no longer always ignore
non-type bindings needs another exception: base-specifiers that are
represented as TYPENAME_TYPE, for which lookup must be type-only (by
[class.derived.general]/2).  This patch fixes this by giving such
TYPENAME_TYPEs a tag type of class_type rather than typename_type so
that we treat them like elaborated-type-specifiers (another type-only
lookup situation).

PR c++/122192

gcc/cp/ChangeLog:

* decl.cc (make_typename_type): Document base-specifier as
another type-only lookup case.
* parser.cc (cp_parser_class_name): Propagate tag_type to
make_typename_type instead of hardcoding typename_type.
(cp_parser_base_specifier): Pass class_type instead of
typename_type as tag_type to cp_parser_class_name.

gcc/testsuite/ChangeLog:

* g++.dg/template/dependent-base6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 49ddf362f0a7c1fdeb62f13a852a2fdec9d6fe6d)

9 days agoc++/modules: Use containing type as key for all member lambdas [PR122310]
Nathaniel Shead [Sat, 18 Oct 2025 12:43:14 +0000 (23:43 +1100)] 
c++/modules: Use containing type as key for all member lambdas [PR122310]

The ICE in the linked PR occurs because we first stream the lambda type
before its keyed decl has been streamed, but the key decl's type depends
on the lambda.  And so when streaming the key decl to check for an
existing decl to merge with, merging the key decl itself crashes because
its type has only been partially streamed.

This patch fixes the issue by generalising the existing FIELD_DECL
handling to any class member using the outermost containing TYPE_DECL as
its key type.  This way we can guarantee that the key decl has been
streamed before the lambda type is otherwise needed.

PR c++/122310

gcc/cp/ChangeLog:

* module.cc (get_keyed_decl_scope): New function.
(trees_out::get_merge_kind): Use it.
(trees_out::key_mergeable): Use it.
(maybe_key_decl): Key to the containing type for all members.

gcc/testsuite/ChangeLog:

* g++.dg/modules/lambda-12.h: New test.
* g++.dg/modules/lambda-12_a.H: New test.
* g++.dg/modules/lambda-12_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 8212abbeffa69f143808e126f40c67f3eb7e7844)

9 days agoDaily bump.
GCC Administrator [Tue, 28 Oct 2025 00:33:02 +0000 (00:33 +0000)] 
Daily bump.

10 days agophiopt: Fix up DEBUG_EXPR_DECL creation in spaceship_replacement [PR122394]
Jakub Jelinek [Mon, 27 Oct 2025 16:43:17 +0000 (17:43 +0100)] 
phiopt: Fix up DEBUG_EXPR_DECL creation in spaceship_replacement [PR122394]

The following testcase ICEs in gcc 15 (and is at least latent in 12-14 too),
because the DEBUG_EXPR_DECL has incorrect mode.  It has
TREE_TYPE (orig_use_lhs) type, but TYPE_MODE (type) rather than
TYPE_MODE (TREE_TYPE (orig_use_lhs)) where the two types are sometimes
the same, but sometimes different (same if !has_cast_debug_uses, different
otherwise).

Though, there wouldn't be the this issue if it used the proper API to create
the DEBUG_EXPR_DECL which takes care of everything.  This is the sole
spot that doesn't use that API.

Doesn't affect the trunk because the code has been removed and replaced with
different stuff after the libstdc++ ABI change in r16-3474.
Before r15-5557 the mode has been always wrong because this was done only
for has_cast_debug_uses.  And the bug has been introduced with r12-5490.

Enough archeology, while it could be fixed by changing the second
SET_DECL_MODE argument, I think it is better to use build_debug_expr_decl.

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

PR tree-optimization/122394
* tree-ssa-phiopt.cc (spaceship_replacement): Use
build_debug_expr_decl instead of manually building DEBUG_EXPR_DECL
and getting SET_DECL_MODE wrong.

* g++.dg/opt/pr122394.C: New test.

10 days ago[RISC-V][PR target/120674] Avoid division by zero in dwarf emitter when vector is...
Jeff Law [Mon, 13 Oct 2025 20:33:10 +0000 (14:33 -0600)] 
[RISC-V][PR target/120674] Avoid division by zero in dwarf emitter when vector is not enabled

This is a RISC-V specific failure in the dwarf2 emitter.  When vector is not
enabled riscv_convert_vector_chunks sets the riscv_vector_chunks poly_int to
[1, 0].

riscv_dwarf_poly_indeterminite_value pulls out that 0 coefficient and uses that
as FACTOR triggering a divide by zero here:

>               /* Add COEFF * ((REGNO / FACTOR) - BIAS) to the value:
>                  add COEFF * (REGNO / FACTOR) now and subtract
>                  COEFF * BIAS from the final constant part.  */
>               constant -= coeff * bias;
>               add_loc_descr (&ret, new_reg_loc_descr (regno, 0));
>               if (coeff % factor == 0)
>                 coeff /= factor;
>               else
>                 {
>                   int amount = exact_log2 (factor);
>                   gcc_assert (amount >= 0);
>                   add_loc_descr (&ret, int_loc_descriptor (amount));
>                   add_loc_descr (&ret, new_loc_descr (DW_OP_shr, 0, 0));
>                 }

Per Robin's recommendation this patch adjusts
riscv_dwarf_poly_indeterminite_value to never set FACTOR to 0, but instead
detect this case and adjust its value to 1.

That fixes the ICE and looks good across the board in my tester. Waiting on
pre-commit CI, of course.

PR target/120674
gcc/
* config/riscv/riscv.cc (riscv_dwarf_poly_indeterminite_value): Do not
set FACTOR to zero, for that case use one instead.

gcc/testsuite

* gcc.target/riscv/pr120674.c: New test.

(cherry picked from commit a92369a6be95c8df1525b02635b9e7c16fc3640e)

10 days agoAArch64: Extend intrinsics framework to account for merging predications without...
Tamar Christina [Fri, 17 Oct 2025 14:43:04 +0000 (15:43 +0100)] 
AArch64: Extend intrinsics framework to account for merging predications without gp [PR121604]

In PR121604 the problem was noted that currently the SVE intrinsics
infrastructure assumes that for any predicated operation that the GP is at the
first argument position which has a svbool_t or for a unary merging operation
that it's in the second position.

However you have intrinsics like fmov_lane which have an svbool_t but it's not
a GP.

You also have instructions like BRKB which work only on predicates so it
incorrectly determines the first operand to be the GP, while that's the
inactive lanes.

However during apply_predication we do have the information about where the GP
is.  This patch re-organizes the code to record this information into the
function_instance such that folders have access to this information.

For functions that are outliers like pmov_lane we can now override the
availability of the intrinsics having a GP.

gcc/ChangeLog:

PR target/121604
* config/aarch64/aarch64-sve-builtins-shapes.cc (apply_predication):
Store gp_index.
(struct pmov_to_vector_lane_def): Mark instruction as has no GP.
* config/aarch64/aarch64-sve-builtins.h (function_instance::gp_value,
function_instance::inactive_values, function_instance::gp_index,
function_shape::has_gp_argument_p): New.
* config/aarch64/aarch64-sve-builtins.cc (gimple_folder::fold_pfalse):
Simplify code and use GP helpers.

gcc/testsuite/ChangeLog:

PR target/121604
* gcc.target/aarch64/sve/pr121604_brk.c: New test.
* gcc.target/aarch64/sve2/pr121604_pmov.c: New test.

Co-authored-by: Jennifer Schmitz <jschmitz@nvidia.com>
(cherry picked from commit d1965b1fd8938f35f78be503e36b98b406751e21)

10 days agox86: Compile builtin-copysign-8b.c with -mtune=generic
H.J. Lu [Mon, 27 Oct 2025 10:11:25 +0000 (18:11 +0800)] 
x86: Compile builtin-copysign-8b.c with -mtune=generic

Compile builtin-copysign-8b.c with -mtune=generic so that it passes with

$ make check-gcc RUNTESTFLAGS="i386.exp=builtin-copysign-8b.c --target_board='unix{-m64\ -march=cascadelake}'"

PR target/122323
* gcc.target/i386/builtin-copysign-8b.c: Add -mtune=generic.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 3ce0b19b87e9146c47343aab5088d144e739ce57)

10 days agoDaily bump.
GCC Administrator [Mon, 27 Oct 2025 00:28:10 +0000 (00:28 +0000)] 
Daily bump.

11 days agox86-64: Use `movsxd` to perform SI-to-DI extension in Intel syntax
LIU Hao [Sat, 25 Oct 2025 09:19:34 +0000 (17:19 +0800)] 
x86-64: Use `movsxd` to perform SI-to-DI extension in Intel syntax

Although there's no possibility of ambiguity, Intel manual says the mnemonic
for DWORD-to-QWORD sign-extension operation should be MOVSXD. Some assemblers
(GNU AS, NASM) also overload MOVSX, but some others don't accept MOVSX (LLVM,
MASM, YASM in NASM mode) and require MOVSXD.

This mnemonic was introduced in r0-34259-g123bf9e3f4056d in 2001, and has not
been updated ever since.

gcc/ChangeLog:

PR target/119079
* config/i386/i386.md: Use `movsxd` to perform SI-to-DI extension in Intel
syntax.

Signed-off-by: LIU Hao <lh_mouse@126.com>
(cherry picked from commit 66b38349273525dfb86f0f74d6c928abdbf7154f)

11 days ago[aarch64] [testsuite] tolerate alternate insn selection [PR121599]
Alexandre Oliva [Sun, 26 Oct 2025 01:45:22 +0000 (22:45 -0300)] 
[aarch64] [testsuite] tolerate alternate insn selection [PR121599]

On gcc-14, instead of 'movi\td[0-9]*,#0', we select
'mov\tz[0-9]*\.b,#0', and the testcase fails.
As in pfalse* tests, tolerate the difference.

for  gcc/testsuite/ChangeLog

PR target/121599
* gcc.target/aarch64/sve2/pr121599.c: Tolerate alterate insn
selection.

(cherry picked from commit ba653cb0d26e004c10d20ebd9f009a0a823659b0)

11 days agoDaily bump.
GCC Administrator [Sun, 26 Oct 2025 00:28:10 +0000 (00:28 +0000)] 
Daily bump.

12 days agoFortran: fix "unstable" interfaces of external procedures [PR122206]
Harald Anlauf [Thu, 9 Oct 2025 16:43:22 +0000 (18:43 +0200)] 
Fortran: fix "unstable" interfaces of external procedures [PR122206]

In the testcase repeated invocations of a function showed an apparently
unstable interface.  This was caused by trying to guess an (inappropriate)
interface of the external procedure after processing of the procedure
arguments in gfc_conv_procedure_call.  The mis-guessed interface showed up
in subsequent uses of the procedure symbol in gfc_conv_procedure_call.  The
solution is to check for an existing interface of an external procedure
before trying to wildly guess based on just the actual arguments.

PR fortran/122206

gcc/fortran/ChangeLog:

* trans-types.cc (gfc_get_function_type): Do not clobber an
existing procedure interface.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit c474a50b42ac3f7561f628916cf58810044986b3)

12 days agoFortran: fix issue with I/O of array pointer [PR107968]
Harald Anlauf [Fri, 3 Oct 2025 19:16:19 +0000 (21:16 +0200)] 
Fortran: fix issue with I/O of array pointer [PR107968]

PR fortran/107968

gcc/fortran/ChangeLog:

* trans-io.cc (gfc_trans_transfer): Also scalarize I/O of section
of an array pointer.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit e3431c6fd4691d5a0c48ee78869e5f9a79f217c3)

12 days agoDaily bump.
GCC Administrator [Sat, 25 Oct 2025 00:28:20 +0000 (00:28 +0000)] 
Daily bump.

13 days agoAda: Fix segfault on file without final EOL with -gnatyc
Eric Botcazou [Fri, 24 Oct 2025 15:39:57 +0000 (17:39 +0200)] 
Ada: Fix segfault on file without final EOL with -gnatyc

The compiler overruns the source file buffer.

gcc/ada/
PR ada/118782
* styleg.adb (Is_Box_Comment): Also stop the loop at EOF.

13 days agoAda: Fix other instances of incorrect String lower bound in gnatlink
Nicolas Boulenguez [Fri, 24 Oct 2025 10:46:55 +0000 (12:46 +0200)] 
Ada: Fix other instances of incorrect String lower bound in gnatlink

This also reverts an unintentional change introduced by the initial fix.

gcc/ada/
PR ada/81087
* gnatlink.adb (Is_Prefix): Move around, streamline and return false
when the prefix is not strict.
(Gnatlink): Fix other instances of incorrect lower bound assumption.

13 days agox86: builtin-fabs-2.c: Also scan (%edi) for x32
H.J. Lu [Fri, 24 Oct 2025 08:23:19 +0000 (16:23 +0800)] 
x86: builtin-fabs-2.c: Also scan (%edi) for x32

Adjust gcc.target/i386/builtin-fabs-2.c to scan both (%rdi) and (%edi).

PR target/122323
* gcc.target/i386/builtin-fabs-2.c: Also scan (%edi)for x32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 77c8be11d85d9f204d2eb1ba3c5d0cbf3cbce277)

13 days agotree-object-size.cc: Fix assert constant offset in check_for_plus_in_loops [PR122012]
Linsen Zhou [Fri, 17 Oct 2025 03:05:04 +0000 (11:05 +0800)] 
tree-object-size.cc: Fix assert constant offset in check_for_plus_in_loops [PR122012]

After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the
pointer offset is a variable in the loop, the object size of the
pointer may also need to be reexamined.
Which make gcc_assert in the check_for_plus_in_loops failed.

gcc/ChangeLog:

PR tree-optimization/122012
* tree-object-size.cc (check_for_plus_in_loops): Skip check
for the variable offset

gcc/testsuite/ChangeLog:

PR tree-optimization/122012
* gcc.dg/torture/pr122012.c: New test.

Signed-off-by: Linsen Zhou <i@lin.moe>
(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923)

13 days agox86: Optimize copysign (x, const_double)
H.J. Lu [Sun, 19 Oct 2025 01:13:52 +0000 (09:13 +0800)] 
x86: Optimize copysign (x, const_double)

After

commit 3f176e1adc6bc9cc2c21222d776b51d9f43cb66b
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Thu Nov 9 13:59:39 2023 +0000

    middle-end: optimize fneg (fabs (x)) to copysign (x, -1) [PR109154]

fneg (fabs (x)) is expanded to copysign (x, -1).  Swap constraints for
operands[1] and operands[2] in copysign<mode>3 pattern to optimize

  y = copysign (x, const_double)

instead of

  y = copysign (const_double, x)

Simplify

  y = copysign (x, positive_const_double)

to

  y = ~signbit_mask & x

and

  y = copysign (x, negative_const_double)

to

  y = signbit_mask | x

gcc/

PR target/99930
PR target/122323
* config/i386/i386-expand.cc (ix86_expand_copysign): Swap
operands[1] with operands[2].  Optimize copysign (x, const_double)
instead of copysign (const_double, x).
* config/i386/i386.md (copysign<mode>3): Swap constraints for
operands[1] and operands[2].

gcc/testsuite/

PR target/99930
PR target/122323
* gcc.target/i386/builtin-copysign-2.c: New test.
* gcc.target/i386/builtin-copysign-3.c: Likewise.
* gcc.target/i386/builtin-copysign-4.c: Likewise.
* gcc.target/i386/builtin-copysign-5.c: Likewise.
* gcc.target/i386/builtin-copysign-6.c: Likewise.
* gcc.target/i386/builtin-copysign-7.c: Likewise.
* gcc.target/i386/builtin-copysign-8a.c: Likewise.
* gcc.target/i386/builtin-copysign-8b.c: Likewise.
* gcc.target/i386/builtin-fabs-1.c: Likewise.
* gcc.target/i386/builtin-fabs-2.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit c3b0ecf04f8c14360cc02c737446c029038a95f7)

13 days agoDaily bump.
GCC Administrator [Fri, 24 Oct 2025 00:29:28 +0000 (00:29 +0000)] 
Daily bump.

2 weeks agotestsuite: arm: [MVE] Relax expected code for vbicq_f [PR122223]
Christophe Lyon [Thu, 23 Oct 2025 07:59:20 +0000 (07:59 +0000)] 
testsuite: arm: [MVE] Relax expected code for vbicq_f [PR122223]

The original versions of the pr122223.c test only took into account
code generated with -mfloat-abi=hard, which uses q0.

With -mfloat-abi=softfp, this can be any Q register, so replace q0
with a suitable regex.

gcc/testsuite/ChangeLog:

PR target/122223
* gcc.target/arm/mve/intrinsics/pr122223.c: Relax expected code.

(cherry picked from commit a52888dc71924afb6cd187b0e5f18d2be4c68a07)

2 weeks agoDaily bump.
GCC Administrator [Thu, 23 Oct 2025 00:27:46 +0000 (00:27 +0000)] 
Daily bump.

2 weeks agoc++: Fix up RAW_DATA_CST handling in braced_list_to_string [PR122302]
Jakub Jelinek [Wed, 22 Oct 2025 11:11:52 +0000 (13:11 +0200)] 
c++: Fix up RAW_DATA_CST handling in braced_list_to_string [PR122302]

The following testcase is miscompiled, because a RAW_DATA_CST tree
node is shared by multiple CONSTRUCTORs and when the braced_list_to_string
function changes one to extend the RAW_DATA_CST over the single preceding
and single succeeding INTEGER_CST, it changes the RAW_DATA_CST in
the other CONSTRUCTOR where the elts around it are still present.

Fixed by tweaking a copy of it instead, like we handle it in other spots.

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

PR c++/122302
* c-common.cc (braced_list_to_string): Call copy_node on RAW_DATA_CST
before changing RAW_DATA_POINTER and RAW_DATA_LENGTH on it.

* g++.dg/cpp0x/pr122302.C: New test.
* g++.dg/cpp/embed-27.C: New test.

(cherry picked from commit 79b49977b1894a0a5eea3d2125eb6546b9d0cf02)

2 weeks agoi386: Correct cpu codename value for unknown model number
Haochen Jiang [Tue, 21 Oct 2025 03:21:45 +0000 (11:21 +0800)] 
i386: Correct cpu codename value for unknown model number

There are several changes for features enabled on cpus. r16-1666 disabled
CLDEMOTE on clients. r16-2224 removed Key locker since Panther Lake and
Clearwater forest. r16-4436 disabled PREFETCHI on Panther Lake.

The patches caused the current return guess value not aligned for
host_detect_local_cpu meeting the unknown model number. Correct the
logic according to the features enabled.

This patch will also backport to GCC14 and GCC15.

gcc/ChangeLog:

* config/i386/driver-i386.cc (host_detect_local_cpu): Correct
the logic for unknown model number cpu guess value.

2 weeks agoDaily bump.
GCC Administrator [Wed, 22 Oct 2025 00:28:35 +0000 (00:28 +0000)] 
Daily bump.

2 weeks agoarm: [MVE] Fix operands order in vbicq_f [PR122223]
Christophe Lyon [Thu, 9 Oct 2025 14:09:26 +0000 (14:09 +0000)] 
arm: [MVE] Fix operands order in vbicq_f [PR122223]

The operands of the floating-point version of vbicq were swapped, this
patch fixes this.

gcc/ChangeLog:
PR target/122223
* config/arm/mve.md (@mve_vbicq_f<mode>): Fix operands order.

gcc/testsuite/ChangeLog:
PR target/122223
* gcc.target/arm/mve/intrinsics/pr122223.c: New test.

(cherry picked from commit 81e226440381cc3e033df7e58cc7793c9b4b4e25)

2 weeks agoaarch64: Fix ICE when op2 is zero for SVE2 saturating add intrinsics.
Jennifer Schmitz [Thu, 21 Aug 2025 17:01:49 +0000 (10:01 -0700)] 
aarch64: Fix ICE when op2 is zero for SVE2 saturating add intrinsics.

When op2 in SVE2 saturating add intrinsics (svuqadd, svsqadd) is a zero
vector and predication is _z, an ICE in vregs occurs, e.g. for

svuint8_t foo (svbool_t pg, svuint8_t op1)
{
    return svsqadd_u8_z (pg, op1, svdup_s8 (0));
}

The insn failed to match the pattern (aarch64-sve2.md):

;; Predicated binary operations with no reverse form, merging with zero.
;; At present we don't generate these patterns via a cond_* optab,
;; so there's no correctness requirement to handle merging with an
;; independent value.
(define_insn_and_rewrite "*cond_<sve_int_op><mode>_z"
  [(set (match_operand:SVE_FULL_I 0 "register_operand")
(unspec:SVE_FULL_I
  [(match_operand:<VPRED> 1 "register_operand")
   (unspec:SVE_FULL_I
     [(match_operand 5)
      (unspec:SVE_FULL_I
[(match_operand:SVE_FULL_I 2 "register_operand")
 (match_operand:SVE_FULL_I 3 "register_operand")]
SVE2_COND_INT_BINARY_NOREV)]
     UNSPEC_PRED_X)
   (match_operand:SVE_FULL_I 4 "aarch64_simd_imm_zero")]
  UNSPEC_SEL))]
  "TARGET_SVE2"
  {@ [ cons: =0 , 1   , 2 , 3  ]
     [ &w       , Upl , 0 , w  ] movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_int_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
     [ &w       , Upl , w , w  ] movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_int_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
  }
  "&& !CONSTANT_P (operands[5])"
  {
    operands[5] = CONSTM1_RTX (<VPRED>mode);
  }
  [(set_attr "movprfx" "yes")]
)

because operands[3] and operands[4] were both expanded into the same register
operand containing a zero vector by define_expand "@cond_<sve_int_op><mode>".

This patch fixes the ICE by making a case distinction in
function_expander::use_cond_insn that uses add_fixed_operand if
fallback_arg == CONST0_RTX (mode), and otherwise add_input_operand (which was
previously the default and allowed the expansion of the zero-vector
fallback_arg to a register operand).

The patch was bootstrapped and tested on aarch64-linux-gnu, no regression.
OK for trunk?

Alex Coplan pointed out in the bugzilla ticket that this ICE goes back
to GCC 10. Shall we backport?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
Co-authored by: Richard Sandiford <rdsandiford@googlemail.com>

gcc/
PR target/121599
* config/aarch64/aarch64-sve-builtins.cc
(function_expander::use_cond_insn): Use add_fixed_operand if
fallback_arg == CONST0_RTX (mode).

gcc/testsuite/
PR target/121599
* gcc.target/aarch64/sve2/pr121599.c: New test.

2 weeks agoDaily bump.
GCC Administrator [Tue, 21 Oct 2025 00:26:07 +0000 (00:26 +0000)] 
Daily bump.

2 weeks agohurd: Add OPTION_GLIBC_P and OPTION_GLIBC
Svante Signell [Sun, 6 Feb 2022 11:43:23 +0000 (11:43 +0000)] 
hurd: Add OPTION_GLIBC_P and OPTION_GLIBC

GNU/Hurd uses glibc just like GNU/Linux.

This is needed for gcc to notice that glibc supports split stack in
finish_options.

PR go/104290
gcc/ChangeLog:
* config/gnu.h (OPTION_GLIBC_P, OPTION_GLIBC): Define.

(cherry picked from commit 29eacf043b6e8560c5c42d67f7f9b11e4e2cb156)

2 weeks agolibstdc++: Remove undeclared macros from configure.ac [PR122322]
Jonathan Wakely [Sat, 18 Oct 2025 21:05:43 +0000 (22:05 +0100)] 
libstdc++: Remove undeclared macros from configure.ac [PR122322]

The additions in r16-4443-g651bf5126da124 cause errors when running
autoreconf.

libstdc++-v3/ChangeLog:

PR libstdc++/122322
* configure.ac (with_newlib) <*-rtems*>: Remove
HAVE_SYS_IOCT4YL_H, _GLIBCXX_USE_LINK, _GLIBCXX_USE_READLINK,
_GLIBCXX_USE_SYMLINK, _GLIBCXX_USE_TRUNCATE, and
_GLIBCXX_USE_FDOPENDIR. Remove duplicates.
* configure: Regenerate.

(cherry picked from commit f5fb192c65e618508108525252b771956bdb1078)

2 weeks agolibstdc++: Fix unsafe comma operators in <random> [PR122062]
Jonathan Wakely [Thu, 25 Sep 2025 16:23:28 +0000 (17:23 +0100)] 
libstdc++: Fix unsafe comma operators in <random> [PR122062]

This fixes a 'for' loop in std::piecewise_linear_distribution that
increments two iterators with a comma operator between them, making it
vulnerable to evil overloads of the comma operator.

It also changes a 'for' loop used by some other distributions, even
though those are only used with std::vector<double>::iterator and so
won't find any overloaded commas.

libstdc++-v3/ChangeLog:

PR libstdc++/122062
* include/bits/random.tcc (__detail::__normalize): Use void cast
for operands of comma operator.
(piecewise_linear_distribution): Likewise.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/122062.cc:
New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Hewill Kang <hewillk@gmail.com>
(cherry picked from commit 11ce485bcffac0db005d77e100420535e54d0aa5)

2 weeks agoAda: Fix spurious warning for renaming of component of VFA record
Eric Botcazou [Mon, 20 Oct 2025 09:21:21 +0000 (11:21 +0200)] 
Ada: Fix spurious warning for renaming of component of VFA record

This is a regression present on the mainline and all active branches: the
compiler gives a spurious "is not referenced" warning for the renaming of
a component of a Volatile_Full_Access record.

gcc/ada/
PR ada/107536
* exp_ch2.adb (Expand_Renaming): Mark the entity as referenced.

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

2 weeks agoDaily bump.
GCC Administrator [Mon, 20 Oct 2025 00:24:24 +0000 (00:24 +0000)] 
Daily bump.

2 weeks agoDaily bump.
GCC Administrator [Sun, 19 Oct 2025 00:23:36 +0000 (00:23 +0000)] 
Daily bump.

2 weeks agoDaily bump.
GCC Administrator [Sat, 18 Oct 2025 00:25:03 +0000 (00:25 +0000)] 
Daily bump.

2 weeks agox86: Cast stride to __PTRDIFF_TYPE__ for AMX-MOVRS intrinsics. [PR122119]
Hu, Lin1 [Fri, 10 Oct 2025 06:30:19 +0000 (14:30 +0800)] 
x86: Cast stride to __PTRDIFF_TYPE__ for AMX-MOVRS intrinsics. [PR122119]

On 64-bit windows, long can't be used, because it is 32 bits. Use
__PTRDIFF_TYPE__ instead of long.

gcc/ChangeLog:

PR target/122119
* config/i386/amxmovrsintrin.h
(_tile_loaddrs_internal): Use __PTRDIFF_TYPE__ instead of long.
(_tile_loaddrst1_internal): Ditto.
(_tile_2rpntlvwz0rs_internal): Ditto.
(_tile_2rpntlvwz0rst1_internal): Ditto.
(_tile_2rpntlvwz1rs_internal): Ditto.
(_tile_2rpntlvwz1rst1_internal): Ditto.

2 weeks agoDaily bump.
GCC Administrator [Fri, 17 Oct 2025 00:23:52 +0000 (00:23 +0000)] 
Daily bump.

3 weeks agoError out stack-protector unavailability on AIX
Ayappan Perumal [Mon, 1 Sep 2025 13:27:52 +0000 (08:27 -0500)] 
Error out stack-protector unavailability on AIX

stack-protector is not supported in GCC on AIX. This patch is to fail the
compilation if -fstack-protector option is passed.

gcc/ChangeLog:

* config/rs6000/aix.h (SUBTARGET_DRIVER_SELF_SPECS):
Error out when stack-protector option is used in AIX
as it is not supported on AIX

Approved By: Segher Boessenkool <segher@kernel.crashing.org>

(cherry picked from commit dfb7e97dd214f7d8ca0fa970d81ad5ba805aaa8d)

3 weeks agoDaily bump.
GCC Administrator [Thu, 16 Oct 2025 00:27:45 +0000 (00:27 +0000)] 
Daily bump.

3 weeks agolibstdc++-v3: Enable features for RTEMS (based on GCC 15)
Chris Johns [Fri, 30 May 2025 21:14:02 +0000 (16:14 -0500)] 
libstdc++-v3: Enable features for RTEMS (based on GCC 15)

libstdc++-v3/ChangeLog:

* configure: Regenerate.
* configure.ac (newlib, *-rtems*): Add HAVE_SYS_IOCTL_H,
HAVE_SYS_STAT_H, HAVE_SYS_TYPES_H, HAVE_S_ISREG, HAVE_UNISTD_H,
HAVE_UNLINKAT, _GLIBCXX_USE_CHMOD, _GLIBCXX_USE_MKDIR,
_GLIBCXX_USE_CHDIR, _GLIBCXX_USE_GETCWD, _GLIBCXX_USE_UTIME,
_GLIBCXX_USE_LINK, _GLIBCXX_USE_READLINK, _GLIBCXX_USE_SYMLINK,
_GLIBCXX_USE_TRUNCATE and _GLIBCXX_USE_FDOPENDIR.

3 weeks agoaarch64: Fix pmsdsfr_el1 encoding
Alice Carlotti [Wed, 15 Oct 2025 13:14:43 +0000 (14:14 +0100)] 
aarch64: Fix pmsdsfr_el1 encoding

The encoding was fixed in Binutils in May 2024, but we didn't copy the
fix to GCC at the time.

gcc/ChangeLog:

* config/aarch64/aarch64-sys-regs.def: Fix pmsdsfr_el1 encoding.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/acle/rwsr-armv8p9.c: Fix pmsdsfr_el1
encoding.

3 weeks agoaarch64, testsuite: Add -fchecking to test options [PR121772]
Alex Coplan [Mon, 13 Oct 2025 13:41:09 +0000 (13:41 +0000)] 
aarch64, testsuite: Add -fchecking to test options [PR121772]

I noticed while testing a backport of the PR121772 fix to GCC 13 that
the test wasn't triggering the ICE as expected with the unpatched
compiler.

This turned out to be because the ICE is a checking ICE, and we
configure by default with --enable-checking=release on the branches.
Additionally, I hadn't noticed when doing the backports to 15 and 14
since there we still ICE later on in emit_move_insn even if we don't
catch the invalid gimple with checking.

I'm not too sure why the 13 branch doesn't see the emit_move_insn ICE,
but it's somewhat irrelevant - the important thing is that adding
-fchecking to the options makes the test fail as expected with an
unpatched compiler (i.e. with a gimple checking failure), even on
release branches.

I considered applying this patch to just the release branches, but
figured that trunk will at some point itself become a release branch, so
it seems to make most sense just to apply it everywhere.

I've checked that the test still passes with this patch, and still fails
if I revert the PR121772 fix.

gcc/testsuite/ChangeLog:

PR tree-optimization/121772
* gcc.target/aarch64/torture/pr121772.c: Add -fchecking to
dg-options.

(cherry picked from commit 0c670d38455c788ac0447e3b86ba621521d44bce)

3 weeks agoi386: Correct ISA set for Panther Lake and Diamond Rapids
Haochen Jiang [Wed, 15 Oct 2025 06:05:07 +0000 (14:05 +0800)] 
i386: Correct ISA set for Panther Lake and Diamond Rapids

In ISE, Panther Lake does not enable PREFETCHI and Diamond Rapids
does not enable USER_MSR. Correct them accordingly.

I will backport the patch to GCC15/14. For GCC14, only PTL will be
backported.

gcc/ChangeLog:

* config/i386/i386.h
(PTA_PANTHERLAKE): Remove PREFETCHI.
(PTA_DIAMONDRAPIDS): Remove USER_MSR.
* doc/invoke.texi: Correct documentation.

3 weeks agoDaily bump.
GCC Administrator [Wed, 15 Oct 2025 00:28:35 +0000 (00:28 +0000)] 
Daily bump.

3 weeks agoc++: pointer to auto member function [PR120757]
Jason Merrill [Wed, 20 Aug 2025 03:15:20 +0000 (23:15 -0400)] 
c++: pointer to auto member function [PR120757]

Here r13-1210 correctly changed &A<int>::foo to not be considered
type-dependent, but tsubst_expr of the OFFSET_REF got confused trying to
tsubst a type that involved auto.  Fixed by getting the type from the
member rather than tsubst.

PR c++/120757

gcc/cp/ChangeLog:

* pt.cc (tsubst_expr) [OFFSET_REF]: Don't tsubst the type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/auto-fn66.C: New test.

(cherry picked from commit ea6ef13d0fc4e020d8c405333153dad9eee1f18d)

3 weeks agogimplify: Fix up side-effect handling in 2nd __builtin_c[lt]zg argument [PR122188]
Jakub Jelinek [Thu, 9 Oct 2025 16:06:39 +0000 (18:06 +0200)] 
gimplify: Fix up side-effect handling in 2nd __builtin_c[lt]zg argument [PR122188]

The patch from yesterday made me think about side-effects in the second
argument of __builtin_c[lt]zg.  When we change
__builtin_c[lt]zg (x, y)
when y is not INTEGER_CST into
x ? __builtin_c[lt]zg (x) : y
with evaluating x only once, we omit the side-effects in y unless x is not
0.  That looks undesirable, we should evaluate side-effects in y
unconditionally.

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

PR c/122188
* c-gimplify.cc (c_gimplify_expr): Also gimplify the second operand
before the COND_EXPR and use in COND_EXPR result of gimplification.

* gcc.dg/torture/pr122188.c: New test.

(cherry picked from commit 579de8f5295b05573d05f6e4102f1428f35c9f17)

3 weeks agogimplify: Fix up __builtin_c[lt]zg gimplification [PR122188]
Jakub Jelinek [Wed, 8 Oct 2025 07:58:41 +0000 (09:58 +0200)] 
gimplify: Fix up __builtin_c[lt]zg gimplification [PR122188]

The following testcase ICEs during gimplification.
The problem is that save_expr sometimes doesn't create a SAVE_EXPR but
returns the original complex tree (COND_EXPR) and the code then uses that
tree in 2 different spots without unsharing.  As this is done during
gimplification it wasn't unshared when whole body is unshared and because
gimplification is destructive, the first time we gimplify it we destruct it
and second time we try to gimplify it we ICE on it.
Now, we could replace one a use with unshare_expr (a), but because this
is a gimplification hook, I think easier than trying to create a save_expr
is just gimplify the argument, then we know it is is_gimple_val and so
something without side-effects and can safely use it twice.  That argument
would be the first thing to gimplify after return GS_OK anyway, so it
doesn't change argument sequencing etc.

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

PR c/122188
* c-gimplify.cc (c_gimplify_expr): Gimplify CALL_EXPR_ARG (*expr_p, 0)
instead of calling save_expr on it.

* c-c++-common/pr122188.c: New test.

(cherry picked from commit bb22f7d4d63446c9095db32ca013a9b2182df7d9)

3 weeks agostmt: Handle %cc[name] in resolve_asm_operand_names [PR122133]
Jakub Jelinek [Mon, 6 Oct 2025 07:46:48 +0000 (09:46 +0200)] 
stmt: Handle %cc[name] in resolve_asm_operand_names [PR122133]

Last year I've extended the asm template syntax in inline asm to support
%cc0 etc., apparently the first 2 letter generic operand modifier.
As the following testcase shows, I forgot to tweak the [foo] handling
for it though.  As final.cc will error on any % ISALPHA not followed by
digit (with the exception of % c c digit), I think we can safely handle
this for any 2 letters in between % and [, instead of hardcoding it for
now only for %cc[ and changing it again next time we add something
two-letter.

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

PR middle-end/122133
* stmt.cc (resolve_asm_operand_names): Handle % and 2 letters followed
by open square.

* c-c++-common/toplevel-asm-9.c: New test.

(cherry picked from commit 96c4a32cfec8c4b4c677de114164192cfd8ae54d)

3 weeks agowidening_mul: Reset flow sensitive info in maybe_optimize_guarding_check [PR122104]
Jakub Jelinek [Sat, 4 Oct 2025 15:06:16 +0000 (17:06 +0200)] 
widening_mul: Reset flow sensitive info in maybe_optimize_guarding_check [PR122104]

In PR95852 I've added an optimization where next to just pattern
recognizing r = x * y; r / x != y or r = x * y; r / x == y
as .MUL_OVERFLOW or negation thereof it also recognizes
r = x * y; x && (r / x != y) or r = x * y; !x || (r / x == y)
by optimizing the guarding condition to always true/false.

The problem with that is that some value ranges recorded for
the SSA_NAMEs in the formerly conditional, now unconditional
basic block can be invalid.

This patch fixes it by calling reset_flow_sensitive_info_in_bb
if we optimize the guarding condition.

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

PR tree-optimization/122104
* tree-ssa-math-opts.cc (maybe_optimize_guarding_check): Call
reset_flow_sensitive_info_in_bb on bb when optimizing out the
guarding condition.

* gcc.target/i386/pr122104.c: New test.

(cherry picked from commit 867f777cee9f44027a3724fbad266c5cfb3a311f)

3 weeks agoi386: Remove AMX-TRANSPOSE from Diamond Rapids
Haochen Jiang [Tue, 1 Jul 2025 06:11:55 +0000 (14:11 +0800)] 
i386: Remove AMX-TRANSPOSE from Diamond Rapids

AMX-TRANSPOSE will be removed from Diamond Rapids according to ISE.
Backported from trunk AMX-TRANSPOSE removal patch.

gcc/ChangeLog:

* config/i386/i386.h (PTA_DIAMONDRAPIDS): Remove AMX-TRANSPOSE.
* doc/invoke.texi: Correct documentation.

3 weeks agoDaily bump.
GCC Administrator [Tue, 14 Oct 2025 00:27:12 +0000 (00:27 +0000)] 
Daily bump.

3 weeks agomatch.pd: Do not canonicalize division by power 2 for {ROUND, CEIL}_DIV
Avinash Jayakar [Mon, 13 Oct 2025 09:47:45 +0000 (15:17 +0530)] 
match.pd: Do not canonicalize division by power 2 for {ROUND, CEIL}_DIV

Canonicalization of unsigned division by power of 2 only applies to
{TRUNC,FLOOR,EXACT}_DIV, therefore remove the same pattern for {CEIL,ROUND}_DIV,
which was added in a previous commit.

2025-10-13  Avinash Jayakar  <avinashd@linux.ibm.com>

gcc/ChangeLog:
PR tree-optimization/122213
* match.pd: Canonicalize unsigned pow2 div only for trunk, floor and
exact div.

3 weeks agoDaily bump.
GCC Administrator [Mon, 13 Oct 2025 00:24:32 +0000 (00:24 +0000)] 
Daily bump.

3 weeks agoDaily bump.
GCC Administrator [Sun, 12 Oct 2025 00:24:54 +0000 (00:24 +0000)] 
Daily bump.

3 weeks ago[PATCH] RISC-V: Detect wrap in shuffle_series_pattern [PR121845].
Robin Dapp [Tue, 7 Oct 2025 13:18:27 +0000 (07:18 -0600)] 
[PATCH] RISC-V: Detect wrap in shuffle_series_pattern [PR121845].

Hi,

In shuffle_series_pattern we use series_p to determine if the permute
mask is a simple series.  This didn't take into account that series_p
also returns true for e.g. {0, 3, 2, 1} where the step is 3 and the
indices form a series modulo 4.

We emit
 vid + vmul
in order to synthesize a series.  In order to be always correct we would
need a vrem afterwards still which does not seem worth it.

This patch adds the modulo for VLA permutes and punts if we wrap around
for VLS permutes.  I'm not really certain whether we'll really see a wrapping
VLA series (certainly we haven't so far in the test suite) but as we observed
a VLS one here now it appears conservatively correct to module the indices.

Regtested on rv64gcv_zvl512b.

Regards
 Robin

PR target/121845

gcc/ChangeLog:

* config/riscv/riscv-v.cc (shuffle_series_patterns):
Modulo indices for VLA and punt when wrapping for VLS.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr121845.c: New test.

(cherry picked from commit 62631c39a788161ff2f686adf355d10443e0d899)

3 weeks agoDaily bump.
GCC Administrator [Sat, 11 Oct 2025 00:26:18 +0000 (00:26 +0000)] 
Daily bump.

3 weeks agoDaily bump.
GCC Administrator [Fri, 10 Oct 2025 00:28:00 +0000 (00:28 +0000)] 
Daily bump.

4 weeks agoAVR: target/122222 - Add modules for __floatsidf, __floatunsidf.
Georg-Johann Lay [Thu, 9 Oct 2025 16:35:34 +0000 (18:35 +0200)] 
AVR: target/122222 - Add modules for __floatsidf, __floatunsidf.

PR target/122222
libgcc/config/avr/libf7/
* libf7-asm.sx (D_floatsidf, D_floatunsidf): New modules.
* libf7-common.mk (F7_ASM_PARTS): Add D_floatsidf, D_floatunsidf.
(F7F, g_dx): Remove floatunsidf, floatsidf.
* libf7.c (f7_set_s32): Don't alias to f7_floatsidf.
(f7_set_u32): Don't alias to f7_floatunsidf.
* f7-renames.h: Rebuild
* f7-wraps.h: Rebuild.

gcc/testsuite/
* gcc.target/avr/pr122222-sitod.c: New test.

(cherry picked from commit 078208cf15bb373dc7931d6b373689cdff70cdc5)

4 weeks agoAVR: target/122220 - Let (int32_t) -0x1p31L return INT32_MIN.
Georg-Johann Lay [Thu, 9 Oct 2025 13:27:16 +0000 (15:27 +0200)] 
AVR: target/122220 - Let (int32_t) -0x1p31L return INT32_MIN.

PR target/122220
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer): Return 0x80... on negative overflow.

gcc/testsuite/
* gcc.target/avr/pr122220.c: New test.

(cherry picked from commit 3ea09e4d43278aa8d7b088a5f5438d921c48c411)

4 weeks agoAVR: target/122210 - Add double -> fixed-point conversions.
Georg-Johann Lay [Wed, 8 Oct 2025 18:02:53 +0000 (20:02 +0200)] 
AVR: target/122210 - Add double -> fixed-point conversions.

PR target/122210
libgcc/config/avr/libf7/
* libf7-common.mk (F7_ASM_PARTS): Add D2<fx> modules.
* libf7-asm.sx: Implement the D2<fx> modules.

gcc/testsuite/
* gcc.target/avr/dtofx.c: New test.

(cherry picked from commit b0bc615d9374ca6293996cf3afca8cabaca0defd)

4 weeks agoAVR: target/122210 - Add fixed-point -> double conversions.
Georg-Johann Lay [Wed, 8 Oct 2025 18:02:53 +0000 (20:02 +0200)] 
AVR: target/122210 - Add fixed-point -> double conversions.

PR target/122210
libgcc/config/avr/libf7/
* libf7-common.mk (F7_ASM_PARTS): Add <fx>2D modules.
* libf7-asm.sx: Implement the <fx>2D modules.

gcc/testsuite/
* gcc.target/avr/fxtod.c: New test.

(cherry picked from commit 7304e83f1f29c39df7a9de888d9c6d40b58c512a)

4 weeks agoDaily bump.
GCC Administrator [Thu, 9 Oct 2025 00:28:11 +0000 (00:28 +0000)] 
Daily bump.

4 weeks ago[PATCH v2] RISC-V: fix __builtin_round NaN handling [PR target/121652]
Aurelien Jarno [Thu, 2 Oct 2025 15:05:34 +0000 (09:05 -0600)] 
[PATCH v2] RISC-V: fix __builtin_round NaN handling [PR target/121652]

__builtin_round() fails to correctly generate invalid exceptions for NaN
inputs when -ftrapping-math is used (which is the default). According to
the specification, an invalid exception should be raised for sNaN, but
not for qNaN.

Commit f12a27216952 ("RISC-V: fix __builtin_round clobbering FP...")
attempted to avoid raising an invalid exception for qNaN by saving and
restoring the FP exception flags. However this inadvertently suppressed
the invalid exception for sNaN as well.

Instead of saving/restoring fflags, this patch uses the same approach
than the well tested GLIBC round implementation. When flag_trapping_math
is enabled, it first checks whether the input is a NaN using feq.s/d. In
that case it adds the input value with itself to possibly convert sNaN
into qNaN. With this change, the glibc testsuite passes again.

The generated code with -ftrapping-math now looks like:

convert_float_to_float_round
  feq.s       a5,fa0,fa0
  beqz        a5,.L6
  auipc       a5,0x0
  flw         fa4,42(a5)
  fabs.s      fa5,fa0
  flt.s       a5,fa5,fa4
  beqz        a5,.L5
  fcvt.w.s    a5,fa0,rmm
  fcvt.s.w    fa5,a5
  fsgnj.s     fa0,fa5,fa0
  ret
.L6:
  fadd.s      fa0,fa0,fa0
.L5:
  ret

With -fno-trapping-math, the additional checks are omitted so the
resulting code is unchanged.

In addition this fixes the following failures:
FAIL: gcc.target/riscv/rvv/autovec/vls/math-nearbyint-1.c -O3 -ftree-vectorize -mrvv-vector-bits=scalable  scan-assembler-times frflags\\s+[atx][0-9]+ 32
FAIL: gcc.target/riscv/rvv/autovec/vls/math-nearbyint-1.c -O3 -ftree-vectorize -mrvv-vector-bits=scalable  scan-assembler-times fsflags\\s+[atx][0-9]+ 32

Fixes: f652a35877e3 ("This is almost exclusively Jivan's work....")
Fixes: f12a27216952 ("RISC-V: fix __builtin_round clobbering FP...")
PR target/121652

gcc/ChangeLog:

* config/riscv/riscv.md (round_pattern): special case NaN input
instead of saving/restoring fflags.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/math-nearbyint-1.c: Adjust
scan pattern for fewer instances of frflags/fsrflags.

(cherry picked from commit 60c6f92fb192352d784ab3153a9e11c19a3216a0)

4 weeks agoDaily bump.
GCC Administrator [Wed, 8 Oct 2025 00:27:03 +0000 (00:27 +0000)] 
Daily bump.

4 weeks agoAVR: target/122187 - Don't clobber recog_data.operand[] in insn out.
Georg-Johann Lay [Tue, 7 Oct 2025 15:50:34 +0000 (17:50 +0200)] 
AVR: target/122187 - Don't clobber recog_data.operand[] in insn out.

avr.cc::avr_out_extr() and avr.cc::avr_out_extr_not()
changed xop for output, which spoiled the operand for
the next invokation, running into an assertion.

This patch makes a local copy of the operands.

PR target/122187
gcc/
* config/avr/avr.cc (avr_out_extr, avr_out_extr_not):
Make a local copy of the passed rtx[] operands.

gcc/testsuite/
* gcc.target/avr/torture/pr122187.c: New test.

(cherry picked from commit 3cbd43d640d6384df85c171a0245488f0adc3145)

4 weeks agoDaily bump.
GCC Administrator [Tue, 7 Oct 2025 00:27:45 +0000 (00:27 +0000)] 
Daily bump.

4 weeks agoAVR/LibF7: Implement sincos.
Georg-Johann Lay [Mon, 6 Oct 2025 19:31:46 +0000 (21:31 +0200)] 
AVR/LibF7: Implement sincos.

libgcc/config/avr/libf7/
* libf7-common.mk (F7_ASM_PARTS): Add D_sincos.
* libf7-asm.sx: (D_sincos): New module implements sincos / sincosl.

gcc/testsuite/
* gcc.target/avr/sincos-1.c: New test.

(cherry picked from commit e3a05e050226aaaa4e2a2e7aee1e5651212a68f6)

4 weeks agoAVR/LibF7: target/122177 - fix fmin / fmax return value for one NaN arg.
Georg-Johann Lay [Sun, 5 Oct 2025 18:56:56 +0000 (20:56 +0200)] 
AVR/LibF7: target/122177 - fix fmin / fmax return value for one NaN arg.

fmin and fmax should return the non-NaN argument in the case where
exactly one argument is a NaN.

Moreover, IEEE double fmin and fmax can be performed without
first converting the args to the internal representation and
then converting back again.

PR target/122177
libgcc/config/avr/libf7/
* libf7-common.mk (m_ddd): Remove: fmin, fmax.
(F7_ASM_PARTS): Add: D_fminfmax.
* libf7-asm.sx (D_fmanfmax): New module.
* f7-wraps.h: Rebuild.

gcc/testsuite/
* gcc.target/avr/fminfmax-1.c: New test.

(cherry picked from commit efb3cd64fdefab88c7787b16ad33be33f4c4a2a4)

4 weeks agoAVR: Speed up IEEE double comparisons.
Georg-Johann Lay [Sun, 5 Oct 2025 18:56:56 +0000 (20:56 +0200)] 
AVR: Speed up IEEE double comparisons.

IEEE double can be compared without first converting them to
the internal representation.

libgcc/config/avr/libf7/
* libf7-common.mk (g_xdd_cmp): Remove le, lt, ge, gt, ne, eq, unord.
(F7_ASM_PARTS): Add D_cmp, D_eq, D_ne, D_ge, D_gt, D_le, D_lt, D_unord.
* libf7-asm.sx (D_cmp, D_eq, D_ne, D_ge, D_gt, D_le, D_lt, D_unord):
New modules.
* f7-wraps.h: Rebuild.

gcc/testsuite/
* gcc.target/avr/cmpdi-1.c: New test.

(cherry picked from commit e5731a4bc50e95245cb628505142e0adff0bb79e)

4 weeks agoDaily bump.
GCC Administrator [Mon, 6 Oct 2025 00:23:58 +0000 (00:23 +0000)] 
Daily bump.

4 weeks agoDaily bump.
GCC Administrator [Sun, 5 Oct 2025 16:56:15 +0000 (16:56 +0000)] 
Daily bump.

4 weeks agoAdd testcase for PR ada/113536
Eric Botcazou [Sun, 5 Oct 2025 08:42:25 +0000 (10:42 +0200)] 
Add testcase for PR ada/113536

gcc/testsuite/
PR ada/113536
* gnat.dg/reduce2.adb: New test.

4 weeks agoAda: Remove useless Makefile variable
Eric Botcazou [Sun, 5 Oct 2025 08:25:14 +0000 (10:25 +0200)] 
Ada: Remove useless Makefile variable

gcc/ada
PR ada/118343
* Makefile.rtl (LLVM_BUILD): Delete.

4 weeks agoRISC-V: Use correct target in expand_vec_perm [PR121780].
Robin Dapp [Thu, 4 Sep 2025 08:16:21 +0000 (10:16 +0200)] 
RISC-V: Use correct target in expand_vec_perm [PR121780].

This fixes a glaring mistake in yesterday's change to the expansion of
vec_perm.  We should of course move tmp_target into the real target
and not the other way around.  I wonder why my testing hasn't
caught this...

PR target/121742
PR target/121780
PR target/121781

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_vec_perm): Swap target and
tmp_target.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr121780.c: New test.
* gcc.target/riscv/rvv/autovec/pr121781.c: New test.

(cherry picked from commit e3d5e9f0c8c6f27bf59d321d5082be7b3bb39f8a)

4 weeks agoRISC-V: Handle overlap in expand_vec_perm PR121742.
Robin Dapp [Mon, 1 Sep 2025 09:41:34 +0000 (11:41 +0200)] 
RISC-V: Handle overlap in expand_vec_perm PR121742.

In a two-source gather we unconditionally overwrite target with the
first gather's result already.  If op1 == target this clobbers the
source operand for the second gather.  This patch uses a temporary in
that case.

PR target/121742

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_vec_perm): Use temporary if
op1 and target overlap.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr121742.c: New test.

(cherry picked from commit f957d352bd6f240829226405e9be7960071d1b9c)

5 weeks agoRISC-V: Always register vector built-in functions during LTO [PR110812]
Kito Cheng [Thu, 10 Jul 2025 07:28:30 +0000 (15:28 +0800)] 
RISC-V: Always register vector built-in functions during LTO [PR110812]

Previously, vector built-in functions were not properly registered during
the LTO pipeline, causing link failures when vector intrinsics were used
in LTO builds with mixed architecture options.  This patch ensures all
vector built-in functions are always registered during LTO compilation.

The key changes include:
- Moving pragma intrinsic flag manipulation from riscv-c.cc to
  riscv-vector-builtins.cc for better encapsulation
- Registering all vector built-in functions regardless of current ISA
  extensions, deferring the actual extension checking to expansion time
- Adding proper support for built-in type registration during LTO

This approach is safe because we already perform extension requirement
checking at expansion time.  The trade-off is a slight increase in
bootstrap time for LTO builds due to registering more built-in functions.

PR target/110812

gcc/ChangeLog:

* config/riscv/riscv-c.cc (pragma_intrinsic_flags): Remove struct.
(riscv_pragma_intrinsic_flags_pollute): Remove function.
(riscv_pragma_intrinsic_flags_restore): Remove function.
(riscv_pragma_intrinsic): Simplify to only call handle_pragma_vector.
* config/riscv/riscv-vector-builtins.cc (pragma_intrinsic_flags):
Move struct definition here from riscv-c.cc.
(riscv_pragma_intrinsic_flags_pollute): Move and adapt from
riscv-c.cc, add zvfbfmin, zvfhmin and vector_elen_bf_16 support.
(riscv_pragma_intrinsic_flags_restore): Move from riscv-c.cc.
(rvv_switcher::rvv_switcher): Add pollute_flags parameter to
control flag manipulation.
(rvv_switcher::~rvv_switcher): Restore flags conditionally.
(register_builtin_types): Use rvv_switcher without polluting flags.
(get_required_extensions): Remove function.
(check_required_extensions): Simplify to only check type validity.
(function_instance::function_returns_void_p): Move implementation
from header.
(function_builder::add_function): Register placeholder for LTO.
(init_builtins): Simplify and handle LTO case.
(reinit_builtins): Remove function.
(handle_pragma_vector): Remove extension checking.
* config/riscv/riscv-vector-builtins.h
(function_instance::function_returns_void_p): Add declaration.
(function_call_info::function_returns_void_p): Remove inline
implementation.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/lto/pr110812_0.c: New test.
* gcc.target/riscv/lto/pr110812_1.c: New test.
* gcc.target/riscv/lto/riscv-lto.exp: New test driver.
* gcc.target/riscv/lto/riscv_vector.h: New header wrapper.

5 weeks agoDaily bump.
GCC Administrator [Thu, 2 Oct 2025 00:26:28 +0000 (00:26 +0000)] 
Daily bump.