]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 hours agocobol: Improve binary conversion from packed-decimal and numeric-display. master trunk
Robert Dubner [Sat, 20 Jun 2026 01:21:48 +0000 (21:21 -0400)] 
cobol: Improve binary conversion from packed-decimal and numeric-display.

There are routines that create GENERIC conversion routines that convert
packed-decimal and numeric-display variables to binary.  Some are in
libgcobol, and some have direct GENERIC implementations.  All have been
updated to use faster divide-and-conquer algorithms.

The new routines are ten to twenty times faster than the prior versions.

gcc/cobol/ChangeLog:

* genapi.cc (parser_enter_file): Establish a var_decl for the
common packed-decimal to binary conversion table.
* genutil.cc (digit): Divide-and conquer numeric-display converter.
(num_disp_dive): Likewise.
(pd_dive): Divide-and-conqure packed-decimal converter.
(get_pd_value): Likewise.
(get_binary_value_tree): Use the new routines.
(binary_from_FldNumericBinary):  Divide-and conquer numeric-display
converter.
* genutil.h: Declaration for var_decl_dp2bin.
* move.cc (mh_little_endian): Allow FldPacked as a source.

libgcobol/ChangeLog:

* charmaps.cc: Eliminate rt_encoding_t.
* libgcobol.cc (console_init): Change how __gg__console_encoding is
established.
(initialize_program_state): Likewise.
(get_binary_value_local): Use new conversion algorithms.
(__gg__move): Likewise.
* stringbin.cc (__gg__numeric_display_to_binary):  Likewise.
(digit_rt): Likewise.
(num_disp_dive_rt): Likewise.
(pd_dive_rt): Likewise.
(__gg__packed_to_binary): Likewise.
* stringbin.h (STRINGBIN_H_): Declaration for __gg__dp2bin.
(__gg__numeric_display_to_binary): Use new algorithms.
(__gg__packed_to_binary): Likewise.

5 hours agoDaily bump.
GCC Administrator [Sat, 20 Jun 2026 00:16:32 +0000 (00:16 +0000)] 
Daily bump.

8 hours agoc: handle .ACCESS_WITH_SIZE in build_unary_op for !/+/- [PR125604]
Kees Cook [Thu, 18 Jun 2026 19:56:51 +0000 (12:56 -0700)] 
c: handle .ACCESS_WITH_SIZE in build_unary_op for !/+/- [PR125604]

PR123569 fixed wrong code with the counted_by attribute on a pointer
member by suppressing creation of the .ACCESS_WITH_SIZE wrapper in the
parser's pre/post-increment paths, and added a checking assertion in
build_unary_op to ensure no .ACCESS_WITH_SIZE call reaches it.

The other rvalue-consuming unary operators (!, -, +) still
rvalue-convert their operand via convert_lvalue_to_rvalue, which
produces the .ACCESS_WITH_SIZE wrapper as before.  They then reach
parser_build_unary_op then build_unary_op carrying the wrapper and
trip the assertion.  A minimal reproducer:

  struct s {
    int n;
    char *p __attribute__((__counted_by__(n)));
  };
  int f (struct s *o) { return !o->p; }

Unwrap the .ACCESS_WITH_SIZE call at the top of build_unary_op via
get_ref_from_access_with_size.  These unary operators consume the
pointer rvalue rather than the pointed-to data, so the bounds-checking
wrapper is not load-bearing here.  The assertion is retained: after
the unwrap it documents the post-condition the rest of the function
relies on.

PR c/125604

gcc/c/ChangeLog:

* c-typeck.cc (build_unary_op): Unwrap .ACCESS_WITH_SIZE
from the operand before further processing.

gcc/testsuite/ChangeLog:

* gcc.dg/counted-by-unary.c: New test.

8 hours agoipa: Don't record return value ranges for pranges with non ipa-invariant [PR125857]
Andrew Pinski [Thu, 18 Jun 2026 21:16:04 +0000 (14:16 -0700)] 
ipa: Don't record return value ranges for pranges with non ipa-invariant [PR125857]

Now that pranges can have invariants in it, we need to make sure the
return value range does not record non-ipa invariants; otherwise we
might prop the address of a local variable from one function to
another.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/125857

gcc/ChangeLog:

* ipa-prop.cc (ipa_record_return_value_range_1): Don't record
pranges which have non ipa-invariants in it.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
9 hours agoaarch64: Handle vec_deconstruct in vector_costs code.
Iain Sandoe [Fri, 19 Jun 2026 18:54:53 +0000 (19:54 +0100)] 
aarch64: Handle vec_deconstruct in vector_costs code.

r17-1655-g7d351b07e5b85c introduces 'vec_deconstruct' which needs to
be handled in the aarch64_vector_costs::count_ops code, leading to a
bootstrap fail.

gcc/ChangeLog:

* config/aarch64/aarch64.cc
(aarch64_vector_costs::count_ops): Treat vec_deconstruct in the
same way as vec_construct.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
9 hours agoriscv: Change tt-ascalon-d8 to tt-ascalon-x
Peter Bergner [Thu, 18 Jun 2026 04:33:03 +0000 (04:33 +0000)] 
riscv: Change tt-ascalon-d8 to tt-ascalon-x

The Ascalon cpu's official marketing name is Ascalon X.  Change the -mcpu=
and -mtune= options to accept tt-ascalon-x as the cpu's canonical name.
Create an alias name so the old option names are still accepted.

2026-06-17  Peter Bergner  <bergner@tenstorrent.com>

gcc/
* config/riscv/riscv-cores.def (RISCV_TUNE)<tt-ascalon-d8>: Rename from
this...
(RISCV_TUNE)<tt-ascalon-x>: ...to this.
(RISCV_CORE)<tt-ascalon-d8>: Likewise.
(RISCV_CORE)<tt-ascalon-x>: Likewise.
(RISCV_CORE_ALIAS): Add tt-ascalon-d8 alias for tt-ascalon-x.
* doc/riscv-mcpu.texi: Document the name change.
* doc/riscv-mtune.texi: Likewise.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
9 hours agoriscv: Add support for alias names for cpus
Peter Bergner [Thu, 18 Jun 2026 04:11:09 +0000 (04:11 +0000)] 
riscv: Add support for alias names for cpus

Some cpus are known by multiple names or have their name changed after
support has already been added to GCC.  Add support to the riscv port
that allows setting up alternate names or aliases for a cpu's canonical
name.

2026-06-17  Peter Bergner  <bergner@tenstorrent.com>

gcc/
* common/config/riscv/riscv-common.cc (struct riscv_cpu_alias_info):
New struct.
(riscv_cpu_alias_table): New.
(riscv_find_cpu): Add support for cpu alias names.
(riscv_get_valid_option_values): Likewise.
Add an early loop exit if we found a duplicate name.
* config/riscv/riscv-cores.def (RISCV_CORE_ALIAS): New macro.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
10 hours agoa68: remove redundant HAS_ROWS check from caller side of a68_low_dup
Kanishka Solanki [Fri, 19 Jun 2026 16:25:51 +0000 (21:55 +0530)] 
a68: remove redundant HAS_ROWS check from caller side of a68_low_dup

This patch removes redundant caller-side HAS_ROWS checks before calls to
a68_low_dup.

a68_low_dup originally always performed a deep copy, so callers avoided
invoking it for values without rows by checking HAS_ROWS beforehand.

a68_low_dup now performs its own HAS_ROWS check and returns the original
expression unchanged when a deep copy is not required. Remove the
remaining caller-side HAS_ROWS checks, as they are redundant.

gcc/algol68/ChangeLog

* a68-low-clauses.cc (a68_lower_collateral_clause): Do not check
for rows before calling a68_low_dup.
* a68-low-units.cc (collect_call_arguments): Likewise.

Signed-off-by: Kanishka Solanki <kanishkasolanki456s@gmail.com>
12 hours agophiopt: Add support for non-zero offsets for load factoring [PR122193]
Andrew Pinski [Wed, 17 Jun 2026 23:09:40 +0000 (16:09 -0700)] 
phiopt: Add support for non-zero offsets for load factoring [PR122193]

This extends the factor_out_conditional_load to support non-zero offsets
for the MEM_REF. And fixes PR 122193.
It tries not to create gimple statements that don't need to be created.
E.g. If the base is the same then it creates the pointer plus in the join
bb rather than the in the middle bbs. Also uses gimple_build for the pointer
plus so that the if one of the offsets was 0, a new statement is not created.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122193
gcc/ChangeLog:

* tree-ssa-phiopt.cc (factor_out_conditional_load): Support non-zero
offsets.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/factor_op_phi-load-offsets-1.c: New test.
* gcc.dg/tree-ssa/factor_op_phi-load-offsets-2.c: New test.
* gcc.dg/tree-ssa/factor_op_phi-load-offsets-3.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 hours agophiopt: Allow factoring out loads even if there are stores
Andrew Pinski [Mon, 15 Jun 2026 05:23:00 +0000 (22:23 -0700)] 
phiopt: Allow factoring out loads even if there are stores

This is a small improvement to the code where we allow factoring
out loads even with stores (or calls) before hand, this will allow
for store elimination (store factoring) to happen too.
factor_op_phi-load-stores-1.c is one such example.
Also adds the cost model to factoring out loads.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (is_factor_profitable): Change arg_op
to operands and opcount.
(factor_out_conditional_operation): Update call to
is_factor_profitable.
(factor_out_conditional_load): Support when merge has
a virtual phi. The load's vuse needs to be the arguments
to the virtual phi. Call is_factor_profitable on the new phi
arguments. Update the vuse on the new load to the virtual phi.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/factor_op_phi-load-stores-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 hours agophiopt: Simplified factoring of loads [PR125557]
Andrew Pinski [Fri, 12 Jun 2026 19:52:18 +0000 (12:52 -0700)] 
phiopt: Simplified factoring of loads [PR125557]

This is a simplified version that I was mentioning.
It is based on https://gcc.gnu.org/pipermail/gcc-patches/2026-June/720170.html
but only handing in phi-opt. It is able to optimize
what is requested and will not have the regression dealing
with vectorization. There are some more tweaks we can do
to handle some more stuff.
Like before vectorization, if the two pointers are the same we should do
the factoring. Or handling stores before the load which will allow
us to iterate better with cs-elim limited. We can also tweak the
before vectorization cost to be rather based on if it just inside
a loop into what was done in the full patch. For the benchmark improvement
that was not needed.

Changes since v1:
* v2: the factoring needs to be done on a diamond only, and the loads need to
come from the middle bbs.

PR tree-optimization/125557

gcc/ChangeLog:

* tree-ssa-phiopt.cc (factor_out_conditional_load): New function.
(factor_out_all):  Call factor_out_conditional_load.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/scc-diamond-1.c: New test.
* gcc.dg/tree-ssa/scc-diamond-3.c: New test.
* gcc.dg/tree-ssa/scc-diamond-4.c: New test.
* gcc.target/aarch64/scc-diamond-2.c: New test.

Co-Authored-by: Kyrylo Tkachov <ktkachov@nvidia.com>
Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
13 hours agoOpenMP: Add omp_get_device_distances routine [PR125877]
Tobias Burnus [Fri, 19 Jun 2026 16:00:37 +0000 (18:00 +0200)] 
OpenMP: Add omp_get_device_distances routine [PR125877]

On multi-device, multi-socket systems, this routine permits to
find the GPU device that is closest to the thread calling this
API routine.

PR libgomp/125877

include/ChangeLog:

* cuda/cuda.h (cuDeviceGetPCIBusId): Declare.

libgomp/ChangeLog:

* affinity.c (gomp_get_current_numa_node,
gomp_get_numa_distance): New functions.
* config/linux/affinity.c (gomp_get_current_numa_node,
gomp_get_numa_distance): Likewise.
* libgomp-plugin.h (GOMP_OFFLOAD_get_numa_node): Declare.
* libgomp.h (gomp_get_current_numa_node,
gomp_get_numa_distance): Declare.
(struct gomp_device_descr): Add get_numa_node_func.
* libgomp.map (OMP_6.1): Add.
* libgomp.texi (omp_get_device_distances): Add routine.
* omp.h.in (omp_get_device_distances): Declare.
* omp_lib.f90.in (omp_get_device_distances): Add interface.
* omp_lib.h.in (omp_get_device_distances): Likewise.
* plugin/cuda-lib.def (cuDeviceGetPCIBusId): Add.
* plugin/plugin-gcn.c (struct agent_info): Add numa_node.
(GOMP_OFFLOAD_get_numa_node): New.
* plugin/plugin-nvptx.c (struct ptx_device): Add numa_node.
(GOMP_OFFLOAD_get_numa_node): New.
* target.c (omp_get_device_distances): New function.
(gomp_load_plugin_for_device): Load get_numa_node symbol.
* testsuite/libgomp.c/omp-get-device-distances.c: New test.
* testsuite/libgomp.fortran/omp-get-device-distances.f90: New test.

16 hours agoada: Fix spurious error on Ada 2022 declare expression of limited type
Eric Botcazou [Tue, 9 Jun 2026 09:11:54 +0000 (11:11 +0200)] 
ada: Fix spurious error on Ada 2022 declare expression of limited type

The underlying problem is that declare expressions are implemented by means
of a temporary in most cases and that's incompatible with limited types.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Expression_With_Actions): Create a temporary
only for types that can be copied, and replace the EWA node by its
expression for other types.
* exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent
is an EWA node.
* sem_ch3.adb (OK_For_Limited_Init_In_05): Recurse on the expression
of an EWA node.

16 hours agoada: Make Error_Msg_Sloc visible for gigi
Viljar Indus [Wed, 10 Jun 2026 08:37:52 +0000 (11:37 +0300)] 
ada: Make Error_Msg_Sloc visible for gigi

This is needed to improve the error messages for -gnatw.q.

gcc/ada/ChangeLog:

* fe.h: Define Error_Msg_Sloc for gigi.

16 hours agoada: Use correct style switch for single space comments
Viljar Indus [Tue, 9 Jun 2026 09:18:56 +0000 (12:18 +0300)] 
ada: Use correct style switch for single space comments

Single space comment checks are activated by -gnatyC whereas
double space comment checks are activated by -gnatyc.

This patch uses the correct switch name for style warnings
triggered by single space comment checks.

gcc/ada/ChangeLog:

* styleg.adb (Check_Comment): use correct switch name in
error message.

16 hours agoada: Fix assertion failure on library procedure
Ronan Desplanques [Thu, 4 Jun 2026 12:41:44 +0000 (14:41 +0200)] 
ada: Fix assertion failure on library procedure

The Build_And_Insert_Type_Attr_Subp procedure sometimes uses the
declaration list of a subprogram body ancestor even when the point of
reference is inside the statement list. Before this patch, this caused
an assertion failure (and a failure to hoist with assertions disabled)
when the declaration list of the body was empty. This patch fixes this.

gcc/ada/ChangeLog:

* exp_attr.adb (Spot, Spot_Kind): New types.
(Build_And_Insert_Type_Attr_Subp, Skip_Non_Source_Subps,
Find_Insertion_Point_For_Ancestor): Handle case of empty body
declaration list.

16 hours agoada: Fix long-standing issue in static accessibility check for allocators
Eric Botcazou [Fri, 5 Jun 2026 21:24:59 +0000 (23:24 +0200)] 
ada: Fix long-standing issue in static accessibility check for allocators

This has been exposed by the latest change made to Resolve_Allocator: the
constraints of a subtype indication are not necessarily given in the same
order as the discriminants of the base type in the source code.

gcc/ada/ChangeLog:

* sem_res.adb (Check_Discriminant_Use): Rename PN local variable as
Par and apply minor formatting tweaks.
(Resolve_Allocator): For the subtype indication form, make sure to
take the constraints of a subtype into account instead of those of
the indication in order to implement the static accessibility check.

16 hours agoada: Straigthen Call_Chain and __gnat_backtrace processing
Olivier Hainque [Thu, 4 Jun 2026 12:02:23 +0000 (12:02 +0000)] 
ada: Straigthen Call_Chain and __gnat_backtrace processing

Work on cross-testsuite/ta20_015__exc_traceback exposed
that calls to GNAT.Traceback.Call_Chain, in some configurations,
yield a first entry within Call_Chain rather than at the
call point.

This is supposed to be controlled by a careful computation
of a number of frames to skip, passed down as the SKIP_FRAMES
parameter to __gnat_backtrace in tracebak.c.

Roughly:
```
 subprogramA
  calls subprogramB
   calls GNAT.TB.Call_Chain (Skip_Frames => 1)
    calls System.TB.Chain (Skip_Frames => 2)
     calls __gnat_backtrace (skip_frames => 3)
           Actual backtrace at this point is
             1 __gnat_backtrace
             2 System.TB.Call_Chain
             3 GNAT.TB.Call_Chain
             4 spB
             5 spA
           Skip the first 3 frames -> return
             [spB, spA]
```

Within tracebak.c, the skip operation is influenced
by micro details of the semantics of a BASE_SKIP macro,
which was imprecisely documented.

I first thought the fault was in the value for this macro
in a couple of configurations, while it was entirely elswehere.

There were two issues aside from the BASE_SKIP documentation
(in)accuracy:

1 GNAT.Traceback exposes a Call_Chain procedure and a Call_Chain
  function.

  The function has a Skip_Frames parameter, with a default value,
  and a description of how it operates wrt that parameter.

  The procedure doesn't accept a parameter, the spec was imprecise
  and the behavior was different from that of the function with
  the default parameter value.

2 The way Skip_Frames values propagate down to __gnat_backtrace
  require the internal calls within the runtime to materialze as actual
  calls (and call frames) at run-time. This requires preventing
  inlining and sibling call optimization, which was achieved with
  dedicated compilation switches for s-traceb.adb and overlooked
  for g-traceb.adb.

This patch addresses these combined points together:

gcc/ada/ChangeLog:
* tracebak.c: Improve documentation of BASE_SKIP.
* libgnat/g-traceb.ads (Call_Chain procedure): Clarify the
expected behavior wrt Call_Chain itself.
* libgnat/g-traceb.adb (Call_Chain procedure): Propagate
a Skip_Frames value to System.TB.Call_Chain accordingly.
* libgnat/libgnat.gpr: Use the same special switches for
g-traceb.adb as for s-traceb.adb.
* Makefile.rtl: Likewise.
* libgnat/s-traceb.adb: Reword top comment on the need
to prevent optimizations. No need to specify how to do it
here.

16 hours agoada: Fix missing names for 'Image of enumeration type
Eric Botcazou [Sun, 7 Jun 2026 20:30:56 +0000 (22:30 +0200)] 
ada: Fix missing names for 'Image of enumeration type

This is a freezing issue introduced by the recent coupling of assertions and
Ghost mode, which are supposed to use different paths in the freezing code.

In light of this, it appears to be wise to undo the coupling and restore the
clear separation between the two different mechanisms.  The price to pay is
the loss of the "assertion would fail at run time" warning for non-static
assertions that are disabled (it is still present for static assertions),
which seems to be an acceptable trade-off to avoid nasty freezing issues.

gcc/ada/ChangeLog:

* expander.adb (Expand): Revert latest change.
* ghost.adb (Set_Ghost_Mode): Likewise.
* sem_ch3.adb (Analyze_Subtype_Declaration): Also copy the RM size
for floating-point types.
* sem_prag.adb (Analyze_Pragma) <Pragma_Check>: Do not mark the
pragma as Ghost when expander is active and the pragma is ignored.
Preanalyze it instead of analyzing it, and rewrite it as a null
statement at the end of the processing.

16 hours agoada: Add missing diagnostic ids for restriction messages
Viljar Indus [Fri, 5 Jun 2026 09:47:31 +0000 (09:47 +0000)] 
ada: Add missing diagnostic ids for restriction messages

gcc/ada/ChangeLog:

* restrict.adb (Check_Restriction_No_Specification_Of_Aspect): add
Diagnostic_Id for error message.
(Check_Restriction_No_Use_Of_Attribute): Likewise.
(Check_Restriction_No_Use_Of_Pragma): Likewise.

16 hours agoada: Fix typo in comment
Eric Botcazou [Thu, 4 Jun 2026 16:32:35 +0000 (18:32 +0200)] 
ada: Fix typo in comment

gcc/ada/ChangeLog:

* libgnat/a-suenco.adb (Convert): Remove double space after comma.

16 hours agoada: Fix minor inefficiency
Eric Botcazou [Thu, 4 Jun 2026 16:32:09 +0000 (18:32 +0200)] 
ada: Fix minor inefficiency

gcc/ada/ChangeLog:

* sem_ch3.adb (Analyze_Object_Declaration): Streamline test.

16 hours agoada: Rename left-over parameterized expression to expression function
Marc Poulhiès [Thu, 4 Jun 2026 11:21:06 +0000 (13:21 +0200)] 
ada: Rename left-over parameterized expression to expression function

The terminology was changed back in 2011 (see
"[Ada] Change parameterized expression to expression function"),
but this one was left behind.

Renaming it to "Expf" as it is more self describing.
Also rename some variable name to reflect the change.

gcc/ada/ChangeLog:

* par.adb (Pf_Rec.Pexp): Renamed to...
(Pf_Rec.Expf): ...this.
(Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp): Renamed to...
(Pf_Decl_Gins_Pbod_Rnam_Stub_Expf): ... this.
(Pf_Decl_Gins_Pbod_Rnam_Stub_Pexp): Renamed to...
(Pf_Decl_Gins_Pbod_Rnam_Stub_Expf): ... this.
(Pf_Decl_Gins_Pbod_Rnam_Pexp): Renamed to ...
(Pf_Decl_Gins_Pbod_Rnam_Expf): ... this.
(Pf_Decl_Pbod_Pexp): Renamed to ...
(Pf_Decl_Pbod_Expf): ... this.
(Pf_Pbod_Pexp): Renamed to ...
(Pf_Pbod_Expf): ... this.
* par-ch6.adb (Rewrite_Entity_If_Direct_Attribute_Def)
(Likely_Expression_Function): Adjust.
* par-ch10.adb (P_Compilation_Unit, P_Subunit): Likewise.
* par-ch3.adb (P_Declarative_Item): Likewise.
* par-ch7.adb (P_Package): Likewise.
* par-ch9.adb (P_Entry_Or_Subprogram_With_Indicator)
(P_Protected_Operation_Items): Adjust.

16 hours agoada: Minor cosmetic change: use Discard_Node
Marc Poulhiès [Fri, 5 Jun 2026 12:25:10 +0000 (14:25 +0200)] 
ada: Minor cosmetic change: use Discard_Node

Instead of using a dedicated block with a local variable, use the
Discard_Node function.

gcc/ada/ChangeLog:

* exp_ch3.adb (Build_Implicit_Copy_Constructor)
(Build_Implicit_Parameterless_Constructor): Refactor how node is
discarded.

16 hours agoada: Replace global variable with function
Ronan Desplanques [Thu, 4 Jun 2026 09:06:38 +0000 (11:06 +0200)] 
ada: Replace global variable with function

Init_Or_Norm_Scalars was a global variable used to store the boolean
disjunction of two other global variables. This patch replaces it with
an expression function to make things simpler.

gcc/ada/ChangeLog:

* opt.ads (Init_Or_Norm_Scalars): Turn into expression function.
* opt.adb (Restore_Config_Switches, Set_Config_Switches): Remove
assignment.
* frontend.adb (Frontend): Remove assignment.
* sem_prag.adb (Do_Initialize_Scalars, Analyze_Pragma): Remove
assignment.
* targparm.adb (Get_Target_Parameters): Remove assignment.

16 hours agoada: Remove unused component
Ronan Desplanques [Wed, 3 Jun 2026 15:51:58 +0000 (17:51 +0200)] 
ada: Remove unused component

gcc/ada/ChangeLog:

* opt.adb (Save_Config_Switches): Remove useless assignment.
* opt.ads (Config_Switches_Type): Remove unused component.

17 hours agotree-optimization: Clarify LIM memory ref equality
Xin Wang [Wed, 20 May 2026 08:17:15 +0000 (16:17 +0800)] 
tree-optimization: Clarify LIM memory ref equality

Restructure mem_ref_hasher::equal so the non-decomposed fallback
and the decomposed comparison path are explicit. The non-decomposed
lookup still compares the original refs with operand_equal_p, while
the decomposed path keeps the same base, offset, size, max_size,
volatile, alias-set, and type checks as before. This matches the split
in gather_mem_refs_stmt, where non-decomposed references are marked
with an unknown max_size and decomposed references are hashed from
base, offset, and size.

* tree-ssa-loop-im.cc (mem_ref_hasher::equal): Refactor
for clarity.

Signed-off-by: Xin Wang <wangxinw@hygon.cn>
20 hours agogcc/doc: Move @anchor-s referring to top of node after their @node
Arsen Arsenović [Fri, 19 Jun 2026 09:13:21 +0000 (11:13 +0200)] 
gcc/doc: Move @anchor-s referring to top of node after their @node

Previously, the anchors would end up generating redirects to the end of
unrelated nodes, rather than to the start of nodes we intended to
target.  This fixes that.

gcc/ChangeLog:

* doc/extend.texi: Move @anchor-s referring to tops of nodes
after their corresponding @node lines.
* doc/invoke.texi: Ditto.

Reported-by: Alexander Monakov <amonakov@ispras.ru>
24 hours agoAdjust configure machinery to abi32 targets
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.

24 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.

26 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.

29 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>
29 hours agoDaily bump.
GCC Administrator [Fri, 19 Jun 2026 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

29 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.

30 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.

32 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.

32 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.

32 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"'.

32 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.

32 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.

32 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.

32 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.

33 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>
34 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.

34 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.

34 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.

35 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.

36 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.

37 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.

37 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.

39 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.

39 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.

40 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>
40 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.

41 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.

41 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.

41 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.

41 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.

41 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.

41 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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>
45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

45 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.

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

2 days 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.

2 days 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>
2 days 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.

2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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.

2 days 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.

2 days 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.

2 days 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.

2 days 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.

2 days 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.

2 days 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.