Skip to content

[forge] Test https://forge.sourceware.org/gcc/gcc-TEST/pulls/161/#4562

Draft
CohenArthur wants to merge 553 commits into
Rust-GCC:masterfrom
CohenArthur:intrinsics/atomic-exchange
Draft

[forge] Test https://forge.sourceware.org/gcc/gcc-TEST/pulls/161/#4562
CohenArthur wants to merge 553 commits into
Rust-GCC:masterfrom
CohenArthur:intrinsics/atomic-exchange

Conversation

@CohenArthur
Copy link
Copy Markdown
Member

This PR should be merged on the forge and not here, but I think it's still worth it to have our CI test it. Pinging @0xllx0

Jeff Law and others added 30 commits May 14, 2026 07:19
Bootstraps on RISC-V recently started failing due to an unused parameter.  I've
only lightly tested this, but it should restore bootstrapping.  Pushing to the
trunk.

gcc/
	* config/riscv/riscv-v.cc (expand_const_vector_stepped): Drop unused
	SRC parameter. All callers changed.
	(expand_const_vector_interleaved_stepped_npatterns): Likewise.
	(expand_const_vector): Corresponding changes.
The components that used __type_identity in C++20 mode (due source
compatibility with older standard) lead to instantiation of separate
class template from std::type_identity for each used type. This
patch makes __type_identity an alias to type_identity if the latter is
available.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__type_identity, __type_identity_t)
	[__cpp_lib_type_identity]: Define as alias to type_identity
	and its nested type respectively.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Copy the a ^ b ^ (a | c) => (c & ~a) ^ b optimization from RISC-V zbb
(r17-241) as we have the andn instruction in LA64 and LA32S.

	PR rtl-optimization/96692

gcc/

	* config/loongarch/loongarch.md (define_split): New splitters
	turning a ^ b ^ (a | c) => (c &~ a) ^ b.

gcc/testsuite/

	* gcc.target/loongarch/pr96692.c: New test.
This patch implements some checks on different interfaces to the same
C binding functions. It contains a few policy changes, and is somewhat
more permissive than the standard, but there are no constraint
violations (to my knowledge) that it misses.

Apart from checking for standards conformance, this should also
help proof code against (now or future) type-based aliasing mishaps.

Checks for global identifiers are performed on a case-insensitive
basis by default, and only sensitive when -pedantic is in force.
This makes sense if Fortran code wants to interface to "FOO" and
"foo".  The restriction to case-insensitive labels comes from a time
when relevant systems had linkers which were case-insensitive, and
it is not possible to implement C (especially the C versions referenced
in the standard) with such a linker.

Return types of functions, ranks, number, type and rank of arguments
are checked. In non-pedantic mode, arguments which have the same
prototype on the C side are permitted, for example passing a scalar
or an array by reference, or arrays of different rank (both for pass
by reference and pass by descriptors). Assumed types are also
assumed to bee OK. This functionality was checked in a few test
cases, so it would make little sense to remove it.

C_PTR is *not* compatible with a random argument passed by reference.
For example, a TYPE(C_PTR), VALUE argument is not compatible
with an INTEGER argument (without VALUE); C_LOC has to be used.

The one-liner in decl.cc may fix some ENTRY problems, I didn't check.

gcc/fortran/ChangeLog:

	PR fortran/125092
	* decl.cc (add_global_entry): Use string from the heap instead
	of a pointer to stack-allocated memory.
	* frontend-passes.cc (check_against_globals): If there is an error
	already, return early.
	* gfortran.h (gfc_symbol_rank): New prototype.
	* interface.cc (symbol_rank): Rename to
	(gfc_symbol_rank): this.
	(gfc_check_dummy_characteristics): Use new function name.
	(gfc_check_result_characteristics): Likewise.
	(gfc_compare_interfaces): Likewise.
	(compare_parameter): Likewise.
	(get_sym_storage_size): Likewise.
	(gfc_procedure_use): Likewise.
	* resolve.cc (decays_to_pointer): New function.
	(c_types_conform): New function.
	(compare_c_binding_arglists): New function.
	(gfc_verify_binding_labels): Check return types and rank
	plus argument lists if there is a pre-exisiting global
	symbol.

gcc/testsuite/ChangeLog:

	PR fortran/125092
	* gfortran.dg/PR100906.f90: Add -Wno-pedantic to options.
	* gfortran.dg/PR100911.f90: Likewise.
	* gfortran.dg/PR100915.f90: Likewise.
	* gfortran.dg/PR94327.f90: Likewise.
	* gfortran.dg/PR94331.f90: Likewise.
	* gfortran.dg/bind_c_procs_4.f90: Add error messages, remove
	warning.
	* gfortran.dg/binding_label_tests_25.f90: Add error messages.
	* gfortran.dg/binding_label_tests_3.f03: Add error messages.
	* gfortran.dg/binding_label_tests_34.f90: Add -Wno-pedantic to
	options.
	* gfortran.dg/c_char_tests_4.f90: Likewise.
	* gfortran.dg/c_char_tests_5.f90: Likewise.
	* gfortran.dg/binding_label_tests_36.f90: New test.
	* gfortran.dg/binding_label_tests_37.f90: New test.
This commit adds a check for the following 'declare mapper restriction:
"At least one map clause that maps var or at least one element of var is
 required."

It additionally fixes a bug in the map-decay code, which did not handle
map modifiers like 'always' when specified in the declare mapper's map
clause.

For C++, some checks are now also run when templates are involved.
Additionally, it turned out that the internal use of constexpr caused
bogus errors when compiled with -std=c++98; therefore, a sorry is now
shown. Solution is to use -std=c++11 or higher.

gcc/c-family/ChangeLog:

	* c-omp.cc (omp_map_decayed_kind): Handle map modifiers
	also for declare-mapper's map clauses.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_declare_mapper): Check that the
	struct var is actually used by at least one map clause.

gcc/cp/ChangeLog:

	* semantics.cc (cp_check_omp_declare_mapper): Change what
	argument is expected; check that the struct var is used by at
	least one map war. Print sorry when compiling with -std=c++98.
	* pt.cc (tsubst_stmt, tsubst_expr): Call it.
	* parser.cc (cp_parser_omp_declare_mapper): Update call.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/declare-mapper-10.c: Exclude C++98.
	* c-c++-common/gomp/declare-mapper-15.c: Likewise.
	* c-c++-common/gomp/declare-mapper-16.c: Likewise.
	* c-c++-common/gomp/declare-mapper-3.c: Likewise.
	* c-c++-common/gomp/declare-mapper-4.c: Likewise.
	* c-c++-common/gomp/declare-mapper-5.c: Likewise.
	* c-c++-common/gomp/declare-mapper-6.c: Likewise.
	* c-c++-common/gomp/declare-mapper-7.c: Likewise.
	* c-c++-common/gomp/declare-mapper-8.c: Likewise.
	* c-c++-common/gomp/declare-mapper-9.c: Likewise.
	* g++.dg/gomp/declare-mapper-1.C: Likewise.
	* g++.dg/gomp/declare-mapper-2.C: Likewise.
	* c-c++-common/gomp/pr122866.c: Expect sorry with C++98.
	* c-c++-common/gomp/declare-mapper-11.c: Likewise.
	Add dg-error for missing var-in-map-clause use.
	* g++.dg/gomp/declare-mapper-3.C: Likewise.
	* c-c++-common/gomp/declare-mapper-17.c: New test.
	* c-c++-common/gomp/declare-mapper-18.c: New test.
	* g++.dg/gomp/declare-mapper-4.C: New test.
	* g++.dg/gomp/declare-mapper-5.C: New test.
Add explicit assembler mode for cases when the argument is not
unambigious. This avoids cases where a user specified 64bit ptwrite
ends up being 32bit due to an ambigious argument.

	PR target/124316

gcc/ChangeLog:

	* config/i386/i386.md (ptwrite): Add explicit mode to
	instruction.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr124316.c: New test.
Various reflection queries reject functions (or variables) with an
undeduced return type.  But this assumes return type deduction has
already been attempted which is not the case if the function is a
specialization that has not yet been ODR-used or otherwise instantiated,
which we must do now.  Similarly a function can also have an deferred
noexcept-specification which we should also instantiate at this point.

Rather an inventing a new way to resolve the type of such a function
or variable for reflection purposes, I think we can just silently call
mark_used in an unevaluated context, which will behave similarly to
requires { &decl; }.  Since diagnostics (in the immediate context) get
suppressed, we'll gracefully handle deleted functions or those with
unsatisfied constraints, leaving it up to the caller to handle them.

	PR c++/124628

gcc/cp/ChangeLog:

	* reflect.cc (resolve_type_of_reflected_decl): New.
	(get_reflection): Call resolve_type_of_reflected_decl instead
	of mark_used.
	(has_type): Call resolve_type_of_reflected_decl before
	checking for an undeduced auto.
	(eval_can_substitute): Likewise.  Also look through BASELINK.
	(members_of_representable): Call resolve_type_of_reflected_decl
	before checking for an undeduced auto.

gcc/testsuite/ChangeLog:

	* g++.dg/reflect/can_substitute2.C: New test.
	* g++.dg/reflect/members_of14.C: New test.
	* g++.dg/reflect/substitute3.C: Adjust test so that f<int>'s
	return type fails to get deduced.
	* g++.dg/reflect/type_of3.C: Also test type_of of a templated
	member function with deduced return type.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
Remove a stray debugging puts and an unused global declaration from
check_profiling_available. Neither affects the AutoFDO availability
check, as the wrapper path is already computed by profopt-perf-wrapper.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_profiling_available): Remove
	unused global declaration and debugging output.
Here we have one empty subobject inside another; we didn't create a
CONSTRUCTOR for the outer one, so we don't have it as context for the inner.

	PR c++/125315

gcc/cp/ChangeLog:

	* constexpr.cc (init_subob_ctx): Allow both ctor and object
	to be null for an empty subobject.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/no_unique_address16.C: New test.
Given the recent (data->flags && ff_genericize) vs.
(data->flags & ff_genericize) typo, I've looked at warning in similar
cases.
We don't warn for cases like that at all, clang/clang++ has
-Wconstant-logical-operand warning enabled by default.
Their behavior is:
1) only warns for rhs of &&/|| (why?)
2) don't warn if rhs is bool
3) for C++ warn if rhs is constant or folds into constant,
   for C warn if rhs is constant or folds into constant and
   that constant is not 0 or 1
4) I think it doesn't warn if rhs comes from a macro
The following patch implements similar warning with similar wording,
just provides the value of the constant, but
1) warns for lhs and rhs
2) doesn't warn if either lhs or rhs is bool
3) doesn't warn if lhs or rhs is or folds to constant 0 or 1
   (but does warn if it is constant 1 of enum type in an enum which
   has enumerator other than just 0/1 (i.e. poor man's boolean))
4) doesn't care if it comes from a macro or not
I think 64 && x is similarly suspicious to x && 64 and both
are likely to be meant 64 & x or x & 64.  I think having
&& 1 or && 0 is common even in C++, people don't always write
&& true or && false etc. and don't see why C++ would be different
in that from C, I think people sometimes write
 if (1
 #ifdef ABC
     && ABC
 #endif
 #ifdef DEF
     && DEF
 #endif
     && 1)
and similar (or similarly with 0/true/false or ||).  And the warning
is only enabled in -Wall, not by default.

2026-05-15  Jakub Jelinek  <jakub@redhat.com>

	PR c++/125081
gcc/
	* doc/invoke.texi (Wconstant-logical-operand): Document.
gcc/c-family/
	* c.opt (Wconstant-logical-operand): New option.
	* c.opt.urls: Regenerate.
gcc/c/
	* c-tree.h (parser_build_binary_op): Add ORIG_ARG1 argument.
	* c-typeck.cc (parser_build_binary_op): Likewise.  Emit
	-Wconstant-logical-operand warnings.
	* c-parser.cc (c_parser_binary_expression): Adjust
	parser_build_binary_op caller, pass to it the original
	stack[sp - 1].expr.value before c_objc_common_truthvalue_conversion.
gcc/cp/
	* typeck.cc (cp_build_binary_op): Emit -Wconstant-logical-operand
	warnings.
gcc/testsuite/
	* c-c++-common/Wconstant-logical-operand-1.c: New test.
	* c-c++-common/Wconstant-logical-operand-2.c: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: "Joseph S. Myers" <josmyers@redhat.com>
The following testcase tests that the consteval-only computation is not
quadratic.  With a loop of 50000 types, I believe this would be O(50000^2)
in the earlier implementation and so would timeout.

2026-05-15  Jakub Jelinek  <jakub@redhat.com>

	PR c++/125179
	* g++.dg/reflect/pr125179.C: New test.
Future work could optimize this on specific targets:
- ARM: lower to RBIT
- x86 with GFNI: lower to vgf2p8affineqb
  https://wunkolo.github.io/post/2020/11/gf2p8affineqb-bit-reversal/

2026-05-15  Disservin  <disservin.social@gmail.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR target/50481
	* builtin-types.def (BT_FN_UINT8_UINT8): New.
	* builtins.def (BUILT_IN_BITREVERSE8, BUILT_IN_BITREVERSE16,
	BUILT_IN_BITREVERSE32, BUILT_IN_BITREVERSE64): New builtins.
	* builtins.cc (expand_builtin, is_inexpensive_builtin): Handle
	bitreverse builtins.
	* fold-const-call.cc (fold_const_call_ss): Fold bitreverse builtins.
	* fold-const.cc (tree_call_nonnegative_warnv_p): Handle
	bitreverse builtins.
	* optabs.def (bitreverse_optab): New.
	* optabs.cc (expand_bitreverse): New function.
	(expand_unop): Use it for bitreverse_optab.
	* tree-ssa-ccp.cc (evaluate_stmt): Handle bitreverse builtins.
	* tree-ssa-phiopt.cc (empty_bb_or_one_feeding_into_p,
	cond_removal_in_builtin_zero_pattern): Likewise.
	* doc/extend.texi: Document __builtin_bitreverse{8,16,32,64}.
	* doc/md.texi (bitreverse<mode>2): Document.

	* gcc.dg/builtin-bitreverse-1.c: New test.
	* gcc.dg/builtin-bitreverse-2.c: New test.

Signed-off-by: Disservin <disservin.social@gmail.com>
IEEE min/max are not commutative and in the pattern
(define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
  [(set (match_operand:VFH 0 "register_operand" "=x,v")
        (unspec:VFH
          [(match_operand:VFH 1 "register_operand" "0,v")
           (match_operand:VFH 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
          IEEE_MAXMIN))]
the first operand is a register and only the second one is register/memory.
Now, the *minmax<mode>3_3 define_insn_and_split does
   rtx tmp = force_reg (<MODE>mode, operands[3]);
   rtvec v = gen_rtvec (2, tmp, operands[2]);
   operands[5] = gen_rtx_UNSPEC (<MODE>mode, v, u);
where operands[3] is the const0_operand, so operands[2] can there be
a memory, but in the *minmax<mode>3_4 case
   rtx tmp = force_reg (<MODE>mode, operands[3]);
   rtvec v = gen_rtvec (2, operands[2], tmp);
   operands[5] = gen_rtx_UNSPEC (<MODE>mode, v, u);
operands[2] goes into the operand which must be a REG, so it
is incorrect to split it into something that won't work.
Now, I've tried both disabling the define_insn_and_split and
the following patch, the former to the latter results in
        movaps  a, %xmm0
        pxor    %xmm1, %xmm1
-       cmpltps %xmm0, %xmm1
-       andps   %xmm1, %xmm0
+       maxps   %xmm1, %xmm0
        movaps  %xmm0, a
        ret
on the testcase, so I think it is better to match it and force_reg
(it is a pre-reload splitter) than change "nonimmediate_operand"
to "register_operand" because it won't match in that case.

2026-05-15  Jakub Jelinek  <jakub@redhat.com>

	PR target/125308
	* config/i386/sse.md (*minmax<mode>3_4): Force also
	operands[2] into a REG.

	* gcc.target/i386/pr125308.c: New test.
…forwarding

The following makes sure to preserve the alignment of the access
and not pick up that of parts of the address we forward.

	PR tree-optimization/125296
	* tree-ssa-forwprop.cc (forward_propagate_addr_expr_1):
	Preserve alignment of the original access.

	* gcc.dg/pr125206.c: New testcase.
The following simplifies the earlier RFC for making it easier
for the target to correlate multiple cost events created from
a single SLP operation.  Instead of changing where we record
costs this patch only adjusts the submission part.

Targets wanting to take advantage of this can implement
add_slp_cost and handle all or select cases and resort
to the default implementation to get add_stmt_cost events
for unhandled groups.

	* tree-vectorizer.h (vector_costs::add_slp_cost): New.
	* tree-vectorizer.cc (vector_costs::add_slp_cost): New
	default version.
	* tree-vect-slp.cc (add_slp_costs): Helper for dispatching
	a cost vector in SLP chunks.
	(vect_slp_analyze_operations): Adjust.
	(li_cost_vec_cmp): Likewise.
	(vect_bb_vectorization_profitable_p): Likewise.
The FMA folds in match.pd currently only matches (negate @0) directly.
When the negated operand is wrapped in a type conversion
(e.g. (convert (negate @0))), the simplification to IFN_FNMA does not
trigger.

This prevents folding of patterns such as:

*c = *c - (v8u)(*a * *b);

when the multiply operands undergo vector type conversions before being
passed to FMA. In such cases the expression lowers to neg + mla/mad
instead of the more optimal msb/mls on AArch64 SVE, because the current
fold cannot see through the casts.

Extend the match pattern to allow conversions on the negated
operand and the second multiplicand:

(fmas:c (nop_convert (negate @0)) @1 @2)

The fold rewrites the expression as:

convert (IFN_FNMA (convert:ut @0) (convert:ut @1) (convert:ut @2))

The match is restricted to nop_convert on the negated operand to avoid
folding through value-changing conversions. This enables recognition of
the subtraction-of-product form even when vector element type casts are
present.

The fold is only performed when signed overflow is unobservable for
both the outer FMA operation and the inner negation. This avoids
changing sanitized overflow behaviour when looking through the nop
conversion on the negated operand.

With this change, AArch64 SVE code generation is able to select msb/mls
instead of emitting a separate neg followed by mla/mad.

This patch was bootstrapped and regression tested on aarch64-linux-gnu.

	PR target/123924
gcc/
	* match.pd: Allow conversions in FMA-to-FNMA fold.

gcc/testsuite/
	* gcc.target/aarch64/sve/fnma_match.c: New test.
	* gcc.target/aarch64/sve/pr123897.c:
	Update the test to scan for FNMA in the tree dump.
This helps to optimize certain nested ternary operation producing -1, 0,
or 1 to slt[u]-slt[u]-sub.

gcc/

	* config/loongarch/loongarch.md (spaceship<mode>4): New
	define_expand.

gcc/testsuite/

	* gcc.target/loongarch/la64/spaceship.c: New test.
For 3 iterations of

    unsigned char flagbits;
    _877 = flagbits_832 + 254;
    _879 = (int) _877;
    # prephitmp_880 = PHI <_879(40), 6(41)>
    _70 = _68 >> prephitmp_880;

The peeled converted IV handling added in r16-3562 incorrectly analyzes
it as [6, 6 + 254, 6 + 254 * 2] instead of [6, 4, 2].  Then VRP uses the
intersect of {6, 560, 514} and {2, 4, 6}, i.e. {6} as the possible value
range, and propagates the constant 6 for _70.

Extend the step (for example, 254 => -2) to fix the issue.

	PR tree-optimization/125291

gcc/

	* tree-scalar-evolution.cc (simplify_peeled_chrec): Sign-extend
	the step for peeled converted IV.

gcc/testsuite/

	* gcc.c-torture/execute/pr125291.c: New test.
Use IANA name for ISO-8859-1 as "-fexec-charset=" and add dg-require-iconv,
to make sure it is supported.

libstdc++-v3/ChangeLog:

	* testsuite/std/format/debug_nonunicode.cc: Pass ISO-8859-1 as
	exec-charset and make sure that it is supported.
	* testsuite/std/format/fill_nonunicode.cc: Likewise.
Since the caller can save a register only if the register is enabled in
the caller, change caller_save_regs to return the enabled registers.

	PR rtl-optimization/125321
	* function-abi.cc (function_abi_aggregator::caller_save_regs):
	Return the enabled registers.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Add aarch64 SVE support and use -mavx2 for x86 to support all x86
modes.

Changes:
- Add aarch64-*-* target with -march=armv8.2-a+sve
- Use -mavx2 instead of -march=x86-64-v3 to support all x86 modes
- Separate -fgimple from architecture-specific options.

Reported-by: https://linaro.atlassian.net/browse/GNU-1901

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/slp-reduc-15.c: Add aarch64 support and use
	-mavx2 for x86.
In testing with GNU ld, I noticed that the HP-UX dynamic linker
doesn't support unaligned DW_EH_PE_absptr encodings.

2026-05-15  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.h (ASM_PREFERRED_EH_DATA_FORMAT): Use
	DW_EH_PE_aligned encoding on 64-bit HP-UX.
A compound statement didn't reset the musttail state after the statement
with the attribute, which led to bogus errors later. Always reset it.

	PR c/124532

gcc/c/ChangeLog:

	* c-parser.cc (struct attr_state): Add reset method.
	(c_parser_compound_statement_nostart): Rename a to astate.
	Reset state before iterating statements.

gcc/testsuite/ChangeLog:

	* c-c++-common/pr124532.c: New test.
This implements resolutions for LWG4131 and LWG3625 (also part of 4.8. section
of the P3016R6). As for any other issues LWG issue changes are applied as DR
for the oldest applicable standards:
* <optional> (LWG4131): C++26, since optional range support
* <stacktrace> (LWG3625): C++23, since introduction

libstdc++-v3/ChangeLog:

	* include/std/optional [__cpp_lib_optional_range_support]:
	Replace <bits/stl_iterator.h> include with <bits/range_access.h>.
	* include/std/stacktrace: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
This reverts the group_case_labels_stmt part of r8-546-gca4d2851687875.
This is placed in the wrong location to remove the case statements that go
directly to __builtin_unreachable. In fact the removal of the case statements
make us lose optimizations in some cases (Wuninitialized-pr107919-1.C for one).

Also this fixes PR 125290 by no longer leaving around a switch which just
has a default case.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/125290

gcc/ChangeLog:

	* tree-cfg.cc (group_case_labels_stmt): Remove code that was
	added to remove `cases` that goto blocks of unreachable.
	* tree-ssa-forwprop.cc (optimize_unreachable): Remove the
	comment about switch cases being handled.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wuninitialized-pr107919-1.C: Remove xfail.
	* gcc.dg/analyzer/taint-assert.c: Update for the non-removal
	of block containing unreachable.
	* gcc.dg/torture/pr125290-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wuninitialized-pr107919-1.C: Fix a dg-bogus.
The operands of a GIMPLE_SWITCH is index, followed by the cases.
The cases are all CASE_LABEL_EXPR which are skipped via operands_scanner::get_expr_operands
anyways so we only need to scan the index operand.
This also the first step in changing GIMPLE_SWITCH slightly.

gcc/ChangeLog:

	* tree-ssa-operands.cc (operands_scanner::parse_ssa_operands):
	Process index of the gswitch only.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Add a section for Git commit messages to the `.editorconfig` file, so
that editors with EditorConfig support will automatically format commit
messages according to the GNU style.

ChangeLog:

	* .editorconfig (COMMIT_EDITMSG): New section.
miranda-adacore and others added 30 commits May 25, 2026 10:28
gcc/ada/ChangeLog:

	* sem_util.adb (Is_Fully_Initialized_Variant): Moved inside
	subprogram Is_Fully_Initialized_Type.
	(Is_Fully_Initialized_Constrained_Array): New subprogram that
	factorizes code of Is_[Fully|Partially]_Initialized_Type.
	(Is_Fully_Initialized_Record_Type): New subprogram; add missing
	support for incomplete types.
	(Is_Partially_Initialized_Record_Type): New subprogram; add missing
	support for incomplete types.
	(Is_Partially_Initialized_Type): Add new formal for predicate checks.
	* sem_util.ads (Is_Partially_Initialized_Type): Add new formal for
	predicate checks.
	* sem_warn.adb (Type_OK_For_No_Value_Assigned): Use named parameters
	in call to Is_Partially_Initialized_Type.
	* sem_ch3.adb (Analyze_Object_Declaration): Add new actual for
	predicate checks.
…o saooaaat.

When a conditional expression is assigned to a saooaaat (that is, to a
stand-alone object of an anonymous access type), in some cases the
required dynamic accessibility check was not being performed.

gcc/ada/ChangeLog:

	* accessibility.adb (Needs_Accessibility_Level_Temp_Or_Check): Conform
	to spec changes. Return True for the RHS of an assignment statement.
	* accessibility.ads: Change name of Is_Anonymous_Access_Actual
	to Needs_Accessibility_Level_Temp_Or_Check; the function now returns
	True in cases other than those described by the old name.
	Also change name of the formal parameter from N to Conditional_Expr.
	* exp_ch4.adb (Expand_N_If_Expression): Update call to a function
	whose name changed.
…l subprogram

The compiler may issue an error saying that a global entity referenced in
the precondition of a formal subprogram is not visible when the containing
generic is instantiated at a place where the entity is not directly visible.
This was due to the formal subprogram's contract not having been analyzed
in the generic template.  As a result, the nodes with global references were
not properly captured (by Save_Global_References).

An additional problem was exposed, which was that references within
contract aspect specifications of generic formals to other formals of the
same generic were not being properly analyzed/resolved, due to copying
the aspect specifications of the already-analyzed copy of the generic
formal when building subprogram wrappers for the contracts.  This could
lead to blowups in the back end due to references to the original formals
occurring in the expansion of the instantiation.  This is addressed by
copying the aspect specifications of the unanalyzed formals rather than
those that were analyzed in the copy of the generic template.

gcc/ada/ChangeLog:

	* contracts.adb (Analyze_Contracts): Add cases for formal subprogram
	Nkinds so that Analyze_Entry_Or_Subprogram_Contract will be called
	for them.
	* sem_attr.adb (Analyze_Attribute_Old_Result): Account for the cases
	of formal subprogram Nkinds, allowing Old attributes for those.
	* sem_ch12.adb (Build_Subprogram_Wrappers): Add a formal for passing
	the unanalyzed generic formal, and use it for copying any aspect
	specifications of the generic formal rather than copying the analyzed
	generic formal's aspects.
	(Analyze_One_Association): Pass Assoc.Un_Formal as an additional
	actual in the call to Build_Subprogram_Wrappers.
Add missing support for C++ constructor call passed as a generic
formal subprogram parameter.

gcc/ada/ChangeLog:

	* sem_ch3.adb (Analyze_Subtype_Declaration): Record subtypes
	inherit the CPP_Class attribute; required for instantiations.
…evel

This is a regression present in recent releases for the peculiar case of the
renaming of a controlled function call done at library level, which causes
the compiler to create a dangling reference to a temporary created on the
stack of the elaboration routine to hold the result of the function call.

gcc/ada/ChangeLog:

	* exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out for the name
	of an object renaming declaration at library level, if the call
	does not return on the secondary stack.
	* exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Rewrite the
	renaming as a regular object declaration if it is declared at
	library level and the name is a controlled function call whose
	result is not returned on the secondary stack.
	* exp_util.adb (Rewrite_Object_Declaration_As_Renaming): Minor fix.
They are exclusively about streamlining the implementation, so there should
be no functional changes.

gcc/ada/ChangeLog:

	* contracts.adb (Has_Public_Visibility_Of_Subprogram): Use Subp_Id
	throughout and Is_Expression_Function to spot expression functions.
	* ghost.adb (Is_OK_Declaration): Likewise.
	* sem_ch12.adb (Analyze_One_Association): Likewise.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Likewise.
	(Analyze_Subprogram_Specification): Fix typo.
	(Find_Corresponding_Spec): Call Is_Expression_Function.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Retrieve the expression
	by means of Expression_Of_Expression_Function.
	* sem_res.adb (Resolve_Allocator): Call Is_Expression_Function.
	(Rewrite_Renamed_Operator): Likewise.
	* sem_util.adb (Expression_Of_Expression_Function): Streamline the
	the implementation.
	(Is_Expression_Function): Likewise.
This patch improve the analysis for the Initialize aspect in constructor bodies.
Specifically:
- Assignments based on the Initialize aspect are always placed at the end of the
  constructor prologue, otherwise they could be overwritten depending on the
  original order of components.
- Introduce the "others" default choice for the Initialize aggregate.
- Improve diagnostics when the Initialize aspect is clearly misspelled.
- Flag components that are required to be initialized but are missing from the
  Initialize aspect.
- Check whether aggregate choices refer to ancestors, which is not allowed.

gcc/ada/ChangeLog:

	* exp_ch3.adb (Build_Implicit_Parameterless_Constructor): Add Initialize
	aspect with default others to trigger Initialize aspect analysis.
	* exp_ch6.adb (Prepend_Constructor_Procedure_Prologue): Fix
	initialization order.
	(Init_From_Initialize_Expression): Retrieve initialization expression or
	the default one base on the Initialize aspect.
	(Init_From_Default_Or_Constructor):. Retrieve initialization expression
	based on the default one in the record initialization list or the init
	procedure.
	* sem_ch13.adb (Analyze_Aspect_Specifications): Add check for
	missing components that require initialization, and add an
	expression_with_action node to place ABE during resolution of
	aggregates with function calls.
	(Check_Constructor_Choices): Helper to check that the aggregate choices
	do not refer to ancestors.
	(Diagnose_Misplaced_Aspects): Improve diagnostics when it is a clear
	misspelling of Initialize aspect.
	* sem_ch6.adb (Analyze_Direct_Attribute_Definition): If missing, add a
	compiler generated Initialize aspect with default others to trigger
	Initialize analysis.
Ensure that an Assertion_Level is assigned when Ghost => True is
used for Abstract_State.

Add an error if Ghost => False is used on an Abstract_State within
a ghost pacakage.

Add an error if the expression used for Ghost is not static.

gcc/ada/ChangeLog:

	* sem_prag.adb (Analyze_Abstract_State): Improve handling of
	True/False for Abstract_State with Ghost.
…nstances

While working on a visibility bug, it was noticed that preconditions
on formal subprograms are not being checked on calls to the subprograms
within package instantiations.  The wrapper subprogram that is created to
perform the check (and invoke the actual subprogram) was not being used
as the target of calls, and the actual subprogram is being called instead
(bypassing the check).  This was due to the subprogram renaming created
(for the actual-to-formal association) and the wrapper being homographs,
and the loop over interpretations in Collect_Interps happening to resolve
calls to the actual instead of the wrapper.  This wrong resolution is
avoided by removing the homographic subprogram renaming, so that the
resolution can only resolve to the wrapper (which will only include
the precondition check in the case where assertions are enabled).

gcc/ada/ChangeLog:

	* sem_ch12.adb (Build_Subprogram_Wrapper): Remove the subprogram
	renaming created for the formal-to-actual association from the
	list of renamings (only when such a subprogram renaming is present).
	Also, change the name from plural to singular, since the procedure
	only creates one wrapper, update the spec comment to reflect that,
	and clarify the state and use of the Renamings parameter.
…constant

The tweak is to add the name of the constant to the error message.  That's
a minor improvement in this simple case, but it will help for the same error
in a more complex case.

gcc/ada/ChangeLog:

	* sem_res.adb (Resolve_Entity_Name): Add the name of the constant
	to the error message for premature freezing of deferred constants.
Replacing the original expression by Expression_Of_Expression_Function is
not fully equivalent because Expression_Of_Expression_Function returns the
Original_Node of the expression.

gcc/ada/ChangeLog:

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Retrieve again the
	expression of the expression function manually.
…ed package

This addresses a long-standing issue in the implementation of expression
functions of Ada 2012, pertaining to their interaction with the freezing
of types that are referenced in their expression: when they are used as
the completion of a function declaration, their expression causes these
types to become frozen, but when they are stand-alone, it does not.

The last rule is problematic for GNAT, because it goes against its freezing
model devised for Ada 95, where types must always be frozen for code to be
generated.  Therefore the current implementation needs to resort to several
kludges in order to implement it, but these are not bullet proof and do not
always work when tagged types are involved.

The new approach is to insert the generated body of stand-alone expression
functions at the next freezing point, instead of at the end of the current
package.  This makes a difference for nested packages, which are precisely
the problematic case.  This requires the analysis and resolution performed
on the body, potentially out of context now, to give identical results as
the preanalysis and resolution performed on the expression in its context,
which is achieved by treating the generated body as an inlined body.

This approach requires a more complete implementation of the special rules
for freezing expression functions, so the change overhauls it and plugs the
most blatant loopholes of the current implementation.

gcc/ada/ChangeLog:

	PR ada/93702
	* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): Call
	Freeze_Expr_Types_Before instead of Freeze_Expr_Types.
	(Process_Preconditions_For): Likewise.
	* exp_ch3.adb (Make_Controlling_Function_Wrappers): Do not set
	Was_Expression_Function flag on the generated bodies.
	* exp_ch6.adb (Expand_Call_Helper): Call Original_Node on the
	result of the call to Expression_Of_Expression_Function.
	* freeze.ads (Freeze_Expr_Types): Delete.
	(Freeze_Expr_Types_Before): New procedure declaration.
	* freeze.adb (Check_Expression_Function): Delete.
	(Freeze_And_Append): Add Do_Freeze_Profile formal parameter and
	pass it to Freeze_Entity.  Remove call to Check_Expression_Function.
	(Freeze_Entity): Set Test_E consistently and freeze the expression
	of expression functions that are primitives of a tagged type.
	(Freeze_Profile): Adjust calls to Should_Freeze_Type.
	(In_Expanded_Body): Also return true for DIC procedures.
	(Freeze_Expression): Remove call to Check_Expression_Function.
	Freeze the expression of expression functions.
	(Freeze_Expr_Types): Add Result and Before formal parameters.
	Make a copy and preanalyze/resolve it only if Typ is present.
	(Freeze_Expr_Types.Explain_Error): New procedure.
	(Freeze_Expr_Types.Find_Incomplete_Constant): Likewise.
	(Freeze_Expr_Types.Check_And_Freeze_Type): Return immediately if
	the type is already frozen.  Report errors on N instead of Node.
	If Before is False, append the freeze nodes to Result.
	(Freeze_Expr_Types.Freeze_Type_Refs): Call Find_Incomplete_Constant.
	(Freeze_Expr_Types_Before): New procedure.
	(Should_Freeze_Type): Remove formal parameter E and
	specific kludge for stand-alone expression functions.
	* ghost.ads (Mark_And_Set_Ghost_Body_Of_Expression_Function): New
	procedure declaration.
	* ghost.adb (Mark_And_Set_Ghost_Body_Of_Expression_Function): New
	procedure body.
	* rtsfind.adb (RTE): Preserve and reset the In_Inlined_Body flag.
	(RTE_Record_Component): Likewise.
	* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Just call
	Freeze_Expression to freeze the expression of prefixes that are
	expression functions and remove obsolete implementation.
	* sem_ch3.adb (Analyze_Declarations): Adjust commentary.
	(Check_Completion): Also skip stand-alone expressions functions.
	* sem_ch4.adb (Analyze_Case_Expression): Always analyze the choices.
	* sem_ch6.adb: Add with and use clauses for Sem_Ch7.
	(Analyze_Expression_Function): Call Freeze_Expr_Types_Before instead
	of Freeze_Expr_Types for expression functions that are completions.
	For stand-alone expression functions, set In_Private_Part on the
	entity if it is in the private part, propagate the results of the
	resolution of the specification of the the declaration to that of
	the body and insert the body at the next freezing point.
	(Analyze_Subprogram_Body_Helper): Remove the machinery for masking
	and unmasking unfrozen types. For a stand-alone expression function,
	call Mark_And_Set_Ghost_Body_Of_Expression_Function, remove obsolete
	code dealing with the freezing of the spec, set In_Inlined_Body to
	True, make the full view of the private types of its scope visible
	if this is not the current scope and it is in the private part, and
	avoid making the spec immediately visible.
	(Analyze_Subprogram_Specification): Fix typo.
	(New_Overloaded_Entity): Set Has_Completion on a [generic] package
	that conflicts with the entity to prevent a cascaded error.
	* sem_ch7.ads (Is_Private_Base_Type): New function declaration moved
	here from...
	* sem_ch7.adb (Is_Private_Base_Type): ...here.  Remove.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Call Freeze_Expression
	to freeze the expression of expression functions, but only if the
	renaming comes from source.
	* sem_ch12.adb (Analyze_One_Association): Likewise, and remove the
	manual freezing for calls to them.
	* sem_res.adb (Resolve): Remove obsolete commentary.
	(Resolve_Call): Always freeze the expression of names that are
	expression functions.
	* sem_util.adb (Check_Fully_Declared): Add commentary and do not
	check types with private component declared outside of the current
	scope when it is a generic unit.
	(Expression_Of_Expression_Function): Return Expression directly.
	(Is_Inlinable_Expression_Function): Call Original_Node on the
	result of the call to Expression_Of_Expression_Function.
This patch adds support for C++ constructor calls in array aggregates.

gcc/ada/ChangeLog:

	* exp_ch5.adb (Expand_N_Assignment_Statement): Handle internally
	generated initialization invoking a C++ constructor.
This patch fixes a spurious error reported by the frontend when
a dispatching primitive of a tagged type has additional formals
with types that have the First_Controlling_Parameter aspect.

gcc/ada/ChangeLog:

	* sem_disp.adb (Check_Controlling_Formals): Formals of a type
	specifying aspect First_Controlling_Parameter are not candidate
	controlling parameters when they are not the first formal of
	the dispatching primitive.
The change unnecessarily prevents the profile of all dispatching operations
from being frozen by their subprogram body, which exposes a weakness in the
implementation of freezing for generic units.  This just reverts that part.

gcc/ada/ChangeLog:

	PR ada/93702
	* exp_ch3.adb (Make_Controlling_Function_Wrappers): Revert latest
	change.
	* sem_ch12.adb (Analyze_One_Association): Remove redundant line.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Freeze the profile
	again for bodies that are not generated from expression functions.
…ram type

As documented at the end of gen_il-gen-gen_entities.adb, E_Subprogram_Type
is part of Scope_Kind but, unlike what is said, it lacks Scope_Depth_Value.

gcc/ada/ChangeLog:

	* gen_il-gen-gen_entities.adb (E_Subprogram_Type): Add the missing
	Scope_Depth_Value field.
Rejectd the SPARK-specific exceptional contract pragmas Exceptional_Cases and
Exit_Cases when they are not compatible with the No_Raise GNAT-specific aspect.

gcc/ada/ChangeLog:

	* sem_prag.adb (Analyze_Exit_Contract): The Exception_Raised exit kind
	is not compatible with No_Raise.
	(Analyze_Pragma): The Exceptional_Cases pragma is not compatible with
	No_Raise.
When a main subprogram had its CPU or priority specified first by an aspect
specification and then by a corresponding pragma, then the pragma was silently
ignored. Now such a pragma is rejected.

gcc/ada/ChangeLog:

	* sem_ch13.adb (Analyze_Aspect_Specifications): Record aspect CPU and
	Priority applied to subprogram as a representation item.
The compiler should be allowing formal functions to be defaulted by
an expression when the core extensions are enabled, but it was
requiring all extensions to be enabled.

gcc/ada/ChangeLog:

	* par-ch12.adb (P_Formal_Subprogram_Declaration): Pass True for
	the Is_Core_Extension parameter on call to Error_Msg_GNAT_Extension.
The absence of Etype decoration is problematic for GNATprove, which
cannot use analyze to fill the blanks in the output.

gcc/ada/ChangeLog:

	* sem_util.adb (As_Boolean): utility to fill decoration in expressions
	(Determining_Condition): set Etype for generated Boolean connectors
	(Conditional_Evaluation_Condition): set Etype for generated connectors
AI12-0095-1 added a paragraph after RM 6.4.1(6.3/3), all the subsequent RM
references within 6.x may be off by one; this patch updates those references.

gcc/ada/ChangeLog:

	* sem_util.adb: Fix RM references.
	* sem_util.ads: Likewise.
	* sem_warn.adb: Likewise.
As documented in the GNAT RM, 'Img should behave like 'Image for objects.
The change fixes the problem and also implements more aggressive folding.

gcc/ada/ChangeLog:

	* sem_attr.adb: Add with and use clauses for Exp_Put_Image.
	(Eval_Attribute.Fold_Compile_Time_Known_Enumeration_Image): New
	procedure factored out from....
	(Eval_Attribute): ...here.  Attempt to fold 'Img and 'Image for all
	compile-time known values of enumeration, but not character, types,
	provided that Put_Image need not be called, by invoking the nested
	Fold_Compile_Time_Known_Enumeration_Image procedure on the value.
The former is a bit of a misnomer, since there is absolutely no leeway.

gcc/ada/ChangeLog:

	* exp_put_image.ads (Image_Should_Call_Put_Image): Rename into...
	(Image_Must_Call_Put_Image): ...this.
	* exp_put_image.adb (Image_Should_Call_Put_Image): Rename into...
	(Image_Must_Call_Put_Image): ...this.
	* exp_imgv.adb (Expand_Image_Attribute): Adjust to above renaming.
	(Expand_Wide_Image_Attribute): Likewise.
	(Expand_Wide_Wide_Image_Attribute): Likewise.
	* sem_attr.adb (Eval_Attribute): Likewise.
…rameters

The bottom line is that we need to suspend the B.3.3(23/2) rule during the
expansion of the equality function of an unchecked union itself containing
a component of an unchecked union type subject to a per-object constraint,
but this was done too broadly instead of specifically for this case.

gcc/ada/ChangeLog:

	* sem_util.adb (Prefix_Is_Formal_Parameter): Rename into...
	(Prefix_Is_Formal_Parameter_Of_EQ): ...this.  Return True only if
	the formal parameter is that of an equality function built for an
	unchecked union type.
	(Has_Inferable_Discriminants): Adjust to above renaming.
This implements additions from sections 4.3, 4.4, 4.5 of P3016R6.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (valarray): Define.
	* include/bits/version.h: Regenerate.
	* include/std/valarray: (__cpp_lib_valarray): Define.
	(valarray::begin, valarray::end, valarray::iterator)
	(valarray::const_iterator) [__glibcxx_valarray >= 202511L]: Define.
	(std::begin(valarray<_Tp>&), std::begin(const valarray<_Tp>&))
	(std::end(valarray<_Tp>&), std::end(const valarray<_Tp>&)): Define
	only if __glibcxx_valarray < 202511L (i.e. not defined).
	* include/bits/range_access.h (std::valarray)
	(std::begin(valarray<_Tp>&), std::begin(const valarray<_Tp>&))
	(std::end(valarray<_Tp>&), std::end(const valarray<_Tp>&)): Forward
	declare only if __glibcxx_valarray < 202511L (i.e. not defined).
	* testsuite/26_numerics/valarray/range_access3.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Nathan Myers <ncm@cantrip.org>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Follow up to r16-5508-g77b8221af8fc82; seemingly, a testcase never got
added - and the internal representation changed afther the code was
written. At least the previous code ICE'd for the included testcase.

	PR c/125377

gcc/ChangeLog:

	* omp-general.cc (omp_check_for_duplicate_variant): Fix used
	tree for 'inform' part of the error message.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/begin-declare-variant-1.c: New test.
The corresponding types are now trivially destructible, per changes
from P3074R7, see PR119059.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_constructible/value-2.cc:
	Adjust expected value for C++26 (__cpp_trivial_union >= 202502L).
	* testsuite/20_util/is_destructible/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_destructible/value.cc: Likewise.
…nts.

Insns that generate transparent __load_<size> calls can be simplified
using hard-reg constraints instead of explicit hard registers.
This handles __flash loads of 3-byte and 4-byte integral, floating point
and fixed-point values on devices without LPMx instruction.

	PR target/121343
gcc/
	* config/avr/avr.md (load_<mode>_libgcc): Rewrite to use
	a hard-reg constraint for operand 0.
	(gen_load<mode>_libgcc): Remove expander.
	(mov<mode>): No more special handling needed for sources that
	satisfy avr_load_libgcc_p.
The test cases ran into

    ld: undefined reference to `__fractunssapsi'
    ld: undefined reference to `__fractunspsisa'

etc. because the backend didn't implement these conversions.
The worker function that outputs fixed-point conversions inline,
avr_out_fract, is generic enough to handle 24-bit integral modes, so
adding PSImode to the mode iterators in avr-fixed.md fixes the issue.

	PR target/125409
gcc/
	* config/avr/avr-fixed.md (FIXED_A, FIXED_B): Add PSI to iterators.

gcc/testsuite/
	* gcc.target/avr/torture/pr125409.h: New file.
	* gcc.target/avr/torture/pr125409-fx24-ssk.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-ssr.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-suk.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-sur.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-usk.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-usr.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-uuk.c: New test.
	* gcc.target/avr/torture/pr125409-fx24-uur.c: New test.
Adds the `atomic_exchange` intrinsics for every memory ordering.

gcc/
	* rust/backend/rust-compile-intrinsic.cc: compile impl
	* rust/backend/rust-intrinsic-handlers.h: handler decls
	* rust/backend/rust-intrinsic-handlers.cc: handler impls
	* rust/util/rust-intrinsic-values.h: value defs

gcc/teststuite/
	* rust/execute/torture/atomic_exchange.rs: basic tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.