]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

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

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

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

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

2 months 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>
2 months agoDaily bump.
GCC Administrator [Thu, 2 Apr 2026 00:16:31 +0000 (00:16 +0000)] 
Daily bump.

2 months 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'.

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

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

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

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

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

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

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

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

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

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

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

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

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

2 months 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>
2 months agoDaily bump.
GCC Administrator [Wed, 1 Apr 2026 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

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

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

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

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

2 months agotestsuite: Add testcase for CWG3145 - Uniqueness of annotations
Jakub Jelinek [Tue, 31 Mar 2026 16:31:00 +0000 (18:31 +0200)] 
testsuite: Add testcase for CWG3145 - Uniqueness of annotations

We already implement this, so just adding a testcase for it.

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

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

2 months agotestsuite: i386: Fix gcc.dg/analyzer/null-deref-pr123981-1.c
Rainer Orth [Tue, 31 Mar 2026 15:31:34 +0000 (17:31 +0200)] 
testsuite: i386: Fix gcc.dg/analyzer/null-deref-pr123981-1.c

The gcc.dg/analyzer/null-deref-pr123981-1.c test FAILs on 64-bit x86
targets with -m32:

FAIL: gcc.dg/analyzer/null-deref-pr123981-1.c (test for excess errors)

gcc.dg/analyzer/null-deref-pr123981-1.c:10:3: error: implicit declaration of function '_writegsbase_u64' [-Wimplicit-function-declaration]
gcc.dg/analyzer/null-deref-pr123981-1.c:10:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

As always, restricting x86 tests by target triplet is wrong: instead of
target x86_64-*-* this needs to be x86 && lp64.

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

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

gcc/testsuite:
* gcc.dg/analyzer/null-deref-pr123981-1.c: Restrict to 64-bit x86.

2 months agolibphobos: Replace old alias declaration syntax for modern style
Iain Buclaw [Tue, 31 Mar 2026 14:17:33 +0000 (16:17 +0200)] 
libphobos: Replace old alias declaration syntax for modern style

2 months agod: Update copyright years of the dmd frontend
Iain Buclaw [Tue, 31 Mar 2026 14:11:50 +0000 (16:11 +0200)] 
d: Update copyright years of the dmd frontend

2 months agofortran: Give up reference factoring in case of shared tree [PR124661]
Mikael Morin [Tue, 31 Mar 2026 13:34:29 +0000 (15:34 +0200)] 
fortran: Give up reference factoring in case of shared tree [PR124661]

When we are about to create a variable to factor a subreference of an
array descriptor, check whether that subreference is shared with some of
the preliminary code and abort the factoring in that case.

In the example from the PR, the preliminary code contained bounds
checking code and the replacement of the subreferences by fresh
variables was causing those variables to be used before they were
defined in that bounds checking code.

PR fortran/121185
PR fortran/124661

gcc/fortran/ChangeLog:

* trans-array.cc (maybe_save_ref): New wrapper function around
save ref.
(set_factored_descriptor_value): Use the new wrapper function.
Add argument PRELIMINARY_CODE.
(gfc_conv_ss_descriptor): Update caller.

gcc/ChangeLog:

* tree-inline.cc (debug_find_tree, debug_find_tree_1): Move
and rename functions...
* tree.cc (find_tree, find_tree_1): ... here.
* tree-inline.h (debug_find_tree): Move renamed declaration...
* tree.h (find_tree): ... here.

gcc/testsuite/ChangeLog:

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

Co-authored-by: Christopher Albert <albert@tugraz.at>
2 months agox86: Call ix86_access_stack_p only for larger alignment
H.J. Lu [Sun, 29 Mar 2026 21:30:28 +0000 (14:30 -0700)] 
x86: Call ix86_access_stack_p only for larger alignment

ix86_access_stack_p can be quite expensive.  Don't check symbolic constant
load.  Instead, call ix86_access_stack_p only if an INSN needs alignment
> stack alignment.  This reduces the compile time of PR target/124684 from
185 seconds to 24 seconds.  The compile time of PR target/124165 test is
unchanged.

PR target/124165
PR target/124684
* config/i386/i386.cc (ix86_symbolic_const_load_p_1): Renamed to
...
(ix86_need_alignment_p_1): This.
(ix86_symbolic_const_load_p): Renamed to ...
(ix86_need_alignment_p): This.
(ix86_find_max_used_stack_alignment): Call ix86_access_stack_p
only if the INSN needs alignment > stack alignment.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 months agotestsuite: change from vect_float to vect_double for tests [PR124712]
Torbjörn SVENSSON [Tue, 31 Mar 2026 11:30:16 +0000 (13:30 +0200)] 
testsuite: change from vect_float to vect_double for tests [PR124712]

gcc/testsuite/ChangeLog:

PR target/124712
* gcc.dg/vect/vect-fmax-2.c: Changed effective target vect_float
to vect_double.
* gcc.dg/vect/vect-fmax-3.c: Likewise.
* gcc.dg/vect/vect-fmin-2.c: Likewise.
* gcc.dg/vect/vect-fmin-3.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 months agoaarch64: Sync aarch64-sys-regs.def with Binutils
Srinath Parvathaneni [Tue, 31 Mar 2026 09:31:27 +0000 (10:31 +0100)] 
aarch64: Sync aarch64-sys-regs.def with Binutils

This patch incorporates changes to this file in Binutils
since October 2025. This file includes the new system
registers in the 2025 architecture extensions.

gcc/ChangeLog:

* config/aarch64/aarch64-sys-regs.def: Copy from Binutils.

2 months agoaarch64: Add support for 2025 architecture feature options
Srinath Parvathaneni [Tue, 31 Mar 2026 09:31:17 +0000 (10:31 +0100)] 
aarch64: Add support for 2025 architecture feature options

This patch adds support for new -march feature options
corresponding to 2025 architecture extensions.

* +poe2
* +tlbid
* +tev
* +gcie
* +mpamv2
* +lscp
* +mops-go
* +sve2p3
* +sme2p3
* +f16f32dot
* +sve-b16mm
* +mtetc
* +f16f32mm
* +f16mm

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def (poe2):
New CLI extension option.
(tev): Likewise.
(tlbid): Likewise.
(gcie): Likewise.
(mpamv2): Likewise.
(lscp): Likewise.
(mops-go): Likewise.
(sve2p3): Likewise.
(sme2p3): Likewise.
(f16f32dot): Likewise.
(sve-b16mm): Likewise.
(mtetc): Likewise.
(f16f32mm): Likewise.
(f16mm): Likewise.

* doc/invoke.texi (poe2): Document option.
(tev): Likewise.
(tlbid): Likewise.
(gcie): Likewise.
(mpamv2): Likewise.
(lscp): Likewise.
(mops-go): Likewise.
(sve2p3): Likewise.
(sme2p3): Likewise.
(f16f32dot): Likewise.
(sve-b16mm): Likewise.
(mtetc): Likewise.
(f16f32mm): Likewise.
(f16mm): Likewise.

2 months agoAda: Fix compiler crash on nested reduce attribute
Eric Botcazou [Tue, 31 Mar 2026 07:50:11 +0000 (09:50 +0200)] 
Ada: Fix compiler crash on nested reduce attribute

This plugs a loophole in the resolution of reduction expressions, which
currently cannot be resolved when their immediate context is ambiguous,
for example in the case of a reduction expression nested in another one.

gcc/ada/
* sem_attr.adb (Analyze_Attribute) <Attribute_Reduce>: Rewrite the
analysis of a non-overloaded reducer.  Moreover, when both actuals
are overloaded, compute the set of possible interpretations.
(Resolve_Attribute) <Attribute_Reduce>: Streamline the processing.

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

2 months agoc++: Fix up eval_data_member_spec
Jakub Jelinek [Tue, 31 Mar 2026 08:16:14 +0000 (10:16 +0200)] 
c++: Fix up eval_data_member_spec

Ivan Lazaric reported privately a bug in eval_data_member_spec,
which I think can't be easily tested.

This is preceded by
          if (!cpp_translate_string (parse_in, &istr, &ostr,
                                     j == 2 ? CPP_STRING : CPP_UTF8STRING,
                                     true))
so for j == 2 it does reverse conversion from -fnarrow-character-set= to
SOURCE_CHARSET (typically UTF-8) and otherwise (j == 1) from
UTF-8 to SOURCE_CHARSET, but the messages of exceptions were reversed.

Now, unless SOURCE_CHARSET is UTF-EBCDIC on s390x-tpf (dunno if that works
at all, but in theory could) and there is some character only in UTF-8 and
not in UTF-EBCDIC, or there is some narrow character set supported by iconv
which has characters not represented in UTF-8 (am not aware of those),
then cpp_translate_string shouldn't fail, so the code in there is just
for a theoretical case.

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

* reflect.cc (eval_data_member_spec): Fix up check for diagnostics
when reverse conversion fails.

2 months agoLoongArch: fix build failure of loongarch32-*-elf* target
Wu Haotian [Sun, 29 Mar 2026 12:52:51 +0000 (20:52 +0800)] 
LoongArch: fix build failure of loongarch32-*-elf* target

Bare-metal LoongArch target triple loongarch*-*-elf* contains references
to "loongarch/linux.h" and "loongarch/t-linux", causing build failure for
GCC targeting loongarch32-*-elf*.

This commit removes the extra Linux references, and is tested by building
a cross compiler for the loongarch32-picolibc-elf target.

gcc/ChangeLog:

* config.gcc: removed linux.h and t-linux for loongarch*-*-elf* targets

Signed-off-by: Wu Haotian <rigoligo03@gmail.com>
2 months agotestsuite: x86: move alias-checks.C into vect
Alexandre Oliva [Tue, 31 Mar 2026 00:58:19 +0000 (21:58 -0300)] 
testsuite: x86: move alias-checks.C into vect

g++.dg/alias-checks.C requires vect_double outside vect.exp, where
-msse2 would have got enabled, but that effective_target is not
supposed to be used in such circumstances: it passes even when SSE2 is
disabled.  Without enabling SSE2, vectors of doubles aren't really
available, so we don't get the expected vectorizations and the test
fails.

Instead of adding machine-specific options to alias-checks.C, I'm
moving it under g++.dg/vect/ and renaming it so that it gets, and
doesn't override, the default vector options for each platform.

for  gcc/testsuite/ChangeLog

* g++.dg/alias-checks.C: Rename to...
* g++.dg/vect/vect-alias-checks.C: ... this.  Don't override
vector options.

2 months agotestsuite: x86: pr82142b.c needs -fomit-frame-pointer
Alexandre Oliva [Tue, 31 Mar 2026 00:58:14 +0000 (21:58 -0300)] 
testsuite: x86: pr82142b.c needs -fomit-frame-pointer

Without an explicit -fomit-frame-pointer, x86 builds that disable
frame pointer optimization by default don't get the expected function
body.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/pr82142b.c: Add -fomit-frame-pointer.

2 months agotestsuite: x86: pr115397.c, pr118497 need fpic support
Alexandre Oliva [Tue, 31 Mar 2026 00:58:10 +0000 (21:58 -0300)] 
testsuite: x86: pr115397.c, pr118497 need fpic support

Here are fixes for two x86-specific testcase that uses PIC
compile-time options without requiring fpic.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/pr115397.c: Require fpic.
* gcc.target/i386/pr118497.c: Likewise.

2 months agotestsuite: x86: part-vect-absnegbf.c requires runtime for -msse2
Alexandre Oliva [Tue, 31 Mar 2026 00:58:05 +0000 (21:58 -0300)] 
testsuite: x86: part-vect-absnegbf.c requires runtime for -msse2

Since this is an execution test, require sse2_runtime.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/part-vect-absnegbf.c: Require sse2_runtime.

2 months agotestsuite: x86: bump unroll insn limit for pr83403-*.c
Alexandre Oliva [Tue, 31 Mar 2026 00:58:01 +0000 (21:58 -0300)] 
testsuite: x86: bump unroll insn limit for pr83403-*.c

Like rv32 and other targets, pr83403-[12].c need to bump
max-completely-peeled-insns to get the loops unrolled on x86 without
sse2 so as to enable the expected store motions.

for  gcc/testsuite/ChangeLog

* gcc.dg/tree-ssa/pr83403-1.c: Bump
max-completely-peeled-insns on x86.
* gcc.dg/tree-ssa/pr83403-2.c: Likewise.

2 months agotestsuite: select -mfpmath=sse for pr32964.c on x86
Alexandre Oliva [Tue, 31 Mar 2026 00:57:56 +0000 (21:57 -0300)] 
testsuite: select -mfpmath=sse for pr32964.c on x86

When using the 387 FPU, we don't perform the expected optimization of
unions to floats.  Setting -fexcess-precision=standard. doesn't fix it
for x86, but selecting -mfpmath=sse and forcing sse enabled does.

for  gcc/testsuite/ChangeLog

* gcc.dg/tree-ssa/pr32964.c: Select the SSE FPU on x86.

2 months agotestsuite: x86: enable sse2 for pr117888-2.c
Alexandre Oliva [Tue, 31 Mar 2026 00:57:52 +0000 (21:57 -0300)] 
testsuite: x86: enable sse2 for pr117888-2.c

Without SSE2, the loop is found too big to unroll, and we don't match
the expected pattern.  So enable sse2.

for  gcc/testsuite/ChangeLog

* gcc.dg/pr117888-2.c: Enable sse2.

2 months agotestsuite: drop loop optimizations in fstack-protector-strong.c
Alexandre Oliva [Tue, 31 Mar 2026 00:57:48 +0000 (21:57 -0300)] 
testsuite: drop loop optimizations in fstack-protector-strong.c

gcc.dg/fstack-protector-strong.c used to expect one stack_chk_fail per
function.  When vectorizer improvements caused foo2 to get vectorized
to the point of enabling the loop and the automatic array-containing
data structure to be optimized away entirely, it no longer required
stack protection, and the expected pattern count was decreased.

However, on platforms that don't or can't vectorize the loop, it isn't
optimized away, and then we find the wrong pattern count.

Reverse the decrease and disable optimizations of the loop that could
cause it to be optimized out, so that we get the originally-expected
stack protection everywhere.

for  gcc/testsuite/ChangeLog

* gcc.dg/fstack-protector-strong.c (foo2): Prevent loop
optimizations.  Expect stack protection again.

2 months agotestsuite: x86: pr115863-1.c should include stdint.h
Alexandre Oliva [Tue, 31 Mar 2026 00:57:44 +0000 (21:57 -0300)] 
testsuite: x86: pr115863-1.c should include stdint.h

stdint-gcc.h isn't necessarily installed by GCC or available from C
libraries.  VxWorks ports don't generally have such a header
available.  Include stdint.h instead.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/pr115863-1.c: Include stdint.h.

2 months agotestsuite: x86: require fpic for lea-4.c and pr116587.c
Alexandre Oliva [Tue, 31 Mar 2026 00:57:38 +0000 (21:57 -0300)] 
testsuite: x86: require fpic for lea-4.c and pr116587.c

These two tests use -fPIE and -fPIC, respectively, without stating the
requirement for compile-time PIC support.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/lea-4.c: Require fpic.
* gcc.target/i386/pr116587.c: Likewise.

2 months agotestsuite: analyzer: drop stderr from deref-before-check-2.c
Alexandre Oliva [Tue, 31 Mar 2026 00:57:34 +0000 (21:57 -0300)] 
testsuite: analyzer: drop stderr from deref-before-check-2.c

On some VxWorks targets, stderr is #defined to a function call, and
this confuses the analyzer in test_1, so we skip the warning.  That
appears to reveal a bug in the analyzer, but it doesn't seem to be
what the test was meant to test, so I'm dropping this unintended
feature from this testcase and filing PR124672 with a testcase to
reproduce it elsewhere.

for  gcc/testsuite/ChangeLog

* c-c++-common/analyzer/deref-before-check-2.c (test_1):
Drop stderr.

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

2 months agoAdjust check for addressable misaligned stack argument
H.J. Lu [Fri, 27 Jun 2025 22:27:25 +0000 (06:27 +0800)] 
Adjust check for addressable misaligned stack argument

Adjust alignment check forcing a local copy if the argument on stack is
not aligned to its type and the current alignment, which is determined
by the backend, is less than MAX_SUPPORTED_STACK_ALIGNMENT when the
parameter has its address taken.

For x86, ignore argument passed on stack when updating stack alignment
since caller is responsible to align the outgoing stack for arguments
passed on stack.

gcc/

PR target/120839
PR middle-end/124671
* function.cc (assign_parm_adjust_stack_rtl): Get the parameter
as argument.  Adjust alignment check forcing a local copy.
(assign_parms): Adjust.
* config/i386/i386.cc (ix86_argument_passed_on_stack_p): New.
(ix86_update_stack_alignment): Ignore argument passed on stack.

gcc/testsuite/

PR target/120839
PR middle-end/124671
* gcc.dg/pr124671.c: New test.
* gcc.target/i386/pr120839-1a.c: Likewise.
* gcc.target/i386/pr120839-1b.c: Likewise.
* gcc.target/i386/pr120839-2.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: Richard Biener <rguenther@suse.de>
2 months agofortran: Fix several issues with INQUIRE and unconnected units.
Jerry DeLisle [Mon, 30 Mar 2026 17:40:43 +0000 (10:40 -0700)] 
fortran: Fix several issues with INQUIRE and unconnected units.

PR libfortran/124543

libgfortran/ChangeLog:

* io/inquire.c (inquire_via_unit): Fix return value for
NAMED. Add check for ACTION. Fix return values for
ENCODING, PENDING, READ, WRITE, READWRITE.
(inquire_via_filename): Add checks for ACTION, DELIM,
ASYNCHRONOUS, and PENDING. Fix return value for
ENCODING.
* io/unix.c (inquire_access): Change return value from no
to unknown.

gcc/testsuite/ChangeLog:

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

2 months agobpf: md: Enable zero_extend{hi,qi}di2 to generate wN regs ...
Vineet Gupta [Mon, 30 Mar 2026 20:15:04 +0000 (13:15 -0700)] 
bpf: md: Enable zero_extend{hi,qi}di2 to generate wN regs ...

... by adjusting the asm template reg string to 'W', similar to commit
gbd275e81812c for zero_extendsidi2. However unlike that change, this is
not a bug fix: zero_extendsidi2 relies on wN reg move to achieve the
32->64 semantics. A {8,16}->64 extension needs to be emulated anyways
by masking out extra bits so the reg used is not important.

However wN reg based codegen is still preferable in general:
 - It is easier on verifier as it has to track fewer bits and avoids
   corner case false positives.
 - Better native codegen as upper bits are guaranteed to be zero and can
   leverage target ISA mechanisms to achieve that mostly for free.
 - Better native codegen on 32-bit targets which need to use 2 regs for
   rN regs.

gcc/ChangeLog:

* config/bpf/bpf.md (zero_extendhidi2): Add alternates for
alu32 and use 'W' for reg operands.
(zero_extendqidi2): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/bpf/zero-ext.c: Add tests for {HI,QI}mode values.

Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
2 months agofortran: Fix uint back to int [PR124666]
Jerry DeLisle [Mon, 30 Mar 2026 16:19:18 +0000 (09:19 -0700)] 
fortran: Fix uint back to int [PR124666]

PR fortran/124666

gcc/fortran/ChangeLog:

* io.cc: Change uint value back to int.

2 months agotestsuite: bpf: Add initial BPF runtime tests
Piyush Raj [Tue, 24 Feb 2026 20:17:54 +0000 (01:47 +0530)] 
testsuite: bpf: Add initial BPF runtime tests

This patch adds runtime tests for BPF target.
These tests are based on existing compile-time tests and depends on
bpf.exp baseboard
To run the testsuite:

  make check-gcc RUNTESTFLAGS="--target_board=bpf-vmtest bpf-torture.exp KERNEL_VERSION=6.15 LOG_LEVEL=ERROR"

Options:
KERNEL_VERSION (default: 6.15)
LOG_LEVEL (default: ERROR)
Note: VMTEST_DIR must be set in the environment.

See the bpf-vmtest-tool README for details.

gcc/testsuite/ChangeLog:

* gcc.target/bpf/torture/bpf-torture.exp: New testsuite.
* gcc.target/bpf/torture/invalid-memory-access.c: New test.
* gcc.target/bpf/torture/memcpy.c: New test.
* gcc.target/bpf/torture/memmove.c: New test.
* gcc.target/bpf/torture/memset.c: New test.
* gcc.target/bpf/torture/naked.c: New test.
* gcc.target/bpf/torture/nop.c: New test.
* gcc.target/bpf/torture/trace_openat.c: New test.

2 months agolibstdc++: Change atomic_ref::address return type to cv void*.
Tomasz Kamiński [Mon, 23 Mar 2026 20:25:58 +0000 (21:25 +0100)] 
libstdc++: Change atomic_ref::address return type to cv void*.

This implements with P3936R1 Safer atomic_ref::address with
the bump to __cpp_lib_atomic_ref feture test macro.

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h (__atomic_ref_base::_Address_return_t):
Define.
(__atomic_ref_base::address): Change return type to _Address_return_t.
* include/bits/version.def (atomic_ref): Bump to 202603.
* include/bits/version.h: Regenerate.
* testsuite/29_atomics/atomic_ref/address.cc: Update check for
return type.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 months agotree-optimization/124692 - update stmt before folding
Richard Biener [Mon, 30 Mar 2026 12:30:45 +0000 (14:30 +0200)] 
tree-optimization/124692 - update stmt before folding

The following makes sure SSA operands are up-to-date before folding.
Esp. when replace_uses_by is invoked from SCEV cprop which now has
ranger enabled we can otherwise end up ICEing where purpoted SSA
names now are constants.  This follows what forwprop does.

PR tree-optimization/124692
* tree-cfg.cc (replace_uses_by): Call update_stmt after
substitution and before folding.

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

2 months agoaarch64: mingw: Disable _Float128 emulation
Saurabh Jha [Mon, 9 Mar 2026 19:54:48 +0000 (19:54 +0000)] 
aarch64: mingw: Disable _Float128 emulation

The Windows ABI doesn't support _Float128:
https://learn.microsoft.com/en-us/cpp/build/ieee-floating-point-representation.

While it can be emulated for this target, the current implementation
prevents fortran from being built with this emulation.

This patch disables _Float128 emulation for aarch64-w64-mingw32 target.
This enables fortran to be built with no additional changes.

gcc/ChangeLog:

* config/aarch64/aarch64.cc
(aarch64_scalar_mode_supported_p): Only return true on TFmode if
TARGET_LONG_DOUBLE_128 is set.

libgcc/ChangeLog:
* config.host: Disable soft floating point.

Co-Authored-By: Evgeny Karpov <evgeny.karpov@arm.com>
2 months agotree-optimization/88576 - make -fno-math-errno not affect malloc
Richard Biener [Fri, 20 Mar 2026 17:35:33 +0000 (18:35 +0100)] 
tree-optimization/88576 - make -fno-math-errno not affect malloc

The following makes -fno-math-errno not affect non-math builtins.

PR tree-optimization/88576
* tree-ssa-alias.cc (check_fnspec): Remove flag_errno_math check.
* ipa-modref.cc (modref_access_analysis::process_fnspec):
Likewise.

* gcc.dg/pr88576.c: New testcase.

2 months agotree-optimization/124677 - wrong recurrence permute placement
Richard Biener [Mon, 30 Mar 2026 08:41:15 +0000 (10:41 +0200)] 
tree-optimization/124677 - wrong recurrence permute placement

When vectorizing a recurrence we have to skip inserted vector
stmts for the latch definition when finding the insertion point
for the permute.

PR tree-optimization/124677
* tree-vect-loop.cc (vectorizable_recurr): Skip vector
stmts for the def.

* gcc.dg/vect/vect-pr124677.c: New testcase.

2 months agofortran: Fix free-form mixed OpenACC/OpenMP continuation state
Christopher Albert [Sun, 22 Mar 2026 06:15:44 +0000 (07:15 +0100)] 
fortran: Fix free-form mixed OpenACC/OpenMP continuation state

Clear the opposite directive flag only for fresh free-form OpenMP/OpenACC
sentinel lines so continued directives do not leak OpenACC/OpenMP state into
the next independent directive.

PR fortran/108382
gcc/fortran/ChangeLog:

* scanner.cc (skip_free_oacc_sentinel): Clear openmp_flag only for
fresh OpenACC directive lines.
(skip_free_omp_sentinel): Clear openacc_flag only for fresh OpenMP
directive lines.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/omp-108382.f90: New test.

Signed-off-by: Christopher Albert <albert@tugraz.at>
2 months agoc++, libstdc++: Implement P4156R0 - Rename meta::has_ellipsis_parameter to meta:...
Jakub Jelinek [Mon, 30 Mar 2026 10:02:47 +0000 (12:02 +0200)] 
c++, libstdc++: Implement P4156R0 - Rename meta::has_ellipsis_parameter to meta::is_vararg_function

Unhappy about the old and new names, as a function type is not a function,
but ces't la vie.

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

gcc/cp/
* metafns.gperf (enum metafn_code): Remove
METAFN_HAS_ELLIPSIS_PARAMETER, add METAFN_IS_VARARG_FUNCTION.
(has_ellipsis_parameter): Remove.
(is_vararg_function): Add.
* reflect.cc (eval_has_ellipsis_parameter): Rename to ...
(eval_is_vararg_function): ... this.  Adjust function comment.
(process_metafunction): Handle METAFN_IS_VARARG_FUNCTION
instead of METAFN_HAS_ELLIPSIS_PARAMETER.
* metafns.h: Regenerate.
gcc/testsuite/
* g++.dg/reflect/has_ellipsis_parameter1.C: Rename to ...
* g++.dg/reflect/is_vararg_function1.C: this.  New test.  Rename
has_ellipsis_parameter to is_vararg_function everywhere.
libstdc++-v3/
* include/std/meta (has_ellipsis_parameter): Rename to ...
(is_vararg_function): ... this.  New declaration.
* src/c++23/std.cc.in: Remove std::meta::has_ellipsis_parameter
export, add std::meta::is_vararg_function export.

2 months agoaarch64, Darwin: Add Apple M5 cores
Francois-Xavier Coudert [Fri, 27 Mar 2026 17:51:32 +0000 (18:51 +0100)] 
aarch64, Darwin: Add Apple M5 cores

The values for chip IDs and the LITTLE.big variants have been confirmed
in the XNU sources (xnu/osfmk/arm/cpuid.h).

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add Apple M5
cores.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi: Add apple-m5 core to the ones listed
for arch and tune selections.

2 months agoarm: allow at least one insn when loading a constant [PR102309]
Torbjörn SVENSSON [Fri, 27 Mar 2026 13:55:27 +0000 (14:55 +0100)] 
arm: allow at least one insn when loading a constant [PR102309]

gcc/ChangeLog:

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

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>