Piotr Trojanek [Thu, 7 May 2026 14:37:01 +0000 (16:37 +0200)]
ada: Basic support for a new SPARK attribute At
For now, only basic legality checks are present. Expansion is not ready yet.
This should be enough to start implementing the backend support in GNATprove.
gcc/ada/ChangeLog:
* exp_attr.adb (Expand_N_Attribute_Reference): Do not expand new
attribute.
* par-ch4.adb (Scan_Apostrophe): Parse 'At as an attribute reference;
otherwise, it would be parsed as a keyword.
* sem_attr.adb (Analyze_Attribute): Basic checks for new attribute.
(Eval_Attribute): New attribute will never be evaluated.
* snames.ads-tmpl: (Preset Names): "at" is now also an attribute, not
just a keyword.
(Attribute_Id): New attribute identifier.
Eric Botcazou [Wed, 6 May 2026 08:44:28 +0000 (10:44 +0200)]
ada: Fix bogus validity check failure for FP component of array with reverse SSO
It comes from a thinko in Sem_Util.In_Reverse_Storage_Order_Object: only the
innermost enclosing composite type needs to be considered by the predicate.
ada: Improve error message for premature record freezing
When a record is frozen it must be completely defined. This requires that
all of its components' types must also be completely defined
ARM 3.11.1 (8).
Before this patch, if a record was frozen while one of its components
was of a private type, the compiler complained that the record had a
private component, although privacy was not the root issue.
Now, the compiler states the actual problem directly: the type is not
completely defined.
gcc/ada/ChangeLog:
* freeze.adb (Check_And_Freeze_Type): Emit a more precise error
message when a component's frozen record is incompletely defined
instead of printing private component error.
* sem_util.ads (Incompletely_Defined): New function that
traverses recursively a type and returns the first incompletely
defined component or itself if it is incompletely defined.
* sem_util.adb (Incompletely_Defined): Likewise.
(Is_Incompletely_Defined): Refactor to a test of the new
Incompletely_Defined function for equality with Empty.
Eric Botcazou [Wed, 6 May 2026 16:52:59 +0000 (18:52 +0200)]
ada: Fix fallout of latest change to Valid_Scalars attribute
The attribute does not work for all private tagged types, but this was not
detected in the case where the full view alone is tagged.
gcc/ada/ChangeLog:
PR ada/124923
* exp_attr.adb (Expand_N_Attribute_Reference) <Valid_Scalars>: Also
bail out for a private type whose full view alone is tagged.
* sem_attr.adb (Analyze_Attribute) <Valid_Scalars>: Also warn for a
private type whose only full view alone is tagged.
Steve Baird [Fri, 1 May 2026 20:06:52 +0000 (13:06 -0700)]
ada: Avoid use-before-definition within library unit subprograms.
When the compiler builds a subprogram for an attribute (either Put_Image
or one of the streaming attributes), it needs to be inserted at a place
in the tree where all callers can refer to it.
In some cases involving library unit subprograms, that insertion point was
chosen incorrectly. Gigi would then fail an assertion while processing
a call to a procedure that had not yet been declared.
gcc/ada/ChangeLog:
* exp_attr.adb
(Expand_N_Attribute_Reference.Build_And_Insert_Type_Attr_Subp):
handle the case of a library unit subprogram body; do not assume
that every subprogram body has an enclosing declaration list.
Eric Botcazou [Sat, 2 May 2026 09:09:18 +0000 (11:09 +0200)]
ada: Fix internal error on private tagged types in instance with -gnateV
The problem is that the full view of a private tagged type, which is visible
in the generic unit, is not restored when expanding -gnateV in the instance.
The fix uses a two-pronged approach:
1. the Valid_Scalars attribute, on which -gnateV is piggybacked, is fixed
to properly handle tagged extensions (only the components declared in
the root type are currently tested for validity).
2. the special case for tagged extensions in instance bodies implemented
by Try_Selected_Component_In_Instance is extended to whole instances.
gcc/ada/ChangeLog:
PR ada/124923
* exp_attr.adb (Build_Record_VS_Func): Rename first parameter, fix
description and implement support for tagged extensions.
(Expand_N_Attribute_Reference) <Attribute_Valid_Scalars>: Also bail
out for the class-wide type of private tagged types and Adjust call
to Build_Record_VS_Func.
* sem_attr.adb (Analyze_Attribute) <Attribute_Valid_Scalars>: Also
warn for the class-wide type of private tagged types.
* sem_ch4.adb (Try_Selected_Component_In_Instance): Extend a special
case from instance bodies to whole instances.
* sem_util.ads (Validated_View): Adjust description.
* sem_util.adb (Validated_View): Do not recurse on the parent type
for tagged extensions.
ada: Support Constant_Reference in Iterable aspect
A Constant_Reference function returning an anonymous access-to-constant
type can be supplied instead of the Element primitive to allow
iteration over elements of a container.
gcc/ada/ChangeLog:
* exp_ch5.adb (Expand_Formal_Container_Element_Loop): Use
Constant_Reference instead of Element if necessary.
* sem_ch13.adb (Resolve_Iterable_Operation): Check Constant_Reference.
(Validate_Iterable_Aspect): Handle Constant_Reference if supplied.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Iteration over
elements of a container is allowed if Constant_Reference is supplied.
* sem_util.adb (Get_Iterable_Type_Primitive): Fix assertion.
* snames.ads-tmpl (Name_Constant_Reference): New name.
Javier Miranda [Thu, 30 Apr 2026 18:30:42 +0000 (18:30 +0000)]
ada: Allow limited type initialization via constructors
This patch extends the currrent support for constructors to support the
initialization of limited types.
gcc/ada/ChangeLog:
* errout.adb (Set_Msg_Node): Improve readability of message for
constructors name, replacing the internal compiler name
generated for direct attribute definitions with a nicer name.
* erroutc.ads (Replace_With_Attribute_Definition): Promote from
a nested subprogram declaration to a public package-level
declaration.
* erroutc.adb (Replace_With_Attribute_Definition): Move its
implementation to package level.
* exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Make]):
Code cleanup; handle assignment statement and limited type
object declaration.
* exp_ch3.adb (Build_Implicit_Parameterless_Constructor): Add
comment.
(Build_Default_Simple_Initialization): Add comment.
* exp_ch4.adb (Expand_N_Allocator): Fix No_Initialization for
internally generated allocators of types with constructors.
* exp_ch6.adb (Prepend_Constructor_Procedure_Prologue): Install
formals and refactor its body to be consistent with the GNAT
style.
* sem_ch3.adb (OK_For_Limited_Init_In_05): Accept T'Make since
it is semantically equivalent to a function call.
* sem_ch6.adb (Analyze_Direct_Attribute_Definition): Handle
incomplete and private type declarations.
* sem_ch13.adb (Diagnose_Misplaced_Aspects): Remove misleading
error for aspect 'Initializes.
* sem_res.adb (Resolve_Actuals): Skip check on the first actual
of init-proc and constructors because the constructor may be
invoked to initialize a constant object, which is allowed.
Johannes Kanig [Fri, 10 Apr 2026 00:06:45 +0000 (00:06 +0000)]
ada: Call back-end even in case of errors
In GNATprove mode, still invoke the back end when frontend compilation
errors are present, so the back-end has a chance to emit error messages
for SARIF report generation.
gcc/ada/ChangeLog:
* gnat1drv.adb (Gnat1drv): In GNATprove mode, call the
back end before exiting on compilation errors.
Jeevitha [Thu, 4 Jun 2026 06:52:08 +0000 (01:52 -0500)]
rs6000: Fix PTImode attribute handling [PR106895]
PTImode is used to generate even/odd register pairs for 128-bit values.
When PTImode is specified via a type attribute, compilation fails
because no internal type exists to represent this mode.
Introduce signed and unsigned PTImode internal builtin types to handle
PTImode. These __pti_internal types are not documented, as they are not
intended for direct user use.
Andrew Pinski [Thu, 4 Jun 2026 00:18:56 +0000 (17:18 -0700)]
match: Disable `if (cond) (A | CST1) : (A & ~CST1)` pattern for non-GIMPLE [PR125588]
r17-265-gf6f33ca83cb6b8 added a new pattern that converts:
cond ? (A | CST1) : (A & ~CST1)
into `(A & ~CST1) | (cond * CST1)` but fold (partly via
fold_binary_op_with_conditional_arg) will turn
that back into `cond ? (A | CST1) : (A & ~CST1)` in some
cases. In those cases we get an infinite loop and a stack overflow crash.
This fixes the problem by enabling this pattern for GIMPLE only.
Pushed as obvious after bootstrap/test on x86_64-linux-gnu.
PR middle-end/125588
gcc/ChangeLog:
* match.pd (`if (cond) (A | CST1) : (A & ~CST1)`): Enable
for GIMPLE only.
gcc/testsuite/ChangeLog:
* gcc.dg/pr125588-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Kevin Stefanov [Thu, 4 Jun 2026 04:46:02 +0000 (22:46 -0600)]
[PATCH v4] Replace certain uses of TEST_HARD_REG_BIT in loops with better alternatives
This change takes loops of the form:
for (int <i> = 0; <i> < FIRST_PSEUDO_REGISTER; <i>++)
if (TEST_HARD_REG_BIT (<set>, <i>))
<body that doesn't change i or set>
and carries out the necessary refactoring to rewrite them as:
hard_reg_set_iterator hrsi; [...]
EXECUTE_IF_SET_IN_HARD_REG_SET (<set>, 0, <i>, hrsi)
<body that doesn't change i or set>
in loops where expressing <set> does not involve <i>.
It also replaces the only two call sites of hard_reg_set_size
(which was internally using TEST_HARD_REG_BIT in such a loop)
with a call to hard_reg_set_popcount, as a popcount is all
that it was doing anyway. Thus, the now-unused function
hard_reg_set_size has been removed from the codebase.
Replaced one additional use of TEST_HARD_REG_BIT in such
a loop with a call to hard_reg_set_popcount.
---
Hi all,
I have made the improvements suggested by Jeffrey's review.
Thank you for that.
In v4, I remove the function hard_reg_set_size and
replace its only two call sites with calls to
hard_reg_set_popcount as Jeff suggested. Since this
is slightly different from the one recurring mechanical
refactoring I was doing so far everywhere else, but
still related to replacing TEST_HARD_REG_BIT in
loops with better alternatives, I've changed the
patch title to reflect that. The ChangeLog and commit
message have been updated too.
The formatting issues involving commas have been fixed
and I have dropped the gratuitous unrelated change
that Jeff pointed out in the review.
I also spotted some incorrect function names in my previous ChangeLog.
It was an oversight on my side. The git diff
command output shows the function name where the displayed
change dump begins, not the function being changed.
That became a source of confusion for me when the diff dump
begins at the end of the previous function's body as it appears
in the source file. I've corrected these ChangeLog entries.
Synced with trunk as of June 3rd, no merge conflicts.
Regstrapped on x86_64-pc-linux-gnu with enable-languages=c,c++.
This is my first contribution, so if anybody could push it for
me when it's ready, I'd appreciate it. Thanks.
gcc/
* config/m68k/m68k.cc (m68k_conditional_register_usage): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
(m68k_zero_call_used_regs): Likewise.
* config/pdp11/pdp11.cc (pdp11_conditional_register_usage): Likewise.
* ira-color.cc (create_new_allocno_hard_regs_node): Replace call to hard_reg_set_size
with hard_reg_set_popcount.
* ira-int.h (hard_reg_set_size): Remove.
* ira-lives.cc (process_bb_node_lives): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* ira.cc (setup_class_hard_regs): Likewise.
(update_equiv_regs_prescan): Likewise.
(build_insn_chain): Likewise.
(setup_stack_reg_pressure_class): Replace call to hard_reg_set_size
with hard_reg_set_popcount.
* lra-eliminations.cc (spill_pseudos): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* optabs.cc (expand_asm_reg_clobber_mem_blockage): Replace
TEST_HARD_REG_BIT with EXECUTE_IF_SET_IN_HARD_REG_SET in one instance
and with hard_reg_set_popcount in another.
* postreload.cc (reload_combine): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* reginfo.cc (init_reg_sets_1): Likewise.
* regrename.cc (init_rename_info): Likewise.
* reload1.cc (maybe_fix_stack_asms): Likewise.
(update_eliminables_and_spill): Likewise.
* rtl-ssa/insns.cc (function_info::record_call_clobbers): Likewise.
* sched-deps.cc (sched_analyze_insn): Likewise.
* sel-sched-dump.cc (print_hard_reg_set): Likewise.
Signed-off-by: Kevin Stefanov <kevinstefanov15@gmail.com>
Xiaomei Xue [Thu, 4 Jun 2026 02:42:12 +0000 (02:42 +0000)]
i386: Extend MOVNTDQ support to cover various packed integer types
As the associated mode iterator VI8 shows, MOVNTDQ is only used for
*QI and *DI packed integer modes, this patch extends it to cover *HI
and *SI packed integer modes.
gcc/ChangeLog:
* config/i386/sse.md (define_mode_attr sse2): Add V4SI/V8SI/V16SI/
V8HI/V16HI/V32HI.
(<sse2>_movnt<mode>): Change mode iterator from VI8 to VI_AVX_AVX512F.
(define_mode_iterator STORENT_MODE): Add V4SI/V8SI/V16SI/V8HI/V16HI/
V32HI/V16QI/V32QI/V64QI.
Patrick Palka [Wed, 3 Jun 2026 22:04:12 +0000 (18:04 -0400)]
c++: non-dep cmp op rewritten from <=> returning char [PR125378]
When a user operator<=> returns an integral type smaller than int, the
rewritten form of x @ y contains an integer promotion: (int)(x <=> y) @ 0.
This patch teaches build_min_non_dep_op_overload to look through and
preserve this implicit cast.
PR c++/125378
gcc/cp/ChangeLog:
* tree.cc (build_min_non_dep_op_overload): Handle comparison
operator expressions rewritten from a <=> that contain an
integer promotion.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/operator-8b.C: New test.
* g++.dg/lookup/operator-8c.C: New test.
* g++.dg/lookup/operator-9a.C: New test.
* g++.dg/lookup/operator-9b.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Marek Polacek <polacek@redhat.com>
Patrick Palka [Wed, 3 Jun 2026 22:03:14 +0000 (18:03 -0400)]
c++: unchecked 'A op B' constraint-expression [PR125490]
Here the nonsensical constraint-expression f() == 42 isn't getting rejected
ahead of time because when parsing we pass no_toplevel_fold_p=true to
cp_parser_binary_expression, which makes it use build_min instead of
build_x_binary_op, effectively bypassing the actual processing of the
operator expression until satisfaction time. This flag was introduced
by r145014 to avoid undesirable folding / canonicalization of OpenMP for
loop conditions, and that's still the only other user of the flag today.
But I think cp_parser_constraint_expression doesn't need to use this
flag at all because constraint-expression parsing is always templated
and we (generally) don't fold templated trees. I think the flag is
intended to be used only by OpenMP parsing routines.
Note that without this patch we'd go on to reject the constraint-expression
at satisfaction time, so this first testcase is effectively IFNDR / QoI.
But this change isn't limited to IFNDR cases, we need to process the
operator expression at parse time for sake of correct unqualified lookup
as in the second testcase.
PR c++/125490
gcc/cp/ChangeLog:
* parser.cc (cp_parser_constraint_expression): Pass
no_toplevel_fold_p=false instead of =true to
cp_parser_binary_expression.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-pr125490.C: New test.
* g++.dg/cpp2a/concepts-pr125490a.C: New test.
Henri Menke [Fri, 29 May 2026 18:09:05 +0000 (18:09 +0000)]
fortran: add INLINE and ALWAYS_INLINE attributes
gfortran already understands the !GCC$ ATTRIBUTES NOINLINE directive to
suppress inlining of a procedure, but there was no way to request the
opposite. This adds two attributes:
INLINE is a plain hint equivalent to the C inline keyword and only sets
DECL_DECLARED_INLINE_P, so the inliner's size limits still apply.
ALWAYS_INLINE corresponds to the C always_inline attribute and
additionally sets DECL_DISREGARD_INLINE_LIMITS. Since Fortran has no
inline keyword, DECL_DECLARED_INLINE_P is set explicitly. Setting only
DECL_DISREGARD_INLINE_LIMITS would make the middle-end warn that the
always-inline function might not be inlinable.
INLINE and ALWAYS_INLINE are incompatible with NOINLINE. In the
middle-end the DECL_UNINLINABLE flag set by NOINLINE always wins, so the
inline request would be silently ignored. To avoid that surprise the
directive parser warns and drops the inline attribute when both are
applied to the same procedure, whether in one directive or in two.
The new EXT_ATTR_* values are appended at the end of the enum because the
symbol_attribute.ext_attr bitmask is written to module files. Appending
preserves the existing bit positions and keeps modules written by older
gfortran readable.
Bootstrapped and regtested on x86_64-pc-linux-gnu with
--enable-languages=c,c++,fortran. All three stages built and the
stage 2 and 3 comparison succeeded. The gfortran testsuite shows no
regressions (75660 expected passes, 339 expected failures, 0 unexpected
failures) and the four new tests pass.
gcc/fortran/ChangeLog:
* gfortran.h (enum ext_attr_id_t): Add EXT_ATTR_INLINE and
EXT_ATTR_ALWAYS_INLINE at the end. Document that new attributes
must be appended to preserve module compatibility.
* decl.cc (ext_attr_list): Add "inline" and "always_inline".
(gfc_match_gcc_attributes): Warn about and drop INLINE or
ALWAYS_INLINE when combined with NOINLINE on the same symbol.
* trans-decl.cc (build_function_decl): Handle EXT_ATTR_INLINE and
EXT_ATTR_ALWAYS_INLINE by setting DECL_DECLARED_INLINE_P, and
DECL_DISREGARD_INLINE_LIMITS for ALWAYS_INLINE.
* gfortran.texi (ATTRIBUTES directive): Document INLINE and
ALWAYS_INLINE.
gcc/testsuite/ChangeLog:
* gfortran.dg/always_inline_1.f90: New test.
* gfortran.dg/always_inline_2.f90: New test.
* gfortran.dg/inline_1.f90: New test.
* gfortran.dg/inline_2.f90: New test.
cselim: Allow middle_bb to have more than one statement [PR124405]
Currently, cselim requires the middle_bb to have only a single statement. This
patch relaxes this restriction as long as all uses (except the rhs) in the
single stmatement are also available where we insert to.
Bootstrapped and tested on x86_64-linux-gnu and aarch64-linux-gnu.
Changes since v1:
* v2: Revert changes to trailing_store_in_bb and do not call
trailing_store_in_bb to get split_assign.
Remove some unnecessary checks in cselim_candidate.
Pass the result of cselim_candidate which is the candidate store for
cselim as an argument to cond_store_replacement instead.
* v3: Simplify cselim_candidate by always calling trailing_store_in_bb and
removing the legality checks.
Generalize the cond_store_replacement legality checks to account for the
case when the middle_bb can have more than one statement.
PR tree-optimization/124405
gcc/ChangeLog:
* tree-ssa-phiopt.cc (cond_store_replacement): Make ASSIGN (the
candidate store for cselim) an argument of the function instead. Update
legality check due to relaxing the restriction that middle_bb can have
only a single statement.
(cselim_candidate): New.
(pass_cselim::execute): Call cselim_candidate and pass the result to
cond_store_replacement.
Martin Uecker [Sun, 10 May 2026 18:21:40 +0000 (20:21 +0200)]
c23: fix TBAA error for function returning structure [PR125252]
To fix PR122572 we globbed pointers to structure or union types nested
within other structure or union types to a void pointer when computing
the TYPE_CANONICAL. But when doing this for function return types this
then leads to wrong aliasing decisions, because for some reason function
derivation behaves differently than pointer and array derivation. Instead
of globbing to void, replace the nested structure or union type with an
incomplete type instead.
PR c/125252
gcc/c/ChangeLog:
* c-typeck.cc (ptr_to_tagged_member): Return type of member.
(c_type_canonical): Use incomplete type.
Marek Polacek [Wed, 27 May 2026 17:23:49 +0000 (13:23 -0400)]
c++: reference tparm refers to temporary object [PR107124]
[temp.arg.nontype] tells us that a temporary object is not an acceptable
template-argument when the corresponding template parameter has reference
type. So
template<const int& CRI> struct B { };
B<1> b;
is ill-formed. In the test below we have a tparm `const int &I` and we
are trying to deduce `I` from `A<0>`. Since a temporary would be required
for the template argument, this should be a deduction failure.
PR c++/107124
gcc/cp/ChangeLog:
* cp-tree.h: Adjust comments to mention
maybe_build_nontype_implicit_conv instead of
maybe_convert_nontype_argument.
* pt.cc (maybe_convert_nontype_argument): Rename to...
(maybe_build_nontype_implicit_conv): ...this.
(convert_nontype_argument_maybe_dependent): New, factored
out of...
(convert_template_argument): ...here.
(unify) <case TEMPLATE_PARM_INDEX>: Call
convert_nontype_argument_maybe_dependent and return unify_invalid
if it failed. Don't call strip_typedefs_expr.
gcc/testsuite/ChangeLog:
* g++.dg/template/deduce11.C: New test.
* g++.dg/template/deduce12.C: New test.
Milan Tripkovic [Wed, 3 Jun 2026 17:33:20 +0000 (11:33 -0600)]
[PATCH v2] RISC-V: Add XuanTie C908 tuning and scheduler model
Add tuning definitions for the XuanTie C908 core, including a
scalar scheduler model.
The scheduler model describes the scalar integer, load/store, multiply,
divide, and floating-point pipeline resources. It is based on the
XuanTie C908 R1S0 User Manual.
This patch only models scalar scheduling. Vector scheduling is left for
future work (xt-c908v).
The scheduler model was tested on a CanMV-K230-V1.1 with CoreMark and a set
of instruction throughput tests.
The instruction throughput tests are essentially unrolled loops which
have groups of instructions (a group of adds and a group of fadd instructions
we are measuring for example) which use independent registers. For the
purpose of estimating the efficiency of scheduling such an unrolled loop,
the impact of reducing pipeline stalls on measured cycle counts is noticeable.
Each test uses aligned memory access. Before taking
measurements, the benchmark performs 20 warm-up runs. The measured test
is then executed 200 times.
On a CanMV-K230-V1.1 board, this tuning gives about a 0.8% CoreMark improvement.
The instruction throughput tests show cycle-count improvements of
about 5% to 17%.
Long-latency reservations are clamped to 7 cycles, following the existing
RISC-V scheduler modelling approach introduced by commit 8265192.
gcc/ChangeLog:
* config/riscv/riscv-cores.def (RISCV_TUNE): Changed xt-c908
PIPELINE_MODEL and TUNE_INFO
* config/riscv/riscv-opts.h (enum riscv_microarchitecture_type): Add entry
for xt-c908 design
* config/riscv/riscv.cc: New tune structure
for the xt-c908 design.
* config/riscv/riscv.md: Add xt-c908 .
Include xt-c908.md.
* config/riscv/xt-c908.md: New file.
Martin Uecker [Mon, 1 Jun 2026 18:57:09 +0000 (20:57 +0200)]
c: fix wrong code with counted_by attribute [PR123569]
For an access to a member of pointer type with counted_by attribute,
the .ACCESS_WITH_SIZE internal function is inserted at certain places
before reading the pointer. This leads to wrong code for increment
and decrement operations. For now, do not instrument these accesses
by using default_array_function_conversion instead of
default_array_function_read_conversion and calling mark_exp_read_
directly. Code to undo the effect of mark_exp_read can be removed,
and the logic is moved into a helper function mark_exp_read_cond.
PR c/123569
gcc/c/ChangeLog:
* c-parser.cc (mark_exp_read_cond): New function.
(c_parser_unary_expression): Use mark_exp_read_cond.
(c_parser_postfix_expression_after_primary): Likewise.
* c-typeck.cc (build_unary_op): Remove dead code and
add checking assertion.
gcc/testsuite/ChangeLog:
* gcc.dg/pr123569.c: New test.
Abhishek Kaushik [Wed, 27 May 2026 11:09:12 +0000 (11:09 +0000)]
tree-scalar-evolution: Fold loop PHIs with known nonzero niter
SCEV sometimes fails to compute the final value of a loop PHI when the
entry value does not match the value produced by later iterations. For
example:
# y = PHI <y_next, 666>
i_next = i + 1;
y_next = i_next * 10;
The PHI value is:
666, 10, 20, 30, ...
This is not a normal affine recurrence. But if the latch count is
known to be nonzero, the entry value cannot be the value seen after
the loop. The final value is the latch argument evaluated at iteration
niter - 1.
Teach SCEV final value replacement to handle this case.
This patch was bootstrapped and regression tested on aarch64-linux-gnu.
gcc/:
* tree-scalar-evolution.cc
(compute_final_value_from_loop_phi_latch): New function.
(final_value_replacement_loop): Use it.
gcc/testsuite/:
* gcc.dg/tree-ssa/sccp-loop-phi.c: New test.
* gcc.dg/tree-ssa/sccp-loop-phi-not-optimized.c: New test.
Andrew Pinski [Tue, 2 Jun 2026 20:21:11 +0000 (13:21 -0700)]
passes: Move early pass_sccopy right after evrp [PR103221]
EVRP changes some statements into copies but then does
not do copy prop during its handling. This causes in some
cases where phiopt could have optimized the phi not to be
done. So we should move the copy prop pass (sccopy) right
after evrp instead of after phiopt.
Notes on the testsuite changes:
dse-points-to.c needs to disable sccopy1 for the same
reason why it disables all other copyprop passes.
pr45397.c had an xfail for specifically PR 103221.
pr81981.c is about a missing warning, in this case moving
sccopy swaps around which uses is first in the list.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/103221
gcc/ChangeLog:
* passes.def (early_optimizations): Move sccopy
to after evrp.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/dse-points-to.c: Disable sccopy1.
* gcc.dg/tree-ssa/pr45397.c: Remove the xfail.
* gcc.dg/ubsan/pr81981.c: Swap around which one is xfailed.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Andrew Pinski [Tue, 2 Jun 2026 21:20:17 +0000 (14:20 -0700)]
sccopy: Handle ssa info for copies in sccopy
Currently if the ssa info (range or aliasing) is different
between the src and dest of a copy, sccopy will reject it.
This fixes the FIXME and handles it in a similar way as copyprop
handles it. This is needed to able to move sccopy earlier (before phiopt1)
and to act like a copyprop pass.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* gimple-ssa-sccopy.cc (stmt_may_generate_copy): Remove restriction
on the ssa info being different for the "copy".
(scc_copy_prop::replace_scc_by_value): Call maybe_duplicate_ssa_info_at_copy
when copyproping a ssa name.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Add the missing account names to the write-after section. All
contributors that have ever had an account on the sourceware machine(s)
are now covered. Only one entry remains that appears never to have had
an account.
ChangeLog:
* MAINTAINERS: Add all known missing account names to
write-after.
Jonathan Wakely [Thu, 21 May 2026 15:38:58 +0000 (16:38 +0100)]
libstdc++: Define feature test macros for hardened implementation
The P3471R4 and P3697R1 proposals adding hardened preconditions also
defined feature test macros that indicate whether the hardened
preconditions are checked. For our implementation, those checks are
enabled by defining _GLIBCXX_ASSERTIONS.
To implement this, I've added all the __cpp_lib_hardened_xxx macros at
the end of bits/version.def, because the simplest way to define many of
them seems to be to make the depend on the macro for the main feature
and additionally depend on defined(_GLIBCXX_ASSERTIONS).
The hardening checks were added to each component as follows:
This commit does not define __cpp_lib_hardened_mdspan, that was added in r17-1258-g19def756dec1fe earlier today.
This commit does not include the LWG 4577 changes to harden
view_interface::operator[] which will be added later (with a new value
for the __cpp_lib_hardened_view_interface macro).
Pan Li [Mon, 18 May 2026 09:46:05 +0000 (17:46 +0800)]
RISC-V: Add testcase for unsigned scalar SAT_MUL form 11
The form 11 of unsigned scalar SAT_MUL has supported from
the previous change. Thus, add the test cases to make sure
it works well.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u64.c: New test.
Pan Li [Mon, 18 May 2026 09:43:19 +0000 (17:43 +0800)]
Match: Support unsigned scalar SAT_MUL form 11
This patch would like to try to match the the unsigned
SAT_MUL form 11, aka below
#define DEF_SAT_U_MUL_FMT_11(NT, WT) \
NT __attribute__((noinline)) \
sat_u_mul_##NT##_from_##WT##_fmt_11 (NT a, NT b) \
{ \
WT x = (WT)a * (WT)b; \
NT max = -1; \
bool overflow_p = x >= (WT)(max); \
return -(NT)(overflow_p) | (NT)x; \
}
while WT is uint128_t, uint64_t, uint32_t and uint16_t, and
NT is uint64_t, uint32_t, uint16_t or uint8_t.
gcc/ChangeLog:
* match-sat-alu.pd: Add pattern for unsigned scalar
SAT_MUL form 11.
Jason Merrill [Wed, 3 Jun 2026 12:40:53 +0000 (08:40 -0400)]
c++/reflection: template splicing tweak
Discussion of the 124794 patch observed that access_path can be null if
object_type isn't derived from scope, which means building a nonsensical
BASELINK with null BASELINK_BINFO.
PR c++/124794
gcc/cp/ChangeLog:
* parser.cc (cp_parser_splice_specifier): Use TYPE_BINFO (scope)
for not-derived case.
* search.cc (build_baselink): Assert that binfos aren't null.
feedable [Wed, 3 Jun 2026 12:40:53 +0000 (08:40 -0400)]
c++/reflection: member function template splicing [PR124794]
cp_parser_splice_expression is stripping BASELINKs before resolving the
expr; checks if the result is a BASELINK after that (by which point it never
is). To fix it, stop stripping the BASELINK, add handling to
check_splice_expr instead.
In cp_parser_splice_specifier, the additional template param parsing fails
to detect that the reflection is a template if it's wrapped in a BASELINKs,
and decides not to parse the splice-specialization-specifier if the
'template' keyword is missing. Grab the data from the reflection instead.
During template instantiation, we blindly substitute the template part of a
TEMPLATE_ID_EXPR, even if it's a SPLICE_EXPR. This, in turn, substitutes the
SPLICE_EXPR as-if it had no template arguments and finishes up the
expression, which interferes with later processing by TEMPLATE_ID_EXPR. To
fix, we defer such TEMPLATE_ID_EXPRs to tsubst_splice_expr, which itself
performs the substitution of a TEMPLATE_ID_EXPR and finishes up the
expression.
check_splice_expr now also accepts TEMPLATE_ID_EXPRs in tsubst_splice_expr;
this is uniform with cp_parser_splice_expression, and required in order to
handle `template[:dep:]<>` where `dep` does not reflect a template.
PR c++/124794
PR c++/125069
gcc/cp/ChangeLog:
* parser.cc (cp_parser_splice_specifier): Do not strip BASELINKs.
(cp_parser_splice_expression): Add parsing for member function
template specializations without the "template" keyword.
* pt.cc (tsubst_splice_expr): Handle TEMPLATE_ID_EXPR where the
template part is a SPLICE_EXPR.
(tsubst_expr): Defer to tsubst_splice_expr when the template part of
TEMPLATE_ID_EXPR is a SPLICE_EXPR.
* reflect.cc (check_splice_expr): Add handling for BASELINKs.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/member19.C: Enable tests.
* g++.dg/reflect/splice15.C: New test.
* g++.dg/reflect/splice16.C: New test.
Tomasz Kamiński [Wed, 3 Jun 2026 10:04:51 +0000 (12:04 +0200)]
libstdc++: Define hardening FTM and update operator[] for mdspan
Defines __cpp_lib_hardened_mdspan.
The hardened precondition on the mdspan converting constructor,
is validated by the assert(_S_is_compatible_extents()) in the
_ExtentsStorge. This also covers user-defined mappings, as all
mappings are required to store, and thus construct extents
objects.
The operator[] implemented all required bounds checks, by:
* checking for negative values in __index_type_cast
* checking if value is representable in index_type in
__index_type_cast
* checking against the bound by calling __is_multi_index lambda
in operator[]
However, the last check subsumes the representability check
(static extent values are validated at compile time).
To reduce duplicated checks, this patch uses __index_int_t
(introduced in r16-7644-g43f7452026fc05 for mdspan::at), that
preserve negative values of arguments of integral type.
libstdc++-v3/ChangeLog:
* include/bits/version.def (hardened_mdspan): Define.
* include/bits/version.h: Regenerate.
* include/std/mdspan (__cpp_lib_hardened_mdspan): Define.
(mdspan::operator[]): Replace __mdspan::__index_type_cast
with cast to __index_int_t, and inline negative value checks.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
function-abi.h was originally added to cope with AArch64's
vector PCS and SVE PCS variants. One of the key requirements
was that a call insn must say precisely which ABI the callee uses,
regardless of how the call is created.
At the time, I did this by encoding the information as an UNSPEC
in the AArch64 call patterns. IIRC, there were three reasons for
doing it that way:
(1) To make sure that the information is not accidentally dropped.
(2) To make sure that calls using different ABIs are distinct
(not rtx_equal_p).
(3) Because it seemed presumptious to add a new CALL_INSN field for
something that only AArch64 was using.
However, CALL_INSN_FUNCTION_USAGE and SIBLING_CALL_P also require (1)
and at least SIBLING_CALL_P requires (2). I'm not aware that this
has been a common source of bugs in practice.
As far as (3) goes, RISC-V now uses a similar system, and x86 is
also about to use function_abi more heavily (see HJ's patches).
Any target that wants to run CPython efficiently will probably want
to implement preserve_none, and so adopt the same kind of approach.
If we take the view that having multiple ABIs is now going to be
common for "major" targets, attaching the information to the
CALL_INSN would be both simpler and more compact.
As it stands, targets have to smuggle the ABI information from
init_cumulative_args (which supplies the function type) through
function_arg (which asks the target for the final call operand)
to call/call_value/etc. (which receive the information from
function_arg). It's all a bit of a mess.
This patch therefore adds a new CALL_INSN_ABI_ID field to CALL_INSN
and removes the now-redundant insn_callee_abi hook.
This makes UNSPEC_CALLEE_CC unnecessary on RISC-V, so the patch
reverts the call patterns to something like their state before r14-3733-gfdd59c0f73e9e6 (which is in no way a comment against
that patch). In contrast, AArch64 still uses the ABI "cookie"
for other information, so it needs to be kept.
The patch reflows the CALL_INSN_FUNCTION_USAGE documentation but
otherwise just does s/@code{CALL_INSN_FUNCTION_USAGE}/This field/.
gcc/
* rtl.def (CALL_INSN): Add a new integer field.
* rtl.h (CALL_INSN_ABI_ID): New macro.
* target.def (insn_callee_abi): Delete.
* doc/rtl.texi: Document CALL_INSN_ABI_ID.
* doc/tm.texi.in (TARGET_INSN_CALLEE_ABI): Remove.
* doc/tm.texi: Regenerate.
* calls.cc: Include regs.h and function-abi.h.
(emit_call_1): Initialize CALL_INSN_ABI_ID.
* cfgcleanup.cc (old_insns_match_p): Compare CALL_INSN_ABI_IDs.
* emit-rtl.cc (try_split): Copy the original insn's CALL_INSN_ABI_ID
to the new call.
(emit_copy_of_insn_after): Likewise.
(make_call_insn_raw): Initialise CALL_INSN_ABI_ID.
* function-abi.cc (insn_callee_abi): Remove use of the insn_callee_abi
hook and instead use CALL_INSN_ABI_ID.
* recog.cc (peep2_attempt): Copy the original insn's CALL_INSN_ABI_ID
to the new call.
* config/aarch64/aarch64-protos.h (aarch64_gen_callee_cookie): Remove
arm_pcs parameter.
* config/aarch64/aarch64.cc (aarch64_gen_callee_cookie): Likewise.
(aarch64_callee_abi): Delete.
(aarch64_insn_callee_abi): Likewise.
(aarch64_function_arg): Update call to aarch64_callee_abi.
(aarch64_output_mi_thunk): Likewise. Set CALL_INSN_ABI_ID instead.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/aarch64/aarch64.md (tlsdesc_small_<mode>): Update call
to aarch64_callee_abi and set CALL_INSN_ABI_ID instead.
* config/i386/i386.cc (ix86_insn_callee_abi): Delete.
(ix86_expand_avx_vzeroupper): Set CALL_INSN_ABI_ID.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/riscv/riscv-sr.cc (riscv_remove_unneeded_save_restore_calls):
Remove coding convention from calls to gen_sibcall_internal and
gen_sibcall_value_internal. Store the ABI identifier in
CALL_INSN_ABI_ID instead.
* config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise.
(riscv_call_tls_get_addr): Likewise, but calling gen_call_value.
(riscv_function_arg): Return null for the end marker.
(get_riscv_cc, riscv_insn_callee_abi): Delete.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/riscv/riscv.md (UNSPEC_CALLEE_CC): Delete.
(sibcall): Revert to treating operand 2 as a placeholder.
Do not pass it to gen_sibcall_internal.
(sibcall_value): Likewise operand 3 and gen_sibcall_value_internal.
(call): Likewise operand 2 and gen_call_internal.
(call_value): Likewise operand 3 and gen_call_value_internal.
(sibcall_internal, call_internal): Remove operand 2.
(sibcall_value_internal, call_value_internal): Remove operand 3.
(untyped_call): Update call to gen_call.
The recover_from_error function calls a68_phrase_to_text in order to
get a descriptive text to emit in diagnostics. This text, however,
may contain format tags such as %< and %>, so it has to be passed to
a68_error as a format string, therwise the format tags are not
interpreted and get printed verbatim.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
* a68-parser-bottom-up.cc (recover_from_error): Use the output of
a68_phrase_to_text as format string so format tags are honored.
Alex Coplan [Thu, 28 May 2026 11:26:02 +0000 (12:26 +0100)]
aarch64: Make Uc[ij] constraints public
This promotes Uci and Ucj from internal to public constraints. They are
already both documented publically in LLVM [1] and we've had a request
from kernel folks who would like to make use of Ucj for saving/restoring
ZA contents [2].
Alex Coplan [Fri, 15 May 2026 15:48:24 +0000 (16:48 +0100)]
doc: Flesh out documentation for IFN_MASK_LOAD
Following the discussion here:
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716769.html
this expands the internal function documentation for IFN_MASK_LOAD to
spell out the signature of the function and explain how it relates to
the optab.
gcc/ChangeLog:
* doc/ifn.texi (Direct Internal Functions): Flesh out
documentation for IFN_MASK_LOAD.
* doc/md.texi (Standard Names): Add anchor for maskloadmn so it
can be cross-referenced.
In this PR, two values were simplified to the same phi, which in
turn was made redundant by other simplifications. The pass then
tried to delete the phi twice.
Tamar Christina [Wed, 3 Jun 2026 08:42:15 +0000 (09:42 +0100)]
vect: gate COMPLEX_MUL on FP_CONTRACT_FAST [PR125431]
The checks for FP_CONTRACT_FAST were in the wrong place for complex_mul.
The location it was in would only block FMA but not MUL. It would also not
really reject the forming of the FMA, it would just create an invalid collection
of nodes which would fail analysis later on.
However complex multiplication is also a contraction, since it's doing
real = a*c - b*d
imag = a*d + b*c
This moves the checks up to earliest possible location and actually just returns
and adds the missing check for FMS.
gcc/ChangeLog:
PR tree-optimization/125431
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches,
complex_fms_pattern::matches): Gate on FP contraction.
gcc/testsuite/ChangeLog:
PR tree-optimization/125431
* gfortran.dg/vect/pr125431.f90: New test.
In the change to enable vectorization without needing a scalar epilogue I
disabled the dominators update for prolog peeling with the assumption that since
I don't need to go to rewire the exits when we vectorize the main loop we don't
end up with the complicated merge block for which the updates were needed.
And indeed no test failed. But it turns out we now get a different form so the
updates are still needed. The merge block is still a mess so determining
manually who is the new dominator of whom is still quite difficult so I couldn't
simplify the updates.
This re-enabled dominator updates after prolog peeling.
Rainer Orth [Wed, 3 Jun 2026 08:05:10 +0000 (10:05 +0200)]
testsuite: Skip g++.dg/modules/pr120458-1 etc. on non-UCN targets
Two new tests FAIL on Solaris with the native assembler:
FAIL: g++.dg/modules/pr120458-1 -std=c++17 link
FAIL: g++.dg/modules/pr120458-1 -std=c++20 link
FAIL: g++.dg/modules/pr120458-1 -std=c++26 link
FAIL: g++.dg/modules/pr120458-2 -std=c++17 link
FAIL: g++.dg/modules/pr120458-2 -std=c++20 link
FAIL: g++.dg/modules/pr120458-2 -std=c++26 link
They don't assemble because as lacks UCN support:
Assembler: pr120458-1_a.C
"pr120458-1_a.s", line 3 : Syntax error
Near line: " .globl _ZW6영혼1fj"
[...]
Too many errors - Goodbye
Fixed by skipping the tests on non-UCN targets.
Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11 (as and gas), and
x86_64-pc-linux-gnu.
Gaius Mulley [Wed, 3 Jun 2026 08:00:20 +0000 (09:00 +0100)]
PR modula2/125512: Candidate for spell checking missed when using qualified ident
This bug fix checks the qualified ident processing for spell checking
candidates.
gcc/m2/ChangeLog:
PR modula2/125512
* gm2-compiler/P3Build.bnf (SubDesignator): Rewrite to
include spell checking.
gcc/testsuite/ChangeLog:
PR modula2/125512
* gm2.dg/spell/iso/fail/badmodule.mod: New test.
* gm2.dg/spell/iso/fail/badrecord.mod: New test.
* gm2.dg/spell/iso/fail/color.def: New test.
Tomasz Kamiński [Thu, 28 May 2026 06:37:33 +0000 (08:37 +0200)]
libstdc++: Add (generic_)display_string and (generic_)native_encoded_string to filesystem::path
Furthermore string and generic_string method as marked as deprecated
in C++26 mode.
This implements the P2319R5 "Prevent path presentation problem" paper,
with the rename of system_encoded_string from LWG4512,
"The system_encoded_string() and generic_system_encoded_string() member
functions of std::filesystem::path are misnamed".
The wording defines the display_string and generic_display_string
in terms of call of std::format with format string "{}" and "{:g}"
respectively. This patch inlines the effects of above, by either
returning native() or generic_string<value_type>() directly
(if value_type is char), or string constructed __unicode::_Utf_view
of above (when value_type is wchar_t).
As we currently assume that char encoding is always UTF-8, the outputs
of (generic_)native_encoded string and (generic_)display_string
are equivalent. However, the former may be adjusted in future.
Richard Biener [Tue, 2 Jun 2026 13:41:07 +0000 (15:41 +0200)]
tree-optimization/125477 - verify we can copy it before versioning an outer loop
The following fixes a hole in vectorizer loop versioning which tries to
version an outer loop that the versioning condition is invariant in but
fails to verify we can actually copy it.
PR tree-optimization/125477
* tree-vect-loop-manip.cc (vect_loop_versioning): Verify we
can duplicate an outer loop before considering to version it.
Andrew Pinski [Tue, 2 Jun 2026 20:05:06 +0000 (13:05 -0700)]
tree-core: Remove ENUM_BITFIELD from tree-core.h [PR125507]
This removes ENUM_BITFIELD from tree-core.h. GCC has been written in C++ for
years now. So enums can be bitfields. There is no reason for the macro.
This removes the macro usage from tree-core.h. The other uses can be removed
by others.
Note gengtype needed to support for tree_code to remove the extra enum that is added
for other others.
Jin Ma [Tue, 2 Jun 2026 13:38:43 +0000 (21:38 +0800)]
RISC-V: Remove dead code in riscv_sched_reorder
While investigating vsetvl ping-ponging cases recently, the ready
queue reordering hook riscv_sched_reorder was found to contain an
unconditional return that makes most of the body unreachable:
if (!last_vconfig.valid || *nreadyp == 1)
return riscv_issue_rate ();
The hook was introduced by commit 63632889651 ("[RISC-V] Reorder
ready queue slightly to avoid unnecessary vsetvl instructions"). It
is unclear whether the second return was intentional (e.g. left as a
temporary guard) or a leftover. Either way, since the surrounding
code is specifically designed to group instructions with the same
vector configuration and reduce vsetvl ping-ponging, the dead return
defeats the hook's stated purpose.
Remove the dead return so the reordering can actually run.
A quick look at the resulting fallout is benign: re-enabling the
reordering changes the vsetvl emission pattern for the zve64f
testcases pr111037-1.c, pr111037-4.c and pr113248.c. The reorder
now places vle64.v + vadd.vv (both with mode-derived SEW=64) before
vfmv.s.f (SEW=16), so the vsetvl pass emits
Both sequences contain two vsetvl insns, so the total switching cost
is unchanged. Updating the scan-assembler-times patterns to match
the new sequence therefore looks like a reasonable adjustment.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_sched_reorder): Remove dead
return after the early-return guard.
gcc/testsuite/ChangeLog:
PR target/111037
PR target/113248
* gcc.target/riscv/rvv/vsetvl/pr111037-1.c: Update vsetvl
patterns to match post-reorder asm sequence.
* gcc.target/riscv/rvv/vsetvl/pr111037-4.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/pr113248.c: Likewise.
The bitmap_element comments appear to have the left and right children
the wrong way around: prev is the left (lower index) and next is the
right (higher index).
gcc/
* bitmap.h (bitmap_element): Fix left/right distinction in comments.
backprop currently takes the shortcut of reusing SSA names when changing
their value. The original justification for this was that backprop only
makes changes that are acceptable to all (non-debug) users. It seemed
pointless to go to the trouble of creating a new SSA name, substituting
into all users, creating new SSA names for dependent statements that also
change value, and so on. Debug instructions could be dealt with using
insert_debug_temp_for_var_def, which would be needed in any case.
(This patch still uses insert_debug_temp_for_var_def.)
However, Robin's upcoming changes to support backpropagating nonzero
bits information runs into the problem that we also need to update
or invalidate range information. That update would spread to the
same places that an SSA rename would. Rather than fight the system
regarding cached information, it seemed better to go with the system
by creating new SSA names.
This is more complicated compared to the status quo, but maybe not
much more so than the status quo plus a flow-sensitive info update.
The change also allows an SSA name to be replaced by any gimple
value. That isn't often useful for the current pass, although
gcc.dg/tree-ssa/backprop-1.c gives an artificial example involving
phi nodes and gcc.dg/torture/pr116922.c gives an example in which
a division gets folded to 1. However, allowing general replacements
should be useful for Robin's work, which otherwise has to create new
assignments and leave other passes to propagate them away.
Hopefully the comments in the patch explain the approach.
gcc/
* gimple-ssa-backprop.cc: Update the comment at head of the file.
(var_info::new_value, var_info::seq): New member variables.
(var_info::var_info): Initialize them.
(remove_unused_var): Replace with...
(remove_dead_stmt): ...this new function.
(note_replacement): Delete.
(backprop::prepare_change): Likewise.
(backprop::complete_change): Likewise.
(backprop::set_new_value): New function.
(backprop::subst_operand): Likewise.
(backprop::finish_stmt): Likewise.
(backprop::optimize_builtin_call): Replace the lhs and info parameters
with a var_info parameter. Create a new statement rather than
changing the existing one.
(backprop::optimize_assign): Likewise.
(backprop::optimize_phi): Likewise.
(backprop::replace_assign_rhs): Likewise, but replace gassign and lhs
parameters.
(backprop::propagate_change): New function.
(backprop::commit_replacement): Likewise.
(backprop::execute): Update phase 3 for the above changes. Do not
alter the original statements during phase 3. If one SSA name
is scheduled to be replaced, also require all its users in m_vars
to be replaced. Add a new phase that performs the scheduled
replacements.
gcc/testsuite/
* gcc.dg/tree-ssa/backprop-7.c: New test.
backprop: Use a double worklist when propagating usage info
backprop does a post-order walk over SSA name definitions, recording
information about all uses. It makes optimistic assumptions about
backedge uses (i.e. uses that occur later in the post order),
then it iterates until a fixed point is reached.
Since the pass currently keeps single-bit information, this fixed point
should be reached after at most two passes: the initial walk and
(if necessary) a "fix-up" walk.
However, Robin's patch will add cases where more iterations might
be needed. This patch prepares for that by switching to a double-
worklist algorithm. Each pass through the worklist follows post order,
so that non-backedge uses are processed before definitions. Definitions
that occur later in the post order are added to the current worklist
and definitions that occur earlier are added to the next worklist.
To make this easier, the patch switches the worklist bitmaps from using
SSA_NAME_VERSION to using m_vars indices (which in any case should be
slightly denser). Since m_vars also follows post order, we can use
bitmap_clear_first_bit to pop from the worklist and so don't need a
separate vector.
gcc/
* gimple-ssa-backprop.cc: Remove the claim at the head of the file
that we only need to revisit a statement once.
(backprop::m_worklist, backprop::m_worklist_names): Delete.
(backprop::m_worklist1): New member variable.
(backprop::m_worklist2, backprop::m_this_worklist): Likewise.
(backprop::m_next_worklist, backprop::m_worklist_threshold): Likewise.
(backprop::backprop): Update accordingly.
(backprop::~backprop): Likewise.
(backprop::push_to_worklist): Switch to using bitmap worklists that
use m_vars indices instead of SSA_NAME_VERSIONs. Decide which
worklist should be used based on m_worklist_threshold.
(backprop::pop_from_worklist): Pop the first bit from m_this_worklist.
Set m_worklist_threshold.
(backprop::execute): Use a double-worklist update in which each
iteration makes a post order walk.
- a usage_info structure that records information about all uses
- a pool of usage_infos for allocating longer-term instances
- a hash map from SSA names to usage_info pointers
- a post-order list of {SSA name, usage_info pointer} pairs
Thus the representation of an SSA-name-to-info mapping uses one copy
of the usage_info but two copies of the SSA name, one in the hash map
and one in the list.
The pass iterates from an optimistic assumption "down" to reality,
so it sometimes finds that an SSA name no longer has useful information.
When that happens, the pass removes the entry from the hash map but not
from the list.
This was simple and was relatively convenient for the current approach.
However, for later patches, it would be better to have a single object
that holds all information about an SSA name, so that both the mapping
and the list see updates to it. This patch therefore switches to:
- a var_info structure that records all information about an SSA name
- a pool of var_infos for allocation purposes
- a hash table of var_info pointers
- a post-order list of var_info pointers
The var_info contains the index of its entry in the list. It's then
possible to remove redundant var_infos from both the hash table and
the list (by nullifying in the latter case).
This doesn't necessarily make much sense on its own. It's just
easier to follow later patches if this change is split out.
The comment at the head of the file needs to be updated after this,
but it seemed better to leave that till the final patch, when all
other changes have been made.
gcc/
* gimple-ssa-backprop.cc (var_info): New structure.
(var_info_hasher): Likewise.
(backprop::m_info_pool): Replace with...
(backprop::m_var_pool): ...this new member variable.
(backprop::m_info_map): Replace with...
(backprop::m_var_table): ...this new member variable.
(backprop::m_worklist): Store var_info pointers instead of SSA names.
(backprop::backprop): Update accordingly.
(backprop::~backprop): Likewise.
(backprop::lookup_operand): Return a var_info pointer instead of
a usage_info pointer.
(backprop::push_to_worklist): Take a var_info pointer instead
of an SSA name.
(backprop::pop_from_worklist): Return a var_info pointer instead
of an SSA name.
(backprop::process_builtin_call_use): Update calls accordingly.
(backprop::process_assign_use): Likewise.
(backprop::process_phi_use): Likewise.
(backprop::reprocess_inputs): Likewise.
(backprop::process_var): Take a pointer to the var_info entry
as a second parameter. Update for the above data structure changes.
(backprop::process_block): Update calls to process_var.
(backprop::execute): Likewise. Update for the above data structure
changes.
That was the best place to put the check at the time, and still is
as things stand. However, a later patch will rename all statements
that might change value, with no opt-out possible once the process
has started. If a phi input's value has changed, then it must be
replaced no matter what.
This patch therefore moves the check to the analysis phase.
gcc/
* gimple-ssa-backprop.cc (backprop::process_var): Don't try to
optimize SSA names that occur as a phi input for an abnormal edge,
moving the restriction from...
(backprop::optimize_phi): ...here.
gsi_replace requires the new statement to have the same lhs as
the old one, if both statements have lhses. This requirement was
added by r0-96285-g0ca5af51abe63d as part of the DEBUG_EXPR_DECL
work. And it makes sense in that context. If gsi_replace nixes
the definition of an SSA name that is still referenced by debug
statements then things are going to go wrong.
But if that's the "only" reason, we should be able to relax the
condition to say that, if the new statement has a different lhs,
the caller must ensure that it has updated all debug uses before
calling gsi_replace.
The patch adds a completely_unused helper to test that. The helper
has a sharp edge and is not widely useful, so I've kept it local
to gimple-iterators.cc for now.
It's arguable that the old code was too forgiving with its
!gimple_has_lhs (stmt) escape hatch. A tighter condition would be
the one tested by:
gcc/
* gimple-iterator.cc (completely_unused): New function.
(gsi_replace): Allow changes in lhs if the caller has updated
all uses of the old name, including all debug uses.
* gimple-fold.cc (gsi_replace_with_seq_vops): Likewise.
This patch adds a bitmap_clear_last_set_bit routine, following the
precedent and implementation approach of bitmap_clear_first_set_bit.
gcc/
* bitmap.h: Document the complexity of pop_largest aka
bitmap_clear_last_set_bit.
(bitmap_clear_last_set_bit): Declare.
* bitmap.cc (bitmap_last_set_bit_worker): New function,
split out from...
(bitmap_last_set_bit): ...here.
(bitmap_clear_last_set_bit): New function.
An Algol 68 mode can be non well formed for two reasons:
- When the mode denotes values that are infinite in size.
- When the mode is strongly coercible to itself.
The yin-yang algorithm implemented by is_well_formed is currently
just reporting a boolean indicating whether the given mode is well
formed.
This patch changes is_well_formed so it returns also the reason for
the particular mode to not be ok: missing a yin means an infinite
mode, whereas missing a yang means the mode is strongly coercible to
itself.
This allows to improve diagnostics, guiding the user on why the mode
is not well formed.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
* a68-parser-modes.cc (WELL): Define.
(NO_YIN): Likewise.
(NO_YANG): Likewise.
(UNWELL): Likewise.
(is_well_formed): Discriminate reason for the given mode to not be
well formed.
(a68_make_moid_list): Emit note explaining why a mode is not well
formed.
gcc/testsuite/ChangeLog
* algol68/compile/malformed-mode-1.a68: New test.
* algol68/compile/malformed-mode-2.a68: Likewise.
Tomasz Kamiński [Thu, 15 Jan 2026 13:45:53 +0000 (14:45 +0100)]
libstdc++: Expand supported operations for __rand_uint128.
This patch adds following operations to __rand_uint128:
* explicit operator bool
* operator- with __rand_uint128
* operator* with uint64_t for _M_hi != 0
* operator/ with uint64_t
The division is currently stubbed by converting to __rand_uint128.
When __rand_uint128 is used, the platform does not provide native 128bit
integer types, thus random number generators will return at most 64bit
integer. In consequence, __generate_cannonical_any will use these
overloads when multiplying by result of generator invocation.
Richard Biener [Tue, 2 Jun 2026 12:56:12 +0000 (14:56 +0200)]
tree-optimization/125545 - reassoc insering after asm goto
There's one case we can handle just fine which is when the asm goto
has a single successor (it's fallthru edge, possibly shared with
an asm goto label). As we're using dominance based insertion
point discovery we have to handle this case.
PR tree-optimization/125545
* tree-ssa-reassoc.cc (insert_stmt_after): Allow asm goto
with a single successor.
Richard Biener [Tue, 2 Jun 2026 12:03:24 +0000 (14:03 +0200)]
tree-optimization/125553 - ICE with VN trick
The following avoids re-doing an earlier CSE when trying to handle
a BIT_FIELD_REF as memory reference by combining it with a
defining load. This might (as in this case) result in double-insertion
to the VN hashtables which rightfully ICEs.
PR tree-optimization/125553
* tree-ssa-sccvn.cc (visit_nary_op): Valueize the BIT_FIELD_REF
operand before looking at its definition.
Wang Yaduo [Tue, 2 Jun 2026 13:12:54 +0000 (07:12 -0600)]
[PATCH] RISC-V: Add tuning info and vector cost model for xt-c9501fdvt
Switch the xt-c9501fdvt RISCV_TUNE entry from generic_ooo_tune_info
to a new xt_c9501_tune_info, with its own scalar tuning parameters
and a dedicated cpu_vector_cost table (xt_c9501_vector_cost) covering
VLS / VLA per-type statement, load/store and reduction costs.
* gcc.dg/vect/costmodel/riscv/rvv/xt-c9501fdvt-vect-stmt-cost.c:
New test.
* gcc.dg/vect/costmodel/riscv/rvv/xt-c9501fdvt-vect-ldst-cost.c:
New test.
* gcc.dg/vect/costmodel/riscv/rvv/xt-c9501fdvt-reduc-unordered.c:
New test.
* gcc.dg/vect/costmodel/riscv/rvv/xt-c9501fdvt-reduc-ordered.c:
New test.
Jin Ma [Tue, 2 Jun 2026 13:07:00 +0000 (07:07 -0600)]
[PATCH] RISC-V: Fix missing return in expand_vec_perm
In expand_vec_perm, the branch handling a selector that is a constant
duplicate (all indices identical) emits a VLMAX vrgather and is then
meant to be done. The missing return let control fall through into the
generic modulo-index handling below, which recomputes and overwrites
the target with another gather sequence.
Add the return so the duplicate path stops after the gather.
No test case is added: without the return the first gather is a dead
store to the target that the generic path immediately overwrites, so it
is removed by later RTL dead-store elimination and the final assembly is
identical with and without the fix. No test can therefore observe the
change.
gcc/ChangeLog:
* config/riscv/riscv-v.cc (expand_vec_perm): Add missing return
after emit_vlmax_gather_insn.
Gaius Mulley [Tue, 2 Jun 2026 11:14:51 +0000 (12:14 +0100)]
PR modula2/125544: ISO reallocate does not call allocate if the address is NIL
This bugfix is for the ISO Storage.REALLOCATE procedure which is a GNU
extension. It should behave in the same way as the PIM version by
first checking whether the pointer parameter is NIL and then calling
ALLOCATE.
gcc/m2/ChangeLog:
PR modula2/125544
* gm2-libs-iso/Storage.def (REALLOCATE): Updated comment
describing new behavior.
* gm2-libs-iso/Storage.mod (REALLOCATE): Check addr
and call ALLOCATE if NIL else call lowerReallocate.
(lowerReallocate): New procedure.
Uros Bizjak [Tue, 2 Jun 2026 09:03:32 +0000 (11:03 +0200)]
i386: Rename crotate attribute to inv_rotate
The crotate code attribute maps a rotation operation to its
inverse direction (rotate <-> rotatert). Since "counter rotate"
does not accurately describe this relationship, rename the
attribute to inv_rotate.
No functional change intended.
gcc/
* config/i386/i386.md (crotate): Rename to inv_rotate.
Update all uses accordingly.
c-family: Prevent optimize attribute from undoing target attribute
This patch fixes a bug reported as PR c/125327.
Previously, function attributes such as
__attribute__ ((target ("vsx"), optimize("O2"))) could
be applied wrongly because correct processing of the
optimize attribute relied on at least one of the following to
be true:
1. The function had no function-specific target options, or
2. changing optimization options did not have the side-effect
of modifying target options, or
3. the target option modified as a side-effect of changing
optimization options was not saved in the cl_target_option
struct.
Assumptions 2 and 3 are not generally guaranteed to be true.
The implementation of the handle_optimize_attribute function
already implicitly acknowledged that by rebuilding the target
options after parsing optimization options, and replacing the
current target option node if that rebuilding resulted in
a fresh target option node. However, any target options
already associated with the function being modified were not
applied before parsing optimization options, therefore they
were lost if that function's target option node was replaced.
Moreover, the decision about whether to replace any existing
target option node was flawed because it was based on a
comparison with a fake node built from ambient global state
instead of a comparison with the current target node.
Assumption 3 is true for i386 because the i386 definition of
munroll-only-small-loops does not have the "Save" tag,
therefore its value cannot differ from the ambient global state
and the target node of the function was not replaced.
The rs6000 and s390 definitions of munroll-only-small-loops
(which is likewise implicitly enabled at -O2 and above)
*do* have the "Save" tag but the 'target' attribute is not
supported on s390, therefore the bug can only be reproduced
on rs6000.
For the bug to manifest, the target option node needed to be
replaced. For rs6000, that could happen if the newly-saved
value of munroll-only-small-loops differed from the ambient
global state (which was wrongly used as the baseline for the
comparison) even if the newly-saved value did not differ from
the value previously saved in the target option node of the
function whose 'optimize' attribute was being applied.
gcc/c-family/ChangeLog:
* c-attribs.cc (handle_optimize_attribute):
Save the global target options before modifying
them. If the function with the optimize attribute
already has a target option node then restore those
target options as the global options, so that they
are used as the basis for any new optimization and
target options attached to the function.
gcc/d/ChangeLog:
* d-attribs.cc (d_handle_optimize_attribute):
Save the global target options before modifying
them. If the function with the optimize attribute
already has a target option node then restore those
target options as the global options, so that they
are used as the basis for any new optimization and
target options attached to the function.
Later, the gimple_seq_may_fallthru() will decide that this block can
fallthru as the last statement is a single label that may be jumped to
from somewhere else.
Only defining this label if we also emit jumps to it helps the compiler
correctly decide if the block can fallthru or not.
In particular, if a function, with a local object needing finalization
and the No_Return aspect, is an endless loop then the spurious warning
that the function is still returning is not emitted anymore.
gcc/ada/ChangeLog:
* gcc-interface/trans.cc (gnat_to_gnu) <N_Exit_Statement>: Mark
the label tree as used.
(gnat_gimplify_stmt) <LOOP_STMT>: Do not emit end label
definition in unused.
Eric Botcazou [Mon, 6 Apr 2026 11:00:50 +0000 (13:00 +0200)]
ada: Add warning for too large return object in extended return statement
The return object may be allocated directly on the return or secondary stack
by the front-end, in other words be the renaming of an allocator.
gcc/ada/ChangeLog:
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Do not
give the warning about too large a size here but...
* gcc-interface/utils2.cc (build_allocator): ...here instead.
Eric Botcazou [Tue, 3 Mar 2026 22:03:18 +0000 (23:03 +0100)]
ada: Plug loophole in layout derivation machinery
The machinery that computes the layout of derived types does not deal with
the variant part of unchecked union types that also contain a fixed part,
because this variant part is represented by a (mere) union type instead of
a qualified union type.
gcc/ada/ChangeLog:
* gcc-interface/decl.cc (components_to_record): Tweak comment.
(build_position_list): Deal with unchecked union types.
(build_variant_list): Likewise.
(get_variant_part): Likewise.
(create_variant_part_from): Likewise.
(copy_and_substitute_in_layout): Likewise.
Eric Botcazou [Mon, 9 Feb 2026 11:23:17 +0000 (12:23 +0100)]
ada: Adjust translation of non-stored discriminants of tagged subtypes
This changes the translation of non-stored discriminants of tagged subtypes
from the (stored) discriminants of the ultimate ancestor to the (non-stored)
discriminants of the tagged type, for the sake of tagged extensions.
This also contains a code layout tweak to gnat_to_gnu_entity and a minor
improvement to gnat_to_gnu.
gcc/ada/ChangeLog:
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: Do
not repeat conditions in chained tests.
(copy_and_substitute_in_layout): For a tagged subtype, inherit the
non-stored dicriminants from the old type explicitely.
* gcc-interface/trans.cc (gnat_to_gnu): Exclude more contexts for
the transformation of boolean rvalues.
Eric Botcazou [Mon, 9 Feb 2026 08:40:18 +0000 (09:40 +0100)]
ada: Adjust RESULT_DECL of functions after updating their profile if needed
Adjusting the RESULT_DECL of functions is necessary before handing them over
to the middle-end when they return by invisible reference and are defined in
the current translation unit, so that's done in Subprogram_Body_to_gnu.
That's also needed when the functions are generated by the middle-end, like
GNU thunks. But, in this case, the transformation can only be applied when
the full view of the type is available, which is not guaranteed by the time
maybe_make_gnu_thunk is invoked, so the transformation needs to be delayed
and applied by update_profile when the full view is eventually encountered.
gcc/ada/ChangeLog:
PR ada/89609
* gcc-interface/gigi.h (adjust_result_decl_for_invisible_reference):
New inline function.
* gcc-interface/decl.cc (update_profile): Adjust the RESULT_DECL of
the function if it returns by invisible reference.
* gcc-interface/trans.cc (Subprogram_Body_to_gnu): Replace manual
adjustment by a call to adjust_result_decl_for_invisible_reference.
(maybe_make_gnu_thunk): Likewise.
* gcc-interface/targtyps.cc: Include stor-layout.h header file.
Eric Botcazou [Fri, 23 Jan 2026 08:28:38 +0000 (09:28 +0100)]
ada: Fix Scalar_Storage_Order not honored for misaligned wrapped scalar
This occurs when the construct is totally scalarized by the SRA pass.
gcc/ada/ChangeLog:
* gcc-interface/utils.cc (maybe_pad_type): Propagate the flag
TYPE_REVERSE_STORAGE_ORDER from the inner type to the record type
if the former is also an aggregate type.
Eric Botcazou [Sat, 2 May 2026 07:13:20 +0000 (09:13 +0200)]
ada: Do not generate accessibility checks for specific synthesized return
This is the return synthesized in a function whose body has been wrapped in
a nested _Wrapped_Statements function, since it only propagates the result.
gcc/ada/ChangeLog:
* accessibility.adb (Apply_Accessibility_Check_For_Return): Bail out
for the return synthesized in a function with _Wrapped_Statements.
Marc Poulhiès [Mon, 27 Apr 2026 08:22:01 +0000 (10:22 +0200)]
ada: Adjust expansion disabling for ghost expression functions
When analyzing a Ghost expression function, expansion was disabled,
which was an issue when some entities needed to be frozen (which is
often the case as expression function are often the first freezing point
of entities).
The previous change:
"Warn on unmodified parameters of expression functions"
now triggers the disabling of the expander because it marks the body of
expression function as "coming from source".
This change adjust the disabling condition by excluding body coming from
expression function.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not disable
expander if body comes from an expression function.
ada: Remove implicit WITHs from ignored ghost regions
Create implicit withs with the same ghost policy as the region
they originate from.
Ensure that the list of Implicit_Withs is consistent after
ignored ghost nodes have been replaced with Null_Statements.
Omit the No_Dependence on ignored implicit WITHs
gcc/ada/ChangeLog:
* rtsfind.adb (Maybe_Add_With): Ensure conistent Implicit_With nodes
traversal after ignored ghost nodes have been removed.
Omit checks on ignored WITH clauses.
Eric Botcazou [Wed, 22 Apr 2026 11:54:17 +0000 (13:54 +0200)]
ada: Fix crash on allocator of class-wide interface as actual in subprogram call
The crash occurs because the type of the allocator lacks the Master_Id to be
passed to the function initializing the allocator, which is required because
the interface is limited and therefore may be the progenitor of a type that
contains tasks.
It comes from a couple of problems: 1) the special conversion trick used in
Resolve_Actuals to force the displacement of the pointer, which blocks the
proper resolution of the allocator (its E_Allocator_Type is not replaced),
and 2) the lack of Master_Id on the E_Access_Subtype created for the subtype
of the parameter in the subprogram call, which is the not null variant of a
named access type.
The former problem is solved by resolving the allocator explicitly, while
the latter is solved by changing Master_Id to live on root types only (in
accordance with RM 9.3(2), which says that it should designate the master
construct that elaborates the ultimate ancestor of a given access type).
The change contains a couple of additional fixes: 3) the proper resolution
of the allocator causes missing accessibility checks to be generated, which
in turn generates a fair amount of useless access checks and 4) an incorrect
transient scope would be created around the allocator when the type of the
parameter is named, while it's only needed for an anonymous access type.
gcc/ada/ChangeLog:
* gen_il-gen-gen_entities.adb (Access_Kind): Add Root_Type_Only for
the Master_Id field.
* einfo.ads (Master_Id): Document that it lives on root types only.
* accessibility.adb (Apply_Accessibility_Check_For_Allocator): Avoid
generating secondary useless checks.
* exp_ch3.adb (Build_Initialization_Call): Use the Master_Id of the
type of target reference directly.
(Build_Master): Minor tweak.
(Expand_N_Full_Type_Declaration): Do not call Build_Master for a
derived access type declaration.
* exp_ch4.adb (Expand_N_Allocator): Test Master_Id directly on the
access type.
* sem_res.adb (Resolve_Actuals): In the case of an allocator, if the
designated type is a CW interface, call Convert_To_And_Rewrite to
add the special conversion but nevertheless resolve the allocator to
the type of the formal afterward; do not establish a transient scope
if the type is a named access type.
Piotr Trojanek [Thu, 16 Apr 2026 10:01:33 +0000 (12:01 +0200)]
ada: Simplify host and target suffix queries
Code cleanup for host and target suffixes, which are stored in C runtime code.
gcc/ada/ChangeLog:
* libgnat/s-os_lib.adb (Get_Debuggable_Suffix, Get_Executable_Suffix,
Get_Object_Suffix, Get_Target_Debuggable_Suffix,
Get_Target_Executable_Suffix, Get_Target_Object_Suffix): Access strings
like we do in Gnatlink.
* adaint.c (__gnat_object_suffix, __gnat_executable_suffix,
__gnat_debuggable_suffix): Now constants, just like the ones for target
suffixes.
ada: Expand check for setenv availability with _POSIX_VERSION
Before this patch, the check for setenv availability was hard-coded to a
fixed list of platforms. Now expand the OR clause to also accept any system
conforming to ISO POSIX.1-2001, which includes setenv in unistd.h. This
avoids falling back to the putenv-based #else branch on other
POSIX-compliant systems.
Gary Dismukes [Fri, 17 Apr 2026 23:15:29 +0000 (23:15 +0000)]
ada: Linker_Section not inherited by object from unconstrained parent subtype
In the case of an object_declaration with a subtype_indication
whose subtype_mark denotes an unconstrained parent subtype (like
"type Unconstrained_String is new String") that itself specifies
the Linker_Section aspect or pragma, the object is not being inherited
from the type like it should be, and so will not be allocated in
the section specified by the aspect or pragma.