]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 months agoc++/reflection: also walk BIND_EXPR_BODY
Marek Polacek [Thu, 19 Feb 2026 17:40:39 +0000 (12:40 -0500)] 
c++/reflection: also walk BIND_EXPR_BODY

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705756.html>,
we shouldn't walk BIND_EXPR_VARS in check_out_of_consteval_use_r, but
BIND_EXPR_BODY should still be walked.

The IF_STMT is there so that we don't emit bogus errors in "if consteval"
branches, as tested in expr12.C.

gcc/cp/ChangeLog:

* reflect.cc (check_out_of_consteval_use_r): Walk BIND_EXPR_BODY.
For IF_STMT_CONSTEVAL_P, only walk the ELSE_CLAUSE.  For
IF_STMT_CONSTEXPR_P, only walk the THEN_ and ELSE_CLAUSE.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/expr11.C: Test more if constexpr.
* g++.dg/reflect/expr12.C: Adjust test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: fix ICE with OMP_CLAUSE [PR124227]
Marek Polacek [Tue, 24 Feb 2026 13:55:31 +0000 (08:55 -0500)] 
c++/reflection: fix ICE with OMP_CLAUSE [PR124227]

This test crashes with -fopenmp -freflection because consteval_only_p
gets

  <omp_clause 0x7fffe99db120
    type <tree_vec 0x7fffe982b900 length:3>
    reduction
    op-0: <var_decl 0x7fffe99d6390 acc>
    op-1: <init_expr 0x7fffe99c9870>
    op-2: <bind_expr 0x7fffe982b8a0>
    op-3: <var_decl 0x7fffe99d6428 D.2864>
    op-4:>

so it takes its type, but complete_type crashes on a TREE_VEC.

So let's handle TREE_VEC in consteval_only_p.

PR c++/124227

gcc/cp/ChangeLog:

* reflect.cc (consteval_only_p): Handle TREE_VEC.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoAda: Fix missing implicit dereference for access-to-protected used as prefix
Eric Botcazou [Wed, 25 Feb 2026 13:00:21 +0000 (14:00 +0100)] 
Ada: Fix missing implicit dereference for access-to-protected used as prefix

... of access-related attribute.  This is a regression present on all active
branches caused by a local resolution of the N_Selected_Component node.

gcc/ada/
PR ada/124226
* sem_res.adb (Resolve_Implicit_Dereference): Move declaration to...
* sem_res.ads (Resolve_Implicit_Dereference): ...here.
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Also call
Resolve_Implicit_Dereference when resolving a protected operation.

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

3 months agotarget/120234 - adjust vector construction costs
Richard Biener [Tue, 24 Feb 2026 08:53:00 +0000 (09:53 +0100)] 
target/120234 - adjust vector construction costs

The following allows vectorizing the gcc.target/i386/pr111023*.c
testcases again with -m32 -msse2 by ensuring we see through a cast
when looking for vector extract sources during costing of vector construction.

This, together with the forwprop fix fixes the regression on those testcases.

PR target/120234
* config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
For constructor elements always look through a conversion.
Rewrite load and vector extraction matching to be more obvious.
Allow arbitrary conversions from the vector extract to elide
costing of a gpr<->xmm move.

3 months agolibiberty, Darwin: Fix handling of file offsets.
Iain Sandoe [Tue, 24 Feb 2026 11:44:27 +0000 (11:44 +0000)] 
libiberty, Darwin: Fix handling of file offsets.

In the case where a Mach-O object is embedded inside some container
(e.g. an archive) we must account the offset from the start of that
container when reading.  In most cases, this has been done correctly.
However, we were missing the case for reading segment data.  This
only showed up once we tried using archives (since regular Mach-O
objects start at the begining of the file).

Fixed thus.

libiberty/ChangeLog:

* simple-object-mach-o.c
(simple_object_mach_o_segment): Account for the offset of
this Mach-O object from the start of any container.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
3 months agoaarch64: early-ra: Fix handling of multi-register allocation with clobbers [PR123285]
Andrew Pinski [Tue, 27 Jan 2026 20:19:13 +0000 (12:19 -0800)] 
aarch64: early-ra: Fix handling of multi-register allocation with clobbers [PR123285]

So the problem here is while forming chains, we don't process hard register
conflicts (and ABI based ones) for allocnos which are already part of a chain.
This means sometimes we allocate a register to a color which might be clobbered
over is live range.
Processing clobbers for all allocnos don't work while forming a chain does
not work as the chain's front allocnos' candidates does not get updated.
So we need to the processing of clobbers (and ABI clobbers) before starting
to form the chains.

Changes since v1:
 * v2: remove accidental hack which was there just for testing.
 * v3: Move the copying of the shared part to new earlier loop too.
       Fix small white space issue.

Bootstrappd and tested on aarch64-linux-gnu.

PR target/123285

gcc/ChangeLog:

* config/aarch64/aarch64-early-ra.cc (early_ra::form_chains): Process clobbers
and ABI clobbers before starting to form the chain.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr123285-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agofortran: Fix iterator counting in nested block scopes [PR fortran/124208]
Christopher Albert [Mon, 23 Feb 2026 21:42:44 +0000 (22:42 +0100)] 
fortran: Fix iterator counting in nested block scopes [PR fortran/124208]

Count FORALL/DO CONCURRENT iterators in EXEC_BLOCK namespace code chains
while sizing VAR_EXPR in gfc_resolve_forall.

This prevents undersized allocation and an ICE for nested FORALL/DO
CONCURRENT inside ASSOCIATE/BLOCK constructs.

PR fortran/124208

gcc/fortran/ChangeLog:

* resolve.cc (gfc_max_forall_iterators_in_chain): Count
iterators in EXEC_BLOCK namespaces.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Christopher Albert <albert@tugraz.at>
3 months agogcc.dg/plugin: fix spurious llp64 warnings
Jonathan Yong [Tue, 17 Feb 2026 02:08:55 +0000 (02:08 +0000)] 
gcc.dg/plugin: fix spurious llp64 warnings

Fixes compile tests with mingw-w64.

gcc/testsuite/ChangeLog:

* gcc.dg/plugin/taint-pr112850-precise.c:
(__kernel_ulong_t): Change unsigned long to __UINTPTR_TYPE__.
(__kernel_size_t): Change __kernel_ulong_t to __kernel_size_t.
(copy_from_user): Change unsigned long n to size_t n.
(snd_rawmidi_ioctl): Change unsigned long arg to uintptr_t arg.
* gcc.dg/plugin/taint-pr112850-too-complex.c: Ditto.
* gcc.dg/plugin/taint-pr112850-unsanitized.c: Ditto.
* gcc.dg/plugin/taint-pr112850.c: Ditto.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
3 months agoDaily bump.
GCC Administrator [Wed, 25 Feb 2026 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

3 months agodoc: Fix the attribute urlifier after changes to indexing [PR88472]
Sandra Loosemore [Sat, 21 Feb 2026 01:04:14 +0000 (01:04 +0000)] 
doc: Fix the attribute urlifier after changes to indexing [PR88472]

Recent patches to the GCC manual have merged previously-separate
sections for function, variable, type, and statement attributes, and
created a separate index for attributes instead of putting them in the
concept index.  This reorganization broke the attribute URLifier and its
self-tests.  I've fixed it up and regenerated attr-urls.def.

gcc/ChangeLog
PR other/88472
* Makefile.in (ATTR_URLS_HTML_DEPS): Point at new index file.
* attr-urls.def: Regenerated.
* gcc-attribute-urlifier.cc (test_attribute_urlifier): Adjust
URLs to match formatting in the new index.
* regenerate-attr-urls.py (parse_html_line_attribute_index):
Update pattern to match formatting in the new combined index.
Don't segregate entries into separate function/variable/etc
arrays.
(INDEX_REL_PATH): Point at the new index file.
(class TestParsingIndex): Update patterns in self-tests to match
the current formatting.

3 months agodoc: Put attributes in their own index [PR88472]
Sandra Loosemore [Fri, 20 Feb 2026 01:11:57 +0000 (01:11 +0000)] 
doc: Put attributes in their own index [PR88472]

GCC has so many attributes nowadays that having a dedicated index for
them seems long overdue.

gcc/ChangeLog
PR other/88472
* doc/extend.texi (Common Attributes): Change @cindex entries for
attributes to @atindex.  Add some additional @cindex entries.
(AArch64 Attributes): Likewise.
(AMD GCN Attributes): Likewise.
(ARC Attributes): Likewise.
(ARM Attributes): Likewise.
(AVR Attributes): Likewise.
(Blackfin Attributes): Likewise.
(BPF Attributes): Likewise.
(C-SKY Attributes): Likewise.
(Epiphany Attributes): Likewise.
(H8/300 Attributes): Likewise.
(IA-64 Attributes): Likewise.
(LoongArch Attributes): Likewise.
(M32C Attributes): Likewise.
(M32R/D Attributes): Likewise.
(m68k Attributes): Likewise.
(MicroBlaze Attributes): Likewise.
(Microsoft Windows Attributes): Likewise.
(MIPS Attributes): Likewise.
(MSP430 Attributes): Likewise.
(NDS32 Attributes): Likewise.
(Nvidia PTX Attributes): Likewise.
(PowerPC Attributes): Likewise.
(RISC-V Attributes): Likewise.
(RL78 Attributes): Likewise.
(RX Attributes): Likewise.
(S/390 Attributes): Likewise.
(SH Attributes): Likewise.
(Symbian OS Attributes): Likewise.
(V850 Attributes): Likewise.
(Visium Attributes): Likewise.
(x86 Attributes): Likewise.
(Xstormy16 Attributes): Likewise.
(C++ Attributes): Likewise.
* doc/gcc.texi: Define a new "at" index for attributes.
(Attribute Index): New appendix.

3 months agodoc: Consolidate documentation for naked attribute [PR88472]
Sandra Loosemore [Thu, 19 Feb 2026 18:26:32 +0000 (18:26 +0000)] 
doc: Consolidate documentation for naked attribute [PR88472]

This attribute has been documented similarly in the sections for 12
different targets.  I think it's time to promote this to a common
attribute and document it only once with a warning that it's not
supported everywhere.

gcc/ChangeLog
PR other/88472
* doc/extend.texi (Common Attributes): Document the "naked"
attribute here.
(ARC Attributes): Delete entry for "naked".
(ARM Attributes): Likewise.
(AVR Attributes): Likewise.
(BPF Attributes): Likewise.
(C-SKY Attributes): Likewise.
(MCORE Attributes): Delete entire section since "naked" was
the only thing listed.
(MSP430 Attributes): Delete entry for "naked".
(NDS32 Attributes): Likewise.
(RISC-V Attributes): Likewise.
(RL78 Attributes): Likewise.
(RX Attributes): Likewise.
(x86 Attributes): Likewise.

3 months agodoc: Consolidate hot/cold attribute documentation [PR88472]
Sandra Loosemore [Thu, 19 Feb 2026 15:40:35 +0000 (15:40 +0000)] 
doc: Consolidate hot/cold attribute documentation [PR88472]

gcc/ChangeLog
PR other/88472
* doc/extend.texi (Common Attributes): Consolidate documentation
for "cold" and "hot" attributes, including the C++-specific
behavior.
(C++ Attributes): Likewise, just point to the main entry.

3 months agodoc, riscv: Tidy RISC-V attribute documentation
Sandra Loosemore [Thu, 19 Feb 2026 17:15:05 +0000 (17:15 +0000)] 
doc, riscv: Tidy RISC-V attribute documentation

gcc/ChangeLog
* doc/extend.texi (RISC-V Attributes): Format and index options
for the "target" attribute consistently with the documentation
for other back ends.

3 months agodoc, loongarch: Clean up LoongArch attribute documentation
Sandra Loosemore [Mon, 16 Feb 2026 23:48:24 +0000 (23:48 +0000)] 
doc, loongarch: Clean up LoongArch attribute documentation

This section of the manual was in need of general tidying for grammar
and markup, as well as correcting confusion resulting from using "attribute"
to refer both to the target attribute and its individual arguments.  I also
added LoongArch to the lists of targets supporting target_clones and
target_version in other sections of the manual.

gcc/ChangeLog
* doc/extend.texi (Common Attributes): Add LoongArch to lists of
targets supporting target_clones and target_version.
(LoongArch Attributes): Copy-edit for grammar and markup.  Wrap
excessively long lines.  Rearrange the introductory material for
the target attribute.  Correct index entries for target attribute
options.
(Function Multiversioning): Add LoongArch to list of targets
supporting this feature.  Fix nearby typo.

3 months agodoc, aarch64: Tidy AArch64 target attribute documentation
Sandra Loosemore [Mon, 16 Feb 2026 00:07:37 +0000 (00:07 +0000)] 
doc, aarch64: Tidy AArch64 target attribute documentation

The presentation in this section previously documented and referred to
the options that could be specified in the "target" attribute string
as if they were attributes themselves, which was quite confusing.  I've
straightened out the terminology and reorganized the text to put the
introductory material and examples first instead of at the end, and fixed
the markup and formatting to match what's already used for other targets
that support this attribute.

gcc/ChangeLog
* doc/extend.texi (AArch64 Attributes): Reorganize material in this
section, correct terminology and formatting.

3 months agodoc: General copy-editing in Attributes section
Sandra Loosemore [Thu, 19 Feb 2026 05:37:27 +0000 (05:37 +0000)] 
doc: General copy-editing in Attributes section

This patch fixes a number of copy-editing issues in the attributes
documentation that are not specifically related to the restructuring
of this section for PR88472.  This includes typos, grammatical errors
like inappropriate verb tenses, switching from passive to active
voice, missing or incorrect markup, missing @noindent after examples,
hbox overflows in the PDF manual, and so on.

gcc/ChangeLog
* doc/extend.texi (Attributes): General copy-editing.
(C++ Attributes): Likewise.

3 months agodoc: Tag attributes with what they apply to [PR88472]
Sandra Loosemore [Sat, 14 Feb 2026 22:46:54 +0000 (22:46 +0000)] 
doc: Tag attributes with what they apply to [PR88472]

After merging the lists of function/variable/type/etc attributes, it
wasn't always clear what particular attributes applied to without
reading through the description.  This patch adopts the practice from
the C standard of starting each attribute section with a paragraph
describing what it can apply to.  In many cases this just involved
adding a paragraph break after the first sentence of the description;
others required a bit of rephrasing too.

gcc/ChangeLog
PR other/88472
* doc/extend.texi (Attributes): Start each attribute's
documentation with a short paragraph describing what it applies to.
(C++ Attributes): Likewise.

3 months agodoc: Merge function, variable, type, and statement attribute sections [PR88472]
Sandra Loosemore [Wed, 18 Feb 2026 01:05:31 +0000 (01:05 +0000)] 
doc: Merge function, variable, type, and statement attribute sections [PR88472]

The previous organization of the Attributes section of the manual was like

Attributes
  Function Attributes
    Common Function Attributes
    + various subsections by target
  Variable Attributes
    Common Variable Attributes
    + various subsections by target
  Type Attributes
    likewise
  Label Attributes
  Enumerator Attributes
  Statement Attributes
  GNU Attribute Syntax

There was a bunch of introductory text duplicated at the top of the
sections for each kind of attribute, and many attributes were listed
in multiple places -- particularly linker-related attributes like
"section" that apply to both functions and variables with the same
semantics.

The material has been reorganized by merging the corresponding
sections for each kind of attribute:

Attributes
  Common Attributes
  Target-Specific Attributes
    + various subsections by target
  GNU Attribute Syntax

Most of the previous boilerplate introductory text for each subsection
has been discarded since it's been replaced by a general introduction
in the top-level Attributes section in a previous patch of this
series.  The duplicate entries for different kinds of attributes of
the same name have been merged and in some cases I reworded things to
provide explicit context about what entities the attribute applies to.

gcc/ChangeLog
PR other/88472
* doc/extend.texi (Attributes): Merge respective subsections of
Function Attributes, Variable Attributes, Type Attributes,
Label Attributes, Enumerator Attributes, and Statement Attributes
into new sections Common Attributes and Target-Specific Attributes.
Fix cross-references.
* doc/invoke.texi: Fix cross-references.
* doc/trouble.texi: Likewise.

3 months agodoc: Rewrite/reorganize discussion of attribute syntax [PR102397]
Sandra Loosemore [Sat, 7 Feb 2026 20:26:32 +0000 (20:26 +0000)] 
doc: Rewrite/reorganize discussion of attribute syntax [PR102397]

Now that GCC's default language dialect for both C and C++ includes
support for the standard attribute syntax, we should encourage users
to prefer that instead of the legacy GNU syntax, while recognizing
that there is a lot of code out there using the latter.  This patch
updates the discussion in the introduction to the Attributes section
with examples showing attribute placement in both syntaxes and focuses
the syntax section on the GNU syntax only.  (Users can read the C/C++
standards, programming books or tutorials, etc to learn about the
standard syntax, so we don't need to document that in detail.)

gcc/ChangeLog
PR c++/102397
* doc/extend.texi (Attributes): Rewrite and expand discussion
of standard vs legacy syntax, with several examples.
(Attribute Syntax): Rename section to...
(GNU Attribute Syntax): ...this.  Prune discussion of standard
attribute syntax.  Fix cross-references.

3 months agoanalyzer: fix ICE on (X + (-X)) for vectors [PR124188]
David Malcolm [Tue, 24 Feb 2026 22:16:59 +0000 (17:16 -0500)] 
analyzer: fix ICE on (X + (-X)) for vectors [PR124188]

gcc/analyzer/ChangeLog:
PR analyzer/124188
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Don't attempt to fold
X + (-X) to zero for vector types.

gcc/testsuite/ChangeLog:
PR analyzer/124188
* c-c++-common/analyzer/vector-ice-pr124188.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
3 months agoanalyzer: fix ICE on division by zero [PR124195]
David Malcolm [Tue, 24 Feb 2026 22:16:58 +0000 (17:16 -0500)] 
analyzer: fix ICE on division by zero [PR124195]

gcc/analyzer/ChangeLog:
PR analyzer/124195
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Bulletproof against
division by zero by returning "unknown".
* region-model.cc (region_model::get_gassign_result): Bail out for
division by zero.
* svalue.cc (svalue::maybe_get_value_range): Rename to...
(svalue::maybe_get_value_range_1): ...this.
(constant_svalue::maybe_get_value_range): Rename to...
(constant_svalue::maybe_get_value_range_1): ...this.
(unknown_svalue::maybe_get_value_range): Rename to...
(unknown_svalue::maybe_get_value_range_1): ...this.
(unaryop_svalue::maybe_get_value_range): Rename to...
(unaryop_svalue::maybe_get_value_range_1): ...this.
(binop_svalue::maybe_get_value_range): Rename to...
(binop_svalue::maybe_get_value_range_1): ...this.
* svalue.h (svalue::maybe_get_value_range): Reimplement inline,
asserting that if we get a result it is not undefined_p.  Use
maybe_get_value_range_1 for the vfunc.
(svalue::maybe_get_value_range_1): Rename from above.
(constant_svalue::maybe_get_value_range): Rename to...
(constant_svalue::maybe_get_value_range_1): ...this.
(unknown_svalue::maybe_get_value_range): Rename to...
(unknown_svalue::maybe_get_value_range_1): ...this.
(unaryop_svalue::maybe_get_value_range): Rename to...
(unaryop_svalue::maybe_get_value_range_1): ...this.
(binop_svalue::maybe_get_value_range): Rename to...
(binop_svalue::maybe_get_value_range_1): ...this.

gcc/testsuite/ChangeLog:
PR analyzer/124195
* c-c++-common/analyzer/divide-by-zero-1.c: New test.
* c-c++-common/analyzer/divide-by-zero-pr124195-2.c: New test.
* gcc.dg/analyzer/divide-by-zero-pr124195-1.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
3 months agoRISC-V: Change scratch constraint for _lra insns.
Robin Dapp [Thu, 19 Feb 2026 17:01:28 +0000 (18:01 +0100)] 
RISC-V: Change scratch constraint for _lra insns.

This fixes a latent bug on rv32 after the lra patch for PR123381.

We have those _lra insn_and_splits

(define_insn_and_split "*mov<V_FRACT:mode><P:mode>_lra"
  [(set (match_operand:V_FRACT 0 "reg_or_mem_operand" "=vr, m,vr")
(match_operand:V_FRACT 1 "reg_or_mem_operand" "  m,vr,vr"))
   (clobber (match_scratch:P 2 "=&r,&r,X"))]

where the clobber constraint for the third alternative is 'X'.
This is supposed to express that we accept anything because we don't
need the scratch for that alternative anyway.

However, in mask_gather_load_run-11.c we create a mem

(insn 302 228 218 (parallel [
            (set (reg:RVVMF8BI 124 v28 [orig:214 mask__62.15 ] [214])
                (reg:RVVMF8BI 120 v24 [orig:354 MEM <vector(16) long long int> [(int64_t *)cond_32(D) + 768B] ] [354]))
            (clobber (mem/c:SI (plus:SI (reg/f:SI 2 sp)
                        (const_int 12 [0xc])) [3 %sfp+-324 S4 A32]))

that match_scratch does not handle, so we never split the insn.

This patch changes the constraint to 'r', this should work as we don't
make use of it anyway.

gcc/ChangeLog:

* config/riscv/vector.md:  Change 'X' to 'r' in _lra insns.

3 months agoRISC-V: theadvector specifics for vec_init and vec_extract. [PR124147]
Robin Dapp [Wed, 18 Feb 2026 11:10:13 +0000 (12:10 +0100)] 
RISC-V: theadvector specifics for vec_init and vec_extract. [PR124147]

The mask-mode vec_init and vec_extract expanders assume that we can
create QImode vectors with the same number of units as the mask mode
has.  XTheadVector does not have fractional-LMUL modes and we ICE when
trying to expand the actual insns.

An obvioius solution would be to simply disable the autovec expanders for
TARGET_XTHEADVECTOR but exactly these optab/mode combination has no fallback
in the common expansion code.  That's a known problem and should be fixed
separately in extract_bit_field_1.

For now, though, we do not need to use small modes and can go with full
vectors instead.  The excess elements don't matter.
To that end, this patch uses paradoxical subregs on the source (for
vec_extract) and on the destination (for vec_init), leaving the
remaining elements undefined.

In order to obtain the right "full vector" I needed to adjust
get_m1_mode slightly.  By default it returns a VLA mode so when
introducing a subreg like above we can have
  (subreg:full_vector_mode (reg:small_vls_vector_mode) 0)
where full_vector_mode is a VLA mode and small_vls_vector_mode is a VLS
mode.  This won't be a valid subreg so the patch adds a VLS_P
argument to get_m1_mode that returns a full VLS vector mode.

Regtested on rv64gcv_zvl512b.  As I didn't have theadvector hardware
available I made the new code paths unconditional (so they are active
for regular RVV) and re-tested.

PR target/124147

gcc/ChangeLog:

* config/riscv/autovec.md: Work around fractional-LMUL modes for
TARGET_XTHEADVECTOR.
* config/riscv/riscv-protos.h (get_m1_mode): Export.
* config/riscv/riscv-v.cc (get_m1_mode): Allow to get a VLS m1
vector.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr124147.c: New test.

3 months agolra: Perform cycle detection for moves with clobber. [PR123381]
Robin Dapp [Wed, 11 Feb 2026 15:32:01 +0000 (16:32 +0100)] 
lra: Perform cycle detection for moves with clobber. [PR123381]

In the PR code we have the somewhat rare case that we need to reload
a vector subreg of a scalar register, (subreg:V2HI (reg:DI)).
What complicates things is that the test is compiled with
-mrvv-vector-bits=zvl, so VLS-only mode.
Unfortunately, we can still get VLA-named modes that are actually VLS
modes (i.e. that have a constant number of units).

For moving real VLS modes we simply use

 (define_insn_and_split "*mov<mode>"
   [(set (match_operand:VLS_AVL_IMM 0 "reg_or_mem_operand" "=vr, m, vr")
  (match_operand:VLS_AVL_IMM 1 "reg_or_mem_operand" "  m,vr, vr"))]

Here, lra recognizes cycle danger, quickly switches to the memory
alternative and the resulting code is as expected - we perform a vector
load from that memory the DImode reg was spilled to.

For VLA (named) modes the mov insn is

(define_insn_and_split "*mov<V_FRACT:mode><P:mode>_lra"
  [(set (match_operand:V_FRACT 0 "reg_or_mem_operand" "=vr, m,vr")
(match_operand:V_FRACT 1 "reg_or_mem_operand" "  m,vr,vr"))
   (clobber (match_scratch:P 2 "=&r,&r,X"))]

The extra clobber here is an optimization:  For modes smaller than a full
register we want to store the actual size, rather than always the full
vector size.  If that mode size happens to exceed 32, instead of using an
immediate we need to move it to a register so vsetvl can consume it.

As the second mov insn above has three operands lra never checks for cycle
danger and promptly creates a cycle :)  This patch loosens the conditions on
the cycle check by allowing a third operand that is a clobber.

PR rtl-optimization/123381

gcc/ChangeLog:

* lra-constraints.cc (process_alt_operands): Detect cycles in
three-operand moves with clobber.
(curr_insn_transform): Don't write back a scratch operand.

gcc/testsuite/ChangeLog:

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

3 months agocontrib: add bpf-vmtest-tool to test BPF programs
Piyush Raj [Tue, 24 Feb 2026 20:17:53 +0000 (01:47 +0530)] 
contrib: add bpf-vmtest-tool to test BPF programs

This patch adds the bpf-vmtest-tool subdirectory under contrib which tests
BPF programs under a live kernel using a QEMU VM.  It can build the
specified kernel version with eBPF support enabled
and stores it under $VMTEST_DIR

It can test BPF C source files and precompiled BPF object files against
the kernel verifier for errors.
When a BPF program is rejected by the kernel verifier,
the verifier logs are displayed.

$ python3 main.py --log-level ERROR vmtest -k 6.15 --bpf-src fail.c
BPF program failed to load
Verifier logs:
        btf_vmlinux is malformed
        0: R1=ctx() R10=fp0
        0: (81) r0 = *(s32 *)(r10 +4)
        invalid read from stack R10 off=4 size=4
        processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

See the README for more examples.

The script uses vmtest (https://github.com/danobi/vmtest) to boot
the VM and run the program.  By default, it uses the host's root
("/") as the VM rootfs via the 9p filesystem, so only the kernel is
replaced during testing.

Tested with Python 3.9 and above.

contrib/ChangeLog:

* bpf-vmtest-tool/README: New file.
* bpf-vmtest-tool/bpf.py: New file.
* bpf-vmtest-tool/config.py: New file.
* bpf-vmtest-tool/kernel.py: New file.
* bpf-vmtest-tool/main.py: New file.
* bpf-vmtest-tool/pyproject.toml: New file.
* bpf-vmtest-tool/tests/test_cli.py: New file.
* bpf-vmtest-tool/utils.py: New file.
* bpf-vmtest-tool/vm.py: New file.

Signed-off-by: Piyush Raj <piyushraj92739@gmail.com>
3 months agoAArch64: Use anchors for vector constants [PR 121240]
Wilco Dijkstra [Thu, 22 Jan 2026 12:28:36 +0000 (12:28 +0000)] 
AArch64: Use anchors for vector constants [PR 121240]

Enable anchors for vector constants - like FP, expand vector constants early
and place them in the constdata section.  Avoid unnecessary loads by expanding
simple cases using DUP.  Performance on SPECFP2017 is ~0.3% better, codesize
increases by 0.05% due to extra const data.

gcc:
PR target/121240
* config/aarch64/aarch64-simd.md (mov<mode>): Expand vector constants
early.
* config/aarch64/aarch64.cc (aarch64_select_rtx_section): Force
vector immediates <= 16 bytes to constdata.

gcc/testsuite:
PR target/121240
* gcc.target/aarch64/const_create_using_fmov.c: Fix test.
* gcc.target/aarch64/pr121240.c: Add new test.
* gcc.target/aarch64/vec-init-single-const.c: Fix test.
* gcc.target/aarch64/vect-cse-codegen.c: Fix test.

3 months agolibstdc++: Replace check for exceptions in mdspan/at.cc.
Tomasz Kamiński [Tue, 24 Feb 2026 17:20:53 +0000 (18:20 +0100)] 
libstdc++: Replace check for exceptions in mdspan/at.cc.

Uses __cpp_lib_constexpr_exceptions, that better expresses
the intent.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/mdspan/at.cc: Updated guard.

3 months agotestsuite: arm: drop xfail for dg-bogus in bfloat_cpp_typecheck.C [PR124064]
Torbjörn SVENSSON [Fri, 13 Feb 2026 13:01:57 +0000 (14:01 +0100)] 
testsuite: arm: drop xfail for dg-bogus in bfloat_cpp_typecheck.C [PR124064]

After r11-6321-g550880a31688f1, the bogous errors are no longer emitted.

gcc/testsuite/ChangeLog:

PR testsuite/124064
* g++.target/arm/bfloat_cpp_typecheck.C: Drop xfail.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
3 months agotestsuite: arm: add -mfpu=auto to arm_v8_3a_complex_neon
Torbjörn SVENSSON [Thu, 19 Feb 2026 09:20:39 +0000 (10:20 +0100)] 
testsuite: arm: add -mfpu=auto to arm_v8_3a_complex_neon

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Add -mfpu=auto to
arm_v8_3a_complex_neon. This aligns with
arm_v8_3a_fp16_complex_neon.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
3 months agolibstdc++: Do not check exception at compile-time for mdspan::at for cow string.
Tomasz Kamiński [Tue, 24 Feb 2026 16:54:11 +0000 (17:54 +0100)] 
libstdc++: Do not check exception at compile-time for mdspan::at for cow string.

Do not test the exception at compile time if _GLIBCXX_USE_CXX11_ABI
is not set, i.e. standard exceptions types are not supported.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/mdspan/at.cc: Updated test.

3 months agoAda: Fix crash on iterated element association for Ordered_Maps
Eric Botcazou [Tue, 24 Feb 2026 16:42:24 +0000 (17:42 +0100)] 
Ada: Fix crash on iterated element association for Ordered_Maps

This is a regression present on the mainline and 15 branch: the compiler
crashes on an iterated element association for Ordered_Maps or similar
container types, because the type of the loop variable is not computed.

gcc/ada/
PR ada/124224
* sem_aggr.adb (Resolve_Container_Aggregate): Minor tweaks.
(Resolve_Iterated_Association): Compute Typ on all paths.

gcc/testsuite/
* gnat.dg/specs/aggr12.ads: New test.

Co-authored-by: Liam Powell <liam@liampwll.com>
3 months agocontrib: Skip Clang -Wreturn-type-c-linkage in rust-fmt.h
Martin Jambor [Tue, 24 Feb 2026 16:32:32 +0000 (17:32 +0100)] 
contrib: Skip Clang -Wreturn-type-c-linkage in rust-fmt.h

When compiling GCC Rust FE, clang gives the following warning:

/home/worker/buildworker/tiber-gcc-clang/build/gcc/rust/ast/rust-fmt.h:403:15: warning: 'collect_pieces' has C-linkage specified, but returns incomplete type 'FFIVec<Piece>' which could be incompatible with C [-Wreturn-type-c-linkage]
/home/worker/buildworker/tiber-gcc-clang/build/gcc/rust/ast/rust-fmt.h:406:15: warning: 'clone_pieces' has C-linkage specified, but returns incomplete type 'FFIVec<Piece>' which could be incompatible with C [-Wreturn-type-c-linkage]

I have raised this with GCC Rust folk on their Zulip chat and we
agreed the warning should be filtered out, at least fornow.  It is
tracked as https://github.com/Rust-GCC/gccrs/issues/4441 so it is not
forgotten but even there it seems that the outcome may be we'd just
ignore the warning forever, as far as I can tell.

contrib/ChangeLog:

2026-02-24  Martin Jambor  <mjambor@suse.cz>

* filter-clang-warnings.py (skip_warning): Skip warning
-Wreturn-type-c-linkage in rust/ast/rust-fmt.h.  Fix indentation of
the entry for libiberty/sha1.c.

3 months agocobol: Increase PIC X(MAX) from 8192 to 2^31.
Robert Dubner [Tue, 24 Feb 2026 14:56:01 +0000 (09:56 -0500)] 
cobol: Increase PIC X(MAX) from 8192 to 2^31.

Up until these changes, temporary intermediate alphanumeric string
variables have been allocated on the stack.  With the design change to
a larger limit, that's no longer practical.  Such variables are now
placed on the heap, and we now have to take pains to free() that memory
when we are done with it.

gcc/cobol/ChangeLog:

* gcobc: Adjust how -fPIC is applied, and other refinements.
* gcobol.1: Documentation.
* genapi.cc (parser_statement_end): New function.  Deallocates
temp char strings from the heap.
(initialize_variable_internal): Ignore temp char strings.
(compare_binary_binary): Formatting.
(parser_end_program): Formatting.
(parser_init_list): Formatting.
(parser_exit_program): Formatting.
(program_end_stuff): Formatting.
(parser_exit): Formatting.
(parser_perform_conditional): Formatting.
(perform_outofline_before_until): Formatting.
(parser_file_add): Formatting.
(mh_source_is_literalA): Formatting.
(psa_new_var_decl): Make cblc_field_t for intermediate_e
alphanumerics program-static.
(parser_symbol_add): Eliminate unnecessary code when
type!=FldConditional; change handling of intermediate_e for
FldAlphanumerics.
* genapi.h (parser_end_program): New declaration.
(parser_exit): Formatting.
(parser_exit_program): Formatting.
(parser_statement_end): New declaration.
* lexio.cc (parse_replace_pairs): Change CDF handling.
(cdftext::lex_open): Likewise.
(cdftext::process_file): Likewise.
* parse.y: Changes to MAXIMUM_ALPHA_LENGTH; refine return value
types for various intrinsic functions; some CDF handling.
* parse_ante.h (MAXLENGTH_FORMATTED_DATE): Eliminate constant.
(MAXLENGTH_FORMATTED_TIME): Likewise.
(MAXLENGTH_CALENDAR_DATE): Likewise.
(MAXLENGTH_FORMATTED_DATETIME): Likewise.
(new_alphanumeric): No longer takes a capacity.
(intrinsic_return_field): New declaration.
(struct ffi_args_t): Changed debug message.
(is_among): New declaration.
* parse_util.h (intrinsic_return_field): New function. Works with
the modified function_descrs[] table.
* scan.l: Modified scanning.
* scan_ante.h (class input_file_status_t): Likewise.
(verify_ws):  Likewise.
(is_refmod): Likewise.
* symbols.cc (symbols_update): Improved comment about a debug
message.
(symbol_temporaries): New function for temporaries on the heap that
will have to be deallocated.
(symbol_temporary_alphanumerics): Likewise.
(new_temporary_impl): Eliminate MAXIMUM_ALPHA_LENGTH from template.
(new_alphanumeric): Eliminate capacity as a parameter.
* symbols.h (cbl_dialect_str): Formatting.
(MAXIMUM_ALPHA_LENGTH): Change comment and value.
(IBM_MAXIMUM_ALPHA_LENGTH): Put parentheses around "size_t(1)<<31".
(symbol_temporaries): New declaration.
(symbol_temporary_alphanumerics): New declaration.
(struct function_descr_t): New comment on ret_type.
(new_alphanumeric): New declaration.
* util.cc (class cdf_directives_t): CDF processing.
(cobol_set_indicator_column): Likewise.
(cdf_push_source_format): Likewise.
(cdf_pop_source_format): Likewise.
(parent_names): Likewise.
(cobol_filename): Likewise.
(cobol_lineno): Likewise.
(cobol_filename_restore): Likewise.

libgcobol/ChangeLog:

* intrinsic.cc (string_to_dest): Move call to
__gg__adjust_dest_size().
(__gg__char): Likewise.
(__gg__current_date): Likewise.
(__gg__formatted_current_date): Likewise.
(__gg__formatted_date): Likewise.
(__gg__formatted_datetime): Likewise.
(__gg__formatted_time): Likewise.
(change_case): Likewise.
(__gg__trim): Likewise; fix memory leak.
(__gg__reverse): Move call to __gg__adjust_dest_size().
(__gg__locale_compare): Likewise
(__gg__locale_date): Likewise
(__gg__locale_time): Likewise
(__gg__locale_time_from_seconds): Likewise
* libgcobol.cc (format_for_display_internal): Make the results of
intermediate FldNumericBin5 look nice to a human.
(init_var_both): Move call to __gg__adjust_dest_size().
(__gg__get_argc): Move call to __gg__adjust_dest_size().
(__gg__get_argv): Move call to __gg__adjust_dest_size().
(__gg__get_command_line): Move call to __gg__adjust_dest_size().
(__gg__adjust_dest_size): Properly handle intermediate_e
allocations.
(__gg__adjust_encoding): Move call to __gg__adjust_dest_size().
(__gg__module_name): Move call to __gg__adjust_dest_size().
(__gg__refer_from_string): Move call to __gg__adjust_dest_size().
(__gg__refer_from_psz): Move call to __gg__adjust_dest_size().
(__gg__convert): Move call to __gg__adjust_dest_size().
* posix/shim/lseek.cc: Changes to extended functions.
* posix/shim/open.cc (posix_opent): Likewise.
(posix_open): Likewise.
* posix/udf/posix-open.cbl: Likewise.
* posix/udf/posix-read.cbl: Likewise.
* posix/udf/posix-write.cbl: Likewise.
* xmlparse.cc (sayso): Change to debug message.
* posix/udf/posix-ftruncate.cbl: New file.

3 months agoc++: error about typename outside of templates
Marek Polacek [Mon, 23 Feb 2026 16:22:08 +0000 (11:22 -0500)] 
c++: error about typename outside of templates

In C++11, DR 382 allowed 'typename' to be used outside of templates,
so the "not allowed outside of templates" error is no longer accurate.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_base_specifier): Use the same error for
a typename in a base-specifier outside of templates and inside.

gcc/testsuite/ChangeLog:

* g++.dg/parse/typename6.C: Adjust dg-error.
* g++.dg/reflect/pr122634-2.C: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agotree-optimization/123117 - fix sign conversion check
Richard Biener [Tue, 24 Feb 2026 08:50:17 +0000 (09:50 +0100)] 
tree-optimization/123117 - fix sign conversion check

The following fixes the sign conversion check added to properly check
whether the BIT_FIELD_REF does a sign conversion on the original
vector elements instead of a conversion to the target constructor
element type.  This avoids disabling all unpacking conversions.

PR tree-optimization/123117
PR target/120234
* tree-ssa-forwprop.cc (simplify_vector_constructor): Fix
sign conversion check guarding unpacking.

3 months agoipa-cp: Make ipcp_val_replacement_ok_p fail better
Martin Jambor [Tue, 24 Feb 2026 10:43:32 +0000 (11:43 +0100)] 
ipa-cp: Make ipcp_val_replacement_ok_p fail better

This is a small improvement to a function which verifies that the
polymorphic context IPA-CP has decided to clone for is indeed among
the known contexts collected for the specialized node.  When no
context has been collected and the vector is empty, like in the case
of PR123629, the function will return false rather than ICE because of
an out of bounds vector access.  That in turn also results in an
ICE, but hopefully the error will be somewhat clearer.

gcc/ChangeLog:

2026-02-23  Martin Jambor  <mjambor@suse.cz>

PR ipa/123629
* ipa-cp.cc (ipcp_val_replacement_ok_p): Also verify that the
vector of known contexts has sufficient length.

3 months agoDaily bump.
GCC Administrator [Tue, 24 Feb 2026 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

3 months agodoc: Fix typos in param.opt [PR118988]
Sandra Loosemore [Mon, 23 Feb 2026 20:21:18 +0000 (20:21 +0000)] 
doc: Fix typos in param.opt [PR118988]

gcc/ChangeLog
PR translation/118988
* params.opt (-param=cycle-accurate-model=): Fix wording of help
string.
(-param=phiopt-factor-max-stmts-live=): Likewise.

3 months agoFortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]
Gonzalo Silvalde Blanco [Mon, 23 Feb 2026 19:53:16 +0000 (20:53 +0100)] 
Fortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]

The error message for an ambiguous pointer function assignment contained a
FIXME and an embedded newline that the diagnostics printer does not handle.
Split the single gfc_error call into a gfc_error for the main diagnostic
and an inform note for the F2008 explanation, wrapped in an
auto_diagnostic_group.

PR fortran/80012

gcc/fortran/ChangeLog:

* symbol.cc (gfc_add_procedure): Split error into gfc_error and
inform using auto_diagnostic_group.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Gonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>
3 months agoOpenMP/Fortran: Fix map-subarray testcases [PR120505]
Paul-Antoine Arras [Mon, 23 Feb 2026 17:55:16 +0000 (18:55 +0100)] 
OpenMP/Fortran: Fix map-subarray testcases [PR120505]

The fix for PR120505 introduced two test failures on some configurations.

This patch update the scan dump pattern in map-subarray-4.f90 to allow for
differing pointer sizes, and disable map-subarray-16.f90 when no offload device
is available.

PR fortran/120505

libgomp/ChangeLog:

* testsuite/libgomp.fortran/map-subarray-16.f90: Enable test only for
offload device.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/map-subarray-4.f90: Update scan dumps for -m32.

3 months agoamdgcn: prefer scalar ALU instructions over vector
Sandra Loosemore [Mon, 23 Feb 2026 16:10:01 +0000 (16:10 +0000)] 
amdgcn: prefer scalar ALU instructions over vector

This patch fixes a performance regression that crept in with commit
gcc-16-2237-g0eee2dd2865 ("Don't clobber VCC if we don't need to").
Removing the clobber from vector-register ALU insn pattern
alternatives seems to make LRA think those alternatives are less
costly than the scalar-register alternatives, which do need the
clobber, resulting in extra move instructions instead.

In this patch I've adjusted all the ALU patterns (not just the ones
modified by the above-mentioned commit) where the scalar-register
alternatives clobber and vector-register alternatives don't, to
slightly disparage the latter using the "?" constraint modifier.

I also fixed a related issue: the comment on addptrdi3 says the
scalar-register alternative is preferred, but it was listed after the
vector alternative, so other things being equal it would still prefer
the vector expansion.  I've not changed the constraints, but simply
flipped the order of the alternatives.

Thanks to Tobias Burnus for identifying the commit that caused the
performance regression, Andrew Stubbs for making the connection between
clobbers and LRA costs, and Arsen Arsenović for setting up the benchmark
scripting I used to compare results.

gcc/ChangeLog
* config/gcn/gcn.md (addsi3): Disparage vector alternative.
(addptrdi3): Reverse order of vector and scalar alternatives
to prefer the latter.
(subsi3): Disparage vector alternatives.
(mulsi3): Likewise.
(muldi3): Likewise.
(bitunop <expander>si2): Likewise.
(vec_and_scalar_com <expander>si3): Likewise.
(vec_and_scalar_nocom <expander>si3): Likewise.
(one_cmpldi2): Likewise.
(vec_and_scalar64_com <expander>di3): Likwise.
(vec_and_scalar64_nocom <expander>di3): Likwise.

3 months agoc++/reflection: splices and passing ctx to finish_id_expr
Marek Polacek [Thu, 19 Feb 2026 15:51:32 +0000 (10:51 -0500)] 
c++/reflection: splices and passing ctx to finish_id_expr

In <https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705175.html>
(bottom of the message) we discussed not passing ctx to finish_id_expression
so that we can get rid of the _deferring_access_checks calls.

We can avoid passing context to finish_id_expression but we can't
completely avoid the _deferring_access_checks calls, because for
address_p we need to call build_offset_ref which needs it.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_splice_expression): For dependent splices return
earlier.  Refactor.  For address_p, build an OFFSET_REF.  Don't pass
context to finish_id_expression.
* semantics.cc (finish_id_expression_1): Adjust an assert to also check
flag_reflection.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: ICE with missing OVERLOAD [PR124150]
Marek Polacek [Tue, 17 Feb 2026 22:08:52 +0000 (17:08 -0500)] 
c++/reflection: ICE with missing OVERLOAD [PR124150]

A function template is supposed to be wrapped in an OVERLOAD.  Since
in certain cases like members_of it is not, splice makes sure to add
the OVERLOAD if needed.  But it wasn't looking into TEMPLATE_ID_EXPRs
and so we ended up with a "naked" TEMPLATE_DECL and crashed.

We can add the missing OVERLOAD in eval_substitute.

PR c++/124150

gcc/cp/ChangeLog:

* reflect.cc (eval_substitute): Add an OVERLOAD around
a DECL_FUNCTION_TEMPLATE_P.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: members_of and friend class [PR123641]
Marek Polacek [Thu, 19 Feb 2026 19:47:26 +0000 (14:47 -0500)] 
c++/reflection: members_of and friend class [PR123641]

The assert in this test currently doesn't pass because .size () is 3, due to
{A, B, B} found in N, but it should only be {A, B}, because we should
skip the hidden "void N::B()".

PR c++/123641

gcc/cp/ChangeLog:

* name-lookup.cc: Move STAT_* and MAYBE_STAT_* macros from here to...
* name-lookup.h: ...here.
* reflect.cc (namespace_members_of): Use them.  Skip STAT_TYPE_HIDDEN_P.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoOpenMP/Fortran: Enforce component order when mapping allocatable DT [PR120505]
Paul-Antoine Arras [Fri, 20 Feb 2026 13:21:55 +0000 (14:21 +0100)] 
OpenMP/Fortran: Enforce component order when mapping allocatable DT [PR120505]

This is a follow-up to r16-5789-g05c2ad4a2e7104.

Consider the following code, assuming tiles is allocatable:

type t
 integer, allocatable :: den1(:,:), den2(:,:)
end type t
[...]
!$omp target enter data map(var%tiles(1)%den2, var%tiles(1)%den1)

r16-5789-g05c2ad4a2e7104 allowed mapping several components from the same
allocatable derived type, provided they are in the right order in user code.
This patch relaxes this constraint by computing offsets and sorting to-be-mapped
components at gimplification time.

PR fortran/120505

gcc/ChangeLog:

* gimplify.cc (omp_accumulate_sibling_list): When the containing struct
is a Fortran array descriptor, sort mapped components by offset.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/map-subarray-12.f90: New test.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/map-subarray-4.f90: New test.

3 months agoOpenMP/Fortran: Map intermediate array descriptors [PR120505]
Paul-Antoine Arras [Fri, 20 Feb 2026 13:21:29 +0000 (14:21 +0100)] 
OpenMP/Fortran: Map intermediate array descriptors [PR120505]

Consider the following OMP directive, assuming tiles is allocatable:

!$omp target enter data &
!$omp   map(to: chunk%tiles(1)%field%density0) &
!$omp   map(to: chunk%left_rcv_buffer)

libgomp reports an illegal memory access error at runtime. This is because
density0 is referenced through tiles, which requires its descriptor to be mapped
along its content.

This patch ensures that all such intervening allocatables in a reference chain
are properly mapped. For the above example, the frontend has to create the
following three additional map clauses:

(1) map (alloc: *(struct tile_type[0:] * restrict) chunk.tiles.data [len: 0])
(2) map (to: chunk.tiles [pointer set, len: 64])
(3) map (attach_detach: (struct tile_type[0:] * restrict) chunk.tiles.data
[bias: -1])

(1) is required by the gimplifier for attaching but will be removed at the end
of the pass; the inner component is explicitly to-mapped elsewhere. (2) ensures
that the array descriptor will be available at runtime to compute offsets and
strides in various dimensions. The gimplifier will turn (3) into a regular
attach of the data pointer and compute the bias.

PR fortran/120505

gcc/fortran/ChangeLog:

* trans-openmp.cc (gfc_map_array_descriptor): New function.
(gfc_trans_omp_clauses): Emit map clauses for intermediate array
descriptors.

gcc/ChangeLog:

* gimplify.cc (omp_mapped_by_containing_struct): Handle Fortran array
descriptors.
(omp_build_struct_sibling_lists): Allow attach_detach bias to be
adjusted on non-target regions.
(gimplify_adjust_omp_clauses): Remove GIMPLE-only nodes.
* tree-pretty-print.cc (dump_omp_clause): Handle
OMP_CLAUSE_MAP_SIZE_NEEDS_ADJUSTMENT and OMP_CLAUSE_MAP_GIMPLE_ONLY.
* tree.h (OMP_CLAUSE_MAP_SIZE_NEEDS_ADJUSTMENT,
OMP_CLAUSE_MAP_GIMPLE_ONLY): Define.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/map-subarray-11.f90: New test.
* testsuite/libgomp.fortran/map-subarray-13.f90: New test.
* testsuite/libgomp.fortran/map-subarray-14.f90: New test.
* testsuite/libgomp.fortran/map-subarray-15.f90: New test.
* testsuite/libgomp.fortran/map-subarray-16.f90: New test.
* testsuite/libgomp.fortran/map-alloc-present-2.f90: New file.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/map-subarray-3.f90: New test.
* gfortran.dg/gomp/map-subarray-5.f90: New test.

3 months agolibstdc++: Harmonize mdspan operator[] and at methods.
Tomasz Kamiński [Thu, 19 Feb 2026 12:53:01 +0000 (13:53 +0100)] 
libstdc++: Harmonize mdspan operator[] and at methods.

This patch changes the implementation of operator[], to follow similar
pattern as at, where we normalize argument types and forward to single
overload. The conversion now uses __mdspan::__index_type_cast, instead
of static_assert. This introduces asserts assuring that conversion is
is value preserving.

Finally, __is_multi_index is implemented as local lambda, avoiding
the need to create a local array with copies of the arguments.

libstdc++-v3/ChangeLog:

* include/std/mdspan (__mdspan::__is_multi_index): Removed,
replaced with local lambda in mdspan::operator[].
(__mdspan::operator[]): Implement in terms of single overload
accepting index_type. Use __mdspan::__index_type_cast for type
conversion.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agolibstdc++: Implement mdspan::at member functions from P3383R3.
Tomasz Kamiński [Thu, 19 Feb 2026 12:14:16 +0000 (13:14 +0100)] 
libstdc++: Implement mdspan::at member functions from P3383R3.

This patch implements P3383R3: mdspan.at().

The mdspan::at cast only non-integral types to the index_type, before
performing the checks. This allows to detect negative value of arguments,
even if the index type is unsigned, and other values that would overflow
index_type.

libstdc++-v3/ChangeLog:

* include/std/mdspan (mdspan::at, mdspan::__index_int_t):
Define.
* testsuite/23_containers/mdspan/at.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 months agoaarch64: Change default -march for SME tests
Alice Carlotti [Sun, 16 Nov 2025 05:05:30 +0000 (05:05 +0000)] 
aarch64: Change default -march for SME tests

The current fallback option -march=armv9-a+sme pulls in an SVE2
dependency that isn't need in most tests.  Switch to -march=armv8-a+sme
so that we test SME without SVE enabled.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/sme/aarch64-sme-acle-asm.exp: Use
-march=armv8-a+sme when SME isn't already enabled.
* g++.target/aarch64/sme/aarch64-sme.exp: Ditto.
* g++.target/aarch64/sme2/aarch64-sme2-acle-asm.exp: Ditto.
* gcc.target/aarch64/sme/aarch64-sme-acle-asm.exp: Ditto.
* gcc.target/aarch64/sme/aarch64-sme.exp: Ditto.
* gcc.target/aarch64/sme2/aarch64-sme2-acle-asm.exp: Ditto.

3 months agoaarch64: Adjust sme tests that require sve
Alice Carlotti [Tue, 30 Dec 2025 08:53:10 +0000 (08:53 +0000)] 
aarch64: Adjust sme tests that require sve

Some SME tests currently require SVE to be enabled as well.  Either mark
this requirement explicitly in the test file (with a pragma), or
eliminate it by modifying the test.

For some check-function-bodies tests we take both approaches - that is,
we add "+sve" to the existing test, and create a duplicate "+nosve" test
that checks for the use of __arm_get_current_vg in the prologue.

For vect-dotprod-twoway.c, the issue is that the number of
udot/sdot/whilelo instructions depends on the selected tuning option.
Pass an explicit -mtune option to preserve the expected codegen.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/sme/exceptions_2.C: Add +sve pragma.
* g++.target/aarch64/sme/exceptions_2_nosve.C: New test.
* gcc.target/aarch64/sme/acle-asm/ldr_vnum_za_sc.c: Remove
svbool_t parameters.
* gcc.target/aarch64/sme/acle-asm/ldr_za_sc.c: Ditto.
* gcc.target/aarch64/sme/acle-asm/str_vnum_za_sc.c: Ditto.
* gcc.target/aarch64/sme/acle-asm/str_za_sc.c: Ditto.
* gcc.target/aarch64/sme/acle-asm/test_sme_acle.h
(TEST_LOAD_ZA_NOPRED, TEST_STORE_ZA_NOPRED): New macros.
* gcc.target/aarch64/sme/call_sm_switch_1.c: Add +sve pragma.
* gcc.target/aarch64/sme/call_sm_switch_1_nosve.c: New test.
* gcc.target/aarch64/sme/call_sm_switch_3.c: Add +sve pragma.
* gcc.target/aarch64/sme/call_sm_switch_3_nosve.c: New test.
* gcc.target/aarch64/sme/call_sm_switch_5.c: Add +sve pragma.
* gcc.target/aarch64/sme/call_sm_switch_6.c: Add +sve pragma.
* gcc.target/aarch64/sme/call_sm_switch_11.c: Add +sve pragma.
* gcc.target/aarch64/sme/call_sm_switch_11_nosve.c: New test.
* gcc.target/aarch64/sme/inlining_9.c: Add +sve pragma.
* gcc.target/aarch64/sme/inlining_10.c: Add +sve pragma.
* gcc.target/aarch64/sme/inlining_11.c: Add +sve pragma.
* gcc.target/aarch64/sme/locally_streaming_1.c:
* gcc.target/aarch64/sme/locally_streaming_1_nosve.c: New test.
* gcc.target/aarch64/sme/pr121028.c: Add +sve to pragma.
* gcc.target/aarch64/sme/vect-dotprod-twoway.c: Add -mtune.
* gcc.target/aarch64/sme2/acle-asm/ldr_zt.c: Use svcntsb instead
of svcntb.
* gcc.target/aarch64/sme2/acle-asm/str_zt.c: Ditto.

3 months agoaarch64: Remove uneccesary +sve2 from SME tests
Alice Carlotti [Sun, 16 Nov 2025 03:50:19 +0000 (03:50 +0000)] 
aarch64: Remove uneccesary +sve2 from SME tests

This reverts the testsuite changes in r15-9067-g432f0dd62c3b29.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_4.c: Remove unnecessary
uses of +sve2.
* gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_single_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c: Ditto.
* gcc.target/aarch64/sve/acle/general-c/clamp_1.c: Ditto.
* gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/storexn_1.c: Ditto.
* gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c:
Ditto.
* gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c: Ditto.
* gcc.target/aarch64/sve/acle/general-c/write_za_1.c: Ditto.
* gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c:
Ditto.

3 months agoaarch64: Remove +sme+nosve sorry
Alice Carlotti [Fri, 2 Jan 2026 16:58:31 +0000 (16:58 +0000)] 
aarch64: Remove +sme+nosve sorry

The preceding patches have fixed support for SME without SVE enabled, so
we can now remove the "sorry" for this configuration.  This allows us to
remove SVE/SVE2 from the features that are added as a workaround when
trying to process a streaming function with SME disabled.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_override_options_internal):
Remove +sme+nosve sorry, and remove SVE from nosme workaround.
* doc/invoke.texi: Remove SVE2 requirement from +sme.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/no-sve-with-sme-1.c: Removed.
* gcc.target/aarch64/no-sve-with-sme-2.c: Removed.
* gcc.target/aarch64/no-sve-with-sme-3.c: Removed.
* gcc.target/aarch64/no-sve-with-sme-4.c: Removed.

3 months agoaarch64: Adjust TARGET_SVE{2}
Alice Carlotti [Fri, 2 Jan 2026 16:58:09 +0000 (16:58 +0000)] 
aarch64: Adjust TARGET_SVE{2}

Many instructions that are currently gated on TARGET_SVE or TARGET_SVE2
are also available in streaming mode when non-streaming SVE is disabled.
The simplest way to reflect this is by updating the macros to include
"|| TARGET_STREAMING".

Any SVE/SVE2 instructions that aren't available in streaming mode
already have an explicit "&& TARGET_NONSTREAMING" in their condition, so
in this case the extra condition has no impact besides a marginal
performance loss.

There are two uses of TARGET_SVE{2} that need handling separately:

- In aarch64_adjust_generic_arch_tuning, we are using features as a
  proxy for tuning decisions, in which case we should treat
  non-streaming mode with SME enabled the same as if either SVE2 or
  streaming mode are enabled.

- In aarch64_update_cpp_builtins, streaming mode enablement is not a
  relevant condition for defining __ARM_FEATURE_* macros, so use an
  explicit feature flags check instead.

gcc/ChangeLog:

* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins):
Replace TARGET_SVE{2} with explicit feature flag checks.
* config/aarch64/aarch64.cc
(aarch64_adjust_generic_arch_tuning): Add SME to SVE2 check.
* config/aarch64/aarch64.h (TARGET_SVE): Adjust condition.
(TARGET_SVE2): Ditto.

3 months agoaarch64: Use __arm_get_current_vg for CFI
Alice Carlotti [Tue, 30 Dec 2025 08:53:57 +0000 (08:53 +0000)] 
aarch64: Use __arm_get_current_vg for CFI

We can't use the cntd instruction in non-streaming mode if SVE is not
available, so instead use __arm_get_current_vg to get the value for the
VG save slot.  This is more expensive, so continue using cntd if we know
we're in streaming mode or have +sve enabled.

gcc/ChangeLog:

* config/aarch64/aarch64-sme.md (UNSPEC_GET_CURRENT_VG): New
enum value.
(aarch64_get_current_vg): New insn.
* config/aarch64/aarch64.cc (aarch64_save_callee_saves): Use
__arm_get_current_vg if cntd is unavailable.

3 months agolibgcc: aarch64: Add __arm_get_current_vg
Alice Carlotti [Tue, 30 Dec 2025 08:52:24 +0000 (08:52 +0000)] 
libgcc: aarch64: Add __arm_get_current_vg

AAPCS64* specifies several runtime support routines that must be
supported by any platform that supports SME.  Add __arm_get_current_vg
to libgcc to help meet this requirement.  This will be used to enable
support for SME without (non-streaming) SVE.

*https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst

libgcc/ChangeLog:

* config/aarch64/libgcc-sme.ver: Add __arm_get_current_vg.
* config/aarch64/t-aarch64: Add new source file.
* config/aarch64/__arm_get_current_vg.S: New file.

3 months agotestsuite: Improve check-function-bodies logging
Alice Carlotti [Fri, 2 Jan 2026 13:59:02 +0000 (13:59 +0000)] 
testsuite: Improve check-function-bodies logging

When a check-function-bodies test fails, it can sometimes be hard to
identify which part of a large function regexp is causing the failure.
To aid debugging these failures, find the largest initial set of lines
that matches the function, and log this separately from the remainder of
the regexp.

Additionally, add a newline before logging the function bodies, so that
the first line has the same indentation as the rest of that function.

gcc/testsuite/ChangeLog:

* lib/scanasm.exp (check_function_body): Log matching portion
of body_regexp separately.

3 months agofortran: Initialize gfc_se in PDT component allocation [PR123949]
Christopher Albert [Sun, 22 Feb 2026 21:07:19 +0000 (22:07 +0100)] 
fortran: Initialize gfc_se in PDT component allocation [PR123949]

Add missing gfc_init_se call for the default initializer case in
ALLOCATE_PDT_COMP.  The adjacent KIND/LEN block (line 11118) and
pdt_string block (line 11149) both initialize tse, but this block
left it uninitialized, causing undefined behavior when tse.ss
contained stack garbage.  Exposed as an ICE in gfc_conv_constant
(trans-const.cc:425) on aarch64 with LTO bootstrap.

PR fortran/123949

gcc/fortran/ChangeLog:

* trans-array.cc (structure_alloc_comps): Add missing
gfc_init_se call in case ALLOCATE_PDT_COMP for scalar
component default initializer.

Signed-off-by: Christopher Albert <albert@tugraz.at>
3 months agoa68: more standard prelude in Algol 68
Jose E. Marchesi [Mon, 23 Feb 2026 00:29:56 +0000 (01:29 +0100)] 
a68: more standard prelude in Algol 68

This commit moves the contents of libga68/transput.a68.in to
libga68/standard.a68.in and removes the built-in expansion of the
L_{int,real,exp}_width standard routines.

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

* transput.a68.in: Remove and move content to..
* standard.a68.in: .. here.
* Makefile.am (libga68_la_DEPENDENCIES): Remove transput.lo.
(libga68_la_LIBADD): Likewise.
(transput.a68): Remove rule.
(standard.a68): Remove transput.a68.
* Makefile.in: Regenerate.

gcc/algol68/ChangeLog

* a68.h: Remove prototypes for *_width functions.
* a68-parser-prelude.cc (stand_prelude): Do not define *width
functions.
* a68-low-ints.cc (a68_int_width): Remove.
* a68-low-reals.cc (a68_real_width): Likewise.
(a68_real_exp_width): Likewise.
* a68-low-prelude.cc (a68_lower_longintwidth): Likewise.
(a68_lower_intwidth): Likewise.
(a68_lower_longlongintwidth): Likewise.
(a68_lower_shortintwidth): Likewise.
(a68_lower_shortshortintwidth): Likewise.
(a68_lower_realwidth): Likewise.
(a68_lower_longrealwidth): Likewise.
(a68_lower_longlongrealwidth): Likewise.
(a68_lower_expwidth): Likewise.
(a68_lower_longexpwidth): Likewise.
(a68_lower_longlongexpwidth): Likewise.

gcc/testsuite/ChangeLog

* algol68/execute/char-in-string-1.a68: It is no longer need to
access Transput explicitly.

3 months agoDaily bump.
GCC Administrator [Mon, 23 Feb 2026 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

3 months agoPR c/123716: Fix an unexpected error_mark_node ICE.
Roger Sayle [Sun, 22 Feb 2026 22:32:05 +0000 (22:32 +0000)] 
PR c/123716: Fix an unexpected error_mark_node ICE.

This patch resolves the P4 regression PR c/123716.

2026-02-22  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR c/123716
* tree.cc (tree_nop_conversion_p): Move sanity checks on
inner_type to here...
(tree_nop_conversion): ... from here.

gcc/testsuite/ChangeLog
PR c/123716
* gcc.dg/pr123716.c: New test case.

3 months agoa68: new test trimmer-12.a68
Jose E. Marchesi [Sun, 22 Feb 2026 21:22:42 +0000 (22:22 +0100)] 
a68: new test trimmer-12.a68

This new test makes sure that the bounds are adjusted while trimming
dimensions of multiples with implicit lower and implicit upper bounds.

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

* algol68/execute/trimmer-12.a68: New test.

3 months agoc++: Fix up recent regression in convert_nontype_argument for C++1[14] [PR124173]
Jakub Jelinek [Sun, 22 Feb 2026 21:09:13 +0000 (22:09 +0100)] 
c++: Fix up recent regression in convert_nontype_argument for C++1[14] [PR124173]

The following testcase is rejected since my recent convert_nontype_argument
change, but only in C++11/14 modes.
The problem is that C++17 says that all NTTPs should be converted constant
expressions, but C++11 only said that for integral and enumeration ones and
something that applied to the decltype(nullptr) case was
- a constant expression that evaluates to a null pointer value
The problem is that for NULLPTR_TYPE_P for C++11/14, we just never called
maybe_constant_value, so obviously just making sure it is integer_zerop and
without tf_error returning NULL_TREE otherwise changes behavior on valid
programs, we really need to constant evaluate it first.

The following patch fixes that.

I'm afraid I actually don't know what exactly C++14 specifies, whether I've
grabbed a pre-C++14 or post-C++14 draft, which looked like the C++17
wording.   So, if C++14 needs something different, we'll need a further
change, but this at least fixes the regression.

2026-02-22  Jakub Jelinek  <jakub@redhat.com>

PR c++/124173
* pt.cc (convert_nontype_argument): For C++11/C++14 handle
NULLPTR_TYPE_P non-type arguments like TYPE_PTR_P.

* g++.dg/cpp0x/pr124173.C: New test.

3 months agoc++: Fix up CWG 3123 expansion stmt handling once again [PR124184]
Jakub Jelinek [Sun, 22 Feb 2026 21:07:45 +0000 (22:07 +0100)] 
c++: Fix up CWG 3123 expansion stmt handling once again [PR124184]

Barry Revzin mentioned in private mail that we reject the following
testcase even when it should be accepted.
The problem is that I thought finish_call_expr with tf_none would
be just harmless, but it is not, it can result in errors while trying
to instantiate something else (e.g. the noexcept).
So, instead of doing finish_call_expr with tf_none and only if that
returns error_mark_node calling it again with tf_any_viable, the
following patch just calls it only with tf_any_viable immediately.

2026-02-22  Jakub Jelinek  <jakub@redhat.com>

PR c++/124184
* parser.cc (cp_perform_range_for_lookup): If tf_error is
missing, call finish_call_expr after perform_koenig_lookup
calls immediately with tf_any_viable instead of twice, once
with tf_none and then with tf_any_viable.
* pt.cc (finish_expansion_stmt): Remove unneeded parens.

* g++.dg/cpp26/expansion-stmt31.C: New test.

3 months agolibcpp: Fix ICE with directives-only and cpp_maybe_module_directive [PR124153]
Nathaniel Shead [Sat, 21 Feb 2026 11:32:25 +0000 (22:32 +1100)] 
libcpp: Fix ICE with directives-only and cpp_maybe_module_directive [PR124153]

When doing directives-only processing (-E -fdirectives-only, or -M) we
crash if we hit an unexpected CPP_PRAGMA_EOL because we 'know' we're in
a module directive but the in_deferred_pragma flag is no longer set.

Fixed by undoing the "finished a module directive" behaviour within
cpp_maybe_module_directive if we're bailing due to an ill-formed peeked
token.

PR c++/124153

libcpp/ChangeLog:

* lex.cc (cpp_maybe_module_directive): Set in_deferred_pragma
and eol when we see an unexpected CPP_PRAGMA_EOL.

gcc/testsuite/ChangeLog:

* g++.dg/modules/cpp-22.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agolibcpp: Fix reading from stdin with -fsearch-include-path [PR119756]
Nathaniel Shead [Sat, 21 Feb 2026 13:32:00 +0000 (00:32 +1100)] 
libcpp: Fix reading from stdin with -fsearch-include-path [PR119756]

When using -fsearch-include-path, we prepend the result of
search_path_head to the provided filenames, which for non-absolute paths
will return "./".  At this point, stdin is represented by the empty
string, and so prepending "./" confuses 'open_file'.  This patch fixes
the issue by treating stdin as-if it were an absolute path.

PR c++/119756

libcpp/ChangeLog:

* files.cc (search_path_head): Also treat empty string (stdin)
as an absolute path.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agodriver: Escape special characters in '-fdeps-{file,target}' [PR120974]
Nathaniel Shead [Sun, 22 Feb 2026 02:09:00 +0000 (13:09 +1100)] 
driver: Escape special characters in '-fdeps-{file,target}' [PR120974]

The driver uses the 'join' function to calculate the default output for
the -fdeps-file and -fdeps-target parameters from the parameter given to
-o (or the basename of the input file).  But if the path given to -o has
any whitespace in it this causes cc1plus to see arguments like

  "-o some file.o" "-fdeps-file=some" "file.ddi"

which breaks.  Fixed by adjusting the 'join' function to escape any
special characters in the result.

PR c++/120974

gcc/ChangeLog:

* gcc.cc (join_spec_func): Escape special characters.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 months agoc++/reflection: anon union member from splice [PR123642]
Valentyn Yukhymenko [Fri, 20 Feb 2026 16:31:36 +0000 (16:31 +0000)] 
c++/reflection: anon union member from splice [PR123642]

Fixes a bogus "'Cls::<unnamed union>' is not a base of 'const Cls'" error
when user tries to do a class member lookup using splice with reflection of
anon union member.

PR c++/123642

gcc/cp/ChangeLog:

* typeck.cc (finish_class_member_access_expr): Change context lookup
to handle anon union members.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/member4.C: Remove expected error.
* g++.dg/reflect/anon4.C: New test based on original bug report.

Signed-off-by: Valentyn Yukhymenko <valentin.yukhymenko@gmail.com>
3 months agoAda: Fix inaccurate documentation of Max_Tasks restriction
Eric Botcazou [Sun, 22 Feb 2026 10:44:34 +0000 (11:44 +0100)] 
Ada: Fix inaccurate documentation of Max_Tasks restriction

The restriction is implementation defined and only enforced at compile
time by GNAT, so Storage_Error is never raised at run time.

gcc/ada
PR ada/124192
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
(Max_Tasks): Adjust description.
* gnat_rm.texi: Regenerate.

3 months agoAda: Fix crash on call to null procedure as triggering statement of select
Eric Botcazou [Sun, 22 Feb 2026 10:23:35 +0000 (11:23 +0100)] 
Ada: Fix crash on call to null procedure as triggering statement of select

This is really a corner case, but it exposes a couple of small issues in
Analyze_Triggering_Alternative that are worth fixing: 1) the detection of
delay and entry call statements is not robust enough and 2) there is also
a thinko in the detection of procedure call statements.

gcc/ada/
PR ada/124179
* sem_ch9.adb (Analyze_Triggering_Alternative): Use more robust
test for delay and entry call statements and fix thinko in test
for procedure call statements.

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

3 months agoa68: fix trimmers with implicit lower and upper bounds
Jose E. Marchesi [Sun, 22 Feb 2026 00:49:32 +0000 (01:49 +0100)] 
a68: fix trimmers with implicit lower and upper bounds

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

* a68-low-units.cc (lower_subscript_for_trimmers): Do not crash
with trimmers with implicit lower and upper bounds.

gcc/testsuite/ChangeLog

* algol68/execute/trimmer-11.a68: New test.

3 months agoDaily bump.
GCC Administrator [Sun, 22 Feb 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

3 months agoxtensa: constantsynth: Exclude the stack pointer
Takayuki 'January June' Suwa [Fri, 20 Feb 2026 12:17:15 +0000 (21:17 +0900)] 
xtensa: constantsynth: Exclude the stack pointer

When updating the value of the stack pointer through a sequence of instruc-
tions, only the last instruction in the sequence must modify the stack
pointer, because the stack pointer may be referenced by an interrupt or
other event during the sequence:

     /* example */
     register void *stack_ptr asm ("a1");
     void test(void) {
       stack_ptr = (void *)0x04000000;
     }

     ;; before (-O -mabi=call0)
     test:
      movi.n sp, 1 ;; An interrupt may occur
      slli sp, sp, 26 ;; between these instructions
      ret.n

This patch avoids this problem by excluding constant value assignments to
the stack pointer from 'constantsynth'.

     ;; after (-O -mabi=call0)
      .literal_position
      .literal .LC0, 67108864
     test:
      l32r sp, .LC0
      ret.n

gcc/ChangeLog:

* config/xtensa/xtensa.cc (constantsynth_pass1):
Add the case where the assignment destination is a stack pointer
to the exclusion criteria for processing.

3 months agoa68: couple more fixes for error formatting tags
Jose E. Marchesi [Sat, 21 Feb 2026 21:33:46 +0000 (22:33 +0100)] 
a68: couple more fixes for error formatting tags

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

* a68-parser-bottom-up.cc (reduce_formal_holes): Fix error format
tag.
* a68-parser-taxes.cc (test_firmly_related_ops_local): Likewise.
(already_declared_hidden): Likewise.

3 months agoa68: fix error format string in Archive_file::initilize_big_archive
Jose E. Marchesi [Sat, 21 Feb 2026 21:16:11 +0000 (22:16 +0100)] 
a68: fix error format string in Archive_file::initilize_big_archive

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

* a68-imports-archive.cc (Archive_file::initialize_big_archive):
Fix formatting tag in call to a68_error.

3 months agoa68: fix %%< and %%> marks in snprintf calls
Jose E. Marchesi [Sat, 21 Feb 2026 20:36:19 +0000 (21:36 +0100)] 
a68: fix %%< and %%> marks in snprintf calls

The function a68_mode_error_text computes a string that is then passed
to a68_error or a68_warning.  The later functions feed the resulting
string to the diagnostics machinery, which knows how to handle %< and
%>, but the *printf calls don't.  Therefore the %s have to be escaped
for %< and %> to be interpreted literally.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
* a68-moids-diagnostics.cc (a68_mode_error_text): Properly escape
%< and %> in snprintf calls.

3 months agolibatomic: Fix race condition in libatomic all-local
Jakub Jelinek [Sat, 21 Feb 2026 20:17:43 +0000 (21:17 +0100)] 
libatomic: Fix race condition in libatomic all-local

In the past few bootstraps/regtests, I got occassionally one random FAIL
in libgomp testsuite, and the log said in each of the cases something like
obj02/x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.log:/usr/bin/ld: error: /home/jakub/src/gcc/obj02/gcc/libatomic.so: file too short
obj02/x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.log:/usr/bin/ld: error: /home/jakub/src/gcc/obj02/gcc/libatomic.so: file too short
obj05/i686-pc-linux-gnu/libgomp/testsuite/libgomp.log:/home/jakub/src/gcc/obj05/gcc/libatomic.so: file not recognized: file format not recognized
obj05/i686-pc-linux-gnu/libgomp/testsuite/libgomp.log:/home/jakub/src/gcc/obj05/gcc/libatomic.so: file not recognized: file format not recognized

I think what happens is that make check in libgomp and make check
in libatomic directories happen concurrently and in libatomic
there is the check -> check_recursive -> check-am -> all-am -> all-local
chain of dependencies.  And all-local is like many other automake goals
.PHONY, so even when it depends on libatomic.la, it is reexecuted each time
and each time attempts to install libatomic*.{so,a}* again, which can race
with make check in other directories.

The following patch fixes it by just adding dependency for all-local
on stmp-libatomic file and only rule for that file dependent on libatomic.la
and performing the installation.  So, if libatomic.la is not relinked, nothing
is reinstalled.

2026-02-21  Jakub Jelinek  <jakub@redhat.com>

* Makefile.am (all-local): Depend on stmp-libatomic and otherwise
do nothing.
(stmp-libatomic): New goal, move all commands from all-local here plus
touch $@ at the end.
* Makefile.in: Regenerate.

3 months agoa68: make Algol 68 diagnostics to use pp_format tags
Jose E. Marchesi [Sat, 21 Feb 2026 13:53:55 +0000 (14:53 +0100)] 
a68: make Algol 68 diagnostics to use pp_format tags

This commit changes the Algol 68 front-end diagnostics so it uses
regular format strings as recognized as pp_format, instead of the
upper-letter tags inherited from Genie.

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

* a68-pretty-print.h: New file.
* a68.h: Mark prototypes of diagnostic functions with
ATTRIBUTE_A68_DIAG.
* a68-diagnostics.cc (diagnostic): Do not translate upper-case
tags and pass a copy of the va_list `args' to diagnostic_set_info.
Mark with ATTRIBUTE_A68_DIAG.
* a68-imports-archive.cc: Convert to use standard error format
tags.
* a68-parser-victal.cc: Likewise.
* a68-parser-top-down.cc: Likewise.
* a68-parser-taxes.cc: Likewise.
* a68-parser-scanner.cc: Likeise.
* a68-parser-moids-check.cc: Likewise.
* a68-parser-modes.cc: Likewise.
* a68-parser-extract.cc: Likewise.
* a68-parser-pragmat.cc: Likewise.
* a68-parser-scope.cc: Likewise.
* a68-parser-brackets.cc: Likewise.
* a68-parser-bottom-up.cc: LIkewise.
* a68-moids-diagnostics.cc: Likewise.
* a68-imports.cc: Likewise.

3 months agoa68: fix handling of & in C formal hole symbols
Jose E. Marchesi [Sat, 21 Feb 2026 16:12:24 +0000 (17:12 +0100)] 
a68: fix handling of & in C formal hole symbols

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

* a68-low.cc (a68_make_formal_hole_decl): Get a boolean indicating
whether the declaration is for the address of the given symbol.
* a68.h: Update prototype of a68_make_formal_hole_decl.
* a68-low-holes.cc (a68_wrap_formal_var_hole): Pass a boolean to
a68_make_formal_hole_decl indicating whether an address is
required.

3 months agoa68: implementation of L bits_pack in standard prelude
Jose E. Marchesi [Wed, 18 Feb 2026 00:23:27 +0000 (01:23 +0100)] 
a68: implementation of L bits_pack in standard prelude

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

* a68-parser-prelude.cc (stand_prelude): Remove definitions for
bitpacks.

gcc/testsuite/ChangeLog

* algol68/compile/warning-hidding-4.a68: Mention bitspack.

libga68/ChangeLog

* standard.a68.in ({L_}bits_pack): New procedures.

3 months agoa68: standard Algol 68 preludes in Algol 68
Jose E. Marchesi [Mon, 2 Feb 2026 00:53:29 +0000 (01:53 +0100)] 
a68: standard Algol 68 preludes in Algol 68

This big commit:

* Adds support to the FFI mechanism to map Algol 68 procedures
  returning strings to an equivalent C interface.

* Adds a new command-line option -fbuilding-libga68.

* Adds support for having modules in libga68 implicitly invoked in
  user-written programs and modules.

* Using the infrastructure agove, removes the compiler-generated glue
  to call the standard POSIX prelude shipped in libga68 to, instead, use
  the formal holes mechanism for FFI.

* Adds posix.a68 to libga68.

* Adds standard.a68 to libga68.

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

* a68-moids-misc.cc (a68_is_c_mode): Allow C formal holes for
routines yielding strings.
* a68-low-holes.cc (a68_wrap_formal_proc_hole): Support wrappers
that yield strings.
* a68.h: Remove a68_posix_* and a68_lower_posix* prototypes.
* a68-low-posix.cc: Remove.
* a68-imports.cc (a68_open_packet): Get argument filename.
* Make-lang.in (ALGOL68_OBJS): Remove algol68/a68-low-posix.o.
* a68-low-runtime.def: Remove POSIX_*.
* lang.opt (-fcheck): Add new undocumented option -fbuilding-libga68.
* a68-parser-prelude.cc (stand_transput): New function.
(posix_prelude): Remove hardcoded additions to the top-level
environment and use a68_extract_revelations instead.
* a68-parser-extract.cc (a68_extract_revelation): Renamed from
extract_revelation and made accessible externally.
* a68-low.cc (a68_make_formal_hole_decl): Remove unneeded check.
(lower_lude_decl): New function.
(lower_module_text): Add calls to preludes and postludes of
standard modules if not building libga68.
(a68_lower_particular_program): Likewise.
* a68-low-prelude.cc (a68_lower_posixargc): Remove.
(a68_lower_posixargv): Likewise.
(a68_lower_posixgetenv): Likewise.
(a68_lower_posixputchar): Likewise.
(a68_lower_posixputs): Likewise.
(a68_lower_posixfconnect): Likewise.
(a68_lower_posixfopen): Likewise.
(a68_lower_posixfcreate): Likewise.
(a68_lower_posixfclose): Likewise.
(a68_lower_posixfsize): Likewise.
(a68_lower_posixlseek): Likewise.
(a68_lower_posixseekcur): Likewise.
(a68_lower_posixseekend): Likewise.
(a68_lower_posixseekset): Likewise.
(a68_lower_posixstdinfiledes): Likewise.
(a68_lower_posixstdoutfiledes): Likewise.
(a68_lower_posixstderrfiledes): Likewise.
(a68_lower_posixfileodefault): Likewise.
(a68_lower_posixfileordwr): Likewise.
(a68_lower_posixfileordonly): Likewise.
(a68_lower_posixfileowronly): Likewise.
(a68_lower_posixfileotrunc): Likewise.
(a68_lower_posixerrno): Likewise.
(a68_lower_posixexit): Likewise.
(a68_lower_posixperror): Likewise.
(a68_lower_posixstrerror): Likewise.
(a68_lower_posixfputc): Likewise.
(a68_lower_posixfputs): Likewise.
(a68_lower_posixgetchar): Likewise.
(a68_lower_posixfgetc): Likewise.
(a68_lower_posixgets): Likewise.
(a68_lower_posixfgets): Likewise.

gcc/testsuite/ChangeLog

* lib/algol68.exp (algol68_init): Add -I options to
ALGOL68_UNDER_TEST so exports in libga68.{a,so} are found.
* algol68/compile/warning-hidding-6.a68: Likewise.
* algol68/compile/warning-hidding-5.a68: Use maxint instead of
getchar to trigger the warning.
* algol68/compile/error-nest-4.a68: Procedures yielding strings
are now on in C formal holes.

libga68/ChangeLog

* posix.a68: New file.
* standard.a68.in: Likewise.
* ga68-posix.c (_libga68_stdin): Define.
(_libga68_stdout): Likewise.
(_libga68_stderr): Likewise.
(_libga68_file_o_default): Likewise.
(_libga68_file_o_rdonly): Likewise.
(_libga68_file_o_rdwr): Likewise.
(_libga68_file_o_trunc): Likewise.
(_libga68_seek_cur): Likewise.
(_libga68_seek_end): Likewise.
(_libga68_seek_set): Likewise.
(_libga68_posixstrerror): Update interface to new way of returning
Algol 68 strings.
(_libga68_posixargv): Likewise.
(_libga68_posixfgets): Likewise.
(_libga68_posixgets): Likewise.
(_libga68_posixfopen): Use _libga68_file_o_default rather than FILE_O_DEFAULT.
(_libga68_posixfopen): Ditto for other FILE_O_* values.
* ga68.h: Update prototypes.
* Makefile.am (libga68_la_LIBADD): Add standard.lo.
(libga68_la_DEPENDENCIES): Likeise.
(.a68.o): Pass -fbuilding-libga68.
(.a68.lo): Likewise.
(standard.a68): New rule.
* Makefile.in: Regenerate.
* transput.a68.in: Add Emacs -*- mode: a68 -*- comment.

3 months agoa68: distinguish between NO_LOWERER and LOWERER_UNIMPL
Jose E. Marchesi [Thu, 19 Feb 2026 02:46:57 +0000 (03:46 +0100)] 
a68: distinguish between NO_LOWERER and LOWERER_UNIMPL

Until now all the identifiers interned in A68_STANDENV were lowered by
using an explicit lowering routine.  This is because the entirely of
the standard preludes were implemented by having the compiler generate
the corresponding code inline.  We have a check in place to determine
whether a lowerer has been installed for a given standard construct:
NO_LOWERER.  This is a lowerer routine that just prints a message and
ICEs.

We want to write part of the standard preludes in Algol 68.  To make
that possible this patch introduces a distinction between NO_LOWERER,
meaning the definition comes from Algol 68 code in the runtime library
and therefore does not use a lowering routine, and LOWERER_UNIMPL,
which means the definition uses a lowering routine but a proper one
has not been written yet.

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

* a68-types.h (NO_LOWERER): Redefine as NULL.
(LOWERER_UNIMPL): Define.
* a68-parser-prelude.cc (a68_idf): Use LOWERER_UNIMPL instead of
NO_LOWERER.
(a68_prio): Likewise.
(a68_op): Likewise.
* a68-low-units.cc (a68_lower_identifier): Do not assume
declarations in A68_STANDENV all have lowerers.
(a68_lower_formula): Likewise.
(a68_lower_monadic_formula): Likewise.

3 months agoa68: support for importing exports data from archives
Jose E. Marchesi [Wed, 18 Feb 2026 11:11:07 +0000 (12:11 +0100)] 
a68: support for importing exports data from archives

The compiler tries to find exports data for accessed modules by
trying, in order:

* Standalone files: FOO.m68
* Shared object:    libFOO.so
* Archives:         libFOO.a
* Object files:     FOO.o

This commit adds support for archives.  Most of the code is copied
from the go FrontEnd's gcc/go/import-archive.c.

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

* a68-imports.cc (a68_find_export_data): Make visible externally.
(a68_find_export_data): Try reading export data from an archive
file.
* a68.h: Adjust prototype of a68_find_export_data accordingly.
* a68-imports-archive.cc: New file.
* Make-lang.in (ALGOL68_OBJS): Build algol/a68-imports-archive.o.

3 months ago[PR rtl-optimization/123994] Bullet-proof RTL-SSA loop to determine insertion location
Jeff Law [Sat, 21 Feb 2026 18:49:11 +0000 (11:49 -0700)] 
[PR rtl-optimization/123994] Bullet-proof RTL-SSA loop to determine insertion location

As discussed in the PR, there's two things we want to do WRT this bug.

First, we want to bullet-proof this loop.  It's trying to find an insertion
point, but can run off the end of the insn chain in the process.  That's enough
to fix the regression and the purpose of this patch.

For gcc-17 Richard S. has a more invasive change which fixes the underlying
cause of walking off the end of the insn chain.  This patch has the potential
to trigger more combinations which in turn could trip over latent bugs, so we
agreed to defer that fix until the gcc-17 cycle out of an abundance of caution.

My fix has been bootstrapped and regression tested on x86.  Pushing to the
trunk.

PR rtl-optimization/123994
gcc/
* rtl-ssa/changes.cc (function_info::verify_insn_changes): Bullet
proof loop to not fault if we run off the end of the insn chain.

gcc/testsuite/
* gcc.dg/torture/pr123994.c: New test.

3 months ago[PR target/124147] Fix build failure with clang on RISC-V
Jeff Law [Sat, 21 Feb 2026 16:32:07 +0000 (09:32 -0700)] 
[PR target/124147] Fix build failure with clang on RISC-V

Trivial fix for a build failure using clang.  The argument here is a pointer,
not a location_t.

Pushed to the trunk as obvious.

PR target/124147
gcc/
* config/riscv/riscv.cc (riscv_same_function_versions): Use nullptr_t rather
than UNKNOWN_LOCATION for pointer argument.

3 months agoRevert "Fortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]"
Harald Anlauf [Sat, 21 Feb 2026 07:24:20 +0000 (08:24 +0100)] 
Revert "Fortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]"

This reverts commit 84ef4948609260266f365c63ce429476fd31262f.

3 months agoDaily bump.
GCC Administrator [Sat, 21 Feb 2026 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

3 months agoAda: Fix finalization glitch for pools with subpools
Eric Botcazou [Fri, 20 Feb 2026 19:46:30 +0000 (20:46 +0100)] 
Ada: Fix finalization glitch for pools with subpools

Finalize_Pool calls Finalize_And_Deallocate on every subpool handle, but
the parameter is declared with In Out mode, so the call ends up writing
back the updated value into the node that was just deallocated.

gcc/ada/
* libgnat/s-stposu.adb (Finalize_Pool): Pass a local copy of the
handle in the call to Finalize_And_Deallocate.

3 months agoFortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]
Gonzalo Silvalde Blanco [Fri, 20 Feb 2026 19:30:55 +0000 (20:30 +0100)] 
Fortran: Fix diagnostic for ambiguous pointer function assignment [PR80012]

The error message for an ambiguous pointer function assignment contained a
FIXME and an embedded newline that the diagnostics printer does not handle.
Split the single gfc_error call into a gfc_error for the main diagnostic
and an inform note for the F2008 explanation, wrapped in an
auto_diagnostic_group.

PR fortran/80012

gcc/fortran/ChangeLog:

* symbol.cc (gfc_add_procedure): Split error into gfc_error and
inform using auto_diagnostic_group.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Gonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>
3 months agoFortran: [PR123949] Fix PDT ICE with large KIND values.
Jerry DeLisle [Fri, 20 Feb 2026 00:59:16 +0000 (16:59 -0800)] 
Fortran: [PR123949] Fix PDT ICE with large KIND values.

Signed-off-by: Christopher Albert <albert@tugraz.at>
PR fortran/123949

gcc/fortran/ChangeLog:

* decl.cc (gfc_get_pdt_instance): Use full integer string encoding
for PDT instance naming rather than 32-bit extraction, which caused
ICEs for valid large KIND values.

gcc/testsuite/ChangeLog:

* gfortran.dg/pdt_85.f03: New test.
* gfortran.dg/pr123949.f90: New test.

3 months agoopenmp: Fix regression in libgomp.c++/target-6.C testcase [PR113436]
Kwok Cheung Yeung [Fri, 20 Feb 2026 16:07:45 +0000 (16:07 +0000)] 
openmp: Fix regression in libgomp.c++/target-6.C testcase [PR113436]

The fix for PR113436 introduced a regression causing the
libgomp.c++/target-6.C testcase to fail on some configurations.

This was caused by a change in how is_variable_sized is applied for variables
that are references in private clauses, causing the path that was intended for
variables that are variable-sized in themselves to be taken, instead of
that for referencing a variable-sized object.

2026-02-20  Kwok Cheung Yeung  <kcyeung@baylibre.com>

gcc/

PR middle-end/113436
* omp-low.cc (omp_lower_target):  Do not check for variable-length
variables in private clauses by reference when allocating memory.

gcc/testsuite/

PR middle-end/113436
* g++.dg/gomp/pr113436-2.C: New.

3 months agotree-optimization/124068 - fix missed AVX2 vectorization of shift
Richard Biener [Wed, 18 Feb 2026 12:46:38 +0000 (13:46 +0100)] 
tree-optimization/124068 - fix missed AVX2 vectorization of shift

The following fixes a regression in AVX2 vectorization because on
trunk we are now correctly determine we can shorten a shift operation
but we never really bothered to check we can implement the
resulting operation.  With the patch we now check this.  For shifts
and rotates we have the choice between vector-vector and vector-scalar
operations which in the end depends on whether we perform SLP or not
and how the shift operand matches up.  The patch heuristically
assumes that constant or external shifts can be handled by vector-scalar
operations.

As we were not checking for target support was to allow recursive matching
other patterns, the following still errors on that side in case the
original operation was not supported by the target or it is binary and
the 2nd operand is a constant.  This helps avoiding regressions in
gcc.dg/vect/vect-over-widen-13.c and gcc.dg/vect/vect-div-bitmask-1.c
and gcc.target/aarch64/sve2/div-by-bitmask_1.c where the operation in
question is integer division.

PR tree-optimization/124068
* tree-vect-patterns.cc (target_has_vecop_for_code): Move
earlier, add defaulted optab_subtype parameter.
(vect_recog_over_widening_pattern): Check that the target
supports the narrowed operation before committing to the
pattern.

* gcc.target/i386/vect-shift-1.c: New testcase.

3 months agoipa-cp: Also look at self-recursive ancestor jump functions (PR122856)
Martin Jambor [Fri, 20 Feb 2026 13:34:27 +0000 (14:34 +0100)] 
ipa-cp: Also look at self-recursive ancestor jump functions (PR122856)

PR 122856 shows that when looking at self recursive calls with
self-feeding jump functions, we did consider pass-through functions
but not ancestor functions with zero offsets.  This then leads to the
fact that constants which were collected from IPA-CP lattices were not
among those collected from available edges, triggering a verification
assert.

This patch fixes that by also detecting self-feeding ancestor jump
functions.

gcc/ChangeLog:

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

PR ipa/122856
* ipa-cp.cc (self_recursive_pass_through_p): Test jump function type first.
(self_recursive_ancestor_p): New function.
(find_scalar_values_for_callers_subset): Test also for self-recursive
ancestor jump functions.
(push_agg_values_for_index_from_edge): Likewise.

gcc/testsuite/ChangeLog:

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

PR ipa/122856
* g++.dg/ipa/pr122856.C: New test.

3 months agolibstdc++: Fix testsuite breakage in r16-7593-g39edc2aea24f9a
Jonathan Wakely [Fri, 20 Feb 2026 09:17:31 +0000 (09:17 +0000)] 
libstdc++: Fix testsuite breakage in r16-7593-g39edc2aea24f9a

Fix my broken r16-7593-g39edc2aea24f9a commit which was an incomplete
version of what I originally tested.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (v3-minimum-std): Remove second
and third args in favour of using globals.

3 months agofold/dse: Don't simplify/remove noreturn functions [PR121103]
Andrew Pinski [Mon, 2 Feb 2026 05:08:54 +0000 (21:08 -0800)] 
fold/dse: Don't simplify/remove noreturn functions [PR121103]

This fixes 2 related bugs. The user marks memmove as noreturn
so when we simplify the memmove to a memory load/store there
is no longer a statement that can alter the CFG and things go
down hill.
The same is true for removing the call in DSE.
So the fix is not to simplify/take into account the call from
gimple-fold and DSE.

changes since v1:
 * v2: Use gimple_call_ctrl_altering_p instead of flags.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/121103

gcc/ChangeLog:

* gimple-fold.cc (gimple_fold_call): Don't simplify
noreturn functions.
* tree-ssa-dse.cc (dse_optimize_stmt): Don't handle
calls to noreturn functions.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 months agocobol: Update and expand DejaGNU test suite.
Robert Dubner [Fri, 20 Feb 2026 02:15:59 +0000 (21:15 -0500)] 
cobol: Update and expand DejaGNU test suite.

The cobol.dg/group2 tests are extracted from a list of autotest programs
that are not maintained in the gnu GCC repository.  They can be see at
/https://gitlab.cobolworx.com/COBOLworx/gcc-cobol.

Many of these tests have been refined in order to make them work
properly when the exec-charset is ASCII, EBCDIC, or UTF16.  The changes
to existing tests seen here largely reflect those changes.

The new files shown below are newly extracted from that same list of
tests.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob: Updated.
* cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out: Updated.
* cobol.dg/group2/ALPHABETIC-LOWER_test.cob: Updated.
* cobol.dg/group2/ALPHABETIC-UPPER_test.cob: Updated.
* cobol.dg/group2/ALPHABETIC_test.cob: Updated.
* cobol.dg/group2/Context_sensitive_words__1_.cob: Updated.
* cobol.dg/group2/DEBUG_Line.cob: Updated.
* cobol.dg/group2/DISPLAY__Sign_ASCII.cob: Updated.
* cobol.dg/group2/DISPLAY__Sign_ASCII.out: Updated.
* cobol.dg/group2/DISPLAY__Sign_ASCII__2_.cob: Updated.
* cobol.dg/group2/DISPLAY__Sign_ASCII__2_.out: Updated.
* cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.cob: Updated.
* cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob: Updated.
* cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob: Updated.
* cobol.dg/group2/FUNCTION_BYTE-LENGTH.out: Updated.
* cobol.dg/group2/FUNCTION_CHAR.cob: Updated.
* cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Updated.
* cobol.dg/group2/FUNCTION_HEX-OF.cob: Updated.
* cobol.dg/group2/FUNCTION_HEX-OF.out: Updated.
* cobol.dg/group2/FUNCTION_ORD.cob: Updated.
* cobol.dg/group2/FUNCTION_ORD.out: Updated.
* cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob: Updated.
* cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob: Updated.
* cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob: Updated.
* cobol.dg/group2/Hexadecimal_literal.cob: Updated.
* cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob: Updated.
* cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out: Updated.
* cobol.dg/group2/LENGTH_OF_omnibus.cob: Updated.
* cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.cob: Updated.
* cobol.dg/group2/PACKED-DECIMAL_dump.cob: Updated.
* cobol.dg/group2/PACKED-DECIMAL_dump.out: Updated.
* cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob: Updated.
* cobol.dg/group2/Refmod_sources_are_figurative_constants.cob: Updated.
* cobol.dg/group2/Refmod_sources_are_figurative_constants.out: Updated.
* cobol.dg/group2/debugging_lines__not_active_.cob: Updated.
* cobol.dg/group2/floating-point_SUBTRACT_FORMAT_2.out: Updated.
* cobol.dg/group2/floating-point_literals.out: Updated.
* cobol.dg/group2/37-digit_Initialization_of_fundamental_types.cob: New test.
* cobol.dg/group2/37-digit_Initialization_of_fundamental_types.out: New test.
* cobol.dg/group2/ACCEPT_FROM_ENVIRONMENT-NAME.cob: New test.
* cobol.dg/group2/ACCEPT_FROM_ENVIRONMENT-NAME.out: New test.
* cobol.dg/group2/ACCEPT_foo_FROM_COMMAND-LINE_1_.cob: New test.
* cobol.dg/group2/ADD_1_2_TO_3_GIVING_B.cob: New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9._Without_OPTION_INITIALIZE_Without_-fdefaultbyte___ASCII_.cob:
New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9._Without_OPTION_INITIALIZE_Without_-fdefaultbyte___ASCII_.out:
New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9._Without_OPTION_INITIALIZE_Without_-fdefaultbyte___EBCDIC_.cob:
New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9._Without_OPTION_INITIALIZE_Without_-fdefaultbyte___EBCDIC_.out:
New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9_Without_OPTION_INITIALIZE_With_-fdefaultbyte___UTF16_.cob:
New test.
* cobol.dg/group2/ALLOCATE_Rules_6_-_9_Without_OPTION_INITIALIZE_With_-fdefaultbyte___UTF16_.out:
New test.
* cobol.dg/group2/ANY_LENGTH__7_.cob: New test.
* cobol.dg/group2/ANY_LENGTH__7_.out: New test.
* cobol.dg/group2/Assorted_SPECIAL-NAMES_CLASS.cob: New test.
* cobol.dg/group2/Assorted_SPECIAL-NAMES_CLASS.out: New test.
* cobol.dg/group2/BINARY_and_COMP-5.cob: New test.
* cobol.dg/group2/BINARY_and_COMP-5.out: New test.
* cobol.dg/group2/CDF2_-_DEFINE_FOO_AS_literal-1.cob: New test.
* cobol.dg/group2/CDF2_-_DEFINE_FOO_AS_literal-1.out: New test.
* cobol.dg/group2/CDF2_Trouble_with___IF__1_.cob: New test.
* cobol.dg/group2/CDF2_Trouble_with___IF__2_.cob: New test.
* cobol.dg/group2/CDF2_Trouble_with___IF__2_.out: New test.
* cobol.dg/group2/CDF4_.cob: New test.
* cobol.dg/group2/CDF4_.out: New test.
* cobol.dg/group2/CDF_Feature_.cob: New test.
* cobol.dg/group2/CDF_Feature_.out: New test.
* cobol.dg/group2/CDF_IS_NOT_DEFINED.cob: New test.
* cobol.dg/group2/CDF_IS_NOT_DEFINED.out: New test.
* cobol.dg/group2/CDF__1__IF____text_.cob: New test.
* cobol.dg/group2/CDF__1__IF____text_.out: New test.
* cobol.dg/group2/CDF__2__IF____number_.cob: New test.
* cobol.dg/group2/CDF__2__IF____number_.out: New test.
* cobol.dg/group2/CDF__3__ALL_NUMERIC_COMPARISONS.cob: New test.
* cobol.dg/group2/CDF__3__ALL_NUMERIC_COMPARISONS.out: New test.
* cobol.dg/group2/COMP-5_Sanity_Check_.cob: New test.
* cobol.dg/group2/Complex_HEX__VALUE_and_MOVE_-_ASCII_EBCDIC.cob: New test.
* cobol.dg/group2/Complex_HEX__VALUE_and_MOVE_-_ASCII_EBCDIC.out: New test.
* cobol.dg/group2/Complex_INITIALIZE_with_nested_tables__1_.cob: New test.
* cobol.dg/group2/Complex_INITIALIZE_with_nested_tables__1_.out: New test.
* cobol.dg/group2/Complex_INITIALIZE_with_nested_tables__2_.cob: New test.
* cobol.dg/group2/Complex_INITIALIZE_with_nested_tables__2_.out: New test.
* cobol.dg/group2/Default_Arithmetic__1_.cob: New test.
* cobol.dg/group2/Default_Arithmetic__1_.out: New test.
* cobol.dg/group2/ENTRY_statement.cob: New test.
* cobol.dg/group2/ENTRY_statement.out: New test.
* cobol.dg/group2/EVALUATE__A__OR__a_.cob: New test.
* cobol.dg/group2/EVALUATE__A__OR__a_.out: New test.
* cobol.dg/group2/EVALUATE_condition__1_.cob: New test.
* cobol.dg/group2/EVALUATE_condition__1_.out: New test.
* cobol.dg/group2/FIND-STRING__forward_.cob: New test.
* cobol.dg/group2/FIND-STRING__forward_.out: New test.
* cobol.dg/group2/FIND-STRING__reverse_.cob: New test.
* cobol.dg/group2/FIND-STRING__reverse_.out: New test.
* cobol.dg/group2/FIXED_FORMAT_data_in_cols_73_and_beyond.cob: New test.
* cobol.dg/group2/FIXED_FORMAT_data_in_cols_73_and_beyond.out: New test.
* cobol.dg/group2/FIXED_FORMAT_data_misplaced_asterisk.cob: New test.
* cobol.dg/group2/FUNCTION_CONVERT.cob: New test.
* cobol.dg/group2/FUNCTION_CONVERT.out: New test.
* cobol.dg/group2/Fundamental_INSPECT_BACKWARD_REPLACING.cob: New test.
* cobol.dg/group2/Fundamental_INSPECT_BACKWARD_REPLACING.out: New test.
* cobol.dg/group2/Fundamental_INSPECT_BACKWARD_TALLYING.cob: New test.
* cobol.dg/group2/Fundamental_INSPECT_BACKWARD_TALLYING.out: New test.
* cobol.dg/group2/Fundamental_INSPECT_REPLACING.cob: New test.
* cobol.dg/group2/Fundamental_INSPECT_REPLACING.out: New test.
* cobol.dg/group2/Fundamental_INSPECT_TALLYING.cob: New test.
* cobol.dg/group2/Fundamental_INSPECT_TALLYING.out: New test.
* cobol.dg/group2/INITIALIZE_OCCURS_with_SIGN_LEADING___TRAILING.cob: New test.
* cobol.dg/group2/INITIALIZE_OCCURS_with_SIGN_LEADING___TRAILING.out: New test.
* cobol.dg/group2/INITIALIZE_OCCURS_with_numeric_edited.cob: New test.
* cobol.dg/group2/INITIALIZE_complex_group__1_.cob: New test.
* cobol.dg/group2/INITIALIZE_complex_group__2_.cob: New test.
* cobol.dg/group2/INITIALIZE_complex_group__2_.out: New test.
* cobol.dg/group2/INITIALIZE_group_entry_with_OCCURS.cob: New test.
* cobol.dg/group2/INITIALIZE_of_EXTERNAL_data_items.cob: New test.
* cobol.dg/group2/INITIALIZE_with_-defaultbyte__ASCII_.cob: New test.
* cobol.dg/group2/INITIALIZE_with_-defaultbyte__ASCII_.out: New test.
* cobol.dg/group2/INITIALIZE_with_-defaultbyte__EBCDIC_.cob: New test.
* cobol.dg/group2/INITIALIZE_with_-defaultbyte__EBCDIC_.out: New test.
* cobol.dg/group2/INITIALIZE_with_FILLER.cob: New test.
* cobol.dg/group2/INITIALIZE_with_REDEFINES.cob: New test.
* cobol.dg/group2/INITIALIZE_with_reference_modification.cob: New test.
* cobol.dg/group2/Intrinsic_Function_ABS.cob: New test.
* cobol.dg/group2/Intrinsic_Function_ACOS.cob: New test.
* cobol.dg/group2/Intrinsic_Function_ANNUITY.cob: New test.
* cobol.dg/group2/Intrinsic_Function_DATE-YYYYMMDD.cob: New test.
* cobol.dg/group2/Intrinsic_Function_NUMVAL.cob: New test.
* cobol.dg/group2/Intrinsic_Function_NUMVAL.out: New test.
* cobol.dg/group2/Long_Division.cob: New test.
* cobol.dg/group2/Long_Division.out: New test.
* cobol.dg/group2/MOVE_X_000203_.cob: New test.
* cobol.dg/group2/MOVE_X_000203_.out: New test.
* cobol.dg/group2/MOVE_to_JUSTIFIED_items.cob: New test.
* cobol.dg/group2/MOVE_to_JUSTIFIED_items.out: New test.
* cobol.dg/group2/N-Queens_algorithm.cob: New test.
* cobol.dg/group2/N-Queens_algorithm.out: New test.
* cobol.dg/group2/Numeric_operations__6_.cob: New test.
* cobol.dg/group2/Numeric_operations__6_.out: New test.
* cobol.dg/group2/Preserve_collation_past_a_CALL.cob: New test.
* cobol.dg/group2/Preserve_collation_past_a_CALL.out: New test.
* cobol.dg/group2/RETURN-CODE_moving.cob: New test.
* cobol.dg/group2/RETURN-CODE_nested.cob: New test.
* cobol.dg/group2/SORT__table_sort__2___ASCII_.cob: New test.
* cobol.dg/group2/SORT__table_sort__2___ASCII_.out: New test.
* cobol.dg/group2/SORT__table_sort__2___EBCDIC_.cob: New test.
* cobol.dg/group2/SORT__table_sort__2___EBCDIC_.out: New test.
* cobol.dg/group2/Simple_DEBUG-ITEM.cob: New test.
* cobol.dg/group2/Simple_DEBUG-ITEM.out: New test.
* cobol.dg/group2/Simple_ENVIRONMENT-NAME_with_exception.cob: New test.
* cobol.dg/group2/Simple_ENVIRONMENT-NAME_with_exception.out: New test.
* cobol.dg/group2/UNSTRING_with_refmods.cob: New test.
* cobol.dg/group2/UNSTRING_with_refmods.out: New test.
* cobol.dg/group2/command-line.cob: New test.
* cobol.dg/group2/command-line.out: New test.
* cobol.dg/group2/floating-point_FORMAT_1.cob: New test.
* cobol.dg/group2/floating-point_FORMAT_1.out: New test.
* cobol.dg/group2/floating-point_FORMAT_2.cob: New test.
* cobol.dg/group2/floating-point_FORMAT_2.out: New test.
* cobol.dg/group2/procedure_division_using_by.cob: New test.
* cobol.dg/group2/repository.cob: New test.
* cobol.dg/group2/skipping_at_the_top.cob: New test.
* cobol.dg/group2/source-computer_object-computer_repository__2_.cob: New test.

3 months agoDaily bump.
GCC Administrator [Fri, 20 Feb 2026 00:16:32 +0000 (00:16 +0000)] 
Daily bump.

3 months agoRegenerate .pot files
Joseph Myers [Thu, 19 Feb 2026 21:07:55 +0000 (21:07 +0000)] 
Regenerate .pot files

gcc/po/
* gcc.pot: Regenerate.

libcpp/po/
* cpplib.pot: Regenerate.

3 months agolibstdc++: Rework constant_wrapper assignments and increments
Tomasz Kamiński [Wed, 18 Feb 2026 09:38:04 +0000 (10:38 +0100)] 
libstdc++: Rework constant_wrapper assignments and increments

This implements LWG4383 with LWG4500, LWG4523 follow-up corrections.

This patch changes the constant_wrapper assignments operator (including
compounds), increment and decrement to apply directly to value. In
consequence the operators are only supported for types, for which above
operations can be applied on const value.

libstdc++-v3/ChangeLog:

* include/std/type_traits (_CWOperators::operator++)
(_CWOperators::operator--, _CWOperators::operator+=)
(_CWOperators::operator-=, _CWOperators::operator*=)
(_CWOperators::operator/=, _CWOperators::operator%=)
(_CWOperators::operator&=, _CWOperators::operator|=)
(_CWOperators::operator^=, _CWOperators::operator<<=)
(_CWOperators::operator>>=, constant_wrapper::operator=):
Adjust definitions to apply operator on value.
* testsuite/20_util/constant_wrapper/generic.cc:
Remove test_pseudo_mutator.
* testsuite/20_util/constant_wrapper/instantiate.cc:
Test that operators are not provided if wrapped type
do not support them, or provide mutable operators.

3 months agolibstdc++: Use global variables for default/max std in libstdc++.exp
Jonathan Wakely [Tue, 17 Feb 2026 12:48:51 +0000 (12:48 +0000)] 
libstdc++: Use global variables for default/max std in libstdc++.exp

This simplifies the v3-minimum-std procedure slightly, but the main
advantage is making v3_modules_std depend on v3_max_std so that we don't
have to update two separate variables when new effective targets such as
c++29 get added.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (v3_default_std, v3_max_std): New
global variables.
(v3-minimum-std): Use globals instead of arguments.
(v3_modules_std): Define in terms of $v3_max_std.
(v3-dg-runtest): Use globals instead of local variables. Adjust
call to v3-min-std.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>