]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 months agomatch: Simplify `(T1)(a bit_op (T2)b)` to `((T1)a bit_op b)` When b is T1 type and...
Andrew Pinski [Sun, 11 Jan 2026 07:17:12 +0000 (23:17 -0800)] 
match: Simplify `(T1)(a bit_op (T2)b)` to `((T1)a bit_op b)` When b is T1 type and truncating from T2 [PR122845]

This adds the simpliciation of:
```
  <unnamed-signed:3> _1;

  _2 = (signed char) _1;
  _3 = _2 ^ -47;
  _4 = (<unnamed-signed:3>) _3;
```

to:
```
  <unnamed-signed:3> _n;
  _4 = _1 ^ -47;
```

This also fixes PR 122843 by optimizing out the xor such that we get:
```
  _1 = b.a;
  _21 = (<unnamed-signed:3>) t_23(D);
  // t_23 in the original testcase was 200 so this is reduced to 0
  _5 = _1 ^ _21;
  # .MEM_24 = VDEF <.MEM_13>
  b.a = _5;
```
And then there is no cast catch this pattern:
`(bit_xor (convert1? (bit_xor:c @0 @1)) (convert2? (bit_xor:c @0 @2)))`
As we get:
```
  _21 = (<unnamed-signed:3>) t_23(D);
  _5 = _1 ^ _21;
  _22 = (<unnamed-signed:3>) t_23(D);
  _7 = _5 ^ _22;
  _25 = (<unnamed-signed:3>) t_23(D);
  _8 = _7 ^ _25;
  _26 = (<unnamed-signed:3>) t_23(D);
  _9 = _7 ^ _26;
```
After unrolling and then fre will optimize away all of those xor.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122845
PR tree-optimization/122843
gcc/ChangeLog:

* match.pd (`(T1)(a bit_op (T2)b)`): Also
simplify if T1 is the same type as b and T2 is wider
type than T1.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/bitops-12.c: New test.
* gcc.dg/tree-ssa/bitops-13.c: New test.
* gcc.dg/store_merging_18.c: xfail store merging.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 months agoFortran: Add additional checks for constant expressions.
Steven G. Kargl [Mon, 12 Jan 2026 21:58:39 +0000 (13:58 -0800)] 
Fortran: Add additional checks for constant expressions.

PR fortran/91960

gcc/fortran/ChangeLog:

* resolve.cc (resolve_fl_parameter): Check the righthand symbol
is a constant expression.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr69962.f90: Adjust testcase to ignore new error message.
* gfortran.dg/pr91960_1.f90: New test.
* gfortran.dg/pr91960_2.f90: New test.

4 months agoc++: deferred noexcept parsing for friend tmpl spec [PR123189]
Patrick Palka [Mon, 12 Jan 2026 16:21:14 +0000 (11:21 -0500)] 
c++: deferred noexcept parsing for friend tmpl spec [PR123189]

Since we now defer noexcept parsing for templated friends, a couple of
routines related to deferred parsing need to be updated to cope with friend
template specializations -- their TI_TEMPLATE is a TREE_LIST rather than
a TEMPLATE_DECL, and they don't introduce new template parameters.

PR c++/123189

gcc/cp/ChangeLog:

* name-lookup.cc (binding_to_template_parms_of_scope_p):
Gracefully handle TEMPLATE_INFO whose TI_TEMPLATE is a TREE_LIST.
* pt.cc (maybe_begin_member_template_processing): For a friend
template specialization consider its class context instead.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agoc++: tweak testcase for --stds=impcx
Jason Merrill [Mon, 12 Jan 2026 09:36:23 +0000 (17:36 +0800)] 
c++: tweak testcase for --stds=impcx

Implicit constexpr makes the use of x disappear, avoiding the exposure and
thus the diagnostic.

gcc/testsuite/ChangeLog:

* g++.dg/modules/internal-17_b.C: Add -fno-implicit-constexpr.

4 months agoc++: more gnu_inline linkage adjustment
Jason Merrill [Fri, 9 Jan 2026 06:01:26 +0000 (14:01 +0800)] 
c++: more gnu_inline linkage adjustment

Since r16-6477 we allow a gnu_inline to be a key method, because it is only
emitted in one place.  It occurs to me that we should make the same
adjustment to other places that check DECL_DECLARED_INLINE_P to decide if a
function has inline/vague/comdat linkage.

PR libstdc++/123326

gcc/cp/ChangeLog:

* cp-tree.h (DECL_NONGNU_INLINE_P): New.
* decl.cc (duplicate_decls, start_decl): Check it.
* decl2.cc (vague_linkage_p, import_export_class): Likewise.
(vtables_uniquely_emitted, import_export_decl): Likewise.
* class.cc (determine_key_method): Check it instead of
lookup_attribute.

4 months agotree-optimization/123528 - tighten bool pattern check
Richard Biener [Mon, 12 Jan 2026 12:55:07 +0000 (13:55 +0100)] 
tree-optimization/123528 - tighten bool pattern check

The following makes sure we're only applying bool patterns for
conversions to scalar integer or float types.

PR tree-optimization/123528
* tree-vect-patterns.cc (vect_recog_bool_pattern): Restore
INTEGRAL_TYPE_P check but also allow SCALAR_FLOAT_TYPE_P.

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

4 months agolibiberty: Make `objalloc_free' `free'-like WRT null pointer
Maciej W. Rozycki [Mon, 12 Jan 2026 13:08:28 +0000 (13:08 +0000)] 
libiberty: Make `objalloc_free' `free'-like WRT null pointer

Inspired by a suggestion from Jan Beulich to make one of `objalloc_free'
callers `free'-like with respect to null pointer argument handling make
the function return with no action taken rather than crashing when such
a pointer is passed.  This is to make the API consistent with ISO C and
to relieve all the callers from having to check for a null pointer.

libiberty/
* objalloc.c (objalloc_free): Don't use the pointer passed if
null.

4 months agoaarch64: Fix copyright year.
Claudio Bantaloukas [Mon, 12 Jan 2026 13:02:12 +0000 (13:02 +0000)] 
aarch64: Fix copyright year.

Initial patch mistakenly added copyright year 2025.

gcc/testsuite/Changelog:

* gcc.target/aarch64/pch/aarch64-pch.exp: Fix copyright year.

4 months agoaarch64: Add tests checking use of arm_sve.h et al in a pch [PR123457]
Claudio Bantaloukas [Thu, 8 Jan 2026 13:40:07 +0000 (13:40 +0000)] 
aarch64: Add tests checking use of arm_sve.h et al in a pch [PR123457]

These tests check that including files using aarch64 specific pragmas in
headers that become precompiled headers works.

Built and tested for aarch64-linux-gnu on top of Andrew's patch.

gcc/testsuite/Changelog:
PR target/123457
* gcc.target/aarch64/pch/aarch64-pch.exp: Add new testsuite.
* gcc.target/aarch64/pch/pch_arm_acle.c: Add new test file.
* gcc.target/aarch64/pch/pch_arm_acle.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_acle_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_acle_include_post.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_multiple.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_multiple.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_multiple_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_multiple_include_post.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_include_post.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_sve_bridge.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_sve_bridge.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_sve_bridge_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_neon_sve_bridge_include_post.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_sme.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_sme.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_sme_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_sme_include_post.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_sve.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_sve.hs: Likewise.
* gcc.target/aarch64/pch/pch_arm_sve_include_post.c: Likewise.
* gcc.target/aarch64/pch/pch_arm_sve_include_post.hs: Likewise.

4 months agoipa-cp: Fix ipa-bit-cp test for recipient_only lattices
Martin Jambor [Mon, 12 Jan 2026 12:32:06 +0000 (13:32 +0100)] 
ipa-cp: Fix ipa-bit-cp test for recipient_only lattices

Unfortunately I made a silly copy-and paste error in may patch
introducing the recipient_only flag.  This patch fixes it, correctly
bailing out in ipa-bit-cp when it is set during propagation.

gcc/ChangeLog:

2026-01-12  Martin Jambor  <mjambor@suse.cz>

PR ipa/123543
* ipa-cp.cc (propagate_bits_across_jump_function): Fix test for
recipient_only_p.

gcc/testsuite/ChangeLog:

2026-01-12  Martin Jambor  <mjambor@suse.cz>

PR ipa/123543
* gcc.dg/ipa/pr123543.c: New test.

4 months agoaarch64: Update target checks for sme2 fp8
Claudio Bantaloukas [Mon, 12 Jan 2026 12:28:38 +0000 (12:28 +0000)] 
aarch64: Update target checks for sme2 fp8

Commits gcc-16-6381-g226d5fd59dc8 and gcc-16-6380-gef533d234293 had
insufficient target checks and this caused regressions on the linaro CI
which uses an older binutils version.

This change adds the needed checks.

gcc/testsuite/Changelog:
* gcc.target/aarch64/sme2/acle-asm/cvt_mf8_bf16_x2.c: Added target checks.
* gcc.target/aarch64/sme2/acle-asm/cvt_mf8_f16_x2.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/cvt_mf8_f32_x4.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/cvtn_mf8_f32_x4.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f16_x2.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f16_x4.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f32_x2.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f32_x4.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f64_x2.c: Likewise.
* gcc.target/aarch64/sme2/acle-asm/scale_f64_x4.c: Likewise.

4 months agoBump BASE-VER to 16.0.1 now that we are in stage4.
Jakub Jelinek [Mon, 12 Jan 2026 12:05:25 +0000 (13:05 +0100)] 
Bump BASE-VER to 16.0.1 now that we are in stage4.

* BASE-VER: Bump to 16.0.1.

4 months agos390: Fix ABI issue in libstdc++.so.6
Jakub Jelinek [Mon, 12 Jan 2026 11:40:31 +0000 (12:40 +0100)] 
s390: Fix ABI issue in libstdc++.so.6

On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> libstdc++-v3/ChangeLog:
>
>       * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
>       names {,P,K}DF16.

This is wrong - an ABI issue.

You can't export new symbols in CXXABI_1.3.14 symbol version when they
weren't exported there in GCC 13.1 already.
Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.

Fixed thusly.

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

* config/abi/pre/gnu.ver (CXXABI_1.3.14): Don't export _ZTI*DF16_ on
s390x.
(CXXABI_1.3.17): Export _ZTI*DF16_ on s390x.
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Remove
_ZTI{,P,K}DF16_.

4 months agotree-optimization/122830 - move VN through aggregate copies
Richard Biener [Mon, 12 Jan 2026 09:04:49 +0000 (10:04 +0100)] 
tree-optimization/122830 - move VN through aggregate copies

The following generalizes the few hacks we have to more loosely
allow VN through aggregate copies to a more general (but also
restrictive) feature to rewrite the lookup to a new base with
a constant offset.  This should now allow all constant-indexed
aggregate copies and it does never leave any stray components
and hoping for the best.

This resolves the diagnostic regression reported in PR122824.

PR tree-optimization/122830
PR tree-optimization/122824
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Generalize
aggregate copy handling when no variable offsets are
involved.

* gcc.dg/tree-ssa/ssa-fre-112.c: New testcase.
* g++.dg/warn/Warray-bounds-pr122824.C: Likewise.

4 months agoFix extra_off mis-computation during aggregate copy VN
Richard Biener [Mon, 12 Jan 2026 09:36:44 +0000 (10:36 +0100)] 
Fix extra_off mis-computation during aggregate copy VN

With the rewrite of aggregate copy handling in r16-2729-g0d276cd378e7a4
there's an error introduced which accumulates extra_off even if we
throw away some of the tentative component consumption.  The following
fixes this.

* tree-ssa-sccvn.cc (vn_reference_lookup_3): Only tentatively
accumulate extra_off when tentatively consuming components
during aggregate copy handling.

4 months agolibstdc++: Stop using some reserved names in src/c++20/atomic.cc
Jonathan Wakely [Sat, 10 Jan 2026 22:34:06 +0000 (22:34 +0000)] 
libstdc++: Stop using some reserved names in src/c++20/atomic.cc

libstdc++-v3/ChangeLog:

* src/c++20/atomic.cc (__detail::__spin_impl): Do not use
reserved names for variables.

4 months agolibstdc++: Improve comments on __wait_args::_M_setup_proxy_wait
Jonathan Wakely [Sat, 10 Jan 2026 13:44:49 +0000 (13:44 +0000)] 
libstdc++: Improve comments on __wait_args::_M_setup_proxy_wait

libstdc++-v3/ChangeLog:

* include/bits/atomic_wait.h (__wait_args): Improve comments.
* src/c++20/atomic.cc (__wait_args::_M_setup_proxy_wait):
Improve comment.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 months agolibstdc++: Fix generate_cannonical test for 128bit floating points.
Tomasz Kamiński [Mon, 12 Jan 2026 10:07:35 +0000 (11:07 +0100)] 
libstdc++: Fix generate_cannonical test for 128bit floating points.

This updates test01, so it properly handle 128bit floating points,
including situation when long double uses such representation.
Firstly, the computation of skips is corrected, by discarding number
values equal to number of calls required to generate element
(skips become zero for all non-float correctly). Furthermore, checks
of histogram for types using iec559 representation, is moved inside
test01 function, so we use correct value for long double, depending
on number of digits in mantissa on given platform.

We also extend test to cover __float128, to test 128bit floating
point on more platforms.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Updated test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 months agomiddle-end/123175 - fix parts of const VEC_PERM with relaxed input sizes
Richard Biener [Fri, 9 Jan 2026 08:35:21 +0000 (09:35 +0100)] 
middle-end/123175 - fix parts of const VEC_PERM with relaxed input sizes

The following fixes enough of const VEC_PERM folding and lowering
to deal with the fallout for the two testcases from the PR.  We
usually do not generate such problematic VEC_PERM expressions, but
we allow those since GCC 14.  As can be seen we mishandle those,
including failure to expand/lower them by zero-extending inputs (which is
what __builtin_shufflevector does).

I'm unsure as to what extent we get such permutes but Tamar indicates
that aarch64 can handle those at least.

PR middle-end/123175
* match.pd (vec_perm @0 @1 @2): Fixup for inputs having a
different number of elements than the result.
* tree-vect-generic.cc (lower_vec_perm): Likewise.

* gcc.dg/torture/pr123175-1.c: New testcase.
* gcc.dg/torture/pr123175-2.c: Likewise.

4 months agolibgomp: Skip libgomp.c++/target-cdtor-2.C on Solaris [PR81337]
Rainer Orth [Mon, 12 Jan 2026 09:36:19 +0000 (10:36 +0100)] 
libgomp: Skip libgomp.c++/target-cdtor-2.C on Solaris [PR81337]

The libgomp.c++/target-cdtor-2.C test FAILs on Solaris:

FAIL: libgomp.c++/target-cdtor-2.C output pattern test

Compared to the Linux output

~S, 5, 1
[...]
finiDH1, 1

the Solaris output has a different order:

finiDH1, 1
[...]
~S, 5, 1

This is another instance of the long-standing PR c++/81337.  As detailed
there, the relative order of ~S::S() and __attribute__((destructor()))
functions isn't guaranteed.  Since xfail'ing the dg-output parts isn't
practical, this patch skips the whole test on Solaris.

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

2025-12-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libgomp:
PR c++/81337
* testsuite/libgomp.c++/target-cdtor-2.C: Skip on Solaris.
Fix comments.

4 months agoc++: Improve diagnostic for implicit conversion errors [PR115163]
Nathaniel Shead [Sat, 10 Jan 2026 23:02:45 +0000 (10:02 +1100)] 
c++: Improve diagnostic for implicit conversion errors [PR115163]

This patch adds a note to indicate if any viable explicit conversion
functions were skipped if an implicit conversion failed to occur.

Perhaps the base diagnostic in ocp_convert can be further improved for
class types as well, as the current message is not very clear, but I've
not looked into that for this patch.

PR c++/115163

gcc/cp/ChangeLog:

* call.cc (implicit_conversion_error): Add flags argument, call
maybe_show_nonconverting_candidate.
(build_converted_constant_expr_internal): Pass flags to
implicit_conversion_error.
(perform_implicit_conversion_flags): Likewise.
* cvt.cc (ocp_convert): Call maybe_show_nonconverting_candidate
on conversion error.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_convertible7.C: Add new testcases.
* g++.dg/diagnostic/explicit2.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
4 months agosimplify-rtx: Fix up shift/rotate VOIDmode count handling [PR123523]
Jakub Jelinek [Mon, 12 Jan 2026 09:06:47 +0000 (10:06 +0100)] 
simplify-rtx: Fix up shift/rotate VOIDmode count handling [PR123523]

The following testcase ICEs on i686-linux, because the HW in that
case implements the shift as shifting by 64-bit count (anything larger
or equal to number of bits in the first operand's element results
in 0 or sign copies), so the machine description implements it as
such as well.
Now, because shifts/rotates can have different modes on the first
and second operand, when the second one has VOIDmode (i.e. CONST_INT,
I think CONST_WIDE_INT has non-VOIDmode and CONST_DOUBLE with VOIDmode
is hopefully very rarely used), we need to choose some mode for the
wide_int conversion.  And so far we've been choosing BITS_PER_WORD/word_mode
or the mode of the first operand's element, whichever is wider.
That works fine on 64-bit targets, CONST_INT has always at most 64 bits,
but for 32-bit targets uses SImode.

Because HOST_BITS_PER_WIDE_INT is always 64, the following patch just
uses that plus DImode instead of BITS_PER_WORD and word_mode.

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

PR rtl-optimization/123523
* simplify-rtx.cc (simplify_const_binary_operation): Use
DImode for VOIDmode shift and truncation counts if int_mode
is narrower than HOST_BITS_PER_WIDE_INT rather than
word_mode if int_mode it is narrower than BITS_PER_WORD.

* gcc.target/i386/pr123523.c: New test.

4 months agoc++: Remove gnu::gnu_inline attribute on inheriting ctors [PR123526]
Jakub Jelinek [Mon, 12 Jan 2026 09:05:50 +0000 (10:05 +0100)] 
c++: Remove gnu::gnu_inline attribute on inheriting ctors [PR123526]

The recent addition of gnu::gnu_inline attributes to some C++26 constexpr
methods broke classes which inherit e.g. from std::logic_error or other
C++26 classes with gnu::gnu_inline constructors and use inheriting
constructors.  On std::logic_error etc. it has the desired effect that
the ctor itself can be constexpr evaluated and even inlined, but is not
emitted in each TU that needs it and didn't inline it, but is still
contained in libstdc++.{a,so.6}.
Unfortunately inheriting ctors inherit also attributes of the corresponding
ctors except those that clone_attrs filter out and that includes the
gnu_inline attribute if explicitly specified on the base class ctor.
That has the undesirable effect that the implementation detail of e.g.
the std::logic_error class leaks into the behavior of a class that inherits
from it if it is using inheriting constructors, those will result in
undefined symbols for the inheriting constructors if they aren't inlined,
unless one also inherits from it in some TU without gnu_inline there (e.g.
one compiled with -std=c++23 or earlier).

So, the following patch fixes it by removing the gnu::gnu_inline attribute
from the inheriting constructor.  Not done in clone_attrs because that
function is also used for the normal constructor cloning and in that case
we do want to clone those attributes.

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

PR c++/123526
* method.cc: Include attribs.h.
(implicitly_declare_fn): Remove gnu::gnu_inline attribute.

* g++.dg/ext/gnu-inline-inh-ctor1.C: New test.
* g++.dg/ext/gnu-inline-inh-ctor2.C: New test.

4 months agotestsuite: Remove lp64 requirement from gcc.target/i386/pr123121.c [PR123121]
Uros Bizjak [Mon, 12 Jan 2026 08:43:29 +0000 (09:43 +0100)] 
testsuite: Remove lp64 requirement from gcc.target/i386/pr123121.c [PR123121]

The test gcc.target/i386/pr123121.c does not rely on LP64-specific
behavior.  Drop the dg-require-effective-target lp64 directive so the
test can run on 32-bit i386 targets as well.

PR rtl-optimization/123121

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr123121.c:

4 months agotestsuite: i386: Disable AVX512BW/DQ tests with Solaris/x86 as [PR123415]
Rainer Orth [Mon, 12 Jan 2026 08:15:16 +0000 (09:15 +0100)] 
testsuite: i386: Disable AVX512BW/DQ tests with Solaris/x86 as [PR123415]

Several AVX512BW and AVX512DQ tests FAIL on Solaris/x86 with the native
assembler.  As detailed in the PR, this is for two reasons:

* Due to a misunderstanding, %k0 isn't accepted as source or destination
  register of some insns.

* {sae} is considered implicit for some insns, so specifying it
  explicitly was deemed unnecessary.

It's unclear if and when this will be fixed, so avx512bw and avx512dq
tests are disabled for now.

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

2025-12-23  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR target/123415
* lib/target-supports.exp (check_effective_target_avx512dq):
Disable with Solaris/x86 as.
(check_effective_target_avx512bw): Likewise.

4 months ago[rs6000] [testsuite] Fix test-frame-related.c [PR123129]
Surya Kumari Jangala [Fri, 9 Jan 2026 07:07:53 +0000 (02:07 -0500)] 
[rs6000] [testsuite] Fix test-frame-related.c [PR123129]

The testcase test-frame-related.c fails in 32-bit mode due to
constraints not matching. Use -mpowerpc64 option to ensure that the
testcase works with -m32.

gcc/testsuite:
PR testsuite/123129
* gcc.dg/rtl/powerpc/test-frame-related.c: Add -mpowerpc64.

4 months agoAutoFDO: Fix missing null-pointer check in offline_unrealized_inlines
Dhruv Chawla [Tue, 6 Jan 2026 04:44:25 +0000 (20:44 -0800)] 
AutoFDO: Fix missing null-pointer check in offline_unrealized_inlines

This was a trivial check that was missing and was causing ICEs due to
segmentation faults in some tests.

Bootstrapped and regtested on aarch64-linux-gnu.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* auto-profile.cc (autofdo_source_profile::offline_unrealized_inlines):
Add missing check for in_map.

4 months agotestsuite: Disable vector-compare-1.C for arm targets [PR121752]
Andrew Pinski [Mon, 12 Jan 2026 03:57:20 +0000 (19:57 -0800)] 
testsuite: Disable vector-compare-1.C for arm targets [PR121752]

So arm is a bit special, non_strict_align is sometimes true but
it does not represent the true value of STRICT_ALIGN inside the compiler,
so this testcase fails. This disables the testcase for arm targets where
STRICT_ALIGN is always true even when there is unaligned loads.

Pushed as obvious after testing on x86_64 and arm-eabi (with -march=armv7) to make
sure the testcase no longer run on arm.

PR testsuite/121752
gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/vector-compare-1.C: Disable for arm targets.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
4 months agoFortran: Test cases from previously fixed bug
Steven G. Kargl [Mon, 12 Jan 2026 02:58:19 +0000 (18:58 -0800)] 
Fortran: Test cases from previously fixed bug

Adding two testcases from Gerhard Steinmetz from 2016-08-30.
These have had the dejagnu directives added.  The last comment
in the PR is from Andrew Pinski notes the PR was fixed in the 9.3,
10+ timeframe.  The testcases are small.  Committing the tests to
ensure things are not broken in the future.

PR fortran/77415

gcc/testsuite/ChangeLog:

* gfortran.dg/pr77415_1.f90: New test.
* gfortran.dg/pr77415_2.f90: New test.

4 months agolibga68: Make it possible to debug the GC
Pietro Monteiro [Sun, 11 Jan 2026 22:25:12 +0000 (17:25 -0500)] 
libga68: Make it possible to debug the GC

If GC_DEBUG is defined then all-upper-case macros will expand to calls
to the debug variant of collector functions.

So add the configury bit to define GC_DEBUG if the user wants and
switch all `GC_` calls to the corresponding macros.

libga68/ChangeLog:

* configure: Regenerate.
* configure.ac: Add --enable-algol68-gc-debug option and
define GC_DEBUG accordingly.
* ga68-alloc.c (_libga68_realloc): Use the C macro version of
the GC function.
(_libga68_realloc_unchecked): Likewise.
(_libga68_malloc): Likewise.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
4 months agoDaily bump.
GCC Administrator [Mon, 12 Jan 2026 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

5 months agolto: Fix SegFault in ICF caused by missing body
Michal Jires [Fri, 19 Dec 2025 16:09:16 +0000 (17:09 +0100)] 
lto: Fix SegFault in ICF caused by missing body

During LTO symbol merging, weak symbols may be resolved to external
definition.
We reset the symbol, so the body might be released in unreachability
pass. But we didn't mark the symbol with body_removed, so ICF assumed
the body was still there causing SegFault.

gcc/lto/ChangeLog:

* lto-symtab.cc (lto_symtab_merge_symbols): Set body_removed
for symbols resolved outside of IR.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/attr-weakref-2_0.c: New test.
* gcc.dg/lto/attr-weakref-2_1.c: New test.

5 months agolto: Add toplevel simple assembly heuristics
Michal Jires [Sun, 16 Nov 2025 19:16:15 +0000 (20:16 +0100)] 
lto: Add toplevel simple assembly heuristics

This new pass heuristically detects symbols referenced by toplevel
assembly to prevent their optimization.

Heuristics is done by comparing identifiers in assembly to known
symbols.

The pass is split into 2 passes, in LGEN and in WPA.
There must be one pass for WPA to be able to reference any symbol.
However in WPA there may be multiple symbols with the same name,
so we handle those local symbols in LGEN.

gcc/ChangeLog:

* asm-toplevel.cc (mark_fragile_ref_by_asm):
Add marked_local to handle symbol as local.
(ipa_asm_heuristics): New.
(class pass_ipa_asm): New.
(make_pass_ipa_asm_lgen): New.
(make_pass_ipa_asm_wpa): New.
* common.opt: New flto-toplevel-asm-heuristics.
* passes.def: New asm passes.
* timevar.def (TV_IPA_LTO_ASM): New.
* tree-pass.h (make_pass_ipa_asm_lgen): New.
(make_pass_ipa_asm_wpa): New.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/toplevel-simple-asm-1_0.c: New test.
* gcc.dg/lto/toplevel-simple-asm-1_1.c: New test.
* gcc.dg/lto/toplevel-simple-asm-2_0.c: New test.
* gcc.dg/lto/toplevel-simple-asm-2_1.c: New test.

5 months agolto: Allow other partitionings for toplevel assembly
Michal Jires [Wed, 3 Dec 2025 01:16:54 +0000 (02:16 +0100)] 
lto: Allow other partitionings for toplevel assembly

For balanced and max partitioning this adds proper partitioning of asm
and related symbols.

The special symbols are partitioned with 1to1 and joined together if
there is no name conflict. All other symbols are partitioned with the
requested partitioning.
In typical usage with small number of toplevel assembly and no name
conflicts, all special symbols will be in the single first partition.
balanced partitioning will continue filling last asm partition.

gcc/lto/ChangeLog:

* lto-partition.cc (join_partitions): Declare.
(lto_1_to_1_map): Split out to..
(map_1_to_1): ..here.
(create_asm_partition): Replaced by..
(create_asm_partitions): ..this.
(lto_max_map): Use new create_asm_partitions.
(lto_balanced_map): Use new create_asm_partitions.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/toplevel-extended-asm-2_0.c: More partitionings.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: Likewise.

5 months agolto: Handle .local symbols in toplevel extended assembly
Michal Jires [Sun, 16 Nov 2025 14:45:21 +0000 (15:45 +0100)] 
lto: Handle .local symbols in toplevel extended assembly

.local symbols cannot become global, so we have to use must_remain_in_tu.

There is no way to mark declaration as both external and static/.local
in C. So we have to disable the implicit definition of static variables.
Also .local asm function still produces "used but never defined" warning.

gcc/ChangeLog:

* asm-toplevel.cc (mark_fragile_ref_by_asm): New.
(struct constraint_data): New.
(walk_through_constraints): Handle .local definitions.
(analyze_toplevel_extended_asm): Propagate constraint_data.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/toplevel-extended-asm-2_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: New test.
* gcc.dg/lto/toplevel-extended-asm-3_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-3_1.c: New test.

5 months agolto: Add must_remain_in_tu flags to symtab_node
Michal Jires [Thu, 18 Dec 2025 13:58:15 +0000 (14:58 +0100)] 
lto: Add must_remain_in_tu flags to symtab_node

With toplevel assembly we are sometimes not allowed to globalize static
symbols. So such symbols cannot be in more than one partition.

must_remain_in_tu_* guarantee that such symbols or references to them do
not escape the original translation unit. Thus 1to1 partitioning is always
valid.

gcc/ChangeLog:

* cgraph.h: Add must_remain_in_tu_*.
* cgraphclones.cc (cgraph_node::create_clone): Propagate
must_remain_in_tu_body.
* cif-code.def (MUST_REMAIN_IN_TU): New.
* ipa-icf.cc (sem_function::equals_wpa): Check
must_remain_in_tu_*
(sem_variable::equals_wpa): Likewise.
* ipa-inline-transform.cc (inline_call): Propagate
must_remain_in_tu_body.
* ipa-inline.cc (can_inline_edge_p): Check
must_remain_in_tu_body.
* lto-cgraph.cc (lto_output_node): Output must_remain_in_tu_*
(lto_output_varpool_node): Likewise.
(input_overwrite_node): Input must_remain_in_tu_*.
(input_varpool_node): Likewise.
* tree.cc (decl_address_ip_invariant_p): Check
must_remain_in_tu_name.
* varpool.cc (varpool_node::ctor_useable_for_folding_p): Check
must_remain_in_tu_body.

gcc/lto/ChangeLog:

* lto-symtab.cc (lto_cgraph_replace_node): Propagate
must_remain_in_tu_*.
(lto_varpool_replace_node): Likewise.

5 months agolto: Compute partition boundary with asm_nodes
Michal Jires [Sun, 16 Nov 2025 03:17:07 +0000 (04:17 +0100)] 
lto: Compute partition boundary with asm_nodes

Previous patch added asm_node streaming, so we need to add referenced
symbols to partition.

asm_nodes must be added to partition before computing the boundary.

gcc/ChangeLog:

* lto-cgraph.cc (compute_ltrans_boundary): Add symbols
referenced from asm_nodes.
* lto-streamer-out.cc (lto_output): Move adding asm_nodes
to...
* passes.cc (ipa_write_summaries): ...here.

gcc/testsuite/ChangeLog:

* gcc.dg/lto/toplevel-extended-asm-1_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-1_1.c: New test.

5 months agolto: Stream toplevel extended assembly
Michal Jires [Thu, 8 Jan 2026 00:40:07 +0000 (01:40 +0100)] 
lto: Stream toplevel extended assembly

Streaming of toplevel extended assembly was missing implementation.

Streaming must be after merging of decls, otherwise we would have to
fix the pointers to new decls.

gcc/ChangeLog:

* ipa-free-lang-data.cc (find_decls_types_in_asm): New.
(free_lang_data_in_cgraph): Use find_decls_types_in_asm.
* lto-cgraph.cc (input_cgraph_1): Move asm to..
(input_toplevel_asms): ..here.
* lto-streamer-in.cc (lto_input_toplevel_asms):
Allow extended asm.
* lto-streamer-out.cc (lto_output_toplevel_asms):
Allow extended asm.
(lto_output_toplevel_asms): Allow ASM_EXPR.
* lto-streamer.h (input_toplevel_asms): New.

gcc/lto/ChangeLog:

* lto-common.cc (read_cgraph_and_symbols): Call
input_toplevel_asms after decl merging.

gcc/testsuite/ChangeLog:

* g++.dg/lto/toplevel_asm-0_0.C: New test.

5 months agoipa: Analyze toplevel extended assembly
Michal Jires [Sat, 15 Nov 2025 18:54:11 +0000 (19:54 +0100)] 
ipa: Analyze toplevel extended assembly

Analyzes references from toplevel extended assembly.

We cannot perform IPA optimizations with toplevel assembly, so
symtab_node only needs ref_by_asm to know that it should not be removed.

PR ipa/122458

gcc/ChangeLog:

* Makefile.in: Add new file.
* cgraph.h (analyze_toplevel_extended_asm): New.
* cgraphunit.cc (symbol_table::finalize_compilation_unit):
Call analyze_toplevel_extended_asm.
* asm-toplevel.cc: New file.

gcc/lto/ChangeLog:

* lto-common.cc (read_cgraph_and_symbols):
Call analyze_toplevel_extended_asm.

gcc/testsuite/ChangeLog:

* gcc.dg/ipa/pr122458.c: New test.

5 months agoipa: Add flag ref_by_asm to symtab_node
Michal Jires [Sat, 15 Nov 2025 23:54:00 +0000 (00:54 +0100)] 
ipa: Add flag ref_by_asm to symtab_node

ref_by_asm will be used by toplevel assembly to mark symbols that cannot
be removed.
It largely overlaps with force_output. Main difference is that ref_by_asm
is meaningful on declarations by not removing them. force_output with
declaration is ignored, which cannot be easily changed, since several
places depend on this behavior.

Global ref_by_asm should not be localized, because they cannot benefit
from it. It would only result in complications, for example by renaming
the symbol.

Notes on different solutions in unreachability analysis:
First unreachability analysis is done in analyze_functions. Marking
ref_by_asm declarations as needed from the start would require reprocessing,
because some declarations may gain definition during the analysis.
Since at this point declarations do not need adding any other symbol,
we can check for ref_by_asm at the end, next to referred_to_p check.

Second unreachability analysis is in remove_unreachable_nodes. Here
declarations (or symbols in_other_partition) may require an alias.
So there we need to add the declarations from the start.

gcc/ChangeLog:

* cgraph.cc (cgraph_node_cannot_be_local_p_1): Check ref_by_asm.
(cgraph_node::verify_node): Likewise.
* cgraph.h (cgraph_node::only_called_directly_or_aliased_p):
Likewise.
(cgraph_node::can_remove_if_no_direct_calls_and_refs_p):
Likewise.
(varpool_node::can_remove_if_no_refs_p): Likewise.
(varpool_node::all_refs_explicit_p): Likewise.
* cgraphunit.cc (symtab_node::needed_p): Likewise.
(analyze_functions): Likewise.
* gimple-ssa-pta-constraints.cc (refered_from_nonlocal_fn):
Likewise.
(refered_from_nonlocal_var): Likewise.
(ipa_create_global_variable_infos): Likewise.
* ipa-comdats.cc (ipa_comdats): Likewise.
* ipa-visibility.cc (cgraph_externally_visible_p): Likewise.
(varpool_node::externally_visible_p): Likewise.
* ipa.cc (symbol_table::remove_unreachable_nodes): Likewise.
* lto-cgraph.cc (lto_output_node): Output ref_by_asm.
(lto_output_varpool_node): Likewise.
(input_overwrite_node): Input ref_by_asm.
(input_varpool_node): Likewise.
* symtab.cc (address_matters_1): Check ref_by_asm.

gcc/lto/ChangeLog:

* lto-symtab.cc (lto_cgraph_replace_node): Propagate ref_by_asm.
(lto_varpool_replace_node): Propagate ref_by_asm.

5 months agoCRIS: Handle POST_INC in cris_rtx_costs
Hans-Peter Nilsson [Tue, 30 Apr 2024 14:22:20 +0000 (16:22 +0200)] 
CRIS: Handle POST_INC in cris_rtx_costs

POST_INC is a code that's only supposed to be valid in an address, so
it should only be calculated through the TARGET_ADDRESS_COST hook, not
by the TARGET_RTX_COSTS hook.  But, because rtx_cost does not
special-case MEM costs by calling TARGET_ADDRESS_COST, we get here as
part of e.g. the auto-inc-dec and combine passes, so deal with it for
the time being.  Without this, the cost is the value of size_factor *
COSTS_N_INSNS (1), i.e. 4 per word.  There's no obvious observable
effect for generated code (coremark, libgcc and newlib-libc checked
for -march=v10), but it may make a difference in the future, so be
safe and correct the cost.

Tested at r16-6493-ge77ba7ef8c75 for cris-elf.  That the cost actually
is changed is observable mostly simply by applying -dp when compiling
 int incref(int n, char *p)
 {
   int sum = 0;

   while (n--)
     sum += *p++;

   return sum;
 }
and seeing that the cost for the single autoincrement is changed from e.g.
adds.b [$r11+],$r10 ;# 15 [c=12 l=2]  *addsqisi_swap/1
to
adds.b [$r11+],$r10 ;# 15 [c=8 l=2]  *addsqisi_swap/1

gcc:
* config/cris/cris.cc (cris_rtx_costs) <POST_INC>: Handle POST_INC
as ZERO_EXTEND and SIGN_EXTEND, i.e. as an operator without cost.

5 months agoremove inclusion of tickLib.h from gthr-vxworks.h
Jerome Guitton [Fri, 5 Dec 2025 23:04:40 +0000 (20:04 -0300)] 
remove inclusion of tickLib.h from gthr-vxworks.h

This header is not used any more and its inclusion is problematic
when building against Helix Cert as it might end up dragging LLVM-specific
headers from spinLockLib.h.

libgcc/
* config/gthr-vxworks.h: Remove #include of tickLib.h.

5 months agoFortran: [PR123012] Silent acceptance of unquoted character items
Jerry DeLisle [Thu, 8 Jan 2026 05:48:49 +0000 (21:48 -0800)] 
Fortran: [PR123012] Silent acceptance of unquoted character items

PR libfortran/123012

libgfortran/ChangeLog:

* io/list_read.c (read_character): Add new check when no
quate is provided and the character string is digits only.

gcc/testsuite/ChangeLog:

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

5 months agoDaily bump.
GCC Administrator [Sun, 11 Jan 2026 00:16:24 +0000 (00:16 +0000)] 
Daily bump.

5 months agoFix regression on mcore-elf port after recent switch conversion change
Jeff Law [Sat, 10 Jan 2026 18:23:41 +0000 (11:23 -0700)] 
Fix regression on mcore-elf port after recent switch conversion change

Filip's recent change to re-enable switch conversion at -Og triggered a
regression on the mcore-elf target.

If we look at tree-switch-conversion.cc we have this:

  if (flag_pic)
    return false;

The mcore-elf port defines a dummy ASM_OUTPUT_ADDR_DIFF_ELT which is designed
to trigger an assembler syntax error and thus fail loudly.  That definition
comes from a time when it appears we had to define that macro in every port,
even if it wasn't being used.

These days we do not need to define that macro unless it's really needed.  And
a definition like the one for mcore-elf will cause problems
(compile/pr69102.c).  That definition has also been the cause of a long
standing failure in the port (gcc.dg/pr47446-2.c).

Naturally this has been through a round of testing where it fixes the two
issues noted above without any regressions.

gcc/
* config/mcore/mcore.h (ASM_OUT_ADDR_DIFF_ELT): Remove.

5 months agos390: Add HF mode support
Stefan Schulze Frielinghaus [Thu, 18 Dec 2025 08:42:18 +0000 (09:42 +0100)] 
s390: Add HF mode support

This patch adds support for _Float16.  As time of writing this, there is
no hardware _Float16 support on s390.  Therefore, _Float16 operations
have to be extended and truncated which is supported via soft-fp.

The ABI demands that _Float16 values are left aligned in FP registers
similar as it is already the case for 32-bit FP values.  If vector
extensions are available, copying between left-aligned FPRs and
right-aligned GPRs is natively supported.  Without vector extensions,
the alignment has to be taken care of manually.  For target z10,
instructions lgdr/ldgr can be used in conjunction with shifts.  Copying
via lgdr from an FPR into a GPR is the easy case since for the shift the
target GPR can be utilized.  However, copying via ldgr from a GPR into a
FPR requires a secondary reload register which is used for the shift
result and is then copied into the FPR.  Prior z10, there is no hardware
support in order to copy directly between FPRs and GPRs.  Therefore, in
order to copy from a GPR into an FPR we would require a secondary reload
register for the shift and secondary memory for copying the aligned
value.  Since this is not supported, _Float16 support starts with z10.
As a consequence, for all targets older than z10 test
libstdc++-abi/abi_check fails.

gcc/ChangeLog:

* config/s390/s390-modes.def (FLOAT_MODE): Add HF mode.
(VECTOR_MODE): Add V{1,2,4,8,16}HF modes.
* config/s390/s390.cc (s390_scalar_mode_supported_p): For 64-bit
targets z10 and newer support HF mode.
(s390_vector_mode_supported_p): Add HF mode.
(s390_register_move_cost): Keep HF mode operands in registers.
(s390_legitimate_constant_p): Support zero constant.
(s390_secondary_reload): For GPR to FPR moves a secondary reload
register is required.
(s390_secondary_memory_needed): GPR<->FPR moves don't require
secondary memory.
(s390_libgcc_floating_mode_supported_p): For 64-bit targets z10
and newer support HF mode.
(s390_hard_regno_mode_ok): Allow HF mode for FPRs and VRs.
(s390_function_arg_float): Consider HF mode, too.
(s390_excess_precision): For EXCESS_PRECISION_TYPE_FLOAT16
return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16.
(TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define.
* config/s390/s390.md (movhf): Define.
(reload_half_gprtofpr_z10): Define.
(signbithf2): Define.
* config/s390/vector.md: Add new vector modes to various
iterators.

libgcc/ChangeLog:

* config.host: Include s390/t-float16.
* config/s390/libgcc-glibc.ver: Export symbols
__trunc{sf,df,tf}hf2, __extendhf{sf,df,tf}2, __fix{,uns}hfti,
__float{,un}tihf, __floatbitinthf.
* config/s390/t-softfp: Add to softfp_extras instead of setting
it.
* configure: Regenerate.
* configure.ac: Support float16 only for 64-bit targets z10 and
newer.
* config/s390/_dpd_dd_to_hf.c: New file.
* config/s390/_dpd_hf_to_dd.c: New file.
* config/s390/_dpd_hf_to_sd.c: New file.
* config/s390/_dpd_hf_to_td.c: New file.
* config/s390/_dpd_sd_to_hf.c: New file.
* config/s390/_dpd_td_to_hf.c: New file.
* config/s390/t-float16: New file.

libstdc++-v3/ChangeLog:

* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
names {,P,K}DF16.

gcc/testsuite/ChangeLog:

* g++.target/s390/float16-1.C: New test.
* g++.target/s390/float16-2.C: New test.
* gcc.target/s390/float16-1-2.h: New test.
* gcc.target/s390/float16-1.c: New test.
* gcc.target/s390/float16-10.c: New test.
* gcc.target/s390/float16-2.c: New test.
* gcc.target/s390/float16-3.c: New test.
* gcc.target/s390/float16-4.c: New test.
* gcc.target/s390/float16-5.c: New test.
* gcc.target/s390/float16-6.c: New test.
* gcc.target/s390/float16-7.c: New test.
* gcc.target/s390/float16-8.c: New test.
* gcc.target/s390/float16-9.c: New test.
* gcc.target/s390/float16-signbit.h: New test.
* gcc.target/s390/vector/vec-extract-4.c: New test.
* gcc.target/s390/vector/vec-float16-1.c: New test.

5 months agoAda, Darwin: Fix bootstrap after recent warning improvements.
Iain Sandoe [Sat, 10 Jan 2026 13:08:17 +0000 (13:08 +0000)] 
Ada, Darwin: Fix bootstrap after recent warning improvements.

Similar to the changes in r16-6620, the improved gnatwu warning finds a 'use'
clause that is not needed in s-osinte__darwin.abd leading to a bootstrap
fail building the libraries.

Fixed by removing the extraneous 'use' clause.

gcc/ada/ChangeLog:

* libgnarl/s-osinte__darwin.adb: Delete unneeded use clause.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
5 months agolibstdc++: Fix std::system_category().message(int) on mingw32 target
Wang Jinghao [Sat, 10 Jan 2026 10:43:14 +0000 (18:43 +0800)] 
libstdc++: Fix std::system_category().message(int) on mingw32 target

On the mingw32 target, std::system_category().message(int) uses
FormatMessage api to format error messages. When the error message
contains insert sequences, it is unsafe not to use the
FORMAT_MESSAGE_OGNORE_INSERTS flag, as seen at:
https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353

The output of FormatMessage ends with "\r\n" and includes a Full stop
character used by the current thread's UI language. Now, we will remove
"\r\n" and any trailing '.' from the output in any language environment.

In the testsuite for std::system_category().message(int), we first
switch the thread UI language to en-US to meet expectations in any
language environment.

libstdc++-v3/ChangeLog:

* src/c++11/system_error.cc (system_error_category) [_WIN32]:
Use FormatMessageA function instead of FormatMessage macro.
* testsuite/19_diagnostics/error_category/system_category.cc:
Fix typo in __MINGW32__ macro name.  Adjust behavior on the
mingw32 target.

5 months agocfgcleanup: Protect latches always [PR123417]
Andrew Pinski [Fri, 9 Jan 2026 10:02:01 +0000 (02:02 -0800)] 
cfgcleanup: Protect latches always [PR123417]

So it turns out LOOPS_MAY_HAVE_MULTIPLE_LATCHES is set in places
along compiling. Setting it only means there might be multiple
latches currently. It does not mean let's go in an delete them
all; which is what remove_forwarder_block does currently. This
was happening before my set of patches too but since it was
only happening in merge_phi pass, latches were not cleared away
al of the time and then recreated.

This solves the problem by protecting latches all of the time
instead of depedent on LOOPS_MAY_HAVE_MULTIPLE_LATCHES not being set.

vect-uncounted_7.c needs to be xfailed here because we no longer
vectorize the code. Note the IR between GCC 15 and after this patch
is the same so I think this was just a case were the testcase
was added after the remove forwarder changes and should not have
vectorized (or vectorize differently).

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/123417
gcc/ChangeLog:

* tree-cfgcleanup.cc (maybe_remove_forwarder_block): Always
protect latches.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-uncounted_7.c: xfail vect test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 months agotoplevel: Unbreak Ada build [PR123490]
Jakub Jelinek [Sat, 10 Jan 2026 10:36:25 +0000 (11:36 +0100)] 
toplevel: Unbreak Ada build [PR123490]

As written earlier, the config-ml.in change from the
--with-multi-buildlist patch broke build of Ada, Ada uses
RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
and expects that the primary multilib will result in rts
rather than rts_. it results in after the --with-multi-buildlist
changes.

The following patch fixes it by restoring previous behavior for
ml_subdir / MULTISUBDIR such that for primary multilib it is
still empty rather than /.

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

PR ada/123490
* config-ml.in: Restore ml_subdir being empty instead of /.
for the primary multilib.

5 months agoranger: Verify gimple_call_num_args for several builtins [PR123431]
Jakub Jelinek [Sat, 10 Jan 2026 10:35:30 +0000 (11:35 +0100)] 
ranger: Verify gimple_call_num_args for several builtins [PR123431]

While gimple_call_combined_fn already do call
gimple_builtin_call_types_compatible_p and for most of builtins ensures
the right types of arguments, for type generic builtins it does not,
from POV of that function those functions are rettype (...).
Now, while the FE does some number of argument checking for the type
generic builtins, as the testcase below shows, it can be gamed.

So, this patch checks the number of arguments for type generic builtins
and does nothing if they have unexpected number of arguments.
Also for the returns arg verifies it can access the first argument.

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

PR tree-optimization/123431
* gimple-range-op.cc (gimple_range_op_handler::maybe_builtin_call):
Punt if type-generic builtins with a single argument don't have
exactly one argument.  For returns_arg punt if call doesn't have
at least one argument.

* gcc.dg/pr123431.c: New test.

5 months agoc: Fix ignored qualifier issue for enumerations [PR123435,PR123463]
Martin Uecker [Fri, 9 Jan 2026 13:38:31 +0000 (14:38 +0100)] 
c: Fix ignored qualifier issue for enumerations [PR123435,PR123463]

We accept a mismatch in qualifiers for enumerations and integers
because we switch to the underlying type before checking that qualifiers
match.

PR c/123435
PR c/123463

gcc/c/ChangeLog:
* c-typeck.cc (comptypes_internal): Test for qualifiers first.

gcc/testsuite/ChangeLog:
* gcc.dg/pr123435-1.c: New test.
* gcc.dg/pr123435-2.c: New test.
* gcc.dg/pr123463.c: New test.

5 months agolibstdc++: constexpr flat_map and flat_multimap
Yuao Ma [Fri, 12 Dec 2025 11:26:01 +0000 (19:26 +0800)] 
libstdc++: constexpr flat_map and flat_multimap

This patch makes flat_map and flat_multimap constexpr as part of P3372R3.

libstdc++-v3/ChangeLog:

* include/bits/version.def: Add FTM.
* include/bits/version.h: Regenerate.
* include/std/flat_map: Add constexpr.
* testsuite/23_containers/flat_map/1.cc: Add constexpr test.
* testsuite/23_containers/flat_multimap/1.cc: Add constexpr test.

5 months agoa68: Add exit function to POSIX prelude
Pietro Monteiro [Sat, 10 Jan 2026 01:52:13 +0000 (20:52 -0500)] 
a68: Add exit function to POSIX prelude

Add the procedure `posixexit'.

gcc/algol68/ChangeLog:

* a68-low-posix.cc (a68_posix_setexitstatus): Delete function.
(a68_posix_exit): New function.
* a68-low-prelude.cc (a68_lower_setexitstatus): Delete function.
(a68_lower_posixexit): New function.
* a68-low-runtime.def (SET_EXIT_STATUS): Delete definition.
(POSIX_EXIT): Add definition for posixexit.
* a68-parser-prelude.cc (posix_prelude): Remove setexitstatus
identifier from and add posixexit identifier to standenv.
* a68.h (a68_posix_setexitstatus): Delete prototype.
(a68_lower_setexitstatus): Likewise.
(a68_posix_exit): New prototype.
(a68_lower_posixexit): Likewise.
* ga68.texi:

libga68/ChangeLog:

* ga68-posix.c (_libga68_posixexit): New function.
* ga68.h (_libga68_posixexit): New prototype.
(_libga68_set_exit_status): Delete prototype.
* ga68.map: Remove _libga68_set_exit_status from and add
_libga68_posixexit to the global map.
* libga68.c: include <stdlib.h>.
(_libga68_set_exit_status): Delete function.
(main): Return EXIT_SUCCESS.

gcc/testsuite/ChangeLog:

* algol68/execute/posix-exit-1.a68: New test.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
5 months agoDaily bump.
GCC Administrator [Sat, 10 Jan 2026 00:16:49 +0000 (00:16 +0000)] 
Daily bump.

5 months agoa68: Escape @ in ga68.texi
Jose E. Marchesi [Fri, 9 Jan 2026 21:46:48 +0000 (22:46 +0100)] 
a68: Escape @ in ga68.texi

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

* ga68.texi (Worthy characters): Escape @.

5 months agoforwprop: Use ssizetype for mask [PR123414].
Robin Dapp [Thu, 8 Jan 2026 13:22:18 +0000 (14:22 +0100)] 
forwprop: Use ssizetype for mask [PR123414].

RVV's vectors can get very large with LMUL8.  In the PR we have
256-element char vectors which get permuted.  For permuting them
we use a mask vectype that is deduced from the element type
without checking if the permute indices fit this type.
That leads to an invalid permute mask which gets optimized away.

This patch uses ssizetype as masktype instead.

PR tree-optimization/123414

gcc/ChangeLog:

* tree-ssa-forwprop.cc (simplify_vector_constructor):
Use ssizetype as mask type.

gcc/testsuite/ChangeLog:

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

5 months agoFix broken bootstrap on FreeBSD.
Thomas Koenig [Fri, 9 Jan 2026 21:00:07 +0000 (22:00 +0100)] 
Fix broken bootstrap on FreeBSD.

As analyzed by Steve, on freebsd __gthread_t is a pointer type.
I thought it the cleanest solution to remove the #ifdef in gfc_unit,
make the "self" member a intptr_t and cast the return value of
__gthread_t to that type.

PR fortran/123512

libgfortran/ChangeLog:

* io/io.h: Change type of self to intptr_t.
* io/async.h (LOCK_UNIT): Cast __gthread_self () to intptr_t.
(TRYLOCK_UNIT): Likewise.
(OWN_THREAD_ID): Likewise.

5 months agoUpdate Copyright for gen-evolution.awk and gen-cxxapi-file.py
Jakub Jelinek [Fri, 9 Jan 2026 20:54:38 +0000 (21:54 +0100)] 
Update Copyright for gen-evolution.awk and gen-cxxapi-file.py

On Fri, Jan 09, 2026 at 05:54:47PM +0000, Joseph Myers wrote:
> I think updates to gcc/config/loongarch/genopts/gen-evolution.awk's calls
> to copyright_header are needed as well.  At present, building for
> loongarch can result in files in the source tree being reverted to older
> copyright dates because the generation hasn't been updated (discovered via
> my glibc bot with GCC mainline stopping updating its GCC source tree
> because such modifications appeared in the sources).  Of course this also
> shows up missing entries in contrib/gcc_update for the three files
> generated by gen-evolution.awk.

gen-evolution.awk was explicitly blacklisted
and so was gen-cxxapi-file.py, both because update-copyright.py
matched Copyright line also within the printing code but it wasn't
matching the expected form.
Fixed by making sure the printing code doesn't match it by using
print "   Copy" "right (C) " ... in the awk case and
Copy{:s}right in the python case (with "" arg added).

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

contrib/
* update-copyright.py (GCCFilter): Don't filter out
gen-evolution.awk and gen-cxxapi-file.py.
gcc/
* config/loongarch/genopts/gen-evolution.awk: Update
copyright year.
(copyright_header): Separate parts of Copyright word
with " " so that it doesn't get matched by update-copyright.py.
(gen_full_header, gen_full_source, gen_full_def): Include
2026 year in the ranges.
gcc/cp/
* gen-cxxapi-file.py: Update copyright year.  Separate
parts of Copyright word with {:s} so that it doesn't get matched
by update-copyright.py.

5 months agoanalyzer: port pop_frame_callbacks to pub/sub
David Malcolm [Fri, 9 Jan 2026 20:54:16 +0000 (15:54 -0500)] 
analyzer: port pop_frame_callbacks to pub/sub

More simplification/consolidation of some callback logic in analyzer in
favor of using the analyzer pub/sub channel.

No functional change intended.

gcc/analyzer/ChangeLog:
* common.h (struct on_frame_popped): New.
(subscriber::on_message): New vfunc for on_frame_popped.
* region-model.cc: Include "context.h" and "channels.h".
(region_model::pop_frame_callbacks): Delete.
(region_model::pop_frame): Port from notify_on_pop_frame to
using pub/sub channel.
* region-model.h (pop_frame_callback): Delete typedef.
(region_model::register_pop_frame_callback): Delete.
(region_model::pop_frame_callbacks): Delete.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc
(cpython_analyzer_events_subscriber::on_message): Implement for
on_frame_popped.
(plugin_init): Drop call to
region_model::register_pop_frame_callback in favor of the above
pub/sub handler.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agoanalyzer: port translation_unit_callbacks to pub/sub
David Malcolm [Fri, 9 Jan 2026 20:54:16 +0000 (15:54 -0500)] 
analyzer: port translation_unit_callbacks to pub/sub

Simplification/consolidation of some callback logic in analyzer in
favor of using the analyzer pub/sub channel.

No functional change intended.

gcc/analyzer/ChangeLog:
* analyzer-language.cc: Include "context.h" and "channels.h".
(finish_translation_unit_callbacks): Delete.
(register_finish_translation_unit_callback): Delete.
(run_callbacks): Delete.
(on_finish_translation_unit): Port from run_callbacks to pub/sub.
* analyzer-language.h (finish_translation_unit_callback): Delete
typedef.
(register_finish_translation_unit_callback): Delete decl.
* common.h (class translation_unit): New forward decl.
(struct analyzer_events::on_tu_finished): New.
(analyzer_events::subscriber::on_message): Add vfunc for
on_tu_finished messages.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc
(cpython_analyzer_events_subscriber::on_message): New.
(plugin_init): Port stashing of named types and global vars to
pub/sub framework.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agoanalyzer: replace PLUGIN_ANALYZER_INIT with a pub/sub channel
David Malcolm [Fri, 9 Jan 2026 20:54:16 +0000 (15:54 -0500)] 
analyzer: replace PLUGIN_ANALYZER_INIT with a pub/sub channel

This patch eliminates the PLUGIN_ANALYZER_INIT event in favor of a new
analyzer_events_channel that can be subscribed to, and ports all the
in-tree analyzer plugins to using it.

The PLUGIN_* approach isn't typesafe, and the name suggests it's only
meant to be used for plugins, whereas the pub/sub approach is typesafe,
and treats the publish/subscribe network as orthogonal to whether the
code is built into the executable or is a plugin.

gcc/analyzer/ChangeLog:
* common.h: Define INCLUDE_LIST.
(class plugin_analyzer_init_iface): Replace with...
(gcc::topics::analyzer_events::on_ana_init): ...this.
(gcc::topics::analyzer_events::subscriber): New.
* engine.cc: Include "context.h" and "channels.h".
(class plugin_analyzer_init_impl): Replace with...
(class impl_on_ana_init): ...this.  Fix some overlong lines.
(impl_run_checkers): Port from PLUGIN_ANALYZER_INIT to using
publish/subscribe framework.

gcc/ChangeLog:
* channels.h (gcc::topics::analyzer_events::subscriber): New
forward decl.
(compiler_channels::analyzer_events_channel): New field.
* doc/plugins.texi (PLUGIN_ANALYZER_INIT): Delete.
* plugin.cc (register_callback): Delete PLUGIN_ANALYZER_INIT.
(invoke_plugin_callbacks_full): Likewise.
* plugin.def (PLUGIN_ANALYZER_INIT): Delete this event.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc: Port from
PLUGIN_ANALYZER_INIT to subscribing to analyzer_events_channel.
* gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agodiagnostics: add optional CFG dumps to SARIF/HTML output sinks
David Malcolm [Fri, 9 Jan 2026 20:54:15 +0000 (15:54 -0500)] 
diagnostics: add optional CFG dumps to SARIF/HTML output sinks

This patch adds a new key/value pair "cfgs={yes,no}" to diagnostics
sinks, "no" by default.

If set to "yes" for a SARIF sink, then GCC will add the internal state
of the CFG for all functions after each pertinent optimization pass in
graph form to theRun.graphs in the SARIF output.

If set to "yes" for an HTML sink, the generated HTML will contain SVG
displaying the graphs, adapted from code in graph.cc

Text sinks ignore it.

The SARIF output is thus a machine-readable serialization of (some of)
GCC's intermediate representation (as JSON), but it's much less than
GCC-XML used to provide.  The precise form of the information is
documented as subject to change without notice.

Currently it shows both gimple statements and RTL instructions,
depending on the pass.  My hope is that it should be possible to write a
"cfg-grep" tool that can read the SARIF and automatically identify
in which pass a particular piece of our IR appeared or disappeared,
for tracking down bugs in our optimization passes.

Implementation-wise:
* this uses the publish-subscribe mechanism from the earlier patch, by
having the diagnostics sink subscribe to pass_events::after_pass
messages from the pass_events_channel.
* the patch adds a new hook to cfghooks.h for dumping a basic block
into a SARIF property bag

gcc/ChangeLog:
* Makefile.in (OBJS): Add tree-diagnostic-cfg.o.
(OBJS-libcommon): Add custom-sarif-properties/cfg.o,
diagnostics/digraphs-to-dot.o, and
diagnostics/digraphs-to-dot-from-cfg.o.
* cfghooks.cc: Define INCLUDE_VECTOR.  Add includes of
"diagnostics/sarif-sink.h" and "custom-sarif-properties/cfg.h".
(dump_bb_as_sarif_properties): New.
* cfghooks.h (diagnostics::sarif_builder): New forward decl.
(json::object): New forward decl.
(cfg_hooks::dump_bb_as_sarif_properties): New callback field.
(dump_bb_as_sarif_properties): New decl.
* cfgrtl.cc (rtl_cfg_hooks): Populate the new callback
field with rtl_dump_bb_as_sarif_properties.
(cfg_layout_rtl_cfg_hooks): Likewise.
* custom-sarif-properties/cfg.cc: New file.
* custom-sarif-properties/cfg.h: New file.
* diagnostics/digraphs-to-dot-from-cfg.cc: New file, partly
adapted from gcc/graph.cc.
* diagnostics/digraphs-to-dot.cc: New file.
* diagnostics/digraphs-to-dot.h: New file, based on material in...
* diagnostics/digraphs.cc: Include
"diagnostics/digraphs-to-dot.h".
(class conversion_to_dot): Rework and move to above.
(make_dot_graph_from_diagnostic_graph): Likewise.
(make_dot_node_from_digraph_node): Likewise.
(make_dot_edge_from_digraph_edge): Likewise.
(conversion_to_dot::get_dot_id_for_node): Likewise.
(conversion_to_dot::has_edges_p): Likewise.
(digraph::make_dot_graph): Use to_dot::converter::make and invoke
the result to make the dot graph.
* diagnostics/digraphs.h (digraph:get_all_nodes): New accessor.
* diagnostics/html-sink.cc
(html_builder::m_per_logical_loc_graphs): New field.
(html_builder::add_graph_for_logical_loc): New.
(html_sink::report_digraph_for_logical_location): New.
* diagnostics/sarif-sink.cc (sarif_array_of_unique::get_element):
New.
(sarif_builder::report_digraph_for_logical_location): New.
(sarif_sink::report_digraph_for_logical_location): New.
* diagnostics/sink.h: Include "diagnostics/logical-locations.h".
(sink::report_digraph_for_logical_location): New vfunc.
* diagnostics/text-sink.h
(text_sink::report_digraph_for_logical_location): New.
* doc/invoke.texi (fdiagnostics-add-output): Clarify wording.
Distinguish between scheme-specific vs GCC-specific keys, and add
"cfgs" as the first example of the latter.
* gimple-pretty-print.cc: Include "cfghooks.h", "json.h", and
"custom-sarif-properties/cfg.h".
(gimple_dump_bb_as_sarif_properties): New.
* gimple-pretty-print.h (diagnostics::sarif_builder): New forward
decl.
(json::object): Likewise.
(gimple_dump_bb_as_sarif_properties): New.
* graphviz.cc (get_compass_pt_from_string): New
* graphviz.h (get_compass_pt_from_string): New decl.
* libsarifreplay.cc (sarif_replayer::handle_graph_object): Fix
overlong line.
* opts-common.cc: Define INCLUDE_VECTOR.
* opts-diagnostic.cc: Define INCLUDE_LIST.  Include
"diagnostics/sarif-sink.h", "tree-diagnostic-sink-extensions.h",
"opts-diagnostic.h", and "pub-sub.h".
(class gcc_extra_keys): New class.
(opt_spec_context::opt_spec_context): Add "client_keys" param and
pass to dc_spec_context.
(handle_gcc_specific_keys): New.
(try_to_make_sink): New.
(gcc_extension_factory::singleton): New.
(handle_OPT_fdiagnostics_add_output_): Rework to use
try_to_make_sink.
(handle_OPT_fdiagnostics_set_output_): Likewise.
* opts-diagnostic.h: Include "diagnostics/sink.h".
(class gcc_extension_factory): New.
* opts.cc: Define INCLUDE_LIST.
* print-rtl.cc: Include "dumpfile.h", "cfghooks.h", "json.h", and
"custom-sarif-properties/cfg.h".
(rtl_dump_bb_as_sarif_properties): New.
* print-rtl.h (diagnostics::sarif_builder): New forward decl.
(json::object): Likewise.
(rtl_dump_bb_as_sarif_properties): New decl.
* tree-cfg.cc (gimple_cfg_hooks): Use
gimple_dump_bb_as_sarif_properties for new callback field.
* tree-diagnostic-cfg.cc: New file, based on material in graph.cc.
* tree-diagnostic-sink-extensions.h: New file.
* tree-diagnostic.cc: Define INCLUDE_LIST.  Include
"tree-diagnostic-sink-extensions.h".
(compiler_ext_factory): New.
(tree_diagnostics_defaults): Set gcc_extension_factory::singleton
to be compiler_ext_factory.

gcc/testsuite/ChangeLog:
* gcc.dg/diagnostic-cfgs-html.py: New test.
* gcc.dg/diagnostic-cfgs-sarif.py: New test.
* gcc.dg/diagnostic-cfgs.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agoAdd publish/subscribe topics and channel: pass_events
David Malcolm [Fri, 9 Jan 2026 20:54:15 +0000 (15:54 -0500)] 
Add publish/subscribe topics and channel: pass_events

This patch adds a new "struct compiler_channels" to hold channels
relating to the compiler that plugins (or diagnostic sinks) might want
to subscribe to events for, accessed from the global gcc::context
object, along with a new gcc/topics/ source subdirectory to hold
strongly-typed publish/subscribe topics relating to the compiler.

For now, there is just one: pass_events_channel, which, if there are any
subscribers, issues notifications about passes starting/stopping on
particular functions, using topics::pass_events, declared in
topics/pass-events.h, but followup patches add more kinds of
notification channel.

A toy plugin in the testsuite shows how this could be used to build a
progress notification UI for the compiler, and a followup patch uses the
channel to (optionally) capture CFG information at each stage of
optimization in machine-readable form into a SARIF sink.

gcc/ChangeLog:
* channels.h: New file.
* context.cc: Define INCLUDE_LIST.  Include "channels.h".
(gcc::context::context): Create m_channels.
(gcc::context::~context): Delete it.
* context.h (struct compiler_channels): New forward decl.
(gcc::context::get_channels): New accessor.
(gcc::context::m_channels): New field.
* passes.cc: Define INCLUDE_LIST.  Include "topics/pass-events.h"
and "channels.h".
(execute_one_pass): If the global context's pass_events_channel
has subscribers, publish before_pass and after_pass events to it.
* topics/pass-events.h: New file.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/plugin.exp: Add progress_notifications_plugin.cc.
* gcc.dg/plugin/progress_notifications_plugin.cc: New test plugin.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agoAdd pub-sub.{h,cc}
David Malcolm [Fri, 9 Jan 2026 20:54:15 +0000 (15:54 -0500)] 
Add pub-sub.{h,cc}

This patch introduces a publish/subscribe mechanism, allowing for
loosely-coupled senders and receivers, with strongly-typed messages
passing between them.  For example, a GCC subsystem could publish
messages about events, and a plugin could subscribe to them.

An example can be seen in the selftests.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Add pub-sub.o.
* pub-sub.cc: New file.
* pub-sub.h: New file.
* selftest-run-tests.cc (selftest::run_tests): Call
selftest::pub_sub_cc_tests.
* selftest.h (selftest::pub_sub_cc_tests): New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 months agoaarch64: Fix PCH for sve builtins [PR123457]
Andrew Pinski [Thu, 8 Jan 2026 04:28:12 +0000 (20:28 -0800)] 
aarch64: Fix PCH for sve builtins [PR123457]

The problem here is function_table was not in the GGC memory space and not
streamed out. So even though the builtins were reloaded, function_table was
a nullptr as it was not reloaded.

Also noticed initial_indexes should be marked with GTY so it is reloaded correctly
from PCH.

Built and tested for aarch64-linux-gnu.

PR target/123457
gcc/ChangeLog:

* config/aarch64/aarch64-sve-builtins.cc (struct registered_function_hasher):
Change base class to ggc_ptr_hash.
(initial_indexes): Mark with GTY.
(function_table): Likewise.
(handle_arm_sve_h): Allocate function_table from ggc instead of heap.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 months agoc: Optimize TARGET_EXPRs for _Atomic loads [PR123475]
Jakub Jelinek [Fri, 9 Jan 2026 19:46:39 +0000 (20:46 +0100)] 
c: Optimize TARGET_EXPRs for _Atomic loads [PR123475]

On the following testcase we emit a false positive warning that
a temporary (TARGET_EXPR slot) is used uninitialized, from the early_uninit
pass.

This regressed with my change to instrument for
-ftrivial-auto-var-init={zero,pattern} not just DECL_EXPRs, but also
TARGET_EXPR initializations if the TARGET_EXPR_INITIALIZER has void type.
Those cases are where the initializer doesn't necessarily have to initialize
the whole TARGET_EXPR slot, or might use parts or the whole slot before
those are initialized; this is how e.g. various C++ temporary objects are
constructed.

The problem is in pass interaction.  The FE creates a TARGET_EXPR with
void type initializer because the initializer is originally
__atomic_load (&expr, &tmp, SEQ_CST); but it is folded instantly into
(void) (tmp = (type) __atomic_load_N (&expr, SEQ_CST)).  The FE also
marks the TARGET_EXPR slot as TREE_ADDRESSABLE, because it would be
if it will use libatomic, but nothing in the IL then takes its address.
Now, since my r16-4212 change which was for mainly C++26 compliance
we see the TARGET_EXPR and because it has void type TARGET_EXPR_INITIALIZER,
we start with tmp = .DEFERRED_INIT (...); just in case the initialization
would attempt to use the slot before initialization or not initialize fully.
Because tmp is TREE_ADDRESSABLE and has gimple reg type, it is actually not
gimplified as tmp = .DEFERRED_INIT (...); but as _1 = .DEFERRED_INIT (...);
tmp = _1; but because it is not actually address taken in the IL, already
the ssa pass turns it into SSA_NAME (dead one), so we have
_1 = .DEFERRED_INIT (...); _2 = _1; and _2 is unused.  Next comes
early_uninit and warns on the dead SSA_NAME copy that it uses uninitialized
var.

The following patch attempts to fix that by checking if
c_build_function_call_vec has optimized the call right away into pure
assignment to the TARGET_EXPR slot without the slot being used anywhere
else in the expression and 1) clearing again TREE_ADDRESSABLE on the slot,
because it isn't really addressable 2) optimizing the TARGET_EXPR, so that
it doesn't have void type TARGET_EXPR_INITIALIZER by changing it to the rhs
of the MODIFY_EXPR.  That way gimplifier doesn't bother creating
.DEFERRED_INIT for it at all.

Or should something like this be done instead in the TARGET_EXPR
gimplification?  I mean not the TREE_ADDRESSABLE clearing, that can't be
done without knowing what we know in the FE, but the rest, generally
TARGET_EXPR with initializer (void) (TARGET_EXPR_SLOT = something)
where something doesn't refer to TARGET_EXPR_SLOT can be optimized into
just something TARGET_EXPR_INITIALIZER.

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

PR c/123475
* c-typeck.cc (c_find_var_r): New function.
(convert_lvalue_to_rvalue): If c_build_function_call_vec
folded __atomic_load (&expr, &tmp, SEQ_CST); into
(void) (tmp = __atomic_load_<N> (&expr, SEQ_CST)), drop
TREE_ADDRESSABLE flag from tmp and set TARGET_EXPR
initializer just to the rhs of the MODIFY_EXPR.

* gcc.dg/pr123475.c: New test.

5 months agodoc: List more valid -x option arguments
Jakub Jelinek [Fri, 9 Jan 2026 19:45:09 +0000 (20:45 +0100)] 
doc: List more valid -x option arguments

We miss quite a few -x option arguments that can be specified.

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

* doc/invoke.texi (-x): Add c++-system-module, objc-cpp-output,
objc++-cpp-output, adascil, adawhy, modula-2, modula-2-cpp-output,
rust, algol68 and lto as further possible option arguments.

5 months agolibstdc++: Simplify use_proxy_wait function
Jonathan Wakely [Thu, 8 Jan 2026 14:03:01 +0000 (14:03 +0000)] 
libstdc++: Simplify use_proxy_wait function

The __wait_args::_M_setup_proxy_wait function must only be called when
_M_obj == addr is true, so it's redundant for _M_setup_proxy_wait to
pass addr to use_proxy_wait. That address is already passed as
args._M_old anyway.

libstdc++-v3/ChangeLog:

* src/c++20/atomic.cc (use_proxy_wait): Remove unused second
parameter.
(__wait_args::_M_setup_proxy_wait): Remove second argument.
(__notify_impl): Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 months agolibstdc++: Fix proxy wait detection in atomic wait
Jonathan Wakely [Thu, 8 Jan 2026 14:03:01 +0000 (14:03 +0000)] 
libstdc++: Fix proxy wait detection in atomic wait

A failed assertion was observed with std::atomic<bool>::wait when the
loop in __atomic_wait_address is entered and calls _M_setup_wait a
second time, after waking from __wait_impl. When the first call to
_M_setup_wait makes a call to _M_setup_proxy_wait that function decides
that a proxy wait is needed for an object of type bool, and it updates
the _M_obj and _M_obj_size members to refer to the futex in the proxy
state, instead of referring to the bool object itself. The next time
_M_setup_wait is called it calls _M_setup_proxy_wait again but now it
sees _M_obj_size == sizeof(futex) and so this time decides a proxy wait
is *not* needed, and then fails the __glibcxx_assert(_M_obj == addr)
check.

The problem is that _M_setup_proxy_wait wasn't correctly handling the
case where it's called a second time, after the decision to use a proxy
wait has already been made. That can be fixed in _M_setup_proxy_wait by
checking if _M_obj != addr, which implies that a proxy wait has already
been set up by a previous call. In that case, _M_setup_proxy_wait should
only update _M_old to the latest value of the proxy _M_ver.

This change means that _M_setup_proxy_wait is safe to call repeatedly
for a proxy wait, and will only update _M_wait_state, _M_obj, and
_M_obj_size on the first call. On the second and subsequent calls, those
variables are already correctly set for the proxy wait so don't need to
be set again.

For non-proxy waits, calling _M_setup_proxy_wait more than once is safe,
but pessimizes performance. The caller shouldn't make a second call to
_M_setup_proxy_wait because we don't need to check again if a proxy wait
should be used (the answer won't change) and we don't need to load a
value from the proxy _M_ver.

However, it was difficult to detect the case of a non-proxy wait,
because _M_setup_wait doesn't know if it's being called the first time
(when _M_setup_proxy_wait is called to make the initial decision) or a
subsequent time (in which case _M_obj == addr implies a non-proxy wait
was already decided on). As a result, _M_setup_proxy_wait was being used
every time to see if it's a proxy wait. We can resolve this by splitting
the _M_setup_wait function into _M_setup_wait and _M_on_wake, where the
former is only called once to do the initial setup and the latter is
called after __wait_impl returns, to prepare to check the predicate and
possibly wait again.  The new _M_on_wake function can avoid unnecessary
calls to _M_setup_proxy_wait by checking _M_obj == addr to identify a
non-proxy wait.

The three callers of _M_setup_wait are updated to use _M_on_wake instead
of _M_setup_wait after waking from a waiting function. This change
revealed a latent performance bug in __atomic_wait_address_for which was
not passing __res to _M_setup_wait, so a new value was always loaded
even when __res._M_has_val was true. By splitting _M_on_wake out of
_M_setup_wait this problem became more obvious, because we no longer
have _M_setup_wait doing two different jobs, depending on whether it was
passed the optional third argument or not.

libstdc++-v3/ChangeLog:

* include/bits/atomic_timed_wait.h (__atomic_wait_address_until):
Use _M_on_wake instead of _M_setup_wait after waking.
(__atomic_wait_address_for): Likewise.
* include/bits/atomic_wait.h (__atomic_wait_address): Likewise.
(__wait_args::_M_setup_wait): Remove third parameter and move
code to update _M_old to ...
(__wait_args::_M_on_wake): New member function to update _M_old
after waking, only calling _M_setup_proxy_wait if needed.
(__wait_args::_M_store): New member function to update _M_old
from a value, for non-proxy waits.
* src/c++20/atomic.cc (__wait_args::_M_setup_proxy_wait): If
_M_obj is not addr, only load a new value and return true.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 months agolibstdc++: Ensure counting_semaphore::try_acquire_for times out [PR122878]
Jonathan Wakely [Fri, 9 Jan 2026 15:29:13 +0000 (15:29 +0000)] 
libstdc++: Ensure counting_semaphore::try_acquire_for times out [PR122878]

As noted in Bug 122878 comment 2, the _M_try_acquire_for implementation
doesn't reduce the remaining timeout each time it returns from an atomic
waiting function. This means that it can wait longer than requested, or
even loop forever. If there is a spurious wake from the timed waiting
function (__wait_until_impl) it will return indicating no timeout
occurred, which means the caller will check the value and potentially
sleep again. If spurious wakes happen every time, it will just keep
sleeping in a loop forever. This is observed to actually happen on
FreeBSD 14.0-STABLE where pthread_cond_timedwait gets a spurious wake
and so never times out.

The solution in this commit is to replace the implementation of
_M_try_acquire_for with a call to _M_try_acquire_until, converting the
relative timeout to an absolute timeout against the steady clock. This
is what ends up happening anyway, because we only have a
__wait_until_impl entry point into the library internals, so
__atomic_wait_address_for already converts the relative timeout to an
absolute timeout (except for the special case of a zero-value duration,
which only checks for an update while spinning for a finite number of
iterations, and doesn't sleep).

As noted in comment 4 of the PR, this requires some changes to
_M_try_acquire which was relying on the behaviour of _M_try_acquire_for
for zero-value durations.  That behaviour is desirable for
_M_try_acquire so that it can handle short-lived contention without
failing immediately. To preserve that behaviour of _M_try_acquire it is
changed to do its own loop and to call __atomic_wait_address_for
directly with a zero duration, to do the spinloop.

libstdc++-v3/ChangeLog:

PR libstdc++/122878
* include/bits/semaphore_base.h (_M_try_acquire): Replace
_M_try_acquire_for call with explicit loop and call to
__atomic_wait_address_for.
(_M_try_acquire_for): Replace loop with call to
_M_try_acquire_until.

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 months agoFortran: [PR123483] Fix duplicate finalization
Jerry DeLisle [Fri, 9 Jan 2026 17:38:52 +0000 (09:38 -0800)] 
Fortran: [PR123483] Fix duplicate finalization

A duplicated call to a finalizer occured in cases where a derived type
has components, one or more of which are allocatable, and one or more
of which are finalizable. (The bug occured only if the derived type
is an extension of another type, which has defined assignment.)

New test case derived from the original report by Paul Thomas.

PR fortran/123483

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_deallocate_alloc_comp): Ad the new
finalization argument and pass it to structure_alloc_comps.
* trans-array.h (gfc_deallocate_alloc_comp): Add a finalization
flag that can be passed by gfc_conv_procedure_call.
* trans-expr.cc (gfc_conv_procedure_call): Use the new
finalization flag.

gcc/testsuite/ChangeLog:

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

Signed off by: Andrew Benson <abensonca@gcc.gnu.org>

5 months agolibstdc++: Fix C++ 11 ctype when using picolibc (blank vs space)
Keith Packard [Thu, 8 Jan 2026 18:14:07 +0000 (10:14 -0800)] 
libstdc++: Fix C++ 11 ctype when using picolibc (blank vs space)

Existing toolchain builds rely on the similarity between picolibc and
newlib when building libstdc++ and use --with-newlib.

Switch to the picolibc 16-bit _ctype_wide array which provides
separate values for ctype_base::blank and ctype_base::space.

This fixes a bug where libstdc++ was including '\f', '\n', '\r' and
'\v' in the set of 'blank' chars. Afterwards, only ' ' and '\t' are in
this set, as specified by C++ 11.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CONFIGURE): Add --with-picolibc.
* configure: Regenerate.
* configure.ac: Add handling for with_picolibc=yes.
* config/os/picolibc/ctype_base.h: New file.
* config/os/picolibc/ctype_configure_char.cc: New file.
* config/os/picolibc/ctype_inline.h: New file.
* config/os/picolibc/os_defines.h: New file.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 months ago[PR123121, LRA]: Fix wrong rematerialization of insns with several outputs
Vladimir N. Makarov [Fri, 9 Jan 2026 15:36:29 +0000 (10:36 -0500)] 
[PR123121, LRA]: Fix wrong rematerialization of insns with several outputs

LRA in the test case, rematerialize insn with div/mod where div result
is not used.  Still div result requires ax which is used by different
pseudos at point of rematerialization and this clobbers the pseudo
value.  The patch solves the problem by constraining to single set
insns as we always rematerialize only one pseudo value.  Also there is
no sense to rematerialize div/mod as usually their latency is more
than load value from CPU cache.  The patch explicitly excludes such
insns from rematerialization.

gcc/ChangeLog:

PR rtl-optimization/123121
* lra-remat.cc (bad_for_rematerialization_p): Consider div/mod ops.
(operand_to_remat): Exclude rematerialization of insns with
multiple sets.

gcc/testsuite/ChangeLog:

PR rtl-optimization/123121
* gcc.target/i386/pr123121.c: New.

5 months agoRISC-V: Update tt-ascalon-d8's extension list [PR123492]
Peter Bergner [Fri, 9 Jan 2026 02:41:20 +0000 (20:41 -0600)] 
RISC-V: Update tt-ascalon-d8's extension list [PR123492]

The Ascalon core implements the full RVA23 profile plus a few other optional
extensions.  However, the -mcpu=tt-ascalon-d8 option doesn't enable them all.
Add the missing extensions.

2026-01-08  Peter Bergner  <bergner@tenstorrent.com>

gcc/
PR target/123492
* config/riscv/riscv-cores.def (RISCV_CORE)<tt-ascalon-d8>: Add missing
extensions via use of rva23s64 profile and adding zkr, smaia, smmpm,
smnpm, smrnmi, smstateen, ssaia, ssstrict, svadu.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
5 months agoipa-cp: Use the VR and bits lattices for clones of non-local functions too
Martin Jambor [Wed, 7 Jan 2026 12:34:45 +0000 (13:34 +0100)] 
ipa-cp: Use the VR and bits lattices for clones of non-local functions too

Since the IPA-CP lattices for value ranges cannot hold more values and
don't have any "variable" flag, we initialize them to bottom for
non-local nodes.  However, that means we don't make use of known
information gathered in jump functions when the corresponding node is
cloned for some other reason.  This patch allows collection of the
information and only does not use them for the original non-local
nodes, while making sure that we do not propagate information through
such-non local nodes as there may be unknown calls.

gcc/ChangeLog:

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

* ipa-cp.h (class ipcp_bits_lattice): New members set_recipient_only,
recipient_only_p and m_recipient_only.
(class ipcp_vr_lattice): Likewise.
(ipcp_vr_lattice::init): Initialize also m_recipient_only.
* ipa-cp.cc (ipcp_bits_lattice::print): Adjust printting to also
print the new flag.
(ipcp_vr_lattice::print): Likewise.
(ipcp_vr_lattice::set_recipient_only): New function.
(ipcp_bits_lattice::set_recipient_only): Likewise.
(set_all_contains_variable): New parameter MAKE_SIMPLE_RECIPIENTS, set
bits and vr lattices to recibient only insted to bottom when it is
true.
(initialize_node_lattices): Pass true to the second parameter of
set_all_contains_variable.
(propagate_bits_across_jump_function): Treat recipient_only source
lattices like bottom.
(propagate_vr_across_jump_function): Likewise.
(ipcp_store_vr_results): Skip non-local nodes.

5 months agoipa-cp: Better opportunity evaluation and ranking
Martin Jambor [Mon, 5 Jan 2026 13:59:52 +0000 (14:59 +0100)] 
ipa-cp: Better opportunity evaluation and ranking

This modifies the decision making stage of IPA-CP in two ways:

Previously, local effects of the cloning were estimated only for the
constant that was being considered, even though the calls which bring
it also carry other constants.  With this patch, all knowsn constants
for the given subset of caller edges are considered and the heuritics
should therefore have more information and generally work better.

Also, when evaluating the opportunities for a given node, IPA-CP
previously just iterate over the parameters starting with the first
one and if any opportunity looked profitable, it was carried out and
associated calling edges were redirected, even if this precludes some
even better opportunity.  The patch tries to mitigate this by first
using the initial estimates to sort all cloning candidates and then
iterate in that order.

The one difference from the version I posted before is that I have
extended the checking assert making sure the value we clone for is
indeed used to also work for non-aggregate constants and polymorphic
contexts.

gcc/ChangeLog:

2025-12-01  Martin Jambor  <mjambor@suse.cz>

* ipa-cp.cc (good_cloning_opportunity_p): Dump a message when
bailing out early too.
(find_more_scalar_values_for_callers_subset): Rename to
find_scalar_values_for_callers_subset, collect constants regardless of
what is already in the vector.  Remove dumping.
(find_more_contexts_for_caller_subset): Rename to
find_contexts_for_caller_subset, collect contexts regardless of what
is already in the vector.  Remove dumping.
(find_aggregate_values_for_callers_subset): Rename to
find_aggregate_values_for_callers_subset_gc, implement using new
functions.
(find_aggregate_values_for_callers_subset_1): New function.
(find_aggregate_values_for_callers_subset): Likewise.
(copy_known_vectors_add_val): Removed.
(dump_reestimation_message): New function.
(decide_about_value): Remove formal parameter avals, compute it
independently, and use it to estimate local cloning effects.
(struct cloning_opportunity_ranking): New type.
(compare_cloning_opportunities): New function.
(cloning_opportunity_ranking_evaluation): Likewise.
(decide_whether_version_node): Pre-sort candidates for cloning before
really evaluating them.  Calculate context independent values only
when considering versioning for all contexts.
(ipcp_val_agg_replacement_ok_p): Renamed to
ipcp_val_replacement_ok_p, check also non-aggregate values.

gcc/testsuite/ChangeLog:

2026-01-08  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/ipa/ipcp-agg-2.c: Adjust dump test.
* gcc.dg/ipa/ipcp-agg-3.c: Likewise.
* gcc.dg/ipa/ipcp-agg-4.c: Likewise.
* gcc.dg/ipa/ipcp-agg-14.c: New test.
* gcc.dg/vect/pr101145_1.c: Compile with -fno-ipa-cp.
* gcc.dg/vect/pr101145_2.c: Likewise.
* gcc.dg/vect/pr101145_3.c: Likewise.

5 months agoarm: prevent impossible tail- long-calls with static chain [PR119430]
Alexandre Oliva [Fri, 11 Jul 2025 01:21:31 +0000 (22:21 -0300)] 
arm: prevent impossible tail- long-calls with static chain [PR119430]

When a function call uses up all argument registers, and needs IP for
the static chain, there aren't any call-clobbered registers left for
reload to assign as the sibcall target, when -mlong-calls is enabled.
Use the same logic that does the job for indirect calls to prevent
tail calls in this case.

With this change, it is possible to bootstrap armv7a-linux-gnu with
both -O3 and lto, but only with both -mlong-calls and
-ffunction-sections.

Without -mlong-calls, linker veneer thunks may clobber the static
chain register set up by callers in one lto unit, preventing them from
reaching the callee in a separate lto unit.  -ffunction-sections is
required for -mlong-calls to be effective, because both caller and
callee are in the same section, and that disables long-calls when
!flag_reorder_blocks_and_partition.

gcc/ChangeLog

PR target/119430
* config/arm/arm.cc (arm_function_ok_for_sibcall): Disable
sibcalls for long-calls that use all call-clobbered
general-purpose registers, including the static chain.

5 months agos390: Fix operand modifier c
Stefan Schulze Frielinghaus [Fri, 9 Jan 2026 14:23:29 +0000 (15:23 +0100)] 
s390: Fix operand modifier c

Currently, operand modifier c truncates and extends any integer constant
to a signed 8-bit constant whereas the common code implementation just
prints the constant unmodified.  The modifier was introduced in
r0-87728-g963fc8d00baeca matching the new constraint C which ensures
that a constant is an 8-bit signed integer.

In the machine description, operand modifier c is only used for operands
with constraint C.  Therefore, there is no immediate need for some
special constant printing.

Since print_operand() is also used by output_asm_insn(), inline asm is
also affected by this.  Note, in output_asm_insn() we cannot utilize
output_addr_const() since not every CONST_INT is a valid address, i.e.,
we have up to 32-bit immediates and at most 20-bit (long) displacements.

In fact, %cN should behave the same as %N for any CONST_INT operand N,
although, this literally means that the output modifier accepts and
prints immediates which might be larger than any instruction accepts.
Though, regarding accepting or rejecting immediates, this is what
constraints et al. are for.  Therefore, align %cN and %N.

gcc/ChangeLog:

* config/s390/s390.cc (print_operand): Align %cN with %N.
* config/s390/s390.md: Remove comment.

gcc/testsuite/ChangeLog:

* gcc.target/s390/asm-constant-1.c: New test.

5 months agoEnable -fbit-tests and -fjump-tables at -Og [PR123212]
Filip Kastl [Fri, 9 Jan 2026 14:16:50 +0000 (15:16 +0100)] 
Enable -fbit-tests and -fjump-tables at -Og [PR123212]

Since GCC 15, bit test and jump table lowering was disabled for both -O0
and -Og to save compile time.  On -Og, compile time isn't *that*
critical, so this patch enables bit tests and jump tables on -Og once
again.

PR c/123212

gcc/ChangeLog:

* opts.cc: Enable -fbit-tests and -fjump-tables at -Og.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
5 months agoaarch64: Add support for FEAT_F8F32MM, FEAT_F8F16MM, and FEAT_SVE_F16F32MM.
Alfie Richards [Thu, 23 Oct 2025 11:42:17 +0000 (11:42 +0000)] 
aarch64: Add support for FEAT_F8F32MM, FEAT_F8F16MM, and FEAT_SVE_F16F32MM.

Adds support for the AArch64 2024 fmmla extensions.

Note this includes a work around in the testsuite for spurious warnings
from binutils with movprfx and fmmla instructions.
(PR gas/33562).

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc
(aarch64_expand_pragma_builtin): Add case for FMMLA.
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins):
Add new __ARM_FEATURE_X macros.
* config/aarch64/aarch64-simd-pragma-builtins.def
(vmmlaq_f16_mf8): New intrinsic.
(vmmlaq_f32_mf8): Likewise.
* config/aarch64/aarch64-simd.md
(@aarch64_<insn><VDQ_HSF_FMMLA:mode>): New instruction.
* config/aarch64/aarch64-sve-builtins-base.cc: Update mmla_impl
for new instructions.
* config/aarch64/aarch64-sve-builtins-shapes.cc
(struct mmla_def): Add support for the new widening forms.
* config/aarch64/aarch64-sve-builtins-sve2.def (svmmla) Add new
intrinsics.
* config/aarch64/aarch64-sve-builtins.cc (TYPES_cvt_narrow_s):
Fix comment.
* config/aarch64/aarch64-sve2.md
(@aarch64_sve2_<sve_fp_op><SVE_FULL_HSF_FMMLA:mode><VNx16QI_ONLY:mode>): New instruction.
(@aarch64_sve2_<sve_fp_op><VNx4SF_ONLY:mode><VNx8HF_ONLY:mode>): Likewise.
* config/aarch64/aarch64.h (TARGET_F8F32MM): New macro.
(TARGET_F8F16MM): Likewise.
(TARGET_SVE_F16F32MM): Likewise.
* config/aarch64/iterators.md (insn): Add fmmla entry.
(VDQ_HSF_FMMLA): New iterator.
(SVE_FULL_HSF_FMMLA): Likewise.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp:
* gcc.target/aarch64/acle/vmmlaq_f16_mf8.c: New test.
* gcc.target/aarch64/acle/vmmlaq_f32_mf8.c: New test.
* gcc.target/aarch64/sve2/acle/asm/fmmla_f8f16mm_sve2.c: New test.
* gcc.target/aarch64/sve2/acle/asm/fmmla_f8f32mm_sve2.c: New test.
* gcc.target/aarch64/sve2/acle/asm/fmmla_sve_f16f32mm.c: New test.
* gcc.target/aarch64/sve/acle/general-c/mmla_1.c: Update error messages.

5 months agoarm: always enable both simd and mve builtins
Christophe Lyon [Fri, 9 May 2025 11:42:20 +0000 (11:42 +0000)] 
arm: always enable both simd and mve builtins

We get lots of error messages when compiling arm_neon.h under
e.g. -mcpu=cortex-m55, because Neon builtins are enabled only when
!TARGET_HAVE_MVE.  This has been the case since MVE support was
introduced.

This patch uses an approach similar to what we do on aarch64, but only
partially since Neon intrinsics do not use the "new" framework.

We register all types and Neon intrinsics, whether MVE is enabled or
not, which enables to compile arm_neon.h.  However, we need to
introduce a "switcher" similar to aarch64's to avoid ICEs when LTO is
enabled: in that case, since we have to enable the MVE intrinsics, we
temporarily change arm_active_target.isa to enable MVE bits.  This
enables hooks like arm_vector_mode_supported_p and arm_array_mode to
behave as expected by the MVE intrinsics framework.  We switch back
to the previous arm_active_target.isa immediately after.

With a toolchain targetting e.g. cortex-m55,
gcc.target/arm/attr-neon3.c now compiles successfully, with only one
failure to be fixed separately:
FAIL: gcc.target/arm/attr-neon3.c check-function-bodies my1

Besides that, gcc.log is no longer full of errors messages when trying
to compile arm_neon.h if MVE is forced somehow.

gcc/ChangeLog:

* config/arm/arm-builtins.cc (arm_init_simd_builtin_types): Remove
TARGET_HAVE_MVE condition.
(class arm_target_switcher): New.
(arm_init_mve_builtins): Remove calls to
arm_init_simd_builtin_types and
arm_init_simd_builtin_scalar_types.  Switch to MVE isa flags.
(arm_init_neon_builtins): Remove calls to
arm_init_simd_builtin_types and
arm_init_simd_builtin_scalar_types.
(arm_need_mve_mode_regs): New.
(arm_need_neon_mode_regs): New.
(arm_target_switcher::arm_target_switcher): New.
(arm_target_switcher::~arm_target_switcher): New.
(arm_init_builtins): Call arm_init_simd_builtin_scalar_types and
arm_init_simd_builtin_types.  Always call arm_init_mve_builtins
and arm_init_neon_builtins.

5 months agotestsuite: Only xfail gcc/testsuite/gcc.dg/vect/pr33804.c etc. on 32-bit SPARC [PR102954]
Rainer Orth [Fri, 9 Jan 2026 13:38:16 +0000 (14:38 +0100)] 
testsuite: Only xfail gcc/testsuite/gcc.dg/vect/pr33804.c etc. on 32-bit SPARC [PR102954]

Two tests currently XPASS on 64-bit Solaris/SPARC:

XPASS: gcc.dg/vect/pr33804.c scan-tree-dump-times vect "vectorized 1 loops" 1
XPASS: gcc.dg/vect/pr33804.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1

XPASS: gcc.dg/vect/slp-multitypes-3.c scan-tree-dump-times vect "vectorized 1 loops" 1
XPASS: gcc.dg/vect/slp-multitypes-3.c scan-tree-dump-times vect "vectorizing stmts using SLP" 2

Both tests are currently xfail'ed on sparc*-*-*.  The following patch
restricts that to 32-bit SPARC instead.

2026-01-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
PR tree-optimization/102954
* gcc.dg/vect/pr33804.c (scan-tree-dump-times): Only
xfail on 32-bit SPARC.
* gcc.dg/vect/slp-multitypes-3.c: Likewise.

5 months agoUpdate copyright years.
Tonu Naks [Tue, 6 Jan 2026 09:38:06 +0000 (09:38 +0000)] 
Update copyright years.

Co-authored-by: Marc Poulhiès <poulhies@adacore.com>
5 months agoAda: Fix suboptimal copy of discriminated record to local variable (2nd try)
Eric Botcazou [Fri, 9 Jan 2026 11:27:49 +0000 (12:27 +0100)] 
Ada: Fix suboptimal copy of discriminated record to local variable (2nd try)

This happens for a discriminated record type with default discriminants, for
which GNAT allocates mutable objects with the maximum size, while trying not
to copy padding bits unnecessarily.  When the padded size is small enough to
be copied efficiently, it should nevertheless be profitable to copy them in
order to avoid a call to memcpy with a dynamic size.

This version makes sure that it is safe to read the padded size on the RHS,
which is not the case for example when the LHS is an unconstrained variable
but the RHS is a constrained object.

gcc/ada
* gcc-interface/trans.cc (gnat_to_gnu): Add comment explaining why
it is necessary to remove the padding for an object of a type with
self-referential size when it is not converted to the result type.
* gcc-interface/utils2.cc (build_binary_op) <MODIFY_EXPR>: For an
assignment between small padded objects of the same type with self-
referential size, and which have the same (constant) size, use the
padded view of the objects.

5 months agoi386: Add OPTION_MASK_ISA_64BIT to 4 non-ia32 builtins [PR123489]
Jakub Jelinek [Fri, 9 Jan 2026 11:19:26 +0000 (12:19 +0100)] 
i386: Add OPTION_MASK_ISA_64BIT to 4 non-ia32 builtins [PR123489]

The following 4 builtins have corresponding insns guarded with TARGET_64BIT
and are only used in #ifdef __x86_64__ ... #endif section of an intrin
header, so when used by hand with -m32 they ICE.

Fixed thusly.

I've additionally verified all the #ifdef __x86_64__ ... #endif guarded
builtins used in intrinsic headers and checked whether they have
OPTION_MASK_ISA_64BIT, the only other exception was __builtin_ia32_prefetchi
but I think that one is fine, as expansion in that case has
            if (TARGET_64BIT && TARGET_PREFETCHI
                && local_func_symbolic_operand (op0, GET_MODE (op0)))
              emit_insn (gen_prefetchi (op0, op2));
            else
              {
                warning (0, "instruction prefetch applies when in 64-bit mode"
                            " with RIP-relative addressing and"
                            " option %<-mprefetchi%>;"
                            " they stay NOPs otherwise");
                emit_insn (gen_nop ());
              }

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

PR target/123489
* config/i386/i386-builtin.def (__builtin_ia32_cvttsd2sis64_round,
__builtin_ia32_cvttsd2usis64_round, __builtin_ia32_cvttss2sis64_round,
__builtin_ia32_cvttss2usis64_round): Require OPTION_MASK_ISA_64BIT.

* gcc.target/i386/pr123489.c: New test.

5 months agoada: Fix suboptimal copy of discriminated record to local variable
Eric Botcazou [Tue, 16 Dec 2025 11:30:14 +0000 (12:30 +0100)] 
ada: Fix suboptimal copy of discriminated record to local variable

This happens for a discriminated record type with default discriminants, for
which GNAT allocates mutable objects with the maximum size, while trying not
to copy padding bits unnecessarily.  When the padded size is small enough to
be copied efficiently, it should nevertheless be profitable to copy them in
order to avoid a call to memcpy with a dynamic size.

gcc/ada/ChangeLog:

* gcc-interface/trans.cc (gnat_to_gnu): For the LHS of an assignment
or an actual parameter of a call, do not remove the padding even for
a type of self-referential size when the padded size is small enough
to be copied efficiently.

5 months agoada: Move Save_Global_References_In_Aspects into sole caller
Eric Botcazou [Wed, 24 Dec 2025 19:35:39 +0000 (20:35 +0100)] 
ada: Move Save_Global_References_In_Aspects into sole caller

No functional changes.

gcc/ada/ChangeLog:

* sem_ch12.ads (Save_Global_References_In_Aspects): Move to...
* sem_ch12.adb (Save_Global_References_In_Aspects): Move to...
* contracts.adb (Save_Global_References_In_Contract): ...here.

5 months agoada: Improve fix for object with address clause and C++ constructor
Javier Miranda [Tue, 23 Dec 2025 19:05:33 +0000 (19:05 +0000)] 
ada: Improve fix for object with address clause and C++ constructor

Improves previous fix to handle an object that has an address clause
and it is initialized by C++ imported constructor call.

gcc/ada/ChangeLog:

* exp_ch3.adb (Expand_N_Object_Declaration): Remove previous patch
and place the call to the constructor into a compound statement
attached to the object; the compound statement will be moved to
the freezing actions of the object if the object has an address
clause.

5 months agoada: Fix crash on legality check for initialization of implicit constructor
Denis Mazzucato [Thu, 18 Dec 2025 12:34:18 +0000 (13:34 +0100)] 
ada: Fix crash on legality check for initialization of implicit constructor

This patch fixes a crash occurring during the legality check of the Initialize
aspect when the constructor is implicitly created by the compiler, e.g., the
default copy constructor. In such case, Corresponding_Spec is not available, the
Specification field must be used instead.

gcc/ada/ChangeLog:

* sem_ch13.adb (Check_Constructor_Initialization_Expression): The first
parameter of an implicit constructor comes from Specification, not
Corresponding_Spec.

5 months agoada: Fix small oversight in accessibility change
Eric Botcazou [Mon, 22 Dec 2025 09:52:01 +0000 (10:52 +0100)] 
ada: Fix small oversight in accessibility change

The change incorrectly turned a Comes_From_Source test initially done on the
type conversion node, into a test on its parent node, that is used to decide
whether to apply an accessibility check to the type conversion.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Type_Conversion): Restore Comes_From_Source
test on N itself instead of its parent node.

5 months agoada: Fix accessibility level of function calls in Ada 95
Eric Botcazou [Thu, 18 Dec 2025 23:57:28 +0000 (00:57 +0100)] 
ada: Fix accessibility level of function calls in Ada 95

This fixes the computation of the accessibility level in the default case.

gcc/ada/ChangeLog:

* accessibility.adb (Function_Call_Or_Allocator_Level): Return the
level of the subprogram in Ada 95 only in the case where the result
type is a return-by-reference type.

5 months agoada: Ada.Containers.Bounded_Indefinite_Holders follow-up.
Steve Baird [Fri, 19 Dec 2025 22:08:30 +0000 (14:08 -0800)] 
ada: Ada.Containers.Bounded_Indefinite_Holders follow-up.

Suppress warnings generated for a Bounded_Indefinite_Holders instance
when compiled for a 32-bit target. The warnings are not useful because
the construct being flagged is in code that is dead (for that instance).

gcc/ada/ChangeLog:

* libgnat/a-cbinho.ads: add Warnings pragmas.

5 months agoada: Fix fallout of latest accessibility change with -gnata
Eric Botcazou [Fri, 19 Dec 2025 17:24:45 +0000 (18:24 +0100)] 
ada: Fix fallout of latest accessibility change with -gnata

Compiling with assertion enabled may create _Wrapped_Statements functions
with access result, whose anonymous access result type is the same entity
as that of their parent function, which fools the accessibility logic.

gcc/ada/ChangeLog:

* accessibility.adb (Function_Call_Or_Allocator_Level): Adjust the
latest change to cope with _Wrapped_Statements functions.
* einfo.ads (Wrapped_Statements): Fix description.
* sem_util.adb (In_Return_Value): Fix typo in comment.

5 months agoada: Unsigned_Base_Range aspect (part 7)
Javier Miranda [Wed, 3 Dec 2025 19:37:53 +0000 (19:37 +0000)] 
ada: Unsigned_Base_Range aspect (part 7)

Add support for ELIMINATED and MINIMIZED overflow checking modes
on types with the Unsigned_Base_Range aspect (modes available
under switch -gnato).

gcc/ada/ChangeLog:

* checks.ads (Convert_From_Bignum): Add a new formal and update
documentation.
(Convert_To_Bignum): Update documentation.
* checks.adb (Is_Signed_Integer_Arithmetic_Op): Renamed as
Is_Overflow_Arithmetic_Op, and replace calls to function
Is_Signed_Integer_Type by calls to Has_Overflow_Operations.
(Apply_Arithmetic_Overflow_Minimized_Eliminated): Add support
for types with the Unsigned_Base_Range aspect.
(Apply_Divide_Checks): Replace calls to Is_Signed_Integer_Type
by calls to Has_Overflow_Operations.
(Compute_Range_For_Arithmetic_Op): Adjust comment.
(Convert_To_Bignum): Add support for types with the Unsigned_
Base_Range aspect.
(Convert_From_Bignum): Add support for result type with the
Unsigned_Base_Range aspect.
(Minimize_Eliminate_Overflows): Add support for types with the
Unsigned_Base_Range aspect.
* exp_ch4.adb (Minimized_Eliminated_Overflow_Check): Replace
call to Is_Signed_Integer_Type by call to Has_Overflow_Operations.
(Expand_Compare_Minimize_Eliminate_Overflow): Add support for types
with the Unsigned_Base_Range aspect.
(Expand_Membership_Minimize_Eliminate_Overflow): Ditto.
(Expand_N_Op_Expon): Ditto.
(Expand_Exponentiation): New subprogram.
* rtsfind.ads (RE_Id): Add RE_LLU_To_Bignum, RE_LLU_From_Bignum.
* libgnat/s-bignum.ads (LLU_To_Bignum): New subprogram.
(LLU_From_Bignum): New subprogram.
* libgnat/s-bignum.adb (LLU_To_Bignum): New subprogram.
(LLU_From_Bignum): New subprogram.
* libgnat/s-genbig.ads (From_Bignum): New overloaded functions
for Long_Long_Long_Unsigned and Long_Long_Unsigned types.
(To_Bignum): Ditto.
* libgnat/s-genbig.adb (From_Bignum): New overloaded functions
for Long_Long_Long_Unsigned and Long_Long_Unsigned types.
(To_Bignum): Ditto.
* libgnat/s-expuns.ads (Exp_Unsigned): Fix documentation.
* libgnat/s-expllu.ads (Exp_Long_Long_Unsigned): Ditto.
* libgnat/s-explllu.ads (Exp_Long_Long_Long_Unsigned): Add missing
documentation.

5 months agoada: Reimplement AI12-0345, AI12-0372 and implement AI12-0402
Eric Botcazou [Thu, 11 Dec 2025 15:14:32 +0000 (16:14 +0100)] 
ada: Reimplement AI12-0345, AI12-0372 and implement AI12-0402

The first two are binding interpretations, so apply to Ada 2012, and have
been only partially implemented.  The third is Ada 2022 and has not been
implemented, but is very convenient to tame the effects of the first two.

They mostly pertain to explicitly aliased parameters and to adjusting the
rules determining the master of a function call, so that the RM 6.4.1(6.4)
legality rule is applied judiciously.

The change also does some housekeeping work in the implementation of static
accessibility checks, plugging a few loopholes: in Ada 2005 for objects of
anonymous access types, in Ada 2005 and 2012 for conversions between access
types done in extended return statements, and in Ada 2012 for explicitly
aliased parameters.

gcc/ada/ChangeLog:

* accessibility.ads (Is_Special_Aliased_Formal_Access): Delete.
* accessibility.adb (Is_Special_Aliased_Formal_Access): Likewise.
(Accessibility_Level.Innermost_Master_Scope_Depth): Look for non-
package bodies and statements directly.
(Accessibility_Level.Function_Call_Or_Allocator_Level): For a
function call in a return context, return the extra level of the
master of the call only for dynamic checks.
(Accessibility_Level) <N_Defining_Identifier>: Always return the
library level for an explicitly aliased parameter in the context
of a return from the subprogram where it is declared.
* exp_ch4.adb (Expand_N_Allocator): Test manually whether the
context is a return statement instead of calling In_Return_Value.
(Expand_N_Type_Conversion): Do not apply accessibility checks to
actuals of a tagged type in a synthesized subprogram call.
* sem_attr.adb (Resolve_Attribute) <Access>: Remove specific test
for explicitly aliased parameters.
* sem_ch4.adb: Remove clauses for Accessibility package.
(Analyze_Call): Do not apply static accessibility checks here...
* sem_res.adb (Resolve_Actuals): ...but here instead.  Implement
a generalized form of AI12-0402.
(Valid_Conversion): Apply static accessibility checks in extended
return statements too.
* sem_util.ads (In_Return_Value): Adjust description.
(Is_Master): Delete.
* sem_util.adb (Is_Explicitly_Aliased): Reindent.
(In_Return_Value): Reimplement.
(Is_Master): Delete.

5 months agoada: Add quickfixes for -gnawk warnings
Viljar Indus [Fri, 12 Dec 2025 13:18:02 +0000 (15:18 +0200)] 
ada: Add quickfixes for -gnawk warnings

gcc/ada/ChangeLog:

* errout.adb (Insert): New function to create an insertion fix.
(Deletion): New function to create a deletion fix.
* errout.ads: Likewise.
* sem_warn.adb (Create_Add_Constant_Fix): New function to create
a fix for adding a constant qualifier for a variable declaration.
(Change_In_Out_To_In_Fix): New function to create a fix for
convertinting an in out parameter direction to a an in direction.

Co-authored-by: Eric Botcazou <ebotcazou@adacore.com>
5 months agoada: Update GNAT RM after implementing Indefinite_Holders
Tonu Naks [Wed, 17 Dec 2025 12:06:32 +0000 (12:06 +0000)] 
ada: Update GNAT RM after implementing Indefinite_Holders

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_of_ada_2022_features.rst: update
AI12-0350, add AI12-0254.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

5 months agoada: Set thread description on Windows
Ronan Desplanques [Tue, 16 Dec 2025 14:28:48 +0000 (15:28 +0100)] 
ada: Set thread description on Windows

On Windows, the tasking runtime now calls SetThreadDescription on the
underlying system threads with the task images as argument.

gcc/ada/ChangeLog:

* adaint.c (__gnat_set_thread_description): New function.
* libgnarl/s-taprop__mingw.adb (Enter_Task): Set thread description.
* rtinit.c (__gnat_runtime_initialize): Set up function pointer.
* mingw32.h (HRESULT, pSetThreadDescription): New.

5 months agoada: Fix parameterless constructors
Denis Mazzucato [Mon, 8 Dec 2025 13:09:12 +0000 (14:09 +0100)] 
ada: Fix parameterless constructors

This patch fix support for parameterless constructors. Specifically, it forbids calling the
parameterless constructor when no explicit one has been declared, and when the parameterless one has
been explicitly removed.

Furthermore, by freezing constructors as predefined operations, it is now possible to use them in
global object declarations right after the record type declaration.

gcc/ada/ChangeLog:

* exp_ch3.adb (Build_Init_Procedure): Remove call to constructors.
(Build_Default_Simple_Initialization): Implicit call to parameterless constructors in new
allocations.
(Expand_Freeze_Record_Type): Freeze constructors as we would freeze predefined operations.
(Constructor_Freeze): Freeze all constructors.
* sem_attr.adb (Analyze_Attribute): Handle missing parameterless constructors.
* sem_ch3.adb: The default constructor is now called parameterless.
* sem_util.adb (Find_Matching_Constructor): Return the constructor
matching the given condition. Before it was just checking its
existence.
(Has_Copy_Constructor): Move it upward to maintain alphabetic
order of utility subprograms.
(Has_Parameterless_Constructor): The default constructor is now called parameterless.
(Has_Explicit_Constructor): New utility to check for constructors
defined by the user. Used to understand if an implicit
parameterless constructor exists.
(Is_Copy_Constructor): Refactor easier control flow.
(Is_Parameterless_Constructor): New utility to check if a constructor has a profile
compatible with the parameterless constructor.
* sem_util.ads: Likewise.