Jason Merrill [Sun, 7 Dec 2025 07:34:15 +0000 (15:34 +0800)]
libcpp: adjust _cpp_file accessors
Back in r78875 mrs added cpp_get_path/dir accessors for _cpp_file in order
to interface with the darwin framework system. But now I notice that the
latter duplicates the better-named _cpp_get_file_dir, and I'm inclined to
rename the former to match.
Perhaps we should drop the initial underscore since these are no
longer internal interfaces; OTOH, _cpp_hashnode_value and
_cpp_backup_tokens still have the initial underscore in cpplib.h.
H.J. Lu [Fri, 24 Oct 2025 01:00:59 +0000 (09:00 +0800)]
Add -ffuse-ops-with-volatile-access
Volatile memory can be used as source operand for any operations. Add
-ffuse-ops-with-volatile-access to fuse operations with volatile memory
reference and update simplify_binary_operation_1 to keep PLUS for 2
volatile memory references. On x86, this optimizes
extern volatile int bar;
int
foo (int z)
{
z *= 123;
return bar + z;
}
into
foo:
imull $123, %edi, %eax
addl bar(%rip), %eax
ret
Alexandre Oliva [Sun, 7 Dec 2025 01:08:04 +0000 (22:08 -0300)]
cselib: dump_cselib_* fixes
Rework dump_cselib_table to not crash when cselib_preserved_hash_table
is not allocated, and to remove the extraneous indirection from
dump_cselib_val that made it inconvenient to call from a debugger.
for gcc/ChangeLog
* cselib.cc (dump_cselib_val): Split out of and rename to...
(dump_cselib_val_ptr): ... this.
(dump_cselib_table): Adjust. Skip cselib_preserved_hash_table
when not allocated.
Alexandre Oliva [Sat, 6 Dec 2025 23:11:46 +0000 (20:11 -0300)]
add fusage for non-ACCUMULATE_OUTGOING_ARGS calls [PR122947]
Since we may delete stores that are found to be redundant in
postreload cse, we need cselib to invalidate argument stores at calls,
and to that end we need CALL_INSN_FUNCTION_USAGE to mention all MEM
stack space that may be legitimately modified by a const/pure callee,
i.e., all arguments passed to it on the stack.
When ACCUMULATE_OUTGOING_ARGS, each on-stack argument gets its own
usage information, but when it's not, each argument is pushed
incrementally, without precomputed stack slots.
Since we only mentioned such precomputed stack slots in
CALL_INSN_FUNCTION_USAGE, non-ACCUMULATE_OUTGOING_ARGS configurations
miss the stack usage data, and cselib fails to invalidate the stores.
Stores in such slots are anonymous, and they often invalidate other
anonymous slots, even part of the same object, but as the testcase
demonstrates, we may occasionally be unlucky that consecutive calls
have the stores to multi-word objects reordered by scheduling in such
a way that the last store for the first call survives the call in the
cselib tables, and then it is found to be redundant with the first
store for the subsequent call, as in the testcase.
So, if we haven't preallocated outgoing arguments for a call (which
would give us preassigned stack slots), and we have used any stack
space, add function call usage covering the entire stack range where
arguments were stored.
for gcc/ChangeLog
PR rtl-optimization/122947
* calls.cc (expand_call): Add stack function usage in
non-ACCUMULATE_OUTGOING_ARGS configurations.
Alexandre Oliva [Sat, 6 Dec 2025 23:11:42 +0000 (20:11 -0300)]
[riscv] avoid auipc overflow with large offsets [PR91420]
When computing an address plus a large offset on riscv64 with a
PC-relative sequence, we may hit the range limit for auipc and get a
relocation overflow, where on riscv32 the computation wraps around.
Since -mcmodel=medany requires the entire program to fit in a 2GiB
address range, a +/-1GiB+ offset added to an in-range symbol in a
barely-fitting program is more likely than not to be out-of-range.
Since such large constants are unlikely to come up by chance, separate
them from the symbol so as to avoid the relocation overflow.
for gcc/ChangeLog
PR target/91420
* config/riscv/riscv.cc (riscv_symbolic_constant_p): Require
offsets smaller than +/- 1GiB for PCREL symbols.
Denis Mazzucato [Sat, 6 Dec 2025 18:13:26 +0000 (19:13 +0100)]
Ada: Fix spurious warning if the reducer subprogram is a procedure
If the reducer is a function and the accumulator type isn't constrained,
at runtime the reduction will likely raise a Constraint_Error since the
reducer is repeatedly assigned to the accumulator variable (likely changing
its length). However, if the reducer is a procedure, no such assignment
occurs, and thus the runtime error only depends on the reducer logic.
This patch prevents the spurious warning in that case.
gcc/ada/
* sem_attr.adb (Resolve_Attribute): Check if the reducer is a
procedure before giving the warning.
Jeff Law [Sat, 6 Dec 2025 16:01:11 +0000 (09:01 -0700)]
Adjust expected output of new risc-v test
Just a minor update to Dimitar's patch for the RISC-V testcase.
The cfi directives are not emitted for the -elf configurations causing the new
test to fail. The cfi directives (and associated labels) don't seem relevant
to the test at hand, so this just drops them.
Jason Merrill [Sat, 6 Dec 2025 10:31:44 +0000 (18:31 +0800)]
libstdc++: add more #if to std.cc
compile-std1.C was breaking on arm-eabi because these interfaces aren't
declared. So for exporting let's check the same macros that control
declaring them.
Jakub Jelinek [Sat, 6 Dec 2025 10:08:05 +0000 (11:08 +0100)]
attribs: Use attribute_value_equal in decl_attributes
This is another thing discussed in the 1/9 Reflection thread,
also not dependent on reflection.
decl_attributes calls simple_cst_equal on TREE_VALUEs of the
current and preexisting attributes, but that is just a small
part of how attribute values should be compared.
The following patch fixes that.
2025-12-06 Jakub Jelinek <jakub@redhat.com>
* attribs.cc (decl_attributes): Use attribute_value_equal to
compare attribute values instead of simple_cst_equal.
Jakub Jelinek [Sat, 6 Dec 2025 10:07:18 +0000 (11:07 +0100)]
c++: is_late_template_attribute and tsubst_attribute fixes
This has been discussed in the 1/9 Reflection thread, but doesn't depend on
reglection in any way.
cp_parser_std_attribute calls lookup_attribute_spec as:
const attribute_spec *as
= lookup_attribute_spec (TREE_PURPOSE (attribute));
so with TREE_LIST where TREE_VALUE is attribute name and TREE_PURPOSE
attribute ns. Similarly c_parser_std_attribute. And for
attribute_takes_identifier_p those do:
else if (attr_ns == gnu_identifier
&& attribute_takes_identifier_p (attr_id))
and
bool takes_identifier
= (ns != NULL_TREE
&& strcmp (IDENTIFIER_POINTER (ns), "gnu") == 0
&& attribute_takes_identifier_p (name));
when handling std attributes (for GNU attributes they just call those
with the IDENTIFIER_NODE name.
is_late_template_attribute and tsubst_attribute pass to these functions
just get_attribute_name though, so handle attributes in all namespaces
as GNU attributes only, which means that lookup_attribute_spec can
return NULL or find a different attribute if it is not from gnu:: or
say standard attribute mapped to gnu::, or attribute_takes_identifier_p
can return true even for attributes for which it shouldn't.
I thought about changing attribute_takes_identifier_p to take optionally
TREE_LIST, but that would mean handling it in the target hooks too and
they only care about GNU attributes right now, so given the above
parser.cc/c-parser.cc snippets, the following patch just follow
what they do.
2025-12-06 Jakub Jelinek <jakub@redhat.com>
* decl2.cc (is_late_template_attribute): Call lookup_attribute_spec
on TREE_PURPOSE (attr) rather than name. Only call
attribute_takes_identifier_p if get_attribute_namespace (attr) is
gnu_identifier.
* pt.cc (tsubst_attribute): Only call attribute_takes_identifier_p
if get_attribute_namespace (t) is gnu_identifier.
Paul Thomas [Sat, 6 Dec 2025 08:00:21 +0000 (08:00 +0000)]
Fortran: [PDT] Mismatched types with same name in assignment [PR122670]
2025-12-06 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/122670
* decl.cc (gfc_get_pdt_instance): Ensure that, in an interface
body, PDT instances imported implicitly if the template has
been explicitly imported.
* module.cc (read_module): If a PDT template appears in a use
only statement, implicitly add the instances as well.
gcc/testsuite
PR fortran/122670
* gfortran.dg/pdt_74.f03: New test.
Paul Thomas [Sat, 6 Dec 2025 07:54:39 +0000 (07:54 +0000)]
Fortran: ALLOCATE with array-valued MOLD expression fails [PR122669]
2025-12-06 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/122669
* resolve.cc (resolve_allocate_deallocate): Mold expressions
with an array reference and a constant size must be resolved
for each allocate object.
gcc/testsuite
PR fortran/122669
* gfortran.dg/pdt_73.f03: New test.
Paul Thomas [Sat, 6 Dec 2025 07:51:21 +0000 (07:51 +0000)]
Fortran: [PDT] Unresolved component and generic binding [PR122578]
2025-12-06 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/122578
* primary.cc (gfc_match_varspec): Try to resolve a typebound
generic procedure selector expression to provide the associate
name with a type. Also, resolve component calls. In both cases,
make a copy of the selector expression to guard against changes
made by gfc_resolve_expr.
gcc/testsuite
PR fortran/122578
* gfortran.dg/pdt_72.f03: New test.
Mark Zhuang [Sat, 6 Dec 2025 05:16:25 +0000 (22:16 -0700)]
[PATCH] prepare-commit-msg: Add compatibility check for --default-prefix option
From: Mark Zhuang <mark.zhuang@spacemit.com>
The previous commit added --default-prefix to handle non-default git
prefix configurations, but this option is not available in older git
versions. This patch adds a compatibility check.
Starting with r16-4438-ga93f80feeef744, the edge sorting order was
switched to lowest execution frequency first. But the "bbro"
optimization pass chooses the first edge as a fallthrough. Thus the
most unlikely branches were optimized to fallthroughs.
Fix by restoring the sorting order prior to r16-4438-ga93f80feeef744.
Now the branches most likely to be executed are picked as fallthroughs.
There are no regressions for C and C++ on x86_64-pc-linux-gnu.
The new tests fail for the respective targets without this patch, and
pass with it.
PR rtl-optimization/122675
gcc/ChangeLog:
* bb-reorder.cc (edge_order): Fix BB edge ordering to be
descending.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/pr122675-1.c: New test.
* gcc.target/i386/pr122675-1.c: New test.
* gcc.target/riscv/pr122675-1.c: New test.
Patrick Palka [Sat, 6 Dec 2025 02:09:34 +0000 (21:09 -0500)]
libstdc++: Use deducing this in std::bind when available [PR80564]
Implement the forwarding performed by std::bind via deducing this when
available, instead of needing 4 operator() overloads. Using deducing
this here is more complicated than in other standard call wrappers
because std::bind is not really "perfect forwarding": it doesn't
consider value category, and along with const-ness it also forwards
volatile-ness (until C++20).
The old implementation suffers from the same problem that other
pre-C++23 SFINAE-friendly call wrappers have which is solved by using
deducing this (see p5.5 of the deducing this paper P0847R7).
PR libstdc++/80564
libstdc++-v3/ChangeLog:
* include/std/functional (__cv_like): New.
(_Bind::_Res_type): Don't define when not needed.
(_Bind::__dependent): Likewise.
(_Bind::_Res_type_cv): Likewise.
(_Bind::operator()) [_GLIBCXX_EXPLICIT_THIS_PARAMETER]:
Define as two instead of four overloads using deducing
this.
* testsuite/20_util/bind/cv_quals_2.cc: Ignore SFINAE
diagnostics inside headers.
* testsuite/20_util/bind/ref_neg.cc: Likewise.
* testsuite/20_util/bind/80564.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
[PR122215, IRA]: Fix undefined behaviour of improve_allocation
Register filters are used in one loop of improve_allocation to ignore some
hard regs for cost calculation but it is missed in the subsequent loop
using the costs. This results in usage of random (undefined) register costs
and in sporadic code generation for riscv32 which uses the filters.
gcc/ChangeLog:
PR rtl-optimization/122215
* ira-color.cc (improve_allocation): Use register filter for all
loop on hard regs.
Harald Anlauf [Thu, 4 Dec 2025 21:16:10 +0000 (22:16 +0100)]
Fortran: associate to a contiguous pointer or target [PR122977]
PR fortran/122977
gcc/fortran/ChangeLog:
* expr.cc (gfc_is_simply_contiguous): For an associate variable
check whether the associate target is contiguous.
* resolve.cc (resolve_symbol): Skip array type check for an
associate variable when the target has the contiguous attribute.
Patrick Palka [Fri, 5 Dec 2025 18:43:40 +0000 (13:43 -0500)]
libstdc++: Implement rest of P2655R3 common_reference of reference_wrapper
PR libstdc++/120446
libstdc++-v3/ChangeLog:
* include/bits/refwrap.h (__detail::__is_ref_wrapper):
Define as per P2655R3 for C++20.
(__detail::__ref_wrap_common_reference_exists_with): Likewise.
(basic_common_reference): Define partial specializations using
the above as per P2655R3 for C++20.
* include/bits/version.def (common_reference_wrapper): New.
* include/bits/version.h: Regenerate.
* include/std/functional (__glibcxx_want_common_reference_wrapper):
Define.
* testsuite/20_util/reference_wrapper/p2655r3.cc: New test.
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
... and in passing use requires-clauses instead of void_t based SFINAE.
This is a non-functional change that'll simplify implementing the
P2655R3 change to common_reference.
PR c++/120446
libstdc++-v3/ChangeLog:
* include/std/type_traits (__common_reference_impl): Rewrite
partial specializations to use requires-clause instead of
an additional void_t template parameter. Consolidate the
partial specializations corresponding to bullet 1.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Patrick Palka [Fri, 5 Dec 2025 17:16:30 +0000 (12:16 -0500)]
libstdc++: Use deducing this in range adaptors even in C++20 [PR111550]
Use deducing this to implement perfect forwarding even in C++20 mode
by using the _GLIBCXX_EXPLICIT_THIS_PARAMETER internal FTM instead of
the standard __cpp_explicit_this_parameter. This fixes the original
testcase from this PR even in C++20 mode.
PR libstdc++/111550
libstdc++-v3/ChangeLog:
* include/std/ranges (views::__adaptor::_Partial::operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this
in C++20 mode when possible.
(views::__adaptor::_Pipe::Operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Likewise.
* testsuite/std/ranges/adaptors/take.cc (test07): New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Patrick Palka [Fri, 5 Dec 2025 17:15:08 +0000 (12:15 -0500)]
libstdc++: Use deducing this in std::bind_front even in C++20 [PR111327]
PR libstdc++/111327
libstdc++-v3/ChangeLog:
* include/bits/binders.h (_Binder::operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this in
C++20 mode when possible.
* testsuite/20_util/function_objects/bind_front/111327.cc:
Expect error inside header even in C++20 mode.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Patrick Palka [Fri, 5 Dec 2025 17:14:23 +0000 (12:14 -0500)]
libstdc++: Use deducing this in std::not_fn when available [PR111327]
Implement the perfect forwarding required by std::not_fn using deducing
this when available, instead of needing 8 operator() overloads. This
also fixes Jiang An's test from this PR which would be messy to fix in
the old implementation.
PR libstdc++/111327
libstdc++-v3/ChangeLog:
* include/std/functional (_Not_fn::operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Define as a single
overload using deducing this.
* testsuite/20_util/function_objects/not_fn/111327.cc: Extend test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
This FTM is like __cpp_explicit_this_parameter but is also defined
in earlier C++ modes if deducing this is supported as an extension
by the compiler. Currently only GCC supports this, Clang doesn't.
arm: avoid invalid shift in arm_canonicalize_comparison [PR122999]
There was UB in arm_canonicalize_comparison if it is called with
both operands of type VOIDmode. Avoid this by first handling
floating-point types, then returning if we are left with anything
other than an integer mode. For belt-and-braces also check that
the mode does not require a mask larger than HOST_WIDE_INT.
gcc/ChangeLog:
PR target/122999
* config/arm/arm.cc (arm_canonicalize_comparison): Defer
initializing maxval until we know we are dealing with an
integer mode.
Richard Biener [Fri, 5 Dec 2025 11:25:09 +0000 (12:25 +0100)]
Fix vect_need_peeling_or_partial_vectors_p wrt peeling for gaps
The code assuming that peeling for gaps can be elided by means of
knowing niters and prologue peeling is wrong. Peeling for gaps
means we need an epilog.
* tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p):
When peeling for gaps we always need an epilog.
Richard Biener [Thu, 10 Jul 2025 13:19:30 +0000 (15:19 +0200)]
tree-optimization/120939 - remove uninitialized use of LOOP_VINFO_COST_MODEL_THRESHOLD
The following removes an optimization that wrongly triggers right now
because it accesses LOOP_VINFO_COST_MODEL_THRESHOLD which might not be
computed yet and uses guessed likely max stmt executions.
It also refactors the code to make the default conservative.
PR tree-optimization/120939
* tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p):
Remove eliding an epilogue based on not computed
LOOP_VINFO_COST_MODEL_THRESHOLD and estimated max stmt executions.
* gcc.dg/torture/pr113026-1.c: Skip when -ftracer.
Javier Miranda [Tue, 18 Nov 2025 19:53:58 +0000 (19:53 +0000)]
ada: Unsigned_Base_Range aspect (part 6)
Revert patch for Is_Modular_Integer_Type and Is_Signed_Integer_Type;
add new synthesized predicates Has_Modular_Operations and
Has_Overflow_Operations, and adjust the frontend sources
to rely on them.
gcc/ada/ChangeLog:
* einfo.ads (Has_Unsigned_Base_Range_Aspect): Update documentation.
(Has_Modular_Operations): New synthesized predicate.
(Has_Overflow_Operations): New synthesized predicate.
* einfo-utils.ads (Has_Modular_Operations): New function.
(Has_Overflow_Operations): New function.
* einfo-utils.adb (Is_Modular_Integer_Type): Undo previous patch.
(Is_Signed_Integer_Type): Undo previous patch.
(Has_Modular_Operations): New function.
(Has_Overflow_Operations): New function.
* checks.adb (Determine_Range): Replace selected occurrences of calls to
Is_Modular_Integer_Type by calls to Has_Modular_Operations, and calls to
Is_Signed_Integer_Type by calls to Has Overflow_Operations.
(Enable_Range_Check): Ditto.
(Insert_Valid_Check): Ditto.
* exp_aggr.adb (Others_Check): Ditto.
* exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Pred,
Attribute_Succ]): Ditto.
* exp_ch4.adb (Expand_Compare_Minimize_Eliminate_Overflow): Ditto.
(Size_In_Storage_Elements): Ditto.
(Expand_N_Op_Abs): Ditto.
(Expand_N_Op_Expon): Ditto.
(Expand_N_Op_Minus): Ditto.
(Expand_N_Op_Multiply): Ditto.
(Expand_N_Op_Subtract): Ditto.
* freeze.adb (Freeze_Entity): Ditto.
* sem_aggr.adb (Report_Null_Array_Constraint_Error): Ditto plus
report specific error for index with unsigned_base_range aspect.
* sem_attr.adb (Check_Modular_Integer_Type): Ditto.
(Analyze_Attribute [Attribute_Pred, Attribute_Succ, Attribute_
Range_Length, Attribute_Small, Attribute_Reduce]): Ditto.
* sem_ch12.adb (Instantiate_Type): Ditto.
(Validate_Formal_Type_Default): Ditto.
* sem_ch13.adb (Valid_Empty): Ditto.
* sem_ch2.adb (Analyze_Integer_Literal): Ditto.
* sem_ch3.adb (Unsigned_Base_Range_Type_Declaration): Set attribute
Has_Unsigned_Base_Range_Aspect on the implicit base, and set Etype
of its first subtype E_Modular_Integer_Subtype.
* sem_ch4.adb (Analyze_Call): Ditto.
* sem_eval.adb (Check_Non_Static_Context_For_Overflow): Ditto.
(Eval_Arithmetic_Op): Ditto.
(Eval_Integer_Literal): Ditto.
(Eval_Logical_Op): Ditto.
(Eval_Op_Expon): Ditto.
(Eval_Op_Not): Ditto.
(Eval_Unary_Op): Ditto.
(Fold_Shift): Ditto.
(Test_Expression_Is_Foldable): Ditto.
* sem_intr.adb (Check_Shift): Ditto.
* sem_prag.adb (Analyze_Pragma [Pragma_Unsigned_Base_Range]): Add
assertion.
* sem_res.adb (Resolve_Logical_Op): Ditto.
(Resolve_Unary_Op): Ditto.
(Set_String_Literal_Subtype): Ditto.
* sem_type.adb (Covers): Ditto.
(Specific_Type): Ditto.
(Valid_Boolean_Arg): Ditto.
* sem_util.adb (Wrong_Type): Ditto
* style.adb (Check_Boolean_Operator): Ditto.
Viljar Indus [Tue, 18 Nov 2025 12:39:03 +0000 (14:39 +0200)]
ada: Fix false positive error for classwide containers
Get_Cursor_Type fails if a classwide container type
is passed to it as it cannot correctly identify the
cursor type since it is expecting the iteration functions
to have a container argument with a classwide container type.
gcc/ada/ChangeLog:
* sem_util.adb (Get_Cursor_Type): use the
specific type for classwide container checks.
Marc Poulhiès [Thu, 20 Nov 2025 14:59:49 +0000 (15:59 +0100)]
ada: Adjust documentation on floating-point overflow handling
The description of the floating-point overflow behavior is already
documented in other sections: remove the duplication.
This removal also removes confusing/wrong informations
ada: Fix reducer selection when resolving 'Reduce attribute
This patch ensures that, during the 'Reduce attribute resolution phase, the
selected reducer subprogram exists, is not ambiguous, and has the proper reducer
profile. Before we could have selected a wrong interpretation.
gcc/ada/ChangeLog:
* sem_attr.adb
(Analyze_Attribute): Set the type of the attribute expression only when
not ambiguous (it will later be resolved correctly). Emit an error in
case the type is limited.
(Resolve_Attribute): Emit an error if the reducer has no entity.
(Get_Value_Subtype): Try to resolve the Value_Subtype of the aggregate
expression, and if it succeeds, set the candidate reducer subprogram.
(Is_Reducer_Subprogram): Check whether the selected candidate has a
proper reducer profile.
(Make_Array_Type): Return simple array type to resolve the array
aggregate against it.
(Resolve_Attribute): Reimplement the resolution of Reduce attribute,
including its prefix.
* sem_res.adb (Resolve_Declare_Expression): Save and restore variables
that may be hidden by the local declaration. Only setting the new
entities is problematic when dealing with copied trees where the ref is
lost (eg. when resolving array aggregates).
* exp_attr.adb (Expand_N_Attribute_Reference): Remove tricks to resolve
the reducer in case of faulty resolution as not needed anymore.
Richard Biener [Thu, 21 Aug 2025 11:46:06 +0000 (13:46 +0200)]
Move even/odd validity check from supportable_widening_operation to caller
The following moves the incomplete validity check to use
WIDEN_MULT_{EVEN,ODD} to the caller of supportable_widening_operation
where we have access to more (but not enough) information. I have
made the test conservative enough I hope. For the testcase what was
broken is that it uses a SLP reduction where lane-swizzling isn't
valid.
PR tree-optimization/123002
* tree-vectorizer.h (supportable_widening_operation): Remove
vinfo and stmt_info parameters, add flag to indicate whether
the context would allow OP_{EVEN,ODD}.
* tree-vect-patterns.cc (vect_recog_abd_pattern): Adjust
and pass false.
(vect_recog_widen_op_pattern): Likewise.
(vect_recog_widen_abd_pattern): Likewise.
* tree-vect-stmts.cc (vectorizable_conversion): Move
even/odd validity check here, from supportable_widening_operation.
Adjust it to be conservative.
(supportable_widening_operation): Get flag whether even/odd
is OK to use and remove then unused parameters and code.
Iain Sandoe [Wed, 3 Dec 2025 07:44:53 +0000 (07:44 +0000)]
Ada, Darwin: Implement OSLock for Darwin [PR115305].
The generic Posix code does not match the layout of the pthread entities
in the Darwin _pthread_types.h. So, let's make a Darwin-specific version
and use it.
PR ada/115305
gcc/ada/ChangeLog:
* Makefile.rtl: Use s-oslock__darwin instead of the Posix version.
* libgnat/s-oslock__darwin.ads: New file.
Tobias Burnus [Fri, 5 Dec 2025 08:08:06 +0000 (09:08 +0100)]
OpenMP: C/C++ parser support for dyn_groupprivate
Follow-up to the Fortran patch r16-5633-g26d41e245dbba3, which (besides
other changes) added parser support for the 'dyn_groupprivate' clause to
the target directive.
This commit adds now the parser support to C/C++ and moves the
not-yet-implemented 'sorry' to the early middle end.
* openmp.cc (resolve_omp_clauses): Permit zero with
DYN_GROUPPRIVATE clause.
* trans-openmp.cc (fallback): Generate TREE code
for DYN_GROUPPRIVATE and remove 'sorry'.
Richard Biener [Fri, 5 Dec 2025 08:04:02 +0000 (09:04 +0100)]
Make gcc.dg/vect/vect-simd-clone-24.c more robust
When -march=cascadelake is added we get 256bit vectorization by
default but there's no OMP SIMD ABI for this case with inbranch.
So add -mprefer-vector-width=512 to the testcase.
Andrew Pinski [Fri, 24 Oct 2025 04:20:24 +0000 (21:20 -0700)]
x86/aarch64: Fix compile time hog with ccmp [PR99782]
With ccmp, right now with TER, we hit an O(n^2) explosion in
compile time. This can be stopped by returning NULL early in
ix86_gen_ccmp_next before we expand the operands which will expand seperately
at that point.
A similar change aarch64's aarch64_gen_ccmp_next is done.
Changes since v1:
* v2: Change how cmp_mode is assigned in ix86_gen_ccmp_next.
Reworded commit message about aarch64.
Bootstrapped and tested on x86_64-linux-gnu and aarch64-linux-gnu.
PR middle-end/99782
gcc/ChangeLog:
* config/i386/i386-expand.cc (ix86_gen_ccmp_next): Move the check
for mode earlier before expand_operands.
* config/aarch64/aarch64.cc (aarch64_gen_ccmp_next): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr99782-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Pan Li [Mon, 24 Nov 2025 01:05:02 +0000 (09:05 +0800)]
RISC-V: Combine vec_duplicate + vmsltu.vv to vmsltu.vx on GR2VR cost
This patch would like to combine the vec_duplicate + vmsltu.wv to the
vmsltu.vx. From example as below code. The related pattern will depend
on the cost of vec_duplicate from GR2VR. Then the late-combine will
take action if the cost of GR2VR is zero, and reject the combination
if the GR2VR cost is greater than zero.
Assume we have asm code like below, GR2VR cost is 0.
After this patch:
11 beq a3,zero,.L8
...
14 .L3:
15 vsetvli a5,a3,e32,m1,ta,ma
...
20 vmsltu.wx v1,a2,v3
...
23 bne a3,zero,.L3
gcc/ChangeLog:
* config/riscv/autovec-opt.md (*pred_cmp_swapped<mode>_scalar):
Add new pattern to match vec_dup > vec for vmsltu.
* config/riscv/predicates.md (comparison_swappable_operator):
Add new iterator for above pattern
* config/riscv/riscv-protos.h (expand_vx_cmp_vec_dup_vec): Add
new func to emit vmsltu.vx.
* config/riscv/riscv-v.cc (get_swapped_cmp_rtx_code): Add new
func to convert cmp code to swapped, like gtu to ltu.
(expand_vx_cmp_vec_dup_vec): Add new func decl.
François Dumont [Thu, 20 Nov 2025 06:15:30 +0000 (07:15 +0100)]
libstdc++: Fix std::erase_if behavior for std::__debug::deque
std::erase and std::erase_if are broken for users directly referencing
__gnu_debug::deque in their code that is to say without activating the
_GLIBCXX_DEBUG mode. The iterators potentially invalidated by the erase
operations are not detected by the __gnu_debug::deque container and so
won't be reported as invalidated.
We need explicit std::erase and std::erase_if implementations for
std::__debug::deque which will work also when _GLIBCXX_DEBUG mode is
activated.
libstdc++-v3/ChangeLog:
* include/debug/deque
(std::erase_if<>(std::__debug::deque<>&, _Pred)): New.
(std::erase<>(std::__debug::deque<>&, const _Up&)): New.
* include/std/deque (std::erase_if(std::deque<>&, _Pred)): Remove
_GLIBCXX_DEBUG code.
* testsuite/23_containers/deque/debug/erase.cc: New test case.
* testsuite/23_containers/deque/debug/invalidation/erase.cc: New test case.
The newly added gcc.dg/pr122991.c test fails also on aarch64.
The problem is the same as on x86 which has been fixed in r16-5882,
while the last operand is guaranteed to be a CONST_INT of the right
mode initially, maybe_legitimize_operands can change that if some earlier
operand has the same value and e.g. register_operand predicate has been
used, that operand is forced into a pseudo and maybe_legitimize_operands
then checks if that satisfies the predicate of the other operand.
As on x86 and aarch64 it didn't have any predicate, it happily used
a pseudo in those cases instead of the expected CONST_INT.
The following patch fixes that.
2025-12-04 Jakub Jelinek <jakub@redhat.com>
PR target/122991
* config/aarch64/aarch64.md (crc_rev<ALLI:mode><ALLX:mode>4,
crc<ALLI:mode><ALLX:mode>4): Use const_int_operand predicate for
the last operand.
Andrew Stubbs [Wed, 3 Dec 2025 15:21:30 +0000 (15:21 +0000)]
amdgcn, libgomp: improve generic device errors
Switching to use "generic" ISA variants has changed the error modes a bit.
This patch changes the runtime so that it doesn't say to use the
device-specific -march option when the real problem is not the ISA (it'll be a
mismatched xnack setting, probably).
Additionally, the testsuite effective target check needs to see if the xnack
mode is accepted by the runtime, as well as the compiler.
libgomp/ChangeLog:
* plugin/plugin-gcn.c (generic_isa_code): New function.
(isa_matches_agent): Use generic ISA details to help select an error
message on ISA mismatch.
* testsuite/lib/libgomp.exp
(check_effective_target_offload_target_amdgcn_with_xnack): Use a
runtime check.
Tomasz Kamiński [Thu, 4 Dec 2025 14:28:00 +0000 (15:28 +0100)]
libstdc++: Fix debug mode for unordered containers.
The r16-5845-g8a2e6590cc4a2f changed the _Safe_container copy-assignment
to delegate to assignment of the _Base. However, _Safe_unordered_container_base
was not updated, and due the presence of move constructor, it's assignments are
deleted, causing hard error for assignment of any unordered container.
libstdc++-v3/ChangeLog:
* include/debug/safe_unordered_base.h
(_Safe_unordered_container_base::operator=): Define as
defaulted, inherit behavior of _Safe_sequence_base.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Richard Biener [Sun, 23 Nov 2025 13:01:03 +0000 (14:01 +0100)]
Select both inbranch and notinbranch clone during SIMD call analysis
The following recors both a possibly notinbranch and an inbranch
SIMD clone during analysis so that we can properly handle the
late decision on loop masking. Recording of linear-clause data
from analysis is extended to cover linear-clause arguments from
both clones.
This also fixes AVX512 masked loop code generation in line with
the previous fixes.
PR tree-optimization/122776
* tree-vectorizer.h (vect_simd_clone_data::clone,
vect_simd_clone_data::clone_inbranch): New fields for
the two selected clones.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Record
both a possibly notinbranch and a inbranch clone. Delay
the choice between both to code generation based on
LOOP_VINFO_FULLY_MASKED_P.
* gcc.dg/vect/vect-simd-clone-24.c: New testcase.
* gcc.dg/gomp/pr110485.c: Adjust.
Martin Jambor [Thu, 4 Dec 2025 13:18:05 +0000 (14:18 +0100)]
vrp: Infer ranges from constant aggregates with initializers (v4)
This patch adds the ability to infer ranges from loads from global
constant static aggregates which have static initializers. Even when
the load has one or more ARRAY_REFs with an unknown index and thus we
do not know the particular constant that is being loaded, we can
traverse the correponding elements of the initializer and see if we
know in what range(s) the loaed value must fall - or for pointers we
can sometimes infer that the value cannot be NULL.
I thought this was similar to fold_using_range::range_of_address and
so I decided to put my implementation alongside of it.
The differences from v3 posted in
https://inbox.sourceware.org/gcc-patches/ri6a50xjv39.fsf@virgil.suse.cz/
are:
- The walking budget is not passed around recursively and
decremented but is estimated from the size of the constant
variable, which must not be bigger than param_vrp_cstload_limit
times the size of the loaded type.
- range_from_readonly_load uses a test for INTEGER_CST tree code to
verify a tree is an integer constant and leaves all pointer checks
to tree_single_nonzero_warnv_p.
- In the testcases, all comparisons with number 666 were replaced
with tighter bounds.
The one important change compared to v2 posted in
https://inbox.sourceware.org/gcc-patches/ri6fratkchf.fsf@virgil.suse.cz/T/#u
is:
- To get at the static constructor, the patch now uses
ctor_for_folding instead of directly looking into DECL_INITIAL. In
LTO this loads the constructor on demand if necessary, and is also
capable of looking through symbol aliases, which is necessary for
example when the variable in question has been merged with another
one by IPA-ICF.
The changes compared to v1 posted in
https://inbox.sourceware.org/gcc-patches/d1bb0175-0dee-481d-8078-12e74da58787@redhat.com/T/#m974fa6138bb074a239fb2a300e1d60bc087913ad
are:
- The limiting parameter limits the number of constructor leaf
"elements" that we traverse.
- I have incorporated (hopefully) all suggestions from Richi, mainly
assuming value zero if we do not encounter a corresponding part of a
static initializer and using get_array_ctor_element_at_index to get
at an element of an array with known constant index. I tried to
emulate how it is used in fold_array_ctor_reference, I hope I got it
right.
- I have changed to code to only work for pranges and iranges for now.
I will file a bug about extending it for frange and attach a patch
to the code I'm now adding to handle frange. But as I mentioned in
an earlier email, something else will need to change too to get it
working as expected.
- I have changed range_from_readonly_load to simply work true or false
for pointers - where true means we can infer that it does not
contain NULL and false means we cannot do anything. For integers, I
have changed it to instantiate int_range<1> rather than value_range
to add another constant.
- I have introduced range_from_missing_constructor_part to handle the
cases of missing bits in a constructor.
- I have put the (now simplified) functionality of
add_loaded_invariant_to_range at the beginning of
range_from_readonly_load. That function remains recursive and walks
the memory reference expression "backwards" for reasons explained in
the previous email thread.
- The case where we need to iterate over all elements of an array was
optimized for pointers, we first check if all elements are present and
do not iterate if not. For integers, we still need to iterate, of
course.
- I have added testcases to cover situations with two-dimensional
arrays. Both when both indices are unknown and when only the second
one is (in the C-sense).
gcc/ChangeLog:
2025-11-28 Martin Jambor <mjambor@suse.cz>
* gimple-range-fold.h (class fold_using_range): New member
function range_from_readonly_var.
* gimple-range-fold.cc (fold_using_range::fold_stmt): Call
range_from_readonly_var on assignments.
(range_from_missing_constructor_part): New function.
(range_from_readonly_load): Likewise.
(fold_using_range::range_from_readonly_var): Likewise.
* params.opt (param_vrp_cstload_limit): New.
* doc/invoke.texi (vrp-cstload-limit): Likewise.
libstdc++: Convertibility of rank == 0 layouts, LWG4272.
LWG4272 proposes to add a condition for convertibility from
layout_stride::mapping to other mappings. New conversion requires
both that rank == 0 and that the extent types are convertible.
LWG4272 also proposes to add the same condition for conversion of
padded layouts, i.e. in addition to the condition on the padding
value, the extent types must be convertible.
libstdc++-v3/ChangeLog:
* include/std/mdspan (layout_left): Apply LWG4272.
(layout_right, layout_left_padded, layout_right_padded): Ditto.
* testsuite/23_containers/mdspan/layouts/ctors.cc: Add
test to check ctor uniformity at rank == 0. Update test
for new behavior.
* testsuite/23_containers/mdspan/layouts/padded.cc: Update test
for new behavior.
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Tomasz Kamiński [Thu, 4 Dec 2025 10:25:37 +0000 (11:25 +0100)]
libstdc++: Fix node-base containers copy and move constructor in debug mode.
The fixes regression from r16-5845-g8a2e6590cc4a2f that added an move
assignment operator to the _Safe_node_sequence, and made the class both
non move and copy constructible (copy is deleted, move is not declared).
In consequence debug version of node containers, that define they copy
and move as defaulted, and inherit from above, have deleted copy and moves.
libstdc++-v3/ChangeLog:
* include/debug/safe_sequence.h
(_Safe_node_sequence::_Safe_node_sequence): Define as defaulted.
The following testcase ICEs on x86_64, because the crc_rev_optab expander
assumes the last operand will be a CONST_INT. That assumption comes from
it being created with
rtx polynomial;
if (TREE_CODE (rhs3) != INTEGER_CST)
{
error ("third argument to %<crc%> builtins must be a constant");
polynomial = const0_rtx;
}
else
polynomial = convert_to_mode (TYPE_MODE (result_type), expand_normal (rhs3), 0);
and so it doesn't bother adding a predicate for it.
Except that maybe_legitimize_operands which expand_insn calls has:
This avoids duplicate rtl and ensures that tied operands
remain tied.
This search is linear, but NOPS is bounded at compile time
to a small number (current a single digit). */
unsigned int j = 0;
for (; j < i; ++j)
if (can_reuse_operands_p (icode, opno + j, opno + i, &ops[j], &ops[i])
&& rtx_equal_p (orig_values[j], orig_values[i])
&& ops[j].value
&& insn_operand_matches (icode, opno + i, ops[j].value))
{
ops[i].value = copy_rtx (ops[j].value);
break;
}
in it, so if one of the earlier operands has equal original value to the
polynomial argument, but has a predicate like register_operand or
nonimmediate_operand, the earlier iteration forced that value into a pseudo
and when the last operand doesn't have a predicate, this happily reuses that
pseudo as the last operand. And then it either with RTL checking fails on
INTVAL use on that operand, or without rtl checking ICEs during expansion of
the insn e.g. using table lookup.
The following patch fixes it by using const_int_operand predicate for it.
That is what loongarch and riscv backends use for it too. Aarch64 doesn't
and I'll send a fix for that once tested on aarch64-linux.
2025-12-04 Jakub Jelinek <jakub@redhat.com>
PR target/122991
* config/i386/i386.md (crc_rev<SWI124:mode>si4): Use const_int_operand
predicate for the last input argument.
During get_reload_reg() a reload register may be reused and so far
exclude start hard registers were not taken into account. For the test
case this means operands 2 and 3 use the same reload register which gets
dx assigned, although, the constraint of operand 3 refers to register
r8. That in turn renders the insn unsatisfiable.
A conservative approach would be to simply not reuse any reload register
whenever the set of exclude start hard regs is non-empty. However, this
would lead to some missed optimizations like in this example where
operands 2 and 3 would land in different registers. Therefore, if both
share a start hard register, still reuse the reload and refine the
exclude start hard regs set.
I only have a test case for inputs. However, I expect an analogue
problem for outputs which is why I adapted that case, too.
gcc/ChangeLog:
* lra-constraints.cc (get_reload_reg): Honor exclude start regs
while reusing reloads.
[PR85072, LRA]: Set a limit for considering other reload pseudo preferences
Compilation of test in PR85072 takes a lot of time and memory, e.g. 17
minutes and 23 GB memory on AMD 9900X. The function in question has one million
program points and one million pseudos. The culprits are
live_reload_and_inheritance_pseudos bitmaps which are used to consider
other reload pseudo preferences when assigning a register to a given
pseudo. The patch introduces a constraint regarding when those
preferences are considered. The patch decreases compilation time to
about 10 minutes and memory consumption to about 2GB.
gcc/ChangeLog:
PR rtl-optimization/85072
* lra-assigns.cc (init_live_reload_and_inheritance_pseudos):
Improve calculation of live_reload_and_inheritance_pseudos and set
a constraint to do this.
* params.opt
(lra-max-pseudos-points-log2-considered-for-preferences): New.
* doc/invoke.texi
(lra-max-pseudos-points-log2-considered-for-preferences): Document
it.
libstdc++: Fix pretty printer lookup for class templates [PR122812]
Under some circumstances the type.name of a pair<> type starts with
"struct". This confuses GDB when we use gdb.lookup_type for the name of
template specialization using "struct pair<...>" in its template
argument list.
Using type.tag avoids this problem.
libstdc++-v3/ChangeLog:
PR libstdc++/122812
* python/libstdcxx/v6/printers.py (lookup_templ_spec): Use
gdb.Type.tag if present.
Joseph Myers [Wed, 3 Dec 2025 16:15:39 +0000 (16:15 +0000)]
testsuite: Escape \r in dg-regexp test names
When the regular expression matched in a test using dg-regexp contains
a newline (written in the source as \n inside ""), there is logic in
the testsuite to escape this so the test name after PASS: or FAIL: in
the testsuite output has \n instead of that newline.
When it contains a carriage return (from \r in the source), however,
there is no such escaping, and the test names in the .sum and .log
files thus contain a literal CR character in the middle of a test
name. The process of combining test results from parallel-run parts
of each testsuite then turns that CR into end-of-line, losing the rest
of the test name (whereas if you use runtest directly, e.g. via
contrib/test_installed, the full test name remains in the .sum file
because there is no such postprocessing). I suspect the handling of
newlines by Python (used for one of the scripts involved in combining
results) is responsible for test names getting truncated like this.
To avoid this truncation, escape CR like newlines are escaped.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
* lib/gcc-defs.exp (handle-dg-regexps): Also escape \r in output.
Jakub Jelinek [Wed, 3 Dec 2025 15:07:29 +0000 (16:07 +0100)]
switchconv: Fix up inbound checks for switch types wider than sizetype [PR122943]
In r14-8302 I've changed switchconv to narrow the CONSTRUCTOR indexes and
the runtime SSA_NAME indexing into the arrays to at most sizetype for
types wider than that (__int128, large _BitInt, for -m32 long long too).
The switchconv partitioning ensures that one partition isn't larger than
that and having CONSTRUCTOR with _BitInt(1024) indexes was causing all kinds
of problems.
Unfortunately, as the following testcase shows, while doing that is
desirable, the later gen_inbound_check call uses the lhs of m_arr_ref_first
statement to determine the type and value that should be compared for the
inbound check (against the highest possible bound cast to the lhs type).
So the PR113491 r14-8302 change broke those inbound checks, instead of
being done in unsigned type corresponding to the precision of the switch
expression they are now sometimes done using sizetype. That is of course
wrong.
So the following patch fixes it by doing the tidx computation in steps,
one is the utype subtraction, which has m_arr_ref_first as the last
instruction, and then if needed there is a cast to sizetype if utype is
wider than that. When gen_inbound_check is called, it adds the inbound
check after the m_arr_ref_first instruction and the additional cast is
then inside of the guarded block.
So e.g. in bar for -m32 this patch changes:
unsigned char bar (long long int val)
{
unsigned char result;
- sizetype _7;
+ sizetype _6;
+ long long unsigned int _7;
PR tree-optimization/122943
* tree-switch-conversion.cc (switch_conversion::build_arrays):
Always gimplify subtraction in utype without cast to tidxtype
and set m_arr_ref_first to the last stmt of that. Remove unneeded
update_stmt call. If tidxtype is not utype, append after that stmt
cast to tidxtype and set tidx to the lhs of that cast.
Andrew MacLeod [Tue, 2 Dec 2025 15:12:24 +0000 (10:12 -0500)]
Return true when a value_relation is added.
relation_oracle::record does not indicate whether a relation was added.
Add a boolean return and only update timestamps when a relation is actually
added.
PR tree-optimization/122898
gcc/
* gimple-range-fold.cc (fur_source::register_relation): Return a bool;
(fur_depend::register_relation): Ditto.
(fur_relation::register_relation): Ditto.
* gimple-range-fold.h (fur_source::register_relation): Adjust prototype.
(fur_depend::register_relation): Ditto.
* gimple-range-path.cc (jt_fur_source::register_relation): Return bool.
* value-relation.cc (equiv_oracle::add_partial_equiv): Return a bool.
(equiv_oracle::record): Return a bool.
(relation_oracle::record): Return a bool.
(dom_oracle::record): Return a bool.
(dom_oracle::set_one_relation): Remove some debug output.
(path_oracle::equiv_set): Return a bool.
(path_oracle::register_equiv): Return a bool.
(path_oracle::record): Return a bool.
* value-relation.h (relation_oracle::record): Adjust prototype.
(equiv_oracle::add_partial_equiv): Ditto
(equiv_oracle::record): Ditto.
(dom_oracle::record): Ditto.
(path_oracle::equiv_set): Ditto.
(path_oracle::register_equiv): Ditto.
(path_oracle::record): Ditto.
So one of the PHIs is completely useless. But that makes the update loop visit
the PHI twice, but the first time we already updated them so we end up with a
non-SSA_NAME there.
In the old code we'd just re-update the PHI with the same statement. So I've put
back that code as fallback. I'm almost 100% sure you can't get here with any
divergent PHI as an inviant has to be a variable before we rewrite it. But as
I'm not 100% sure I've put the update fallback instead of skipping the update.
gcc/ChangeLog:
PR tree-optimization/122969
* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer): handle
non-ssa name IV var args.
gcc/testsuite/ChangeLog:
PR tree-optimization/122969
* gcc.dg/vect/pr122969.c: New test.
Mathias Krause [Mon, 1 Dec 2025 19:31:53 +0000 (20:31 +0100)]
i386: Generate 3-byte NOP for -mnop-mcount -m16
When generating 16-bit code via -m16, the NOP mcount code generation
emits a 5-byte NOP. However, that is neither a valid i8086 instruction
(long NOPs are PentiumPro+), nor would it get decoded as a 5-byte
instruction. It's a 4-byte 'nopw 0(%si)' followed by a zero byte. The
latter causes the following instruction to get misinterpreted as some
form of ADD.
Fix this by emiting a 3-byte no-op 'lea 0(%si)' instead which makes it
compatible with systems lacking long NOP support.
Add a test for this and change the existing one accordingly.
gccrs: Add missing test for lang item feature gate
We recently modified all tests with lang items to add the lang feature
gate switch but we did not introduce any test to check that a proper
error message is printed when this switch is not used.
Owen Avery [Sat, 29 Nov 2025 23:20:01 +0000 (18:20 -0500)]
gccrs: Improve feature handling
This fixes a false positive with undefined features, improves the
implementation of Feature::as_name, and configures the testsuite to
check further stages of libcore compilation.
gcc/rust/ChangeLog:
* ast/rust-macro.h (MetaNameValueStr::get_name): New function.
(MetaNameValueStr::get_value): Likewise.
* checks/errors/feature/rust-feature-gate.cc
(FeatureGate::visit): Tweak unknown feature detection.
(FeatureGate::gate): Handle field rename.
(FeatureGate::note_stability_attribute): New function
definition.
* checks/errors/feature/rust-feature-gate.h
(FeatureGate::note_stability_attribute): New function
declaration.
(FeatureGate::Stability): New enum class.
(FeatureGate::valid_features): Rename field to...
(FeatureGate::valid_lang_features): ...here.
(FeatureGate::valid_lib_features): New field.
(FeatureGate::defined_lib_features): Likewise.
* checks/errors/feature/rust-feature.cc (Feature::as_name):
Improve implementation.
gcc/testsuite/ChangeLog:
* rust/core/core.exp: Change -frust-compile-until=astvalidation
to -frust-compile-until=nameresolution.
* parse/rust-parse-impl.h (Parser::parse_function): Return a nullptr on
error instead of a valid function.
(Parser::parse_let_stmt): Remove non leaf error.
(Parser::parse_if_expr): Likewise.
(Parser::parse_loop_expr): Likewise.
(Parser::parse_expr): Return error on null denotation error.
This patch turns superfluous typedefs into struct forward-references,
and gets rid of a few unused macros. It also moves some definitions
from the a68-types.h header to a68-parser-scope.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog