]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 hours agoAdjust configure machinery to abi32 targets master trunk
Eric Botcazou [Thu, 18 Jun 2026 09:08:39 +0000 (11:08 +0200)] 
Adjust configure machinery to abi32 targets

The machinery would still consider them as 64-bit targets in a few cases.

gcc/
* acinclude.m4 (gcc_GAS_FLAGS): Set to --32 for abi32 targets.
* configure.ac (TLS support): Use 32-bit sequence for abi32 targets.
* configure: Regenerate.

2 hours agoFix wrong optimization of array manipulation at -O2 or above
Eric Botcazou [Wed, 17 Jun 2026 08:07:41 +0000 (10:07 +0200)] 
Fix wrong optimization of array manipulation at -O2 or above

This occurs when the array is declared in a subprogram and manipulated from
within a second subprogram nested in the first: in this case, the array is
allocated in the special frame structure of the first subprogram as a field
with the DECL_NONADDRESSABLE_P flag set if the TREE_ADDRESSABLE flag is not
set for the original array variable.  But the array may contain addressable
(sub)components whose address can be taken, thus fooling the computation of
alias sets when strict aliasing is enabled.

The fix is in keeping with the usage of DECL_NONADDRESSABLE_P on fields of
record types by the Ada compiler, which is the main user of both the flag
and the machinery implemented in the tree-nested.cc file.

gcc/
* tree-nested.cc (lookup_field_for_decl): In the non-pointer case,
clear DECL_NONADDRESSABLE_P if the DECL is of an aggregate type.

gcc/testsuite/
* gnat.dg/opt108.adb: New test.
* gnat.dg/opt108_pkg.ads, gnat.dg/opt108_pkg.adb: New helper.

4 hours ago[PATCH] match: Optimize bit_ior/bit_and {bit_not} rshift to min/max [PR125641]
Kael Andrew Franco [Fri, 19 Jun 2026 03:00:44 +0000 (21:00 -0600)] 
[PATCH] match: Optimize bit_ior/bit_and {bit_not} rshift to min/max [PR125641]

Fold x | (x >> (TYPE_PRECISION (type) - 1)) to max (x, -1)
Fold x | (~ (x >> (TYPE_PRECISION (type) - 1))) to min (x, -1)
Fold x & (x >> (TYPE_PRECISION (type) - 1)) to min (x, 0)
Fold x & (~ (x >> (TYPE_PRECISION (type) - 1))) to max (x, 0)

Bootstrapped and tested on x86_64-pc-linux-gnu

PR tree-optimization/125641

gcc/ChangeLog:

PR tree-optimization/125641
* match.pd: Add bit_ior/bit_and {bit_not} rshift to min/max.

gcc/testsuite/ChangeLog:

PR tree-optimization/125641
* gcc.dg/pr125641.c: New test.

7 hours agoclean: Removed orphaned comments from deleted imports.
Léo Hardt [Tue, 9 Jun 2026 01:59:40 +0000 (22:59 -0300)] 
clean: Removed orphaned comments from deleted imports.

Hello!

This patch removes comments that used to refer to imports, which
were deleted in some import clean-ups that happened years ago.

I did a brief tour of the code and did not notice any other such
orphaned comment.

For convenience of reviewing, here are the links to the mentioned
commits. Notice that these diffs created the orphaned comments.

- For ddg.h:
  https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=60393bbc

- For sel-sched-ir.h:
  gcc.gnu.org/git/?p=gcc.git;a=commit;h=c7131fb

- For trans-intrinsic, objc-act, objc-encoding:
  https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=69f293c

As for testing, I don't think comments could affect the target
binary, but I have nevertheless successfully bootstrapped gcc
with these changes applied.

gcc/ChangeLog:

* ddg.h (GCC_DDG_H): Removed orphaned comment from 60393bbc
* sel-sched-ir.h (GCC_SEL_SCHED_IR_H): Removed orphaned comment from c7131fb

gcc/fortran/ChangeLog:

* trans-intrinsic.cc: Removed orphaned comment from 69f293c

gcc/objc/ChangeLog:

* objc-act.cc: Removed orphaned comment from 69f293c
* objc-encoding.cc: Removed orphaned comment from 69f293c

Signed-off-by: Léo Hardt <leom.hardt@inf.ufrgs.br>
7 hours agoDaily bump.
GCC Administrator [Fri, 19 Jun 2026 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

8 hours ago[PATCH] PR tree-optimization/125405: Missed optimization: mask/sub sign-extension...
Milan Tripkovic [Thu, 18 Jun 2026 23:51:59 +0000 (17:51 -0600)] 
[PATCH] PR tree-optimization/125405: Missed optimization: mask/sub sign-extension idiom not canonicalized to sign extension

This patch implement new pattern for match.pd that recognize the
sign-extension idiom (x & low_bits) - (x & sign_bit) and tests that covers it.
Pattern is based on conversation from bug report.

TRUNK riscv output:
 sext8_hd:
          andi    a5,a0,127
          andi    a0,a0,128
          sub     a0,a5,a0
          ret

 sext16_hd:
          slli    a5,a0,49
          li      a4,32768
          srli    a5,a5,49
          and     a0,a0,a4
          sub     a0,a5,a0
          ret

NEW riscv output:
sext8_hd:
        slliw   a0,a0,24
        sraiw   a0,a0,24
        ret

sext16_hd:
        slliw   a0,a0,16
        sraiw   a0,a0,16
        ret

TRUNK x86 output:
"sext8_hd":
        mov     rax, rdi
        and     edi, 128
        and     eax, 127
        sub     rax, rdi
        ret

"sext16_hd":
        mov     rax, rdi
        and     edi, 32768
        and     eax, 32767
        sub     rax, rdi
        ret

new x86 output:
sext8_hd:
        movsbq  %dil, %rax
        ret

sext16_hd:
        movswq  %di, %rax
        ret

PR target/125405

gcc/ChangeLog:

* match.pd: New pattern added.

gcc/testsuite/ChangeLog:

* gcc.dg/pr125405-bitint.c: New test.
* gcc.dg/tree-ssa/pr125405.c: New test.
* gcc.target/riscv/pr125405.c: New test.

9 hours ago[RISC-V] Split X eq/ne C where -C is a small constant
Jeff Law [Thu, 18 Jun 2026 22:56:31 +0000 (16:56 -0600)] 
[RISC-V] Split X eq/ne C where -C is a small constant

This was something I found while analyzing paths forward for a patch from
Daniel.

Amazingly, RISC-V does not have anything like a setCC style insn that compares
a register against a constant.  Instead we negate the constant and add it to
the source value.  That gives us zero (equal) or nonzero (not equal).  We
follow that with a snez/seqz to give us 0/1 like other setCC style
instructions.

If we have a 3 or more insns that ultimately combine into something like:

(set (dest) (eq (srcreg) (const_int))

We can use a define_split to rewrite that into a two instruction sequence which
is a small win.  I'd suspected there was some value in this kind of splitter
for a while, but never had a testcase that could actually be improved.  I wrote
the splitter and tested with Daniel's code, but more importantly, once I had
the basic splitter working, I could do a before/after comparison and look for
differences which I was able to find.

While the testcase came from 502.gcc, it's not hot at all.  But it does clearly
show how the splitter can improve code.

Tested on riscv32-elf and riscv64-elf.  Bootstraps on the K3 and c920 are in
flight.  I'll wait for the bootstrap/regression tests as well as the pre-commit
CI testing before moving forward.

gcc/
* config/riscv/riscv.md (splitter for equality test): New splitter.

gcc/testsuite/
* gcc.target/riscv/test-equal.c: New test.

10 hours agolibgomp: Prototype "accel" 'GOMP_INDIRECT_ADDR_MAP', 'GOMP_INDIRECT_ADDR_HMAP' in...
Thomas Schwinge [Mon, 11 May 2026 20:07:13 +0000 (22:07 +0200)] 
libgomp: Prototype "accel" 'GOMP_INDIRECT_ADDR_MAP', 'GOMP_INDIRECT_ADDR_HMAP' in 'target-indirect.h'

..., instead of repeating 'extern' prototypes in all "accel" 'team.c' files
for 'GOMP_INDIRECT_ADDR_MAP' vs. no prototype for 'GOMP_INDIRECT_ADDR_HMAP',
as done in commit da5803c794d16deb461c93588461856fbf6e54ac
"libgomp: Init hash table for 'indirect'-clause of 'declare target' on the host [PR114445, PR119857]".

libgomp/
* config/accel/target-indirect.h (GOMP_INDIRECT_ADDR_MAP)
(GOMP_INDIRECT_ADDR_HMAP): Prototype.
* config/gcn/team.c: Adjust.
* config/nvptx/team.c: Likewise.

10 hours agolibgomp: Prototype "accel" 'build_indirect_map' in new 'target-indirect.h'
Thomas Schwinge [Mon, 11 May 2026 19:58:30 +0000 (21:58 +0200)] 
libgomp: Prototype "accel" 'build_indirect_map' in new 'target-indirect.h'

..., instead of repeating 'extern' prototypes in all "accel" 'team.c'
files, as done in commit a49c7d3193bb0fd5589e12e725f5a130725ae171
"openmp: Add support for the 'indirect' clause in C/C++".

libgomp/
* config/accel/target-indirect.h: New.
* config/accel/target-indirect.c: Adjust.
* config/gcn/team.c: Likewise.
* config/nvptx/team.c: Likewise.

10 hours agolibgomp: '#include "libgomp.h"' in 'libgomp/target-indirect.c'
Thomas Schwinge [Mon, 11 May 2026 19:42:11 +0000 (21:42 +0200)] 
libgomp: '#include "libgomp.h"' in 'libgomp/target-indirect.c'

..., as libgomp implementation files generally do.  This gets us
'#include "libgomp_g.h"', which contains the prototype for
'GOMP_target_map_indirect_ptr'.  Minor fix-up for
commit a49c7d3193bb0fd5589e12e725f5a130725ae171
"openmp: Add support for the 'indirect' clause in C/C++".

libgomp/
* target-indirect.c: '#include "libgomp.h"'.

10 hours agolibgomp: Sort 'GOMP_target_map_indirect_ptr' correctly in 'libgomp/libgomp_g.h'
Thomas Schwinge [Mon, 11 May 2026 19:41:43 +0000 (21:41 +0200)] 
libgomp: Sort 'GOMP_target_map_indirect_ptr' correctly in 'libgomp/libgomp_g.h'

Minor fix-up for commit a49c7d3193bb0fd5589e12e725f5a130725ae171
"openmp: Add support for the 'indirect' clause in C/C++".

libgomp/
* libgomp_g.h (GOMP_target_map_indirect_ptr): Sort correctly.

10 hours agolibgomp: Sort 'GOMP_atomic_{start,end}' correctly in 'libgomp/libgomp_g.h'
Thomas Schwinge [Tue, 12 May 2026 07:58:50 +0000 (09:58 +0200)] 
libgomp: Sort 'GOMP_atomic_{start,end}' correctly in 'libgomp/libgomp_g.h'

Minor fix-up for Subversion r242789
(Git commit 6103184e81c0b6a8b1f4e072e0c32d9bb86fcc15)
"OpenMP offloading to NVPTX: libgomp changes", which did:

    [...]
     * critical.c: Split out GOMP_atomic_{start,end} into...
     * atomic.c: ...here (new file).
    [...]

libgomp/
* libgomp_g.h (GOMP_atomic_start, GOMP_atomic_end): Sort correctly.

11 hours agolibgomp: Drop unused 'ialias'es from 'libgomp/oacc-init.c'
Thomas Schwinge [Mon, 11 May 2026 14:07:43 +0000 (16:07 +0200)] 
libgomp: Drop unused 'ialias'es from 'libgomp/oacc-init.c'

They've always been unused, and, curiously, no 'ialias'es had ever gotten
added for any other 'libgomp/oacc-[...].c' files.  Minor fix-up for
Subversion r219682 (Git commit 41dbbb3789850dfea98dd8984f69806284f87b6e)
"Merge current set of OpenACC changes from gomp-4_0-branch".

libgomp/
* oacc-init.c (acc_init, acc_shutdown, acc_get_num_devices)
(acc_set_device_type, acc_get_device_type, acc_get_device_num)
(acc_set_device_num, acc_get_property, acc_get_property_string)
(acc_on_device): Drop 'ialias'es.

11 hours agolibgomp: 'libgomp/config/nvptx/oacc-parallel.c' -> 'libgomp/config/accel/oacc-parallel.c'
Thomas Schwinge [Mon, 11 May 2026 10:35:01 +0000 (12:35 +0200)] 
libgomp: 'libgomp/config/nvptx/oacc-parallel.c' -> 'libgomp/config/accel/oacc-parallel.c'

For no good reason, libgomp/GCN currently compiles the "full" (host)
'oacc-parallel.c', instead of the empty "accel" one.  Minor fix-up for
Subversion r278132 (Git commit b3d14b3aa343eb7fc656e7f4d3c9b2dc04be63be)
"Move generic libgomp files from nvptx to accel", which moved other files
from 'libgomp/config/nvptx/' to 'libgomp/config/accel/'.

libgomp/
* config/nvptx/oacc-parallel.c: Move...
* config/accel/oacc-parallel.c: ... here.

11 hours agoMake 'gcc/tree.h:ENCODE_QUAL_ADDR_SPACE' safer to use
Paul Iannetta [Thu, 6 Oct 2022 14:34:00 +0000 (16:34 +0200)] 
Make 'gcc/tree.h:ENCODE_QUAL_ADDR_SPACE' safer to use

As pointed out by Paul Iannetta in his
"[RFC] c++: parser - Support for target address spaces in C++".  Fix-up for
Subversion r153572 (Git commit 09e881c9e21a9209b2092e400ea4c38948614f78)
"Named address spaces: core middle-end support".

gcc/
* tree.h (ENCODE_QUAL_ADDR_SPACE): Add missing parentheses.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
12 hours agopointsr-to and points-away intersected result is undefined.
Andrew MacLeod [Thu, 18 Jun 2026 15:03:05 +0000 (11:03 -0400)] 
pointsr-to and points-away intersected result is undefined.

when performing an intersection, pointing-to an object and away-from
an object now results in an UNDEFINED value.

* value-range.cc (prange::intersect): Points-to and away results
in undefined.

12 hours agoinvariant_p should return true or false instead of a tree
Andrew MacLeod [Thu, 18 Jun 2026 14:58:57 +0000 (10:58 -0400)] 
invariant_p should return true or false instead of a tree

left from a previous API version, the boolean result should be true
or false, not a TREE which is then converted to a boolean.

* value-range.h (prange::pt_invariant_p): Return true or false.
(prange::pt_invariant_away_p): Likewise.

12 hours agoDo not check points-to in zero_p.
Andrew MacLeod [Thu, 18 Jun 2026 14:45:39 +0000 (10:45 -0400)] 
Do not check points-to in zero_p.

checking pt_unknown_p() should not be needed, having a NULL condition
should have no points to field set.  Assert this is true.

* value-range.h (prange::zero_p): Assert that is zero_p is true,
points_to is unknown.

14 hours agofortran: [PR125535] Plug remaining leak in implied-do array constructor with allocata...
Jerry DeLisle [Fri, 12 Jun 2026 01:50:37 +0000 (18:50 -0700)] 
fortran: [PR125535] Plug remaining leak in implied-do array constructor with allocatable components

Follow-up to the PR fortran/125535 wrong-code fix (commit 1b8421e9d5b,
already pushed): that fix corrected the *values* produced by an
implied-do array constructor of derived-type function results with
allocatable components, but left a separate memory leak in the same
code path.

An array constructor whose implied-do produces function results of a
derived type with allocatable components moves each result into the
constructor temporary, so the temporary owns those components.  The
per-element finalization in gfc_trans_array_ctor_element only freed
the single slot referenced by the final loop offset, leaking the
allocatable components of every other element the loop produced.

A whole-array sweep is the only way to free every slot written by an
implied-do, but it may be used only when every element is an owned
function result: a variable element is shallow-copied into the
temporary and its components are aliased rather than owned, so freeing
them would double free.  Add gfc_constructor_is_owned_alloc_comp to
detect the all-owned case and, when it holds, suppress the per-element
finalization and emit a single gfc_deallocate_alloc_comp_no_caf over
the whole temporary.

PR fortran/125535

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_constructor_is_owned_alloc_comp): New function.
(gfc_trans_array_constructor_value): Add OWNED_SWEEP parameter and,
when set, suppress the per-element finalization.  Pass it through the
recursive call.
(trans_array_constructor): Compute OWNED_SWEEP and, when set,
deallocate the allocatable components of the whole temporary in one
sweep.

gcc/testsuite/ChangeLog:

* gfortran.dg/asan/implied_do_alloc_comp_leak_1.f90: New test.

15 hours agoMark variables in references for variable definition context as used.
Thomas Koenig [Sun, 14 Jun 2026 06:43:00 +0000 (08:43 +0200)] 
Mark variables in references for variable definition context as used.

Code like "a(i) = 42" would not mark i as used, leading to false
positives for warnings with -Wunused-but-set-variable.  This is fixed
in the attached patch.  It also removes some default arguments to
make sure that the caller side provides correct information.

gcc/fortran/ChangeLog:

PR fortran/30438
* gfortran.h (gfc_value_set_at): Remove default argument.
(gfc_expr_set_at): Add prototype.
* interface.cc (gfc_compare_actual_formal): Use gfc_expr_set_at.
* intrinsic.cc (mark_args_as_used): Likewise.
* io.cc (resolve_tag): Likewise.
(gfc_resolve_dt): Likewise.
(gfc_resolve_inquire): Likewise.
* resolve.cc (resolve_transfer): Likewise.
(mark_lhs_assignments_set): Likewise.
* symbol.cc (gfc_lvalue_allocated_at): Add comment, fix formatting.
(gfc_expr_set_at): New fuction.

gcc/testsuite/ChangeLog:

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

15 hours agocobol: Improved MOVE routines.
Robert Dubner [Thu, 18 Jun 2026 15:25:57 +0000 (11:25 -0400)] 
cobol: Improved MOVE routines.

Faster routine for converting numeric-display numerical strings to
binary values.  Improved conversion of binary values to big-endian
COMP-4 values.

gcc/cobol/ChangeLog:

* cbldiag.h (current_program_index): Suppress cppcheck warning.
(struct cbl_loc_t): Likewise.
* genutil.cc (get_depending_on_value_from_odo): Check subscript
against occurs-depending-on value.
(get_data_offset): Likewise.
(digit): Fast string-to-binary routine.
(num_disp_dive): Likewise.
(get_binary_value_tree): Likewise.
(copy_little_endian_into_place): Move the function to move.cc.
(get_location): Normalize use of "data" pointer versus using the
address of a known variable.
* genutil.h (copy_little_endian_into_place): Remove declarations.
* move.cc (get_reference_to_data): Eliminate function.
(mh_identical): Simplify the logic that uses get_location.
(copy_little_endian_into_place):  Use the routine for both little-
and big-endian targets.  Take absolute value of signed inputs when
the target is unsigned.
(mh_little_endian): Handle both little- and big-endian targets.
* symbols.cc (cbl_alphabet_t::cbl_alphabet_t):  Suppress
cppcheck warning.

16 hours agobackprop: Don't try to delete default defs [PR125872]
Richard Sandiford [Thu, 18 Jun 2026 15:54:08 +0000 (16:54 +0100)] 
backprop: Don't try to delete default defs [PR125872]

In this PR, -fno-tree-dce meant that backprop was presented with code
that was completely dead.  The pass's internal DCE then tried to delete
the function parameter's definition.

gcc/
PR tree-optimization/125872
* gimple-ssa-backprop.cc (backprop::execute): Don't try to delete
default definitions.

gcc/testsuite/
PR tree-optimization/125872
* gcc.dg/torture/pr125872.c: New test.

17 hours agoFix typo in range_of_phi.
Andrew MacLeod [Thu, 18 Jun 2026 00:19:19 +0000 (20:19 -0400)] 
Fix typo in range_of_phi.

We should set points to info when it doesnt already point at something.
The opposite was being done.

* gimple-range-fold.cc (fold_using_range::range_of_phi): Remove
extranous logical not from expression.

17 hours agoDo not invoke a different range query from within fold_stmt.
Andrew MacLeod [Wed, 17 Jun 2026 20:51:15 +0000 (16:51 -0400)] 
Do not invoke a different range query from within fold_stmt.

fold_using_range works on a specified range_query object.  IF this
object is not the current_range_query (cfun) object, do not invoke
the general gimple fold routines as they may call into the current
query.

PR tree-optimization/125854
gcc/
* gimple-range-fold.cc (fold_using_range::fold_stmt): Check if the
range_query matches the current one before invoking fold.

gcc/testsuite/
* g++.dg/pr125854.C: New.

18 hours agoc++: simplify condition in check_initializer
Marek Polacek [Wed, 17 Jun 2026 18:20:53 +0000 (14:20 -0400)] 
c++: simplify condition in check_initializer

This condition has become unwieldy and hard to read.
In <https://gcc.gnu.org/pipermail/gcc-patches/2026-June/720712.html>
I tried to factor it out into a separate function but it works to
just drop the complicated inner disjunction.  I ran the testsuite
checking if we exercise the case where the new and old conditions
evaluate to different values and many tests triggered that.

gcc/cp/ChangeLog:

* decl.cc (check_initializer): Don't call
build_aggr_init_full_exprs for {} of an aggregate.

Reviewed-by: Jason Merrill <jason@redhat.com>
19 hours agoipa-cp: Fix ipa-vr intersection in wrong type (PR124128)
Martin Jambor [Thu, 18 Jun 2026 12:55:33 +0000 (14:55 +0200)] 
ipa-cp: Fix ipa-vr intersection in wrong type (PR124128)

Function ipa_vr_intersect_with_arith_jfunc in ipa-cp.cc contains a
check

  if (src_type == dst_type)

which should have been

  if (operation_type == dst_type)

which lead to an ICE in the ranger machinery as it tried to intersect
a signed and an unsigned integer when compiling the testcases from
PR124128.

The condition itself is basically an early exit to avoid calling yet
another ipa_vr_operation_and_type_effects to type-convert the value
range when we already can simply compare the types and see we already
have the righ thing.  A better place for it is however just before
that conversion, where it can also avoid the call when dealing with
the most simple of pass-through jump functions (and where it generally
"makes more sense") so this is what the patch does.

gcc/ChangeLog:

2026-06-04  Martin Jambor  <mjambor@suse.cz>

PR ipa/124128
* ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Move the check if
the final type conversion needs to happen before the conversion.

gcc/testsuite/ChangeLog:

2026-06-04  Martin Jambor  <mjambor@suse.cz>

PR ipa/124128
* gcc.dg/ipa/pr124128.c: New test.

19 hours agofortran: Fix UBSAN error member access within null pointer (PR125860)
Martin Jambor [Thu, 18 Jun 2026 12:17:14 +0000 (14:17 +0200)] 
fortran: Fix UBSAN error member access within null pointer (PR125860)

With UBSAN instrumented compiler, compiling the testcase
gfortran.dg/altreturn_5.f90 at -O3 fails with:

  /home/worker/buildworker/ubsan/build/gcc/fortran/interface.cc:4717:27: runtime error: member access within null pointer of type 'struct gfc_expr'

This patch adds the necessary guard to avoid passing an invalid LOC to
gfc_value_set_and_used even when the EXPR parameter is NULL and the
function will just return.  I have left the NULL-check in
gfc_value_set_and_used intact so that the behavior of the function is
consistent with gfc_value_used_expr (and possibly other functions).

gcc/fortran/ChangeLog:

2026-06-16  Martin Jambor  <mjambor@suse.cz>

PR fortran/125860
* interface.cc (gfc_procedure_use): Check a->expr is not NULL before
calling gfc_value_set_and_used.

19 hours agouse recorded vector composition type for costing
Richard Biener [Tue, 12 May 2026 12:48:41 +0000 (14:48 +0200)] 
use recorded vector composition type for costing

We're making vector construction extra costly but too much
because we up to now do not know the actual vector composition
type used.  This makes use of this now available information.

* config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
Use vector construction scaling also for mult-lane
VMAT_STRIDED_SLP but use vector composition type recorded
to avoid excessive over-costing.

19 hours agoHandle vec_deconstruct where appropriate
Richard Biener [Wed, 17 Jun 2026 11:23:41 +0000 (13:23 +0200)] 
Handle vec_deconstruct where appropriate

The following replaces vec_to_scalar handling where now vec_deconstruct
is expected.

* config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
Expect vec_deconstruct where formerly handling vec_to_scalar
for emulated gather/scatter, elementwise and strided accesses.

19 hours agoSplit out ix86_vector_cd_cost
Richard Biener [Wed, 13 May 2026 12:14:19 +0000 (14:14 +0200)] 
Split out ix86_vector_cd_cost

This implements costing of vector construction and decomposition
to a custom (possibly vector) element type to be used for vectorizer
costing of the corresponding operations when dealing with
VMAT_STRIDED_SLP loads and stores.

* config/i386/i386.cc (ix86_vector_cd_cost): New function,
enhanced and split out from ...
(ix86_default_vector_cost): ... here.

19 hours agoAdd vec_deconstruct costing kind
Richard Biener [Wed, 17 Jun 2026 11:19:56 +0000 (13:19 +0200)] 
Add vec_deconstruct costing kind

The following adds vec_decostruct to replace nunits * vec_to_scalar
which allows for more precise costing whenever vectorization
needs to decompose a vector to pieces, like for emulated gather/scatter
but also for strided [SLP] loads/stores.

This requires changes across targets, both for the different kind
but also for the difference in expected count.  For now this adjusts
them all to handle vec_deconstruct like vec_construct to avoid ICEing.

* target.h (vect_cost_for_stmt::vec_deconstruct): New kind.
* tree-vect-loop.cc (vect_model_reduction_cost): Use it.
* tree-vect-stmts.cc (vectorizable_store): Likewise.
(vectorizable_load): Likewise.
* tree-vectorizer.cc (dump_stmt_cost): Handle vec_deconstruct.
* config/aarch64/aarch64.cc (aarch64_builtin_vectorization_cost):
Handle vec_deconstruct like vec_construct.
* config/i386/i386.cc (ix86_default_vector_cost): Likewise.
* config/arm/arm.cc (arm_builtin_vectorization_cost): Likewise.
* config/loongarch/loongarch.cc (loongarch_builtin_vectorization_cost):
Likewise.
* config/riscv/riscv.cc (riscv_builtin_vectorization_cost):
Likewise.
* config/rs6000/rs6000.cc (rs6000_builtin_vectorization_cost):
Likewise.
* config/s390/s390.cc (s390_builtin_vectorization_cost): Likewise.
* targhooks.cc (default_builtin_vectorization_cost): Likewise.

20 hours agoAlso record ls element type for costing
Richard Biener [Wed, 13 May 2026 12:22:01 +0000 (14:22 +0200)] 
Also record ls element type for costing

I've realized that on x86 we get vector types as vector composition
element types, so just recording the ls_type isn't enough to
realize we're constructing a V4SI from V2SI elements.  The following
adds such a field.

* tree-vectorizer.h (vect_load_store_data::ls_eltype): New field.
* tree-vect-stmts.cc (vectorizable_load): Record ltype
as ls_eltype for VMAT_STRIDED_SLP.
(vectorizable_store): Likewise.

23 hours agoada: Fix missing accessibility check for allocator with access discriminant
Eric Botcazou [Fri, 5 Jun 2026 19:55:29 +0000 (21:55 +0200)] 
ada: Fix missing accessibility check for allocator with access discriminant

This implements the last part of the RM 4.8(10.1) rule about allocators
for types with access discriminants.  The implementation is modeled on
that of returns for types with access discriminants, given that the set
of rules applying to them is the same (RM 3.10.2(12-12.4)).

The change also streamlines the latter by applying the RM 3.10.2(12.4)
rule in Apply_Accessibility_Check_For_Discriminated_Return.

gcc/ada/ChangeLog:

* accessibility.ads (Apply_Accessibility_Check_For_Allocator):
Rename to...
(Apply_Accessibility_Check_For_Class_Wide_Allocator): ...this.
(Apply_Accessibility_Check_For_Discriminated_Allocator): New.
* accessibility.adb (Apply_Accessibility_Check_For_Allocator):
Rename to...
(Apply_Accessibility_Check_For_Class_Wide_Allocator): ...this.
Call Duplicate_Subexpr directly instead of reimplementing it.
(Apply_Accessibility_Check_For_Discriminated_Allocator): New.
(Apply_Accessibility_Check_For_Discriminated_Return): Streamline.
(Apply_Accessibility_Check_For_Return): Tweak comments.
* exp_ch4.adb (Expand_Allocator_Expression): Call
Apply_Accessibility_Check_For_Discriminated_Allocator and
adjust calls to Apply_Accessibility_Check_For_Allocator.
(Expand_N_Allocator): Likewise.

23 hours agoada: Allow volatile objects to appear in Modifies SPARK clauses
Piotr Trojanek [Thu, 4 Jun 2026 09:25:52 +0000 (11:25 +0200)] 
ada: Allow volatile objects to appear in Modifies SPARK clauses

Volatile objects are allowed to appear in the Modifies clauses with no guards.

gcc/ada/ChangeLog:

* sem_util.adb (Is_OK_Modifies_Context): Accept references in Modifies
clauses.

23 hours agoada: Support new Modifies contract for SPARK
Piotr Trojanek [Wed, 6 May 2026 14:48:46 +0000 (16:48 +0200)] 
ada: Support new Modifies contract for SPARK

Basic support for a new contract. References to SPARK RM will be completed once
the contract is documented there. Legality checks for modified objects being
outputs need to be completed as well (or implemented in GNATprove).

All the code is copied and adapted from the Subprogram_Variant aspect, just
like with other contracts for SPARK, but with notable differences: this
contract requires a dedicated parsing and has no expansion. Currently it is
only supported as an aspect, despite having a corresponding pragma (which is
required to handle it like other contracts).

gcc/ada/ChangeLog:

* aspects.ads (Aspect_Id, Implementation_Defined_Aspect,
Aspect_Argument, Is_Representation_Aspect, Aspect_Names, Aspect_Delay):
Add new aspect and its basic characteristics.
* contracts.adb (Add_Contract_Item,
Analyze_Entry_Or_Subprogram_Contract,
Analyze_Entry_Or_Subprogram_Body_Contract,
Analyze_Subprogram_Body_Stub_Contract): Handle new aspect.
* contracts.ads (Add_Contract_Item,
Analyze_Entry_Or_Subprogram_Contract,
Analyze_Entry_Or_Subprogram_Body_Contract,
Analyze_Subprogram_Body_Stub_Contract): Likewise.
* doc/gnat_rm/implementation_defined_aspects.rst (Aspect Modifies):
Document new aspect.
* doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Modifies):
Document corresponding pragma.
* einfo-utils.adb
(Get_Pragma): Handle new pragma
* einfo-utils.ads
(Get_Pragma): Likewise.
* inline.adb (Remove_Aspects_And_Pragmas): Handle new pragma.
* par-ch13.adb (P_Modifies_Specification): Parse special aspect syntax.
(Get_Aspect_Specifications): Parse new aspect.
* par-prag.adb (Prag): Temporarily accept new pragma.
* sem_ch12.adb (Implementation of Generic Contracts): Update list of
supported contracts.
* sem_ch13.adb (Analyze_One_Aspect, Analyze_Aspect_Specifications,
Check_Aspect_At_Freeze_Point): Analyze new aspect.
* sem_ch8.adb (In_Abstract_View_Pragma): Abstract states can appear in
new contract.
* sem_prag.adb (Contract_Freeze_Error, Ensure_Aggregate_Form): Update
list of supported contracts.
(Analyze_Modifies_In_Decl_Part, Analyze_Pragma): Analyze new pragma.
(Sig_Flags): Support new pragma.
* sem_prag.ads (Aspect_Specifying_Pragma, Assertion_Expression_Pragma,
Pragma_Significant_To_Subprograms, Find_Related_Declaration_Or_Body):
Handle new pragma.
(Analyze_Modifies_In_Decl_Part): Analyze new pragma.
* sem_util.adb, sem_util.ads (Is_Subprogram_Contract_Annotation):
Handle new contract.
* sinfo.ads (Is_Generic_Contract_Pragma, Contract): New contract is
a generic contract.
* snames.ads-tmpl: New contract name and new pragma.
* gnat_rm.texi: Regenerate.

23 hours agoada: Fix copy-paste error in subprogram body header
Piotr Trojanek [Thu, 30 Apr 2026 13:39:49 +0000 (15:39 +0200)] 
ada: Fix copy-paste error in subprogram body header

SPARK aspects are implemented by mostly copy-pasting existing code, so mistakes
are inevitable.

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_defined_pragmas.rst
(Subprogram_Variant): Refill paragraph.
* sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Fix header.
* gnat_rm.texi: Regenerate.

23 hours agoada: Fix missing dynamic accessibility checks for subpool access type
Eric Botcazou [Thu, 4 Jun 2026 13:45:53 +0000 (15:45 +0200)] 
ada: Fix missing dynamic accessibility checks for subpool access type

The checks are those prescribed by the RM 13.11.4(24-27) rules, which are
part of dynamic semantics but can be applied statically for the most part.

While the current implementation is incomplete, the fix is straightforward
and mostly boils down to redoing the associated static accessibility checks
of RM 13.11.4(22-23) without too much duplication in the implementation.

gcc/ada/ChangeLog:

* sem_util.ads (Get_Pool_Object_Or_Dereference): New function.
* sem_util.adb (Get_Pool_Object_Or_Dereference): Likewise, mostly
taken from...
* sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Object_From>:
...here.
<Attribute_Storage_Pool>: Call Get_Pool_Object_Or_Dereference.
* exp_ch3.adb (Freeze_Type): Add missing checks of RM 13.11.4(24-27)
and apply them to all regular pools not statically descendants from
Root_Storage_Pool_With_Subpools when its unit has been loaded.

23 hours agoada: Remove obsolete two-pronged implementation of static accessibility checks
Eric Botcazou [Wed, 3 Jun 2026 21:16:41 +0000 (23:16 +0200)] 
ada: Remove obsolete two-pronged implementation of static accessibility checks

For type conversions in instance bodies.  It's barely maintainable and the
raise statements are directly inserted for these checks in other contexts.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Type_Conversion): Do not apply again static
accessibility checks in instance bodies.
* sem_res.adb (Valid_Conversion): Insert the raise statements for
the failure of static accessibility checks in instance bodies.

23 hours agoada: Rework In_Package_Body field
Ronan Desplanques [Tue, 14 Apr 2026 07:02:45 +0000 (09:02 +0200)] 
ada: Rework In_Package_Body field

Before this patch, In_Package_Body had two different meanings depending
on whether it was applied to a package or to some other entity. This
extracts the second meaning to a new field, Declared_In_Package_Body, and
ties the maintenance of this field to the Scope field, which actually
becomes a thin wrapper over a new internal Gen_IL field.

A new Gen_IL contract is added to help enforce that In_Package_Body is
now only used with package entities.

One might wonder why the conceptually similar In_Private_Part field is
not given the same treatment. One reason is that it has combined the two
different meanings for much longer than In_Package_Body has, so it's much
more work to categorize the call sites. One other reason is that a change
I have in my pipeline is made possible by just this change to
In_Package_Body.

Also update all call sites that previously used Is_Package_Body_Entity to
use the new Declared_In_Package_Body field, remove Is_Package_Body_Entity,
and make print_node display Scope instead of the internal
Scope_Gen_IL_Private field.

gcc/ada/ChangeLog:

* gen_il-fields.ads (Declared_In_Package_Body): New field.
(Scope): Rename into...
(Scope_Gen_IL_Private): ...this.
* einfo-utils.ads (Scope, Set_Scope): New subprograms.
* einfo-utils.adb (Set_Scope): New subprogram.
* einfo.ads (In_Package_Body): Update documentation.
(Declared_In_Package_Body): Add documentation.
(Is_Package_Body_Entity): Remove.
* fe.h (Scope): New macro.
* gen_il-gen-gen_entities.adb (Gen_Entities): New field.
New contract. Remove Sm (Is_Package_Body_Entity).
* gen_il-gen-gen_nodes.adb (Gen_Nodes): Adapt to renaming.
* gen_il-gen.adb (Compute_Field_Offsets): Adapt to renaming.
* gen_il-internals.adb (Image): Adapt to renaming.
* lib-load.adb, lib.adb: Add with clauses.
* sem_ch3.adb (Analyze_Object_Declaration): Remove field update.
* sem_ch6.adb (Enter_Overloaded_Entity): Likewise.
* sem_util.adb (Collect_Primitive_Operations): Use new field.
(Enter_Name): Replace Is_Package_Body_Entity with
Declared_In_Package_Body.
* treepr.adb (Image): Add F_Scope_Gen_IL_Private alternative
that returns Scope.
* exp_dbug.adb (Is_BNPE): Replace Is_Package_Body_Entity with
Declared_In_Package_Body.
* sem_ch12.adb (Check_Generic_Actuals): Likewise.
* sem_warn.adb (Generic_Package_Spec_Entity): Likewise.
* sem_ch7.adb (Analyze_Package_Body_Helper): Replace
Set_Is_Package_Body_Entity with Set_Declared_In_Package_Body.

Co-Authored-By: Mathias Aparicio <aparicio@adacore.com>
23 hours agoada: Apply -gnatw.j warning switch correctly in a message
Viljar Indus [Thu, 4 Jun 2026 12:07:08 +0000 (15:07 +0300)] 
ada: Apply -gnatw.j warning switch correctly in a message

The error message here was using both ?.*? and ? warning
inseriton characters where the latter would override the first.

gcc/ada/ChangeLog:

* sem_disp.adb (Warn_On_Late_Primitive_After_Private_Extension):
apply warning character correctly.

23 hours agoada: Use correct warning char for unconditional elab warning
Viljar Indus [Wed, 3 Jun 2026 12:15:56 +0000 (15:15 +0300)] 
ada: Use correct warning char for unconditional elab warning

Warning messages from Check_Internal_Call_Continue were
not actually conditional on the -gnatwl flag and were
emitted always.

Use the switchless warning character for those messages
and refactor Output_Calls in order to handle all of the
possible warning characters in the continuation messages.

gcc/ada/ChangeLog:

* sem_elab.adb (Output_Calls): Apply correct warning
characeter for each continuation message.
(Check_Internal_Call_Continue): Use regular warning
character in error messages.

23 hours agoada: Fix missing error on formal with access discriminant in allocator and -gnatc
Eric Botcazou [Wed, 3 Jun 2026 10:50:58 +0000 (12:50 +0200)] 
ada: Fix missing error on formal with access discriminant in allocator and -gnatc

The problem is that the relevant part of the RM 4.8(5.3) rule is implemented
in the expander (the other part being implemented in the analyzer), so this
merges the former with the latter and streamlines the result in the process.

This also tweaks the Accessibility_Level function to make it more robust in
the presence of errors, as well as adjusts the new error message given by
the Check_Return_Construct_Accessibility procedure, which was a mouthful
and not really in keeping with other error messages about accessibility.

gcc/ada/ChangeLog:

* accessibility.adb (Accessibility_Level): Also deal with SAOOAAATs
without extra accessibility object alongside formal parameters.
(Check_Return_Construct_Accessibility): Streamline the error message
and adjust it to expression functions.
* exp_ch4.adb (Expand_Allocator_Expression): Do not perform a static
accessibility check here.
* sem_res.adb (Resolve_Allocator): Streamline the implementation of
the static accessibility check of RM 4.8(5.3), use a more consistent
error message, adjust it to instantiation bodies, and specifically
deal with formal parameters.

23 hours agoada: Make subprogram insertion code easier to understand
Ronan Desplanques [Wed, 3 Jun 2026 07:49:36 +0000 (09:49 +0200)] 
ada: Make subprogram insertion code easier to understand

This extracts part of the statement sequence of the
Build_And_Insert_Type_Attr_Subp procedure into a helper function. The
intent is to make it easier to tell when the objects declared inside the
procedure are mutated.

gcc/ada/ChangeLog:

* exp_attr.adb (Skip_Non_Source_Subps): Move before local object
declarations and add formals.
(Build): Move before local object declarations.
(Find_Insertion_Point_For_Ancestor): New local function.
(Build_And_Insert_Type_Attr_Subp): Use new function.

23 hours agoada: Fix missing context for class-wide contract expressions
Piotr Trojanek [Tue, 26 May 2026 09:20:20 +0000 (11:20 +0200)] 
ada: Fix missing context for class-wide contract expressions

The copies of class-wide pre- and postconditions are now attached to the
original pragma, so that legality checks, like the one for 'Old, can find the
original context of where those expressions appeared.

gcc/ada/ChangeLog:

* sem_attr.adb (Uneval_Old_Msg): Attribute Old never occurs outside of
a pragma.
* sem_ch13.adb (Analyze_One_Aspect): Attach expression copy of a
class-wide aspect to the corresponding pragma.
* sem_prag.adb (Analyze_Pre_Post_Condition): Likewise for a class-wide
pragma.

23 hours agoada: Fix ignored ghost withs hiding other implicit withs
Viljar Indus [Wed, 3 Jun 2026 07:58:11 +0000 (10:58 +0300)] 
ada: Fix ignored ghost withs hiding other implicit withs

gcc/ada/ChangeLog:

* rtsfind.adb (Maybe_Add_With): Fix skipping implicit
withs when only an ignored implicit with exists.

23 hours agoada: Minor comment fix
Marc Poulhiès [Tue, 2 Jun 2026 12:38:22 +0000 (14:38 +0200)] 
ada: Minor comment fix

Comment has been incorrect since the first imported version of the frontend.

The procedure is the same as Sprint_Node_List, not Sprint_Line_List (function
seems to have never existed, so it's probably a very old typo).

gcc/ada/ChangeLog:

* sprint.ads (Sprint_Indented_List): Adjust comment.

23 hours agoada: Fix assertion failure on access to uninitialized package entity
Eric Botcazou [Sat, 30 May 2026 19:11:44 +0000 (21:11 +0200)] 
ada: Fix assertion failure on access to uninitialized package entity

It occurs during the analysis of a generic package declared in a structural
instance of a parent generic package, on accessing the uninitialized entity
of the current semantic unit.  But this access is unnecessary because what
happens within an instance does not affect the current semantic unit here.

The change also adds the missing call to Unit_Requires_Body already present
in the generic subprogram case to the generic package case.

gcc/ada/ChangeLog:

* sem_ch12.adb (Analyze_Generic_Package_Declaration): Do not set the
Body_Needed_For_Inlining flag on the current semantic unit if the
package is declared within an instance or does not require a body.
(Analyze_Generic_Subprogram_Declaration): Similarly, do not set the
Body_Needed_For_Inlining flag on the current semantic unit if the
subprogram is declared within an instance.

23 hours agoada: Crash on allocator for tagged object with constructor
Javier Miranda [Thu, 28 May 2026 16:58:09 +0000 (16:58 +0000)] 
ada: Crash on allocator for tagged object with constructor

This patch fixed a compiler crash when allocating a tagged record
types through class-wide access type.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Allocator): For a class-wide designated
type with a constructor initializer, add a type conversion to
the specific type to avoid a dispatching call (since contructors
are not dispatching primitives).
* sem_ch13.adb (Analyze_Aspect_Specifications)
<Aspect_Initialize>: Avoid reporting a spurious error.

23 hours agoada: Fix missing error on nonaliased formal with access discriminants in return
Eric Botcazou [Mon, 25 May 2026 09:22:10 +0000 (11:22 +0200)] 
ada: Fix missing error on nonaliased formal with access discriminants in return

The construct must fail the static accessibility check of 6.5(5.9) because
the accessibility level of the anonymous access type of the discriminants
is that of the invocation of the function, which is too deep for a return.

The change also gets rid of the implementation of this check in the routine
Apply_Accessibility_Check_For_Anonymous_Return because 1) this routine is
meant for the corresponding dynamic accessibility check 6.5(21) and, thus,
only invoked when expansion is active, and 2) the check is implemented in
other routines, e.g. Check_Return_Construct_Accessibility for discriminants.

The change also implements the 6.8(5) rule, which is the counterpart of the
6.5(5.9) rule for access discriminants in expression functions.

gcc/ada/ChangeLog:

* accessibility.ads (Check_Return_Construct_Accessibility): Document
that it also implements the 6.8(5) rule.
* accessibility.adb (Accessibility_Message): Remove dead return.
(Apply_Accessibility_Check_For_Anonymous_Return): Do not apply the
static check of 6.5(5.9) here.
(Check_Return_Construct_Accessibility): Do not use "return object"
in the error message.  Do not reject synthesized return statements
when the function comes from source to handle expression funtions.
Robustify processing and explicitly deal with formal parameters.

23 hours agoada: Fix duplicated external tag error with structural generic instantiation
Eric Botcazou [Fri, 29 May 2026 08:54:05 +0000 (10:54 +0200)] 
ada: Fix duplicated external tag error with structural generic instantiation

The registration can be skipped altogether, because the name of the tag is
quite unlikely to conflict with a user-declared tag.

gcc/ada/ChangeLog:

* sem_ch12.adb (Build_Structural_Instantiation): Temporarily disable
registration of tagged types when analyzing the instantiation.

23 hours agoada: Fix dangling reference with Bounded_Indefinite_Holders and Empty_Holder
Eric Botcazou [Fri, 29 May 2026 06:34:39 +0000 (08:34 +0200)] 
ada: Fix dangling reference with Bounded_Indefinite_Holders and Empty_Holder

The issue is that the finalization of an empty container does not deallocate
its subpool, thus creating a dangling reference to it from the global pool.

gcc/ada/ChangeLog:

* libgnat/a-cbinho.adb (Clear): Deallocate the subpool even if the
container is empty.

23 hours agoada: Fix diagnostics inteneded as continuations
Viljar Indus [Thu, 28 May 2026 12:26:12 +0000 (15:26 +0300)] 
ada: Fix diagnostics inteneded as continuations

The diagnostic messages fixed here were using the | insertion
character instead of the \ used for continuations. Even though
they were clearly intended to supplement the previous message.

gcc/ada/ChangeLog:

* restrict.adb (Process_Restriction_Synonyms): Fix continuation
message.
* sem_prag.adb (Analyze_Pragma): Likewise.

23 hours agoada: Improve error reported for wrong constructor call
Javier Miranda [Tue, 26 May 2026 16:06:49 +0000 (16:06 +0000)] 
ada: Improve error reported for wrong constructor call

This patch improves the error reported when the invoked constructor is
not available. This is a common error because constructors are not
inherited; this means that a constructor for a given tagged type may
not exist for its derived types. Fix also a crash in the initialization
of a limited record type.

gcc/ada/ChangeLog:

* sem_attr.adb (Analyze_Attribute): Report an error when the number
of actual parameters for a constructor do not match any available
constructor.
* exp_ch6.adb (Make_Init_Proc_Call): Add the _Init_Level accessibility
level formal when building a call to the init proc of a limited record
type.
(Prepend_Constructor_Procedure_Prologue): Restrict the initialization
of the _parent component to cases where a Super aspect is present
or a parameterless parent constructor exists.

31 hours agoDaily bump.
GCC Administrator [Thu, 18 Jun 2026 00:16:35 +0000 (00:16 +0000)] 
Daily bump.

32 hours agocobol: Remove obsolete and renamed DejaGNU tests.
Robert Dubner [Wed, 17 Jun 2026 22:46:01 +0000 (18:46 -0400)] 
cobol: Remove obsolete and renamed DejaGNU tests.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/258_Nested_PERFORM.cob: Removed.
* cobol.dg/group2/258_Nested_PERFORM.out: Removed.
* cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.cob: Removed.
* cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.out: Removed.
* cobol.dg/group2/338_Default_Arithmetic__1_.cob: Removed.
* cobol.dg/group2/338_Default_Arithmetic__1_.out: Removed.
* cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.cob: Removed.
* cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.out: Removed.
* cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob: Removed.
* cobol.dg/group2/MOVE_to_JUSTIFIED_item.cob: Removed.
* cobol.dg/group2/MOVE_to_JUSTIFIED_item.out: Removed.
* cobol.dg/group2/SORT__table_sort__2_.cob: Removed.
* cobol.dg/group2/SORT__table_sort__2_.out: Removed.
* cobol.dg/group2/_-static__compilation.cob: Removed.

34 hours agoc++/reflection: crash with can_substitute and fn returning ref [PR125764]
Marek Polacek [Fri, 12 Jun 2026 13:43:52 +0000 (09:43 -0400)] 
c++/reflection: crash with can_substitute and fn returning ref [PR125764]

Here we crash in convert_from_reference because it gets a FUNCTION_TYPE
int&().  Since its return type is a reference, it passes the c_f_r check:

  if (TREE_TYPE (val)
      && TYPE_REF_P (TREE_TYPE (val)))

and we crash inside that block.

The call isn't needed since r17-1271:

  return convert_nontype_argument (type, convert_from_reference (arg),
                  complain);

but we can also avoid calling it on TYPE_P because the function is meant
for expressions only.

PR c++/125764

gcc/cp/ChangeLog:

* reflect.cc (eval_can_substitute): Don't call
convert_from_reference on types.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
35 hours ago install: Update required Bison version.
James K. Lowden [Wed, 17 Jun 2026 20:45:40 +0000 (16:45 -0400)] 
install: Update required Bison version.

gcc/ChangeLog:

* doc/install.texi: COBOL requires Bison 3.8.2.

40 hours agoc++/reflection: ICE in get_reflection on INDIRECT_REF [PR125759]
Marek Polacek [Fri, 12 Jun 2026 15:44:15 +0000 (11:44 -0400)] 
c++/reflection: ICE in get_reflection on INDIRECT_REF [PR125759]

We crash here in outer_var_p on:

  /* These should have been stripped or otherwise handled by the caller.  */
  gcc_checking_assert (!REFERENCE_REF_P (decl));

because we never stripped the INDIRECT_REF in get_reflection.  I don't
think stripping it only for the outer_automatic_var_p call would be
right so I'm doing it at the top of the function.

PR c++/125759

gcc/cp/ChangeLog:

* reflect.cc (get_reflection): Do STRIP_REFERENCE_REF.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
40 hours agoc++/reflection: tweak size_of diagnostic [PR125492]
Marek Polacek [Thu, 11 Jun 2026 16:18:36 +0000 (12:18 -0400)] 
c++/reflection: tweak size_of diagnostic [PR125492]

Here we say "reflection with incomplete type" when size_of
got a reflection of a function.  Let's clarify that diagnostic.

PR c++/125492

gcc/cp/ChangeLog:

* reflect.cc (eval_size_of): Add a separate throw_exception for
function types.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
40 hours agoc++/reflection: Handle stale parameter decarations in eval_is_explicit_object_parameter
Wang Jinghao [Wed, 17 Jun 2026 15:17:47 +0000 (11:17 -0400)] 
c++/reflection: Handle stale parameter decarations in eval_is_explicit_object_parameter

eval_is_explicit_object_parameter() determines whether a parameter is
an explicit object parameter by checking whether the passed-in tree
node is the first parameter in its parameter chain. As described in
the comment for maybe_update_function_parm(), if the sequence is
declaration -> reflection -> definition, the old PARM_DECL will be
compared against the new PARM_DECL, causing the check to produce an
incorrect result.
Calling maybe_update_function_parm() before the comparison updates
the old reflection to the new PARM_DECL in the chain, thereby
avoiding this error.

gcc/cp/ChangeLog:

* reflect.cc (eval_is_explicit_object_parameter): Call
maybe_update_function_parm before checking the parameter
against DECL_ARGUMENTS.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Wang Jinghao <zheng.xianyuwang@gmail.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
40 hours agolibgccjit: Add gcc_jit_type_is_floating_point
Antoni Boucher [Fri, 5 Sep 2025 14:32:40 +0000 (10:32 -0400)] 
libgccjit: Add gcc_jit_type_is_floating_point

gcc/jit/ChangeLog:

* docs/topics/compatibility.rst (LIBGCCJIT_ABI_38): New ABI tag.
* docs/topics/types.rst: Document gcc_jit_type_is_floating_point.
* libgccjit.cc (gcc_jit_type_is_floating_point): New function.
* libgccjit.h (gcc_jit_type_is_floating_point): New function.
* libgccjit.map: New function.
* libgccjit.exports: New function.

gcc/testsuite/ChangeLog:

* jit.dg/test-reflection.c: Add test for
gcc_jit_type_is_floating_point.

Co-authored-by: Robert Zakrzewski <robert.zakrzewski1@stellantis.com>
40 hours agoc++: explicit instantiation and noexcept-specifier [PR125613]
Marek Polacek [Fri, 5 Jun 2026 17:42:06 +0000 (13:42 -0400)] 
c++: explicit instantiation and noexcept-specifier [PR125613]

This patch implements this part of [except.spec]: In an explicit
instantiation a noexcept-specifier may be specified, but is not required.
If a noexcept-specifier is specified in an explicit instantiation, the
exception specification shall be the same as the exception specification
of all other declarations of that function.

But we are not checking this, and are the only compiler that accepts:

  template<typename T>
  void fn (T) {}
  template void fn<int>(int) noexcept;

PR c++/125613

gcc/cp/ChangeLog:

* pt.cc (check_explicit_specialization): Detect mismatches in
exception specifications in explicit instantiations.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/explicit-inst2.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
40 hours agolibstdc++: adjust explicit inst of std::basic_string::data()
Marek Polacek [Fri, 5 Jun 2026 21:25:36 +0000 (17:25 -0400)] 
libstdc++: adjust explicit inst of std::basic_string::data()

r15-2650 removed noexcept from non-const std::basic_string::data()
in bits/cow_string.h, but the explicit instantiations in string-inst.cc
kept their noexcept.  [except.spec] says that in an explicit instantiation
a noexcept-specifier may be specified, but is not required, but when it
is specified, it must be the same as the exception specification of all
other declarations of that function.  So I think we should just remove it.

libstdc++-v3/ChangeLog:

* src/c++17/string-inst.cc (basic_string::data): Remove noexcept.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
41 hours agolibgccjit: Make is_same_type_as() support floating point types
Robert Zakrzewski [Mon, 29 Apr 2024 10:19:28 +0000 (12:19 +0200)] 
libgccjit: Make is_same_type_as() support floating point types

gcc/jit/ChangeLog:

* jit-recording.h: Fix float comparison.
* libgccjit.cc: Fix type check in gcc_jit_context_new_comparison.

gcc/testsuite/ChangeLog:

* jit.dg/all-non-failing-tests.h: Mention new test.
* jit.dg/test-comparison.c: New test.

Co-authored-by: Antoni Boucher <bouanto@zoho.com>
41 hours agolibgccjit: Fix is_same_type_as for vector type
Robert Zakrzewski [Fri, 21 Jun 2024 09:08:26 +0000 (11:08 +0200)] 
libgccjit: Fix is_same_type_as for vector type

gcc/jit/ChangeLog:

* jit-recording.h: Fix type comparison.

gcc/testsuite/ChangeLog:

* jit.dg/test-types.c: Add vector type comparison in test.

Co-authored-by: Antoni Boucher <bouanto@zoho.com>
41 hours agolibgccjit: Handle missing types in jit_langhook_type_for_mode
Antoni Boucher [Tue, 8 Oct 2024 23:34:43 +0000 (19:34 -0400)] 
libgccjit: Handle missing types in jit_langhook_type_for_mode

gcc/jit/ChangeLog:

* dummy-frontend.cc: Handle new types in jit_langhook_type_for_mode.

42 hours agolibffi: Update LOCAL_PATCHES
Wilco Dijkstra [Wed, 17 Jun 2026 13:32:25 +0000 (13:32 +0000)] 
libffi: Update LOCAL_PATCHES

Add commit:
commit 94c5f47d21aa5f144a690189222cc08b86a00505 (origin/master, origin/HEAD)
Author: Muhammad Kamran <muhammad.kamran@arm.com>
Date:   Wed Jun 17 13:25:31 2026 +0000

    libffi: Mark AArch64 BTI and PAC with build attributes

    This is an adapted backport of the BTI/PAC parts of upstream libffi commit
    547449d705258ea490aa8787dc084c5b38dbe722, which emits AArch64 feature build
    attributes when assembler support is available and keeps the existing GNU
    property note as the fallback.

    GCC's current libffi copy does not include the upstream GCS support, so
    this backport only covers the existing BTI and PAC feature marking.

* LOCAL_PATCHES: Add commit 94c5f47d21aa5f144a690189222cc08b86a00505.

42 hours agolibffi: Mark AArch64 BTI and PAC with build attributes
Muhammad Kamran [Wed, 17 Jun 2026 13:25:31 +0000 (13:25 +0000)] 
libffi: Mark AArch64 BTI and PAC with build attributes

This is an adapted backport of the BTI/PAC parts of upstream libffi commit
547449d705258ea490aa8787dc084c5b38dbe722, which emits AArch64 feature build
attributes when assembler support is available and keeps the existing GNU
property note as the fallback.

GCC's current libffi copy does not include the upstream GCS support, so
this backport only covers the existing BTI and PAC feature marking.

libffi/ChangeLog:

* src/aarch64/internal.h (AARCH64_POINTER_AUTH): Rename from
GNU_PROPERTY_AARCH64_POINTER_AUTH.
* src/aarch64/sysv.S (AARCH64_BTI): Rename from
GNU_PROPERTY_AARCH64_BTI.
(GNU_PROPERTY): New macro.
(FEATURE_1_AND_MARK): Likewise.
Emit BTI and PAC feature build attributes when
__ARM_BUILDATTR64_FV is defined.

42 hours agolibitm: Mark AArch64 asm features with build attributes
Muhammad Kamran [Wed, 17 Jun 2026 13:23:56 +0000 (13:23 +0000)] 
libitm: Mark AArch64 asm features with build attributes

Emit AArch64 build attributes for BTI and PAC from libitm's hand-written
AArch64 assembly when __ARM_BUILDATTR64_FV is available.  Keep the
existing GNU property note emission as the fallback for toolchains that do
not support the new attribute form.

libitm/ChangeLog:

* config/aarch64/sjlj.S (FEATURE_1_AND_MARK): Define.  Use
AArch64 build attributes when __ARM_BUILDATTR64_FV is available,
otherwise emit a GNU property note.

42 hours agolibatomic: Mark AArch64 asm features with build attributes
Muhammad Kamran [Wed, 17 Jun 2026 13:23:50 +0000 (13:23 +0000)] 
libatomic: Mark AArch64 asm features with build attributes

Use AArch64 build attributes to record BTI, PAC and GCS feature bits when
__ARM_BUILDATTR64_FV is available.  Fall back to the existing GNU property
note emission otherwise.

libatomic/ChangeLog:

* config/linux/aarch64/atomic_16.S (FEATURE_1_AND_MARK): Define.
Use AArch64 build attributes when __ARM_BUILDATTR64_FV is
available, otherwise emit a GNU property note.

42 hours agolibgcc: Mark AArch64 asm features with build attributes
Muhammad Kamran [Wed, 17 Jun 2026 13:23:42 +0000 (13:23 +0000)] 
libgcc: Mark AArch64 asm features with build attributes

Emit AArch64 build attributes for BTI, PAC and GCS when
__ARM_BUILDATTR64_FV is available.  Keep the existing GNU property note
emission as the fallback for toolchains that do not support the new
attribute form.

libgcc/ChangeLog:

* config/aarch64/aarch64-asm.h (FEATURE_1_AND_MARK): Define.
Use AArch64 build attributes when __ARM_BUILDATTR64_FV is
available, otherwise emit a GNU property note.

44 hours agovect: Fix early break in PEELED cases [PR125804]
Tamar Christina [Wed, 17 Jun 2026 11:09:22 +0000 (12:09 +0100)] 
vect: Fix early break in PEELED cases [PR125804]

When a loop is LOOP_VINFO_EARLY_BREAKS_VECT_PEELED && ! LOOP_VINFO_EARLY_BRK_NEEDS_EPILOG
then we still need the epilog loop for the main latch edge.

The early exits themselves when LOOP_VINFO_EARLY_BRK_NEEDS_EPILOG don't need to
go to scalar code.

Allowing bound_epilog to still be set to VF when
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED we get to the desired effect that the early
exits do not require an epilog when !LOOP_VINFO_EARLY_BRK_NEEDS_EPILOG but
the main edge still does if LOOP_VINFO_EARLY_BREAKS_VECT_PEELED.

gcc/ChangeLog:

PR tree-optimization/125804
* tree-vect-loop-manip.cc (vect_do_peeling): Have
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED require epilog.

gcc/testsuite/ChangeLog:

PR tree-optimization/125804
* gcc.dg/vect/vect-early-break_144-pr125804.c: New test.

45 hours agoFortran/OpenMP: Rename declare-mapper struct members
Tobias Burnus [Wed, 17 Jun 2026 10:16:55 +0000 (12:16 +0200)] 
Fortran/OpenMP: Rename declare-mapper struct members

The usm->mapper_id vs. usm->usm->mapper_id and
also the usm->usm itself was a bit confusing.

Hence, this is now:
  usm->requested_mapper_id
  usm->resolved_usm
where the latter has
  usm->resolved_usm->mapper_id

Hereby, usm->requested_mapper_id is set for a map/to/from
clause such as 'map(mapper(my_name), to: x' - while
the resolved_usm points to an object that has been
created by 'declare mapper'.

gcc/fortran/ChangeLog:

* gfortran.h (struct gfc_omp_udm): Add comment.
(struct gfc_omp_namelist_udm): Likewise; rename members
mapper_id to requested_mapper_id and usm to resolved_usm.
* module.cc (load_omp_udms, write_omp_udm): Update accordingly.
* openmp.cc (gfc_match_omp_clauses, resolve_omp_clauses): Likewise.
* trans-openmp.cc (gfc_trans_omp_clauses): Likewise.

46 hours agolto: Fix streaming of loop->can_be_parallel [PR125717]
Dhruv Chawla [Tue, 16 Jun 2026 12:05:39 +0000 (12:05 +0000)] 
lto: Fix streaming of loop->can_be_parallel [PR125717]

The can_be_parallel flag was not being streamed out, so any frontend
setting the flag (via annot_expr_parallel_kind) would not observe it doing
anything when LTO was enabled.

Bootstrapped and regtested on aarch64-linux-gnu.

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

PR fortran/125717
* lto-streamer-in.cc (input_cfg): Stream loop->can_be_parallel in.
* lto-streamer-out.cc (output_cfg): Stream loop->can_be_parallel out.

2 days agoOpenMP/Fortran: Improve 'declare reduction' diagnostic
Tobias Burnus [Wed, 17 Jun 2026 06:48:58 +0000 (08:48 +0200)] 
OpenMP/Fortran: Improve 'declare reduction' diagnostic

gcc/fortran/ChangeLog:

* openmp.cc (match_udr_expr, gfc_match_omp_declare_reduction,
gfc_resolve_omp_udr): Improve diagnostic.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/declare-reduction-2.f90: Update dg-error.
* gfortran.dg/gomp/udr1.f90: Likewise.
* gfortran.dg/gomp/udr2.f90: Likewise.
* gfortran.dg/gomp/udr3.f90: Likewise.
* gfortran.dg/gomp/udr4.f90: Likewise.
* gfortran.dg/gomp/declare-reduction-5.f90: New test.

2 days agoi386: Adjust c86-4g-m7 512-bit memory costs
Zhongjie Guo [Wed, 17 Jun 2026 03:29:15 +0000 (03:29 +0000)] 
i386: Adjust c86-4g-m7 512-bit memory costs

c86-4g-m7 is a split-regs AVX512 target.  A 512-bit memory
operation is implemented as two 256-bit halves, so the vectorizer cost
model should not make 512-bit loads and stores almost as cheap as
256-bit ones.

The old c86_4g_m7_cost values made 512-bit loads/stores cost 12/12,
close to or equal to the 256-bit 10/12 costs.  This can make 64-byte
vectorization win in the loop body cost comparison even when 32-byte
vectors avoid extra reduction epilogue work.

Set the 512-bit load/store and unaligned load/store costs to twice the
256-bit costs.  This removes the artificial 64-byte body-cost advantage;
for dot-product style reduction loops, the reduction epilogue cost can
then make 32-byte vectorization preferable.

Compared with gcc-trunk without this tuning, local SPEC2006/SPEC2017
testing shows improvements in several vector-width sensitive workloads.
SPEC2006 1-copy fp_speed improved by 2.32%, including 436.cactusADM
+12.39%, 433.milc +7.33%, and 459.GemsFDTD +4.76%.  SPEC2017 32-copy
fprate improved by 0.40%, with 526.blender_r improving by 2.80%.

gcc/ChangeLog:

* config/i386/x86-tune-costs.h (c86_4g_m7_cost): Increase
512-bit load/store and unaligned load/store costs.

gcc/testsuite/ChangeLog:

* gcc.target/i386/c86-4g-m7-vect-load-cost-reduc.c: New test.

Signed-off-by: Zhongjie Guo <guozhongjie@hygon.cn>
2 days agoi386: Fix some c86-4g-m7 reservations
Xin Liu [Wed, 17 Jun 2026 03:28:39 +0000 (03:28 +0000)] 
i386: Fix some c86-4g-m7 reservations

Fix several existing c86-4g-m7 scheduling reservation issues.

The fixes correct decode unit selection, branch and call execution units,
missing store resources for store or load/store forms, and several FPU
pipeline resource descriptions.  They also rename a few reservations so the
template names better match the instructions they cover, and simplify
duplicate memory attribute checks.

gcc/ChangeLog:

* config/i386/c86-4g-m7.md (c86_4g_m7_imov_xchg): Adjust
reservation units.
(c86_4g_m7_imov_xchg_load): Ditto.
(c86_4g_m7_call): Ditto.
(c86_4g_m7_branch): Ditto.
(c86_4g_m7_branch_load): Ditto.
(c86_4g_m7_fp_spc_direct): Add missing store unit.
(c86_4g_m7_sse_pinsr_reg): Adjust reservation units.
(c86_4g_m7_avx512_insertx_ymm): Ditto.
(c86_4g_m7_avx512_insertx_ymem): Ditto.
(c86_4g_m7_avx512_insertx_zxmm): Ditto.
(c86_4g_m7_avx512_insertx_zxmem): Ditto.
(c86_4g_m7_avx512_abs_load): Add missing store unit.
(c86_4g_m7_avx_sign): Use combined FPU reservation.
(c86_4g_m7_avx_sign_load): Ditto.
(c86_4g_m7_avx_aes): Ditto.
(c86_4g_m7_avx_aes_load): Ditto.
(c86_4g_m7_extr_load): Rename to ...
(c86_4g_m7_extr_store): ... this and restrict to store memory.
(c86_4g_m7_avx_imul): Use combined FPU reservation.
(c86_4g_m7_avx_imul_mem): Ditto.
(c86_4g_m7_avx512_vpmovx_y_load): Add missing store unit.
(c86_4g_m7_avx_vpmovx_xx_load): Ditto.
(c86_4g_m7_avx512_sseadd_maxmin_xy): Rename to ...
(c86_4g_m7_avx512_sseadd_maxmin): ... this and simplify
memory attribute check.
(c86_4g_m7_avx512_sseadd_maxmin_xy_load): Rename to ...
(c86_4g_m7_avx512_sseadd_maxmin_load): ... this and simplify
memory attribute check.
(c86_4g_m7_avx512_sseadd_xy): Rename to ...
(c86_4g_m7_avx512_sseadd): ... this.
(c86_4g_m7_avx512_sseadd_xy_load): Rename to ...
(c86_4g_m7_avx512_sseadd_load): ... this.
(c86_4g_m7_sse_sseiadd_sadbw): Use combined FPU reservation.
(c86_4g_m7_sse_sseiadd_sadbw_mem): Ditto.
(c86_4g_m7_avx512_ssecmp_vp_z): Adjust reservation units.
(c86_4g_m7_avx512_ssecmp_vp_z_load): Ditto.
(c86_4g_m7_avx512_ssecmp_test_load): Ditto.
(c86_4g_m7_avx512_mskmov_k_m): Adjust latency.

Signed-off-by: Xin Liu <liulxx@hygon.cn>
2 days ago[PATCH] RISC-V: Fix more scalar mode_idx instances [PR125478].
Robin Dapp [Wed, 17 Jun 2026 04:40:34 +0000 (22:40 -0600)] 
[PATCH] RISC-V: Fix more scalar mode_idx instances [PR125478].

Hi,

This is another case of PR123022 and PR116149 where we query a scalar source
operand instead of a vector operand, leading to a wrong AVL during avlprop.

This patch moves viwalu, vfwalu, viwmul, and vfwmul to the proper
bucket.  I wonder why I didn't do that the last two times but it seems
to be the correct choice now 🙂

Regtested on rv64gcv_zvl512b and waiting for the CI.

Regards
 Robin

PR target/125478

gcc/ChangeLog:

* config/riscv/vector.md: Set widen-alu mode_idx to 3.

gcc/testsuite/ChangeLog:

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

2 days agoRevert "RISC-V: Run smart multilib match even when generic matcher picked a dir"
Jeff Law [Wed, 17 Jun 2026 03:25:03 +0000 (21:25 -0600)] 
Revert "RISC-V: Run smart multilib match even when generic matcher picked a dir"

This reverts commit 6dbcda7f978ce7fba81e81971911d00b2d1ccab0.

2 days agoc++: Update get_cxx_dialect_name for cxx29
H.J. Lu [Wed, 17 Jun 2026 03:23:14 +0000 (11:23 +0800)] 
c++: Update get_cxx_dialect_name for cxx29

Update get_cxx_dialect_name to handle cxx29 added by

commit 0c5c6249a2e9a75d2e7d1c6c434487c8dc077130
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jun 16 22:24:57 2026 +0200

    c++, libcpp: Add -std=c++2[9d] and -std=gnu++2[9d] options

PR c++/125851
* name-lookup.cc (get_cxx_dialect_name): Handle cxx29.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 days ago[committed][RISC-V] Tighten and xfail test for pr120811
Jeff Law [Wed, 17 Jun 2026 02:34:49 +0000 (20:34 -0600)] 
[committed][RISC-V] Tighten and xfail test for pr120811

So the test for pr120811 has actually been failing for several months, but the
scan-asm regexp was too general in what it accepted and as a result we weren't
aware it was failing.  What's a bit weird, is it looks like post-reload combine
just never tries the relevant insns, though it does look like a viable
post-reload combine opportunity.

Then changes in the last day or so scrambled the output even more to the point
where the faulty scan-asm wouldn't match and the regression has come to light.

This adds the missing escapes to the scan-asm.  I've confirmed it works with
the old (desired) code generation and it fails with the change from a couple
months ago which seems to be preventing the post-reload combine.  It xfails the
test as well.

I'll get a bug opened to track the performance regression.

gcc/testsuite
* gcc.target/riscv/pr120811.c: Add missing escapes and xfail.

2 days agoPointer global ranges of nonzero are no longer invariant.
Andrew MacLeod [Thu, 11 Jun 2026 17:16:13 +0000 (13:16 -0400)] 
Pointer global ranges of nonzero are no longer invariant.

TO preserve processing, the cache did not track pointer ranges any more
once it was set to non-zero.  With prange now tracking pointers, any
conditional may provide points-to info to a nonzero range, so we
must track these values now.

* gimple-range-cache.cc (ranger_cache::set_global_range): Nonzero
pointer ranges are no longer invariant.

2 days agoRemove value-pointer-equiv code.
Andrew MacLeod [Mon, 8 Jun 2026 16:35:08 +0000 (12:35 -0400)] 
Remove value-pointer-equiv code.

The side table is no longer used, remove the code.

* Makefile.in (OBJS): Remove value-pointer-equiv.o.
* tree-vrp.cc (rvrp_folder::m_pta): Delete member.
(rvrp_folder::rvrp_folder): Remove m_pta allocation.
(rvrp_folder::~rvrp_folder): Delete.
(rvrp_folder::pre_fold_bb): Remove m_pta reference.
(rvrp_folder::post_fold_bb): Delete.
(rvrp_folder::pre_fold_stmt): Remove m_pta reference.
* value-pointer-equiv.cc: Delete.
* value-pointer-equiv.h: Delete.

2 days agoSwitch VRP to use prange.
Andrew MacLeod [Mon, 1 Jun 2026 18:28:33 +0000 (14:28 -0400)] 
Switch VRP to use prange.

Use the points-to info in prange instead olf the value-range-equiv side
table in VRP.  Adjust testcases:
 - PTA causes less mem*_chk routines to be generated.
 - Gimple fold is causing issues by not properly handling pointer_plus.
   See PR 123160.   XFAILing until resolved.
 - Adding noipa prevents VRP from propagating IPA info causing a failure.

gcc/
* tree-vrp.cc (rvrp_folder::value_of_expr): Use prange PTA info.
(value_on_edge): Likewise.

gcc/testsuite/
* gcc.c-torture/execute/builtins/memcpy-chk.c: Adjust.
* gcc.c-torture/execute/builtins/memmove-chk.c: Adjust.
* gcc.dg/builtin-object-size-4.c: XFAIL until pr123160 is fixed.
* gcc.dg/builtin-dynamic-object-size-4.c: Likewise.
* gcc.misc-tests/gcov-14.c: Add noipa.

2 days agoPoints-to functionality for prange.
Andrew MacLeod [Wed, 10 Jun 2026 17:42:27 +0000 (13:42 -0400)] 
Points-to functionality for prange.

Add basic invariant points-to functionality to prange.
Use tree affine for base and offset info
Adjust various range-ops to support points-to.

/gcc
* gimple-range-fold.cc (x_fold_context): New.
(pta_valueize): New.
(fold_using_range::fold_stmt): Set PTA fields.
(fold_using_range::range_of_phi): Ditto.
* ipa-prop.cc (ipa_vr::ipa_vr): Allocate unshared range.
* range-op-ptr.cc (pointer_plus_operator::fold_range): Handle PTA.
(pointer_plus_operator::op2_range): Ditto.
(operator_pointer_diff::fold_range): Ditto.
(operator_cast::fold_range): Ditto.
(operator_cast::lhs_op1_relation): Ditto.
(operator_equal::fold_range): Ditto.
(operator_not_equal::fold_range): Ditto.
* value-query.cc (range_query::get_tree_range): Ditto.
* value-range-pretty-print.cc (vrange_printer::print_pt): New.
(vrange_printer::visit): Add print support.
* value-range-pretty-print.h (vrange_printer::print_pt): New prototype.
* value-range-storage.cc (vrange_allocator::clone): Allow unshared
expression allocation.
(vrange_storage::alloc): Likewise.
(prange_storage::alloc): Likewise.
(prange_storage::prange_format): Copy PTA.
(prange_storage::set_prange): Ditto.
(prange_storage::get_prange): Ditto.
(prange_storage::equal_p): Compare points-to data.
(ggc_alloc_vrange_storage): Allow unshared expression.
* value-range-storage.h (clone): Adjust param list.
(prange_storage::m_pt, m_points_to_p): New.
* value-range.cc (inchash::add_vrange): Add points-to to hash value.
(prange::set_pt): New.
(prange::pt_base): New.
(prange::pt_offset): New.
(prange::pt_size): New.
(prange::set): Initialize PTA field.
(prange::union_): Handle PTA cases.
(prange::intersect): Ditto.
(prange::operator=): Ditto.
(prange::operator==): Ditto.
(prange::invert): Handle PTA cases.
(prange::verify_range): Ditto.
* value-range.h (set_pt, set_pt_unknown, pt_unknown_p,
pt_invariant, pt_invariant_away, pt_invariant_p, pt_invariant_away_p,
pt_invert, pt_inverted_p, pt_base, pt_offset, pt_size,
pt_equal_p): New prange prototypes.
(prange::m_pt, prange::m_points_to_p): New members.
(prange::set_undefined): Clear PTA fields.
(prange::set_varying): Ditto.
(prange::set_nonzero): Ditto.
(prange::set_zero): Ditto.
(prange::zero_p): Check PTA fields.
(varying_compatible_p): Ditto.
(prange::set_pt): New.
(prange::set_pt_unknown): New.
(prange::pt_unknown_p): New.
(prange::pt_equal_p): New prange prototypes.
(prange::pt_inverted_p): New.
(prange::pt_invert): New.
(prange::pt_invariant): New.
(prange::pt_invariant_away): New.
(prange::pt_invariant_p): New.
(prange::pt_invariant_away_p): New.

gcc/testsuite/
* gcc.dg/Wreturn-local-addr-9.c: Remove xfail.
* gcc.c-torture/execute/builtins/strncat-chk.c: Adjust for new
prange points_to capabilities.

2 days agoDaily bump.
GCC Administrator [Wed, 17 Jun 2026 00:16:32 +0000 (00:16 +0000)] 
Daily bump.

2 days agotestsuite, x86, Darwin: Amend fabsneg-2.c for Mach-O.
Iain Sandoe [Tue, 16 Jun 2026 13:24:36 +0000 (14:24 +0100)] 
testsuite, x86, Darwin: Amend fabsneg-2.c for Mach-O.

The new test fails on Darwin because constant labels may also be
introduced with 'lC' where we require them to be linker-visible.

gcc/testsuite/ChangeLog:

* gcc.target/i386/fabsneg-2.c: Allow for lC* in Mach-O.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2 days agoa68: fix deduplication of in-MOIF modes
Jose E. Marchesi [Tue, 16 Jun 2026 20:52:14 +0000 (22:52 +0200)] 
a68: fix deduplication of in-MOIF modes

Of course I got the in-MOIF deduplication of modes wrong due to a
stupid thinko.  This patch fixes the thinko and also adds a little
extra sanity check.

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

* a68-imports.cc (a68_replace_equivalent_mode): Get a moif and
check extracts.
(a68_open_packet): Fix deduplication of in-moif modes and move
extract replacement code to a68_replace_equivalent_mode.
* a68-low-moids.cc (a68_lower_moids): Check that all known modes
have an associated ctype as part of the sanity checks.

2 days agoSSP: Check UINTPTR_TYPE to get uintptr_t type
H.J. Lu [Fri, 8 May 2026 04:20:02 +0000 (12:20 +0800)] 
SSP: Check UINTPTR_TYPE to get uintptr_t type

default_stack_protect_guard calls

  lang_hooks.types.type_for_mode (ptr_mode, 1);

to get an integer type for __stack_chk_guard which is declared as a
global symbol of type uintptr_t.  For 32-bit systems, uintptr_t may
be either unsigned int or unsigned long int.  On 32-bit Darwin, we get

$ cat /tmp/x.c
__UINTPTR_TYPE__ __stack_chk_guard = 0x1000;
$ ./xgcc -B./ -S /tmp/x.c -m32
/tmp/x.c:1:18: error: conflicting types for ‘__stack_chk_guard’; have ‘long unsigned int’
    1 | __UINTPTR_TYPE__ __stack_chk_guard = 0x1000;
      |                  ^~~~~~~~~~~~~~~~~
cc1: note: previous declaration of ‘__stack_chk_guard’ with type ‘unsigned int’
$

since lang_hooks.types.type_for_mode returns unsigned int while Darwin's
uintptr_t is unsigned long int.  Update default_stack_protect_guard to
call unsigned_integer_tree_node_for_type with UINTPTR_TYPE to get unsigned
integer type for uintptr_t instead.

gcc/

PR c/125226
* targhooks.cc (default_stack_protect_guard): If UINTPTR_TYPE
isn't NULL, call unsigned_integer_tree_node_for_type with
UINTPTR_TYPE to get unsigned integer type for uintptr_t.
* tree.cc (unsigned_integer_tree_node_for_type): New function.
(build_common_tree_nodes): Call unsigned_integer_tree_node with
SIZE_TYPE to get unsigned integer type for size_t.
* tree.h (unsigned_integer_tree_node_for_type): New prototype.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 days agocobol: Simplify tree type determination; eliminate file-static variables.
Robert Dubner [Tue, 16 Jun 2026 18:26:24 +0000 (14:26 -0400)] 
cobol: Simplify tree type determination; eliminate file-static variables.

Use tree_type_from_field() and tree_type_from_refer() to replace a number
of similar routines.  Replace a number of specific file-static
variable definitions with non-specific variable definitions.

Repair calculation of DIVIDE ... GIVING REMAINDER where parameters are
negative.

gcc/cobol/ChangeLog:

* compare.cc (numeric_alpha_compare): Use tree_type_from_refer().
* genapi.cc (file_static_variable): Eliminate function.
(psa_FldLiteralN): Use tree_type_from_field.
(parser_accept_command_line): Eliminate file-static variables.
(parser_accept_envar): Likewise.
(parser_assign): Likewise.
(parser_initialize_table): Likewise.
(parser_see_stop_run): Likewise.
(parser_file_write): Likewise.
(parser_file_start): Likewise.
(inspect_tally): Likewise.
(inspect_replacing): Likewise.
(field_increment): Likewise.
(parser_match_exception): Likewise.
* genapi.h (file_static_variable): Eliminate function.
* genmath.cc (largest_binary_term): Use tree_type_from_refer().
(fast_add):  Likewise.
(fast_subtract): Likewise.
(fast_multiply): Likewise.
(fast_divide): Likewise.
(parser_divide): Likewise.
* genutil.cc (tree_type_from_digits): Eliminate function.
(get_integer_value): Eliminate file-static variables.
(get_data_offset): Eliminate file-static variables.
(get_binary_value_tree): Eliminate file-static variables.
(tree_type_from_field): Updated function.
(tree_type_from_refer): New function.
(scale_by_power_of_ten): Eliminate file-static variables.
(tree_type_from_size): Eliminate function.
(copy_little_endian_into_place): Improve logic.
(build_array_of_size_t): Eliminate file-static variables.
(refer_refmod_length): Likewise.
(refer_fill_depends): Likewise.
(refer_size): Likewise.
(refer_size_source): Likewise.
* genutil.h (tree_type_from_digits): Eliminate function.
(tree_type_from_size): Eliminate function.
(tree_type_from_refer): New function.
* lang.opt: Updated documentation.
* lang.opt.urls: Updated documentation.
* move.cc (digits_to_bytes): Eliminate function.
(get_bytes_needed): Likewise.
(mh_source_is_literalN): Eliminate file-static variables; use
tree_type_from_refer().
(mh_numeric_display): Likewise.
(mh_little_endian): tree_type_from_refer().
(mh_numdisp_to_packed): Use get_location() function.
(mh_packed_to_packed): Likewise.
(mh_packed_to_numdisp): Likewise.
(move_helper): Likewise.

libgcobol/ChangeLog:

* gmath.cc (multiply_int256_by_int64): Comment.
(int256_as_decimal): Handle negative values.
(__gg__dividef45): Repair remainder logic when numeric-display
parameters are negative.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/DIVIDE_binary-long_giving_remainder.cob: New test.
* cobol.dg/group2/DIVIDE_binary-long_giving_remainder.out: New test.
* cobol.dg/group2/DIVIDE_numeric-display_giving_remainder.cob: New test.
* cobol.dg/group2/DIVIDE_numeric-display_giving_remainder.out: New test.
* cobol.dg/group2/GCC_125616_RT3601_-_IBM_incorrect_DISPLAY_of_COMP-1_COMP-2_float.cob:
New test.
* cobol.dg/group2/PR39_RT3573_-_Parser_issue_w_concat._source_lines.cob: New test.

2 days agoc++, libcpp: Add -std=c++2[9d] and -std=gnu++2[9d] options
Jakub Jelinek [Tue, 16 Jun 2026 20:24:57 +0000 (22:24 +0200)] 
c++, libcpp: Add -std=c++2[9d] and -std=gnu++2[9d] options

The following patch adds a new -std= option arguments for C++29 and
changes __cplusplus value for C++26 from 202400L to 202603L.

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

gcc/
* doc/invoke.texi (-std=c++2d, -std=c++29, -std=gnu++2d,
-std=gnu++29): Document.
(-std=c++2c, -std=c++26, -std=gnu++2c, -std=gnu++26): Tweak so that
26 comes first and is meant as the supported option.
* doc/cpp.texi: Adjust expected __cplusplus value for -std=c++26,
document value for -std=c++29.
* dwarf2out.cc (highest_c_language): Handle C++29.
(gen_compile_unit_die): Likewise.  Adjust lversion for C++26.
gcc/c-family/
* c-common.h (enum cxx_dialect): Add cxx29.
* c-opts.cc (set_std_cxx29): New function.
(c_common_handle_option): Handle -std=c++2d, -std=c++29, -std=gnu++2d
and -std=gnu++29.
* c.opt (std=c++2d, std=c++29, std=gnu++2d, std=gnu++29): New.
(std=c++2c, std=c++26, std=gnu++2c, std=gnu++26): Move Undocumented
to the 2c cases, tweak description.
gcc/testsuite/
* g++.dg/cpp26/cplusplus.C: Expect __cplusplus == 202603L.
* g++.dg/cpp29/cplusplus.C: New test.
* g++.dg/cpp29/feat-cxx29.C: New test.
* lib/target-supports.exp (check_effective_target_c++26): Also
true for C++29.
(check_effective_target_c++26_down, check_effective_target_c++29_only,
check_effective_target_c++29): New procedures.
* lib/g++-dg.exp (g++-std-flags): Replace 26 with 29 in the list
and add 26 to the end.
libcpp/
* include/cpplib.h (enum c_lang): Add CLK_GNUCXX29 and CLK_CXX29.
* init.cc (lang_defaults): Add CLK_GNUCXX29 and CLK_CXX29 row.
(cpp_init_builtins): Change __cplusplus value for C++26 from 202400L
to 202603L and set __cplusplus value for C++29 to 202700L.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days ago cobol: Use cdf namespace in CDF Bison parser output.
James K. Lowden [Tue, 16 Jun 2026 15:15:46 +0000 (11:15 -0400)] 
cobol: Use cdf namespace in CDF Bison parser output.

Fixes PR 119215 LTO error by removing enumerated types and other
names from the global namespace, and by deleting use of YYLTYPE. A
single location type cbl_loc_t is used by both parsers.

Also fixes PR 122466 using conditional compilation for non-POSIX
symbols.

Require Bison 3.8.2 for C++ output.  The generated C++ uses
iostreams to format error messages.  The cdf.y file includes the
iostream header and does not use any GCC header files.

gcc/cobol/ChangeLog:

* Make-lang.in: Report Bison version.
* cbldiag.h (defined): Define possibly missing macros.
(ATTRIBUTE_GCOBOL_DIAG): Define if missing.
(ATTRIBUTE_PRINTF_1): Same.
(ATTRIBUTE_PRINTF_3): Same.
(yyerror): Remove.
(struct YYLTYPE): Remove.
(enum cbl_gcobol_feature_t): Relocate from symbols.h.
(YYLTYPE_IS_DECLARED): Remove.
(YYLTYPE_IS_TRIVIAL): Remove.
(cobol_location): Relocate.
(cobol_gcobol_feature_set): Declare.
(struct YDFLTYPE): Remove.
(enum cbl_call_convention_t): Relocate from symbols.h.
(YDFLTYPE_IS_DECLARED): Remove.
(YDFLTYPE_IS_TRIVIAL): Remove.
(current_call_convention): Declare.
(cdf_push): Declare.
(cdf_push_call_convention): Declare.
(cdf_push_current_tokens): Declare.
(cdf_push_dictionary): Declare.
(cdf_push_enabled_exceptions): Declare.
(cdf_push_source_format): Declare.
(cdf_pop): Declare.
(cdf_pop_call_convention): Declare.
(cdf_pop_current_tokens): Declare.
(cdf_pop_dictionary): Declare.
(cdf_pop_source_format): Declare.
(cdf_pop_enabled_exceptions): Declare.
(current_program_index): Declare.
(struct cbl_loc_t): Derive from cbl_loc_base_t.
(struct cbl_loc_base_t): Define.
(cbl_err): Declare.
(cbl_errx): Declare.
(error_msg): Use cbl_loc_t.
(warn_msg): Same.
(cbl_unimplemented_at): Same.
(gcc_location_set): Same.
* cdf.y: Require Bison 3.8.2 and generate C++ in cdf namespace.
* cdfval.h (struct YDFLTYPE): Remove.
(struct cbl_loc_t): Forward declaration.
(struct cdfval_base_t): User-defined conversion from derived.
* copybook.h (gcc_assert): Use assert(3) within cdf.y.
(gcc_unreachable): Declare within cdf.y.
(class copybook_elem_t): Use cbl_loc_t.
(CTOUPPER): Use toupper(3) in uppername_t helper.
(TOUPPER): Same.
(class copybook_t): Use cbl_loc_t.
* exceptg.h (struct cbl_label_t): Declare cbl_label_t.
* gcobc: Support -fno-ec.
* gcobol.1: Reword -fsyntax-only slightly.
* genapi.cc (parser_label_label): Use cobol_location().
* lang.opt: Add comment in re lang.opt.urls.
* lexio.cc (struct replacing_term_t): Use cbl_loc_t.
(location_in): Same.
(parse_copy_directive): Same.
* lexio.h (struct filespan_t): Same.
* messages.cc (cbl_message): Same.
* parse.y: Same, and propagate location variously.
* parse_ante.h (current_data_section_set): Use cbl_loc_t.
(namcpy): Same.
(reject_refmod): Same.
(require_pointer): Same.
(require_integer): Same.
(ast_op): Same.
(perform_tgt_set): Same.
(label_add): Same.
(paragraph_reference): Same.
(tee_up_name): Same.
(ast_inspect): Same.
(ast_enter_section): Same.
(ast_enter_paragraph): Same.
(prototype_add): Same.
(verify_args): Same.
(subscript_dimension_error): Same.
(literal_subscripts_valid): Same.
(literal_refmod_valid): Same.
(struct cbl_fieldloc_t): Remove.
(intrinsic_call_1): Use cbl_loc_t.
(symbol_find): Same.
(valid_redefine): Same.
(field_add): Same.
(field_type_update): Same.
(field_capacity_error): Same.
(field_alloc): Same.
(file_add): Same.
(alphabet_add): Same.
(set_real_from_capacity): Same.
(procedure_division_ready): Same.
(file_section_fd_set): Same.
(ast_call): Same.
(field_binary_usage): Same.
(ast_end_program): Same.
(cobol_location): Same.
(location_set): Same.
(statement_begin): Same.
(ast_first_statement): Same.
* scan.l: Qualify tokens with new cdf namespace.
* scan_ante.h (ydfparse): Now static.
(cdf_context): Declare.
(ydfltype_of): Remove.
(update_location): Use cbl_loc_t.
(reset_location): Same.
(YY_USER_INIT): Same.
(class picture_t): Same.
* scan_post.h (ydfparse): Wrapper for cdf_parser::parse() method.
(ydfchar): Lookahead helper.
(ydfdebug): Same.
(run_cdf): Clearer debug messages.
(struct pending_token_t): Renamed to recent_token_t.
(struct recent_token_t): As above.
(PENDING): Renames to RECENT.
(RECENT): As above.
(next_token): Removed.
(recent_tokens_t): Capture abandoned lookahead tokens.
(prelex): Use recent_tokens queue.
(yylex): Drop normal parsing idea.
* symbols.cc (symbol_field_location): Use cbl_loc_t.
(symbol_alphabet): Same.
(cbl_alphabet_t::cbl_alphabet_t): Same.
(cbl_alphabet_t::assign): Same.
(cbl_alphabet_t::also): Same.
(symbol_temporary_location): Same.
(cbl_field_t::encode): Same.
* symbols.h (enum cbl_gcobol_feature_t): Remove.
(cobol_gcobol_feature_set): Remove.
(struct cbl_field_t): Use cbl_loc_t.
(struct cbl_refer_t): Same.
(struct cbl_alphabet_t): Same.
(struct cbl_perform_tgt_t): Same.
(struct cbl_nameloc_t): Same.
(class name_queue_t): Same.
(tee_up_name): Same.
(symbol_field_location): Same.
(enum cbl_call_convention_t): Remove
(class current_tokens_t):  Use cbl_loc_t.
(current_call_convention): Same.
(gcc_location_set): Same.
* util.cc (class cdf_directives_t): Use cbl_loc_t.
(cdf_unreachable): Define as gcc_unreachable.
(cdf_literalize): Do not handle location.
(cdf_file): New function.
(cdf_file_index): Same.
(cdf_file_name): Same.
(cdf_add_field): Same.
(cbl_field_t::encode_numeric): Remove unused parameter.
(cbl_field_t::report_invalid_initial_value): Use cbl_loc_t.
(match_proc): Namespace for local prototype-verification functions.
(DUMP_PROCEDURE_CALLS): Guard macro for debug function.
(procedure_calls_dump): New function to show uses of PERFORM.
(gcc_location_set_impl): Use cbl_loc_t.
(gcc_location_set): Same.
(class temp_loc_t): Same.
(error_msg): Same.
(warn_msg): Same.
(ydfdebug): Same.
(cobol_set_debugging): Same.
(cbl_unimplemented_at): Same.
* util.h (cbl_err): Remove declaration.
(cbl_errx): Same.
(cdf_push): Same.
(cdf_push_call_convention): Same.
(cdf_push_current_tokens): Same.
(cdf_push_dictionary): Same.
(cdf_push_enabled_exceptions): Same.
(cdf_push_source_format): Same.
(cdf_pop): Same.
(cdf_pop_call_convention): Same.
(cdf_pop_current_tokens): Same.
(cdf_pop_dictionary): Same.
(cdf_pop_source_format): Same.
(cdf_pop_enabled_exceptions): Same.

libgcobol/ChangeLog:

* posix/shim/open.cc (defined): Honor _GNU_SOURCE and _POSIX_C_SOURCE.

2 days agoc++: bogus error with meta::members_of [PR125770]
Marek Polacek [Fri, 12 Jun 2026 19:46:10 +0000 (15:46 -0400)] 
c++: bogus error with meta::members_of [PR125770]

mark_used produces the
use of built-in parameter pack '__integer_pack' outside of a template
error even when called with tf_none (in this case, from
resolve_type_of_reflected_decl).

I played with the idea of skipping all fndecl_built_in_p functions
in resolve_type_of_reflected_decl but it doesn't seem to make any
reasonable difference on compile time.

PR c++/125770

gcc/cp/ChangeLog:

* decl2.cc (mark_used): Check complain & tf_error before giving
an error.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoc++: ICE in tsubst_expr with comma expr [PR125539]
Marek Polacek [Mon, 1 Jun 2026 21:32:38 +0000 (17:32 -0400)] 
c++: ICE in tsubst_expr with comma expr [PR125539]

Here we crash because a TARGET_EXPR gets into tsubst_expr with something
like:

  template<typename>
  constexpr static A a = (A{}, A{});

Pre r14-4796, when we had tsubst_copy, we didn't crash because we had
an early exit when substituting with args=NULL_TREE.  tsubst_expr
deliberately doesn't have that early exit.

Note that

  template<typename>
  constexpr static A a = A{};

works because expand_aggr_init_1 sees a COMPOUND_LITERAL_P and does the
early exit without calling expand_default_init.  But with a COMPOUND_EXPR
we don't take that path.

The TARGET_EXPR is created via check_initializer -> build_aggr_init_full_exprs
-> build_aggr_init -> expand_aggr_init_1 -> expand_default_init -> ocp_convert
-> build_cplus_new -> build_target_expr.  I tried adjusting the big
and ugly check in check_initializer before build_aggr_init_full_exprs
but that didn't work out.  I also tried avoiding the call to ocp_convert
but that broke some reflection tests.

We can fix this by calling perform_implicit_conversion in a template to
create an IMPLICIT_CONV_EXPR, then build_cplus_new won't create a TARGET_EXPR.

PR c++/125539

gcc/cp/ChangeLog:

* cvt.cc (ocp_convert): In a template, always call
perform_implicit_conversion.  Pass flags to
perform_implicit_conversion_flags.
* decl.cc (check_initializer): Remove a call to
build_implicit_conv_flags.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/var-templ89.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days ago[PATCH] vect: Fix gather supported vectype [PR125516].Hi,
Robin Dapp [Tue, 16 Jun 2026 13:47:13 +0000 (07:47 -0600)] 
[PATCH] vect: Fix gather supported vectype [PR125516].Hi,

This patch fixes a mistake in gather/scatter discovery.  In the third
"phase" we check for a larger offset type for the needed scaling but
fail to let the vectorizer know it.  The patch just sets
supported_offset_vectype and also skips costing an instruction in case
the necessary conversion is a nop.

Bootstrapped and regtested on x86, power10, and aarch64.
Regtested on riscv64.

Regards
 Robin

PR tree-optimization/125516

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_gather_scatter_fn_p): Set
supported_offset_vectype.
* tree-vect-stmts.cc (vectorizable_store): Skip nop conversions
when costing scatters.
(vectorizable_load): Ditto for gathers.

gcc/testsuite/ChangeLog:

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

2 days ago[PATCH] tree-optimization: Query ranger on edge for niter bound expressions
Abhishek Kaushik [Tue, 16 Jun 2026 13:43:50 +0000 (07:43 -0600)] 
[PATCH] tree-optimization: Query ranger on edge for niter bound expressions

determine_value_range only queried ranger when VAR was an SSA_NAME.
However, number_of_iterations_exit_assumptions calls
expand_simple_operations on the IV bases before asking for the range.
This can expose simple GENERIC expressions, including conversions, even
when the original value had an SSA_NAME with useful range information.

Ranger can analyze such expressions at a program point or edge, so query
it for integral bound expressions on the loop preheader edge rather than
restricting the query to SSA_NAMEs.  This lets niter analysis recover the
narrower range for value-preserving conversions such as uint8_t to int,
while still handling non-value-preserving conversions and wrapping
expressions conservatively.

The new test covers a direct converted uint8_t bound, a masked uint16_t
bound whose useful range comes from ranger, a guarded uint16_t bound
whose range is context-sensitive, a non-value-preserving uint8_t to
int8_t conversion, and a wrapping unsigned expression.

Bootstrapped and regression tested on aarch64-unknown-linux-gnu.

gcc/ChangeLog:

* tree-ssa-loop-niter.cc (determine_value_range): Query ranger
for integral expressions, not only SSA_NAMEs.  Query ranges on the
loop preheader edge.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve2/niter-convert-range.c: New test.

2 days agovect: consult the alias oracle for unanalyzable BB SLP dependences
Kyrylo Tkachov [Tue, 16 Jun 2026 10:16:42 +0000 (12:16 +0200)] 
vect: consult the alias oracle for unanalyzable BB SLP dependences

vect_slp_analyze_data_ref_dependence conservatively reported a dependence
whenever the classical (affine) data-dependence test returned chrec_dont_know,
e.g. when one of the accesses has a non-affine or runtime array subscript.  In
the BB SLP region check this is overly pessimistic: the unanalyzable subscript
says nothing about whether the two references can actually alias, and the alias
oracle can frequently still prove they cannot (distinct restrict parameters,
distinct non-escaping objects, and so on).  When that happens a perfectly good
SLP group is torn down.  The motivating case is the deal.II
VectorizedArray<double,N> reciprocal in SPEC CPU 2026 766.femflow_r.

The store-sink and load-hoist walkers already fall back to the alias oracle
(stmt_may_clobber_ref_p_1 / ref_maybe_used_by_stmt_p) for statements that have
no single recorded data reference.  Extend that fallback to the chrec_dont_know
case: vect_slp_analyze_data_ref_dependence now returns a three-way result
(chrec_known when the references are provably independent, chrec_dont_know when
the affine test cannot analyze them, and the dependence otherwise) so each
caller can tell "unknown" apart from "dependent", and on "unknown" runs the same
oracle query it already uses for the no-data-reference case, with the TBAA
setting appropriate to what is being moved: no TBAA when sinking a store (a
moving store may change the dynamic type), TBAA when hoisting a load.

On the new gcc.dg/vect/bb-slp-dep-oracle.c the 8-lane reciprocal group is torn
down and emitted scalar without the patch and vectorizes to four vector
divides with it.

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

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

* tree-vect-data-refs.cc (vect_slp_analyze_data_ref_dependence):
Return a three-way tree result (chrec_known when independent,
chrec_dont_know when the affine test cannot analyze the pair, the
dependence otherwise) instead of a bool.
(vect_slp_analyze_store_dependences): Resort to the alias oracle on
an unknown dependence as well as on a missing data reference; a
store is being moved so do not use TBAA.
(vect_slp_analyze_load_dependences): Likewise on the load-hoist
paths, using TBAA as a load is being hoisted; also record that the
ao_ref has been initialized in check_hoist.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-dep-oracle.c: New test.

2 days ago[PATCH] RISC-V: Fix splitter [PR125670].
Robin Dapp [Tue, 16 Jun 2026 12:54:48 +0000 (06:54 -0600)] 
[PATCH] RISC-V: Fix splitter [PR125670].

Hi,

In the PR we ICE during vsetvl, expecting a register in the VL operand
slot which only contains an immediate 4.  Non-VLMAX insns with immediate
length have a NULL_RTX in that slot.

However, during a split, we erroneously use operand[5] instead of
operand[6].  operand[5] is the mask policy and happened to be "1".
"1" indicates a VLMAX insn in the avl_type operand.  This caused the
wrong turn in vsetvl.

The patch just corrects the operand number.

Regtested on rv64gcv_zvl512b.  Going to wait for the CI.

Regards
 Robin

PR target/125670

gcc/ChangeLog:

* config/riscv/autovec-opt.md: Use avl_type operand number.

gcc/testsuite/ChangeLog:

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

2 days agotestsuite: Limit shared memory use of coarray tests [PR125584]
Rainer Orth [Tue, 16 Jun 2026 12:04:04 +0000 (14:04 +0200)] 
testsuite: Limit shared memory use of coarray tests [PR125584]

As discussed in PR testsuite/125584, the gfortran.dg/coarray tests with
-lcaf_shmem require excessive amounts of backing store for their shared
memory images: for 64-bit tests, each test uses 4 GB images.

On Solaris, the mapped files reside in /tmp/.LIBRT/SHM, which is tmpfs.
During parallel testing, several such tests can run in parallel, leading
to excessive VM use, in particular on targets like Solaris that don't
use lazy allocation.  This is unacceptable since the testsuite defaults
need to be safe for all targets.

The tests PASS just fine when limiting GFORTRAN_SHARED_MEMORY_SIZE to 2M
instead.  To allow for testing with either the default or a different
size, setting GCC_TEST_RUN_EXPENSIVE to a non-empty string allows to
override this.

Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu.

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

gcc/testsuite:
PR testsuite/125584
* gfortran.dg/coarray/caf.exp: Default GFORTRAN_SHARED_MEMORY_SIZE
to 2 MB unless running expensive tests.

2 days agotree-optimization/125730 - avoid losing track of base in IVOPTs
Richard Biener [Thu, 11 Jun 2026 13:51:02 +0000 (15:51 +0200)] 
tree-optimization/125730 - avoid losing track of base in IVOPTs

The PR highlights several places where IVOPTs gets lost in tracking
an appropriate base to use for a TARGET_MEM_REF.  The following
addresses the initial place, enough to fix the bug, but already
showing difficulties in avoiding fallout.  The first place is
alloc_iv where we convert the nice pointer IV to an unsigned integer
before applying affine canonicalization.

Removing that resolves the PR and with the fold_plusminus_mult_expr
change tests without regressions on x86_64.

PR tree-optimization/125730
* tree-ssa-loop-ivopts.cc (alloc_iv): Do not convert pointer
IVs to unsigned before canonicalizing.

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