]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 weeks agoDaily bump.
GCC Administrator [Sun, 19 Jul 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

2 weeks ago[PATCH] RISC-V: Fix the LRA crashing triggered by TLSDESC clobber updates
Luke Zhuang [Sat, 18 Jul 2026 20:29:18 +0000 (14:29 -0600)] 
[PATCH] RISC-V: Fix the LRA crashing triggered by TLSDESC clobber updates

An LRA crashing is found by fuzz-testing, and is triggered by
<0748d2c83fc>. We can avoid it by replacing RVVM8QI with RVVM1QI,
and may need to fix the LRA later.

A reduced test is appended as well, demonstrating the crash.

gcc/ChangeLog:

* config/riscv/riscv.md (@tlsdesc<mode>): Use individual
RVVM1QI clobbers instead of four RVVM8QI.

gcc/testsuite/ChangeLog:

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

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2 weeks ago[PATCH] RISC-V: Do not grow complete unrolling at -O2
wangjue [Sat, 18 Jul 2026 16:52:23 +0000 (10:52 -0600)] 
[PATCH] RISC-V: Do not grow complete unrolling at -O2

RISC-V enables -funroll-loops at -O2 for small-loop unrolling.  Keep
size-growing complete unrolling disabled unless unrolling is explicitly
requested.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_override_options_after_change): New
function.
(riscv_option_override): Call it.
(TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): Define.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/unroll-explicit-attr-cunroll.c: New test.
* gcc.target/riscv/unroll-small-loop-cunroll.c: New test.

2 weeks ago[PR target/123883] Inefficient bit manipulation code on RISC-V port
Dusan Stojkovic [Sat, 18 Jul 2026 16:38:41 +0000 (10:38 -0600)] 
[PR target/123883] Inefficient bit manipulation code on RISC-V port

With changes to the RISC-V backend, it's possible to get the desired code
generation for this test with a simple match.pd pattern.

Essentially we have (1 << N) & (1 << N) where each shift is in a different
type.  With some constraints, we can collapse that down to just (1 << N) in
the wider type.  That in turn allows collapsing the entire sequence down to
a single bit set (6 instructions -> 3 instructions on rv64gcb).

PR target/123883

gcc/ChangeLog:

* match.pd ((1<<N) & (1<<N) with different types): New
pattern.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr123883-a.c: New test.
* gcc.target/riscv/pr123883-b.c: New test.

2 weeks ago[PATCH] lra: mark the hard frame pointer live when LRA decides it is needed [PR117184]
Matt Turner [Sat, 18 Jul 2026 16:32:39 +0000 (10:32 -0600)] 
[PATCH] lra: mark the hard frame pointer live when LRA decides it is needed [PR117184]

ira_setup_eliminable_regset calls df_set_regs_ever_live for the hard frame
pointer when it decides frame_pointer_needed.  LRA can reach that decision
later instead, in setup_can_eliminate, when it finds the frame pointer to
stack pointer elimination is not possible after all, but it does not mark the
register live there.

A target whose prologue decides which registers to save from
df_regs_ever_live_p then sets up the frame pointer without saving the caller's
value.  On alpha this miscompiles pge while bootstrapping the Modula-2 front
end (PR117184): alpha_compute_frame_layout leaves $15 out of the save mask, so
alpha_expand_prologue emits the "mov $30,$15" that clobbers it but no matching
store, while alpha_expand_epilogue restores the register whenever
frame_pointer_needed, from an fp_offset that stayed 0 -- the return address
slot.  The caller gets its call-saved $15 back as a code address, which shows
up much later as a NULL dereference, and the Modula-2 runtime turns the
resulting SIGSEGV into an unhandled exception:

  terminate called after throwing an instance of 'unsigned int'

The testcase needs the VLA to reach the caller by inlining: a caller with its
own VLA has cfun->calls_alloca set, so IRA already knows a frame pointer is
needed and marks $15 live itself.

Do what IRA does, so the two paths agree.

PR target/117184
gcc/
* lra-eliminations.cc (setup_can_eliminate): Mark the hard frame
pointer live when setting frame_pointer_needed.

gcc/testsuite/
* gcc.target/alpha/frame-pointer-save-1.c: New test.

2 weeks agoLoongArch: fix par_const_vector_shf_set_operand for vshuf4i [PR 126200]
Xi Ruoyao [Tue, 14 Jul 2026 07:03:19 +0000 (15:03 +0800)] 
LoongArch: fix par_const_vector_shf_set_operand for vshuf4i [PR 126200]

The logic of par_const_vector_shf_set_operand (actually,
loongarch_const_vector_shuffle_set_p) expect mode to have the same
element count as the shuffled vector.  But the lsx_vshuf4i_<lsxfmt_f>
definition have VOIDmode for the mode of the selector, thus the
predicate actually accepts anything.  The issue was somehow latent until
recently fwprop1 seems improved on folding two vec_select into one.

Change par_const_vector_shf_set_operand to a special predicate so we can
specify a mode different from the actual mode of the selector parallel
(in VOIDmode) to the predicate.  Then specify VIMODE to satisfy the
expectation of loongarch_const_vector_shuffle_set_p.

PR target/126200

gcc/

* config/loongarch/predicates.md
(par_const_vector_shf_set_operand): Define as special predicate.
* config/loongarch/lsx.md (lsx_vshuf4i_<lsxfmt_f>): Pass VIMODE
to the predicate of selector.

gcc/testsuite/

* gcc.target/loongarch/vector/lsx/pr126200.c: New test.

2 weeks agoRISC-V: Split the pr112431-13 test in to 2 file
Pan Li [Sat, 18 Jul 2026 03:23:16 +0000 (11:23 +0800)] 
RISC-V: Split the pr112431-13 test in to 2 file

The vfwcvt_x_f_v and vfwcvt_rtz_x_f_v are placed in
one file, and when allow overlap for vfwcvt_x_f_v.
The csrr scan still xfail.

Therefore, split it into two files to make sure
both the vfwcvt_x_f_v and vfwcvt_rtz_x_f_v has
no csrr after enable overlap.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr112431-13.c: Move to...
* gcc.target/riscv/rvv/base/pr112431-13-0.c: ...here.
* gcc.target/riscv/rvv/base/pr112431-13-1.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Add test cases for vfwcvtu.xu.f.v reg overlap
Pan Li [Thu, 16 Jul 2026 04:57:53 +0000 (12:57 +0800)] 
RISC-V: Add test cases for vfwcvtu.xu.f.v reg overlap

Add test cases for vfwcvt.xu.f.v register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_xu-f32-mf2.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Add test cases for vfcvt.x.f.v reg overlap
Pan Li [Thu, 16 Jul 2026 04:57:02 +0000 (12:57 +0800)] 
RISC-V: Add test cases for vfcvt.x.f.v reg overlap

Add test cases for vfwcvt.x.f.v register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vfwcvt_x-f32-mf2.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Allow RVV register overlap for vfwcvt.x[u].f.v
Pan Li [Thu, 16 Jul 2026 04:55:25 +0000 (12:55 +0800)] 
RISC-V: Allow RVV register overlap for vfwcvt.x[u].f.v

Like v[sz]ext.vf8, allow the rvv register overlap
for vfwcvt.x[u].f.v.

gcc/ChangeLog:

* config/riscv/vector.md: Leverage Wvr constraint.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoShow details of attr->allocated with -fdump-fortran-original.
Thomas Koenig [Sat, 18 Jul 2026 08:41:23 +0000 (10:41 +0200)] 
Show details of attr->allocated with -fdump-fortran-original.

This simple and obvious patch adds output for the var_allocated enum,
to make the status of where the gfortran thinks a potential allocation
came from more clear.

Instead of (example from warn_unused_but_set_variable_4.f90)

attributes: (VARIABLE  ALLOCATABLE DIMENSION REFERENCED VALUE-SET(INTENT-OUT) ALLOCATED)

this now displays

attributes: (VARIABLE  ALLOCATABLE DIMENSION REFERENCED VALUE-SET(INTENT-OUT) ALLOCATED(ARG))

No user impact (unless the user is exceptionally curious) and no test
case.

gcc/fortran/ChangeLog:

PR fortran/126058
* dump-parse-tree.cc (show_attr): Show details of
attr->allocated.

2 weeks agoDaily bump.
GCC Administrator [Sat, 18 Jul 2026 00:16:38 +0000 (00:16 +0000)] 
Daily bump.

2 weeks agocobol: portability for Darwin.
James K. Lowden [Fri, 17 Jul 2026 20:25:30 +0000 (16:25 -0400)] 
cobol: portability for Darwin.

With this change https://github.com/iains/gcc-darwin-arm64 commit
f576c64ad77e65fb054365839a4ea80a79398e45 builds successfully.

gcc/cobol/ChangeLog:

PR cobol/122466
* copybook.h: Include sys/types.h
* parse.y: Cast size for printf %lu parameter.
* util.cc (cobol_filename): Same.

2 weeks agotestsuite, aarch64: Require -mbig-endian support where it is missing.
Iain Sandoe [Wed, 15 Jul 2026 06:42:35 +0000 (07:42 +0100)] 
testsuite, aarch64: Require -mbig-endian support where it is missing.

The tests here require support for big endian code generation but do
not require a big endian host.

We provide an aarch64_mbig_endian target supports check fot this an
use it to gate the tests.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/and-be.c: Require big-endian support.
* gcc.target/aarch64/fmov-1-be.c: Likewise.
* gcc.target/aarch64/fmov-2-be.c: Likewise.
* gcc.target/aarch64/fmov-3-be.c: Likewise.
* gcc.target/aarch64/fmov-4-be.c: Likewise.
* gcc.target/aarch64/fmov-5-be.c: Likewise.
* gcc.target/aarch64/ins_bitfield_2.c: Likewise.
* gcc.target/aarch64/ins_bitfield_4.c: Likewise.
* gcc.target/aarch64/ins_bitfield_6.c: Likewise.
* gcc.target/aarch64/pr124078-1.c: Likewise.
* gcc.target/aarch64/pr62308.c: Likewise.
* gcc.target/aarch64/pr87305.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_2.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_4.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_6.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_lane_9.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_bf16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_f16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_f32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_f64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_mf8.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_s16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_s32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_s64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_s8.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_u16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_u32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_u64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_5_be_u8.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_bf16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_f16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_f32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_f64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_mf8.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_s16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_s32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_s64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_s8.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_u16.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_u32.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_u64.c: Likewise.
* gcc.target/aarch64/sve/pcs/args_6_be_u8.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_1_be_nowrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_1_be_wrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_2_be_nowrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_2_be_wrap.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_4_be.c: Likewise.
* gcc.target/aarch64/sve/pcs/saves_5_be.c: Likewise.
* gcc.target/aarch64/sve/pr88847.c: Likewise.
* gcc.target/aarch64/sve/revb_2.c: Likewise.
* gcc.target/aarch64/sve/revh_2.c: Likewise.
* gcc.target/aarch64/sve/revhw_2.c: Likewise.
* gcc.target/aarch64/sve/revw_2.c: Likewise.
* gcc.target/aarch64/sve/struct_move_1.c: Likewise.
* gcc.target/aarch64/sve/struct_move_2.c: Likewise.
* gcc.target/aarch64/sve/struct_move_3.c: Likewise.
* gcc.target/aarch64/sve/vec_init_4.c: Likewise.
* lib/target-supports.exp: Provide aarch64_mbig_endian.

gcc/ChangeLog:

* doc/sourcebuild.texi: Document aarch64_mbig_endian.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2 weeks agocobol: Repair errors in man page.
James K. Lowden [Fri, 17 Jul 2026 19:56:05 +0000 (15:56 -0400)] 
cobol: Repair errors in man page.

gcc/cobol/ChangeLog:

PR cobol/122916
* gcobol.1: Remove blank line and escape characters in width arguments.

2 weeks agomatch: Move tree_expr_nonnegative_p (@1) to tree_expr_nonnegative_p@1. [PR126087]
Kael Andrew Alonzo Franco [Fri, 17 Jul 2026 18:14:26 +0000 (14:14 -0400)] 
match: Move tree_expr_nonnegative_p (@1) to tree_expr_nonnegative_p@1. [PR126087]

This simplify r17-2487.

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

PR tree-optimization/126087

gcc/ChangeLog:

* match.pd: Move tree_expr_nonnegative_p (@1) to tree_expr_nonnegative_p@1.

Signed-off-by: Kael Andrew Franco <kaelfandrew@gmail.com>
2 weeks agoOpenMP: docs - improve -fopenmp-ompt(-detailed) description + update impl. status
Tobias Burnus [Fri, 17 Jul 2026 15:19:46 +0000 (17:19 +0200)] 
OpenMP: docs - improve -fopenmp-ompt(-detailed) description + update impl. status

invoke.texi: Improve the wording for -fopenmp-ompt(-detailed) that was
added in r17-2288-gab0dd7d5e16fcd.

libgomp.texi: Mark OpenMP 5.1's 'device_type(...)' for variables on
'declare target' as partially implemented as parsing support was added for
C/C++ in r10-2342-g77eb117f588686 and for Fortran in r11-2858-gd58e7173ef964d.

(device_type: It actually seems to work fine, even though there is almost no
code to handle 'host' differently; still host/nohost handling should be
improved for vars and funcs; hence, marked as only partial not as fully
supported.)

gcc/ChangeLog:

* doc/invoke.texi (-fopenmp-ompt, -fopenmp-ompt-detailed): Improve
wording.

libgomp/ChangeLog:

* libgomp.texi (OpenMP 5.1 Impl Status): Mark device_type on vars
in declare target as 'P'.

2 weeks agoaarch64: deprecate the TME extension
Richard Earnshaw [Tue, 7 Jul 2026 16:14:07 +0000 (17:14 +0100)] 
aarch64: deprecate the TME extension

Arm has sunset the TME extension from the aarch64 architecture since
there are no known implementations.  Since this has been present in the
compiler for a while though, we need to go through a deprecation cycle.

This patch starts that process by:
 - removing it from the documentation
 - warning if the option is used during compilation
 - removing the tests for it.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_override_options): Warn if
+tme is used as an architecture feature
(aarch64_process_target_attr): Similarly, but only if TME
was previously disabled.
* doc/invoke.texi (aarch64): Remove mentions of +tme.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_2.c: Drop tests for TME.
* gcc.target/aarch64/acle/tme.c: Removed.
* gcc.target/aarch64/acle/tme_guard-1.c: Removed.
* gcc.target/aarch64/acle/tme_guard-2.c: Removed.
* gcc.target/aarch64/acle/tme_guard-3.c: Removed.
* gcc.target/aarch64/acle/tme_guard-4.c: Removed.

2 weeks ago[PATCH] alpha: do not gate cannot_copy_insn_p on reload_completed
Matt Turner [Fri, 17 Jul 2026 13:26:12 +0000 (07:26 -0600)] 
[PATCH] alpha: do not gate cannot_copy_insn_p on reload_completed

alpha_legitimize_address emits movdi_er_tlsgd and movdi_er_tlsldm together
with their paired call_value_osf_tlsgd/tlsldm at expand time, and both halves
already carry the sequence number that ties the pair together.  Those patterns
are marked with the cannot_copy attribute, but alpha_cannot_copy_insn_p
returned false whenever !reload_completed, so the hook had no effect on any
pass running before register allocation.

Unrolling a loop whose body contains such a pair therefore copies the sequence
number along with it.  With

  extern __thread int tv;
  extern int cond (int);
  int f (int n)
  {
    int s = 0;
    for (int i = 0; i < n; i++)
      if (cond (i))
s += tv;
    return s;
  }

compiled with -O2 -funroll-loops -fno-move-loop-invariants -fPIC
-ftls-model=global-dynamic, the unroller produces seven copies of !tlsgd!1 and
the assembler rejects the result:

  Error: duplicate !tlsgd!1
  Error: too many lituse insns for !lituse_tlsgd!1

Drop the reload_completed test.  The gpdisp pairs are only created after
reload, so this does not change their handling; it only lets the hook protect
the TLS pairs that already exist before register allocation.  This is
independent of the register allocator: the failure reproduces identically with
both reload and LRA.

gcc/
* config/alpha/alpha.cc (alpha_cannot_copy_insn_p): Do not return
false before reload_completed.  Update comment.

gcc/testsuite/
* gcc.target/alpha/tlsgd-dup-1.c: New test.

2 weeks agocobol: Filename-as-device; normalize special registers.
Robert Dubner [Fri, 17 Jul 2026 12:19:51 +0000 (08:19 -0400)] 
cobol: Filename-as-device; normalize special registers.

The compiler now parses a new feature where a filename can be
established using the device syntax.  It awaits implementation in the
code generator.

The variables "literally_zero" and "literally_zero" are now established
as global constants in libgcobol instead of as constructed temporary
variables.

The initialization of "special registers", and the necessary
coordination between their compile-time cbl_field_t and run-time
cblc_field_t counterparts has been normalized.

gcc/cobol/ChangeLog:

* genapi.cc (parser_file_open): New filename-as-device feature
awaiting implementation.
* lexio.h (struct filespan_t): Variable name change.
* parse.y: Filename-as-device.
* parse_ante.h (field_find): Likewise.
(data_division_ready): _literally_zero and _literally_one global
constants.
* scan.l: Require separate space after '<', '>' and '=' comparison
operators.
* scan_ante.h (update_location): Change debug message text.
* symbols.cc (constq): Eliminate #define in favor of explicit
(constant_e | quoted_e).
(label_cmp): Formatting: eliminate trailing space.
(symbol_elem_cmp): Filename-as-device.
(enum protoreq_t): Formatting: eliminate trailing space.
(cbl_field_t::clear_attr): Likewise.
(symbols_dump): Likewise.
(cbl_field_t::attr_str): Likewise.
(field_str): Likewise.
(symbols_update): Use _literally_zero and _literally_one.
(endian_bit): Compact access to cobol_target_big_endian().
(symbol_table_init): Normalize initialization of "special
registers".
(symbol_registers_add): Likewise.
(cbl_perform_tgt_t::recurses): Formatting: eliminate trailing space.
(symbol_literalA): Replace constq.
(cbl_alphabet_t::reencode): Eliminate trailing space.
(symbol_temporary_alphanumerics): Likewise.
(new_literal_add): Likewise.
(new_temporary_clone): Ensure FldLiteralBin5 has the endian attribute of
the target architecture.
(iconv_cd): Formatting: eliminate trailing space.
(cbl_field_t::encode): Likewise.
(cbl_field_t::set_capacity): Formatting: eliminate trailing space.
(cbl_label_t::str): Likewise.
(cbl_file_t::special_index): New function supporting
filename-as-device.
(cbl_file_t::filename_of): Likewise.
* symbols.h (struct cbl_special_name_t): Support filename as device.
(struct cbl_file_t): Likewise.
(symbol_typedef): Likewise.
(symbol_special_index): Likewise.

libgcobol/ChangeLog:

* charmaps.h (ebcdic_newline): Use just SPACES instead of both
SPACE and SPACES.
* constants.cc (INTEGER_CONSTANT1): Eliminate.
(struct cblc_field_t): Eliminate __gg__data_space.
(INTEGER_CONSTANT2): Eliminate.
(endian): Adjust the initialization of __ggsr__spaces and the
various DEBUG-ITEM components.
* libgcobol.cc (alpha_to_alpha_move_from_location): Correct a comment.
(__gg__codeset_figurative_constants): Normalize using SPACES when SPACE is
specified.
(__gg__get_figconst_data): Likewise.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/INITIALIZE_with_-defaultbyte__ASCII_.cob: Use
"VALUE '-'" instead of "VALUE'-'".
* cobol.dg/group2/INITIALIZE_with_-defaultbyte__EBCDIC_.cob:
Likewise.
* cobol.dg/group2/PR59_RT3586_-_Code_format_heuristic_fails.cob: Removed.
* cobol.dg/group2/RT3609_Unexpected_PROCESS.cob: Removed.
* cobol.dg/group2/DEBUG-ITEM_using_mh_identical.cob: New test.
* cobol.dg/group2/DEBUG-ITEM_using_mh_identical.out: New test.

2 weeks agoFix signed char test assumption [Was Re: [Linaro-TCWG-CI] gcc-17-2261-g649b2a6d9f9f...
Jeff Law [Fri, 17 Jul 2026 13:14:13 +0000 (07:14 -0600)] 
Fix signed char test assumption [Was Re: [Linaro-TCWG-CI] gcc-17-2261-g649b2a6d9f9f: 7 regressions on arm]

> Dear contributor,
>
> Our automatic CI has detected problems related to your patch(es). Please find some details below.
>
> In  armv8l-unknown-linux-gnueabihf native, after:
>   | commit gcc-17-2261-g649b2a6d9f9f
>   | Author: Jeff Law <jeffrey.law@oss.qualcomm.com>
>   | Date:   Wed Jul 8 12:30:56 2026 -0600
>   |
>   |     [PR rtl-optimization/126136] Fix dest = cond ? x : -1 when STORE_FLAG_VALUE is -1
>   |
>   |     So a while back I added support for selecting x/-1 into the ifcvt.cc by using
>   |     scc and a couple ALU operations.  That code explicitly rejects STORE_FLAG_VALUE
>   |     if it is not 1 or -1.
>   | ... 20 lines of the commit log omitted.
>
> Produces 7 regressions:
>   |
>   | regressions.sum:
>   | Running gcc:gcc.dg/torture/dg-torture.exp ...
>   | FAIL: gcc.dg/torture/pr126136.c -O0  execution test
>   | FAIL: gcc.dg/torture/pr126136.c -O1  execution test
>   | FAIL: gcc.dg/torture/pr126136.c -O2  execution test
>   | FAIL: gcc.dg/torture/pr126136.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
>   | ... and 3 more
>
> Used configuration :
>  *CI config* tcwg_gcc_check armv8l-unknown-linux-gnueabihf
>  *configure and test flags:* none, autodetected on armv8l-unknown-linux-gnueabihf--disable-multilib --with-float=hard --with-mode=thumb --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=neon-fp-armv8
>
> We track this bug report under https://linaro.atlassian.net/browse/GNU-1959. (Require Linaro login) Please let us know if you have a fix.

As others noted, this is a case where the test assumed signed chars.  The patch
makes the signedness explicit.

Bootstrapped and regression tested on armv7 and verified the test now passes on
that platform.  Pushing to the trunk.

gcc/testsuite

* gcc.dg/torture/pr126136.c: Make chars explicitly signed.

2 weeks ago[PATCH] RISC-V: Remove zama16b from xt-c9501fdvt
Wang Yaduo [Fri, 17 Jul 2026 13:08:16 +0000 (07:08 -0600)] 
[PATCH] RISC-V: Remove zama16b from xt-c9501fdvt

The binutils has not supported zama16b.  Do not enable the extension
through -mcpu=xt-c9501fdvt.

gcc/ChangeLog:

* config/riscv/riscv-cores.def (RISCV_CORE): Remove zama16b from
xt-c9501fdvt.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/mcpu-xt-c9501fdvt.c: Expect __riscv_zama16b
to be undefined.

Signed-off-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
2 weeks agolto: Support #pragma GCC diagnostic [PR80922] [PR106823] [PR107936]
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
lto: Support #pragma GCC diagnostic [PR80922] [PR106823] [PR107936]

After the previous changes in this series, the LTO front end always has an
appropriate linemap structure for interpreting diagnostic pragmas, so it is
straightforward to implement them, as is done here.

The pragmas are streamed out in each linemap section; since all locations
from a given linemap section will be contiguous in the reconstructed
linemap, they are automatically ordered properly for the existing diagnostic
pragma infrastructure to work as-is.

One wrinkle is that a single function may have been streamed out in multiple
sections. (For example, an inline function will be streamed out in all
partitions that need it.) In this case, when merging them, LTO keeps only
one of the sections, as directed by the linker resolution, so the diagnostic
pragmas that will be in force (in case they were not the same for the
different translation units) will be whichever were applicable to the
section LTO decided to keep.

gcc/ChangeLog:

PR middle-end/80922
PR middle-end/106823
PR lto/107936
* lto-streamer-in.cc (lto_create_loc_map): Process diagnostic
pragmas from the linemap sections.
* lto-streamer-out.cc (location_output::produce_linemap_section):
Stream diagnostic pragmas into the linemap section.

gcc/testsuite/ChangeLog:

PR middle-end/80922
PR middle-end/106823
PR lto/107936
* gcc.dg/lto/pr106823_0.c: New test.
* gcc.dg/lto/pr107936_0.c: New test.
* gcc.dg/lto/pr107936_1.c: New test.
* gcc.dg/lto/pr80922-1_0.c: New test.
* gcc.dg/lto/pr80922-1_1.c: New test.
* gcc.dg/lto/pr80922-2_0.c: New test.
* gcc.dg/lto/pr80922-2_1.c: New test.
* gcc.dg/lto/pr80922-2_2.c: New test.

2 weeks agolto: Overhaul approach to location streaming [PR65536]
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
lto: Overhaul approach to location streaming [PR65536]

PR65536 is about location-related issues that arise when the LTO front end
reads one or several large object files and runs out of location_t space to
encode all the locations. The main reason for the potential problem is that
the libcpp linemap is designed to be used for incrementally reading source
files (and their included header files) in the natural order. When it is
used in another way, such as by LTO, which adds locations in the order in
which it happened to read different entities, then the assumptions that
justify its design are no longer applicable, and it is not hard to run out
of location_t values (e.g., because of a large number of file changes, or
lines being added out of order.)

The PR remains open because it is not theoretically resolved, but it has
been resolved for all practical purposes by the following two improvements:

    1) The lto_location_cache class now tries hard to optimize the number of
       maps that it creates, especially by sorting the locations before
       adding them. This approach only goes so far, because it can only work
       at the LTO section level, so each function is handled independently
       of the others, but it helps a lot with reducing the number of maps
       required for a single function.

    2) We moved to 64-bit location_t, which means everything is a lot more
       forgiving of wasting location_t space.

Point 2) made this not much of an issue in practice, although sufficiently
large files (especially with very long lines) could still trigger a problem
in theory. While locations are now by and large working fine in LTO, there
was an interesting discussion on PR65536, starting around:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65536#c8

about how the location streaming might be optimized by streaming the linemap
structure itself, rather than a (file name, line number, column number)
triplet for each location. In the end, this approach was not taken because
solution 1) above was adequate and less disruptive. But the arguments
presented in favor of streaming the linemap directly are still interesting.

That discussion did not touch on another topic, namely the need to make
`#pragma GCC diagnostic' usable in LTO. Right now, it does not work, because
the diagnostic pragmas are not streamed out. But even if they were streamed
out, the existing approach to locations in the LTO front end is not
compatible with enforcing the pragmas. Diagnostic pragmas require a global
ordering on location_t values, so that the machinery in option-classifier.cc
can determine which pragmas are in force at each location. This requires
remembering the order in which each source line was encountered, and that is
exactly what is encoded in the linemap. This cannot be reconstructed just
from source file names and line numbers; consider, for example, that the
same file might be used in different translation units or multiple times in
the same translation unit with different diagnostic pragmas in place each
time.

These considerations tip the scales in favor of adding linemap streaming as
Manuel proposed on the PR. This patch prepares to support `#pragma GCC
diagnostic' in the LTO front end by changing the approach to location
streaming along these lines. The new approach has these general
characteristics:

    o There is a new LTO section (LTO_section_linemap) that contains the
      information needed to reconstruct the linemap. There is an entry for
      each line_map_ordinary object that was used by at least one
      streamed-out location. When the LTO front end reads one of these map
      entries, it adds a new map with the corresponding properties to its
      own linemap using the new line_map_add_raw_map interface in libcpp.

    o When a location needs to be output, we stream out two integers: one to
      identify which linemap contains the location, and one containing the
      offset from the start of that map to the location.

    o When the language front ends stream out their data, they produce a
      single linemap section (labeled as linemap.0) that applies to the
      whole translation unit. When WPA prepares partitioned files for
      LTRANS, it may copy function bodies into the LTRANS files without
      reading them, so it needs also to copy the linemap sections they refer
      to. Since the same linemap section will often be needed by more than
      one partition, this is done by putting all of the linemap sections
      into one additional object file, which is provided as input to each
      LTRANS process via the new option -fltrans-linemap-file.

    o The naming of the LTRANS linemap sections is stable so as not to
      inhibit incremental LTO.

    o Once the reader has processed the linemap sections, there is no
      further overhead associated with inputting a location, unless it is an
      adhoc location for the purpose of associating a discriminator or a
      tree with the location. For the adhoc location case, the existing
      lto_location_cache setup is still useful to avoid creating unneeded
      adhoc locations, so this has been left in place as before. The
      restriction that there be only one lto_location_cache at a time is no
      longer strictly necessary; but it is still useful so that the IPA
      passes can access the currently active one simply, so I have not
      changed this for now.

With this new setup, PR65536 can be closed.  The subsequent patches in this
series will enable support for diagnostic pragmas.

gcc/lto/ChangeLog:

PR lto/65536
* lang.opt: Add -fltrans-linemap-file.
* lto-common.cc (lto_read_in_decl_state): Read the linemap ID from
function sections.
(linemap_section_id): New function.
(create_subid_section_table): Note how many linemap sections were
found in each input section.
(loc_map_decl_data): New GC root.
(lto_file_read): Make ORDER into a static variable so it counts
continuously across all files and sub-files provided on the command
line.
(lto_file_finalize): Handle reading the new LTRANS linemap file.
(read_cgraph_and_symbols): Likewise. Also stop freeing
ALL_FILE_DECL_DATA at the end; the ordered list of files is now
useful later on for lto_copy_linemaps().
* lto.cc (stream_out_linemaps): New function.
(lto_wpa_write_files): Stream out the linemaps for LTRANS to use.

gcc/testsuite/ChangeLog:

PR lto/65536
* gcc.misc-tests/outputs.exp: Adjust LTO -save-temps tests to expect
the new linemap file.

gcc/ChangeLog:

PR lto/65536
* doc/lto.texi: Document the new LTO_section_linemap and the new
option -fltrans-linemap-file.
* lto-opts.cc (lto_write_options): Handle the new option.
* opts.cc (gen_command_line_string): Likewise.
* lto-section-in.cc (lto_section_name[]): Add new name for
LTO_section_linemap.
* lto-streamer-in.cc (get_location_from_idx): New function.
(lto_location_cache::cmp_loc): Remove.
(bp_unpack_delta): New function.
(create_loc_map): New function.
(get_loc_map): New function.
(lto_location_cache::override_loc_map): New function.
(lto_location_cache::apply_location_cache): Pervasive changes to
implement new location streaming format.
(lto_location_cache::input_location_and_block): Likewise.
(lto_location_cache::input_location): Rename argument LOC -> DEST
for clarity.
(lto_read_body_or_constructor): Handle LINEMAP_ID in the decl state.
(lto_data_in_create): Add NEED_LOCATION_CACHE argument. Rename local
variable DATA_IN to D to avoid clash with the type name.
* lto-streamer-out.cc (clear_line_info): Update for change to class
output_block.
(compute_map_hash): New function.
(class location_output): New class.
(location_output::record_location): New function.
(bp_pack_delta): New function.
(location_output::produce_linemap_section): New function.
(lto_output_location_1): Pervasive changes to implement new location
streaming format.
(copy_function_or_variable): Set the LINEMAP_ID in the decl state.
(copy_linemap_section): New function.
(copy_linemap_sections): New function.
(lto_copy_linemaps): New function.
(lto_register_linemap_for_output): New function.
(lto_output_decl_state_refs): Output the LINEMAP_ID for function
decls.
(lto_out_decl_state_written_size): Adapt for new LINEMAP_ID output.
(produce_asm_for_decls): Output the linemap section when needed.
* lto-streamer.cc (lto_get_section_name): Handle linemap sections,
which need an order suffix.
* lto-streamer.h (enum lto_section_type): Fix typo in the
comment. Add LTO_section_linemap.
(struct lto_loc_map): New struct.
(class lto_location_cache): Pervasive changes to implement new
location streaming format.
(struct lto_in_decl_state): Add LINEMAP_ID member.
(struct lto_out_decl_state): Likewise.
(struct lto_file_decl_data): Add LOC_MAP_DECL_DATA, LOC_MAPS,
and NUM_LINEMAP_SECTIONS members.
(lto_linemap_output_id): New function.
(struct output_block): Adjust members for new streaming format.
(data_in::data_in): New function.
(lto_data_in_create): Adjust prototype for new NEED_LOCATION_CACHE
argument.
(lto_register_linemap_for_output): Declare.
(lto_copy_linemaps): Declare.
* lto-wrapper.cc (run_gcc): Pass new argument -fltrans-linemap-file.
* timevar.def (TV_IPA_LTO_LINEMAP_IN): New timevar.
(TV_IPA_LTO_LINEMAP_OUT): New timevar.
(TV_IPA_LTO_LINEMAP_COPY): New timevar.

2 weeks agotestsuite: Add { dg-lto-do incr-link } option
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
testsuite: Add { dg-lto-do incr-link } option

Similar to { dg-lto-do ar-link }, which allows testing the combination of
multiple LTO objects into an archive before linking, this new directive
allows testing the incremental linking modes of the LTO front end.

gcc/ChangeLog:

* doc/sourcebuild.texi: Document ar-link and incr-link options to
dg-lto-do directive.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/README: Update to document ar-link and incr-link.
* lib/lto.exp: Support incr-link directive throughout.

2 weeks agotestsuite: Add dg-lto-additional-options directive
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
testsuite: Add dg-lto-additional-options directive

In the LTO testsuite, tests run by default with a variety of options. If
the dg-lto-options directive is used, the default list is replaced with just
the requested options, so there is no convenient way, for instance, to add a
given option like -Wall to all of the options being tested.

This will be handy for testing `#pragma GCC diagnostic' in the next patch in
this series, so this patch adds a new directive dg-lto-additional-options
for that purpose. This keeps the list of options to test unchanged, and
just adds the requested options to all of them.

gcc/ChangeLog:

* doc/sourcebuild.texi: Document dg-lto-additional-options
directive.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/README: Document dg-lto-additional-options directive.
* lib/lto.exp (lto-get-options-main): Implement
dg-lto-additional-options directive.
(lto-execute-1): Likewise.

2 weeks agodiagnostics: Preparation for LTO diagnostic pragma support
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
diagnostics: Preparation for LTO diagnostic pragma support

The next patches in this series will enable support for `#pragma GCC
diagnostic' in the LTO streaming code.  This requires some minor changes to
the diagnostics interface so that LTO can access what it needs:

    1) Make the name of the type option_classifier::classification_change_t
       publicly accessible. The actual m_classification_history object is
       already public via an accessor function, which was needed for C++
       modules; this patch just additionally makes the name of the type
       accessible for convenience.

    2) Add a trailing member to enum diagnostics::kind indicating the
       maximum possible value. This is for the benefit of LTO streaming that
       can make use of the range information.

    3) The function option_classifier::classify_diagnostic() does some work
       to return a value; when a diagnostic kind is changed, it claims to
       return the previous kind. The returned value is incorrect, however;
       it does not attempt to follow the history of diagnostic pop pragmas
       to return the actual previous value, and it could also misinterpret a
       pop directive if the pop index happens to match the index of the
       option being processed.  There is no actual need to compute this
       value, and it has never been used by any callers, so remove it
       entirely.

       This change is not strictly necessary for the rest of this
       patch series, but the extra work being done here may be a bigger
       concern for LTO, which could potentially have a rather large list of
       diagnostic pragmas to work with, so it seemed worthwhile to include
       this fix now.

gcc/ChangeLog:

* diagnostic.h (diagnostic_classify_diagnostic): Adapt for removal
of return value in option_classifier::classify_diagnostic.
* diagnostics/context.h: Likewise.
* diagnostics/kinds.h (enum kind): Add trailing element to indicate
the total number of kinds.
* diagnostics/option-classifier.cc
(option_classifier::classify_diagnostic): Remove the return value,
which was not correct and which was not used anyway.
* diagnostics/option-classifier.h (class option_classifier): Adjust
prototype for classify_diagnostic.  Make the name of nested strruct
classification_change_t publicly accessible.

2 weeks agolibcpp: Preparation for LTO linemap changes
Lewis Hyatt [Sat, 11 Jul 2026 18:21:12 +0000 (14:21 -0400)] 
libcpp: Preparation for LTO linemap changes

The expected way to create a new map in a line_map object is to call
linemap_add() and/or linemap_line_start(), which contain the necessary logic
to decide if a location can be encoded in the currently active map or if a
new map is required, and, in the latter case, what properties the new map
requires. This interface works well for the typical use case where a line
map is built up incrementally as source lines are processed, but it does not
provide the user with precise control over the exact properties of the newly
added map (or even whether a map is added at all).

That level of control will be needed for an upcoming change to the approach
to streaming location data for the LTO front end. Enable it by adding a new
function linemap_add_raw_map(), which simply allows the user (i.e., the LTO
front end) to add maps with the desired properties. The user is then
responsible for making sure the resulting state makes sense.

This patch adds self-tests for the new function, but does not otherwise make
any observable changes yet.

gcc/ChangeLog:

* input.cc (test_accessing_ordinary_linemaps): Test new
line_map_add_raw_map() functionality.

libcpp/ChangeLog:

* include/line-map.h (linemap_next_start_location): New function.
(linemap_add_raw_map): Declare new function.
* line-map.cc (linemap_add): Minor refactor to make use of
linemap_next_start_location().
(linemap_add_raw_map): New function.
(linemap_lookup): Update the comment for clarity.

2 weeks agomatch: Simplify sign tests for MIN and BIT_IOR [PR126087]
Neal Patalay [Fri, 17 Jul 2026 11:02:39 +0000 (04:02 -0700)] 
match: Simplify sign tests for MIN and BIT_IOR [PR126087]

When `b` is known to be non-negative, the sign of both `MIN (a, b)`
and `a | b` depends only on the sign of `a`. Add patterns to match.pd
to optimize `MIN (a, b) cmp 0` and `(a | b) cmp 0` into `a cmp 0`,
where `cmp` is `<` or `>=`. Currently, `(a | b) cmp 0` is optimized
at the RTL level for some targets, but simplifying earlier is
preferable.

PR tree-optimization/126087

gcc/ChangeLog:

* match.pd: Simplify MIN and BIT_IOR compared to 0 when
one operand is non-negative.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Neal Patalay <nealpatalay0@gmail.com>
2 weeks agoi386: Add ROLW %r,8 alternative to bswaphi2 patterns [PR126283]
Uros Bizjak [Fri, 17 Jul 2026 11:28:16 +0000 (13:28 +0200)] 
i386: Add ROLW %r,8 alternative to bswaphi2 patterns [PR126283]

The HImode bswap can be implemented in two ways: using XCHGB %rH,%rL or
ROLW %r,8 where the former does not clobber flags.  Unfortunately, clobber-less
XCHGB form limits available register set to only %ax, %bx, %cx and %dx, where
ROLW can use all registers (but clobbers flags reg).

It is better to use the form that clobbers flags reg and leave insn selection
to the compiler via preferred_for_* machinery.  This choice also makes
"improve register allocation" peephole2 obsolete.

Also, always convert HImode rotate by 8 to bswap pattern, which can also
emit MOVBE instruction when available.

PR target/126283

gcc/ChangeLog:

* config/i386/i386.md (bswaphi2): Add flags reg clobber.
(*bswaphi2_movbe): Add flags reg clobber.  Add ROLW alternative
and update instruction attributes.  Add preferred_for_size and
preferred_for_speed attributes.
(*bswaphi2): Ditto.
(*bswaphisi2_lowpart): Ditto.
(XCHGB -> ROLW peephole2 patterns): Remove.
(ROLW reg,8 -> BSWAP splitter): Update for added flags reg clobber.
Always split.
* config/i386/i386-expand.cc (ix86_expand_gfni_bitreverse):
Update for bswaphi2 change.

gcc/testsuite/ChangeLog:

* gcc.target/i386/xchg-1.c: Scan for XCHG instead of ROL.
* gcc.target/i386/pr126283.c: New test.

2 weeks agotestsuite: Add regression test for PR81549
Naveen [Fri, 17 Jul 2026 11:13:10 +0000 (04:13 -0700)] 
testsuite: Add regression test for PR81549

The testcase from PR tree-optimization/81549 is already optimized on
current trunk by the existing loop-PHI final-value replacement code.
Add the testcase to preserve coverage for the delayed loop-carried value
and verify that the final stores and return value are folded to constants.

gcc/testsuite/ChangeLog:

PR tree-optimization/81549
* gcc.dg/tree-ssa/pr81549.c: New test.
* gcc.dg/tree-ssa/pr81549-2.c: New test.

Signed-off-by: Naveen <naveen.siddegowda@oss.qualcomm.com>
2 weeks agoopenmp: Add OMPT variant of GOMP_has_masked_thread_num
Paul-Antoine Arras [Thu, 16 Jul 2026 13:06:16 +0000 (15:06 +0200)] 
openmp: Add OMPT variant of GOMP_has_masked_thread_num

Add GOMP_has_masked_thread_num_with_end, which is semantically identical but
meant for -fopenmp-ompt.

gcc/ChangeLog:

* omp-builtins.def (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END):
New builtin.
* omp-low.cc (lower_omp_master): Use it when -fopenmp-ompt.

libgomp/ChangeLog:

* libgomp.map: Add GOMP_has_masked_thread_num_with_end.
* libgomp.texi: Document it.
* libgomp_g.h (GOMP_has_masked_thread_num_with_end): Declare.
* parallel.c (GOMP_has_masked_thread_num_with_end): New function.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/masked-1.c: Check new builtin is not emitted.
* c-c++-common/gomp/masked-3.c: Check new builtin is emitted with
-fopenmp-ompt.

2 weeks agolibstdc++: Use __FLT_EVAL_METHOD__ to enable test for piecewise distributions.
Tomasz Kamiński [Fri, 17 Jul 2026 09:49:30 +0000 (11:49 +0200)] 
libstdc++: Use __FLT_EVAL_METHOD__ to enable test for piecewise distributions.

As pointed out by Jakub, the use of excess precision is most likely source
of differences.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize2.cc:
Guard test_custom invocations with __FLT_EVAL_METHOD__ macros.
* testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize2.cc:
Likewise.

2 weeks agoc++: Implement C++29 P3424R2 - Deallocation Functions with Throwing Exception Specifi...
Jakub Jelinek [Fri, 17 Jul 2026 07:58:00 +0000 (09:58 +0200)] 
c++: Implement C++29 P3424R2 - Deallocation Functions with Throwing Exception Specification Are Ill-formed [PR125833]

The following patch attempts to implement the C++29 P3424R2
Deallocation Functions with Throwing Exception Specification Are Ill-formed
paper by diagnosing those cases in grokfndecl, maybe_instantiate_noexcept and
cp_parser_class_specifier.

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

PR c++/125833
* cp-tree.h: Implement C++29 P3424R2 - Deallocation Functions with
Throwing Exception Specification Are Ill-formed.
(maybe_diagnose_deallocation_noexcept_false): Declare.
* decl.cc (maybe_diagnose_deallocation_noexcept_false): New function.
(grokfndecl): Call it.
* pt.cc (maybe_instantiate_noexcept): Likewise.
* parser.cc (cp_parser_class_specifier): Likewise.

* g++.dg/cpp0x/dealloc2.C: Expect extra diagnostics in C++29.
* g++.dg/cpp29/dealloc1.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 weeks agobuild: testsuite: Generate effective targets from auto-host.h
Rainer Orth [Fri, 17 Jul 2026 07:53:34 +0000 (09:53 +0200)] 
build: testsuite: Generate effective targets from auto-host.h

Several of the testsuite's effective targets are supposed to match the
result of configure tests.  However, they often try to redo the tests,
which leads to code duplication and inconsistencies.

Instead, this patch provides a framework to automatically generate
check_effective_target_<effective-target> procs that match an
auto-host.h macro and loads the result into targets-support.exp.

The effective target definitions are read from et-static.def, similar to
the existing *.opt files, with a two-step process: preprocessing
et-static.def by stripping comments and empty lines, emitting the result
in a simple record format.  That is used to scan auto-host.h to provide
the actual effective-target definitions.

Both the resulting et-static.def and the auto-host.h file are installed
so they can seamlessly be used for installed testing.

contrib/test_installed has been modified to allow for three scenarios:

* By default, the testsuite will load the installed et-static.exp file
  directly.

* To use a modified or fallback et-static.exp, it can be specified with
  --with-et-static.

* With --with-auto-host-h, an et-static.exp file matching the source
  tree to be tested can be generated from a corresponding auto-host.h
  file.  This allows for testing an older installed compiler with a
  newer source tree.

To avoid interfering with the target-supports.exp code to locate
et-static.exp, test_installed only emits the *_UNDER_TEST variables to
site.exp if a particular front end is actually tested.

To demonstrate the facility, this patch uses the recently added
HAVE_LD_AT_FILE check as a trivial example.  Just as HAVE_LD_AT_FILE was
used to replace the current HAVE_GNU_LD, this patch creates a new
ld_at_file effective target, replacing one use of the gld effective
target.

Bootstrapped without regressions on i386-pc-solaris2.11 (as/ld and
gas/gld) and x86_64-pc-linux-gnu.  Also tested with test_installed on
i386-pc-solaris2.11.

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

gcc:
* et-gather.awk, gen-et-static.awk: New scripts.
* Makefile.in (testsuitedir): New.
(native): Depend on testsuite/et-static.exp.
(clean): Remove etlist.
(distclean): Remove et-static.exp.
(install-testsuite): New target.
(install): Depend on it.
(site.exp): Depend on testsuite/et-static.exp.
(testsuite/et-static.exp): New target.

* doc/sourcebuild.texi (Effective-Target Keywords): Document
et-static.def.
(Effective-Target Keywords, Other attributes): Document
ld_at_file.

gcc/testsuite:
* lib/et-static.def: New file.
* lib/target-supports.exp: Load et-static.exp.
* gcc.misc-tests/outputs.exp: Use ld_at_file effective target
instead of gld.
Update comment.

contrib:
* test_installed (--with-auto-host-h): New option.
(--with-et-static): Likewise.
(--with-objc): Likewise.
Generate et-static.def if --with-auto-host-h is specified.
(GCC_UNDER_TEST): Only emit to site.def if enabled.
(GXX_UNDER_TEST): Likewise.
(GFORTRAN_UNDER_TEST): Likewise.
(OBJC_UNDER_TEST): Likewise.
(et_static): Emit to site.exp if specified.

2 weeks agox86: Avoid misaligned prologue if count <= epilogue size
H.J. Lu [Wed, 15 Jul 2026 21:39:33 +0000 (05:39 +0800)] 
x86: Avoid misaligned prologue if count <= epilogue size

After

commit cbc56384029c9224280b0a1018fb9502797f243d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jun 26 08:43:20 2026 +0800

    determine_block_size: Set len_rtx to min size if min size == max size

ix86_expand_set_or_cpymem may use vector loop on a block of memory whose
size < epilogue size.  Don't use misaligned prologue if count <= epilogue
size.

gcc/

PR target/126275
* config/i386/i386-expand.cc (ix86_expand_set_or_cpymem): Don't
use misaligned prologue if count <= epilogue size.

gcc/testsuite/

PR target/126275
* gcc.target/i386/pr126275.c: New.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoAda: Fix bogus type mismatch for reduction expression with non-integer index
Eric Botcazou [Fri, 17 Jul 2026 07:14:46 +0000 (09:14 +0200)] 
Ada: Fix bogus type mismatch for reduction expression with non-integer index

This is a regression recently introduced by the rewrite of the resolution of
reduction expressions.  The resolution of the prefix to an array type built
on the fly when it is an aggregate does not work properly, so this removes
it to get back to the previous working state.  This requires performing the
full resolution of the reducer even if it is not overloaded to avoid losing
errors in some illegal cases.

gcc/ada/
* sem_attr.adb (Resolve_Attribute) <Attribute_Reduce>: Perform the
full resolution of the reducer even if it is not overloaded, but do
not resolve the prefix if it is an aggregate

2 weeks agoImprove BB vectorization of reductions
Richard Biener [Wed, 15 Jul 2026 09:33:50 +0000 (11:33 +0200)] 
Improve BB vectorization of reductions

When there's not a uniform chain of operations gathered from the
reduction operation chain we currently simply fail and to make
success more likely we strip off the last operation to make the
number of lanes at least even.  This isn't ideal and somewhat
random as can be seen in PR126028 which is the motivating case
and has a three lane reduction.  So the following removes the
early stripping down to an even number of lanes and uses SLP
discovery of the whole group to direct re-analysis of the
larger of the matching or non-matching part.

For gcc.dg/vect/pr106081.c we now BB vectorize parts which
just confuses the loop vectorization dump scanning, so disable it.

PR tree-optimization/126028
* tree-vect-slp.cc (vect_slp_check_for_roots): Do not
force the BB reduction root to have an even number of lanes.
(vect_build_slp_instance): For failed discovery of a BB
reduction attempt to re-try discovery on the matching or
non-matching part.

* gcc.dg/vect/bb-slp-reduc-2.c: New testcase.
* gcc.dg/vect/bb-slp-reduc-3.c: Likewise.
* gcc.dg/vect/pr106081.c: Disable BB vectorization.

2 weeks agoDaily bump.
GCC Administrator [Fri, 17 Jul 2026 00:16:39 +0000 (00:16 +0000)] 
Daily bump.

2 weeks agoRevert "libstdc++: Fix LD_LIBRARY_PATH when testing an installed compiler"
Arsen Arsenović [Thu, 16 Jul 2026 21:17:25 +0000 (23:17 +0200)] 
Revert "libstdc++: Fix LD_LIBRARY_PATH when testing an installed compiler"

I somehow missed that this breaks parallel testing.  I intend to
reintroduce the fix for installed compilers over the weekend.

This reverts commit 7f2bba0d2d08219e79ab6ba543be42ccdb37a760.

Reported-by: Jakub Jelinek <jakub@redhat.com>
2 weeks agocobol: Repair mh_identical MOVEs involving DEBUG registers [PR126277]
Robert Dubner [Thu, 16 Jul 2026 20:23:37 +0000 (16:23 -0400)] 
cobol: Repair mh_identical MOVEs involving DEBUG registers [PR126277]

The mh_identical MOVE routine was flummoxed by the DEBUG-XXX registers that
are children of DEBUG-ITEM.  These changes repair that problem.

PR cobol/126277

gcc/cobol/ChangeLog:

* move.cc (mh_identical): Handle externals that have parents.
(mh_binary_to_packed): Eliminate trailing whitespace.
* symbols.cc (symbol_table_init): Correct attributes of DEBUG-CONTENTS.

libgcobol/ChangeLog:

* constants.cc (struct cblc_field_t): Adjust initialization of
DEBUG-ITEM fields.

2 weeks agocobol: Update --help text to be consistent with gcobol.1. Fix PR 125987.
James K. Lowden [Thu, 16 Jul 2026 19:04:11 +0000 (15:04 -0400)] 
cobol: Update --help text to be consistent with gcobol.1.  Fix PR 125987.

gcc/cobol/ChangeLog:

* gcobolspec.cc (lang_specific_driver): New text for OPT__help.

2 weeks agoopenmp: Pass loop parameters to static worksharing dispatch builtins for OMPT
Paul-Antoine Arras [Wed, 15 Jul 2026 18:41:45 +0000 (20:41 +0200)] 
openmp: Pass loop parameters to static worksharing dispatch builtins for OMPT

The GOMP_*_static_worksharing_dispatch builtins took no arguments and the
OMPT dispatch callback was missing information about the loop. Pass the loop's
iteration count, start, step, chunk size, and the thread's starting
iteration instead.

gcc/ChangeLog:

* builtin-types.def (BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG): New.
* omp-builtins.def (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING_DISPATCH): Use
BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG.
(BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING_DISPATCH): Likewise.
* omp-expand.cc (expand_omp_for_static_nochunk): Pass niter, start,
incr, chunk size, and istart to the dispatch call.
(expand_omp_for_static_chunk): Likewise.

gcc/fortran/ChangeLog:

* types.def (BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG): New.

libgomp/ChangeLog:

* config/gcn/teams.c (GOMP_distribute_static_worksharing_dispatch): Add
niter, start, incr, chunk_size, and istart parameters (unused).
* config/nvptx/teams.c (GOMP_distribute_static_worksharing_dispatch):
Likewise.
* libgomp_g.h (GOMP_loop_static_worksharing_dispatch): Update prototype.
(GOMP_distribute_static_worksharing_dispatch): Likewise.
* loop.c (GOMP_loop_static_worksharing_dispatch): Add niter, start,
incr, chunk_size, and istart parameters (unused).
* teams.c (GOMP_distribute_static_worksharing_dispatch): Likewise.
* testsuite/libgomp.c-c++-common/for-static-3.c: Update scan pattern
to match new arguments.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/for-static-3.c: Update scan pattern to match new
arguments.

2 weeks agocobol: Fix PR 126002. Accept parenthesized sign condition.
James K. Lowden [Thu, 16 Jul 2026 16:24:25 +0000 (12:24 -0400)] 
cobol: Fix PR 126002.  Accept parenthesized sign condition.

Also new specific diagnostics for invalid use of a device name outside
SELECT.

gcc/cobol/ChangeLog:

* parse.y: New diagnostic messages regarding invalid device
name use.
* scan.l: Add right paren as lexical terminator for simple
condition.

2 weeks agoRISC-V: Fix typo in gcc.dg/asm-hard-reg-4.c
Craig Blackmore [Mon, 13 Jul 2026 16:14:40 +0000 (17:14 +0100)] 
RISC-V: Fix typo in gcc.dg/asm-hard-reg-4.c

The scan assembler test was not being run for RISC-V due to a typo in
the target selector.

gcc/testsuite/ChangeLog:

* gcc.dg/asm-hard-reg-4.c: Fix typo in target selector.

2 weeks agoPath ranger should check root ranger equivalencies as well.
Andrew MacLeod [Wed, 15 Jul 2026 19:43:14 +0000 (15:43 -0400)] 
Path ranger should check root ranger equivalencies as well.

Path ranger currently checks the root ranger for realtions between
only local equivalencies.   If that fails, it should also check the
root ranger for any equivalencies and relations between the two names
which occur earlier in the IL.

PR tree-optimization/125986
* value-relation.cc (path_oracle::query): Query root oracle for
relations.

2 weeks agoRISC-V: Use a pseudo for sibcall addresses
Jin Ma [Thu, 16 Jul 2026 07:56:08 +0000 (15:56 +0800)] 
RISC-V: Use a pseudo for sibcall addresses

SIBCALL_REGS excludes t1, so the "j" constraint makes LRA reload a
sibcall address materialized in t1.  Sibcalls are therefore correct
without this change.

Use a pseudo for sibcall address materialization so allocation can
select SIBCALL_REGS directly and avoid the reload.  Keep t1 for normal
calls.  This is an optimization, not a bug fix.

gcc/ChangeLog:

* config/riscv/riscv-protos.h
(riscv_legitimize_call_address): Add a sibcall parameter.
* config/riscv/riscv.cc
(riscv_legitimize_call_address): Use a pseudo for sibcalls.
* config/riscv/riscv.md (sibcall): Pass true for sibcalls.
(sibcall_value): Likewise.
(call): Pass false for ordinary calls.
(call_value): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sibcall-materialize-pseudo.c: New test.

2 weeks agoRISC-V: Exclude t1 from SIBCALL_REGS
Jin Ma [Sat, 11 Jul 2026 14:45:54 +0000 (22:45 +0800)] 
RISC-V: Exclude t1 from SIBCALL_REGS

RISCV_CALL_ADDRESS_TEMP and RISCV_PROLOGUE_TEMP2 both use t1.  An
indirect sibcall target in t1 can therefore be overwritten by an RVV
scalable-frame epilogue before the final jump.

Exclude t1 from SIBCALL_REGS and map it to JALR_REGS.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_regno_to_class): Map t1 to
JALR_REGS.
* config/riscv/riscv.h (RISCV_PROLOGUE_TEMP_REGNUM): Document
the SIBCALL_REGS restriction.
(REG_CLASS_CONTENTS): Remove t1 from SIBCALL_REGS.

gcc/testsuite/ChangeLog:

* g++.target/riscv/pr97682.C: Accept registers in SIBCALL_REGS.
* gcc.target/riscv/rvv/base/sibcall-scalable-frame-indirect.c:
New test.
* gcc.target/riscv/rvv/base/sibcall-scalable-frame-weak.c: New test.

2 weeks agoMAINTAINERS: Add myself to write after approval
Craig Blackmore [Thu, 16 Jul 2026 15:37:04 +0000 (16:37 +0100)] 
MAINTAINERS: Add myself to write after approval

ChangeLog:

* MAINTAINERS (Write After Approval): Regenerate.
* MAINTAINERS.yml: Add myself.

2 weeks agolibstdc++: Resolve named-rule UNTIL save adjustment [PR116110]
Tomasz Kamiński [Tue, 14 Jul 2026 14:06:36 +0000 (16:06 +0200)] 
libstdc++: Resolve named-rule UNTIL save adjustment [PR116110]

The previous patches for PR 116110 left one case unresolved: a Zone
line with a wall-time UNTIL whose RULES field is a named rule set.
The save value used to convert the wall UNTIL to UTC depends on which
rule of the set was active at the UNTIL instant, but at parse time
the rule records have not all been loaded, so the active-rule lookup
can't yet be performed.

The remaining FIXME in operator>>(istream&, ZoneInfo&) caused zones
like Africa/Algiers (around 1977-10-21) to place their zone-line
boundary one save-period off from the canonical zic interpretation,
producing brief incorrect sys_info windows during DST transitions.

This commit defers the save adjustment to _M_get_sys_info call,
and applies it only for the ZoneInfo surrounding the specified
time. This assumes that applying the save does not change relative
order of ZoneInfo (i.e. the until members are spaced more than save).

The m_expanded member is replaced with four state _M_state setting:
Expanded, and three separte state used for rule based zones:
* SaveKnown - m_save contains save value at time m_until
* SavePending - m_save is defualted to zero, m_until is correct
* UntilPending - as above, but also m_until time need to adjusted
The parser set the UntilPending state when it sees a wall-time
UNTIL on a named-rule line, and SaveKnown if not UNTIL date is
specified.

The fixup in _M_get_sys_info, is performed by calc_save function
on previous/current zone. If necessary (depending on m_state) this
function updates m_save and m_until members, and returns true
if the m_until was shifted in the process. In such case, we redo
the comparision of until() against tp, and move iterator to active
zone info if necessary. The save at boundary for previous/current
ZoneInfo is required to implement proper zone merging, so it is
always computed.

The active-rule lookup either reuses the existing find_active_rule
overload accepting sys_seconds (if UNTIL is not affected by save),
or newly introduced overload accepting local_seconds (local time).
The local_seconds versions, follows the same logic for finding
rule transitions (extracted to find_surrounding_transitions)
surrounding the sys_time. The final active rule, is then determined
after converting the transition times to local time, including the
running save.

The test_apia case in 116110.cc had a hardcoded `+11h` workaround
for the unfixed bug; with this fix in place the workaround is removed
and the value becomes the canonical `+10h`.

libstdc++-v3/ChangeLog:

PR libstdc++/116110
* src/c++20/tzdb.cc (ZoneInfo::calc_save, ZoneInfo::State): Define.
(ZoneInfo::m_expanded): Replaced with m_state.
(ZoneInfo::m_pos): Reduce the bit with to 14.
(ZoneInfo::m_state): Expands m_expanded with four state enum.
(ZoneInfo::ZoneInfo, ZoneInfo::expanded, ZoneInfo::set_abbrev):
Replace m_expanded usage with m_state and State::Expanded.
(Transitions, find_surrounding_transitions): Extracted from
find_active_rule.
(find_active_rule): Define overload for local_seconds. Implement
both in terms of find_surrounding_transitions.
(time_zone::_M_get_sys_info): Use ZoneInfo::calc_save to adjust
until() on surrounding zones, and shift the current zone iterator
(i) accordingly.
(operator>>(istream&, ZoneInfo&)): Set m_state for UntilPending
for UNTIL time using wall time, and SaveKnown for lines without
end date. For clarity, set m_save to 0 if daylight is not used.
* testsuite/std/time/time_zone/116110.cc (test_apia): Use correct
value of the the total offset.
testsuite/std/time/time_zone/pr116110_named.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Álvaro Begué <alvaro.begue@gmail.com>
Signed-off-by: Álvaro Begué <alvaro.begue@gmail.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 weeks agogcov: Build edge updates in a local sequence
Sebastian Huber [Thu, 16 Jul 2026 04:34:50 +0000 (12:34 +0800)] 
gcov: Build edge updates in a local sequence

Instead of inserting each generated statement onto an edge individually, which
happens repeatedly for the same edge while flushing the condition coverage
accumulators, build up a local gimple_seq for the edge and insert it once with
a single gsi_insert_seq_on_edge() call.  emit_assign() and emit_bitwise_op()
are changed to append to a caller-supplied gimple_seq instead of inserting
directly on an edge.

Suggested by Andrew Pinski:

https://inbox.sourceware.org/gcc-patches/CALvbMcD_BM-PESKx1nei4vccLomXLgvS=YTO8kKGRpMAHifsKg@mail.gmail.com/#t

Tested on x86_64-pc-linux-gnu (gcov.exp, gcc.dg gcov*.c, tree-prof.exp) with no
regressions.

gcc/ChangeLog:

* tree-profile.cc (emit_assign): Append to a gimple_seq instead
of inserting on an edge.  Make the functions static.
(emit_bitwise_op): Likewise.
(instrument_decisions): Build up a local gimple_seq per edge and
insert it once instead of inserting each statement individually.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2 weeks agogcov: Optimize condition coverage code generation
Sebastian Huber [Thu, 16 Jul 2026 03:53:41 +0000 (11:53 +0800)] 
gcov: Optimize condition coverage code generation

Change the code to avoid emitting bitwise-or operations with a zero constant
operand since they are effectively no-operations.  The omitted bitwise-or
operations are potentially relaxed atomic operations which cannot be optimized
away once emitted, so the omission has to happen while generating the profiling
code in instrument_decisions(), not as a later gimple optimization.

For example, consider this test case:

int a(int);
int b(int);
int g(int i)
{
  if (i) {
    return a(i);
  } else {
    return b(i);
  }
}

On 64-bit RISC-V this change results in the following code changes for
options -fprofile-update=atomic -fcondition-coverage -O2:

  --- test.s.old        2026-06-19 06:53:06.806622709 +0200
  +++ test.s.new        2026-06-19 06:53:29.187922134 +0200
  @@ -9,15 +9,13 @@
          .type   g, @function
   g:
          lui     a5,%hi(.LANCHOR0)
  -       addi    a5,a5,%lo(.LANCHOR0)
          beq     a0,zero,.L2
          li      a4,1
  +       addi    a5,a5,%lo(.LANCHOR0)
          amoor.d zero,a4,0(a5)
  -       addi    a5,a5,8
  -       amoor.d zero,zero,0(a5)
          tail    a
   .L2:
  -       amoor.d zero,zero,0(a5)
  +       addi    a5,a5,%lo(.LANCHOR0)
          li      a4,1
          addi    a5,a5,8
          amoor.d zero,a4,0(a5)
  @@ -35,7 +33,7 @@
          .word   1110847786
          .zero   4
          .dword  0
  -       .word   -566726224
  +       .word   -566618674
          .word   903831156
          .dword  .LC0
          .dword  0

Tested on x86_64-pc-linux-gnu (gcov.exp, gcc.dg gcov*.c, tree-prof.exp)
with no regressions, and manually cross-checked on 64-bit RISC-V for the
asm diff shown above.

gcc/ChangeLog:

* tree-profile.cc (emit_bitwise_op): Build/fold the operation with
gimple_build() instead of gimple_build_assign(), and return the
folded result as-is instead of always materializing a new SSA
name.
(instrument_decisions): Do not emit bitwise-or operations with a
zero constant operand.

gcc/testsuite/ChangeLog:

* gcc.dg/gcov-atomic-or-zero.c: New test.
* gcc.misc-tests/gcov-35.c: Likewise.
* gcc.misc-tests/gcov-36.c: Likewise.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2 weeks agolibstdc++: Disable serialization test for piecewise_linear_distribution<double> on...
Tomasz Kamiński [Thu, 16 Jul 2026 13:36:08 +0000 (15:36 +0200)] 
libstdc++: Disable serialization test for piecewise_linear_distribution<double> on i686

The r17-2455-gf8c277ed801ba6 enabled test_custom unconditionally for both
double and float, however all-combination test shows that double remains
unstable.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize2.cc:
Enable test_customd<double> for __x86_64__.

2 weeks agolibstdc++: Apply rule triggering at Zone line transition [PR124853]
Tomasz Kamiński [Thu, 16 Jul 2026 10:50:32 +0000 (12:50 +0200)] 
libstdc++: Apply rule triggering at Zone line transition [PR124853]

When seeding zone information from the application of the rules
prior the transition, we should consider the rule triggering exactly
at boundary, not only prior, i.e. call find_active_rule with info.begin.
Due the rule_start - t < days(1) check (that is not removed yet), such
transitions were effectively ignored.

This addresses regressions introduced by r17-2060-gf7cde200320e08,
where new differences between outputs of libstdc++ and date library were
introduced for some zones (e.g. Europe/Lisbon in 1976). With this fixup,
the patch is now pure improvement in consistency.

libstdc++-v3/ChangeLog:

PR libstdc++/124853
* src/c++20/tzdb.cc (time_zone::_M_get_sys_info): Find
rules firing exactly at transition time.
* testsuite/std/time/time_zone/wall_cascade.cc: Add test
for Europe/Lisbon, and corrected test_negative.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 weeks agoRISC-V: Adjust test case due to allow vwcvt[u].x.x.v overlap
Pan Li [Wed, 15 Jul 2026 02:58:16 +0000 (10:58 +0800)] 
RISC-V: Adjust test case due to allow vwcvt[u].x.x.v overlap

Remove the xfail due to vwcvt changes.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr112431-1.c: Remove xfail.
* gcc.target/riscv/rvv/base/pr112431-2.c: Ditto.
* gcc.target/riscv/rvv/base/pr112431-3.c: Ditto.
* gcc.target/riscv/rvv/base/pr112431-39.c: Ditto.
* gcc.target/riscv/rvv/base/pr112431-40.c: Ditto.
* gcc.target/riscv/rvv/base/pr112431-41.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Add test cases for vwcvtu.x.x.v reg overlap
Pan Li [Wed, 15 Jul 2026 01:21:06 +0000 (09:21 +0800)] 
RISC-V: Add test cases for vwcvtu.x.x.v reg overlap

Add test cases for vwcvtu.x.x.v register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i32-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvtu-i8-mf8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Add test cases for vwcvt.x.x.v reg overlap
Pan Li [Wed, 15 Jul 2026 01:20:10 +0000 (09:20 +0800)] 
RISC-V: Add test cases for vwcvt.x.x.v reg overlap

Add test cases for vwcvt.x.x.v register group overlap, please
note it is not overlap as much as possible.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i16-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i16-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i16-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i16-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i16-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i32-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i32-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i32-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i32-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-m1.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-m2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-m4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-mf2.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-mf4.c: New test.
* gcc.target/riscv/rvv/autovec/group_overlap/vwcvt-i8-mf8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoRISC-V: Allow RVV register overlap for vwcvt[u].x.x.v
Pan Li [Wed, 15 Jul 2026 01:15:33 +0000 (09:15 +0800)] 
RISC-V: Allow RVV register overlap for vwcvt[u].x.x.v

Like v[sz]ext.vf8, allow the rvv register overlap
for vwcvt[u].x.x.v.

gcc/ChangeLog:

* config/riscv/vector.md: Leverage Wvr constraint.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agocontrib: Fix exit status of relpath.sh for invalid args [PR125956]
Jonathan Wakely [Wed, 24 Jun 2026 20:50:24 +0000 (21:50 +0100)] 
contrib: Fix exit status of relpath.sh for invalid args [PR125956]

The relpath.sh script always writes its usage message to stdout and
exits with zero status, even for invalid arguments. This caused a
problem for libstdc++-v3/src/c++23/Makefile which assumed that
relpath.sh won't exit successfully on error, via:

relpath=$(relpath.sh ...) && sed 's,@MODPATH@,$$relpath,' ...

Because relpath.sh exits successfully for invalid args, the sed command
still ran even when relpath.sh was invoked incorrectly.

The libstdc++ Makefile has been changed to work around this, but
relpath.sh should still have an idiomatic exit status.

contrib/ChangeLog:

PR libstdc++/125956
* relpath.sh: For invalid arguments write to stderr and exit
with non-zero status.

2 weeks ago[RISC-V] Improve costing for if-converted sequences
Jeff Law [Thu, 16 Jul 2026 12:37:53 +0000 (06:37 -0600)] 
[RISC-V] Improve costing for if-converted sequences

So I'm not happy with this entire routine, but after trying to fix things
right, I'm back to adjusting the cost routine instead.

The fundamental problem as I see it is the cstore patterns on RISC-V are
suboptimal.

Those patterns always have an SI destination.  One expander is used for integer
inputs, the other for FP inputs.

In both the integer and FP case we use an iterator to allow different input
modes.  But the destination stays fixed in SI.

But it'd be really advantageous to support an output iterator. With the forced
SI output we typically end up with subreg copies, zero extensions and moves in
sequences involving SCC insns.  That is usually cleaned up by combine, but
those extra insns participate in if-conversion costing and sometimes cause us
to miss opportunities or force us into a slower/bigger sequence using
generalized conditional moves.

Of course the cstore only has one mode, which if I read the docs correctly
*should* be the output mode.  RISC-V is using it for the input modes.  So we're
doing something a bit dumb there.  To achieve that we'd need to combine the two
expanders since they both have integer output modes and we can't have two
expanders with the same name.  To combine the expanders the inputs have to
accept both integer and FP modes.  That's likely possible but it's going to get
ugly (for example, use modeless operands and check modes and FAIL in the
expansion code).

So rather than fight that battle, this patch just ignores the trivial copies
that can be generated during expansion.  The code was already ignoring certain
extensions and promoted subreg copies.   With some in flight if-conversion work
we're able to take this testcase (adjusted from a loongarch test):

extern long lm, ln, lr;

void
test_ne ()
{
  if (lm != ln)
    lr += (1 << 2);
  lr += lm;
}

Which previously generated this code for the conditional add

        beq     a5,a2,.L2
        addi    a4,a4,4
.L2:
        add     a5,a5,a4

With the in flight if-converter work alone we'd generate:

        sub     t2,t0,t1
        li      a1,4
        czero.eqz       a0,a1,t2
        add     a6,a3,a0
        add     a7,t0,a6

It's straightline code and probably better due to that alone if the branch has
meaningful unpredictability for the hardware.  Add in this patch to send us
through a different if-conversion path and we get:

        sub     t2,t0,t1
        snez    a0,t2
        sh2add  a1,a0,a2
        add     a6,t0,a1

For shift counts 1..3 we'll get that shNadd form.  For shift counts 4..11 we'll
get sll+add.  For shift counts > 11 the middle block in the if-conversion path
has two insns because the constant can't encode into an addi instruction and we
can't use the specialized ifcvt paths.

Tested on riscv32-elf and riscv64-elf.  Bootstrap & regression test on k3 is in
flight.  Bootstrap and regression test and k1 and c920 will fire up later
today.  Obviously I'll wait for pre-commit CI to render its verdict, I expect
I'll have k3 data by then as well.

gcc/

* config/riscv/riscv.cc (riscv_noce_conversion_profitable_p): Ignore
reg->reg copies too.

2 weeks agolibstdc++: Generate result_type bits of precision in piecewise distributions.
Tomasz Kamiński [Thu, 9 Jul 2026 09:17:58 +0000 (11:17 +0200)] 
libstdc++: Generate result_type bits of precision in piecewise distributions.

The piecewise distributions previously always generated a double value
out of provided generator, regardless of the result_type (template
parameter). This patch address above, by generating value of _RealType
by default.

Furthermore, this patch addresses LWG4052, "Bogus requirements for
piecewise_linear_distribution" issue, by converting the inputs
(from iterators, or provided weights functor) to RealType, instead
of double. See input_type test included in this patch.

For consistency the internal computations are now performed in RealType,
instead of double. This reduces the precision if float it used, however
due the ABI compatibility, double is still used for storage, unless
_GLIBCXX_USE_RESULT_TYPE_FOR_PIECEWISE_DENSITIES is defined (see
test_precision_depended in accessors.cc) test.

The above change leads to user-observable changes in the behaviour or
distributions, both in produced outputs and number of calls to provided
generator performed per each element (see test_engine_calls in accessors.cc).
The pre-GCC17 behavior of distributions can be restored by defining
_GLIBCXX_USE_OLD_PIECEWISE_DISTRIBUTIONS (this also reverts r17-2391-geae19
and r17-2392-g86a93). This is achieved by converting the values to _CalcType
that is either defined as double or _RealType. This change is not applied
to interval delta (_M_int[__k + 1] - _M_int[__k]) that used _RealType
already, to preserve the result of computations involving it.

To reduce the code duplication the __generate_one functions are introduced
for both distributions. They are used both by the operator() and
__generate_impl. The linear __generate_impl is now consistent with constant
version, and simply assigns the result of generator invocation for default
configuration.

Finally, this made result of stream operator for float/double param_type
of piecewise_linear_distribution consistent for 32bits/64bits. The
float specialization for constant distribution still produces different
result, however the calculated values are consistent when printed as
hexfloat.

libstdc++-v3/ChangeLog:

* doc/html/manual/using_macros.html: Regenrate.
* doc/xml/manual/using.xml
(_GLIBCXX_USE_OLD_PIECEWISE_DISTRIBUTIONS): Mention LWG4052.
* include/bits/random.h
(piecewise_constant_distribution::_CalcType)
(piecewise_linear_distribution::_CalcType): Define.
(piecewise_constant_distribution::__generate_one)
(piecewise_linear_distribution::__generate_one): Declare.
(piecewise_constant_distribution::_M_initialize2)
(piecewise_linear_distribution::__M_initialize2): Adjust
densities parameter to _CalcType.
* include/bits/random.tcc (std::__normalize): Perform
computation in the type of factor parameter.
(piecewise_constant_distribution::_M_configure)
(piecewise_linear_distribution::_M_configure): Use _CalcType.
(piecewise_constant_distribution::param_type::param_type)
(piecewise_constant_distribution::param_type::param_type):
Cast the inputs to the _CalcType. Use _RealType as input
weight functor.
(piecewise_constant_distribution::__generate_one)
(piecewise_linear_distribution::__generate_one): Extract
from operator() and use _CalcType.
(piecewise_constant_distribution::operator())
(piecewise_constant_distribution::__generate_impl).
(piecewise_linear_distribution::operator()): Use __generate_one.
(piecewise_linear_distribution::__generate_impl): Optimize
_M_cp.empty() case and user __generate_one otherwise.
* testsuite/26_numerics/random/piecewise_constant_distribution/operators/accessors.cc:
(test_precision_depended): Expand test to cover all constructors,
and inputs different from distribution result type.
(test_engine_calls): New tests.
* testsuite/26_numerics/random/piecewise_linear_distribution/operators/accessors.cc:
Likewise.
* testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize2.cc:
Update values to accommodate the change in precision for float.
Remove trailing whitespaces.
* testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize2.cc:
Likewise, and enable float/double test for i686.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/input_type.cc:
New test.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/input_type_fallback_neg.cc:
New test.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/input_type.cc:
New test.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/input_type_fallback_neg.cc:
New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 weeks agotestsuite, aarch64: Drop duplication of big endian AArch64 neon tests.
Iain Sandoe [Thu, 16 Jul 2026 08:42:37 +0000 (09:42 +0100)] 
testsuite, aarch64: Drop duplication of big endian AArch64 neon tests.

The aarch64-neon driver script includes a section that allows for a
target to perform the tests as big-endian.  Since the majority of LE
targets will not be able to perform these tests this produces a lot
of UNRESOLVED cases there.  For big-endian targets the effect is to
do the work twice.

So removing that section.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/neon/aarch64-neon.exp: Remove section
re-runing the tests as big-endian.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2 weeks agolibstdc++: Mark std::indirect and std::polymorphic with _GLIBCXX_NO_SPECIALIZATIONS...
Jakub Jelinek [Thu, 16 Jul 2026 11:58:52 +0000 (13:58 +0200)] 
libstdc++: Mark std::indirect and std::polymorphic with _GLIBCXX_NO_SPECIALIZATIONS [PR120635]

The following marks these two templates with [[_Clang::no_specializations]]
because the P3019R14 paper which introduced them already added the
restrictions that they shouldn't be specialized by users.

I think I'll defer the rest to others (i.e. P2652R2 - std::allocator_traits,
P0912R5 - std::coroutine_handle and LWG4535 - <simd>).

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

PR c++/120635
* include/bits/indirect.h (std::indirect, std::polymorphic): Add
_GLIBCXX_NO_SPECIALIZATIONS.
* testsuite/std/memory/indirect/specialization.cc: New test.
* testsuite/std/memory/polymorphic/specialization.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2 weeks agoAvoid complex gimple_build API
Richard Biener [Thu, 16 Jul 2026 10:48:10 +0000 (12:48 +0200)] 
Avoid complex gimple_build API

The following simplifies some gimple_build API use by using the
available gimple_seq overloads.

* tree-switch-conversion.cc (gen_log2): Use gimple_seq
overload of gimple_build.
(gen_pow2p): Likewise.

2 weeks agoOpenMP: Fix implicit declare target - aka fix libgomp.fortran/reverse-offload-6.f90
Tobias Burnus [Thu, 16 Jul 2026 11:23:15 +0000 (13:23 +0200)] 
OpenMP: Fix implicit declare target - aka fix libgomp.fortran/reverse-offload-6.f90

This fixes a bug I introduced in commit r17-2404-g2468c79741f97c,
  OpenMP: Handle 'device_type(host)' on 'target'

For code inside a target region with either 'device(ancestor:1)' or
with 'device_type(host)' no device code should be generated. That's
handled by both omp_discover_declare_target_tgt_fn_r and by
omp_discover_declare_target_fn_r.

While for the latter, walk_tree_without_duplicates is called when
the condition is true, the former sets '*walk_subtrees = 0'.

Looking too similar, r17-2404 ended up using the same condition for
both. - The solution is to inverse the current condition for
omp_discover_declare_target_tgt_fn_r.

Testcase: The already existing and since r17-2404 failing
test libgomp.fortran/reverse-offload-6.f90.

gcc/ChangeLog:

* omp-offload.cc (omp_discover_declare_target_tgt_fn_r): Fix
the condition for anchestor + nohost handling.

2 weeks agoFix typo in comment of invert_mod2n
Eric Botcazou [Thu, 16 Jul 2026 11:02:52 +0000 (13:02 +0200)] 
Fix typo in comment of invert_mod2n

The typo is just one letter 'Z' -> 'X', but a 1-character change is a waste
of resources so I have beefed up the comment with a few references.

gcc/
* expmed.cc (invert_mod2n): Fix typo in comment and add references.

2 weeks agolibstdc++: Fix LD_LIBRARY_PATH when testing an installed compiler
Arsen Arsenović [Sat, 20 Jun 2026 17:05:58 +0000 (19:05 +0200)] 
libstdc++: Fix LD_LIBRARY_PATH when testing an installed compiler

Previously, none would be set, so an installed compiler that does not
emit an RPATH to its libraries would not be able to execute programs
that require libstdc++.so symbols.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (libstdc++_init): Use
gcc-set-multilib-library-path to calculate LD_LIBRARY_PATH for
installed G++ compilers.

2 weeks agoOpenMP: uses_allocators - fix Fortran memspace use + multiple clauses [PR126279]
Tobias Burnus [Thu, 16 Jul 2026 10:11:38 +0000 (12:11 +0200)] 
OpenMP: uses_allocators - fix Fortran memspace use + multiple clauses [PR126279]

The memspace modifier to uses_allocators was converted in Fortran not to an
integer number but to an external variable - which failed then at link time.

Additionally, it turned out that - at least with host fallback - multiple
uses_allocator clauses aren't supported as newer ones overrode previous ones;
shifting it by gomp_omp_allocator_data_size data helped.

OpenMP requires 'a constant array, have constant values' for C/C++ and for
Fortran a 'named constant of rank one'; it turned out that the FEs already
generate, e.g.
   static struct omp_alloctrait_t traits[1] = {{.key=2, .value=1024}};
which can be directly passed to the runtime library - no need to expand the
initializer values into a new variable and then take the address of that one.

For C/C++, this might be new since commit r17-2414-g9e9e22587f7954
that set calls 'mark_exp_read' to avoid an 'unused but set' warning for the
traits variable [not checked] - but in any case it is now consistent.

PR fortran/126279

gcc/fortran/ChangeLog:

* trans-openmp.cc (gfc_trans_omp_clauses): Convert memspace constant
to an integer not to an external variable.

gcc/ChangeLog:

* omp-low.cc (lower_omp_target): Avoid creating a second static const
variable for the trait array used by uses_allocators.

libgomp/ChangeLog:

* target.c (copy_firstprivate_data): After storing  users_allocators'
allocator, shift the offset by its storage size to avoid overriding.
* testsuite/libgomp.fortran/uses_allocators-1.f90: Use kind c_size_t
instead of kind 8 for 32bit compatibility.
* testsuite/libgomp.fortran/uses_allocators-4.f90: Update expected
tree dump.
* testsuite/libgomp.fortran/uses_allocators-7.f90: Extend testcase now
that user-defined allocators are supported by uses_allocators.

2 weeks agoOpenMP: Handle 'device_type(host)' on 'target': Repair 'libgomp.c/target-device-type...
Thomas Schwinge [Thu, 16 Jul 2026 09:35:09 +0000 (11:35 +0200)] 
OpenMP: Handle 'device_type(host)' on 'target': Repair 'libgomp.c/target-device-type-3.c' offload tree dump scanning

Per commit 2468c79741f97c2aa0cbb4baaccb86fd4a150910
"OpenMP: Handle 'device_type(host)' on 'target'",
'libgomp.c/target-device-type-3.c':

    [...]
    // NOTE: With offloading,
    //   UNRESOLVED:
    // is expected for the "optimized" tests as those dumps are only enabled
    // for the no-host side.
    [...]
    /* { dg-final { scan-tree-dump "hhh" "optimized" { target offload_device } } } */
    /* { dg-final { scan-tree-dump-not "ggg" "optimized" { target offload_device } } } */
    /* { dg-final { scan-tree-dump-not "_omp_fn" "optimized" { target offload_device } } } */
    [...]

..., resulting in:

    +PASS: libgomp.c/target-device-type-3.c (test for excess errors)
    +PASS: libgomp.c/target-device-type-3.c execution test
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump-times ompexp "omp declare target" 1
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump-not ompexp "omp target entrypoint"
    +PASS: libgomp.c/target-device-type-3.c scan-tree-dump ompexp "__builtin_GOMP_target_ext \\(-3,"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump optimized "hhh"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "ggg"
    +UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "_omp_fn"

I assume that intended to test what I've now implemented?

    [...]
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump optimized "hhh"
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "ggg"
    -UNRESOLVED: libgomp.c/target-device-type-3.c scan-tree-dump-not optimized "_omp_fn"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump optimized "hhh"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump-not optimized "ggg"
    +PASS: libgomp.c/target-device-type-3.c scan-amdgcn-amdhsa-offload-tree-dump-not optimized "_omp_fn"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump optimized "hhh"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump-not optimized "ggg"
    +PASS: libgomp.c/target-device-type-3.c scan-nvptx-none-offload-tree-dump-not optimized "_omp_fn"

(Also, effective-target 'offload_device' tests "if [an] offload device is
available", which wasn't the right conditional here: should rather have used
'offload_target_any': "if compiling for any offload target".  But that still
wouldn't have achieved what this intended to test.)

libgomp/
* testsuite/libgomp.c/target-device-type-3.c: Repair offload tree
dump scanning.

2 weeks agolibstdc++: Fix spelling of new macro in ChangeLog
Jonathan Wakely [Thu, 16 Jul 2026 09:32:54 +0000 (10:32 +0100)] 
libstdc++: Fix spelling of new macro in ChangeLog

2 weeks agolibgomp: Robustify omp_get_device_distances: ... some more [PR125877]
Thomas Schwinge [Wed, 15 Jul 2026 13:38:08 +0000 (15:38 +0200)] 
libgomp: Robustify omp_get_device_distances: ... some more [PR125877]

Per commit 929b1c42f3d23dcffacdedb005ab83d3607b47ce
"libgomp: Robustify omp_get_device_distances [PR125877]", we've got:

    [...]
      FILE *f = fopen ("/sys/devices/system/node/online", "r");
      if (f == NULL)
        goto fail;
      char *lineptr = NULL;
    [...]
    fail:
      free (lineptr);
    [...]

In C (per my understanding), this is "valid" (syntax): 'lineptr' appears as
part of the block it's declared in.  However, it only gets initialized (to
'NULL') only *after* the first 'goto fail;', therefore that 'goto fail;',
'free (lineptr);' code path invokes undefined behavior, crashes for random junk
in 'lineptr'.

We've got:

    [...]
      char *lineptr = NULL;
      size_t nline;
      if (getline (&lineptr, &nline, f) <= 0)
    [...]

Per the glibc manual ('info libc getline'):

|  -- Function: ssize_t getline (char **LINEPTR, size_t *N, FILE *STREAM)
| [...]
|      If you set ‘*LINEPTR’ to a null pointer, and ‘*N’ to zero, before
|      the call, then ‘getline’ allocates the initial buffer [...]

Confusingly, that's slightly different from the 'getline' definition in
<https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html> as
well as common implementation (including glibc's...), which don't require
zero-initialiation of 'nline' given NULL for 'lineptr'.  We shall err on the
side of caution, and do similar to other libgomp 'getline' code, that is,
initialize 'nline' to zero in this case here.

We've got:

    [...]
      if (getline (&lineptr, &nline, f) <= 0)
        {
          free (lineptr);
          fclose (f);
          goto fail;
        }
    [...]
    fail:
      free (lineptr);
    [...]

..., that is, a double 'free' in the error case.

PR libgomp/125877
libgomp/
* config/linux/numa.c (gomp_get_numa_distance): Move 'lineptr'
initialization earlier, robustify 'getline' call, avoid double
'free'.

2 weeks agoOpenMP: Handle 'device_type(nohost)' on 'target': Fix 'libgomp.c/target-device-type...
Thomas Schwinge [Wed, 15 Jul 2026 22:47:08 +0000 (00:47 +0200)] 
OpenMP: Handle 'device_type(nohost)' on 'target': Fix 'libgomp.c/target-device-type-1.c' for non-USM

With commit 97a43fc4dbc5cfb1174a13313dda7637c838d110
"OpenMP: Handle 'device_type(nohost)' on 'target'", I'm seeing:

    PASS: libgomp.c/target-device-type-1.c (test for excess errors)
    FAIL: libgomp.c/target-device-type-1.c execution test
    PASS: libgomp.c/target-device-type-1.c scan-tree-dump gimple "= __builtin_omp_is_initial_device \\(\\);"
    PASS: libgomp.c/target-device-type-1.c scan-tree-dump gimple "__builtin_GOMP_error \\("Executing device-type ..nohost.. target region on the host","

... for (non-USM) AMD GPU offloading:

    Memory access fault by GPU node-2 (Agent handle: 0xff37f00) on address 0x7ffd8a413000. Reason: Page not present or supervisor privilege.

..., and correspondingly for (non-USM) NVIDIA GPU offloading:

    libgomp: cuCtxSynchronize error: an illegal memory access was encountered

Fix this by 'map'ping 'x' for the OpenMP 'target' construct.  Not technically
necessary for 'libgomp.c/target-device-type-2.c' (as that one's exercising the
'host' error case), but still apply the same change also to that one.

libgomp/
* testsuite/libgomp.c/target-device-type-1.c (f): Map 'x'.
* testsuite/libgomp.c/target-device-type-2.c (f): Likewise.

2 weeks agoAVR: Fix a typo in the AVR Options documentation.
Georg-Johann Lay [Thu, 16 Jul 2026 08:39:49 +0000 (10:39 +0200)] 
AVR: Fix a typo in the AVR Options documentation.

gcc/
* doc/invoke.texi (AVR Options): Fix a typo.

2 weeks agoRemove netbsd_link_ld_elf_so spec
Rainer Orth [Thu, 16 Jul 2026 08:21:24 +0000 (10:21 +0200)] 
Remove netbsd_link_ld_elf_so spec

The netbsd_link_ld_elf_so spec is unused, probably due to the removal of
NetBSD a.out support, so this patch removes it.

Bootstrapped without regressions on amd64-pc-netbsd10.1.

2026-07-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* config/netbsd-elf.h (NETBSD_LINK_LD_ELF_SO_SPEC): Remove.
(NETBSD_SUBTARGET_EXTRA_SPECS): Remove netbsd_link_ld_elf_so.

2 weeks agotestsuite: Fix gcc.dg/vect/tsvc tests on NetBSD
Rainer Orth [Thu, 16 Jul 2026 08:14:54 +0000 (10:14 +0200)] 
testsuite: Fix gcc.dg/vect/tsvc tests on NetBSD

All gcc.dg/vect/tsvc tests FAIL on NetBSD like

FAIL: gcc.dg/vect/tsvc/vect-tsvc-s000.c (test for excess errors)
UNRESOLVED: gcc.dg/vect/tsvc/vect-tsvc-s000.c compilation failed to produce executable
UNRESOLVED: gcc.dg/vect/tsvc/vect-tsvc-s000.c scan-tree-dump-times vect "vectorized 1 loops" 1

Excess errors:
gcc.dg/vect/tsvc/tsvc.h:199:20: error: implicit declaration of function 'memalign' [-Wimplicit-function-declaration]
gcc.dg/vect/tsvc/tsvc.h:199:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
gcc.dg/vect/tsvc/tsvc.h:200:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

While NetBSD lacks memalign, it has posix_memalign instead.

Tested on amd64-pc-netbsd10.1 and i386-pc-solaris2.11.

2026-07-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.dg/vect/tsvc/tsvc.h (init): Don't use memalign on NetBSD.

2 weeks agotestsuite: Require bitint in gcc.dg/torture/bitint-101.c
Rainer Orth [Thu, 16 Jul 2026 07:56:58 +0000 (09:56 +0200)] 
testsuite: Require bitint in gcc.dg/torture/bitint-101.c

The new gcc.dg/torture/bitint-101.c test FAILs on Solaris/SPARC:

FAIL: gcc.dg/torture/bitint-101.c   -O0  (test for excess errors)
UNRESOLVED: gcc.dg/torture/bitint-101.c   -O0  compilation failed to produce executable

Excess errors:
gcc.dg/torture/bitint-101.c:4:1: sorry, unimplemented: '_BitInt(2)' is not supported on this target
gcc.dg/torture/bitint-101.c:11:3: sorry, unimplemented: '_BitInt(2)' is not supported on this target

Fixed by requiring bitint support.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

2026-07-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.dg/torture/bitint-101.c: Require bitint.

2 weeks agobitintlower: Avoid coalescing lhs with operands for .MUL_OVERFLOW [PR126262]
Jakub Jelinek [Thu, 16 Jul 2026 07:55:37 +0000 (09:55 +0200)] 
bitintlower: Avoid coalescing lhs with operands for .MUL_OVERFLOW [PR126262]

We need to avoid overlap between the lhs and input operands of __mulbitint3
and __divmodbitint4.  This is done in build_bitint_stmt_ssa_conflicts, when
muldiv_p is set, we call use on all the SSA use operands (including operands
of stmts on worklist) first and def on the lhs at the end, while for
!muldiv_p, at least for stmts with a single lhs we call def first and then
all the use calls.  For MULT_EXPR etc. we already handle it:
                case MULT_EXPR:
                case TRUNC_DIV_EXPR:
                case EXACT_DIV_EXPR:
                case TRUNC_MOD_EXPR:
                  muldiv_p = true;
Now, for the IFN_*_OVERFLOW, we handle it for bitint_big_endian only
currently, on big endian there is a problem that if the sizes don't match
exactly, even in order updates of the limbs can clobber stuff.
But, for IFN_MUL_OVERFLOW and IFN_UBSAN_CHECK_MUL, we actually use
__mulbitint3 libgcc call and that function really can't be called with
overlapping destination and inputs, because it traverses the inputs multiple
times while writing destination one by one (and it intentionally doesn't
allocate memory for temporaries).

So, the following patch fixes it by making IFN_MUL_OVERFLOW and
IFN_UBSAN_CHECK_MUL calls be always handled as muldiv_p.

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

PR tree-optimization/126262
* gimple-lower-bitint.cc (build_bitint_stmt_ssa_conflicts): Treat
IFN_MUL_OVERFLOW and IFN_UBSAN_CHECK_MUL like IFN_BSWAP, regardless
of bitint_big_endian.

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

Reviewed-by: Richard Biener <rguenth@suse.de>
2 weeks agolibstdc++: Use _Clang::__no_specializations__ attribute in a few spots [PR120635]
Jakub Jelinek [Thu, 16 Jul 2026 07:51:48 +0000 (09:51 +0200)] 
libstdc++: Use _Clang::__no_specializations__ attribute in a few spots [PR120635]

The following patch adds _Clang::__no_specializations__ attribute
to a couple of templates:
1) LWG3975 - basic_format_{,parse_}context
2) LWG3990 - variant, tuple
3) LWG4305 - type_order
4) LWG2129 - std::initializer_list
This assumes all those issues were handled as defect reports.

What I haven't touched, but has similar wording:
5) P2652R2 - std::allocator_traits
6) P3019R14 - std::indirect
7) P0912R5 - std::coroutine_handle
8) LWG4535 - <simd>

Anything else I'm missing?

Note, seems libcxx adds the attribute to significantly more places, but not
sure if that is desirable. [namespace.std] has some restrictions, but those
generally say that it is UB in that case, which I'm not sure is the right
case for unconditional error.  Compared to that, the above mentioned
library issues talk about ill-formed (and not IFNDR, so we really should
be diagnosing that).

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

PR c++/119561
PR c++/120635
* include/bits/c++config (_GLIBCXX_NO_SPECIALIZATIONS): Define.
* include/std/variant (std::variant): Use it to resolve LWG3990.
* include/std/format (std::basic_format_parse_context,
std::basic_format_context): Use it to resolve LWG3975.
* libsupc++/compare (std::type_order): Use it to resolve LWG4305.
* libsupc++/initializer_list (std::initializer_list): Use it to
resolve LWG2129.
* include/std/tuple (std::tuple): Use it to resolve LWG3990.
Temporarily ignore -Winvalid-specialization around specializations
of tuple.
* testsuite/18_support/comparisons/type_order/lwg4305.cc: New test.
* testsuite/18_support/initializer_list/lwg2129.cc: New test.
* testsuite/std/format/lwg3975.cc: New test.
* testsuite/20_util/tuple/lwg3990.cc: New test.
* testsuite/20_util/variant/lwg3990.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2 weeks agoa68: fix typo in ga68 manual section Creating Files
Jose E. Marchesi [Thu, 16 Jul 2026 05:57:11 +0000 (07:57 +0200)] 
a68: fix typo in ga68 manual section Creating Files

gcc/algol68/ChangeLog

* ga68.texi (POSIX files): Fix typo.

2 weeks agors6000: Add Dense Math builtin infrastructure
Kishan Parmar [Wed, 15 Jul 2026 04:12:16 +0000 (09:42 +0530)] 
rs6000: Add Dense Math builtin infrastructure

Add the initial infrastructure required to support Dense Math Facility
(DMF) builtins.

Extend the builtin generator with a new "dm" stanza, ENB_DM enable flag,
DMR base type, and DM-specific builtin attributes used for Dense Math
builtins.  Also add TARGET_DMF builtin enablement checks.

These changes provide the foundation for subsequent Dense Math builtin
support. The infrastructure is enabled only when TARGET_DMF is active
(for example, via -mdense-math) and targets a future Power ISA that may
or may not be be implemented in future Power processors and the builtin
interfaces may change accordingly.

2026-07-15  Peter Bergner  <bergner@linux.ibm.com>
    Kishan Parmar  <kishan@linux.ibm.com>

gcc/ChangeLog
* config/rs6000/rs6000-builtin.cc (rs6000_invalid_builtin): Add
ENB_DM diagnostic.
(rs6000_builtin_is_supported): Handle ENB_DM.
* config/rs6000/rs6000-gen-builtins.cc: Update comments for new
Dense Math builtin attributes.
(bif_stanza): Add BSTZ_DM.
(stanza_map): Add "dm" stanza.
(enable_string): Add ENB_DM.
(basetype): Add BT_DMR.
(attrinfo): Add isdm, isdmint and isdmr fields.
(type_map): Add dmr1024 and ptr_dmr1024 type mappings.
(match_type): Recognize dmr1024 type.
(parse_bif_attrs): Parse dm, dmint and dmr attributes.
(complete_vector_type): Handle BT_DMR.
(write_decls): Emit ENB_DM and Dense Math builtin attribute bits
and predicates.
(write_bif_static_init): Initialize Dense Math builtin attributes
and associate dmint builtins with their internal variants.

2 weeks agoDaily bump.
GCC Administrator [Thu, 16 Jul 2026 00:16:40 +0000 (00:16 +0000)] 
Daily bump.

2 weeks agox86-64: Add *fix_trunc<mode>si_sse_2_zext
H.J. Lu [Wed, 15 Jul 2026 23:30:31 +0000 (07:30 +0800)] 
x86-64: Add *fix_trunc<mode>si_sse_2_zext

We expand

unsigned long long
func (float x)
{
  return (unsigned int) x;
}

to

(insn 6 5 7 (set (reg:DI 103)
        (fix:DI (reg/v:SF 100 [ x ]))) "x.c":4:10 -1
     (nil))

(insn 7 6 8 (set (reg:SI 102 [ _1 ])
        (subreg:SI (reg:DI 103) 0)) "x.c":4:10 -1
     (nil))

(insn 8 7 9 (set (reg:DI 101 [ _3 ])
        (zero_extend:DI (reg:SI 102 [ _1 ]))) "x.c":4:10 -1
     (nil))

Add *fix_trunc<mode>si_sse_2_zext so that combine can generate:

(insn 8 6 13 2 (set (reg:DI 101 [ _3 ])
        (zero_extend:DI (subreg:SI (fix:DI (reg:SF 104 [ x ])) 0))) "x.c":4:10 235 {*fix_truncsfsi_sse_2_zext}
     (expr_list:REG_DEAD (reg:SF 104 [ x ])
        (nil)))

This fixes

FAIL: gcc.target/i386/zext-sse-1.c check-function-bodies func1
FAIL: gcc.target/i386/zext-sse-1.c check-function-bodies func2

PR target/126231
* config/i386/i386.md (*fix_trunc<mode>si_sse_2_zext): New.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agocobol: Accept TYPEDEF in Local-Storage.
James K. Lowden [Wed, 15 Jul 2026 22:32:01 +0000 (18:32 -0400)] 
cobol: Accept TYPEDEF in Local-Storage.

Parser erroneously passed TYPEDEF name to codegen as if a data-item.
Fixes PR 126281.

gcc/cobol/ChangeLog:

* parse_ante.h (procedure_division_ready): Test field with is_typedef().

2 weeks agolibgfortran: Don't quote ENV_PPID and ENV_BASE in caf/shmem/shared_memory.c
John David Anglin [Wed, 15 Jul 2026 22:55:54 +0000 (18:55 -0400)] 
libgfortran: Don't quote ENV_PPID and ENV_BASE in caf/shmem/shared_memory.c

ENV_PPID and ENV_BASE are declared previously as strings and they
don't need to be quoted.

2026-06-12  John David Anglin  <danglin@gcc.gnu.org>

libgfortran/ChangeLog:

* caf/shmem/shared_memory.c (shared_memory_set_env): Don't
quote ENV_PPID.
(shared_memory_init) Don't quote ENV_BASE.

2 weeks agolibgfortran: Define macro to handle z length modifier in format strings
John David Anglin [Wed, 15 Jul 2026 22:47:26 +0000 (18:47 -0400)] 
libgfortran: Define macro to handle z length modifier in format strings

hppa64-hp-hpux* lacks the z length modifier.  It specifies the following
integer conversion corresponds to a size_t or a ssize_t argument.  The
size_t type is unsigned long on HP-UX, so we can replace the z length
modifier with l on HP-UX.

2026-06-10  John David Anglin  <danglin@gcc.gnu.org>

libgfortran/ChangeLog:

* libgfortran.h (FMT_Z): Define.
* caf/shmem/alloc.c (get_memory_by_id_internal): Use FMT_Z.
(alloc_free_memory_with_id): Likewise.
* caf/shmem/supervisor.c (get_memory_size_from_envvar): Likewise.
* caf/shmem/thread_support.c (get_handle): Likewise.
(thread_support_init_supervisor): Likewise.
* intrinsics/reduce.c (reduce): Likewise.

2 weeks agolibgfortran: Implement c99 functions strnlen, frexpl and scalbnl
John David Anglin [Wed, 15 Jul 2026 22:45:44 +0000 (18:45 -0400)] 
libgfortran: Implement c99 functions strnlen, frexpl and scalbnl

Fixes libgfortran build and gfortran test failures on
hppa64-hp-hpux11.11.  These functions are required for minimal
REAL16 support.

The frexpl and scalbnl functions are derived from libquadmath
implementations.

2026-06-10  John David Anglin  <danglin@gcc.gnu.org>

libgfortran/ChangeLog:

PR libfortran/125623
* c99_protos.h: (strnlen, frexpl, scalbnl): Declare if HAVE_STRNLEN,
HAVE_FREXPL, HAVE_SCALBNL aren't defined, respectively.
* intrinsics/c99_functions.c (strnlen, frexpl, scalbnl): Implement.
* libgfortran.h: Include string.h if HAVE_STRING_H.

2 weeks agolibgfortran: Fix caf tests on HP-UX
John David Anglin [Wed, 15 Jul 2026 22:40:07 +0000 (18:40 -0400)] 
libgfortran: Fix caf tests on HP-UX

On HP-UX, shm_open parses the name argument directly through file
system checks.  As a result, we need a name that specifies a directory
with read, write and execute permisions.  This differs from linux
where the name specifies the shared memory object to be created or
opened, and the shared object is identified by a name of the form
/somename.

We also limit the size of the shared objects to 1 GB on HP-UX.
The maximum JFS file size is 2 GB - 1 with the default nolargefiles
option in HP-UX 11.

Finally, we need to compile and link tests with the -pthread option
to ensure they are linked against libpthread.

2026-06-13  John David Anglin  <danglin@gcc.gnu.org>

libgfortran/ChangeLog:

* caf/shmem/shared_memory.c (SHM_NAME_FMTD, SHM_NAME_FMTS): Define.
(shared_memory_init) Use SHM_NAME_FMTD format to generate
shm_name.
(shared_memory_cleanup): Use SHM_NAME_FMTS to generate shm_name.
* caf/shmem/supervisor.c (get_memory_size_from_envvar): Use
1 GB on 64-bit Windows and HP-UX.

gcc/testsuite/ChangeLog:

* gfortran.dg/coarray/caf.exp: Run test with -pthread option.

2 weeks ago[PATCH v1] RISC-V: Share bases for scaled indexed addresses
wangjue [Wed, 15 Jul 2026 21:11:22 +0000 (15:11 -0600)] 
[PATCH v1] RISC-V: Share bases for scaled indexed addresses

riscv_legitimize_address handled scaled indexed addresses only when
the constant offset fit an I-type immediate.  Large offsets fell back to
generic legalization and could materialize the same base at each
reference.

Use riscv_add_offset for all offsets before adding the scaled index.
This preserves small-offset code generation and exposes large bases to
CSE.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_legitimize_address): Use
riscv_add_offset for scaled indexed addresses.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/large-frame-indexed-base.c: New test.
* gcc.target/riscv/small-frame-indexed-base.c: New test.

2 weeks agoUpdate ranger timestamps for inferred ranges.
Andrew MacLeod [Tue, 14 Jul 2026 18:55:44 +0000 (14:55 -0400)] 
Update ranger timestamps for inferred ranges.

If an inferred range is added for a name, mark the name as an updated
range to allow the dependency processing to pick up the change.

PR tree-optimization/126110
gcc/
* gimple-range-cache.cc (ranger_cache::mark_stale): Default defs
get a new timestamp to make them stale.
* gimple-range-infer.cc (infer_range_manager::add_range): When
an inferred range is added, mark the name as updated.

gcc/testsuite/
* gcc.dg/pr126110.c: New.

2 weeks ago[PATCH] RISC-V: Fix NULL location pointer check in target attribute parser
Jim Lin [Wed, 15 Jul 2026 19:58:47 +0000 (13:58 -0600)] 
[PATCH] RISC-V: Fix NULL location pointer check in target attribute parser

parse_arch tested "if (*m_loc)", dereferencing the location_t pointer,
while every other diagnostic site guards with "if (m_loc)".  Since
m_loc can be NULL, test the pointer instead of dereferencing it.

gcc/ChangeLog:

* config/riscv/riscv-target-attr.cc
(riscv_target_attr_parser::parse_arch): Check m_loc instead of *m_loc
before emitting the diagnostic.

Signed-off-by: Jim Lin <jim@andestech.com>
2 weeks ago[PATCH] RISC-V: Fix GE/GEU zicond splitter emitting the wrong comparison
Jim Lin [Wed, 15 Jul 2026 19:55:57 +0000 (13:55 -0600)] 
[PATCH] RISC-V: Fix GE/GEU zicond splitter emitting the wrong comparison

The splitter matching (x >= 1 ? 2^n : 0) lowered it to
tmp = (x > 1); result = tmp << n, emitting any_gt instead of any_ge.
At x == 1 the original yields 2^n but the split yields 0, a
miscompile.  Emit any_ge to reproduce the matched comparison, as the
sibling GE/GEU splitters already do.

gcc/ChangeLog:

* config/riscv/zicond.md: Emit any_ge instead of any_gt in the
GE/GEU if-then-else splitter.

Signed-off-by: Jim Lin <jim@andestech.com>
2 weeks agoFix some more issues with -Wunused-but-set and -Wundefined-vars.
Thomas Koenig [Tue, 14 Jul 2026 16:58:36 +0000 (18:58 +0200)] 
Fix some more issues with -Wunused-but-set and -Wundefined-vars.

The root cause for PR 126058 that was that sym->extra_loc was not
being set for possible allocations via allocatablearguments. Looking
at the code, a few more problems became clear:  Not only INTENT(OUT)
arguments could allocate allocatables, all other INTENTS could do so
as well, but only if the formal arguments are allocatable as well.
Also, curent intrinsics do not have allocatable components.

During testing, there were also a few cases where, if one warning with
-Wall and one with -Wextra applied, the one with -Wextra was issued peferably.
This is slightly confusing, and also fixed with this patch.

gcc/fortran/ChangeLog:

PR fortran/126058
* gfortran.h (enum var_allocated): New enum.
(symbol_attribute): Change member allocated to new enum.
(gfc_used_in_allocate_expr): Add argument how.
* interface.cc (gfc_compare_actual_formal): Mark variables
as allocated only when the formal arg is allocatable.
* intrinsic.cc (mark_args_as_used): Intrinsics do not allocate
their arguments.
* resolve.cc (find_unused_vs_set): Move warnings enabled with
-Wextra behind those enabled with -Wall. If a variable is
maybe allocated as an argument, mark it as such.
* symbol.cc (mark_vars_as_used): Always set location.
(gfc_used_in_allocate_expr): Add argument how. Use it.
(gfc_lvalue_allocated_at): Set sym->attr.allocated to ALLOCATED_ASSIGNMENT.

gcc/testsuite/ChangeLog:

PR fortran/126058
* gfortran.dg/warn_undefined_vars_7.f90: New test.
* gfortran.dg/warn_unused_but_set_variable_4.f90: New test.

2 weeks agoRevert "MIPS: Add -mmxu and -mno-mxu driver pass through"
Jeff Law [Wed, 15 Jul 2026 17:22:36 +0000 (11:22 -0600)] 
Revert "MIPS: Add -mmxu and -mno-mxu driver pass through"

This reverts commit b5404c42dde7dba8c72b9246cca288c256b55d8c.

2 weeks agoRobustify awk pass generation
Nathan Sidwell [Mon, 13 Jul 2026 13:21:45 +0000 (09:21 -0400)] 
Robustify awk pass generation

gcc/
* gen-pass-instances.awk: Require only white-space before
macro invocations.

2 weeks agoOpenMP: 'allocate' on 'target' with uses_allocators' def'ed allocator
Tobias Burnus [Wed, 15 Jul 2026 16:43:19 +0000 (18:43 +0200)] 
OpenMP: 'allocate' on 'target' with uses_allocators' def'ed allocator

This implements the tweaks required for
  omp target uses_allocators(traits(...): my_alloc) allocate(my_alloc:...)
i.e. using an allocator variable in 'allocate' on target, which is
initialized via the 'uses_allocators' directive.

('allocate' on target may either use such an allocator or a predefined
allocator. Using a random allocator handle is rejected at compile time.)

gcc/ChangeLog:

* omp-low.cc (lower_private_allocate): When called on 'target'
and the allocator is a variable, obtain the device variable.
(lower_omp_target): Move processing of OMP_CLAUSE_USES_ALLOCATORS
on the device/receiver side in before the loop over clauses to
ensure the VALUE_EXPR points to uses_allocators's inited var.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/uses_allocators-10.c: New test.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/uses_allocators-3.c: New test.

2 weeks agolto: Fix cache partitioning to handle min_partition_size=0
Michal Jires [Mon, 11 May 2026 19:11:10 +0000 (21:11 +0200)] 
lto: Fix cache partitioning to handle min_partition_size=0

Cache partitioning asserts that {min,max}_partition_size parameter
cannot be 0 to prevent later divisions by zero. This is needlessly
strict, we can clamp the value to 1 to get reasonable/expected behavior.

PR lto/125257

gcc/lto/ChangeLog:

* lto-partition.cc: Handle min/max_partition_size = 0 for
cache partitioning.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/pr125257_0.c: New test.

2 weeks agocobol: Correct tests against uninitialized access and other incorrect behavior.
James K. Lowden [Wed, 15 Jul 2026 15:11:55 +0000 (11:11 -0400)] 
cobol: Correct tests against uninitialized access and other incorrect behavior.

Some tests wrote to an input parameter to NUL-terminate a
filename.  Some did not set RETURN-CODE to zero before
returning. MF-specific tests are now also tested with the gcobc script
to ensure compatibility.

gcc/cobol/ChangeLog:

* parse.y: Add debug messages during parameter validation.
* symbols.h: (cbl_ffi_arg_t::capacity_ok): New function.

libgcobol/ChangeLog:

* compat/gnu/lib/CBL_CREATE_FILE.cbl: Do not write to input parameter.
* compat/gnu/lib/CBL_OPEN_FILE.cbl: Same.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/CBL_CREATE_FILE___CBL_WRITE_FILE___CBL_CLOSE_FILE.cob: Add gcobc.
* cobol.dg/group2/CBL_DELETE_FILE.cob: Same.
* cobol.dg/group2/CBL_OPEN_FILE___CBL_CLOSE_FILE.cob: Same.
* cobol.dg/group2/CBL_OPEN_FILE___CBL_READ_FILE___CBL_CLOSE_FILE.cob: Same.
* cobol.dg/group2/CBL_READ_FILE__check_file_size_with_flags___128.cob: Same.
* cobol.dg/.gitignore: New test.

2 weeks agoRemove unused return value from vect_transform_stmt
Richard Biener [Wed, 15 Jul 2026 13:11:36 +0000 (15:11 +0200)] 
Remove unused return value from vect_transform_stmt

Without SLP we used to elide stores immediately, but now this is
done as postprocessing so the return value is no longer needed.

* tree-vectorizer.h (vect_transform_stmt): Return void.
* tree-vect-stmts.cc (vect_transform_stmt): Likewise.

2 weeks agoImprove dump when SLP fails to compute lane extraction insertion points
Richard Biener [Wed, 15 Jul 2026 11:20:55 +0000 (13:20 +0200)] 
Improve dump when SLP fails to compute lane extraction insertion points

The following helps debugging.

* tree-vect-slp.cc (vect_bb_slp_mark_live_stmts): Enhance
dumping in the failure case.

2 weeks agotestsuite: Fix gcc.target/i386/pr64731.c on 32-bit Solaris/x86
Rainer Orth [Wed, 15 Jul 2026 12:48:42 +0000 (14:48 +0200)] 
testsuite: Fix gcc.target/i386/pr64731.c on 32-bit Solaris/x86

Between r17-2065 and r17-2094, the gcc.target/i386/pr64731.c test
regressed on 32-bit Solaris/x86:

FAIL: gcc.target/i386/pr64731.c scan-assembler-not movap[sd].*[er]sp

The test needs -mno-stackrealign now.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu (32 and 64-bit
each).

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

gcc/testsuite:
* gcc.target/i386/pr64731.c (dg-options): Add -mno-stackrealign.