Skip to content

Conversation

@MichielDerhaeg
Copy link
Contributor

The purpose of the PR is solely to review the patch set that will be submitted to upstream.

AlfieRichardsArm and others added 12 commits September 30, 2025 19:27
Adds an optimisation in FMV to redirect to a specific target if possible.

A call is redirected to a specific target if both:
- the caller can always call the callee version
- and, it is possible to rule out all higher priority versions of the callee
  fmv set. That is estabilished either by the callee being the highest priority
  version, or each higher priority version of the callee implying that, were it
  resolved, a higher priority version of the caller would have been selected.

For this logic, introduces the new TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A
hook. Adds a full implementation for Aarch64, and a weaker default version
for other targets.

This allows the target to replace the previous optimisation as the new one is
able to cover the same case where two function sets implement the same versions.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc (aarch64_functions_b_resolvable_from_a): New
	function.
	(TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A): New define.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in: Add documentation for
	TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A.
	* multiple_target.cc (redirect_to_specific_clone): Add new optimisation
	logic.
	(ipa_target_clone): Remove check for TARGET_HAS_FMV_TARGET_ATTRIBUTE.
	* target.def: Document new hook..
	* attribs.cc: (functions_b_resolvable_from_a) New function.
	* attribs.h: (functions_b_resolvable_from_a) New function.

gcc/testsuite/ChangeLog:

	* g++.target/aarch64/fmv-selection1.C: New test.
	* g++.target/aarch64/fmv-selection2.C: New test.
	* g++.target/aarch64/fmv-selection3.C: New test.
	* g++.target/aarch64/fmv-selection4.C: New test.
	* g++.target/aarch64/fmv-selection5.C: New test.
	* g++.target/aarch64/fmv-selection6.C: New test.
	* g++.target/aarch64/fmv-selection7.C: New test.
Remove duplicated std::swap implementation.

libstdc++-v3/ChangeLog

	* include/std/inplace_vector:
	(std::swap(inplace_vector<>&, inplace_vector<>&)): Remove the duplicated
	implementation at std namespace level. Keep the friend inline one.
	(inplace_vector<Tp, 0>::assign(initializer_list<>)): Add missing return
	statement.
The recent patch r16-3747-gafa74d37e81 to detect the use of non-local
context by nested functions caused regressions on aarch64, because
DECL_NONLOCAL was set on labels.  Fix this by setting it only to
the same types of decls as before.

	PR target/121933

gcc/c/ChangeLog:
	* c-typeck.cc (mark_decl_used): Set DECL_NONLOCAL
	only for VAR_DECL, FUNC_DECL, PARM_DECL.
No functional change intended.

gcc/ChangeLog:
	* diagnostics/output-spec.cc: Rename "parsed_arg" to
	"scheme_and_kvs" throughout.  Rename "unparsed_arg" to
	"unparsed_spec" throughout, and make a member of
	output_spec::context rather than passing it around.
	* diagnostics/output-spec.h: Likewise.
	* libgdiagnostics.cc: Likewise.
	* opts-diagnostic.cc: Likewise.

Signed-off-by: David Malcolm <[email protected]>
Simplification; no functional change intended.

gcc/ChangeLog:
	* diagnostics/output-spec.cc: Move class scheme_handler out from
	inside class output_factory.

Signed-off-by: David Malcolm <[email protected]>
No functional change intended.

gcc/ChangeLog:
	* diagnostics/output-spec.cc: Add comments.  Introduce a
	"struct decoded_args" within each scheme_handler subclass,
	and split out per-scheme key-value parsing from each make_sink
	implementation into new per-scheme decode_kv member functions.

Signed-off-by: David Malcolm <[email protected]>
The previous refactoring highlighted that we were ignoring the "color"
key within the "text" output scheme for diagnostics.

Fixed thusly.

gcc/ChangeLog:
	* diagnostics/output-spec.cc (text_scheme_handler::make_sink): Use
	the value of the "color" to determine if the sink's printer is
	colorized.

Signed-off-by: David Malcolm <[email protected]>
I believe I stopped using this in r16-2211-ga5d9debedd2f46.

gcc/testsuite/ChangeLog:
	* lib/sarif.py: Remove import of ET.

Signed-off-by: David Malcolm <[email protected]>
2025-10-01  Paul Thomas  <[email protected]>

gcc/fortran
	PR fortran/122089
	* decl.cc (gfc_get_pdt_instance): If the pdt_template is use
	associated, 'module' field should be copied to this instance.

gcc/testsuite/
	PR fortran/122089
	* gfortran.dg/pdt_51.f03: New test.
libstdc++-v3/ChangeLog:

	* testsuite/std/memory/polymorphic/copy.cc: Fix spelling of
	typedef.
This was regenerated with (slightly simplified):

	$ make bootstrap && make html && cd gcc && make regenerate-opt-urls;

Fixes: 33c35b7 (2025-09-26; "c, objc: Add -Wmultiple-parameter-fwd-decl-lists")

gcc/c-family/ChangeLog:

	* c.opt.urls: Regenerate

Signed-off-by: Alejandro Colomar <[email protected]>
@MichielDerhaeg MichielDerhaeg force-pushed the michiel/upstream_rmx100 branch from 0efc8b2 to 2fa36eb Compare October 1, 2025 11:42
rguenth and others added 14 commits October 1, 2025 13:49
We can handle bitwise-operation reductions and reductions on mask
vectors just fine.

	PR tree-optimization/122110
	* tree-vect-loop.cc (vectorizable_reduction): Relax restriction
	to mode-precision operations.
…zed.h

Running the testsuite with warnings enabled gives:

FAIL: 20_util/specialized_algorithms/uninitialized_copy/58982.cc  -std=gnu++26 (test for excess errors)
Excess errors:
.../libstdc++-v3/include/bits/stl_uninitialized.h:293: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing to an object of type 'struct T' with no trivial copy-assignment; use copy-initialization instead [-Wclass-memaccess]

This is because -Wclass-memaccess warns about using memcpy on types
which have a deleted assignment, even though those can be trivially
copyable and so using memcpy on them is technically valid. Where these
warnings occur in bits/stl_uninitialized.h we're only using memcpy after
checking for trivially copyable (and any other relevant conditions) so
we can be confident that we're using it safely. We also don't actually
care about assignment here because we're only constructing new objects,
not copying over existing ones (which is what std::copy does, but not
std::uninitialized_copy).

Uses of memcpy in the C++98 code don't need to have -Wclass-memaccess
suppressed, because there are no deleted functions in C++98 so there are
no types which are trivially copyable but trigger the warning.

libstdc++-v3/ChangeLog:

	* include/bits/stl_uninitialized.h (uninitialized_copy)
	(uninitialized_fill, uninitialized_fill_n): Use pragmas to
	suppress -Wclass-memaccess warnings.

Reviewed-by: Tomasz Kamiński <[email protected]>
These tests are currently evaluated as (err == failbit)|eofbit which is
not what we want. It should be err == (failbit|eofbit).

libstdc++-v3/ChangeLog:

	* testsuite/22_locale/time_get/get/char/3.cc: Add parentheses to
	x == y|z expression.
	* testsuite/22_locale/time_get/get/wchar_t/3.cc: Likewise.
	* testsuite/28_regex/algorithms/regex_match/multiline.cc:
	Likewise.

Reviewed-by: Tomasz Kamiński <[email protected]>
These test facets were failing to override the members in the
std::codecvt base class.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/9875_seekoff.cc
	(Cvt::do_length): Fix signature to override virtual function in
	base.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/9875_seekpos.cc:
	(Cvt::do_length): Likewise.
	* testsuite/27_io/basic_filebuf/underflow/char/1.cc
	(NoconvCvt::do_in): Likewise.
	* testsuite/27_io/basic_filebuf/underflow/wchar_t/11603.cc
	(checksumcvt::do_length): Likewise.

Reviewed-by: Tomasz Kamiński <[email protected]>
libstdc++-v3/ChangeLog:

	* testsuite/20_util/unique_ptr/modifiers/93562.cc: Define a
	separate deleter for array cases.

Reviewed-by: Tomasz Kamiński <[email protected]>
When bounds_of_var_in_loop was converted to range_from_loop_direction,
the final check returned FALSE when the beginning and end bounds were
the same...  The new code was using wi::gt_p, when it should have been
wi::ge_p when checking for the fail condition.

	PR tree-optimization/120560
	gcc/
	* vr-values.cc (range_from_loop_direction): Use wi::ge_p rather
	than wi::gt_p.

	gcc/testsuite/
	* gcc.dg/pr120560.c: New.
This uses sizeof on a wide string to get the length, which is wrong
because each wchar_t is more than one byte. This was presumably copied
from a narrow char test.

libstdc++-v3/ChangeLog:

	* testsuite/28_regex/basic_regex/assign/wchar_t/pstring.cc: Use
	wcslen(cs) instead of sizeof(cs)-1.

Reviewed-by: Tomasz Kamiński <[email protected]>
Both GCC and GDB/binutils now have root editorconfig files.  It would
make sense to unify them as this sets the general tone for these
projects.

ChangeLog:
	* .editorconfig: Unify the GCC and GDB/binutils root config.
While looking into AutoFDO porfiles I noticed that sometimes we lost
precise zero counts due to inlining and merging basic blocks.  Propagating
precise zero counts should be safe even for measured profiles and thus
this patch enables it.

gcc/ChangeLog:

	* predict.cc (unlikely_executed_stmt_p): Remove redundant check.
	(rebuild_frequencies): Also recompute unlikely bbs when profile is
	present or consistent.
When merging blocks we currently alway use count of the first basic block.
In some cases we merge block containing call to cold noreturn function (thus
having count 0 (reliable)) with earlier block with weaker form of profile.
In this case we can still preserve reliable count of 0.

The patch also makes block merging to pick higher of the counts if quality
is the same.  This should reduce chances of losing track of hot code in broken
profiles.

gcc/ChangeLog:

	* cfghooks.cc (merge_blocks): Choose more reliable or higher BB
	count.
currently autoprofiled bootstrap produces auto-profiles for cc1 and cc1plus
binaries.  Those are used to build respective frontend files.  For backend
cc1plus.fda is used.   This does not work well with LTO bootstrap where cc1plus
backend is untrained since it is used only for parsing and ealry opts. As a
result all binaries gets most of the backend optimized for size rather then
speed.

This patch adds lto1.fda and then combines all of cc1, cc1plus and lto1 into
all.fda that is used compiling common modules.  This is more or less equivalent
to what -fprofile-use effectively uses modulo that with -fprofile-use we know
number of runs of evety object file and scale accordingly at LTO time.

gcc/ChangeLog:

	* Makefile.in (ALL_FDAS): New variable.
	(ALL_HOST_BACKEND_OBJ): Use all.fda instead of cc1plus.fda
	(all.fda): New target

gcc/c/ChangeLog:

	* Make-lang.in: Add c_FDAS
	(create_fdas_for_cc1): Be sure that build fails if create_gcov fails.

gcc/cp/ChangeLog:

	* Make-lang.in: Add c++_FDAS
	(create_fdas_for_cc1plus): Be sure that build fails if create_gcov fails.

gcc/lto/ChangeLog:

	* Make-lang.in: Add lto_FDAS; enable FDA collection
	(create_fdas_for_lto1): Be sure that build fails if create_gcov fails.
afdo_set_bb_count had code that, only if no count was determined in the BB itself,
looked into its outgoing edges and tried to determine counts based on location of
phi args.  This is not quite correct, since value detemrined is the count of edge
which may be lower than count of BB.

This patchs moves the logic into afdo_unscaled_edge_count and extends it to
also use goto_locus.  BB profile is infered only if BB has single successor and
otherwise the edge counts are stored into correct location in
afdo_calculate_branch_prob.

gcc/ChangeLog:

	* auto-profile.cc (afdo_unscaled_edge_count): New function based on
	part of ...
	(afdo_set_bb_count): ... this function; use it here.
	(afdo_calculate_branch_prob): Try to determine edge counts using
	phi args and goto locuses.
This patch adds a parameter that controls whether BB profile is read from auto-profile
or we just scale guessed profile according to known counts.  This is mostly useful as
a first aid when auto-profile goes wrong.  Once we fix enough bugs I think it may be
removed but so far it is quite useful, so I decided to push it.

gcc/ChangeLog:

	* auto-profile.cc (determine_scale): Break out from ...
	(afdo_adjust_guessed_profile): ... here.
	(scale_bb_profile): New function.
	(afdo_annotate_cfg): Use it.
	* params.opt (auto-profile-bbs): New parmaeter.
	* doc/invoke.texi (auto-profile-bbs): Document.
gcc/ChangeLog:

	* auto-profile.cc (afdo_calculate_branch_prob): Improve dump file.
jakubjelinek and others added 29 commits October 9, 2025 18:06
…nt [PR122188]

The patch from yesterday made me think about side-effects in the second
argument of __builtin_c[lt]zg.  When we change
__builtin_c[lt]zg (x, y)
when y is not INTEGER_CST into
x ? __builtin_c[lt]zg (x) : y
with evaluating x only once, we omit the side-effects in y unless x is not
0.  That looks undesirable, we should evaluate side-effects in y
unconditionally.

2025-10-09  Jakub Jelinek  <[email protected]>

	PR c/122188
	* c-gimplify.cc (c_gimplify_expr): Also gimplify the second operand
	before the COND_EXPR and use in COND_EXPR result of gimplification.

	* gcc.dg/torture/pr122188.c: New test.
In the testcase repeated invocations of a function showed an apparently
unstable interface.  This was caused by trying to guess an (inappropriate)
interface of the external procedure after processing of the procedure
arguments in gfc_conv_procedure_call.  The mis-guessed interface showed up
in subsequent uses of the procedure symbol in gfc_conv_procedure_call.  The
solution is to check for an existing interface of an external procedure
before trying to wildly guess based on just the actual arguments.

	PR fortran/122206

gcc/fortran/ChangeLog:

	* trans-types.cc (gfc_get_function_type): Do not clobber an
	existing procedure interface.

gcc/testsuite/ChangeLog:

	* gfortran.dg/interface_abstract_6.f90: New test.
The cselim pass is enabled only for targets that have conditional move
instructions.  Since pru-unknown-elf doesn't have such instructions, the
pass is not executed, and the test fails with:

  gcc.dg/tree-ssa/cselim-2.c: dump file does not exist
  UNRESOLVED: gcc.dg/tree-ssa/cselim-2.c scan-tree-dump cselim "if-then-else store replacement: 3"

Fix by explicitly enabling the cselim pass for this test.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/cselim-2.c: Pass -ftree-cselim option.

Signed-off-by: Dimitar Dimitrov <[email protected]>
Previously, ana::binding_map was a
  hash_map <const binding_key *, const svalue *>
combining both concrete and symbolic keys into the same map, with no
meaningful ordering.

This patch reimplements it as:
  concrete_bindings_t m_concrete;
  symbolic_bindings_t m_symbolic;
where concrete_bindings_t is:
  std::map<bit_range, const svalue *>
thus organizing them into order, and symbolic_bindings_t is:
  std::vector<symbolic_binding>
where a symbolic_binding is a (region, svalue pair) and the vector for
now has at most one symbolic binding.

In particular, this means that iterating over the bindings in a map or
cluster yields them in ascending memory order of concrete bindings,
followed by the symbolic binding (if present).

This should allow various optimizations, make it easier to detect
overlapping bindings, and to eventually better support analyzing code
that builds up a string via concatenations (perhaps with multiple
symbolic bindings "hanging off the end").

gcc/analyzer/ChangeLog:
	* access-diagram.cc: Update for renaming of fields of binding_key.
	* ana-state-to-diagnostic-state.cc: Likewise.
	* bounds-checking.cc: Likewise.  Add store_manager param.
	* call-summary.cc: Likewise.
	* diagnostic-manager.cc: Drop includes of "basic-block.h" and
	"gimple.h".
	* engine.cc: Likewise.
	* infinite-recursion.cc: Update for renaming of fields of
	binding_key.
	* kf.cc: Pass store_manager to mark_as_escaped.
	* program-state.cc: Update for renaming of fields of binding_key.
	* region-model-asm.cc: Pass store manager to
	get_or_create_cluster.
	* region-model-reachability.cc: Likewise.  Update for renaming of
	fields of binding_key.
	* region-model.cc: Likewise.
	(struct bad_pointer_finder): Drop.
	(region_model::poison_any_pointers_to_descendents): Implement
	iteration directly, rather than using store::for_each_binding.
	Drop return value.
	(selftest::test_struct): Set field in order y then x.  Verify
	that iteration yields bindings in order x then y.
	* region-model.h
	(region_model::poison_any_pointers_to_descendents): Drop return
	value.
	* region.cc: Pass store manager to get_or_create_cluster.
	* store.cc (binding_map::const_iterator::operator==): New.
	(binding_map::const_iterator::operator++): New.
	(binding_map::const_iterator::operator*): New.
	(binding_map::iterator::operator==): New.
	(binding_map::iterator::operator++): New.
	(binding_map::iterator::operator*): New.
	(binding_map::binding_map): Reimplement.
	(binding_map::operator=): Reimplement.
	(binding_map::operator==): Reimplement.
	(binding_map::hash): Reimplement.
	(binding_map::get): Reimplement.
	(binding_map::put): Reimplement.
	(binding_map::overwrite): New.
	(binding_map::remove): New.
	(binding_map::begin): New.
	(binding_map::end): New.
	(binding_map::elements): New.
	(binding_map::dump_to_pp): Reimplement.
	(binding_map::to_json): Iterate over *this directly; drop sort.
	(binding_map::add_to_tree_widget): Likewise.
	(binding_map::cmp): Reimplement.
	(binding_map::get_overlapping_bindings): Update for field
	renamings.
	(binding_cluster::binding_cluster): Add store_mgr param.
	(binding_cluster::validate): Update for field renamings.
	(binding_cluster::bind_compound_sval): Likewise.
	(binding_cluster::purge_state_involving): Likewise.
	(binding_cluster::maybe_get_compound_binding): Likewise.  Add
	store_mgr param.
	(binding_cluster::can_merge_p): Likewise.  Update for new
	implementation.
	(binding_cluster::make_unknown_relative_to): Likewise.
	(binding_cluster::on_unknown_fncall): Likewise.
	(binding_cluster::on_asm): Likewise.
	(binding_cluster::get_representative_path_vars): Likewise.
	(store::set_value): Likewise.
	(store::on_maybe_live_values): Pass around store_manager.
	(store::fill_region): Likewise.
	(store::mark_region_as_unknown): Likewise.
	(store::get_or_create_cluster): Likewise.
	(store::can_merge_p): Likewise.
	(store::mark_as_escaped): Likewise.
	(store::canonicalize): Update for field renamings.
	(store::loop_replay_fixup): Likewise.  Pass around store_manager.
	(store::replay_call_summary_cluster): Likewise.
	(selftest::test_binding_map_ops): New.
	(selftest::analyzer_store_cc_tests): Call it.
	* store.h (class binding_map): Reimplement.
	(binding_map::map_t): Drop.
	(struct binding_map::symbolic_binding): New.
	(binding_map::concrete_bindings_t): New.
	(binding_map::symbolic_bindings_t): New.
	(struct binding_map::bindings_pair): New.
	(class binding_map::const_iterator): New.
	(class binding_map::iterator): New.
	(binding_map::get): Reimplement.
	(binding_map::overwrite): New decl.
	(binding_map::remove): Reimplement.
	(binding_map::clear): Reimplement.
	(binding_map::put): Reimplement.
	(binding_map::empty_p): Reimplement.
	(binding_map::begin): Reimplement.
	(binding_map::end): Reimplement.
	(binding_map::elements): Reimplement.
	(binding_map::m_map): Drop field.
	(binding_map::m_store_mgr): New field.
	(binding_map::m_concrete): New field.
	(binding_map::m_symbolic): New field.
	(BindingVisitor): Drop.
	(binding_cluster::map_t): Drop.
	(binding_cluster::iterator_t): Reimplement.
	(binding_cluster::const_iterator_t): New.
	(binding_cluster::binding_cluster): Add store_mgr param.
	(binding_cluster::for_each_value): Reimplement.
	(binding_cluster::empty_p): Reimplement.
	(binding_cluster::for_each_binding): Drop.
	(binding_cluster::begin): Split into const/non-const overloads.
	(binding_cluster::get_map): Add non-const overload.
	(store::get_or_create_cluster): Add store_mgr param.
	(store::mark_as_escaped): Likewise.
	(store::for_each_binding): Drop.
	(store::on_maybe_live_values): Add store_mgr param.
	* svalue.cc (compound_svalue::compound_svalue): Reimplement.
	(compound_svalue::accept): Likewise.
	(compound_svalue::calc_complexity): Likewise.
	(compound_svalue::maybe_fold_bits_within): Likewise.
	* svalue.h (compound_svalue::const_iterator_t): New.
	(compound_svalue::begin): Split into const/non-const overloads.
	(compound_svalue::end): Likewise.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/analyzer_cpython_plugin.cc: Replace INCLUDE_
	defines with include of include "analyzer/common.h".  Update
	for changes to binding_pair.
	* gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise.
	* gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise.

Signed-off-by: David Malcolm <[email protected]>
	PR target/122220
libgcc/config/avr/libf7/
	* libf7-asm.sx (to_integer): Return 0x80... on negative overflow.

gcc/testsuite/
	* gcc.target/avr/pr122220.c: New test.
	PR target/122222
libgcc/config/avr/libf7/
	* libf7-asm.sx (D_floatsidf, D_floatunsidf): New modules.
	* libf7-common.mk (F7_ASM_PARTS): Add D_floatsidf, D_floatunsidf.
	(F7F, g_dx): Remove floatunsidf, floatsidf.
	* libf7.c (f7_set_s32): Don't alias to f7_floatsidf.
	(f7_set_u32): Don't alias to f7_floatunsidf.
	* f7-renames.h: Rebuild
	* f7-wraps.h: Rebuild.

gcc/testsuite/
	* gcc.target/avr/pr122222-sitod.c: New test.
As suggested by Patrick Palka in the bug report, the diagnostic check
for concept_check_p(fn) was being done too late in finish_call_expr(),
which led to an early return inside if (processing_template_decl), which
meant that the error wouldn't be triggered when we are in a type
dependence early exit. This fix makes sure that this error is handled in
the semantic analysis phase, and avoids the failed assertion later in
tsubst_expr().

	PR c++/116477

gcc/cp/ChangeLog:

	* semantics.cc (finish_call_expr): Move concept_check_p diagnostic
	before processing_template_decl check to catch errors earlier.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-pr116477.C: New test.

Signed-off-by: Egas Ribeiro <[email protected]>
… C17

The C++26 https://wg21.link/P3348R4 C++26 should refer to C23 not C17
paper among other things changes va_start macro in the similar way
how C23 has changed it.  Now, unlike C17 and older, C++ has since forever
allowed int (...) but just one wasn't able to use va_start/va_arg/va_end
in such functions.
With the current C++26 draft wording, we'd have to
  #define va_start(V, ...) __builtin_va_start (V, 0)
like we've used for C23 before the PR107980 change.
But Jonathan has kindly filed
https://cplusplus.github.io/LWG/issue4388
which similarly to C23 will if accepted allow to define it as
  #define va_start(...) __builtin_c23_va_start(__VA_ARGS__)
and let the compiler diagnose undesirable cases (see stdarg6.C
testcase in the patch for what it can diagnose, basically anything
that isn't either va_start (ap) or va_start (ap, i) where i is the
last argument's identifier).  This patch implements what assumes
LWG4388 will pass.

It also defines
  #define __STDC_VERSION_STDARG_H__ 202311L
also for C++26.

The hardest part is actually something different.
C23 had to differentiate between C99 void foo (); i.e. unspecified
arguments (but not stdarg) and the new C23 void bar (...); which
is stdarg, but in both cases TYPE_ARG_TYPES (fntype) is NULL.
This has been implemented through the new TYPE_NO_NAMED_ARGS_STDARG_P
flag, fntypes with that flag set are considered stdarg_p and allow
va_start in those, while fntypes with NULL TYPE_ARG_TYPES but the
flag cleared are not stdarg_p, can accept any number of arguments
but can't use va_start.
So, I had to change various places in the C++ FE to pass true
as the third argument to build_function_type for calls which are
meant to be (...) so that one can actually use va_start in those.
Done only for C++26 in order not to disturb older versions too much.
And there is a problem with some of the builtins and #pragma weak
which are using (...) declarations more in the sense of C17
unspecified arguments rather than this call has variable arguments.

So, structural_comptypes now considers the non-C++26 (...) used
for selected builtins and #pragma weak incompatible with C++26 (...)
to avoid ICEs.

2025-10-09  Jakub Jelinek  <[email protected]>

gcc/
	* ginclude/stdarg.h (va_start): Use __builtin_c23_va_start
	also for C++26.
	(__STDC_VERSION_STDARG_H__): Also define for C++26.
gcc/c-family/
	* c-common.h (D_CXX26): Define.
	* c-common.cc (c_common_resword): Add D_CXX26 to
	__builtin_c23_va_start flags, mention D_CXX26 in comment.
gcc/cp/
	* cp-tree.h (cp_build_function_type): Declare.
	* lex.cc: Implement va_start changes from P3348R4 - C++26 should
	refer to C23 not C17 paper.
	(init_reswords): Set D_CXX26 in mask for C++23 and older.
	* parser.cc (cp_parser_primary_expression): Handle RID_C23_VA_START.
	(cp_parser_builtin_c23_va_start): New function.
	* cp-objcp-common.cc (names_builtin_p): Likewise.
	* decl.cc (grokfndecl, check_function_type): Pass
	TYPE_NO_NAMED_ARGS_STDARG_P as last arg to build_function_type.
	(grokdeclarator, static_fn_type): Use cp_build_function_type instead
	of build_function_type.
	* typeck.cc (merge_types): Likewise.
	(structural_comptypes): Return false for TYPE_NO_NAMED_ARGS_STDARG_P
	differences.
	* lambda.cc (maybe_add_lambda_conv_op): Use cp_build_function_type
	instead of build_function_type.
	* tree.cc (cp_build_function_type): New function.
	(strip_typedefs): Pass TYPE_NO_NAMED_ARGS_STDARG_P as last arg to
	build_function_type.
	* name-lookup.cc (push_local_extern_decl_alias): Likewise.
	* module.cc (trees_in::tree_node): Use cp_build_function_type instead
	of build_function_type.
	* pt.cc (copy_default_args_to_explicit_spec,
	rebuild_function_or_method_type, build_deduction_guide): Likewise.
	(alias_ctad_tweaks): Pass TYPE_NO_NAMED_ARGS_STDARG_P as last arg to
	build_function_type.
	* decl2.cc (change_return_type, cp_reconstruct_complex_type):
	Likewise.
gcc/testsuite/
	* c-c++-common/cpp/has-builtin-4.c: Expect
	__has_builtin (__builtin_c23_va_start) == 1 also for C++26.
	* c-c++-common/Wvarargs.c (foo3): Don't expect undefined behavior
	warning for C++26.
	* g++.dg/cpp26/stdarg1.C: New test.
	* g++.dg/cpp26/stdarg2.C: New test.
	* g++.dg/cpp26/stdarg3.C: New test.
	* g++.dg/cpp26/stdarg4.C: New test.
	* g++.dg/cpp26/stdarg5.C: New test.
	* g++.dg/cpp26/stdarg6.C: New test.
	* g++.dg/cpp26/stdarg7.C: New test.
	* g++.dg/cpp26/stdarg8.C: New test.
	* g++.dg/cpp26/stdarg9.C: New test.
	* g++.dg/opt/pr60849.C (foo): Add explicit cast.
Add two new c-family attributes, "btf_type_tag" and "btf_decl_tag"
along with attribute handlers for them.  These attributes may be
used to annotate types or declarations respectively with arbitrary
strings, which will be recorded in DWARF and/or BTF information.
Both attributes accept exactly one string argument.  Wide strings
are not supported.

gcc/c-family/
	* c-attribs.cc (c_common_attribute_table): Add btf_decl_tag and
	btf_type_tag attributes.
	(handle_btf_decl_tag_attribute): New handler for btf_decl_tag.
	(hanlde_btf_type_tag_attribute): New handler for btf_type_tag.
	(btf_tag_args_ok): Helper for new attribute handlers.

gcc/testsuite/
	* gcc.dg/attr-btf-decl-tag-1.c: New test.
	* gcc.dg/attr-btf-decl-tag-2.c: New test.
	* gcc.dg/attr-btf-type-tag-1.c: New test.
	* gcc.dg/attr-btf-type-tag-2.c: New test.
	* gcc.dg/attr-btf-type-tag-3.c: New test.
The btf_decl_tag and btf_type_tag attributes provide a means to annotate
declarations and types respectively with arbitrary user provided
strings.  These strings are recorded in debug information for
post-compilation uses, and despite the name they are meant to be
recorded in DWARF as well as BTF.  New DWARF extensions
DW_TAG_GNU_annotation and DW_AT_GNU_annotation are used to represent
these user annotations in DWARF.

This patch introduces the new DWARF extension DIE and attribute, and
generates them as necessary to represent user annotations from
btf_decl_tag and btf_type_tag.

The format of the new DIE is as follows:

    DW_TAG_GNU_annotation
        DW_AT_name: "btf_decl_tag" or "btf_type_tag"
        DW_AT_const_value: <arbitrary user-supplied string>
        DW_AT_GNU_annotation: <reference to another TAG_GNU_annotation DIE>

DW_AT_GNU_annotation is a new attribute extension used to refer to these
new annotation DIEs.  If non-null in any given declaration or type DIE,
it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation
for that declaration or type.  In addition, the DW_TAG_GNU_annotation
DIEs may also have a non-null DW_AT_GNU_annotation, referring to another
annotation DIE.  This allows chains of annotation DIEs to be formed,
such as in the case where a single declaration has multiple instances of
btf_decl_tag with different string annotations.

gcc/
	* dwarf2out.cc (struct annotation_node, struct annotation_node_hasher)
	(btf_tag_htab): New ancillary structures and hash table.
	(annotation_node_hasher::hash, annotation_node_hasher::equal): New.
	(hash_btf_tag, gen_btf_tag_dies, maybe_gen_btf_type_tag_dies)
	(maybe_gen_btf_decl_tag_dies): New functions.
	(modified_type_die): Add new argument to pass type attributes.
	Handle btf_type_tag, and update recursive calls.
	(base_type_for_mode): Add new arg for modified_type_die call.
	(add_type_attribute): Likewise.
	(gen_array_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_formal_parameter_die): Call maybe_gen_btf_decl_tag_dies for the
	parameter.
	(override_type_for_decl_p): Add new arg for modified_type_die call.
	(force_type_die): Likewise.
	(gen_tagged_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_decl_die): Call maybe_gen_btf_decl_tag_dies for the decl.
	(dwarf2out_finish): Empty btf_tag_htab.
	(dwarf2out_cc_finalize): Delete btf_tag_htab hash table.

include/
	* dwarf2.def (DW_TAG_GNU_annotation): New DWARF extension.
	(DW_AT_GNU_annotation): Likewise.

gcc/testsuite/
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-6.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-7.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-8.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-9.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: New test.
Translate DW_TAG_GNU_annotation DIEs created for C attributes
btf_decl_tag and btf_type_tag into an in-memory representation in the
CTF/BTF container.  They will be output in BTF as BTF_KIND_DECL_TAG and
BTF_KIND_TYPE_TAG records.

The new CTF kinds used to represent these annotations, CTF_K_DECL_TAG
and CTF_K_TYPE_TAG, are expected to be formalized in the next version of
the CTF specification.  For now they only exist in memory as a
translation step to BTF, and are not emitted when generating CTF
information.

gcc/
	* ctfc.cc (ctf_dtu_d_union_selector): Handle CTF_K_DECL_TAG and
	CTF_K_TYPE_TAG.
	(ctf_add_type_tag, ctf_add_decl_tag): New.
	(ctf_add_variable): Return the new ctf_dvdef_ref rather than zero.
	(new_ctf_container): Initialize new members.
	(ctfc_delete_container): Deallocate new members.
	* ctfc.h (ctf_dvdef, ctf_dvdef_t, ctf_dvdef_ref): Move forward
	declarations earlier in file.
	(ctf_decl_tag_t): New typedef.
	(ctf_dtdef): Add ctf_decl_tag_t member to dtd_u union.
	(ctf_dtu_d_union_enum): Add new CTF_DTU_D_TAG enumerator.
	(ctf_container): Add ctfc_tags vector and ctfc_type_tags_map hash_map
	members.
	(ctf_add_type_tag, ctf_add_decl_tag): New function protos.
	(ctf_add_variable): Change prototype return type to ctf_dvdef_ref.
	* dwarf2ctf.cc (gen_ctf_type_tags, gen_ctf_decl_tags)
	(gen_ctf_decl_tags_for_var): New static functions.
	(gen_ctf_pointer_type): Handle type tags.
	(gen_ctf_sou_type): Handle decl tags.
	(gen_ctf_function_type): Likewise.
	(gen_ctf_variable): Likewise.
	(gen_ctf_function): Likewise.
	(gen_ctf_type): Handle TAG_GNU_annotation DIEs.

gcc/testsuite/
	* gcc.dg/debug/ctf/ctf-decl-tag-1.c: New test.
	* gcc.dg/debug/ctf/ctf-type-tag-1.c: New test.

include/
	* ctf.h (CTF_K_DECL_TAG, CTF_K_TYPE_TAG): New defines.
Support the btf_decl_tag and btf_type_tag attributes in BTF by creating
and emitting BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG records,
respectively, for them.

Some care is required when -gprune-btf is in effect to avoid emitting
decl or type tags for declarations or types which have been pruned and
will not be emitted in BTF.

gcc/
	* btfout.cc (get_btf_kind): Handle DECL_TAG and TYPE_TAG kinds.
	(btf_calc_num_vbytes): Likewise.
	(btf_asm_type): Likewise.
	(output_asm_btf_vlen_bytes): Likewise.
	(output_btf_tags): New.
	(btf_output): Call it here.
	(btf_add_used_type): Replace with simple wrapper around...
	(btf_add_used_type_1): ...the implementation.  Handle
	BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG.
	(btf_add_vars): Update btf_add_used_type call.
	(btf_assign_tag_ids): New.
	(btf_mark_type_used): Update btf_add_used_type call.
	(btf_collect_pruned_types): Likewise.  Handle type and decl tags.
	(btf_finish): Call btf_assign_tag_ids.

gcc/testsuite/
	* gcc.dg/debug/btf/btf-decl-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-c2x-1.c: New test.

include/
	* btf.h (BTF_KIND_DECL_TAG, BTF_KIND_TYPE_TAG) New defines.
	(struct btf_decl_tag): New.
gcc/
	* doc/extend.texi (Common Function Attributes)
	(Common Variable Attributes): Document btf_decl_tag attribute.
	(Common Type Attributes): Document btf_type_tag attribute.
Add a couple of tests to ensure that BTF type/decl tags do not interfere
with generation of BPF CO-RE relocations.

gcc/testsuite/
	* gcc.target/bpf/core-btf-tag-1.c: New test.
	* gcc.target/bpf/core-btf-tag-2.c: New test.
…21929]

Previously, formatting a year_month_weekday with the weekday index equal to
0, 6, or 7 (which are !ok() values in the supported range) produced a
seemingly correct day output. For example %Y-%m-%d produced:
 * 2024-09-06 for 2024y/September/Sunday[6] (2024-10-06)
 * 2024-09-25 for 2024y/September/Sunday[0] (2023-08-25)

This patch changes how the internal _M_day value is computed for
year_month_weekday. Instead of converting to local_days then to year_month_day,
_M_day is now set as the number of days since ymd.year()/ymd.month()/0. If this
difference is negative (which occurs when index() is 0), _M_day is set to 0 to
avoid handling negative days of the month.

This change yields identical results for all ok() values. However, for !ok() dates,
it now consistently produces invalid dates, ensuring the formatted output clearly
reflects the !ok input state:
 * 2024-09-36 for 2024y/September/Sunday[6]
 * 2024-09-00 for 2024y/September/Sunday[0]

For consistency, _M_day is computed in the same manner for year_month_weekday_last.

Finally, for year_month_day_last, we fill _M_day directly with ymd.day().
This provides a more efficient implementation and avoids the need to compute
local_days for %Y-%m-%d, %F and similar specifiers.

	PR libstdc++/121929

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (_ChronoData::_M_fill_aux)
	(_ChronoData::_M_fill_aux): Add comment documenting precondition.
	(formatter<chrono::year_month_day, _CharT>::format): Compute
	local_days inline.
	(formatter<chrono::year_month_day_last, _CharT>::format)
	(formatter<chrono::year_month_weekday, _CharT>::format)
	(formatter<chrono::year_month_weekday_last, _CharT>::format):
	Change how the _M_day field is computed.
	* testsuite/std/time/year_month_weekday/io.cc: Adjust tests.

Reviewed-by: Jonathan Wakely <[email protected]>
Signed-off-by: Tomasz Kamiński <[email protected]>
Implements P3233R1 (DR for C++20/C++11, fixes LWG 4069 and 3508).

This commit implements std::atomic_ref<cv T> support (LWG3508) as DR for
C++20, by  extractingparts of the __atomic_ref class (that atomic_ref inherits
from) into a further base class (__atomic_ref_base):

* __atomic_ref_base<const T> implements non-mutating (const) atomic API.
  Single base class is used, and the difference in is_always_lock_free and
  required_aligment values between types are handled by _S_is_always_lock_free,
  _S_required_aligment helper functions.
* __atomic_ref_base<T> implements the common atomic APIs. The non-mutating
  operations are handled by inherting from __atomic_ref_base<const T> partial
  partial specialization. Tu support that __atomic_ref_base<const T> stores
  mutable pointer to T, and performs const_cast in constructor.
* __atomic_ref<T, ....> inherits from __atomic_ref_base<T>, and implement
  type-specific mutable APIs (fetch_add, -=, ...) and difference_type member
  type.
* __atomic_ref<const T, ...> inherits from __atomic_ref_base<const T>
  and adds different_type member, whose presence and denoted type depends
  on T.

The __atomic_ref specialization selection is adjusted to handle cv-qualified
bool (add remove_cv_t) and pointer types. To handle the later, additional
constant template parameter is introduced.

The atomic wait and notify operations are currently not supported for volatile
types, to signal that static assert is added to corresponding methods of
atomic_ref.

At the same time,  disable support for cv-qualified types in std::atomic
(for instance, std::atomic<volatile T> isn't meaningful; one should use
volatile std::atomic<T>), again as per the paper, resolving LWG4069 as DR
for C++11. This only affects atomic<volatile T>, as specialization
atomic with const-qualifed types was already producing an compile-time
error.

	PR libstdc++/115402

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (__atomic_ref_base<const _Tp>)
	(__atomic_ref_base<_Tp>): Define by extracting common methods
	from atomic_ref specializations.
	(__atomic_ref<_Tp, In, Fp, Pt>): Inherit from __atomic_ref_base
	and remove extracted method.
	(__atomic_ref<const _Tp, In, Fp, Pt>): Define.
	* include/std/atomic (std::atomic): Added an
	* testsuite/29_atomics/atomic/requirements/types_neg.cc:
	Add test for volatile qualified types.
	* testsuite/29_atomics/atomic_ref/bool.cc: Move the content
	to op_support.cc, add test for bool.
	* testsuite/29_atomics/atomic_ref/op_support.cc: New test
	expanded from atomic_ref/bool.cc.
	* testsuite/29_atomics/atomic_ref/cv_qual.cc: New test.
	* testsuite/29_atomics/atomic_ref/requirements_neg.cc: New test.
	* testsuite/29_atomics/atomic_ref/deduction.cc: Add tests for
	cv-qualified types.
	* testsuite/29_atomics/atomic_ref/float.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/requirements.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Add tests for
	const qualified types.

Reviewed-by: Jonathan Wakely <[email protected]>
Co-authored-by: Tomasz Kamiński <[email protected]>
Signed-off-by: Giuseppe D'Angelo <[email protected]>
Signed-off-by: Tomasz Kamiński <[email protected]>
The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
	for std::print dependencies.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
	* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
	Define new variable template.
	* include/bits/version.def (print): Bump value.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for variable template.
	* include/std/ostream (print) [!_WIN32]: Do not use
	vprint_unicode at all.
	(println): Append newline to format string instead of formatting
	twice.
	* include/std/print (_File_sink): New class.
	(vprint_nonunicode_locking): New function.
	(vprint_unicode_locking): New function reusing previous code
	from vprint_unicode.
	(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
	vprint_unicode_locking otherwise.
	(print): [!_WIN32]: Do no use vprint_unicode at all.
	Check enable_nonlocking_formatter_optimization and defer to
	either vprint_nonunicode_locking or vprint_nonunicode.
	(println): Use vprint_unicode or format directly to a _File_sink
	instead of formatting twice.
	* testsuite/27_io/print/1.cc: Updated and added new tests.
	* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely <[email protected]>
Reviewed-by: Tomasz Kamiński <[email protected]>
Co-authored-by: Tomasz Kamiński <[email protected]>
This patch implements additional enable_nonlocking_formatter_optimization
specializations listed in P3235R3.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h
	(enable_nonlocking_formatter_optimization): Define specializations
	for chrono types.
	* include/bits/version.def (print): Bump.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for pair, tuple and ranges.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Define specializations for queue and priority_queue.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Define specialization for stack.
	* include/std/stacktrace (enable_nonlocking_formatter_optimization):
	Define specialization for basic_stacktrace and stacktrace_entry.
	* include/std/thread (enable_nonlocking_formatter_optimization):
	Define specialization for thread::id.
	* include/std/vector (enable_nonlocking_formatter_optimization):
	Define specialization for vector<bool>::reference.
	* testsuite/23_containers/vector/bool/format.cc: Test value of
	enable_nonlocking_formatter_optimization.
	* testsuite/30_threads/thread/id/output.cc: Likewise.
	* testsuite/std/format/ranges/adaptors.cc: Likewise.
	* testsuite/std/format/ranges/formatter.cc: Likewise.
	* testsuite/std/format/tuple.cc: Likewise.
	* testsuite/std/time/format/empty_spec.cc: Extract Rep class
	to custom_rep.h.
	* testsuite/std/time/format/custom_rep.h: Extracted from
	empty_spec.cc.
	* testsuite/std/time/format/nonlocking.cc: New test.

Reviewed-by: Jonathan Wakely <[email protected]>
…tions [PR121790]

This patch addresses several issues related to the additional specializations
for enable_nonlocking_formatter_optimization fomr P3235R3 proposal:

* LWG4399 [1]: Apply remove_cvref_t to tuple and pair elements when checking if
	the direct printing optimization is enabled.
* LWG4398 [2]: Disable the direct printing optimization for the standard library
	 container adaptors: queue, priority_queue, and stack.
* LWG4400 [3]: Enable the direct printing optimization only for durations that
	 use standard arithmetic types. Conditionally enable it for hh_mm_ss
	 and time_points based on their underlying Duration template argument.

[1] https://cplusplus.github.io/LWG/issue4399
[2] https://cplusplus.github.io/LWG/issue4398
[3] https://cplusplus.github.io/LWG/issue4400

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (enable_nonlocking_formatter_optimization):
	Adjust specializations for duration, hh_mm_ss and time_points.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Apply remove_cvref_t on pair and tuple elements.
	* include/std/queue (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* include/std/stack (enable_nonlocking_formatter_optimization):
	Change specialization value to false.
	* testsuite/std/format/ranges/adaptors.cc: Adjusted tests.
	* testsuite/std/format/tuple.cc: Adjusted tests.
	* testsuite/std/time/format/nonlocking.cc: Adjusted tests.

Reviewed-by: Jonathan Wakely <[email protected]>
The following fixes return stmt type verification by properly looking
at DECL_RESULT to decide whether that's by reference, not trying to
figure that from the actual argument.

	PR tree-optimization/122225
	* tree-cfg.cc (verify_gimple_return): Look at DECL_RESULT
	for DECL_BY_REFERENCE.
The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

	* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
	HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
	(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
	* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.
In gcc-16-4314-g5e9eecc6686 I meant to remove all uses of TYPE
in support_vector_misalignment but apparently forgot this one.
Fixing by using the inner mode's size.

gcc/ChangeLog:

	* config/arm/arm.cc (arm_builtin_support_vector_misalignment):
	Remove use of type.
The following uses gimple_build to do the conversion simplification
in build_and_insert_cast instead of duplicating it there.  Conveniently
when building directly into the IL all stmts are taken into account
for the simplification.

	PR tree-optimization/122111
	* tree-ssa-math-opts.cc (build_and_insert_cast): Remove
	conversion simplification, instead use gimple_convert.

	* gcc.target/arm/pr122111.c: New test.
This commit introduces a new -mtune=rmx100 tuning option together with
relevant scheduler definitions. Instruction latencies and costs are based on
the "RMX-100 Technical Reference Manual" document (revision 0.4, 13
September 2023) and are subject to change.

The changes have been verified by running the Dhrystone and Coremark benchmarks
and observing expected (small) improvements compared to the -mtune=generic
results.

Signed-off-by: Artemiy Volkov <[email protected]>
This commit adds the new arcv-mpy-option compilation parameter with the valid
(string) values of 1c, 2c, and 10c.  This corresponds to different versions of
the MPY/DIV unit of the RMX100 core, each of which has different latencies for
imul/idiv instructions.

Internally, this option is propagated to the pipeline description information
in rmx100.md with the use of new helper functions defined in riscv.cc.

Signed-off-by: Artemiy Volkov <[email protected]>
This patch adds latencies related to FPU instructions to arcv-rmx100.md.
The specific values used correspond to the 'fast' config, except fdiv
where the latency was reduced to 10 cycles.  In the future, FP latencies
for RMX-100 should be made dependent on an external (-mfpu-like) option.

Signed-off-by: Artemiy Volkov <[email protected]>
@MichielDerhaeg MichielDerhaeg force-pushed the michiel/upstream_rmx100 branch from 2fa36eb to 8b7268c Compare October 10, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.