]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
6 days agolibstdc++: Guard use of float16_t and bfloat16_t [PR124722]
Matthias Kretz [Wed, 1 Apr 2026 09:46:08 +0000 (11:46 +0200)] 
libstdc++: Guard use of float16_t and bfloat16_t [PR124722]

The rest of this test is still relevant, thus only the (b)float16_t
tests are made optional rather than skipping the whole test via
dg-effective-target.

libstdc++-v3/ChangeLog:

PR libstdc++/124722
* testsuite/std/simd/traits_impl.cc: Add __STDCPP_FLOAT16_T__
and __STDCPP_BFLOAT16_T__ guards.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
6 days agoc++: Partially implement mangling for C++26 pack indexing [PR124487]
Jakub Jelinek [Sat, 4 Apr 2026 09:18:20 +0000 (11:18 +0200)] 
c++: Partially implement mangling for C++26 pack indexing [PR124487]

I still haven't figured out how to correctly mangle the case
in pack-indexing9.C where write_type is called with PACK_INDEX_TYPE
where PACK_INDEX_PACK is TREE_VEC of types, i.e. already expanded pack,
but given that right now we sorry on mangling of all PACK_INDEX_TYPE
or PACK_INDEX_EXPR trees, I think the following patch is an incremental
progress in the right direction and just mangles what is clearly specified
in the proposal.

This patch relies on the PR124198 patch I've just posted, because the
casts to size_t change mangling of pack...[1] from having i1 in it
to m1 (on x86_64, j1 on ia32, ...).

2026-04-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/124487
* mangle.cc (write_type) <case PACK_INDEX_TYPE>: Handle pack index
mangling unless (for now) PACK_INDEX_PACK is a TREE_VEC.
(write_expression): Handle PACK_INDEX_EXPR.

* g++.dg/cpp26/pack-indexing7.C: Don't xfail dg-bogus.
* g++.dg/cpp26/pack-indexing22.C: New test.

6 days agoc++: Fix up pack indexing [PR124198]
Jakub Jelinek [Sat, 4 Apr 2026 09:07:40 +0000 (11:07 +0200)] 
c++: Fix up pack indexing [PR124198]

https://eel.is/c++draft/expr.prim.pack.index#2 says:
The constant-expression shall be a converted constant expression of type
std::size_t whose value V, termed the index, is such that 0<=V<sizeof...(P).

But we actually don't implement it like that, instead just error out if
the index doesn't have an integral type or is negative.

Because of this we don't call mark_rvalue_use on it, so on pack-indexing20.C
we report a bogus warning that the var used in the index is unused but set,
and more importantly we reject the IMHO valid testcase pack-indexing21.C.

The following patch calls build_converted_constant_expr to make sure it
is converted, marked as read, if not possible to be converted diagnostics
is emitted.

2026-04-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/124198
* parser.cc (cp_parser_pack_index): If index is not type dependent,
call build_converted_constant_expr on it.  Return error_mark_node
if index is error_operand_p.
* pt.cc (tsubst_pack_index): Likewise.

* g++.dg/cpp26/pack-indexing2.C (getT2, badtype4): Expect different
diagnostics.
* g++.dg/cpp26/pack-indexing20.C: New test.
* g++.dg/cpp26/pack-indexing21.C: New test.

6 days agolibstdc++: Define foo() in optional/ref/access.cc test.
Tomasz Kamiński [Sat, 4 Apr 2026 08:33:36 +0000 (10:33 +0200)] 
libstdc++: Define foo() in optional/ref/access.cc test.

Fix undefined reference error when compiling with -O0.

libstdc++-v3/ChangeLog:

* testsuite/20_util/optional/ref/access.cc: Provide
definition for foo().

6 days agoxtensa: Change xtensa_legitimize_address() to allow the emission of one more ADDMI...
Takayuki 'January June' Suwa [Fri, 3 Apr 2026 02:00:32 +0000 (11:00 +0900)] 
xtensa: Change xtensa_legitimize_address() to allow the emission of one more ADDMI instruction

Previously, address displacement mitigation measures for exceeding machine
instruction limits involved using only one ADDMI machine instruction
(adding an immediate value that is a multiple of 256) to cover approxi-
mately 32 kilobytes before and after the address.

This patch expands the range covered by the mitigation by doubling it by
using just one more ADDMI instruction, slightly more advantageous than the
result without the mitigation, ie., covering the displacement amount by
loading from constant pool or using CONST16 instruction pair.

     /* example */
     int test(int a[]) {
       return a[4] + a[16032];
     }

     ;; before (-O2 -mconst16)
     test:
      entry sp, 32
      movi.n a8, 0 ;; 3 instructions
      const16 a8, 64128 ;;
      add.n a8, a2, a8 ;;
      l32i.n a8, a8, 0
      l32i.n a2, a2, 16
      add.n a2, a2, a8
      retw.n

     ;; after (-O2 -mconst16)
     test:
      entry sp, 32
      addmi a8, a2, 0x7b00 ;; 2 instructions
      addmi a8, a8, 0x7f00 ;;
      l32i.n a2, a2, 16
      l32i a8, a8, 128
      add.n a2, a2, a8
      retw.n

gcc/ChangeLog:

* config/xtensa/xtensa.cc (xtensa_legitimize_address):
Add code to legitimize the displacement of 64 kilobytes before and
after using two ADDMI instructions.

6 days agoxtensa: Small change to the alternative negsf2 pattern
Takayuki 'January June' Suwa [Fri, 3 Apr 2026 01:58:09 +0000 (10:58 +0900)] 
xtensa: Small change to the alternative negsf2 pattern

The previously added alternative negsf2 pattern (for cases where both
source and destination are GP registers) directly specified multiple
machine instructions in the output template, but this patch replaces
that with an RTL representation using the split pattern, to increase
opportunities for instruction reordering.

gcc/ChangeLog:

* config/xtensa/xtensa.md (negsf2):
Change define_insn to define_insn_and_split, and replace the
corresponding output template with the split pattern.

6 days agoxtensa: Remove TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook
Takayuki 'January June' Suwa [Sun, 29 Mar 2026 08:10:07 +0000 (17:10 +0900)] 
xtensa: Remove TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook

Since the previous commit 6924c00c8710ec95834e21f8d68b10f2d09a8680 ("xtensa:
Make all memory constraints special"), it has been discovered that the
definition of TARGET_DIFFERENT_ADDR_DISPLACEMENT_P, which was previously
introduced to obtain appropriate memory reference displacements (commit
211459e12147e9ed42c0a0947b1b95b551e03ef3), is no longer necessary.  In other
words:

  - The order of the movsi_internal MD pattern alternatives has been re-
    arranged so that memory references with shorter displacements take
    precedence

  - Furthermore, since all memory constraints are now "special," address
    reload operations that explicitly add the displacement to the base
    register and then adopt a 0-displacement reference are no longer
    performed and are simply skipped

Therefore, this patch removes the definition of
TARGET_DIFFERENT_ADDR_DISPLACEMENT_P.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (TARGET_DIFFERENT_ADDR_DISPLACEMENT_P):
Remove.

6 days agoxtensa: Avoid redundant MEM_P() checks in memory constraint definitions
Takayuki 'January June' Suwa [Thu, 2 Apr 2026 23:08:52 +0000 (08:08 +0900)] 
xtensa: Avoid redundant MEM_P() checks in memory constraint definitions

If the memory constraint definition includes (match_code "MEM"), then
the subsequent 'op' is undoubtedly MEM rtx, and all that remains is to
determine if 'XEXP (op, 0)' is the address corresponding to that
definition using (match_test "...").

This patch eliminates the need to call MEM_P() again in the predicate
function called from (match_test "...") in the memory constraint
definitions.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (smalloffset_mem_p):
Rename it to smalloffset_address_p and remove the result check
of MEM_P().
(constantpool_address_p): Change from static scope to global.
* config/xtensa/xtensa-protos.h (smalloffset_mem_p):
Rename it to smalloffset_address_p.
(constantpool_address_p): New function prototype.
* config/xtensa/constraints.md (R):
Change the call in (match_test "...") from smalloffset_mem_p()
to smalloffset_address_p().
(T, U): Change the call in (match_test "...") from
constantpool_mem_p() to constantpool_address_p().

6 days agoFortran: fix resolution of generic interface with TYPE(C_PTR) [PR66973]
Harald Anlauf [Fri, 3 Apr 2026 20:35:48 +0000 (22:35 +0200)] 
Fortran: fix resolution of generic interface with TYPE(C_PTR) [PR66973]

When symbols from the intrinsic module ISO_C_BINDING were USEd indirectly,
the resolution of generic interfaces with procedures having dummies with
TYPE(C_PTR) or TYPE(C_FUNPTR) could fail when the actual argument was
C_LOC() or C_FUNLOC().  Amend checking of actual versus formal procedure
arguments to these cases.

PR fortran/66973

gcc/fortran/ChangeLog:

* interface.cc (gfc_compare_actual_formal): Check that C_LOC and
C_FUNLOC from ISO_C_BINDING as actual argument are passed to a
dummy argument of matching type C_PTR/C_FUNPTR.

gcc/testsuite/ChangeLog:

* gfortran.dg/generic_36-1.f90: New test.
* gfortran.dg/generic_36-2.f90: New test.

6 days agofortran: Minor adjustment to INQUIRE for ENCODING=
Jerry DeLisle [Fri, 3 Apr 2026 17:17:03 +0000 (10:17 -0700)] 
fortran: Minor adjustment to INQUIRE for ENCODING=

PR libfortran/124543

libgfortran/ChangeLog:

* io/inquire.c (inquire_via_unit): Adjust the logic to
treat formatted vs unformatted correctly.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr124543.f90: Set result to 'UNDEFINED' in two
places.

6 days agoDaily bump.
GCC Administrator [Sat, 4 Apr 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

6 days agodoc, c: Clarify status of decimal floating point support [PR123234]
Sandra Loosemore [Fri, 3 Apr 2026 22:15:53 +0000 (22:15 +0000)] 
doc, c: Clarify status of decimal floating point support [PR123234]

At first glance, the GCC manual's section documenting decimal floating
point support as a C extension appears to be bit-rotten, since this
feature is now standardized in ISO C23.  In fact, though, GCC's
implementation is based on the older N1312 proposal, and full C23
support is not yet available.  This patch makes the GCC manual say that
explicitly.

gcc/ChangeLog
PR c/123234
* doc/extend.texi (Decimal Float): Clarify that GCC really does
support only the older N1312 draft as documented here, not the
standard C23 functionality yet.

6 days agoc++: coroutines: initialize refcount
Alexandre Oliva [Fri, 3 Apr 2026 21:09:20 +0000 (18:09 -0300)] 
c++: coroutines: initialize refcount

If the promise ctor throws, the EH cleanup will access refcount before
it is initialized.  Initialize it to zero so that cleanups can take
place.

This seems very hard to hit on systems that ensure the stack starts
out zero-initialized, but on VxWorks in kernel mode, this hits more
often than not on various architectures.

for  gcc/cp/ChangeLog

* coroutines.cc (cp_coroutine_transform::build_ramp_function):
Zero-initialize refcount.

6 days agox86: Add a test for PR target/123210
H.J. Lu [Fri, 3 Apr 2026 20:56:01 +0000 (04:56 +0800)] 
x86: Add a test for PR target/123210

PR target/123210 was fixed by

commit r16-7563-gb54533a28632482e91d7dfbbc47c75fb6d5e78bb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 17 09:51:58 2026 +0800

    x86: Update stack alignment only if stack is used

Add a test to verify the fix.

PR target/123210
* gcc.target/i386/pr123210.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agostrlen: Fix up memcpy/strcpy/strcat handling [PR124754]
Jakub Jelinek [Fri, 3 Apr 2026 18:55:26 +0000 (20:55 +0200)] 
strlen: Fix up memcpy/strcpy/strcat handling [PR124754]

The following testcase ICEs because it tries to use a freed strinfo.
strinfo uses refcounting and vectors of pointers to those are either shared
in between bbs or unshared when some later bb needs to modify something.

The ICE is due to the second memcpy handling.  Since r10-5451 it first
calls get_stridx on dst (&a), then get_strinfo with the returned index and
then get_stridx on src (&a + 24).  &a has been referenced earlier and
the pass knows some details on its string length (let's ignore that the
testcase invokes UB for now, I think it can happen even on valid code,
just haven't managed to adjust the testcase, but supposedly the unreduced
original is valid), so the strinfo is shared with other bbs.
WHen get_stridx is called for &a + 24, it sees it doesn't know anything
about that yet and wants to create a strinfo for it.  But related strinfos
are chained, so &a's next should be &a + 24 in this testcase, that means
we need to unshare the &a strinfo so that we can modify it while keeping
the one entry used by earlier bbs unmodified.  The problem is that
handle_builtin_memcpy called get_strinfo before this, so it got hands on
the old still not unshared strinfo for &a and because it isn't refreshed
after the get_stridx call by another get_strinfo call, we try to unshare
it again and break the refcounting.

So, basically for calls which call get_stridx twice, we need top make sure
we do both get_stridx calls before the first get_strinfo call, or repeat
get_strinfo after the second get_stridx call.

In handle_builtin_memcpy it used to be right and got broken by r10-5451,
but I'm in strcpy/strcat handling I've screwed it up since the pass was
added.

Fixed thusly.

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

PR tree-optimization/124754
* tree-ssa-strlen.cc (strlen_pass::handle_builtin_strcpy): Make
sure both get_stridx calls are done before first get_strinfo call.
(strlen_pass::handle_builtin_memcpy): Likewise.
(strlen_pass::handle_builtin_strcat): Likewise.

* g++.dg/tree-ssa/strlenopt-3.C: New test.

Reviewed-by: Jeffrey Law <jeffrey.law@oss.qualcomm.com>
6 days agoc++, libstdc++: Implement P3856R8 - New reflection metafunction - is_structural_type
Jakub Jelinek [Fri, 3 Apr 2026 18:52:33 +0000 (20:52 +0200)] 
c++, libstdc++: Implement P3856R8 - New reflection metafunction - is_structural_type

This patch attempts to implement this paper, adds a new trait, builtin trait
and metafunction.

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

gcc/cp/
* cp-trait.def (__builtin_is_structural): New trait.
* semantics.cc (trait_expr_value): Handle CPTK_IS_STRUCTURAL.
(finish_trait_expr): Likewise.
* constraint.cc (diagnose_trait_expr): Likewise.
* metafns.gperf (enum metafn_code): Add METAFN_IS_STRUCTURAL_TYPE.
(is_structural_type): New metafn.
* metafns.h: Regenerate.
* reflect.cc (eval_is_structural_type): New function.
(process_metafunction): Handle METAFN_IS_STRUCTURAL_TYPE.
gcc/testsuite/
* g++.dg/reflect/type_trait14.C: New test.
* g++.dg/reflect/eh1.C: Add test for is_structural_type.
* g++.dg/reflect/eh2.C: Likewise.
libstdc++-v3/
* include/bits/version.def (is_structural): New.
* include/bits/version.h: Regenerate.
* include/std/type_traits (__glibcxx_want_is_structural): Define.
(std::is_structural): New type trait.
(std::is_structural_v): New type trait variable template.
* include/std/meta (std::meta::is_structural_type): New declaration.
* src/c++23/std.cc.in: Export std::is_structural, std::is_structural_v
and std::meta::is_structural_type.
* testsuite/20_util/is_structural/requirements/explicit_instantiation.cc: New test.
* testsuite/20_util/is_structural/requirements/typedefs.cc: New test.
* testsuite/20_util/is_structural/value.cc: New test.
* testsuite/20_util/variable_templates_for_traits.cc: Test
is_structural_v.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
6 days agoc++, libstdc++: Attempt to implement P3842R2 - A conservative fix for constexpr uncau...
Jakub Jelinek [Fri, 3 Apr 2026 18:46:42 +0000 (20:46 +0200)] 
c++, libstdc++: Attempt to implement P3842R2 - A conservative fix for constexpr uncaught_exceptions() and current_exception()

The following patch attempts to implement the
P3842R2 - A conservative fix for constexpr uncaught_exceptions()
          and current_exception()
paper.  std::current_exception() and std::uncaught_exceptions() aren't
constexpr anymore (admittedly, they weren't declared that way in the
headers before either, but the FE magically treated them as such),
instead two new FE builtins are introduced so that one can get their
behavior before this patch when needed.  So, at constant evaluation
time they are constant evaluated and if they are not folded away,
they are transformed into std::current_exception() or
std::uncaught_exceptions() runtime calls during gimplification.

And nested_exception isn't constexpr anymore either.

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

gcc/cp/
* cp-tree.h (enum cp_built_in_function): Add
CP_BUILT_IN_CURRENT_EXCEPTION and CP_BUILT_IN_UNCAUGHT_EXCEPTIONS.
* tree.cc (builtin_valid_in_constant_expr_p): Handle
those.
* decl.cc (cxx_init_decl_processing): Build
decls for CP_BUILT_IN_CURRENT_EXCEPTION and
CP_BUILT_IN_UNCAUGHT_EXCEPTIONS.
(require_deduced_type): Deduce CP_BUILT_IN_CURRENT_EXCEPTION
return type.
* cp-gimplify.cc (cp_gimplify_expr): Handle
CP_BUILT_IN_CURRENT_EXCEPTION and CP_BUILT_IN_UNCAUGHT_EXCEPTIONS.
* constexpr.cc (enum cxa_builtin): Remove STD_UNCAUGHT_EXCEPTIONS
and STD_CURRENT_EXCEPTION, add BUILTIN_UNCAUGHT_EXCEPTIONS and
BUILTIN_CURRENT_EXCEPTION, renumber some enumerators.
(cxx_cxa_builtin_fn_p): Don't check for std::uncaught_exceptions
nor std::current_exception.
(cxx_eval_cxa_builtin_fn): Handle BUILTIN_UNCAUGHT_EXCEPTIONS
and BUILTIN_CURRENT_EXCEPTION instead of STD_UNCAUGHT_EXCEPTIONS
and STD_CURRENT_EXCEPTION.
(cxx_eval_builtin_function_call): Handle
CP_BUILT_IN_CURRENT_EXCEPTION and CP_BUILT_IN_UNCAUGHT_EXCEPTIONS.
Do just one fndecl_builtin_p check for BUILT_IN_FRONTEND and
switch on DECL_FE_FUNCTION_CODE.
gcc/testsuite/
* g++.dg/cpp26/constexpr-eh3.C: Use __builtin_current_exception()
instead of std::current_exception() and
__builttin_uncaught_exceptions() instead of
std::uncaught_exceptions().  Remove nested_exception related parts
of the test.
* g++.dg/cpp26/constexpr-eh8.C: Use __builtin_current_exception()
instead of std::current_exception().
libstdc++-v3/
* libsupc++/exception_ptr.h (std::make_exception_ptr): Use
__builtin_current_exception() instead of current_exception() if
the builtin exists.
* libsupc++/nested_exception.h: Revert 2026-01-07 and 2025-07-10
changes.
* testsuite/18_support/exception_ptr/exception_ptr_cast.cc (test01):
Use __builtin_current_exception instead of std::current_exception
if __has_builtin(__builtin_current_exception).  Otherwise don't
try to constant evaluate test01.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
6 days agodoc: Document -g2 debugging level [PR94491]
Sandra Loosemore [Fri, 3 Apr 2026 17:28:56 +0000 (17:28 +0000)] 
doc: Document -g2 debugging level [PR94491]

gcc/ChangeLog
PR debug/94491
* doc/invoke.texi (Debugging Options): Explicitly document what
-g2 does instead of just saying it's the default.

7 days agodoc: Improve documentation of -Wchar-subscripts and char signedness [PR94182]
Sandra Loosemore [Fri, 3 Apr 2026 15:02:22 +0000 (15:02 +0000)] 
doc: Improve documentation of -Wchar-subscripts and char signedness [PR94182]

The documentation of -Wchar-subscripts was missing cross-references to
discussion elsewhere in the manual about how the char type may be either
signed or unsigned.  Besides adding the references, I've also done some
improvements to those two other sections.

gcc/ChangeLog
PR other/94182
* doc/implement-c.texi (Characters implementation): Add
cross-reference to more detailed discussion about signedness.
* doc/invoke.texi (C Dialect Options): Combine -fsigned-char
and -funsigned-char table entries since the following discussion
applies to both.  Add an anchor so other things can point at it.
(Warning Options): Add cross-references to the above two places.
Clarify that the warning is given regardless of whether char is
signed or unsigned.

7 days agoFortran: fix passing a procedure pointer to c_funloc [PR124652]
Harald Anlauf [Wed, 1 Apr 2026 20:28:02 +0000 (22:28 +0200)] 
Fortran: fix passing a procedure pointer to c_funloc [PR124652]

PR fortran/124652

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Do not clobber a
procedure pointer intent(out) argument.
* trans-intrinsic.cc (conv_isocbinding_function): When passing to
C_FUNLOC a procedure pointer that is a dummy, dereference it.

gcc/testsuite/ChangeLog:

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

7 days agofortran: Add testcase [PR98203]
Christopher Albert [Thu, 2 Apr 2026 23:23:19 +0000 (00:23 +0100)] 
fortran: Add testcase [PR98203]

The reproducer from the bug report compiles cleanly on current
trunk.  Add a testcase to prevent future regressions.

PR fortran/98203

gcc/testsuite/ChangeLog:

PR fortran/98203
* gfortran.dg/gomp/pr98203.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
7 days agoc++: Implement LWG4517 - data_member_spec should throw for cv-qualified unnamed bit...
Jakub Jelinek [Fri, 3 Apr 2026 08:29:51 +0000 (10:29 +0200)] 
c++: Implement LWG4517 - data_member_spec should throw for cv-qualified unnamed bit-fields

As written in https://wg21.link/lwg4517 , unnamed bit-fields shall not
be declared with cv-qualified types, so the following patch rejects it
when trying to create that in data_member_spec.

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

* reflect.cc (eval_data_member_spec): Implement C++26 LWG4517
- data_member_spec should throw for cv-qualified unnamed bit-fields.

* g++.dg/reflect/data_member_spec2.C: Add tests for unnamed bit-fields
with const and/or volatile types.

Reviewed-by: Jason Merrill <jason@redhat.com>
7 days agotestsuite: Add testcase for CWG3162 - Evaluation context of manifestly constant-evalu...
Jakub Jelinek [Fri, 3 Apr 2026 08:27:36 +0000 (10:27 +0200)] 
testsuite: Add testcase for CWG3162 - Evaluation context of manifestly constant-evaluated expressions

Another testcase for something we already implement the desired way.

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

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

Reviewed-by: Jason Merrill <jason@redhat.com>
7 days agotestsuite: Add testcase for LWG4556 - Unclear properties of reflection strings
Jakub Jelinek [Fri, 3 Apr 2026 08:26:31 +0000 (10:26 +0200)] 
testsuite: Add testcase for LWG4556 - Unclear properties of reflection strings

The issue clarifies what the *string_view points to is not valid for
template arguments with pointer type, the following testcase verifies
that we already reject it.

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

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

Reviewed-by: Jason Merrill <jason@redhat.com>
7 days agoc++: Handle RAW_DATA_CST and RANGE_EXPR in build_vec_init [PR124531]
Jakub Jelinek [Fri, 3 Apr 2026 08:18:25 +0000 (10:18 +0200)] 
c++: Handle RAW_DATA_CST and RANGE_EXPR in build_vec_init [PR124531]

The following testcases show two bugs in build_vec_init, one
introduced with either since my r15-5958 (when using #embed) or
my r15-6339 (when not using it but large init transformed into
RAW_DATA_CST), problem that the FOR_EACH_CONSTRUCTOR_ELT loop
in build_vec_init doesn't handle RAW_DATA_CST, and another since
Marek's r15-7810 which has added limited RANGE_EXPR support to that loop,
but only changed the num_initialized_elts value computation and
has not actually also added a runtime loop over the range to initialize
multiple elements to the same value.  The lack of RAW_DATA_CST handling
causes ICEs (during expansion or later on), while the lack of proper
RANGE_EXPR handling causes wrong-code.

The following patch attempts to fix both.

RAW_DATA_CST has 2 separate variants of handling it, one is when
the types match (digested is true) and it is char/signed char/unsigned
char/std::byte array, in that case (especially if it is huge initializer,
but RAW_DATA_CST already implies 62+ elements) it emits a setting of
MEM_REF with ARRAY_TYPE for the RAW_DATA_LENGTH bytes to a CONSTRUCTOR
with the RAW_DATA_CST in it which gimplifier handles (but of course for
try_const const_vec it uses the RAW_DATA_CST directly).
The second variant is for other types or non-digested one, in that case
RAW_DATA_CST is peeled appart into individual INTEGER_CSTs.

As for RANGE_EXPR, for try_const const_vec it uses the RANGE_EXPR field
as before, but for the runtime code it puts the
one_init/base increment/iterator decrement stmts into a loop which iterates
range_expr_nelts times.

The reason for the first hunk is to optimize the CONSTRUCTOR from what
the preprocessor emits, i.e.
CPP_NUMBER CPP_COMMA CPP_EMBED CPP_COMMA CPP_NUMBER
turned into
INTEGER_CST RAW_DATA_CST INTEGER_CST
into just RAW_DATA_CST covering also the first and last number.
I'm worried about braced_lists_to_strings transformation to STRING_CST
when try_const though, I think it isn't handled right now, so the code
ignores STRING_CST return.

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

PR c++/124531
* init.cc (build_vec_init): Call braced_lists_to_strings for
array CONSTRUCTORs.  Handle RAW_DATA_CST and handle RANGE_EXPR
correctly.

* g++.dg/cpp/embed-29.C: New test.
* g++.dg/cpp0x/pr124531.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
7 days agoAda: Update documentation to reflect relaxed structural instantiation
Tonu Naks [Fri, 3 Apr 2026 07:44:18 +0000 (09:44 +0200)] 
Ada: Update documentation to reflect relaxed structural instantiation

gcc/ada/
* doc/gnat_rm/gnat_language_extensions.rst: Adjust rules for
structural generic instantiations.
* gnat_rm.texi: Regenerate.

7 days agofortran: Add testcase [PR95163]
Christopher Albert [Tue, 10 Mar 2026 23:21:27 +0000 (00:21 +0100)] 
fortran: Add testcase [PR95163]

The reproducer from the bug report now gives a proper error on current
trunk instead of an ICE.  Add a testcase to prevent future regressions.

PR fortran/95163

gcc/testsuite/ChangeLog:

PR fortran/95163
* gfortran.dg/gomp/pr95163.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
7 days agoFortran: Regression in gfc_convert_to_structure_constructor
Paul Thomas [Thu, 2 Apr 2026 09:00:37 +0000 (10:00 +0100)] 
Fortran: Regression in gfc_convert_to_structure_constructor

This patch is not the prettiest because it jumps across the normal
wrapping up of the actual arguments in gfc_conv_procedure_call. However
the alternatives, which required jumps past existing call and the logic
for adding the pre and post blocks looked even uglier. The testcase has
been checked with valgrind and does not cause memory leaks. The memory
leaks in pr105168, mentioned in this pr, are fixed too.

2026-04-02  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/100155
* trans-expr.cc (gfc_add_interface_mapping): 'new_sym' dummy
attribute set to zero.
(gfc_conv_procedure_call): Deallocate allocatable components of
a class argument, enclosed in parentheses,wrap up the parmse
and proceed to the next argument.

gcc/testsuite/
PR fortran/100155
* gfortran.dg/pr100155.f90: New test.

7 days agoDaily bump.
GCC Administrator [Fri, 3 Apr 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

7 days agoc++/modules: Propagate DECL_ARGUMENTS when reading a function def [PR124477]
Nathaniel Shead [Sat, 14 Mar 2026 14:58:41 +0000 (01:58 +1100)] 
c++/modules: Propagate DECL_ARGUMENTS when reading a function def [PR124477]

The crash in the given PR occurs because we've streamed the definition
of an anticipated builtin, but when processing the nonnull attribute we
find that its DECL_ARGUMENTS is null.

Back in r14-8196-g3471a61ed0ddef70de8f1bbba85cd1e945fc86fd I removed the
setting of DECL_ARGUMENTS as this was causing issues where we were
replacing the argument list for existing definitions.  This was because
the definition we streamed was referencing those same PARM_DECLs, and if
they diverged we got different parts of the body with different
pointers to the same logical parameter.

In most cases we do not need to adjust DECL_ARGUMENTS because
fn_parms_fini will substitute in the correct DECL_ARGUMENTS from the
existing declaration.  But if DECL_ARGUMENTS was not set on the existing
declaration at all, as happens with e.g. anticipated builtins, then we
do need to set them.

PR c++/124477

gcc/cp/ChangeLog:

* module.cc (trees_in::read_function_def): Set DECL_ARGUMENTS if
installing and otherwise missing.

gcc/testsuite/ChangeLog:

* g++.dg/modules/builtin-10_a.C: New test.
* g++.dg/modules/builtin-10_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
7 days agolibstdc++/ranges: Uglify 'sizes' function parameter
Patrick Palka [Thu, 2 Apr 2026 20:51:09 +0000 (16:51 -0400)] 
libstdc++/ranges: Uglify 'sizes' function parameter

libstdc++-v3/ChangeLog:

* include/std/ranges (zip_view::size): Uglify 'sizes'
parameter.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
7 days agocobol: Reduce CFG complexity; improve PERFORM return logic; improve INSPECT performance.
Robert Dubner [Thu, 2 Apr 2026 02:40:13 +0000 (22:40 -0400)] 
cobol: Reduce CFG complexity; improve PERFORM return logic; improve INSPECT performance.

Control FLow Graph complexity exploded because of indirect jumps. Those
have been replaced with SWITCH_EXPR.

A number of calls to gg_get_address_of() have been replaced with
gg_pointer_to_array() so that we properly get a pointer to the first element
of arrays, rather than a pointer to an array object.

The speed of the INSPECT (Format 1) STATEMENT has been improved by breaking
out a faster routine when the character set is single-byte-coded, like
ASCII or EBCDIC.

A number of COBOL variables were improperly allocated as executable globals.
They are now allocated as per-function static variables for top-level
COBOL program-ids.

gcc/cobol/ChangeLog:

* cobol1.cc (cobol_langhook_handle_option): Handle OPT_Wrecording_mode.
* gcobol.1: Documentation of pre-program registers.
* genapi.cc (hijacker): Define new function hijacked code generation.
(RETURN_WHEN_HIJACKED): Macro for wrapping if(hijacked)return;
(hijacked): Either a boolean or false depending on ENABLE_HIJACKING.
(set_exception_environment): Use gg_pointer_to_array instead of
gg_get_address_of.
(parser_statement_end): Formatting.
(section_label): Change ALTER STATEMENT processing.
(pseudo_return_push): Expand TRACE1 message.
(pseudo_return_pop): Expand TRACE1 message; improved PERFORM processing.
(find_procedure): Change how cbl_proc_t is allocated; improved PERFORM
processing.
(parser_enter_section): Changed ALTER statement processing.
(parser_enter_paragraph): Likewise.
(parser_goto): Use SWITCH_EXPR instead of indirect jump.
(parser_perform): Likewise.
(internal_perform_through): Likewise.
(parser_enter_file): Use SWITCH_EXPR for implementing ENTRY statement.
(parser_leave_file): Build table of values for the SWITCH_EXPR.
(enter_program_common): Remove unused JMP *ptr.
(parser_enter_program): Code to hijack code generation for a function
"dubner" when ENABLE_HIJACKING is defined.
(build_dispatch_switch): Generalize builder of SWITCH_EXPR.
(build_alter_switch): Uses build_dispatch_switch.
(build_entry_switch): Likewise.
(build_perform_dispatcher): Likewise.
(parser_end_program): Wrap build_perform_dispatcher() in if(!hijacked).
(parser_init_list): Use RETURN_WHEN_HIJACKED; use gg_pointer_to_array()
instead of gg_get_address_of().
(psa_FldLiteralN): Set TREE_READONLY(var_decl) = 1.
(parser_alphabet): use gg_pointer_to_array() instead of
gg_get_address_of().
(parser_assign): Formatting.
(program_end_stuff): Call hijacking() when ENABLE_HIJACKING and the
program-id is "hijack"; use gg_pointer_to_array().
(parser_exit): Handle if(hijacked);
(register_find): New static function to find XML-* COBOL variables.
(parser_xml_parse): Updated XML PARSE statement handling.
(initialize_the_data): Use RETURN_WHEN_HIJACKED.
(establish_using): Change first-time-through processing.
(parser_division): Change ENTRY statement processing.
(parser_see_stop_run): Changed RETURN-CODE per-function variable
processing.
(parser_label_label): Use RETURN_WHEN_HIJACKED.
(parser_label_goto): Likewise.
(parser_perform_inline_times): Honor cbl_field_t offset for the count
parameter.
(inspect_tally): Use __gg__inspect_format_1_sbc() for SBC characters.
(create_and_call): Use per-function RETURN-CODE.
(parser_entry_activate): Eliminate static tree variables.
(parser_entry): Use automatic tree variables.
(parser_program_hierarchy): Use RETURN_WHEN_HIJACKED and
gg_pointer_to_array().
(build_temporaryN): New function compiled when ENABLE_HIJACKING.
(hijack_for_development): Changed to generate minimal GENERIC.
(actually_create_the_static_field): Use gg_structure_type_constructor
to create the constructor for the static cblc_field_t VAR_DECL.
(psa_FldLiteralA): Move where TREE attributes are established.
(parser_local_add): Use gg_pointer_to_array().
(parser_symbol_add): Use RETURN_WHEN_HIJACKED(); use gg_pointer_to_array().
* gengen.cc (gg_append_statement): #if 0 around some debugging code.
(gg_show_type): Expanded to display "static" and "readonly".
(gg_find_field_in_struct): Moved and rewritten.
(gg_get_structure_type_decl): New function.
(gg_start_building_a_union): Eliminated.
(gg_start_building_a_struct): Eliminated.
(gg_add_field_to_structure): Eliminated.
(gg_structure_type_constructor): New function.
(gg_get_struct_type_decl): Eliminated.
(gg_get_union_type_decl): Eliminated.
(gg_get_local_struct_type_decl): Eliminated.
(gg_get_filelevel_struct_type_decl): Eliminated.
(gg_get_filelevel_union_type_decl): Eliminated.
(gg_define_local_struct): Eliminated.
(gg_assign_to_structure): Eliminated.
(gg_define_array): Formatting.
(gg_pointer_to_array): Returns ADDR_EXPR for &array[0];
(gg_goto): Comment reflecting why we aren't using it.
* gengen.h (SHORT_P): Alias for build_pointer_type(short_integer_type_node);
(struct gg_function_t): Changes mostly in support of SWITCH_EXPR.
(gg_get_local_struct_type_decl): Eliminated declaration.
(gg_get_filelevel_struct_type_decl): Likewise.
(gg_get_filelevel_union_type_decl): Likewise.
(gg_define_local_struct): Likewise.
(gg_get_structure_type_decl): New declaration.
(gg_structure_type_constructor): New declaration.
(gg_assign_to_structure): Eliminated declaration.
(gg_define_uchar_star): Changed declaration.
(gg_pointer_to_array): New declaration.
* genutil.cc: Removed unused globals; added var_decl_entry_index.
* genutil.h: Likewise.
* parse.y: Change program-id and REDEFINES handling.
* parse_ante.h: Likewise.
* scan_ante.h (is_refmod): Rewrite.
* structs.cc (create_cblc_field_t): Use gg_get_structure_type_decl().
* symbols.cc (return_code_register): Use per-program COBOL registers.
(symbol_redefines_root): New function.
(symbols_update): Use per-program COBOL registers.
(symbol_table_init): Implement per-program registers.
(symbol_registers_add): Likewise.
(cbl_field_t::encode): Loosen COBOL level requirement.
* symbols.h (struct cbl_proc_t): SWITCH_EXPR-based PERFORM returns.
(symbol_redefines_root): New declaration.
(symbol_registers_add): New declaration.
(new_alphanumeric): New comment.
* util.cc (FOR_JIM): Remove some unused demonstration code.
(cbl_field_t::encode_numeric): Likewise.

libgcobol/ChangeLog:

* Makefile.am: Include new libgcobol/inspect.cc file.
* Makefile.in: Likewise.
* charmaps.h: Remove global RETURN-CODE
* constants.cc (struct cblc_field_t): Eliminate various globals.
* gcobolio.h: Eliminate cblc_field_t::dummy member.
* libgcobol.cc (funky_find): Moved to inspect.cc.
(funky_find_wide): Likewise.
(funky_find_backward): Likewise.
(funky_find_wide_backward): Likewise.
(normalize_id): Likewise.
(match_lengths): Likewise.
(the_alpha_and_omega): Likewise.
(the_alpha_and_omega_backward): Likewise.
(inspect_backward_format_1): Likewise.
(__gg__inspect_format_1): Likewise.
(inspect_backward_format_2): Likewise.
(__gg__inspect_format_2): Likewise.
(normalize_for_inspect_format_4): Likewise.
(__gg__inspect_format_4): Likewise.
(__gg__is_canceled): Simplify establishing the function return code.
(__gg__pseudo_return_push): Work with integer indexes rather than
addresses.
(__gg__set_data_member): New function.
* xmlparse.cc (xml_event): Use passed variables rather than globals.
(__gg__xml_parse): Likewise.
* inspect.cc: New file.

7 days agotestsuite/c++: Fix lifetime issue in func-params-07.C [PR124548]
Andrew Pinski [Wed, 18 Mar 2026 00:13:55 +0000 (17:13 -0700)] 
testsuite/c++: Fix lifetime issue in func-params-07.C [PR124548]

So compiling this testcase with -fsantize=address we get an use
after the lifetime is gone. In this case it is the rvalue reference
argument to my_coro. With more inlining into main, this testcase
started to fail at -O3 as we remove the store to the temporary now
as the access is after the lifetime of the temporary has ended.
The best way of fixing this is creating an rvalue reference that will
then forward into the argument. This means we have the rvalue reference
no longer as a temporary that ends at the end of the statement but rather
end of the scope (since it is extended).

Tested on x86_64-linux-gnu with the testcase now passing at -O3.

PR testsuite/124548

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/torture/func-params-07.C (main): Fix lifetime
issue of rvalue reference.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
8 days agoc++/reflection: fix wrong-code with members_of [PR124646, PR124645]
Marek Polacek [Wed, 1 Apr 2026 20:06:58 +0000 (16:06 -0400)] 
c++/reflection: fix wrong-code with members_of [PR124646, PR124645]

My r16-8235 change should have set DECL_EXTERNAL only in the
!at_function_scope_p block, before rest_of_decl_compilation.  Setting
DECL_EXTERNAL on the temporary var for both at_function_scope_p and
!at_function_scope_p cases causes issues: in members_of11.C, we wrongly
initialize 'mem' in the loop to A::a both times, insted of A::a and B::b.
Similarly in members_of12.C we wrongly initialize member when inspecting
ns2.

I couldn't track down where *exactly* things go wrong, but the point
of r16-8235 was to set DECL_EXTERNAL only for the rest_of_decl_compilation
call.

PR c++/124646
PR c++/124645

gcc/cp/ChangeLog:

* call.cc (set_up_extended_ref_temp): Move setting DECL_EXTERNAL
to the !at_function_scope_p block.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/members_of11.C: New test.
* g++.dg/reflect/members_of12.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
8 days agolibstdc++: Updated inplace_vector::try_ functions per P3981R2 and P4022R0.
Tomasz Kamiński [Thu, 2 Apr 2026 10:00:01 +0000 (12:00 +0200)] 
libstdc++: Updated inplace_vector::try_ functions per P3981R2 and P4022R0.

This paper removes the try_append_range from inplace_vector and changes the
return type of try_emplace_back and try_push_back to optional<_Tp&> per:
P4022R0: Remove try_append_range from inplace_vector for now.
P3981R2: Better return types in std::inplace_vector and std::exception_ptr_cast.

The test are also expanded to cover type Y, that is convertible to optional<Y&>,
and require return type to be constructed using in_place.

libstdc++-v3/ChangeLog:

* include/bits/version.def (inplace_vector): Bump to 202603.
* include/bits/version.h: Regenerate.
* include/std/inplace_vector (inplace_vector::try_emplace_back)
(inplace_vector::try_push_back): Change return type to optional<_Tp&>
and adjust implementation accordingly.
(inplace_vector::try_append_range): Remove.
* include/debug/inplace_vector (inplace_vector::try_emplace_back)
(inplace_vector::try_push_back, inplace_vector::try_append_range):
Likewise.
* testsuite/23_containers/inplace_vector/modifiers/single_insert.cc:
Updated check for the optional<T&> return. Added test for type
convertible to optional<T&>
* testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc:
Use has_value() to check if engaged optional is returned.
* testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc:
Likewise.
* testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc:
Remove try_append_range tests.
* testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc:
Removed.
* testsuite/23_containers/inplace_vector/version.cc: Updated expected
feature test macro value.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agophiprop: Fix speculating aggregate copies [PR124746]
Andrew Pinski [Wed, 1 Apr 2026 17:43:17 +0000 (10:43 -0700)] 
phiprop: Fix speculating aggregate copies [PR124746]

r16-5555-g952e145796da0f introduced a problem for aggregates.
Allowing speculating non-trapping loads is ok but allowing
speculating non-trapping aggregate copies is not valid as
there is no ssa renaming for the lhs. So for aggregates,
we need to treat it similar as a trapping load to find if
it is speculating. Since we already reject 'delayed' loads
for aggregates, we will skip over this load.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/124746
gcc/ChangeLog:

* tree-ssa-phiprop.cc (propagate_with_phi): Treat
and aggregate copy as it is a trapping load.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
8 days agophiprop: Move the check for load of ptr before the checks of dom
Andrew Pinski [Wed, 1 Apr 2026 17:35:57 +0000 (10:35 -0700)] 
phiprop: Move the check for load of ptr before the checks of dom

This moves the check for thge load of *ptr before the checks of domination.
In the next patch I need to know if the load is an aggregates or not.
This should NOT have any code generation difference.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiprop.cc (propagate_with_phi): Move the
check for load from ptr before the checks of domination.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
8 days agolibstdc++: Add Doxygen documentation to <version>
Jonathan Wakely [Wed, 1 Apr 2026 19:17:29 +0000 (20:17 +0100)] 
libstdc++: Add Doxygen documentation to <version>

libstdc++-v3/ChangeLog:

* include/std/version: Add Doxygen documentation comment.

Reviewed-by: Nathan Myers <nmyers@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Simplify documentation of match_flag_type::format_default
Jonathan Wakely [Wed, 1 Apr 2026 14:02:06 +0000 (15:02 +0100)] 
libstdc++: Simplify documentation of match_flag_type::format_default

This combines the $n and $nn items into one, which is more consistent
with the EcmaScript docs.

libstdc++-v3/ChangeLog:

* include/bits/regex_constants.h (format_default): Simplify
description of $n in Doxygen comment.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Minor tweak to Doxygen comment for std::pair
Jonathan Wakely [Wed, 1 Apr 2026 14:22:14 +0000 (15:22 +0100)] 
libstdc++: Minor tweak to Doxygen comment for std::pair

It doesn't necessarily hold objects, it can hold references too.

libstdc++-v3/ChangeLog:

* include/bits/stl_pair.h (pair): Adjust Doxygen comment.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Fix Doxygen comments on chrono::floor etc.
Jonathan Wakely [Wed, 1 Apr 2026 16:06:21 +0000 (17:06 +0100)] 
libstdc++: Fix Doxygen comments on chrono::floor etc.

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (floor, ceil, round): Fix Doxygen
comments to use correct parameter name and describe return value
more accurately.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Rename parameters of unordered erase(K&&) members
Jonathan Wakely [Wed, 1 Apr 2026 17:11:34 +0000 (18:11 +0100)] 
libstdc++: Rename parameters of unordered erase(K&&) members

This fixes some Doxygen warnings caused by inconsistent parameter names,
which do not match the names used in the Doxygen comments:

include/bits/unordered_map.h:899: warning: argument '__x' of command @param is not found in the argument list of std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >::erase(_Kt &&__key)
include/bits/unordered_map.h:899: warning: The following parameter of std::unordered_map::erase(_Kt &&__key) is not documented:
  parameter '__key'

libstdc++-v3/ChangeLog:

* include/bits/unordered_map.h (unordered_map::erase(K&&)):
Change parameter name to __x.
* include/bits/unordered_set.h (unordered_set::erase(K&&))
(unordered_multiset::erase(K&&)): Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Fix Doxygen grouping
Jonathan Wakely [Wed, 1 Apr 2026 14:13:23 +0000 (15:13 +0100)] 
libstdc++: Fix Doxygen grouping

libstdc++-v3/ChangeLog:

* include/bits/ostream.h (operator<<): Do not include deleted
overloads in @{ group.
* include/bits/stl_queue.h (priority_queue): Add @{ group around
constructors.
* include/bits/unordered_map.h: Remove stray @{. Move #endif to
encompass @} that is within the #if group.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Remove Doxygen @return on void functions
Jonathan Wakely [Wed, 1 Apr 2026 14:06:21 +0000 (15:06 +0100)] 
libstdc++: Remove Doxygen @return on void functions

With the latest version of Doxygen this gives a warning about using
@return on a function that returns void. Stating it explicitly adds very
little value, anybody can see from the signature that a function returns
void.

libstdc++-v3/ChangeLog:

* include/bits/move.h (swap): Remove @return from Doxygen
comment.
* include/bits/stl_algo.h (inplace_merge, shuffle)
(random_shuffle, partial_sort, nth_element, sort)
(stable_sort): Likewise.
* include/bits/stl_algobase.h (iter_swap, fill): Likewise.
* include/bits/stl_deque.h (_Deque_base::_M_initialize_map)
(deque::_M_range_initialize, deque::_M_fill_initialize):
Likewise.
* include/bits/stl_iterator_base_funcs.h (advance): Likewise.
* include/bits/stl_numeric.h (iota): Likewise.
* include/bits/stl_tempbuf.h (return_temporary_buffer):
Likewise.
* include/bits/stl_uninitialized.h (uninitialized_fill):
Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Fix missing #endif in unused header
Jonathan Wakely [Wed, 1 Apr 2026 09:26:19 +0000 (10:26 +0100)] 
libstdc++: Fix missing #endif in unused header

This header does not appear to be used anywhere, but Doxygen gives a
warning when processing it:

include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp:49: warning: More #if's than #endif's found (might be in an included file).

libstdc++-v3/ChangeLog:

* include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp:
Add missing #endif.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Fix errors in Doxygen markup
Jonathan Wakely [Tue, 31 Mar 2026 15:00:41 +0000 (16:00 +0100)] 
libstdc++: Fix errors in Doxygen markup

libstdc++-v3/ChangeLog:

* doc/doxygen/doxygroups.cc: Define variable_templates group.
* include/bits/binders.h: Fix @file name.
* include/bits/formatfwd.h: Add missing @cond
* include/bits/forward_list.h: Add closing backtick in comment.
* include/bits/out_ptr.h (out_ptr, inout_ptr): Fix names in
@param comments.
* include/bits/regex_constants.h: Escape backtick in comment.
* include/bits/stl_map.h: Add missing @{.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_pair.h: Move declaration of complex into #if
group where it's used. Fix nesting of @cond and @endcond in #if
groups.
* include/std/functional: Move @cond inside #if group.
* include/std/type_traits: Likewise.
* libsupc++/exception: Fix typo'd backtick.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Tweak Doxygen config file to include C++26 components
Jonathan Wakely [Wed, 1 Apr 2026 09:41:29 +0000 (10:41 +0100)] 
libstdc++: Tweak Doxygen config file to include C++26 components

This updates the __cplusplus value used by Doxygen, so that C++26
components are included in the generated docs. It also suppresses
documentation for some macros that are implementation details or just
uninteresting for users.

libstdc++-v3/ChangeLog:

* doc/doxygen/user.cfg.in (INPUT): Add <debugging> header.
(EXCLUDE_SYMBOLS): Exclude include guards and other internal
macros from generated documentation.
(PREDEFINED): Update __cplusplus to C++26 value. Remove
unnecessary spaces in macro expansions. Add missing
_GLIBCXX_ABI_TAG_CXX11 macro.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Update Doxygen config to 1.17.0
Jonathan Wakely [Wed, 1 Apr 2026 09:37:09 +0000 (10:37 +0100)] 
libstdc++: Update Doxygen config to 1.17.0

The changes were done automatically using 'doxygen -u' to rebase the
config on Doxygen 1.17.0, which added a number of new config options and
removed HTML_TIMESTAMP and LATEX_TIMESTAMP.

libstdc++-v3/ChangeLog:

* doc/doxygen/user.cfg.in: Update Doxygen config.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Use __cpp_lib_map_try_emplace feature test macro
Jonathan Wakely [Wed, 1 Apr 2026 14:16:38 +0000 (15:16 +0100)] 
libstdc++: Use __cpp_lib_map_try_emplace feature test macro

Check the relevant macro for insert_or_assign members, instead of just
checking the value of __cplusplus.

Also use Doxygen grouping to make docs for try_emplace apply to all
three overloads.

libstdc++-v3/ChangeLog:

* include/bits/stl_map.h (map::try_emplace): Move #endif and use
Doxygen's @{ to document all three overloads.
(map::insert_or_assign): Use relevant feature test macro.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agoi386/testsuite: Fix pr124696.c test failure for 32-bit targets
Uros Bizjak [Thu, 2 Apr 2026 10:56:03 +0000 (12:56 +0200)] 
i386/testsuite: Fix pr124696.c test failure for 32-bit targets

Compile only for int128 targets. Also, use -Wno-psabi instead of -w.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr124696.c: Compile only for int128 targets.
(dg-options): Use -Wno-psabi instead of -w

8 days agolibstdc++: Rename std::strided_slice to std::extent_slice.
Tomasz Kamiński [Thu, 19 Mar 2026 15:35:13 +0000 (16:35 +0100)] 
libstdc++: Rename std::strided_slice to std::extent_slice.

This is last change proposed in P3982R2, so we bump submdspan
value.

libstdc++-v3/ChangeLog:

* include/bits/version.def (submdspan): Update to 202603,
and list all papers in comment.
* include/bits/version.h: Regenerate.
* include/std/mdspan: Replaced std::strided_stride to
std::extent_slice, __is_strided_slice to __is_extent_slice,
_SliceKind::__unit_strided_slice to __unit_stride_slice.
* src/c++23/std.cc.in (std::extent_slice): Replaced
std::strided_slice to std::extent_slice.
* testsuite/23_containers/mdspan/submdspan/canonical_slices.cc:
Replaced all occurences of strided_slice to extent_slice.
* testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc:
Likewise.
* testsuite/23_containers/mdspan/submdspan/strided_slice.cc: Move to...
* testsuite/23_containers/mdspan/submdspan/extent_slice.cc: ...here
and handle rename.
* testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc: Move to...
* testsuite/23_containers/mdspan/submdspan/extent_slice_neg.cc: ...here
and handle rename.
* testsuite/23_containers/mdspan/submdspan/selections/testcases.h:
Replaced all occurences of strided_slice to extent_slice.
* testsuite/23_containers/mdspan/submdspan/subextents.cc: Likewise.
* testsuite/23_containers/mdspan/submdspan/subextents_neg.cc:
Likewise.
* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
Likewise.
* testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Change meaning of strided_slice::extent per P3982R2
Tomasz Kamiński [Mon, 26 Jan 2026 11:20:48 +0000 (12:20 +0100)] 
libstdc++: Change meaning of strided_slice::extent per P3982R2

This patch implements the changes suggested in P3982R2 (and PL007 NB comment)
for C++26, but changing the strided_slice::extent to indicate number of
elements (extent) in the produced (output) mdspan, instead of input.

libstdc++-v3/ChangeLog:

* include/std/mdspan (__mdspan::__static_slice_extent)
(__mdspan::__dynamic_slice_extent): Return unmodified extent
value for strided_slice.
(__mdspan::__substrides_generic, __mdspan::__substrides_standardized):
Multipliy stride, if more than one element is requested.
(__mdspan::__canonical_range_slice): Define.
(__mdspan::__slice_cast): Use __canonical_range_slice for range_slice
and two elements tuples.
(__mdspan::__check_inrange_index): Define.
(__mdspan::__check_valid_slice): Validate if slice.offset +
(slice.extent - 1) * slice.stride fits into extent of given
dimension. Check stride if slice.extent > 1.
* testsuite/23_containers/mdspan/submdspan/canonical_slices.cc:
Add test for range_slice.
* testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc:
Add tests validating new conditions.
* testsuite/23_containers/mdspan/submdspan/selections/testcases.h:
Adjusted for change of meaing of strided_slice::extent.
* testsuite/23_containers/mdspan/submdspan/subextents.cc:
Adjusted for change of meaing of strided_slice::extent. And expanded
range_slice tests.
* testsuite/23_containers/mdspan/submdspan/subextents_neg.cc:
Adjusted for change of meaing of strided_slice::extent.
* testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc:
Adjust test for stride value.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Implement range_slice from P3982R2.
Tomasz Kamiński [Tue, 16 Dec 2025 17:03:23 +0000 (18:03 +0100)] 
libstdc++: Implement range_slice from P3982R2.

This patch add a range_slice a class, and maps it to strided_slice
with the original meanning. This is usefull for benchmark, as effects
of strided_slice remain stable before and after the change.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in (range_slice): Export.
* include/std/mdspan (range_slice, __mdspan::__is_range_slice):
Define.
(__mdspan::__slice_cast): Handle strided_slice.
* testsuite/23_containers/mdspan/submdspan/subextents.cc:
Sanity tests for range_slice.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agotestsuite: disable loop peeling check for arm [PR124705]
Christophe Lyon [Wed, 1 Apr 2026 16:34:24 +0000 (16:34 +0000)] 
testsuite: disable loop peeling check for arm [PR124705]

Unaligned accesses or peeling for alignment is ok for all arm targets,
including e.g. armeb-*.

gcc/testsuite/ChangeLog:

PR target/124705
* gcc.dg/tree-ssa/gen-vect-26.c: Disable loop peeling check for
arm*-*-.
* gcc.dg/tree-ssa/gen-vect-28.c: Likewise.

8 days agoLoongArch: Implement TARGET_CHECK_TARGET_CLONE_VERSION.
Lulu Cheng [Tue, 24 Mar 2026 03:32:25 +0000 (11:32 +0800)] 
LoongArch: Implement TARGET_CHECK_TARGET_CLONE_VERSION.

This is to be able to ignore invalid versions to allow some portability
of code using target_clones attributes.
Add warning tests for invalid target_clones versions.

gcc/ChangeLog:

* config/loongarch/loongarch-protos.h
(loongarch_parse_fmv_features): Modify parameter type.
* config/loongarch/loongarch-target-attr.cc
(loongarch_parse_fmv_features): Some errors have been
changed to warnings.
* config/loongarch/loongarch.cc
(loongarch_process_target_version_attr): Update parameters.
(loongarch_check_target_clone_version): Likewise.
(loongarch_option_same_function_versions): Likewise.
(TARGET_CHECK_TARGET_CLONE_VERSION): Define.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/attr-check-error-message8.c: Removed.
* gcc.target/loongarch/attr-check-error-message9.c: Removed.
* gcc.target/loongarch/attr-check-warning-message1.c: New test.
* gcc.target/loongarch/attr-check-warning-message2.c: New test.
* gcc.target/loongarch/attr-check-warning-message3.c: New test.

8 days agolibstdc++: Add new-abi-baseline target to main Makefile
Jonathan Wakely [Wed, 1 Apr 2026 13:55:28 +0000 (14:55 +0100)] 
libstdc++: Add new-abi-baseline target to main Makefile

This allows you to run 'make new-abi-baseline' in the
$target/libstdc++-v3 build directory instead of only in the testsuite
subdirectory.

libstdc++-v3/ChangeLog:

* Makefile.am (new-abi-baseline): New target.
* Makefile.in: Regenerate.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Check right value of __cpp_lib_format for dynamic_string
Jonathan Wakely [Wed, 1 Apr 2026 14:25:14 +0000 (15:25 +0100)] 
libstdc++: Check right value of __cpp_lib_format for dynamic_string

This doesn't matter in practice, but strictly speaking the right value
for defining std::dynamic_format is 202603 not 202311 (which was the
macro value for the old name, std::runtime_format).

libstdc++-v3/ChangeLog:

* include/std/format (dynamic_format): Check new value for
feature test macro.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
8 days agolibstdc++: Fix typo in export of std::saturating_cast.
Tomasz Kamiński [Thu, 2 Apr 2026 07:10:51 +0000 (09:10 +0200)] 
libstdc++: Fix typo in export of std::saturating_cast.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in (std::saturatint_cast): Fixed typo...
(std::saturating_cast): ...by exporting this.

8 days agolibstdc++: Update export declaration for dynamic_format and saturation arithmetic.
Tomasz Kamiński [Thu, 2 Apr 2026 06:53:32 +0000 (08:53 +0200)] 
libstdc++: Update export declaration for dynamic_format and saturation arithmetic.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in (std::runtime_format, std::add_sat)
(std::sub_sat, std::mul_sat, std::div_sat, std::saturate_cast):
Replace exports with...
(std::dynamic_format, std::saturating_add, std::saturating_sub)
(std::saturating_mul, std::saturating_div, std::saturating_cast):
...exports of new names.

8 days agofortran: Fix assumed-rank repacking for contiguous dummies [PR124751]
Christopher Albert [Wed, 1 Apr 2026 13:52:30 +0000 (15:52 +0200)] 
fortran: Fix assumed-rank repacking for contiguous dummies [PR124751]

When an assumed-rank actual is packed for a contiguous dummy argument,
create a descriptor for the packed temporary instead of reusing the
original descriptor metadata with stale strides and offsets.

The updated testcase keeps the original ICE coverage from PR100194 and
adds runtime coverage for the remaining wrong-code cases reported after
r16-8375.

PR fortran/124751

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_conv_array_parameter): Build a packed
descriptor for assumed-rank actual arguments instead of reusing
stale metadata from the original descriptor.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr100194.f90: Run the testcase and add runtime
coverage for packed assumed-rank sections.

Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
Signed-off-by: Christopher Albert <albert@tugraz.at>
8 days agoDaily bump.
GCC Administrator [Thu, 2 Apr 2026 00:16:31 +0000 (00:16 +0000)] 
Daily bump.

8 days agofortran: Change test case to compile only.
Jerry DeLisle [Wed, 1 Apr 2026 23:14:56 +0000 (16:14 -0700)] 
fortran: Change test case to compile only.

PR fortran/124739

gcc/testsuite/ChangeLog:

* gfortran.dg/pr124739.f90: Change 'run' to 'compile'.

8 days agoPR target/123238: VCOND_MASK regression on aarch64.
Roger Sayle [Wed, 1 Apr 2026 22:54:50 +0000 (23:54 +0100)] 
PR target/123238: VCOND_MASK regression on aarch64.

This patch fixes the regression PR target/123238 on aarch64, using the
changes to aarch64's aarch64_rtx_costs proposed by Tamar Christina.

To explain and motivate things for aarch64:

void foo(char c[])
{
    for (int i = 0; i < 8; i++)
        c[i] = c[i] != 'a' ? 'c' : 'e';
}

currently generates with -O2 the following:

foo: movi    v30.8b, 0x61
        ldr     d0, [x0]
        movi    v29.8b, 0x63
        movi    v31.8b, 0x65
        cmeq    v30.8b, v0.8b, v30.8b
        not     v30.8b, v30.8b
        bit     v31.8b, v29.8b, v30.8b
        str     d31, [x0]
        ret

where a cmeq followed by a not is used to implement NE_EXPR.
c.f. the comment "Handle NE as !EQ" in aarch64-simd.md's expander
of vec_cmp<mode><mode>.  With the patch for PR 123238, including this
change to aarch64_rtx_costs to indicate that NE is more expensive
than EQ, the middle-end swaps the VCOND_EXPR, reducing the number of
instructions in the example above [to what it was in GCC 14].

2026-04-01  Tamar Christina  <tamar.christina@arm.com>
    Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/123238
* config/aarch64/aarch64.cc (aarch64_rtx_costs) <case NE/EQ>:
Provide improved costs for scalar and vector comparisons.

gcc/testsuite/ChangeLog
PR target/123238
* gcc.target/aarch64/pr123238.c: New test case.

8 days agoPR target/123238: VCOND_MASK regression on x86_64.
Roger Sayle [Wed, 1 Apr 2026 22:52:26 +0000 (23:52 +0100)] 
PR target/123238: VCOND_MASK regression on x86_64.

This patch is my revised fix for (the regression aspects of) PR123238,
a code quality regression on x86_64 triggered by the generation of
VCOND_MASK.  The regression is actually just bad luck.  From gimple,
VCOND_MASK(a==b,c,d) is equivalent to VCOND_MASK(a!=b,d,c), and which
form gets generated was previously arbitrary.  This is reasonable for
many (most?) targets, but on x86_64 there's an asymmetry, equality
can be performed in 1 instruction, but inequality requires three.

Teaching the middle-end's expand pass which form is preferred could
in theory be done with a new (very specific) target hook, that would
require documentation, but a more generic solution is for expand's
expand_vec_cond_mask_optab_fn to make use of rtx_costs, and reverse
the sense of VCOND_MASK if that would be an improvement.  This has
the convenient property that the default rtx_costs of all comparison
operators is the same, resulting in no change unless explicitly
specified by the backend.

This revision incorporates the feedback from both Andrew Pinksi and
Richard Biener, using get_gimple_for_ssa_name instead of
SSA_NAME_DEF_STMT, and Andrew's suggestion to log expand's
decision to the dump file, which now contains lines such as:

;; swapping operands of .VCOND_MASK
;; cost of original ne: 8
;; cost of replacement eq: 4

or (for failure)

;; not swapping operands of .VCOND_MASK
;; cost of original eq: 4
;; cost of replacement ne: 8

Thanks to Richard and Hongtao for approvals.

2026-04-01  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/123238
* expr.cc (convert_tree_comp_to_rtx): Make global.
* expr.h (convert_tree_comp_to_rtx): Prototype here.
* internal-fn.cc (expand_vec_cond_mask_optab_fn): Use rtx_costs
to determine whether swapping operands would result in better
code.

* config/i386/i386-expand.cc (ix86_expand_int_vec_cmp): On
AVX512 targets use a ternlog instead of a comparison to negate
the mask (requires one instruction instead of two).
* config/i386/i386.cc (ix86_rtx_costs): Refactor code for UNSPEC.
Provide costs for UNSPEC_BLENDV and  UNSPEC_MOVMSK.  Provide
costs for comparison operators of integer vector modes.

gcc/testsuite/ChangeLog
PR target/123238
* gcc.target/i386/pr123238.c: Likewise.

8 days agofortran: Fix host association in module procedure interface bodies [PR79330]
Gonzalosilvalde [Sat, 28 Mar 2026 11:22:42 +0000 (12:22 +0100)] 
fortran: Fix host association in module procedure interface bodies [PR79330]

Named constants from the host scope were not accessible in module
procedure interface bodies, causing bind(C, name=...) expressions
referencing such constants to fail.  The compiler treated the constant
as an implicitly typed REAL(4) variable instead of resolving it from
the enclosing module scope.

The fix sets has_import_set on the current namespace when a module
procedure is detected inside an interface block, before bind(C) is
parsed, so that symbol lookup can reach the host scope.

gcc/fortran/ChangeLog:

PR fortran/79330
* decl.cc (gfc_match_subroutine): Set has_import_set when
matching a module procedure inside an interface block.
(gfc_match_function_decl): Likewise.

gcc/testsuite/ChangeLog:

PR fortran/79330
* gfortran.dg/bind_c_module_proc.f90: New test.

Signed-off-by: Gonzalo Silvalde <gonzalo.silvalde@gmail.com>
8 days ago[PR124696, LRA]: Fix LRA cycle involving reloads, secondary memory reloads, and subre...
Vladimir N. Makarov [Wed, 1 Apr 2026 19:08:01 +0000 (15:08 -0400)] 
[PR124696, LRA]: Fix LRA cycle involving reloads, secondary memory reloads, and subreg reloads

The code for reloading the register inside paradoxical subreg is assumed
to require that the subreg is located in more than one hard reg.  But the check was
omitted and this resulted in LRA cycling through series of reloads,
secondary memory reloads, and subreg reloads.  The patch fixes this.

gcc/ChangeLog:

PR rtl-optimization/124696
* lra-constraints.cc (simplify_operand_subreg): Reload
paradoxical subreg only if it requires more than one hard reg.

gcc/testsuite/ChangeLog:

PR rtl-optimization/124696
* gcc.target/i386/pr124696.c: New.

8 days agod: Merge upstream dmd, druntime 55e64690bc, phobos 0c519ae39.
Iain Buclaw [Wed, 1 Apr 2026 18:16:34 +0000 (20:16 +0200)] 
d: Merge upstream dmd, druntime 55e64690bc, phobos 0c519ae39.

D front-end changes:

- Import dmd v2.113.0-beta.1.
- Add support for static array length inference.
- Added trait `__traits(needsDestruction, T)'.
- Added trait `__traits(isOverlapped, field)'.

D runtime changes:

- Import druntime v2.113.0-beta.1.

Phobos changes:

- Import phobos v2.113.0-beta.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 55e64690bc.
* dmd/VERSION: Bump version to v2.113.0-beta.1.
* d-codegen.cc (d_build_call): Check if argument is already a
TARGET_EXPR.
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Don't use
`__result' decl as named return value if it's a ref type.
* expr.cc (ExprVisitor::visit (StructLiteralExp *)): Force TARGET_EXPR
if init symbol needs to be mutable.
* runtime.def (ARRAYSETLENGTHT): Remove.
(ARRAYSETLENGTHIT): Remove.
(ARRAYCOPY): Remove.
(ARRAYAPPENDCTX): Remove.
* typeinfo.cc (TypeInfoVisitor::visit (TypeInfoClassDeclaration *)):
Only scan class fields for pointer members.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 55e64690bc.
* src/MERGE: Merge upstream phobos 0c519ae39.
* src/Makefile.am (PHOBOS_DSOURCES): Add
std/internal/windows/bcrypt.d.
* src/Makefile.in: Regenerate.
* testsuite/libphobos.aa/test_aa.d: Update.
* testsuite/libphobos.phobos/std_array.d: Regenerate.
* testsuite/libphobos.phobos/std_mathspecial.d: Regenerate.
* src/std/internal/windows/bcrypt.d: New file.

8 days agoc++: Implement CWG3124 - Disallow annotations on block-scope externs and non-unique...
Jakub Jelinek [Wed, 1 Apr 2026 18:13:23 +0000 (20:13 +0200)] 
c++: Implement CWG3124 - Disallow annotations on block-scope externs and non-unique friend declarations

This issue says it is invalid to declare annotations on local externs or
non-defining friends and their arguments (if any).

2026-04-01  Jakub Jelinek  <jakub@redhat.com>

* name-lookup.cc (push_local_extern_decl_alias): Diagnose annotations
on local externs and their arguments.
* decl.cc (grokdeclarator): Diagnose annotations on non-defining
friends and their arguments.

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

8 days agoc++: Change ^^:: mangling from LDmngE to LDmgsE
Jakub Jelinek [Wed, 1 Apr 2026 17:19:19 +0000 (19:19 +0200)] 
c++: Change ^^:: mangling from LDmngE to LDmgsE

In
https://github.com/itanium-cxx-abi/cxx-abi/issues/208#issuecomment-3518384358
Richard Smith suggested (among other things) to use gs instead of ng
for ^^:: mangling, because gs is already used elsewhere in the grammar for
similar purposes (like [gs] nw <expression>* _ <type> E etc.).

This patch changes that, plus added the part I forgot to update when
mangling the annotations.

Note, in
https://github.com/itanium-cxx-abi/cxx-abi/issues/208#issuecomment-3571323241
Tim Song mentioned that perhaps for L Dm ta ... E we should be including
both the <alias prefix> and underlying <type> (probably with some
separation), because different TUs could have different aliases.  Or shall
all decls which refer to type aliases be TU local?

2026-04-01  Jakub Jelinek  <jakub@redhat.com>

* mangle.cc (write_reflection): Change ^^:: mangling in grammar
from LDmngE to LDmgsE.
* reflect.cc (reflection_mangle_prefix): Set prefix to "gs" rather
than "ng" for global_namespace.

* g++.dg/reflect/mangle1.C: Expect _Z3barILi310ELDmgsEEvv
rather than _Z3barILi310ELDmngEEvv.

Reviewed-by: Jason Merrill <jason@redhat.com>
8 days agolibstdc++: Attempt to implement LWG4537 - Improve define_static_array
Jakub Jelinek [Wed, 1 Apr 2026 17:15:51 +0000 (19:15 +0200)] 
libstdc++: Attempt to implement LWG4537 - Improve define_static_array

The following patch attempts to implement
https://cplusplus.github.io/LWG/lwg-active.html#4537

I've also added tests for the returned type.

2026-04-01  Jakub Jelinek  <jakub@redhat.com>

* include/std/meta (std::meta::__detail::__statically_sized): New
concept.
(std::meta::define_static_array): Change return type to auto.  If
__statically_sized<_Rg>, return span with ranges::size(__r) as
second argument.

* g++.dg/reflect/define_static_array1.C (l): Another variable
with define_static_array test from array<int, 0>.
Add static assertions for types of the define_static_array results.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
8 days agoMAINTAINERS: Add my bugzilla account
David Faust [Wed, 1 Apr 2026 16:49:26 +0000 (09:49 -0700)] 
MAINTAINERS: Add my bugzilla account

ChangeLog:

* MAINTAINERS: Add my bugzilla account.

8 days agolibstdc++: [_GLIBCXX_DEBUG] Fix COW string valid range check
François Dumont [Mon, 30 Mar 2026 20:18:50 +0000 (22:18 +0200)] 
libstdc++: [_GLIBCXX_DEBUG] Fix COW string valid range check

In revision 698a6af5dcbae5d935bcda8a461dea8458c658dc the _GLIBCXX_DEBUG code
for the Library Defect 438 has been removed as starting in C++11 the iterator
type is constrained through the _RequireInputIter requirement.

But the COW basic_string implementation used when _GLIBCXX_USE_CXX11_ABI=0 is
missing the _RequireInputIter constraint on a number of methods resulting in test
failures.

For the moment move the culprit __glibcxx_requires_valid_range call in the COW
basic_string implementation in a method where the iterator type has already been
checked.

libstdc++-v3/ChangeLog:

* include/bits/cow_string.h
(basic_string::replace(iterator, iterator, _InputIte, _InputIte)): Move
__glibcxx_requires_valid_range to...
(basic_string::_M_replace_dispatch(iterator, iterator, _InputIte,
_InputIte, __fase_type)): ...here.
* testsuite/21_strings/basic_string/debug/append_neg.cc: New test case.
* testsuite/21_strings/basic_string/debug/assign_neg.cc: New test case.
* testsuite/21_strings/basic_string/debug/construct_neg.cc: New test case.
* testsuite/21_strings/basic_string/debug/insert_neg.cc: New test case.
* testsuite/21_strings/basic_string/debug/replace_neg.cc: New test case.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
8 days agoMAINTAINERS: Update Qing Zhao email address
David Faust [Wed, 1 Apr 2026 16:28:10 +0000 (09:28 -0700)] 
MAINTAINERS: Update Qing Zhao email address

Qing has retired from Oracle, and asked me to update her email address
in MAINTAINERS on her behalf, as she temporarily does not have a
machine set up to push to the repo.

ChangeLog:

* MAINTAINERS: Update Qing Zhao email address.

9 days agolibstdc++/ranges: Inline hidden friends' member function helpers
Patrick Palka [Wed, 1 Apr 2026 15:34:27 +0000 (11:34 -0400)] 
libstdc++/ranges: Inline hidden friends' member function helpers

These helpers were needed to work around GCC's historically strict
interpretation of friendship for hidden friends whereby they did not
inherit the friends of the containing class.  But this has been relaxed
in r13-465 which granted hidden friends the same access as any other
member declaration, and <ranges> additions since then rely on this
relaxed interpretation.  (Note that Clang also has this relaxed
interpretation, but MSVC / EDG seem to have the strict interpretation.)

This patch removes these now redundant member functions and inlines
their logic directly into the respective friend operators, making
things simpler and more consistent.

libstdc++-v3/ChangeLog:

* include/std/ranges (iota_view::_Sentinel): Remove _M_equal and
_M_distance_from.  Inline logic into friend operators.
(basic_istream_view::_Iterator): Remove _M_at_end.  Inline logic
into operator==.
(transform_view::_Sentinel): Remove __distance_from and __equal.
Inline logic into friend operators.
(join_view::_Sentinel): Remove __equal.  Inline logic into operator==.
(lazy_split_view::_OuterIter): Remove __at_end.  Inline logic into
operator==.
(split_view::_Sentinel): Remove _M_equal.  Inline logic into operator==.
(elements_view::_Sentinel): Remove _M_equal and _M_distance_from.
Inline logic into friend operators.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
9 days agolibstdc++: Implement P3725R3 Filter View Extensions for Safer Use
Patrick Palka [Wed, 1 Apr 2026 15:34:24 +0000 (11:34 -0400)] 
libstdc++: Implement P3725R3 Filter View Extensions for Safer Use

This implements the recently approved C++26 paper P3725R3, which
we treat as a Defect Report against C++20.

libstdc++-v3/ChangeLog:

* include/bits/version.def (ranges_filter): Define for C++20.
* include/bits/version.h: Regenerate.
* include/std/ranges: Provide __cpp_lib_ranges_filter.
(filter_view::_Iterator): Add _Const template parameter.
(filter_view::_Iterator::_S_iter_concept): Return
input_iterator_tag if _Const.
(filter_view::_Iterator::_Parent): New.
(filter_view::_Iterator::_Base): New.
(filter_view::_Iterator::_Vp_iter): Replace with ...
(filter_view::_Iterator::_Base_iter): ... this.
(filter_view::_Iterator::_M_current): Adjust to consider _Const.
(filter_view::_Iterator::_M_parent): Likewise.
(filter_view::_Iterator::value_type): Likewise.
(filter_view::_Iterator::difference_type): Likewise.
(filter_view::_Iterator::_Iterator): Likewise.  Add
const-converting overload.
(filter_view::_Iterator::base): Adjust to consider _Const.
(filter_view::_Iterator::operator*): Likewise.
(filter_view::_Iterator::operator->): Likewise.
(filter_view::_Iterator::operator++): Likewise.
(filter_view::_Iterator::operator--): Likewise.
(filter_view::_Iterator::iter_move): Likewise.
(filter_view::_Iterator::iter_swap): Likewise.
(filter_view::_Sentinel): Add _Const template parameter.
(filter_view::_Sentinel::_Parent): New.
(filter_view::_Sentinel::_Base): New.
(filter_view::_Sentinel::_M_end): Adjust to consider _Const.
(filter_view::_Sentinel::_Sentinel): Likewise.  Add
const-converting overload.
(filter_view::_Sentinel::base): Adjust to consider _Const.
(filter_view::_Sentinel::operator==): Likewise.  Inline the
helper member function __equal.
(filter_view::begin): Adjust return type of non-const overload.
New const overload.
(filter_view::end): Likewise.
* testsuite/std/ranges/adaptors/filter.cc: Verify value of
__cpp_lib_ranges_filter.
(test08): New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
9 days agos390: Fix -Wformat-security diagnostics
Stefan Schulze Frielinghaus [Wed, 1 Apr 2026 15:27:37 +0000 (17:27 +0200)] 
s390: Fix -Wformat-security diagnostics

This fixes

gcc/config/s390/s390.cc: In function ‘void print_operand(FILE*, rtx, int)’:
gcc/config/s390/s390.cc:8974:15: warning: format not a string literal and no format arguments [-Wformat-security]
 8974 |       fprintf (file, s390_branch_condition_mnemonic (x, FALSE));
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc/config/s390/s390.cc:8978:15: warning: format not a string literal and no format arguments [-Wformat-security]
 8978 |       fprintf (file, s390_branch_condition_mnemonic (x, TRUE));
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc/ChangeLog:

* config/s390/s390.cc (print_operand): Use fputs instead of
fprintf.

9 days agodoc: Update docs for character set support and environment variables [PR70917]
Sandra Loosemore [Wed, 1 Apr 2026 08:36:40 +0000 (08:36 +0000)] 
doc: Update docs for character set support and environment variables [PR70917]

The "Environment Variables" section of the GCC manual had
long-obsolete (20+ years!) information about environment variables
affecting character sets and encodings.  In particular, GCC stopped
using environment variables to control how input files are parsed
in 2004.

gcc/ChangeLog
PR preprocessor/70917
* doc/invoke.texi (Environment Variables): Clarify that LC_ALL,
LC_CTYPE, LC_MESSAGES, and LANG affect only diagnostics and
informational output from GCC, not the encodings of input and
output files. Remove separate bit-rotten entry for LANG.

9 days agolibstdc++: Rename std::runtime_format for C++26 (P3953R3)
Jonathan Wakely [Mon, 30 Mar 2026 11:13:39 +0000 (12:13 +0100)] 
libstdc++: Rename std::runtime_format for C++26 (P3953R3)

Last week in Croydon we approved P3953R3 to rename std::runtime_format
for C++26. The rationale is that with compile-time std::format, the name
std::runtime_format doesn't make sense. It's std::dynamic_format now
instead.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono::_S_empty_fs)
(__formatter_chrono::_M_C_y_Y, __formatter_chrono::_M_D_x)
(__formatter_chrono::_M_F, __formatter_chrono::_M_subsecs)
(__formatter_chrono_info::_M_format_to): Use
_Dynamic_format_string instead of _Runtime_format_string.
* include/bits/version.def (format): Bump value.
* include/bits/version.h: Regenerate.
* include/std/format (_Runtime_format_string): Rename to
_Dynamic_format_string.
(runtime_format): Rename to dynamic_format.
* include/std/print (println): Adjust comment to refer to
dynamic_format instead of runtime_format.
* testsuite/std/format/runtime_format.cc: Move to...
* testsuite/std/format/dynamic_format.cc: ...here.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
9 days agolibstdc++: Rename saturation arithmetic for C++26 (P4052R0)
Jonathan Wakely [Mon, 30 Mar 2026 11:13:39 +0000 (12:13 +0100)] 
libstdc++: Rename saturation arithmetic for C++26 (P4052R0)

Last week in Croydon we approved P4052R0 to rename std::add_sat etc. for
C++26

libstdc++-v3/ChangeLog:

* include/bits/sat_arith.h (add_sat, sub_sat, mul_sat, div_sat)
(saturate_cast): Rename to saturating_xxx as per P4052R0.
* include/bits/version.def (saturation_arithmetic): Bump value.
* include/bits/version.h: Regenerate.
* testsuite/26_numerics/saturation/add.cc: Use new name.
* testsuite/26_numerics/saturation/cast.cc: Likewise.
* testsuite/26_numerics/saturation/div.cc: Likewise.
* testsuite/26_numerics/saturation/extended.cc: Likewise.
* testsuite/26_numerics/saturation/mul.cc: Likewise.
* testsuite/26_numerics/saturation/sub.cc: Likewise.
* testsuite/26_numerics/saturation/version.cc: Check for updated
value.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
9 days agoforwprop: Add missing NULL check on vdef in optimize_aggr_zeroprop [PR124742]
Andrew Pinski [Wed, 1 Apr 2026 02:56:00 +0000 (19:56 -0700)] 
forwprop: Add missing NULL check on vdef in optimize_aggr_zeroprop [PR124742]

When I converted optimize_aggr_zeroprop into a forward walk instead of
a backward walk, I missed that the vdef of a memset call could be NULL.
This only happens when there is "undefined" declaration of memset exists.
Anyways this fixes the ICE by adding the NULL check and an early out.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/124742

gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_aggr_zeroprop): Exit
if the vdef on the stmt is NULL.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
9 days agoCheck BIGGEST_ALIGNMENT when forcing a local copy
H.J. Lu [Tue, 31 Mar 2026 15:59:50 +0000 (08:59 -0700)] 
Check BIGGEST_ALIGNMENT when forcing a local copy

BIGGEST_ALIGNMENT is the biggest alignment that any data type can require
on the target machine.  It is not the biggest alignment that is supported,
just the biggest alignment that, when violated, may cause a fault.

MAX_SUPPORTED_STACK_ALIGNMENT is the maximum stack alignment guaranteed by
the backend.  If SUPPORTS_STACK_ALIGNMENT is false, it is defined as
PREFERRED_STACK_BOUNDARY.

Adjust alignment check forcing a local copy if the argument on stack is
not aligned to its type and the current alignment is less than the
minimum of BIGGEST_ALIGNMENT and MAX_SUPPORTED_STACK_ALIGNMENT.

gcc/

PR middle-end/124697
* function.cc (assign_parm_adjust_stack_rtl): Force a local copy
if the current alignment is less than the minimum of
BIGGEST_ALIGNMENT and MAX_SUPPORTED_STACK_ALIGNMENT.

gcc/testsuite/

PR middle-end/124697
* gcc.target/i386/pr120839-1b.c: Adjusted.
* gcc.target/i386/pr124697-1a.c: New test.
* gcc.target/i386/pr124697-1b.c: Likewise.
* gcc.target/i386/pr124697-2a.c: Likewise.
* gcc.target/i386/pr124697-2b.c: Likewise.
* gcc.target/i386/pr124697-3a.c: Likewise.
* gcc.target/i386/pr124697-3b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
9 days agoc: Fix ICE related to field members that are arrays of pointers to structs [PR124635]
Martin Uecker [Fri, 27 Mar 2026 18:45:42 +0000 (19:45 +0100)] 
c: Fix ICE related to field members that are arrays of pointers to structs [PR124635]

We get a checking error in verify_type, because I did not copy
TYPE_REVERSE_STORAGE_ORDER over from the original when reconstructing
derived types during the contruction of canonical types.

PR c/124635

gcc/c/ChangeLog:
* c-typeck.cc (c_reconstruct_complex_type): Copy
TYPE_REVERSE_STORAGE_ORDER.

gcc/testsuite/ChangeLog:
* gcc.dg/pr124635.c: New test.

9 days agotestsuite: disable loop peeling check for arm-none-eabi [PR124705]
Torbjörn SVENSSON [Tue, 31 Mar 2026 14:42:38 +0000 (16:42 +0200)] 
testsuite: disable loop peeling check for arm-none-eabi [PR124705]

Unaligned accesses or peeling for alignment is ok for arm-none-eabi.

gcc/testsuite/ChangeLog:

PR target/124705
* gcc.dg/tree-ssa/gen-vect-26.c: Disable loop peeling check for
arm-none-eabi.
* gcc.dg/tree-ssa/gen-vect-28.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
9 days agotestsuite: xfail tests for arm_mve [PR93080]
Torbjörn SVENSSON [Tue, 31 Mar 2026 15:36:04 +0000 (17:36 +0200)] 
testsuite: xfail tests for arm_mve [PR93080]

As per comment 11 in PR93080.

gcc/testsuite/ChangeLog:

PR testsuite/93080
* gcc.dg/tree-ssa/forwprop-40.c: Xfail for arm_mve.
* gcc.dg/tree-ssa/forwprop-41.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
9 days agomiddle-end/124634 - add internal function internals documentation section
Richard Biener [Tue, 31 Mar 2026 17:48:30 +0000 (19:48 +0200)] 
middle-end/124634 - add internal function internals documentation section

The following adds documentation for internal function details.  I
have populated the internal function tables via macro expansion
of the internal-fn.def file, so it's quite boiler-plate and asks
for manual amending in more complicated places.

Without such a place it's quite difficult to tell people to document
things when they add new internal functions.  We might want to split
the table into two, separating direct internal functions from others.

I have added some overall sentences related to internal functions
and builtins but left the API section as a FIXME.

I'm not sure we need a separate index - I have used IFN_ prefixes
which separates them nicely.  Removing those would warrant a
separate index.

I've placed the contents after the GENERIC/GIMPLE chapters.

v2: wrap long lines and integrate Sandras changes

Built and inspected using texinfo 7.1.

PR middle-end/124634
* doc/ifn.texi: New file.
* doc/gccint.texi: Include ifn.texi.
* Makefile.in (TEXI_GCCINT_FILES): Add ifn.texi.

Co-Authored-By: Sandra Loosemore <sloosemore@baylibre.com>
9 days agodoc: Fix wrong documentation for -finput-charset [PR61896]
Sandra Loosemore [Wed, 1 Apr 2026 04:59:45 +0000 (04:59 +0000)] 
doc: Fix wrong documentation for -finput-charset [PR61896]

This patch fixes long-standing bugs in the documentation for
-finput-charset.  Support for getting the default charset from the
locale has been disabled since 2004.  The error behavior has never been
documented, and now there is -Winvalid-utf8 that should be mentioned
in this context too.

gcc/ChangeLog
PR c/61896
* doc/cppopts.texi (-finput-charset=): Remove long-obsolete
locale discussion.  Document behavior about ill-formed inputs.

9 days agodoc: Add copyright notices to .texi files that don't have one
Sandra Loosemore [Wed, 1 Apr 2026 03:05:14 +0000 (03:05 +0000)] 
doc: Add copyright notices to .texi files that don't have one

I realized I'd forgotten to add a copyright notice to specs.texi when I
split that from invoke.texi a while back.  Scanning the other .texi files
in the same directory, I found poly-int.texi was also missing a copyright.
Both are fixed with this patch.

gcc/ChangeLog
* doc/poly-int.texi: Add copyright notice.
* doc/specs.texi: Likewise.

9 days agofortran: Fix INQUIRE(id=integer-expression) is rejected.
Jerry DeLisle [Wed, 1 Apr 2026 02:54:25 +0000 (19:54 -0700)] 
fortran: Fix INQUIRE(id=integer-expression) is rejected.

PR fortran/124739

gcc/fortran/ChangeLog:

* io.cc (match_inquire_element): Change tag_id from a
variable tag to an expression tag.

gcc/testsuite/ChangeLog:

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

9 days agofortran: Fix ICE in gfc_trans_create_temp_array for assumed-rank [PR100194]
Christopher Albert [Tue, 31 Mar 2026 06:26:57 +0000 (08:26 +0200)] 
fortran: Fix ICE in gfc_trans_create_temp_array for assumed-rank [PR100194]

When a non-contiguous assumed-rank actual argument is passed to a
contiguous assumed-rank dummy, the compiler routes it through
gfc_conv_subref_array_arg which uses the scalarizer.  The scalarizer
requires known rank at compile time, but assumed-rank arrays have
rank = -1, hitting gcc_assert (ss->dimen > 0).

Skip the scalarizer path for assumed-rank expressions and let them
fall through to gfc_conv_array_parameter, which handles assumed-rank
via the runtime pack/unpack functions.

gcc/fortran/ChangeLog:

PR fortran/100194
* trans-expr.cc (gfc_conv_procedure_call): Skip
gfc_conv_subref_array_arg for assumed-rank actual arguments
(e->rank == -1) when the dummy is contiguous.

gcc/testsuite/ChangeLog:

PR fortran/100194
* gfortran.dg/pr100194.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
9 days agoDaily bump.
GCC Administrator [Wed, 1 Apr 2026 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

9 days agoc++: Fix up access_context::current and current_namespace
Jakub Jelinek [Tue, 31 Mar 2026 22:22:46 +0000 (00:22 +0200)] 
c++: Fix up access_context::current and current_namespace

On Mon, Mar 30, 2026 at 01:15:07PM +0200, Tomasz Kaminski wrote:
> > auto
> > Q::baz () -> typename [: current_namespace () == ^^Q ? ^^int : ^^:: :]
> > {
> >   return 0;
> > }
> > part also fails, there I don't know what's right but possibly it should
> > be in Q; in that case it would be a pre-existing bug already for
> > std::meta::access_context::current () too.
> >
> My reading of the standard may be wrong here.

I think you're right, but because it is a preexisting bug on
access_context, sending this as a separate patch rather than
updating the current_* patch.

2026-04-01  Jakub Jelinek  <jakub@redhat.com>

* reflect.cc (reflect_current_scope): Use decl_namespace_list->last ()
in preference to current_namespace.

* g++.dg/reflect/access_context1.C: Add new tests.
* g++.dg/reflect/current_function1.C: Likewise.
* g++.dg/reflect/current_class1.C: Likewise.
* g++.dg/reflect/current_class2.C: Likewise.
* g++.dg/reflect/current_namespace1.C: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agoc++: Handle annotations in data_member_spec/define_aggregate
Jakub Jelinek [Tue, 31 Mar 2026 22:14:04 +0000 (00:14 +0200)] 
c++: Handle annotations in data_member_spec/define_aggregate

The following patch attempts to implement another part of P3795R2,
in particular the addition of annotations to data_member_options
and handling it in data_member_spec/define_aggregate etc.

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

libstdc++-v3/
* include/std/meta (std::meta::data_member_options): Add annotations
member.
gcc/cp/
* reflect.cc (get_range_elts): If N is negative, just use the tree
as object to extract range from instead of finding Nth argument
of a call.
(eval_is_bit_field, eval_type_of, eval_size_of, eval_alignment_of,
eval_bit_size_of, eval_has_identifier, eval_identifier_of): Adjust
function comments from P3795R2.
(eval_display_string_of): Handle annotations in
REFLECT_DATA_MEMBER_SPEC.
(eval_annotations_of): Adjust function comments from P3795R2.
(eval_data_member_spec): Likewise.  Read and diagnose annotations.
(eval_define_aggregate): Adjust function comments from P3795R2.
Create annotations.
(compare_reflections): Compare REFLECT_DATA_MEMBER_SPEC annotations.
* mangle.cc (write_reflection): Mangle REFLECT_DATA_MEMBER_SPEC
annotations.
gcc/testsuite/
* g++.dg/reflect/data_member_spec5.C: New test.
* g++.dg/reflect/data_member_spec6.C: New test.
* g++.dg/reflect/display_string_of1.C: Expect extra ", {}" before
closing paren for empty annotations, otherwise a list of annotations.
* g++.dg/reflect/u8display_string_of1.C: Likewise.
* g++.dg/reflect/define_aggregate9.C: New test.
* g++.dg/reflect/mangle1.C: Test mangling of REFLECT_DATA_MEMBER_SPEC
annotations.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
9 days agoc++, libstdc++: Implement current_{function,class,namespace} metafn addition from...
Jakub Jelinek [Tue, 31 Mar 2026 21:42:38 +0000 (23:42 +0200)] 
c++, libstdc++: Implement current_{function,class,namespace} metafn addition from P3795R2

The following patch implements addition of std::meta::current_function,
std::meta::current_class, std::meta::current_namespace metafunctions
from P3795R2 - Miscellaneous Reflection Cleanup paper.

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

gcc/cp/
* metafns.gperf (enum metafn_code): Add METAFN_CURRENT_FUNCTION,
METAFN_CURRENT_CLASS and METAFN_CURRENT_NAMESPACE.
(enum metafn_kind): Add METAFN_KIND_INFO_VOID.
(current_function, current_class, current_namespace): New
metafunctions.
* pt.cc (value_dependent_expression_p): Make current_function(),
current_class() and current_namespace() calls dependent if they
are inside of template.
* reflect.cc (reflect_current_scope, eval_current_function,
eval_current_class, eval_current_namespace): New functions.
(eval_access_context_current): Use reflect_current_scope.
(process_metafunction): Handle METAFN_CURRENT_FUNCTION,
METAFN_CURRENT_CLASS and METAFN_CURRENT_NAMESPACE.
* metafns.h: Regenerate.
gcc/testsuite/
* g++.dg/reflect/current_function1.C: New test.
* g++.dg/reflect/current_function2.C: New test.
* g++.dg/reflect/current_class1.C: New test.
* g++.dg/reflect/current_class2.C: New test.
* g++.dg/reflect/current_namespace1.C: New test.
libstdc++-v3/
* include/std/meta (std::meta::current_function,
std::meta::current_class, std::meta::current_namespace): New
declarations.
* src/c++23/std.cc.in: Export those 3.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
9 days agoc++: Use anon enums in eval_data_member_spec
Jakub Jelinek [Tue, 31 Mar 2026 21:38:11 +0000 (23:38 +0200)] 
c++: Use anon enums in eval_data_member_spec

On Mon, Mar 30, 2026 at 03:46:57PM -0400, Jason Merrill wrote:
> Maybe it would be helpful to have local enums to name the indices in args?

Here is incremental patch to use local enums for those.
Tested on x86_64-linux, ok for trunk (it conflicts with the annotations
addition patch, but it can be easily resolved)?

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

* reflect.cc (eval_data_member_spec): Add anonymous enums for
fields in std::meta::data_member_options and
std::meta::data_member_options::_Name and use them instead of
hardcoded constants.

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agod: Merge upstream dmd, druntime e7c34c13de, phobos 0c5c9e984.
Iain Buclaw [Thu, 5 Feb 2026 16:38:18 +0000 (17:38 +0100)] 
d: Merge upstream dmd, druntime e7c34c13de, phobos 0c5c9e984.

D front-end changes:

- Add support for `with' statements with an expression
  initializer.
- Support for default values in bitfields.

Phobos changes:

- `std.variant' support for large structs with `@disabled this'.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd e7c34c13de.
* d-codegen.cc (build_vthis): Update for new front-end interface.
(get_frameinfo): Likewise.
* d-lang.cc (d_post_options): Disable null pointer checks.
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Ignore ref noreturn
variables.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime e7c34c13de.
* src/MERGE: Merge upstream phobos 0c5c9e984.
* testsuite/libphobos.phobos/std_algorithm_comparison.d: Regenerate.
* testsuite/libphobos.phobos/std_algorithm_iteration.d: Regenerate.
* testsuite/libphobos.phobos/std_algorithm_searching.d: Regenerate.
* testsuite/libphobos.phobos/std_array.d: Regenerate.
* testsuite/libphobos.phobos/std_concurrency.d: Regenerate.
* testsuite/libphobos.phobos/std_conv.d: Regenerate.
* testsuite/libphobos.phobos/std_datetime_date.d: Regenerate.
* testsuite/libphobos.phobos/std_datetime_systime.d: Regenerate.
* testsuite/libphobos.phobos/std_math_algebraic.d: Regenerate.
* testsuite/libphobos.phobos/std_meta.d: Regenerate.
* testsuite/libphobos.phobos/std_range_package.d: Regenerate.
* testsuite/libphobos.phobos/std_sumtype.d: Regenerate.
* testsuite/libphobos.phobos/std_traits.d: Regenerate.
* testsuite/libphobos.phobos/std_typecons.d: Regenerate.
* testsuite/libphobos.phobos/std_uuid.d: Regenerate.
* testsuite/libphobos.phobos/std_internal_entropy.d: New test.
* testsuite/libphobos.phobos/std_mathspecial.d: New test.

9 days agoc++/reflection: update eval_size_of comment
Marek Polacek [Tue, 31 Mar 2026 20:20:37 +0000 (16:20 -0400)] 
c++/reflection: update eval_size_of comment

The wording was changed by the fix for NB US 105-166 (C++26 CD).

gcc/cp/ChangeLog:

* reflect.cc (eval_offset_of): Update comment.

9 days agoUpdate gcc .po files
Joseph Myers [Tue, 31 Mar 2026 19:25:56 +0000 (19:25 +0000)] 
Update gcc .po files

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, ka.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po,
zh_CN.po, zh_TW.po: Update.

9 days agotestsuite: Require effective target fstack_protector for pr124041.c
Dimitar Dimitrov [Sat, 28 Mar 2026 09:19:00 +0000 (11:19 +0200)] 
testsuite: Require effective target fstack_protector for pr124041.c

Fix this spurious error on targets without stack protection ability:
  FAIL: gcc.dg/torture/pr124041.c   -O0  (test for excess errors)
  Excess errors:
  cc1: warning: '-fstack-protector' not supported for this target

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr124041.c: Require effective target
fstack_protector.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
9 days agotestsuite: Require int32plus effective target for pr122925.c
Dimitar Dimitrov [Sun, 22 Mar 2026 09:12:09 +0000 (11:12 +0200)] 
testsuite: Require int32plus effective target for pr122925.c

The test case logic relies on the constant literal -4 being promoted to
32-bit int.  But on AVR and other targets with 16-bit int types, the
literal is promoted to 16-bit int, which changes the expression value
and ultimately failing the test:

  FAIL: gcc.dg/pr122925.c execution test

Fix by requiring an effective target with at least 32-bit ints.

gcc/testsuite/ChangeLog:

* gcc.dg/pr122925.c: Require int32plus effective target.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
9 days agoFix internal error on non-byte-sized reference in GIMPLE DSE
Eric Botcazou [Tue, 31 Mar 2026 16:42:19 +0000 (18:42 +0200)] 
Fix internal error on non-byte-sized reference in GIMPLE DSE

This is a regression present on all the active branches and a sibling of:
  https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646628.html

during GIMPLE pass: dse
+===========================GNAT BUG DETECTED==============================+
| 16.0.1 20260331 (experimental) [master r16-8354-gbf6989de817]  GCC error:|
| in exact_div, at poly-int.h:2179                                         |
| Error detected around opt107.adb:26:11                                   |
| Compiling opt107.adb

At least one caller of compute_trims, namely maybe_trim_constructor_store,
expects ref->size to be a multiple of a byte for trimming, and that is most
probably the case for others in practice, from a cursory reading.  Therefore
the patch adds the same test on ref->size as the one added to ref->offset.

gcc/
* tree-ssa-dse.cc (compute_trims): Bail out if ref->size is not
byte aligned either.

gcc/testsuite/
* gnat.dg/opt107.adb: New test.
* gnat.dg/opt107_pkg.ads: New helper.