]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 months agoarm: allow at least one insn when loading a constant [PR102309]
Torbjörn SVENSSON [Fri, 27 Mar 2026 13:55:27 +0000 (14:55 +0100)] 
arm: allow at least one insn when loading a constant [PR102309]

gcc/ChangeLog:

PR target/102309
* config/arm/arm.cc (arm_constant_limit): Allways allow at least
one insn when loading a constant.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agoDaily bump.
GCC Administrator [Mon, 30 Mar 2026 00:16:21 +0000 (00:16 +0000)] 
Daily bump.

2 months ago[RISC-V][PR target/124674] Define OImode in the usual way
Jeff Law [Sun, 29 Mar 2026 23:36:25 +0000 (17:36 -0600)] 
[RISC-V][PR target/124674] Define OImode in the usual way

This testcase tries to call build_nonstandard_integer_type for a 192-bit
precision type.  This eventually faults because we don't have a suitably wide
mode.

Somewhat surprisingly, the targets are responsible for defining OImode.  So
this adds it to the RISC-V port as well which trivially fixes the ICE.  The
test is limited to rv64 as rv32 doesn't support int128.  That could have been
handled with a target-supports selector just as easily.

Tested on riscv32-elf and riscv64-elf.  Both the BPI and Pioneer are
experiencing NVME drive failures, so no bootstraps until I figure that out.
Waiting on the pre-commit tester to do its thing before pushing

PR target/124674
gcc/
* config/riscv/riscv-modes.def: Create OImode.

gcc/testsuite
* gcc.target/riscv/pr124674.c: New test.

2 months agoDaily bump.
GCC Administrator [Sun, 29 Mar 2026 00:16:23 +0000 (00:16 +0000)] 
Daily bump.

2 months agotestsuite: d: Adjust test for d_runtime_has_std_library
Iain Buclaw [Sat, 28 Mar 2026 18:21:54 +0000 (19:21 +0100)] 
testsuite: d: Adjust test for d_runtime_has_std_library

The test for the D std library incorrectly returned true on targets
--with-libphobos-druntime-only=yes.

The function cos() is treated as an intrinsic, so always exists.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_d_runtime_has_std_library): Test for
acos rather than cos.

2 months agofortran: Fix [PR124666] [16 Regression] [UBSAN] io.cc:290:27: runtime error
Jerry DeLisle [Sat, 28 Mar 2026 17:53:55 +0000 (10:53 -0700)] 
fortran: Fix [PR124666] [16 Regression] [UBSAN] io.cc:290:27: runtime error

Simple an obvious fix to avoid integer overflow.

PR fortran/124666

gcc/fortran/ChangeLog:

* io.cc (format_lex): Use enclosing parens to subtract
before adding.

2 months agoFortran: Fix use-after-free in gfc_fixup_sibling_symbols [PR95879]
Paul Thomas [Sat, 28 Mar 2026 09:08:54 +0000 (09:08 +0000)] 
Fortran:  Fix use-after-free in gfc_fixup_sibling_symbols [PR95879]

2026-03-28  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/95879
* parse.cc (fixup_st_func_formals): New function to update
statement function formal argument lists referencing a symbol
about to be freed.
(gfc_fixup_sibling_symbols): Call fixup_st_func_formals before
gfc_release_symbol.

gcc/testsuite
PR fortran/95879
* gfortran.dg/pr95879.f90: New test.

2 months agoFortran: Avoid rollback ICE after invalid SELECT TYPE [PR84245]
Paul Thomas [Sat, 28 Mar 2026 07:23:01 +0000 (07:23 +0000)] 
Fortran: Avoid rollback ICE after invalid SELECT TYPE [PR84245]

2026-03-28  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/84245
* match.cc (gfc_match_select_type): Free the temporary namespace
only on MATCH_NO. Return immediately on MATCH_ERROR.

gcc/testsuite/ChangeLog:

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

2 months agotestsuite: aarch64: skip erratas_opt_*.c on vxworks
Alexandre Oliva [Wed, 25 Mar 2026 18:05:49 +0000 (15:05 -0300)] 
testsuite: aarch64: skip erratas_opt_*.c on vxworks

VxWorks involves linking oddities in both kernel and rtp modes that
prevent the testcases for finding the expected outputs in the
erratas_opt_*.c testcases.  One of the modes doesn't even perform
final linking, so it's kind of hopeless.  Just skip them.

for  gcc/testsuite/ChangeLog

* gcc.target/aarch64/erratas_opt_0.c: Skip on VxWorks.
* gcc.target/aarch64/erratas_opt_1.c: Likewise.
* gcc.target/aarch64/erratas_opt_2.c: Likewise.
* gcc.target/aarch64/erratas_opt_3.c: Likewise.
* gcc.target/aarch64/erratas_opt_4.c: Likewise.
* gcc.target/aarch64/erratas_opt_5.c: Likewise.
* gcc.target/aarch64/erratas_opt_6.c: Likewise.
* gcc.target/aarch64/erratas_opt_7.c: Likewise.
* gcc.target/aarch64/erratas_opt_8.c: Likewise.
* gcc.target/aarch64/erratas_opt_9.c: Likewise.
* gcc.target/aarch64/erratas_opt_10.c: Likewise.
* gcc.target/aarch64/erratas_opt_11.c: Likewise.
* gcc.target/aarch64/erratas_opt_12.c: Likewise.
* gcc.target/aarch64/erratas_opt_13.c: Likewise.
* gcc.target/aarch64/erratas_opt_14.c: Likewise.
* gcc.target/aarch64/erratas_opt_15.c: Likewise.

2 months agotestsuite: aarch64: avoid stdint-gcc.h in crc-builtin-pmul64.c
Alexandre Oliva [Wed, 25 Mar 2026 18:05:33 +0000 (15:05 -0300)] 
testsuite: aarch64: avoid stdint-gcc.h in crc-builtin-pmul64.c

Though gcc most often installs a stdint-gcc.h, that's not necessarily
the case, and it isn't the case for sure when targeting vxworks.

The file history doesn't justify the oddity, so I'm assuming it was a
mistake.

for  gcc/testsuite/ChangeLog

* gcc.target/aarch64/crc-builtin-pmul64.c: Include stdint.h.

2 months agotestsuite: negated triplets need blank separators
Alexandre Oliva [Wed, 25 Mar 2026 18:05:14 +0000 (15:05 -0300)] 
testsuite: negated triplets need blank separators

!a-b-c is not the same as ! a-b-c.  In !a-b-c, the '!' is part of the
triplet that istarget attempts to match.  Fix all occurrences, except
for gcc.dg/vect/vect-93.c, that is taken care of separately.

for  gcc/testsuite/ChangeLog

* gcc.dg/debug/btf/btf-variables-5.c: Separate ! from triplet.
* gcc.dg/hoist-register-pressure-1.c: Likewise.
* gcc.dg/hoist-register-pressure-2.c: Likewise.
* gcc.dg/hoist-register-pressure-3.c: Likewise.
* gcc.target/powerpc/safe-indirect-jump-1.c: Likewise.
* gfortran.dg/gomp/declare-variant-14.f90: Likewise.

2 months agolibgcc: vxworks: work around warnings promoted to errors on aarch64
Alexandre Oliva [Wed, 25 Mar 2026 18:04:53 +0000 (15:04 -0300)] 
libgcc: vxworks: work around warnings promoted to errors on aarch64

In RTP mode, defining TLS_DELETE_HOOK_ARG as NULL AKA 0 elicits a
warning, that casting it to TASK_ID avoids.

objLibP.h defines an inline function that, depending on the
configuration, will have unused parameters.  Allow warnings about
them.

vxTas calls are supposed to take __vx_tas_t, but upon passing it that
on aarch64, we get warnings about discarding volatile qualifiers, that
not even explicit type casts avoid.  So, allow the warnings.

for  libgcc/ChangeLog

* config/gthr-vxworks-tls.c (TLS_DELETE_HOOK_ARG): Type-cast
NULL constant to avoid warning.
* config/t-vxworks (LIBGCC2_CFLAGS): Tolerate unused-parameter
and discarded-qualifiers errors.

2 months agolibstdc++: simd: allow x86 -mlong-double-64
Alexandre Oliva [Mon, 23 Mar 2026 01:32:55 +0000 (22:32 -0300)] 
libstdc++: simd: allow x86 -mlong-double-64

On a target that defaults to -mlong-double-64 -msse,
standard_abi_usable.cc and other tests fail to compile because of the
assert that rejects long double.  As on ppc, we can trivially make
things work for -mlong-double-64.

for  libstdc++-v3/ChangeLog

* include/experimental/bits/simd.h (__intrinsic_type): Accept
64-bit long doubles on x86 SSE.

2 months agoDaily bump.
GCC Administrator [Sat, 28 Mar 2026 00:16:25 +0000 (00:16 +0000)] 
Daily bump.

2 months agobpf: md: fix zero_extendsidi2 reg->reg codegen [PR124670]
Vineet Gupta [Thu, 26 Mar 2026 18:01:24 +0000 (11:01 -0700)] 
bpf: md: fix zero_extendsidi2 reg->reg codegen [PR124670]

Currently the following RTL for zero extension

| (insn 8 7 9 (set (reg:DI 0 %r0 [25])
|        (zero_extend:DI (reg:SI 0 %r0 [24])))  {zero_extendsidi2}
|     (nil))

generates

|   r0 = r0

which is just a 64-bit copy and doesn't clear the upper 32-bits as
semantically required by the pattern.

The issue is pattern's asm template missing ‘w’/'W' causing bpf_print_register ()
to only emit 'r' regs. Using ‘W’ in template generates correct code.

|   w0 = w0

Note that 'W specifier ignores the RTL mode and unconditionally emits
the 'w' reg which might feel like creating a potential future bug.
However for this insn, it is correct/completely safe as follows:
 - 'W1' for src operand: src operand has a SI mode in pattern.
 - 'W0' for dst: Technically dst is DI, but the upper 32-bits of output
   have to be 0 due to zero-extension, thus a 'w' reg is OK.

For selftests this is a wash, except for some spurious changes.

PR target/124670

gcc/ChangeLog:

* config/bpf/bpf.md (zero_extendsidi2): Use 'W' in asm template.

gcc/testsuite/ChangeLog:

* gcc.target/bpf/zero-ext.c: New test.

Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
2 months agoFortran: Fix ICE in interface mapping with assumed rank [PR102619]
Paul Thomas [Fri, 27 Mar 2026 22:47:41 +0000 (22:47 +0000)] 
Fortran: Fix ICE in interface mapping with assumed rank [PR102619]

2026-03-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/102619
* trans-expr.cc (gfc_get_interface_mapping_array): Add argument
'assumed_rank_formal', which if true returns the descriptor in
'ifm'.
(gfc_add_interface_mapping): Detect an assumed rank formal arg
of a non-intrinsic function to set 'assumed_rank_formal' and
pass the descriptor to gfc_get_interface_mapping_array.

gcc/testsuite/
PR fortran/102619
* gfortran.dg/pr102619.f90: New test.

2 months agoAda: Lift restriction on structural generic instantiation of subprograms
Eric Botcazou [Fri, 27 Mar 2026 20:09:53 +0000 (21:09 +0100)] 
Ada: Lift restriction on structural generic instantiation of subprograms

When an entity of a library-level package is used as actual in an attempted
structural instantiation of a library-level generic unit in the package, an
error is given since the structural instance is a library unit with circular
semantic dependence on the package.

This change lifts the restriction for generic subprograms by demoting the
structural instance into a local instance in this case, which means that
several instances might end up being present in a single partition, unless
the optimizer is run on the entire partition, for example by means of LTO.

gcc/ada/
* sem_ch12.adb (Analyze_Structural_Associations): Create a local
instance instead of a structural instance when a local entity of
a library-level package is used in a subprogram instantiation.

2 months agoFortran: fix array bounds violation in min_max_args [PR124656]
Harald Anlauf [Fri, 27 Mar 2026 19:51:20 +0000 (20:51 +0100)] 
Fortran: fix array bounds violation in min_max_args [PR124656]

PR fortran/124656

gcc/fortran/ChangeLog:

* check.cc (min_max_args): Fix array index used for registering
labeled arguments of the MIN/MAX intrinsics for subsequent
duplicate label checks.

2 months agoFortran: several small fixes in gfc_simplify_eoshift [PR124631]
Harald Anlauf [Thu, 26 Mar 2026 20:35:11 +0000 (21:35 +0100)] 
Fortran: several small fixes in gfc_simplify_eoshift [PR124631]

PR fortran/124631

gcc/fortran/ChangeLog:

* simplify.cc (gfc_simplify_eoshift): Initialize sstride[0] to
prevent pointer arithmetic with undefined offset.  Fix several
frontend memleaks.

2 months agoAda: Fix overriding indicator wrongly rejected on protected procedure
Eric Botcazou [Fri, 27 Mar 2026 17:38:09 +0000 (18:38 +0100)] 
Ada: Fix overriding indicator wrongly rejected on protected procedure

The case itself is fairly pathological (and very likely not human made), but
it's a clear incentive to get rid of an old kludge in generic instantiation,
whereby the full view of a type is forced on nodes in the generic unit even
though only the partial declaration is visible to them.

gcc/ada/
PR ada/124596
* sem_ch12.ads (Check_Private_View): Move around.
* sem_ch12.adb (Check_Private_View): Retrieve the partial view
by means of a call to Incomplete_Or_Partial_View.
(Save_Global_References.Set_Global_Type): Do not force the full
view of a type when only the partial declaration is visible.
* sem_res.adb (Resolve_Actuals.Insert_Default): Remove obsolete
code coping with the above kludge.

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

2 months agolibgomp: fix omp_target_is_present and omp_get_mapped_ptr
Tobias Burnus [Fri, 27 Mar 2026 16:54:00 +0000 (17:54 +0100)] 
libgomp: fix omp_target_is_present and omp_get_mapped_ptr

There were a few minor issues with the two routines, partially because of
not handling corner cases and partially some clarifications are only in
newer versions of the spec.

In particular, for omp_target_is_present
* NULL pointer aren't regarded as present
* For (unified-)shared memory, claiming that something has always corresponding
  storage is wrong - it mostly never has. (but it is omp_target_is_accessible).
* Even with shared memory, 'declare target' usually has device memory. For
  'link' it is made to point to the host, i.e. it is not mapped, all others
  are still mapped. (With 'requires self_mapping', 'enter' should also not be
  mapped (and turned internally to 'link'), only 'local' needs to be mapped.)

For omp_get_mapped_ptr
* For NULL we can return NULL early also for devices.
* For shared memory, we shouldn't touch link (it is not counting as mapped);
  hence return NULL for it.

The documentation was updated add some missing cross references as the more
useful ones were missing.  Additionally, the description for the two modified
routines has been updated.

libgomp/ChangeLog:

* target.c (omp_target_is_present, omp_get_mapped_ptr): Update handling
for nullptr and shared-memory devices.
* libgomp.texi (omp_target_is_present, omp_get_mapped_ptr): Update
description, add see-also @refs.
(omp_target_is_accessible, omp_target_associate_ptr): Add see-also
@refs.
* testsuite/libgomp.c/omp_target_is_present.c: New test.
* testsuite/libgomp.c/omp_target_is_present-2.c: New test.

2 months agoregcprop: Return early in maybe_mode_change for unorder modes [PR124649]
Andrew Pinski [Thu, 26 Mar 2026 20:21:01 +0000 (13:21 -0700)] 
regcprop: Return early in maybe_mode_change for unorder modes [PR124649]

Like r16-727-g2ec5082dd24cef but the call to partial_subreg_p happens
in a later place, maybe_mode_change.
For this example we have VNx4QImode and DImode which are not ordered.

Bootstrapped and tested on aarch64-linux-gnu.

PR rtl-optimization/124649

gcc/ChangeLog:

* regcprop.cc (maybe_mode_change): Return early
for unordered modes.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agolibstdc++: Delete superseded comment
Nathan Myers [Fri, 27 Mar 2026 15:37:39 +0000 (11:37 -0400)] 
libstdc++: Delete superseded comment

A comment referring to nothing remained in a patch.

libstdc++-v3/ChangeLog:
* include/bits/stl_tree.h: Delete comment.

2 months agoFortran: Fix ICE with allocation of scalar pointer entity [PR114021]
Paul Thomas [Fri, 27 Mar 2026 10:50:39 +0000 (10:50 +0000)] 
Fortran: Fix ICE with allocation of scalar pointer entity [PR114021]

2026-03-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/114021
* symbol.cc (gfc_get_unique_symtree): If the namespace argument
is NULL, allocate a new symtree and provide it with the unique
name.
* trans-expr.cc (trans_scalar_assign): In the deep copy of a
derived type with allocatable components, fix the rhs value if
it is not a constant or a variable.
* trans-stmt.cc (gfc_trans_allocate): Do not deallocate
allocatable components of a source that is not a variable and
is a pointer. If the DECL_NAME or its IDENTIFIER_POINTER are
null,use gfc_get_unique_symtree with NULL namespace to obtain a
symtree for the assignment.

gcc/testsuite/
PR fortran/114021
* gfortran.dg/pr114021.f90: New test.

2 months agoRISC-V: Allow all vector modes during builtin registration. [PR124613]
Robin Dapp [Tue, 24 Mar 2026 09:58:14 +0000 (10:58 +0100)] 
RISC-V: Allow all vector modes during builtin registration. [PR124613]

In r16-7312-gecc37444062b40 we allowed all vector modes for the
any_target hook.  Since then we would ICE in gcc.target/riscv/pr122051.c
as emit_move_multi_word would choose a fractional vector mode.

This patch disallows fractional vector modes for xtheadvector in
riscv_vector_mode_supported_p but makes an exception for builtin
registration (through a global variable).  During registration we
need to have all modes available in order to maintain the registration
order for LTO streaming.

PR target/124613

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins.cc (rvv_switcher::rvv_switcher):
Add riscv_registering_builtins.
(rvv_switcher::~rvv_switcher): Set riscv_registering_builtins to
false.
* config/riscv/riscv.cc (riscv_vector_mode_supported_p): Use
riscv_registering_builtins.
* config/riscv/riscv.h: Declare.

2 months agodebug/124644 - duplicate DW_AT_artificial attribute
Richard Biener [Thu, 26 Mar 2026 14:09:53 +0000 (15:09 +0100)] 
debug/124644 - duplicate DW_AT_artificial attribute

We can attempt to add DW_AT_artificial because of two reasons,
because of DECL_ARTIFICIAL on the decl and because of the
artificial function attribute which is attempted when marking
a decl DIE for inlining.  The following guards the latter,
avoiding an ICE with checking enabled.

PR debug/124644
* dwarf2out.cc (dwarf2out_abstract_function): Only
add DW_AT_artificial if the decl isn't DECL_ARTIFICIAL.

* g++.dg/debug/pr124644.C: New testcase.

2 months agoAdd topics/*.h to installed header files
Torbjörn SVENSSON [Tue, 24 Mar 2026 16:33:23 +0000 (17:33 +0100)] 
Add topics/*.h to installed header files

Install topics/*.h header files to allow progress_notifications_plugin.cc
to properly build when testing out of build tree.

gcc/ChangeLog:

* Makefile.in: (PLUGIN_HEADERS): Add $(srcdir)/topics/*.h.
(install-plugin): Preserve directory structure for topics
headers.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agoFortran: Add testcase [PR101281]
Paul Thomas [Fri, 27 Mar 2026 07:27:09 +0000 (07:27 +0000)] 
Fortran: Add testcase [PR101281]

2026-03-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite/ChangeLog:

PR fortran/101281
* gfortran.dg/pr101281.f90: New test.

2 months agoDaily bump.
GCC Administrator [Fri, 27 Mar 2026 00:16:23 +0000 (00:16 +0000)] 
Daily bump.

2 months agoFortran: Minor PDT cleanup and fix in gfc_simplify_exp [PR115315]
Paul Thomas [Thu, 26 Mar 2026 18:50:13 +0000 (18:50 +0000)] 
Fortran: Minor PDT cleanup and fix in gfc_simplify_exp [PR115315]

2026-03-26  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/115315
* decl.cc (insert_parameter_exprs): Make strcmp condition more
concise.
(gfc_get_pdt_instance): Use gf_replace_expr where possible and
use return value of gfc_simplify_expr. Correct error in which
params->expr was being simplified instead of c2->initializer.
* expr.cc (gfc_simplify_expr): If the substring 'start' value
is less than zero, it is clearly out of range and so return
false.

gcc/testsuite/
PR fortran/115315
* gfortran.dg/pdt_90.f03: New test.

2 months agolibgomp: Update tests to initialize full_data to 0.
Prathamesh Kulkarni [Thu, 26 Mar 2026 17:09:08 +0000 (17:09 +0000)] 
libgomp: Update tests to initialize full_data to 0.

libgomp/ChangeLog:
PR libgomp/124123
* testsuite/libgomp.c/pr122314.c (test): Initialize full_data
to 0.
* testsuite/libgomp.c/pr122356.c: Likewise.

Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
2 months agotestsuite: Fix up another tcl 9 compatibility problem
Jakub Jelinek [Thu, 26 Mar 2026 17:11:06 +0000 (18:11 +0100)] 
testsuite: Fix up another tcl 9 compatibility problem

TCL 9 removed case command which has been deprecated before.
https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9
says "Replace case with switch" and switch has been working in TCL 8
just fine.

2026-03-26  Jakub Jelinek  <jakub@redhat.com>

* lib/mike-gcc.exp (postbase): Use switch instead of case for
TCL 9 compatibility.
* lib/mike-g++.exp (postbase): Likewise.

2 months agolto/124289 - Correctly handle toplevel asm with -flto-partition=cache
Michal Jires [Thu, 5 Mar 2026 09:03:21 +0000 (10:03 +0100)] 
lto/124289 - Correctly handle toplevel asm with -flto-partition=cache

This patch adds create_asm_partitions to cache partitioning
to prevent issues with non-renameable symbols (while partition
joining) and static asm symbols (while partition splitting).

All other relevant partitionings use create_asm_partitions.
This was not used in cache partitioning, because toplevel asm
could be in principle special handled in cache partitioning
with marginally better results, but I never implemented it.

lto/124289

gcc/lto/ChangeLog:

* lto-partition.cc (enum map1to1_content): New.
(map_1_to_1): Use map1to1_content.
(lto_1_to_1_map): Likewise.
(create_asm_partitions): Likewise.
(lto_max_map): Likewise.
(lto_cache_map): Use create_asm_partitions.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/toplevel-extended-asm-2_0.c: Add padding to asm label.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: Add padding to asm label.

2 months agoRegenerate gcc.pot
Joseph Myers [Thu, 26 Mar 2026 15:08:27 +0000 (15:08 +0000)] 
Regenerate gcc.pot

* gcc.pot: Regenerate.

2 months agoc++/reflection: ICE with substitute and undeduced auto [PR123613]
Marek Polacek [Thu, 19 Mar 2026 17:10:38 +0000 (13:10 -0400)] 
c++/reflection: ICE with substitute and undeduced auto [PR123613]

In substitute7.C we have

  template <typename T, auto ... Vs>
  constexpr auto construct_from = T{Vs...}; // #1
  struct Inner {};
  struct Outer { Inner m; };
  constexpr auto r = substitute(^^construct_from,
                               { ^^Outer, ^^construct_from<Inner> });

which crashes because the auto in #1 hadn't been deduced when we
called eval_can_substitute -> lookup_template_variable when processing
the substitute call.  We can call mark_used to resolve this, because
it has:

  if (undeduced_auto_decl (decl))
    maybe_instantiate_decl (decl);

and to make the json-parser.C test work, we have to do something
similar in eval_substitute, otherwise we crash due to another
undeduced auto.

PR c++/123613

gcc/cp/ChangeLog:

* reflect.cc (get_reflection): Call mark_used.
(eval_can_substitute): Don't resolve_nondeduced_context here.
(eval_substitute): Call lookup_and_finish_template_variable instead
of lookup_template_variable and finish_template_variable.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/json-parser.C: New test.
* g++.dg/reflect/substitute7.C: New test.
* g++.dg/reflect/test.json: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 months agoDaily bump.
GCC Administrator [Thu, 26 Mar 2026 00:16:25 +0000 (00:16 +0000)] 
Daily bump.

2 months agotestsuite, c++: Skip contracts run tests for non-hosted.
Iain Sandoe [Sat, 31 Jan 2026 20:45:23 +0000 (20:45 +0000)] 
testsuite, c++: Skip contracts run tests for non-hosted.

These, in general, require hosted support.

gcc/testsuite/ChangeLog:

* g++.dg/contracts/cpp26/basic.contract.eval.p11-observe.C: Skip
for non-hosted.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-2.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-3.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-4.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-5.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF-post.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF-pre.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF2.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF3.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17-SMF4.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p17.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p4.C: Likewise.
* g++.dg/contracts/cpp26/basic.contract.eval.p6.observe.C: Likewise.
* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-all.C: Likewise.
* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-none.C: Likewise.
* g++.dg/contracts/cpp26/callerside-checks/callerside-checks-pre.C: Likewise.
* g++.dg/contracts/cpp26/callerside-checks/freefunc-noexcept-post.C: Likewise.
* g++.dg/contracts/cpp26/callerside-checks/freefunc-noexcept-pre.C: Likewise.
* g++.dg/contracts/cpp26/contract-assert-run.C: Likewise.
* g++.dg/contracts/cpp26/contract-violation-noexcept2.C: Likewise.
* g++.dg/contracts/cpp26/debug-and-opt.C: Likewise.
* g++.dg/contracts/cpp26/deferred1.C: Likewise.
* g++.dg/contracts/cpp26/definition-checks/contract-assert-no-def-check.C: Likewise.
* g++.dg/contracts/cpp26/dependent_contract.C: Likewise.
* g++.dg/contracts/cpp26/empty-nt-param.C: Likewise.
* g++.dg/contracts/cpp26/expr.prim.id.unqual.p7-3.C: Likewise.
* g++.dg/contracts/cpp26/expr.prim.id.unqual.p7-4.C: Likewise.
* g++.dg/contracts/cpp26/function-contract-specifier-seq.C: Likewise.
* g++.dg/contracts/cpp26/name_mangling.C: Likewise.
* g++.dg/contracts/cpp26/outline-checks/freefunc-noexcept-post.C: Likewise.
* g++.dg/contracts/cpp26/outline-checks/freefunc-noexcept-pre.C: Likewise.
* g++.dg/contracts/cpp26/outline-checks/func-noexcept-assert.C: Likewise.
* g++.dg/contracts/cpp26/outline-checks/memberfunc-noexcept-post.C: Likewise.
* g++.dg/contracts/cpp26/outline-checks/memberfunc-noexcept-pre.C: Likewise.
* g++.dg/contracts/cpp26/src-loc-0.C: Likewise.
* g++.dg/contracts/cpp26/src-loc-1.C: Likewise.
* g++.dg/contracts/cpp26/src-loc-2.C: Likewise.
* g++.dg/contracts/cpp26/throwing-violation-handler.cc: Likewise.
* g++.dg/contracts/cpp26/vaargs.C: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2 months agoFortran: fix rank/shape check in interface checking [PR124567]
Harald Anlauf [Tue, 24 Mar 2026 21:04:29 +0000 (22:04 +0100)] 
Fortran: fix rank/shape check in interface checking [PR124567]

PR fortran/124567

gcc/fortran/ChangeLog:

* interface.cc (gfc_check_dummy_characteristics): Split shape check
into a separate check for rank and a check for shape, taking into
account a corner case where the ambiguity between deferred shape
and assumed shape has not been fully resolved at the time of
checking.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr124567.f90: New test.
* gfortran.dg/proc_decl_30.f90: Likewise.

2 months agogcov-profile/121074 - hold onto gcov file for less time
Richard Biener [Wed, 25 Mar 2026 13:40:59 +0000 (14:40 +0100)] 
gcov-profile/121074 - hold onto gcov file for less time

The following fixes the issue of two open gcov files at the
same time, one from -ftest-coverage, opened/closed by
coverage_init/finish and one from -fauto-profile, attempted
to be opened by pass_ipa_auto_profile.  The solution is
to open the coverage files only during pass_ipa_tree_profile.

PR gcov-profile/121074
* coverage.h (coverage_init_file): Declare.
(coverage_finish_file): Likewise.
* coverage.cc (coverage_init_file): New function, split
out actual file opening and writing from ...
(coverage_init): ... here.
(coverage_finish_file): Likewise for file closing, from ...
(coverage_finish): ... here.
* tree-profile.cc (tree_profiling): Call coverage_init_file
and coverage_finish_file here.

2 months agotree-optimization/124627 - inlining and elided debug stmts
Richard Biener [Wed, 25 Mar 2026 08:40:56 +0000 (09:40 +0100)] 
tree-optimization/124627 - inlining and elided debug stmts

When we fixup a noreturn call during inlining we can end up eliding
debug stmts, so we have to make sure to not re-instantiate SSA
operands on those later when processing all debug stmts.

PR tree-optimization/124627
* tree-inline.cc (copy_debug_stmts): Only copy debug
stmts that are still in the IL.

2 months agovxworks: fix gthr visibility issues
Alexandre Oliva [Wed, 25 Mar 2026 09:45:47 +0000 (06:45 -0300)] 
vxworks: fix gthr visibility issues

xtreme-header-8.C fails on VxWorks because various TU-local gthr
functions defined as static inline are referenced from libstdc++
symbols with global visibility.

C++ modules require those functions to be non-static inline, and other
gthr implementations adopt always_inline in C++.

Follow this practice in gthr-vxworks.h as well.

for  libgcc/ChangeLog

* config/gthr-vxworks.h (__GTHREAD_ALWAYS_INLINE,
__GTHREAD_INLINE): Copy from gthr-posix.h.  Replace static
inline with __GTHREAD_INLINE.

2 months agotestsuite: vxworks: gcov-32 misuses sigjmp_buf with setjmp
Alexandre Oliva [Wed, 25 Mar 2026 09:45:43 +0000 (06:45 -0300)] 
testsuite: vxworks: gcov-32 misuses sigjmp_buf with setjmp

The test (presumably by mistake) calls setjmp with a sigjmp_buf.

Because of the sigsetjmp requirement, I'm replacing the setjmp call
with sigsetjmp, though the comments in the test explicitly mention
setjmp.

for  gcc/testsuite/ChangeLog

* gcc.misc-tests/gcov-32.c: Replace mismatched setjmp call
with sigsetjmp.

2 months agotestsuite: arm: pr115485 requires fpic
Alexandre Oliva [Wed, 25 Mar 2026 09:45:38 +0000 (06:45 -0300)] 
testsuite: arm: pr115485 requires fpic

This C++ test uses -fPIE without checking for PIC support.  Add it.

for  gcc/testsuite/ChangeLog

* g++.target/arm/pr115485.C: Require fpic.

2 months ago[testsuite] [vxworks] add -gno-strict-dwarf to pr111409.c
Alexandre Oliva [Wed, 25 Mar 2026 09:45:35 +0000 (06:45 -0300)] 
[testsuite] [vxworks] add -gno-strict-dwarf to pr111409.c

The expected macro debug information is not issued with
-gstrict-dwarf, and ports such as vxworks default to that.  Allow
non-strict dwarf for the test.

pr115066.c needs the same problem adjustment.

for  gcc/testsuite/ChangeLog

* gcc.dg/pr111409.c: Allow non-strict dwarf.
* gcc.dg/pr115066.c: Likewise.

2 months agotestsuite: arm: add -mno-long-calls to epilog-1
Alexandre Oliva [Wed, 25 Mar 2026 09:45:30 +0000 (06:45 -0300)] 
testsuite: arm: add -mno-long-calls to epilog-1

ARM test epilog-1.c needs -mno-long-calls to match the expected asm
outputs on targets that default to -mlong-calls.

for  gcc/testsuite/ChangeLog

* gcc.target/arm/epilog-1.c: Add -mno-long-calls.

2 months agotestsuite: vect: slp-mask-store-1 accesses past the end of flags
Alexandre Oliva [Wed, 25 Mar 2026 09:45:25 +0000 (06:45 -0300)] 
testsuite: vect: slp-mask-store-1 accesses past the end of flags

The loop invokes undefined behavior: the flags array runs 0..31, but
so does the iterator i, thus the accesses to pairs therein run 0..63.
If we're lucky we find all zeros and don't mess with anything else,
but if we find any nonzero out-of-range flags, we'll end up scribbling
out of range onto x, that runs 0..15.

Surely the iterator wasn't meant to go up to 32.  If it goes up to 16,
as proposed herein, we only access flags in range, and since its
second half is all zeros, we only access x in range as well.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/slp-mask-store-1.c (foo): Fix iteration range.

2 months agolibstdc++-v3: testsuite: lengthen stop_request wait_until timeout
Alexandre Oliva [Wed, 25 Mar 2026 09:45:19 +0000 (06:45 -0300)] 
libstdc++-v3: testsuite: lengthen stop_request wait_until timeout

30_threads/condition_variable_any/stop_token/wait_on.cc's
test_wait_until occasionally fails on vxworks under very high load, in
a way that suggests wait_until times out before the main thread
requests it to stop.  Extend the timeouts to make more room for the
stop request.

for  libstdc++-v3/ChangeLog

* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc
(test_wait_until): Extend the timeout for a stop request.

2 months ago[testsuite] require sysconf for vect-early-break_109-pr113588.c
Alexandre Oliva [Wed, 25 Mar 2026 09:45:14 +0000 (06:45 -0300)] 
[testsuite] require sysconf for vect-early-break_109-pr113588.c

The test calls sysconf but it doesn't require it as it should.

vect-early-break_130.c needs that treatment as well.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/vect-early-break_109-pr113588.c: Require sysconf.
* gcc.dg/vect/vect-early-break_130.c: Likewise.

2 months ago[testsuite] [ppc] expect vectorization in gen-vect-11c.c with lp64
Alexandre Oliva [Wed, 25 Mar 2026 09:45:09 +0000 (06:45 -0300)] 
[testsuite] [ppc] expect vectorization in gen-vect-11c.c with lp64

The first loop in main gets stores "vectorized" on powerpc64 into
full-word stores, even without any vector instruction support, so the
test's expectation of no loop vectorization is not met.

for  gcc/testsuite/ChangeLog

* gcc.dg/tree-ssa/gen-vect-11c.c: xfail the test for no
vectorization on powerpc*-*-* && lp64.

2 months agotestsuite: vect: adjust vect-early-break_137-pr121190
Alexandre Oliva [Wed, 25 Mar 2026 09:45:04 +0000 (06:45 -0300)] 
testsuite: vect: adjust vect-early-break_137-pr121190

The test needs to require sysconf for _SC_PAGESIZE, and it shouldn't
override the vect.exp-set vect-enabling options by using dg-options.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/vect-early-break_137-pr121190.c: Require sysconf.
Don't override vect.exp options.

2 months agotestsuite: vxworks: xfail thread_local-order2 execution
Alexandre Oliva [Wed, 25 Mar 2026 09:44:59 +0000 (06:44 -0300)] 
testsuite: vxworks: xfail thread_local-order2 execution

VxWorks doesn't support __cxa_thread_atexit, so XFAIL the test that
relies on it for correct destruction order of thread-local objects.

for  gcc/testsuite/ChangeLog

* g++.dg/tls/thread_local-order2.C: XFAIL on VxWorks.

2 months agoc++: arm -Wdeprecated fails for ctors
Alexandre Oliva [Wed, 25 Mar 2026 09:44:55 +0000 (06:44 -0300)] 
c++: arm -Wdeprecated fails for ctors

ARM requires C++ constructors to return the 'this' pointer.  Setting
that up disables warnings at the ctor location for Wuse_after_free.
Unfortunately, the nowarn_spec_t mapping maps both Wuse_after_free and
Wdeprecated_declaration to the same NW_OTHER catchall group, so we
don't get deprecation warnings for constructors, and libstdc++'s
20_util/pair/cons/99957.cc fails.

We may want to consider also explicitly mapping Wdeprecated and
Wdeprecated_declaration to another group, but this minimal change
appears to be enough.

for  gcc/ChangeLog

* gcc-diagnostic-spec.cc (nowarn_spec_t::nowarn_spec_t): Map
OPT_Wuse_after_free like OPT_Wuse_after_free_.

2 months agoFortran: Invalid error in bounds check of elemental dim [PR119273]
Paul Thomas [Wed, 25 Mar 2026 09:28:15 +0000 (09:28 +0000)] 
Fortran: Invalid error in bounds check of elemental dim [PR119273]

2026-03-25  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/119273
* trans-array.cc (expr_contains_impure_fcn): New function.
(gfc_expr_contains_impure_fcn): New function calling above fcn.
(array_bound_check_elemental): Add indexse pre-block to se pre.
Warn if the index expression contains a function not declared
to be pure.

gcc/testsuite/
PR fortran/119273
* gfortran.dg/pr119273.f90: New test.

2 months agoi386: Fix gcc.target/i386/pr61599-1.c on Solaris/x86
Rainer Orth [Wed, 25 Mar 2026 08:44:54 +0000 (09:44 +0100)] 
i386: Fix gcc.target/i386/pr61599-1.c on Solaris/x86

The gcc.target/i386/pr61599-1.c test has been FAILing on Solaris/x86
with the native assembler for a long time:

FAIL: gcc.target/i386/pr61599-1.c (test for excess errors)
UNRESOLVED: gcc.target/i386/pr61599-1.c compilation failed to produce executable

Excess errors:
ld: fatal: relocation error: R_AMD64_PC32: file gcc/amd64/crtbegin.o: symbol completed.0: value 0xc01004b9 does not fit
ld: fatal: relocation error: R_AMD64_PC32: file gcc/amd64/crtbegin.o: symbol completed.0: value 0xc01004a7 does not fit

Looking closer, pr61599-1.o is 3.1 GB large with the native assembler.
Comparing the section headers between as and gas, one sees the difference:

With as there's

Section Header[3]:  sh_name: .lbss.a
    sh_addr:      0                   sh_flags:   [ SHF_WRITE SHF_ALLOC ]
    sh_size:      0x40000000          sh_type:    [ SHT_PROGBITS ]

while gas creates

Section Header[5]:  sh_name: .lbss.a
    sh_addr:      0                   sh_flags:   [ SHF_WRITE SHF_ALLOC SHF_AMD6
4_LARGE ]

    sh_size:      0x40000000          sh_type:    [ SHT_NOBITS ]

The use of SHT_PROGBITS by as is due to gcc not emitting @nobits for the
.lbss sections, so as uses the default section type:

.section .lbss.a,"aw"

For .bss, we get this instead:

.section .bss.a,"aw",@nobits

as usually doesn't care about section names, but relies on the compiler
to correctly emit section types and flags.

This happens because x86_64_elf_section_type_flags first calls
default_section_type_flags, which doesn't know about .lbss and sets
SECTION_NOTYPE.  When default_elf_asm_named_section later emits the
.section directive, @nobits is omitted even though SECTION_BSS has been
added by then.

To work around this, this patch clears SECTION_NOTYPE when SECTION_BSS
is set.

Similarly, the current assembler output relies on the assembler to set
the SHF_X86_64_LARGE section flag based on the section name.  While gcc
emits the necessary flag letter ('l' with gas, 'h' with Solaris as) for
plain .lbss sections, it fails to do so for .lbss.*.

This patch adresses this by moving the gas definition of
MACH_DEP_SECTION_ASM_FLAG to i386/x86_64.h so it's picked up by all
64-bit x86 targets.  It also extends ix86_in_large_data_p to also
consider .lbss.* etc. sections as large data sections, not just .lbss,
matching x86_64_elf_section_type_flags.

pr61599-1.o is identical without and with the section letter and section
type specifiec.

Bootstrapped without regressions on i386-pc-solaris2.11,
amd64-pc-solaris2.11, x86_64-pc-linux-gnu, and i686-pc-linux-gnu.

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

gcc:
* config/i386/i386.cc (ix86_in_large_data_p): Check for .lbss etc.
(x86_64_elf_section_type_flags): Clear SECTION_NOTYPE for .lbss etc.
* config/i386/x86-64.h (MACH_DEP_SECTION_ASM_FLAG): Define.
* config/i386/sol2.h [HAVE_SOLARIS_AS]
(MACH_DEP_SECTION_ASM_FLAG): Redefine as 'h'.

gcc/testsuite:
* gcc.target/i386/pr61599-1.c (dg-options): Add -save-temps.
(scan-assembler-times): Check for @nobits.

2 months ago[PATCH] Use next_speculative_call_target in get_next_speculative_id
Kugan Vivekanandarajah [Wed, 25 Mar 2026 07:25:16 +0000 (18:25 +1100)] 
[PATCH] Use next_speculative_call_target in get_next_speculative_id

This patch uses next_speculative_call_target in get_next_speculative_id
As the specualtive_id should be unique only within on speculative id
block.

gcc/ChangeLog:

* cgraph.cc (cgraph_edge::get_next_speculative_id): Use
next_speculative_call_target in get_next_speculative_id.

Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
2 months agoDaily bump.
GCC Administrator [Wed, 25 Mar 2026 00:16:24 +0000 (00:16 +0000)] 
Daily bump.

2 months ago[PR124572, LRA]: Deal with generation of reload insns during elimination
Vladimir N. Makarov [Tue, 24 Mar 2026 13:05:59 +0000 (09:05 -0400)] 
[PR124572, LRA]: Deal with generation of reload insns during elimination

It was assumed that elimination in LRA does not generate new reload
insns.  In the testcase the elimination of SFP subreg generates reload
insn of the subreg and this insn is added at end of RTL code.  The insn
is also skipped for necessary processing.  This results in ICE.  The patch
checks creation of reloads insn during elimination, insert them in the right
place, and add them for later processing.

gcc/ChangeLog:

PR rtl-optimization/124572
* lra-eliminations.cc (lra_eliminate): Push new reload insns for
eliminations in insns.

gcc/testsuite/ChangeLog:

PR rtl-optimization/124572
* gcc.target/aarch64/pr124572.c: New.

2 months agotestsuite: Only xfail g++.dg/coroutines/pr110872.C on 64-bit targets [PR124326]
Rainer Orth [Tue, 24 Mar 2026 15:46:20 +0000 (16:46 +0100)] 
testsuite: Only xfail g++.dg/coroutines/pr110872.C on 64-bit targets [PR124326]

The g++.dg/coroutines/pr110872.C test XPASSes on many 32-bit targets:

XPASS: g++.dg/coroutines/pr110872.C  -std=c++26 (internal compiler error)

Darwin/x86 is the exception where the test ICEs for both 32 and 64-bit.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
x86_64-apple-darwin17.7.0, and x86_64-pc-linux-gnu.

2026-03-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR testsuite/124326
* g++.dg/coroutines/pr110872.C (dg-ice): Restrict to 64-bit
targets or Darwin.

2 months agotestsuite: Fix g++.dg/warn/Wstringop-overflow-6.C on Solaris [PR123135]
Rainer Orth [Tue, 24 Mar 2026 15:43:16 +0000 (16:43 +0100)] 
testsuite: Fix g++.dg/warn/Wstringop-overflow-6.C on Solaris [PR123135]

The g++.dg/warn/Wstringop-overflow-6.C test FAILs on Solaris:

FAIL: g++.dg/warn/Wstringop-overflow-6.C  -std=gnu++11 (test for excess errors)

with

Excess errors:
/usr/include/iso/math_c99.h:361: warning: ignoring '#pragma does_not_read_global_data ' [-Wunknown-pragmas]

and

/usr/include/errno.h:93: warning: ignoring '#pragma no_side_effect ' [-Wunknown-pragmas]

Those pragmas are specific to the Studio compilers but unrelated to the
testcase, so this patch disables the warnings on Solaris.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and
x86_64-pc-linux-gnu.

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

gcc/testsuite:
PR testsuite/123135
* g++.dg/warn/Wstringop-overflow-6.C (dg-additional-options): Add
-Wno-unknown-pragmas on Solaris.

2 months agolibgomp: Fix libgomp.fortran/uses_allocators-7.f90 [PR123177]
Rainer Orth [Tue, 24 Mar 2026 15:40:12 +0000 (16:40 +0100)] 
libgomp: Fix libgomp.fortran/uses_allocators-7.f90 [PR123177]

The libgomp.fortran/uses_allocators-7.f90 test has been UNRESOLVED from
the beginning:

UNRESOLVED: libgomp.fortran/uses_allocators-7.f90   -O  compilation failed to produce executable

The compilation is expected to fail, so this must be changed into a
compile test.

Tested on i386-pc-solaris2.11.

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

libgomp:
PR libgomp/123177
* testsuite/libgomp.fortran/uses_allocators-7.f90: Change to
compile test.
(dg-message): Adjust line numbers.
(dg-bogus): Likewise.

2 months agotestsuite: add -fno-short-enums to have predictable mangling
Torbjörn SVENSSON [Tue, 24 Mar 2026 12:31:42 +0000 (13:31 +0100)] 
testsuite: add -fno-short-enums to have predictable mangling

Without -fno-short-enums, some targets might have a different size for
enums than regular `int`, resulting in unpredictable name mangling.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/mangle1.C: Add -fno-short-enums.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agotestsuite: add require effective target fopenmp to modules/omp-4_*.C
Torbjörn SVENSSON [Tue, 24 Mar 2026 12:59:12 +0000 (13:59 +0100)] 
testsuite: add require effective target fopenmp to modules/omp-4_*.C

gcc/testsuite/ChangeLog:

* g++.dg/modules/omp-4_a.C: Add missing require effective target
fopenmp.
* g++.dg/modules/omp-4_b.C: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agodoc: Fix 'RTL SSA Access Lists' description
Christopher Bazley [Tue, 24 Mar 2026 11:40:50 +0000 (11:40 +0000)] 
doc: Fix 'RTL SSA Access Lists' description

In the 'RTL SSA Access Lists' subsection of
GCC's documentation, an example of code with
an 'if'...'else' structure is given. The
given list of the full list of accesses is
said to include "use of the ebb4's R phi
definition of R by B". That cannot be true
because B is in the first substatement of the
'if' statement, whereas ebb4 is the second
substatement. First and second substatements
are mutually exclusive: there is no path to
B that goes through the degenerate phi node
of ebb4.

It looks as though D was intended, not B.

gcc/ChangeLog:

* doc/rtl.texi: Fix example of the SSA form.

2 months agovect: Move previously unreachable strided access guard.
Alfie Richards [Tue, 24 Mar 2026 11:01:37 +0000 (11:01 +0000)] 
vect: Move previously unreachable strided access guard.

Previously code for the error message about VMAT_ELEMENTWISE and
VMAT_STRIDED_SLP could never be reached because it was dominated by
the logic for the unsupported access type for masked load.

This change reverses the two checks so that the more specific case
comes first.

gcc/ChangeLog:

* tree-vect-stmts.cc (vectorizable_load): Swap order of failure
message checks.

2 months agotestsuite: add require effective target fopenmp to pr124454-1.c
Torbjörn SVENSSON [Tue, 24 Mar 2026 09:28:45 +0000 (10:28 +0100)] 
testsuite: add require effective target fopenmp to pr124454-1.c

gcc/testsuite/ChangeLog:

* gcc.dg/pr124454-1.c: Add missing require effective target
fopenmp.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agoc: Mark derived types variably-modified after struct/union completion [PR123424]
Martin Uecker [Sat, 7 Mar 2026 15:28:00 +0000 (16:28 +0100)] 
c: Mark derived types variably-modified after struct/union completion [PR123424]

When structure types are completed and are variably-modified, we
need to make sure that C_TYPE_VARIABLY_MODIFIED is updated also
for derived types.  For derived types which are not updated and
remain TYPE_STRUCTURAL_EQUALITY_P, we do recursion when checking
the bit instead.  This change then fixes also a weird corner
case when forming composite types of mutually recursively
defined types.

We do not update other structure or union type that end up
with variably modified pointers, as it is not clear this is
needed and also needs further analysis.

PR c/123424

gcc/c/ChangeLog:
* c-decl.cc (c_update_variably_modified): New function.
(finish_struct): Call c_update_variably_modified.
* c-tree.h (c_variably_modified_p): Recurse if necessary.
* c-typeck.cc (c_verify_type): Update.
(c_set_type_bits): Use c_variably_modified_p.
(mark_decl_used): Dito.
(build_function_call_vec): Dito.
(c_build_qualified_type): Dito.
* c-objc-common.cc (c_var_p): Dito.

gcc/testsuite/ChangeLog:
* gcc.dg/gnu23-tag-composite-7.c: New test.
* gcc.dg/gnu23-varmod-3.c: New test.
* gcc.dg/pr123424.c: New test.

2 months agoDaily bump.
GCC Administrator [Tue, 24 Mar 2026 00:16:23 +0000 (00:16 +0000)] 
Daily bump.

2 months agoAda: Fix crash on instantiation in separate package body
Eric Botcazou [Mon, 23 Mar 2026 21:01:52 +0000 (22:01 +0100)] 
Ada: Fix crash on instantiation in separate package body

This is an old regression present on all active branches for a quite unusual
setup where a generic package is declared and instantiated in a subunit, and
which comes from a thinko in the Has_Body.Find_Body routine of Sem_Elab.

gcc/ada/
PR ada/124607
* sem_elab.adb (Has_Body.Find_Body): Fix thinko.

gcc/testsuite/
* gnat.dg/generic_inst20.ads, gnat.dg/generic_inst20.adb: New test.
* gnat.dg/generic_inst20-sub.adb: New helper.

2 months agoAda: Fix instantiation failure with formal array type after formal package
Eric Botcazou [Mon, 23 Mar 2026 20:48:52 +0000 (21:48 +0100)] 
Ada: Fix instantiation failure with formal array type after formal package

This comes from a confusion in the mapping maintained between formal and
actual parameters of the instantiation caused by the equivalent mapping
maintained for the instantiation of the formal package.  The change just
removes the offending lines, which do not seem to serve any useful purpose.

gcc/ada/
PR ada/124606
* sem_ch12.adb (Find_Actual_Type): Rename formal parameter.
(Map_Formal_Package_Entities): Do not register base types.

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

2 months agoUpdate gcc sv.po
Joseph Myers [Mon, 23 Mar 2026 20:36:32 +0000 (20:36 +0000)] 
Update gcc sv.po

* sv.po: Update.

2 months agogcc: Fix "uselful" and "directivers" typos in comment
Stefan Weigl-Bosker [Wed, 4 Mar 2026 23:51:51 +0000 (18:51 -0500)] 
gcc: Fix "uselful" and "directivers" typos in comment

gcc/ChangeLog:

* omp-general.h: Fix typos.

2 months agotree-optimization/124599 - compile-time regression with PRE
Richard Biener [Mon, 23 Mar 2026 09:51:00 +0000 (10:51 +0100)] 
tree-optimization/124599 - compile-time regression with PRE

The following fixes the reported compile-time regression after the
PRE change to properly track reference expressions in r16-8128-g5f1024922d3f67.
The issue is that the VN reference lookup code performs alias walks and
those are made quadratic for the transition from one VUSE to another
when that involves multiple translation steps.  The error was to make
the VUSE part of the expression, but it is really part of the value.
So the following patch reverts this change, fixing the issue.

PR tree-optimization/124599
* tree-ssa-pre.cc (compute_avail): Make the VUSE in the
PRE reference expression part of the value again.
(phi_translate_1): Likewise.

2 months agoconfigure: Further {gas,gnu_ld}{,_flag} fixes [PR124547]
Jakub Jelinek [Mon, 23 Mar 2026 11:10:02 +0000 (12:10 +0100)] 
configure: Further {gas,gnu_ld}{,_flag} fixes [PR124547]

Andreas mentioned in the PR that {gas,gnu_ld}_flag vars should be only
ever used in configure.ac before . config.gcc and I agree with that.
config.gcc initializes the {gas,gnu_ld} vars to {gas,gnu_ld}_flag, then
for some triplets has gas=yes and/or gnu_ld=yes and in some rare cases
(for targets which basically require people to use --with{,out}-gnu-{as,ld})
x$gas = xyes/x$gnu_ld = xyes/x$gas != xyes/x$gnu_ld != xyes tests.

So, the following patch uses just what comes up from config.gcc from that
point onward (so, the user requested setting (which can be now empty if
unknown) possibly overridden by triplet).  With the exception of solaris
(which does what it did before PR124547, i.e. always probe linker and
assembler) and the fallback case of checking gas/ld version if still unset
(but that in this patch only affects targets which don't override it
by triplet, i.e. targets which typically have a choice between GNU binutils
and some proprietary ones).

2026-03-23  Jakub Jelinek  <jakub@redhat.com>

PR bootstrap/124547
* configure.ac: After config.gcc inclusion use or set only gas instead
of gas_flag and gnu_ld instead of gnu_ld_flag.
* config.gcc: Document possibility of gas_flag or gnu_ld_flag being
empty.
* acinclude.m4 (gcc_GAS_FLAGS): Use gas instead of gas_flag.
(gcc_AC_INITFINI_ARRAY): Likewise.  Use gnu_ld instead of gnu_ld_flag.
* configure: Regenerate.

2 months agoa68: fix typo in ga8-coding-guidelines.texi
Jose E. Marchesi [Mon, 23 Mar 2026 00:29:22 +0000 (01:29 +0100)] 
a68: fix typo in ga8-coding-guidelines.texi

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

* ga68-coding-guidelines.texi (Comments): Fix typo.

2 months agoDaily bump.
GCC Administrator [Mon, 23 Mar 2026 00:16:21 +0000 (00:16 +0000)] 
Daily bump.

2 months agofortran: Replace large structs as function parameters by references [PR124259]
Harald Anlauf [Sun, 22 Mar 2026 20:58:37 +0000 (21:58 +0100)] 
fortran: Replace large structs as function parameters by references [PR124259]

Large structs passed by value as function parameters can be replaced by
const references to improve performance.

PR fortran/124259

gcc/fortran/ChangeLog:

* target-memory.cc (gfc_merge_initializers): Change struct
gfc_typespec argument into a const reference.
* target-memory.h (gfc_merge_initializers): Adjust prototype.
* trans.cc (gfc_finalize_tree_expr): Change struct symbol_attribute
argument into a const reference.
* trans.h (gfc_finalize_tree_expr): Adjust prototype.

2 months agolibgfortran: Disable caf_shmem without usable process-shared pthreads [PR124512]
Christopher Albert [Fri, 20 Mar 2026 22:09:26 +0000 (23:09 +0100)] 
libgfortran: Disable caf_shmem without usable process-shared pthreads [PR124512]

Use a compile-time usability probe for the process-shared pthread API
required by caf_shmem and only build libcaf_shmem when that probe succeeds.

caf_shmem needs process-shared pthread primitives that are visible through
the default pthread headers.  AX_PTHREAD already established the baseline
pthread flags; this additional check only verifies that the specific
process-shared API surface is usable for caf/shmem/thread_support.c.

PR fortran/124512

libgfortran/ChangeLog:

* Makefile.am: Adjust the dependencies.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add new check.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 months agox86/testsuite: Add testcase for eh and va_end [PR124597]
Andrew Pinski [Sat, 21 Mar 2026 20:25:22 +0000 (13:25 -0700)] 
x86/testsuite: Add testcase for eh and va_end [PR124597]

This adds the testcase for the eh edge removal with va_end folding.

PR target/124597

gcc/testsuite/ChangeLog:

* g++.target/pr124597.C: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agox86: Mark the x86 va_builtins as nothrow and leaf [PR124597]
Andrew Pinski [Sat, 21 Mar 2026 19:37:24 +0000 (12:37 -0700)] 
x86: Mark the x86 va_builtins as nothrow and leaf [PR124597]

So all of the va_builtins are marked as nothrow and leaf but
the x86 backend builds the va builtins without this.
This causes both missed optimizations and in some cases
more work needs to be done by the middle-end handling of
these builtins.
This marks all of the x86 va builtins function decls as both
nothrow and leaf.

Bootstrapped and tested on x86_64-linux-gnu.

PR target/124597

gcc/ChangeLog:

* config/i386/i386-builtins.cc (ix86_init_builtins_va_builtins_abi):
Also add nothrow and leaf attributes to the va builtins.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agogimple-fold: Fix folding of va_end with maybe throw builtin [PR124597]
Andrew Pinski [Sat, 21 Mar 2026 20:16:17 +0000 (13:16 -0700)] 
gimple-fold: Fix folding of va_end with maybe throw builtin [PR124597]

The problem here is when we are replacing the va_end with a GIMPLE_NOP,
gsi_replace is being called with true for updating the eh information.
This was a mistake; for most case this worked but with x86 backend
creating a function decl without nothrow on the VA_END, this caused
problems of not removing eh edge after removing the call. (The
x86 backend change is submitted in a different patch).

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/124597

gcc/ChangeLog:

* gimple-fold.cc (gimple_fold_builtin_stdarg): Correct the
eh_update argument to gsi_replace for the VA_END case.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agoDaily bump.
GCC Administrator [Sun, 22 Mar 2026 00:16:21 +0000 (00:16 +0000)] 
Daily bump.

3 months agosh: Fix modes on if_then_else [PR123852]
Andrew Pinski [Sat, 21 Mar 2026 22:15:07 +0000 (15:15 -0700)] 
sh: Fix modes on if_then_else [PR123852]

Inside the machine description of the sh target,
there are some modes missing on if_then_else rtl. This
causes an ICE during the vartrack pass where it is
creating a simplifying a subreg of that rtl.
This worked before r16-3067-g8e3239e3e92f3c where
simplify_gen_subreg would return NULL RTL on the
case where the mode was VOIDmode.
Anyways this is the obvious patch which adds the modes
on the if_then_else and now fixes the Ada and algol68
building (and some other code).

Tested by Doko on sh-linux-gnu and the Ada and algol68
langauges enabled.
Pushed as obvious.

PR target/123852

gcc/ChangeLog:

* config/sh/sh.md (movsicc_t_false): Add the SImode
on the if_then_else.
(movsicc_t_true): Likewise.
(negsi_cond): Likewise.
(negdi_cond): Add the DImode on the if_then_else.
(bst_m2a): Add the QImode on the if_then_else.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agoa68: avoid libga68 dependency on libm
Jose E. Marchesi [Sat, 21 Mar 2026 12:20:36 +0000 (13:20 +0100)] 
a68: avoid libga68 dependency on libm

Using some of the operators and routines in the standard prelude lead
to a dependency on standard system math routines, usually available in
libm.  This is the case for sin, cos, etc.

If no such operator/routine is used by the user program, however, the
dependency should not be there.  We recently implemented some parts of
libga68 in Algol 68, and these use the entier operator.  Using this
operator drags in a dependency on floor, floorf and floorl via some
GCC built-ins.

This patch adds the gnulib implementation of floor, floorl and floorf
to libga68.

Tested in x86_64-pc-linux-gnu, in both -m64 and -m32 modes.
Tested in i686-pc-linux-gnu.

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

* ga68-math.c: New file.
* floor.c: Imported from gnulib.
* configure.ac: Do not check for libm.
* Makefile.am (libga68_la_SOURCES): Add ga68-match.c.
* Makefile.in (am_libga68_la_OBJECTS): Regenerate.
* configure (ac_res): Likewise.

3 months agolibstdc++: Implement [simd] for C++26
Matthias Kretz [Wed, 11 Feb 2026 14:19:17 +0000 (15:19 +0100)] 
libstdc++: Implement [simd] for C++26

This implementation differs significantly from the
std::experimental::simd implementation. One goal was a reduction in
template instantiations wrt. what std::experimental::simd did.

Design notes:

- bits/vec_ops.h contains concepts, traits, and functions for working
  with GNU vector builtins that are mostly independent from std::simd.
  These could move from std::simd:: to std::__vec (or similar). However,
  we would then need to revisit naming. For now we kept everything in
  the std::simd namespace with __vec_ prefix in the names. The __vec_*
  functions can be called unqualified because they can never be called
  on user-defined types (no ADL). If we ever get simd<UDT> support this
  will be implemented via bit_cast to/from integral vector
  builtins/intrinsics.

- bits/simd_x86.h extends vec_ops.h with calls to __builtin_ia32_* that
  can only be used after uttering the right GCC target pragma.

- basic_vec and basic_mask are built on top of register-size GNU vector
  builtins (for now / x86). Any larger vec/mask is a tree of power-of-2
  #elements on the "first" branch. Anything non-power-of-2 that is
  smaller than register size uses padding elements that participate in
  element-wise operations. The library ensures that padding elements
  lead to no side effects. The implementation makes no assumption on the
  values of these padding elements since the user can bit_cast to
  basic_vec/basic_mask.

Implementation status:

- The implementation is prepared for more than x86 but is x86-only for
  now.

- Parts of [simd] *not* implemented in this patch:

  - std::complex<floating-point> as vectorizable types
  - [simd.permute.dynamic]
  - [simd.permute.mask]
  - [simd.permute.memory]
  - [simd.bit]
  - [simd.math]
  - mixed operations with vec-mask and bit-mask types
  - some conversion optimizations (open questions wrt. missed
    optimizations in the compiler)

- This patch implements P3844R3 "Restore simd::vec broadcast from int",
  which is not part of the C++26 WD draft yet. If the paper does not get
  accepted the feature will be reverted.

- This patch implements D4042R0 "incorrect cast between simd::vec and
simd::mask via conversion to and from impl-defined vector types" (to be
published once the reported LWG issue gets a number).

- The standard feature test macro __cpp_lib_simd is not defined yet.

Tests:

- Full coverage requires testing
  1. constexpr,
  2. constant-propagating inputs, and
  3. unknown (to the optimizer) inputs
  - for all vectorizable types
  * for every supported width (1–64 and higher)
  + for all possible ISA extensions (combinations)
  = with different fast-math flags
  ... leading to a test matrix that's far out of reach for regular
  testsuite builds.

- The tests in testsuite/std/simd/ try to cover all of the API. The
  tests can be build in every combination listed above. Per default only
  a small subset is built and tested.

- Use GCC_TEST_RUN_EXPENSIVE=something to compile the more expensive
  tests (constexpr and const-prop testing) and to enable more /
  different widths for the test type.

- Tests can still emit bogus -Wpsabi warnings (see PR98734) which are
  filtered out via dg-prune-output.

Benchmarks:

- The current implementation has been benchmarked in some aspects on
  x86_64 hardware. There is more optimization potential. However, it is
  not always clear whether optimizations should be part of the library
  if they can be implemented in the compiler.

- No benchmark code is included in this patch.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Add simd headers.
* include/Makefile.in: Regenerate.
* include/bits/version.def (simd): New.
* include/bits/version.h: Regenerate.
* include/bits/simd_alg.h: New file.
* include/bits/simd_details.h: New file.
* include/bits/simd_flags.h: New file.
* include/bits/simd_iterator.h: New file.
* include/bits/simd_loadstore.h: New file.
* include/bits/simd_mask.h: New file.
* include/bits/simd_mask_reductions.h: New file.
* include/bits/simd_reductions.h: New file.
* include/bits/simd_vec.h: New file.
* include/bits/simd_x86.h: New file.
* include/bits/vec_ops.h: New file.
* include/std/simd: New file.
* testsuite/std/simd/arithmetic.cc: New test.
* testsuite/std/simd/arithmetic_expensive.cc: New test.
* testsuite/std/simd/create_tests.h: New file.
* testsuite/std/simd/creation.cc: New test.
* testsuite/std/simd/creation_expensive.cc: New test.
* testsuite/std/simd/loads.cc: New test.
* testsuite/std/simd/loads_expensive.cc: New test.
* testsuite/std/simd/mask2.cc: New test.
* testsuite/std/simd/mask2_expensive.cc: New test.
* testsuite/std/simd/mask.cc: New test.
* testsuite/std/simd/mask_expensive.cc: New test.
* testsuite/std/simd/reductions.cc: New test.
* testsuite/std/simd/reductions_expensive.cc: New test.
* testsuite/std/simd/shift_left.cc: New test.
* testsuite/std/simd/shift_left_expensive.cc: New test.
* testsuite/std/simd/shift_right.cc: New test.
* testsuite/std/simd/shift_right_expensive.cc: New test.
* testsuite/std/simd/simd_alg.cc: New test.
* testsuite/std/simd/simd_alg_expensive.cc: New test.
* testsuite/std/simd/sse_intrin.cc: New test.
* testsuite/std/simd/stores.cc: New test.
* testsuite/std/simd/stores_expensive.cc: New test.
* testsuite/std/simd/test_setup.h: New file.
* testsuite/std/simd/traits_common.cc: New test.
* testsuite/std/simd/traits_impl.cc: New test.
* testsuite/std/simd/traits_math.cc: New test.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
3 months agoc++/modules: Support section attributes [PR122786]
Nathaniel Shead [Thu, 19 Mar 2026 11:58:11 +0000 (22:58 +1100)] 
c++/modules: Support section attributes [PR122786]

This is a minimal fix to not just silently drop the section attribute on
stream-in.  Ideally we should be using cplus_decl_attributes for this,
but it's not yet ready for modules (many attributes behave weirdly when
applied not during parsing).  We should also be checking for
incompatible sections on stream-in in is_matching_decl, but that would
also be better handled more generally so I'm leaving that out of this
patch.

Instead this minimally fixes the issue by just re-applying the section
name from the attributes we've streamed in.

PR c++/122786

gcc/cp/ChangeLog:

* module.cc (trees_in::decl_value): Set section name from
attribute.

gcc/testsuite/ChangeLog:

* g++.dg/modules/attrib-5_a.C: New test.
* g++.dg/modules/attrib-5_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/modules: Handle maybe_unused on PARM_DECLs [PR124483]
Nathaniel Shead [Thu, 19 Mar 2026 11:56:20 +0000 (22:56 +1100)] 
c++/modules: Handle maybe_unused on PARM_DECLs [PR124483]

The [[maybe_unused]] attribute works by marking relevant entities as
TREE_USED, and DECL_READ_P for vars and parms.  But modules streaming
typically clears this flag unless reading a definition.  This patch sets
it back again when we see this attribute applied to a parameter.

PR c++/124483

gcc/cp/ChangeLog:

* module.cc (trees_in::fn_parms_init): Set TREE_USED and
DECL_READ_P for parameters deliberately marked unused.

gcc/testsuite/ChangeLog:

* g++.dg/modules/attrib-4_a.C: New test.
* g++.dg/modules/attrib-4_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoDaily bump.
GCC Administrator [Sat, 21 Mar 2026 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

3 months agoopenmp: sorry instead of ICE for unimplemented mapper with iterator [PR122866]
Tobias Burnus [Thu, 19 Mar 2026 22:55:56 +0000 (22:55 +0000)] 
openmp: sorry instead of ICE for unimplemented mapper with iterator [PR122866]

Support for iterators on mapper functions is an OpenMP 5.2
feature that is not implemented yet.  Presently attempting to use
this feature results in an ICE; let's make it a more user-friendly
"sorry" until we get around to implementing this.

gcc/ChangeLog
PR c/122866
* gimplify.cc (omp_instantiate_mapper): Give a sorry if there are
iterators.

gcc/testsuite/ChangeLog
PR c/122866
* c-c++-common/gomp/pr122866.c: New.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
3 months agolibgomp: Fix missing "target exit data" support for iterators
Tobias Burnus [Tue, 17 Mar 2026 01:07:30 +0000 (01:07 +0000)] 
libgomp: Fix missing "target exit data" support for iterators

libgomp/ChangeLog
* target.c (gomp_exit_data): Handle iterators.
* testsuite/libgomp.c-c++-common/target-enter-data-iterators-1.c: New.
* testsuite/libgomp.c-c++-common/target-update-iterators-2.c:
Also test "target exit data".
* testsuite/libgomp.c-c++-common/target-update-iterators-3.c:
Likewise.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
3 months agoopenmp: Fix ICE with "target data" and iterators
Kwok Cheung Yeung [Thu, 29 Jan 2026 16:51:32 +0000 (16:51 +0000)] 
openmp: Fix ICE with "target data" and iterators

gimplify_omp_workshare() correctly handles iterators in the "target"
construct but missed the very similar case for "target data", causing
an ICE.

gcc/ChangeLog
* gimplify.cc (gimplify_omp_workshare): Handle iterators in
"target data".

gcc/testsuite/ChangeLog
* c-c++-common/gomp/target-map-iterators-6.c: New.

libgomp/ChangeLog
* testsuite/libgomp.c-c++-common/target-data-iterators-1.c: New.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
3 months agoAda: Fix interaction between overloading and types with implicit dereference
Eric Botcazou [Fri, 20 Mar 2026 21:18:54 +0000 (22:18 +0100)] 
Ada: Fix interaction between overloading and types with implicit dereference

The overall strategy for types declared with implicit dereference is to add
two interpretations for every name, the direct one and the one corresponding
to the generalized reference.  But the two interpretations are not always
preserved through the analysis and, more importantly, the resolution stops
at the first couple of interpretations for such a name, disregarding more
traditional overloading of specific names.

The change makes sure that the two interpretation are preserved through the
analysis, and implements the proper resolution of traditionally overloaded
names in the presence of types with implicit dereference. It also performs
some streamlining in the common processing of overloaded nodes in Resolve.

gcc/ada/
PR ada/120669
* sem_ch4.adb (Analyze_Explicit_Dereference): Remove interpretations
of the prefix only if they are of access types.
(Analyze_One_Call.Indicate_Name_And_Type): Check for an implicit
dereference only after indicating the name and type of the call.
* sem_ch5.adb (Analyze_Assignment): Do not remove interpretations
for the LHS if they are for a type with implicit dereference.
* sem_res.adb (Resolve): Streamline the processing of overloaded
nodes once an interpretation is picked for them.  Add a specific
handling for additional interpretations for generalized references.
(Resolve_Explicit_Dereference): Remove interpretations of the prefix
only if they are of access types.
(Is_Ambiguous_Operand): Skip the direct interpretation for a limited
type that has implicit dereference.
* sem_type.adb (Add_One_Interp): Set the name of the first entry of
the table of interpretations in more cases.

gcc/testsuite/
* gnat.dg/implicit_deref1.adb: New test.
* gnat.dg/implicit_deref2.adb: Likewise.
* gnat.dg/implicit_deref3.adb: Likewise.

3 months agoc++/reflection: ICE with lifetime extension of consteval-only [PR124575]
Marek Polacek [Thu, 19 Mar 2026 13:33:15 +0000 (09:33 -0400)] 
c++/reflection: ICE with lifetime extension of consteval-only [PR124575]

Here we ICE in output_constant because we attempt to emit the temporary
created for lifetime extension of a consteval-only expression.  Like
other consteval-only variables, the temporary also has to be marked
DECL_EXTERNAL so that we don't emit it.

I tried to do the setting in make_temporary_var_for_ref_to_temp, but
then we ICE in set_decl_context_in_fn.

PR c++/124575

gcc/cp/ChangeLog:

* call.cc (set_up_extended_ref_temp): If var is consteval-only,
mark it DECL_EXTERNAL.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoUpdate gcc sv.po
Joseph Myers [Fri, 20 Mar 2026 20:35:33 +0000 (20:35 +0000)] 
Update gcc sv.po

* sv.po: Update.

3 months agogccrs: Move cli inner attribute injection to injection
Pierre-Emmanuel Patry [Wed, 11 Mar 2026 12:35:08 +0000 (13:35 +0100)] 
gccrs: Move cli inner attribute injection to injection

Inner attribute injection was not within the injection function where
the other things get injected within a crate.

gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::compile_crate): Use additional
cli attributes for the injection function. Move additional attribute
injection from here...
(Session::injection): ... to here.
* rust-session-manager.h: Update injection fonction prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
3 months agogccrs: Add ability to inject inner attributes from CLI
Pierre-Emmanuel Patry [Tue, 10 Mar 2026 17:20:23 +0000 (18:20 +0100)] 
gccrs: Add ability to inject inner attributes from CLI

It is often required to inject some inner attributes to a crate from the
CLI. It has been required recently for fuzzing the compiler easily.

gcc/rust/ChangeLog:

* ast/rust-ast.cc (Crate::inject_inner_attribute): Add member function
to inject an inner attribute.
* ast/rust-ast.h: Add function prototype.
* lang.opt: Add frust-crate-attr argument to the compiler CLI.
* rust-lang.cc: Remove unused attribute on  option handler.
* rust-session-manager.cc (Session::handle_crate_name): Collect CLI
additional inner attributes.
(Session::compile_crate): Parse the additional inner attributes and
inject them.
* rust-session-manager.h (struct CompileOptions): Add collection of
additional inner attributes.

gcc/testsuite/ChangeLog:

* rust/compile/cli_inner_attribute_injection.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
3 months agogccrs: Add no_std to builtin attributes
Pierre-Emmanuel Patry [Fri, 6 Mar 2026 16:24:31 +0000 (17:24 +0100)] 
gccrs: Add no_std to builtin attributes

no_std is a builtin attribute required for rust-for-linux but was
missing from the builtin attribute list and instead considered an unknown
attribute macro invocation.

gcc/rust/ChangeLog:

* util/rust-attributes.cc: Add no_std to list of builtin attributes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
3 months agogccrs: intrinsic: Add bswap intrinsic
Enes Cevik [Fri, 27 Feb 2026 15:28:18 +0000 (18:28 +0300)] 
gccrs: intrinsic: Add bswap intrinsic

This patch implements the bswap intrinsic for integer types. It maps to the respective GCC built-ins for 16, 32, 64 and 128-bit integers.

gcc/rust/ChangeLog:

* backend/rust-compile-intrinsic.cc: Add bswap_handler.
* backend/rust-intrinsic-handlers.cc (bswap_handler): New function.
* backend/rust-intrinsic-handlers.h (bswap_handler): New declaration.

gcc/testsuite/ChangeLog:

* rust/compile/bswap.rs: New test.
* rust/execute/bswap.rs: New test.

Signed-off-by: Enes Cevik <nsvke@proton.me>
3 months agogccrs: feat: Implement `no_core` feature gate check
Mohamed Ali [Thu, 5 Mar 2026 10:02:51 +0000 (12:02 +0200)] 
gccrs: feat: Implement `no_core` feature gate check

The compiler was accepting `#![no_core]` without requiring
`#![feature(no_core)]`, silently treating an unstable attribute
as stable.  Gate it via check_no_core_attribute, consistent with
how other experimental attributes are handled.

Fixes: Rust-GCC#4461
gcc/rust/ChangeLog:

* checks/errors/feature/rust-feature-gate.cc (FeatureGate::visit): Call check_no_core_attri.
* checks/errors/feature/rust-feature-gate.h: Declare method check_no_core_attri.

gcc/testsuite/ChangeLog:

* rust/compile/match-scope.rs: Fix test.
* rust/compile/no_core_feature_gate.rs: New test.

Signed-off-by: Mohamed Ali <mohmedali1462005@gmail.com>
3 months agogccrs: resolve: Fix ICE on ambiguous glob re-exports
Harishankar [Fri, 27 Feb 2026 01:43:10 +0000 (07:13 +0530)] 
gccrs: resolve: Fix ICE on ambiguous glob re-exports

This patch adds an ambiguity check in 'finalize_rebind_import'.
If a Definition is ambiguous, it emits a proper error diagnostic
instead of crashing, consistent with rustc's behavior(verified)

Fixes Rust-GCC/gccrs#4411

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): Add ambiguity
check before calling get_node_id() on glob import definitions.

gcc/testsuite/ChangeLog:

* rust/compile/issue-4411.rs: New test.

Signed-off-by: Harishankar <harishankarpp7@gmail.com>
3 months agogccrs: Use predefined intrinsic instead of raw values
Pierre-Emmanuel Patry [Wed, 4 Mar 2026 19:50:00 +0000 (20:50 +0100)] 
gccrs: Use predefined intrinsic instead of raw values

gcc/rust/ChangeLog:

* backend/rust-compile-intrinsic.cc: Use predefined values.
* checks/errors/rust-unsafe-checker.cc (is_safe_intrinsic): Likewise.
* util/rust-intrinsic-values.h: New file.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>