Commit Graph

223961 Commits

Author SHA1 Message Date
David Faust
ac7027f180 dwarf: create annotation DIEs for btf tags
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.
2025-10-09 14:13:23 -07:00
David Faust
7e80927e9b c-family: add btf_type_tag and btf_decl_tag attributes
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.
2025-10-09 14:13:23 -07:00
Jakub Jelinek
4e44fe4280 c++: C++26 va_start - part of P3348R4 - C++26 should refer to C23 not 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  <jakub@redhat.com>

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.
2025-10-09 22:41:30 +02:00
Egas Ribeiro
4ee06690a4 c++: Fix ICE with concept used as function [PR116477]
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 <egas.g.ribeiro@tecnico.ulisboa.pt>
2025-10-09 21:27:11 +01:00
Georg-Johann Lay
078208cf15 AVR: target/122222 - Add modules for __floatsidf, __floatunsidf.
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.
2025-10-09 21:55:11 +02:00
Georg-Johann Lay
3ea09e4d43 AVR: target/122220 - Let (int32_t) -0x1p31L return INT32_MIN.
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.
2025-10-09 21:55:10 +02:00
David Malcolm
310a70ef6d analyzer: reimplement binding_map using a "spatial" representation
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 <dmalcolm@redhat.com>
2025-10-09 14:41:28 -04:00
Dimitar Dimitrov
ccb2a10820 testsuite: Explicitly enable cselim pass for cselim-2.c
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 <dimitar@dinux.eu>
2025-10-09 20:34:29 +03:00
Harald Anlauf
c474a50b42 Fortran: fix "unstable" interfaces of external procedures [PR122206]
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.
2025-10-09 19:05:17 +02:00
Jakub Jelinek
579de8f529 gimplify: Fix up side-effect handling in 2nd __builtin_c[lt]zg argument [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  <jakub@redhat.com>

	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.
2025-10-09 18:06:39 +02:00
David Malcolm
0558c6028e diagnostics: add class sink::extension
This patch provides a way for plugins to add extra information
to a diagnostic sink, potentially capturing more information via
a "finalizer" hook.

gcc/c-family/ChangeLog:
	* c-opts.cc: Define INCLUDE_VECTOR.

gcc/cp/ChangeLog:
	* error.cc: Define INCLUDE_VECTOR.

gcc/ChangeLog:
	* diagnostic-global-context.cc: Define INCLUDE_VECTOR.
	* diagnostics/buffering.cc: Likewise.
	* diagnostics/context.cc (context::finish): Call
	finalize_extensions on each sink.
	(sink::dump): Dump any extensions.
	(sink::finalize_extensions): New.
	* diagnostics/macro-unwinding.cc: Define INCLUDE_VECTOR.
	* diagnostics/selftest-context.cc: Likewise.
	* diagnostics/sink.h (class sink::extension): New.
	(sink::add_extension): New.
	(sink::finalize_extensions): New decl.
	(sink::m_extensions): New member.
	* gcc.cc: Define INCLUDE_VECTOR.
	* langhooks.cc: Likewise.
	* opts.cc: Likewise.
	* tree-diagnostic-client-data-hooks.cc: Likewise.
	* tree-diagnostic.cc: Likewise.

gcc/fortran/ChangeLog:
	* error.cc: Define INCLUDE_VECTOR.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic_group_plugin.cc: Define INCLUDE_VECTOR.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
	* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.

libcc1/ChangeLog:
	* context.cc: Define INCLUDE_VECTOR.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-10-09 11:38:50 -04:00
Jonathan Wakely
ea05497d4a libstdc++: Extend constexpr if to C++14 in _Hashtable::_S_nothrow_move()
We can use diagnostic pragmas to allow the constexpr if version of this
function to be used for C++14 as well. We still need the __and_ version
for C++11 because we can't use 'if' in constexpr functions at all before
C++14.

Also use the integral_constant::value static data member instead of
invoking integral_constant::operator(), as it's a tiny bit cheaper to
compiler.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable.h (_Hashtable::_S_nothrow_move): Use
	diagnostic pragmas to allow constexpr if in C++14. Use value
	member instead of operator().

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-10-09 15:26:08 +01:00
Jonathan Wakely
71e95e871d libstdc++: Tweak comment on generated #endif lines in bits/version.h
Make the #endif comment match the #if condition in the generated code.

Also adjust a comment in the Scheme code which describes the logic. The
__glibcxx_NAME macro is not defined _unconditionally_, as it still
depends on the conditions in cxxmin, extra_cond etca,. and the
__cpp_lib_NAME macro now depends on no_stdname too.

libstdc++-v3/ChangeLog:

	* include/bits/version.tpl: Fix comment on #endif. Tweak
	description of when macros are defined.
	* include/bits/version.h: Regenerate.

Reviewed-by: Arsen Arsenović <arsen@aarsen.me>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-10-09 15:25:59 +01:00
Filip Kastl
0738f0ae35 tree-ssa-structalias: Put constraint building into its own file
This patch cuts out points-to constraint building from
tree-ssa-structalias.cc and places it into a new file
gimple-ssa-pta-constraints.cc.

The diff of tree-ssa-structalias.cc ended up being messy, so here is a
summary of changes I made that may not be apparent at first glance.
I didn't do any functional changes.  Everything is just shifting
functions and declarations around and giving external linkage to some
things.

- These functions now have external linkage and got shifted to the
  beginning of the file:
determine_global_memory_access
fndecl_maybe_in_other_partition
new_var_info
- The using namespace pointer_analysis directive got shifted to the
  beginning of the file
- Declarations of these global variables got shifted to the beginning of
  the file:
variable_info_pool
final_solutions
final_solutions_obstack
- These global variables got external linkage:
use_field_sensitive
in_ipa_mode

gcc/ChangeLog:

	* Makefile.in: Add gimple-ssa-pta-constraints.cc.
	* tree-ssa-structalias.cc (determine_global_memory_access):
	External linkage, move to namespace pointer_analysis.
	(fndecl_maybe_in_other_partition): External linkage, move to
	namespace pointer_analysis.
	(new_var_info): External linkage, move to namespace
	pointer_analysis.
	(create_variable_info_for): Move to
	gimple-ssa-pta-constraints.cc.
	(lookup_vi_for_tree): External linkage, move to namespace
	pointer_analysis, move to gimple-ssa-pta-constraints.cc.
	(type_can_have_subvars): Move to gimple-ssa-pta-constraints.cc.
	(make_param_constraints): Move to gimple-ssa-pta-constraints.cc.
	(get_call_vi): Move to gimple-ssa-pta-constraints.cc.
	(lookup_call_use_vi): External linkage, move to namespace
	pointer_analysis, move to gimple-ssa-pta-constraints.cc.
	(lookup_call_clobber_vi): External linkage, move to namespace
	pointer_analysis, move to gimple-ssa-pta-constraints.cc.
	(get_call_use_vi): Move to gimple-ssa-pta-constraints.cc.
	(get_call_clobber_vi): Move to gimple-ssa-pta-constraints.cc.
	(get_constraint_for_1): Move to gimple-ssa-pta-constraints.cc.
	(get_constraint_for): Move to gimple-ssa-pta-constraints.cc.
	(get_constraint_for_rhs): Move to gimple-ssa-pta-constraints.cc.
	(do_deref): Move to gimple-ssa-pta-constraints.cc.
	(constraint_pool): Move to gimple-ssa-pta-constraints.cc.
	(new_constraint): Move to gimple-ssa-pta-constraints.cc.
	(insert_vi_for_tree): Move to gimple-ssa-pta-constraints.cc.
	(alias_get_name): Move to gimple-ssa-pta-constraints.cc.
	(get_vi_for_tree): Move to gimple-ssa-pta-constraints.cc.
	(new_scalar_tmp_constraint_exp): Move to
	gimple-ssa-pta-constraints.cc.
	(get_constraint_for_ssa_var): Move to
	gimple-ssa-pta-constraints.cc.
	(process_constraint): Move to gimple-ssa-pta-constraints.cc.
	(bitpos_of_field): Move to gimple-ssa-pta-constraints.cc.
	(get_constraint_for_ptr_offset): Move to
	gimple-ssa-pta-constraints.cc.
	(get_constraint_for_component_ref): Move to
	gimple-ssa-pta-constraints.cc.
	(get_constraint_for_address_of): Move to
	gimple-ssa-pta-constraints.cc.
	(process_all_all_constraints): Move to
	gimple-ssa-pta-constraints.cc.
	(do_structure_copy): Move to gimple-ssa-pta-constraints.cc.
	(make_constraints_to): Move to gimple-ssa-pta-constraints.cc.
	(make_constraint_to): Move to gimple-ssa-pta-constraints.cc.
	(make_constraint_from): Move to gimple-ssa-pta-constraints.cc.
	(make_copy_constraint): Move to gimple-ssa-pta-constraints.cc.
	(make_escape_constraint): Move to gimple-ssa-pta-constraints.cc.
	(make_indirect_escape_constraint): Move to
	gimple-ssa-pta-constraints.cc.
	(make_transitive_closure_constraints): Move to
	gimple-ssa-pta-constraints.cc.
	(make_any_offset_constraints): Move to
	gimple-ssa-pta-constraints.cc.
	(struct obstack fake_var_decl_obstack): Move to
	gimple-ssa-pta-constraints.cc.
	(build_fake_var_decl): Move to gimple-ssa-pta-constraints.cc.
	(make_heapvar): Move to gimple-ssa-pta-constraints.cc.
	(make_constraint_from_restrict): Move to
	gimple-ssa-pta-constraints.cc.
	(make_constraint_from_global_restrict): Move to
	gimple-ssa-pta-constraints.cc.
	(get_function_part_constraint): Move to
	gimple-ssa-pta-constraints.cc.
	(handle_call_arg): Move to gimple-ssa-pta-constraints.cc.
	(handle_rhs_call): Move to gimple-ssa-pta-constraints.cc.
	(handle_lhs_call): Move to gimple-ssa-pta-constraints.cc.
	(get_fi_for_callee): Move to gimple-ssa-pta-constraints.cc.
	(find_func_aliases_for_call_arg): Move to
	gimple-ssa-pta-constraints.cc.
	(find_func_aliases_for_builtin_call): Move to
	gimple-ssa-pta-constraints.cc.
	(find_func_aliases_for_call): Move to
	gimple-ssa-pta-constraints.cc.
	(find_func_aliases): Move to gimple-ssa-pta-constraints.cc.
	(process_ipa_clobber): Move to gimple-ssa-pta-constraints.cc.
	(find_func_clobbers): Move to gimple-ssa-pta-constraints.cc.
	(struct fieldoff): Move to gimple-ssa-pta-constraints.cc.
	(fieldoff_compare): Move to gimple-ssa-pta-constraints.cc.
	(sort_fieldstack): Move to gimple-ssa-pta-constraints.cc.
	(var_can_have_subvars): Move to gimple-ssa-pta-constraints.cc.
	(type_must_have_pointers): Move to
	gimple-ssa-pta-constraints.cc.
	(field_must_have_pointers): Move to
	gimple-ssa-pta-constraints.cc.
	(push_fields_onto_fieldstack): Move to
	gimple-ssa-pta-constraints.cc.
	(count_num_arguments): Move to gimple-ssa-pta-constraints.cc.
	(create_function_info_for): Move to
	gimple-ssa-pta-constraints.cc.
	(check_for_overlaps): Move to gimple-ssa-pta-constraints.cc.
	(create_variable_info_for_1): Move to
	gimple-ssa-pta-constraints.cc.
	(intra_create_variable_infos): Move to
	gimple-ssa-pta-constraints.cc.
	(init_base_vars): Move to gimple-ssa-pta-constraints.cc.
	(init_constraint_builder): Move to
	gimple-ssa-pta-constraints.cc.
	(delete_constraint_builder): Move to
	gimple-ssa-pta-constraints.cc.
	(intra_build_constraints): Move to
	gimple-ssa-pta-constraints.cc.
	(delete_points_to_sets): Move to gimple-ssa-pta-constraints.cc.
	(associate_varinfo_to_alias): Move to
	gimple-ssa-pta-constraints.cc
	(refered_from_nonlocal_fn): Move to
	gimple-ssa-pta-constraints.cc
	(refered_from_nonlocal_var): Move to
	gimple-ssa-pta-constraints.cc
	(ipa_create_function_infos): Move to
	gimple-ssa-pta-constraints.cc
	(ipa_create_global_variable_infos): Move to
	gimple-ssa-pta-constraints.cc
	(ipa_build_constraints): Move to gimple-ssa-pta-constraints.cc
	* tree-ssa-structalias.h (struct constraint_stats):
	(determine_global_memory_access): External linkage, move to
	namespace pointer_analysis.
	(fndecl_maybe_in_other_partition): External linkage, move to
	namespace pointer_analysis.
	(new_var_info): External linkage, move to namespace
	pointer_analysis.
	* gimple-ssa-pta-constraints.cc: New file.
	* gimple-ssa-pta-constraints.h: New file.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
2025-10-09 14:24:52 +02:00
Filip Kastl
8581d66ec6 tree-ssa-structalias: Put constraint building into separate functions
Preparation for splitting out constraint building into a separate source
file.  This patch splits out constraint building from
compute_points_to_sets and ipa_pta_execute into separate functions.
It also moves initializing and cleaning up constraint building stuff
into separate functions.

gcc/ChangeLog:

	* tree-ssa-structalias.cc (init_constraint_builder): New
	function.
	(delete_constraint_builder): New function.
	(compute_points_to_sets): Put constraint building into
	intra_build_constraints and call it.
	(intra_build_constraints): New function.
	(delete_points_to_sets): Put cleanup of constraint builder
	global vars into delete_constraint_builder and call it.
	(ipa_pta_execute): Put constraint building into
	ipa_build_constraints and call it.
	(ipa_create_function_infos): New function.
	(ipa_create_global_variable_infos): New function.
	(ipa_build_constraints): New function.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
2025-10-09 14:24:52 +02:00
Tomasz Kamiński
f379367635 libstdc++: Formatting tests for std::chrono date types.
This covers year_month_day_last, year_month_weekday, year_month_weekday_last.

libstdc++-v3/ChangeLog:

	* testsuite/std/time/year_month_day_last/io.cc: New formatting tests.
	* testsuite/std/time/year_month_weekday/io.cc: Likewise.
	* testsuite/std/time/year_month_weekday_last/io.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-10-09 14:10:21 +02:00
Takayuki 'January June' Suwa
5ff9cd5f7f xtensa: constantsynth: Update to version 2
This patch completely replaces the existing "constantsynth" with a new
implementation, which has become unsightly due to the extension.

This new version offers the following benefits:

  - Independence from the insn splitting mechanism.  No define_split
    descriptions are required
  - Resource saving as internally required information storage no longer
    persists across passes
  - The replacement of insns is based on the actual costs (for both size
    and speed) of the insns before and after the conversion, rather than
    on some arbitrary pre-determined ones
  - The replacing insn sequence is verified by formally evaluating the
    RTL expressions to see if it correctly computes the original constant
    value
  - Easy-to-understand/-add interface for constant synthesis methods

The built-in synthesis methods are (supposedly) very effective, with 2
instructions for certain values and up to 5 instructions to cover all
32-bit values.

     /* example */
     _Complex double test(int a[], float b[]) {
       a[0] = 2045 * 2045;
       a[1] = 0xDEADBEEF;
       a[2] = 0xDEADBEEF - 15;
       a[3] = 4182000;
       a[4] = 131071;
       a[5] = 293805;
       a[6] = 700972933;
       a[7] = -372738139;
       b[0] = 3.14159265359f;
       b[1] *= 0.12005615234375f;
       return 1-1i;
     }

     ;; result (-O2 -mextra-l32r-costs=5)
     test:
     	entry	sp, 32
     	movi	a8, 0x7af
     	float.s	f1, a8, 14
     	movi	a8, 0x7fd
     	mull	a8, a8, a8
     	lsi	f0, a3, 4
     	s32i.n	a8, a2, 0
     	movi.n	a8, 0x57
     	addmi	a8, a8, -0x1100
     	slli	a8, a8, 17
     	addmi	a8, a8, -0x4100
     	addi	a8, a8, -17
     	s32i.n	a8, a2, 4
     	addi	a8, a8, -15
     	s32i.n	a8, a2, 8
     	movi	a8, 0x3fd
     	slli	a8, a8, 12
     	addi	a8, a8, -16
     	s32i.n	a8, a2, 12
     	movi.n	a8, -1
     	srli	a8, a8, 15
     	s32i.n	a8, a2, 16
     	movi	a8, 0x85
     	addmi	a8, a8, 0x7f00
     	addx8	a8, a8, a8
     	s32i.n	a8, a2, 20
     	movi	a8, 0x539
     	slli	a8, a8, 19
     	addi	a8, a8, -123
     	s32i.n	a8, a2, 24
     	movi	a8, -0x2c7
     	slli	a8, a8, 19
     	addmi	a8, a8, 0x7800
     	addi	a8, a8, -91
     	s32i.n	a8, a2, 28
     	movi.n	a8, 0x49
     	mul.s	f0, f0, f1
     	addmi	a8, a8, 0x4000
     	slli	a8, a8, 16
     	addmi	a8, a8, 0x1000
     	addi	a8, a8, -37
     	s32i.n	a8, a3, 0
     	ssi	f0, a3, 4
     	movi	a5, -0x401
     	movi	a3, 0x3ff
     	movi.n	a2, 0
     	slli	a3, a3, 20
     	movi.n	a4, 0
     	slli	a5, a5, 20
     	retw.n

gcc/ChangeLog:

	* config/xtensa/xtensa-protos.h (xtensa_constantsynth): Remove.
	* config/xtensa/xtensa.cc
	(#include): Remove "context.h" and "pass_manager.h".
	(machine_function): Remove "litpool_usage" member.
	(xtensa_constantsynth_2insn, xtensa_constantsynth_rtx_SLLI,
	xtensa_constantsynth_rtx_ADDSUBX, xtensa_constantsynth): Remove.
	(constantsynth_method_lshr_m1, split_hwi_to_MOVI_ADDMI,
	constantsynth_method_16bits, constantsynth_method_32bits,
	constantsynth_method_square): New worker function related to
	constant synthesis methods.
	(constantsynth_method_info, constantsynth_methods):
	New structure representing the list of all constant synthesis
	methods.
	(constantsynth_info): New structure that stores internal
	information for "constantsynth".
	(constantsynth_pass1, verify_synth_seq, constantsynth_pass2):
	New functions that are the core of "constantsynth".
	(do_largeconst): Add a call to constantsynth_pass1() to the insn
	enumeration loop, and add a call to constantsynth_pass2() to the
	end of this function.
	* config/xtensa/xtensa.md (SHI): Remove.
	(The two auxiliary define_splits for mov[sh]i_internal): Remove.
	(The two auxiliary define_splits for movsf_internal): Remove.

gcc/testsuite/ChangeLog:

	* gcc.target/xtensa/constsynth_2insns.c,
	gcc.target/xtensa/constsynth_3insns.c,
	gcc.target/xtensa/constsynth_double.c: Remove due to outdated.
	* gcc.target/xtensa/constsynthV2_O2_costs0.c,
	gcc.target/xtensa/constsynthV2_O2_costs5.c,
	gcc.target/xtensa/constsynthV2_Os.c: New.
2025-10-09 02:29:37 -07:00
Takayuki 'January June' Suwa
b6af5f46e3 xtensa: Change the splitting of D[IF]mode constant assignments to be implemented in xt_largeconst instead of define_split
This patch moves the process of splitting D[IF]mode constant assignments
into SImode ones from the define_split implementation after reloading to
processing within the "xt_largeconst" target-specific pass.  It also
converts SFmode constant assignments into bit-equivalent SImode ones.

This allows these assignments to be processed by the "constantsynth"
optimization, which will be reimplemented later.

gcc/ChangeLog:

	* config/xtensa/xtensa-protos.h
	(xtensa_split_DI_reg_imm): Remove.
	* config/xtensa/xtensa.cc (xtensa_split_DI_reg_imm): Remove.
	(split_DI_SF_DF_const): New worker function.
	(do_largeconst): Add a call to split_DI_SF_DF_const() to the insn
	enumeration loop.
	* config/xtensa/xtensa.md (movdi): Remove split code when the
	source is constant.
	(movdi_internal): Add a new constraint pair (a, Y) to the second
	of the existing constraint alternatives.
	(The auxiliary define_split for movdi_internal): Remove.
2025-10-09 02:29:36 -07:00
Takayuki 'January June' Suwa
4864f24c86 xtensa: Optimize assignment of certain constants to hardware FP registers
This patch introduces an optimization that replaces assignments of signed
12-bit integer values divided by 0th through 15th power of two to hardware
FP registers with assignments of that integer values to address (GP)
registers followed by negatively-scaled floating-point conversion
instructions.

For example, 0.12005615234375f is exactly equal to (1967.f / (1 << 14)), so
we can emit such as:

	movi	a9, 1967
	float.s	f0, a9, 14

if such conversion reduces costs.

gcc/ChangeLog:

	* config/xtensa/xtensa.cc (xt_full_rtx_costs):
	New struct, derived from full_rtx_costs.
	(FPreg_neg_scaled_simm12b_1, FPreg_neg_scaled_simm12b):
	New worker functions.
	(do_largeconst): Add a call to FPreg_neg_scaled_simm12b() to the
	insn enumeration loop.
2025-10-09 02:29:36 -07:00
Takayuki 'January June' Suwa
1eefa6e0c8 xtensa: Make large CONST_INT legitimate until the postreload pass
Generally, RISC machines only have a limited bit width for integer constant
immediate values, and it is common to implement
TARGET_LEGITIMATE_CONSTANT_P() for their representation.  However, by
making bare CONST_INTs less visible in RTL, some optimizers may miss out
on opportunities.

  - Operands with the nonmemory/immediate_operand() predicates never accept
    constants that TARGET_LEGITIMATE_CONSTANT_P() rejects, so templates
    containing their predicates may unintentionally not be used for insns
    containing such constants during the RTL generation or instruction
    combination passes

  - Some optimizers only accept bare CONST_INTs and may not consider their
    equivalents (such as literal pool entry references) at all
    (Unrelated to this patch, but perhaps even worse, some optimizers such
    as RTL ifcvt, assume that not only the constant format but also the insn
    format is CISC-like)

As a clear example, the effect of constant-anchored optimization during
the postreload pass can be seen by compiling the following with and without
-mconst16 or -mauto-litpools:

     /* example */
     void test(int a[4]) {
       a[0] = 0xDEADFACE;
       a[1] = 0xDEADFACE - 1;
       a[2] = 0xDEADFACE - 2;
       a[3] = 0xDEADFACE + 254;
     }

     ;; without -mauto-litpools
     	.literal_position
     	.literal .LC0, -559023410
     	.literal .LC1, -559023411
     	.literal .LC2, -559023412
     	.literal .LC3, -559023156
     test:
     	entry	sp, 32
     	l32r	a8, .LC0
     	s32i.n	a8, a2, 0
     	l32r	a8, .LC1
     	s32i.n	a8, a2, 4
     	l32r	a8, .LC2
     	s32i.n	a8, a2, 8
     	l32r	a8, .LC3
     	s32i.n	a8, a2, 12
     	retw.n

     ;; with -mauto-litpools
     test:
     	entry	sp, 32
     	movi	a8, -559023410
     	s32i.n	a8, a2, 0
     	addi.n	a8, a8, -1	;; const-anchored
     	s32i.n	a8, a2, 4
     	addi.n	a8, a8, -1	;; const-anchored
     	s32i.n	a8, a2, 8
     	addmi	a8, a8, 0x100	:: const-anchored
     	s32i.n	a8, a2, 12
     	retw.n

Therefore, we aim to overcome the above obstacles by introducing a tweak
that legitimates a full-bitwidth CONST_INT regardless of other conditions
until a specific RTL path is reached.  Then, the most appropriate point
to switch the behavior of TARGET_LEGITIMATE_CONSTANT_P() would probably
be just before reload/LRA, but as mentioned earlier, there is an optimizer
that should be utilized in postreload, so the switchover point will be
just after that.

This patch introduces a new target-specific pass called "xt_largeconst"
to implement all of the above, which will also serves as a host for other
future optimizers related to large constants, such as "constantsynth".
As a result, this patch also resolves some of the issues mentioned in the
previous patch notes:

  - B[GE/LT]U branch instructions with immediate values of 32768 or 65536
    cannot be emitted
  - Insn combination templates matching the CLAMPS instruction cannot be
    matched against large upper and lower bounds

gcc/ChangeLog:

	* config/xtensa/constraints.md (Y):
	Change to reference xtensa_postreload_completed_p() instead of
	xtensa_split1_finished_p().
	* config/xtensa/predicates.md (move_operand): Ditto.
	* config/xtensa/t-xtensa (PASSES_EXTRA):
	Add xtensa-passes.def as target-specific pass description.
	* config/xtensa/xtensa-passes.def:
	New definition file that inserts pass_xtensa_largeconst after
	pass_postreload_cse.
	* config/xtensa/xtensa-protos.h (xtensa_split1_finished_p): Remove.
	(xtensa_postreload_completed_p, make_pass_xtensa_largeconst):
	New function prototypes.
	* config/xtensa/xtensa.cc (machine_function):
	Add a new member "postreload_completed".
	(xtensa_emit_move_sequence):
	Change to reference xtensa_postreload_completed_p() instead of
	can_create_pseudo_p().
	(xtensa_split1_finished_p): Remove.
	(xtensa_postreload_completed_p): New function.
	(xtensa_legitimate_constant_p): Change to also consider
	xtensa_postreload_completed_p().
	(litpool_set_src_1, litpool_set_src, do_largeconst,
	rest_of_handle_largeconst):
	New sub-functions for pass_xtensa_largeconst.
	(pass_data_xtensa_largeconst, pass_xtensa_largeconst):
	New target-specific pass definition.
	(make_pass_xtensa_largeconst):
	New function called by the pass manager.
	* config/xtensa/xtensa.md
	(The auxiliary define_split for movdi_internal):
	Change to reference xtensa_postreload_completed_p() instead of
	xtensa_split1_finished_p().
	(The first of three auxiliary define_splits for mov[sh]i_internal):
	Remove.

gcc/testsuite/ChangeLog:

	* gcc.target/xtensa/BGEUI-BLTUI-32k-64k.c:
	Disable optimizations and modify to also verify RTL dump in the
	"expand" pass.
2025-10-09 02:29:16 -07:00
Takayuki 'January June' Suwa
2ce24fb6d9 xtensa: Implement TARGET_MD_ASM_ADJUST
The behavior of the 'g'-constraint on asm statement operands does not
strictly match that described in the GCC User Manual:

   "'g'  Any register, memory, or immediate integer operand is allowed,
    except for registers that are not general registers."

   -- 6.12.3.1 Simple Constraints, Using the GCC (the latest)

Contrary to the quote above, the following example will produce different
results depending on whether TARGET_CONST16 or TARGET_AUTO_LITPOOLS is
enabled:

     /* example */
     void test(void) {
       asm volatile ("# %0"::"g"(65536));
     }

     ;; TARGET_CONST16 || TARGET_AUTO_LITPOOLS
     test:
     	entry	sp, 32
     	# 65536
     	retw.n

     ;; !TARGET_CONST16 && !TARGET_AUTO_LITPOOLS
     	.literal_position
     	.literal .LC0, 65536
     test:
     	entry	sp, 32
     	# .LC0
     	retw.n

Indeed, both of the above results satisfy the constraint, but the latter
is not an "any" constant as stated in the manual, and is therefore incon-
sistent with the former.

This is because the behavior of the 'g'-constraint on constants depends
on the general_operand() predicate, and essentially on
TARGET_LEGITIMATE_CONSTANT_P().

This patch resolves that inconsistency by adding an 'n'-constraint imme-
diately before every occurrence of 'g' in each constraint string during
the RTL generation pass, to prioritize being an integer constant for the
alternative to which 'g' belongs.

gcc/ChangeLog:

	* config/xtensa/xtensa.cc
	(TARGET_MD_ASM_ADJUST): New macro definition.
	(xtensa_md_asm_adjust): New function prototype and definition, that
	prepends all 'g'-constraints in the "constraints" vector with 'n',
	if neither TARGET_CONST16 nor TARGET_AUTO_LITPOOLS is enabled.
2025-10-09 02:23:00 -07:00
Richard Biener
5ab4db5459 tree-optimization/122212 - fix CLZ detection
The following corrects a mistake with the zero value handling which
was broken because the bits bias was applied first which works
for the special-case using a bit-and but not when using a conditional
move.  Apply this after the fact instead where it also more easily
folds with an existing bias we compensate.

	PR tree-optimization/122212
	* tree-ssa-forwprop.cc (simplify_count_zeroes): Apply
	bias for CLZ after dealing with the zero special value.

	* gcc.dg/torture/pr122212.c: New testcase.
2025-10-09 10:55:02 +02:00
Georg-Johann Lay
b0bc615d93 AVR: target/122210 - Add double -> fixed-point conversions.
PR target/122210
libgcc/config/avr/libf7/
	* libf7-common.mk (F7_ASM_PARTS): Add D2<fx> modules.
	* libf7-asm.sx: Implement the D2<fx> modules.

gcc/testsuite/
	* gcc.target/avr/dtofx.c: New test.
2025-10-09 10:43:57 +02:00
Georg-Johann Lay
7304e83f1f AVR: target/122210 - Add fixed-point -> double conversions.
PR target/122210
libgcc/config/avr/libf7/
	* libf7-common.mk (F7_ASM_PARTS): Add <fx>2D modules.
	* libf7-asm.sx: Implement the <fx>2D modules.

gcc/testsuite/
	* gcc.target/avr/fxtod.c: New test.
2025-10-09 10:43:56 +02:00
Kito Cheng
76eb9c4927 RISC-V: Allow VLS types using up to LMUL 8
We used to apply -mrvv-max-lmul= to limit VLS code gen, auto vectorizer,
and builtin string function expansion. But I think the VLS code gen part doesn't
need this limit, since it only happens when the user explicitly writes vector
types.

For example, int32x8_t under -mrvv-max-lmul=m1 with VLEN=128 would be split into
two int32x4_t, which generate more instructions and runs slower.

In this patch, I changed -mrvv-max-lmul= to only affect auto vectorization and
builtin string function expansion. Actually, the option's help text already
says it only controls the LMUL used by auto-vectorization, so I believe this
change is makes sense :)

Changes since v1:
- Add testase to make sure auto vectorizer is still constrained by
  -mrvv-max-lmul=.

gcc/ChangeLog:

	* config/riscv/riscv-protos.h (vls_mode_valid_p): New argument
	allow_up_to_lmul_8.
	* config/riscv/riscv-v.cc (autovectorize_vector_modes): Set
	allow_up_to_lmul_8 to false.
	(vls_mode_valid_p): Add new argument allow_up_to_lmul_8, and use
	it to determine whether to allow LMUL 8.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vls-type-rvv-max-lmul.c: New test.
	* gcc.target/riscv/rvv/vls-type-rvv-max-lmul-autovec.c: New
	test.
2025-10-09 15:46:10 +08:00
Prathamesh Kulkarni
e63cf4b130 PR81358: Enable automatic linking of libatomic.
ChangeLog:
	PR driver/81358
	* Makefile.def: Add no_atomic=true for libraries that don't depend on
	libatomic.
	* Makefile.tpl: Export TARGET_CONFIGDIRS and create rule to
	add dependencies for libatomic.
	* configure.ac: Add libatomic to bootstrap_target_libs.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

gcc/ChangeLog:
	PR driver/81358
	* common.opt: New option -flink-libatomic.
	* gcc.cc (LINK_LIBATOMIC_SPEC): New macro.
	* config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Use LINK_LIBATOMIC_SPEC.
	* config/arm/uclinux-elf.h: Likewise.
	* config/arm/unknown-elf.h: Likewise.
	* config/avr/avrlibc.h: Likewise.
	* config/bfin/linux.h: Likewise.
	* config/darwin.h: Likewise.
	* config/gnu-user.h: Likewise.
	* config/lm32/uclinux-elf.h: Likewise.
	* config/rs6000/linux64.h: Likewise.
	* config/rs6000/rtems.h: Likewise.
	* config/sparc/sparc.h: Likewise.
	* doc/invoke.texi: Document -flink-libatomic.
	* configure.ac: Define TARGET_PROVIDES_LIBATOMIC.
	* configure: Regenerate.
	* config.in: Regenerate.
	* common.opt.urls: Regenerate.

libatomic/ChangeLog:
	PR driver/81358
	* Makefile.am: Pass -fno-link-libatomic.
	New rule all-local.
	* configure.ac: Assert that CFLAGS is set and pass -fno-link-libatomic.
	Use __libatomic_save_CFLAGS__ instead of save_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
Co-authored-by: Matthew Malcolmson <mmalcolmson@nvidia.com>
2025-10-09 07:26:51 +00:00
Robin Dapp
5e9eecc668 vect: Remove type from misalignment hook.
This patch removes the type argument from the vector_misalignment hook.
Ever since we switched from element to byte misalignment its
semantics haven't been particularly clear and nowadays it should be
redundant.

Also, in case of gather/scatter, the patch sets misalignment to the
misalignment of one unit of the vector mode so targets can
distinguish between element size alignment and element mode alignment.

is_packed is now always set, regardless of misalignment.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc (aarch64_builtin_support_vector_misalignment):
	Remove type.
	* config/arm/arm.cc (arm_builtin_support_vector_misalignment):
	Ditto.
	* config/epiphany/epiphany.cc (epiphany_support_vector_misalignment):
	Ditto.
	* config/gcn/gcn.cc (gcn_vectorize_support_vector_misalignment):
	Ditto.
	* config/loongarch/loongarch.cc (loongarch_builtin_support_vector_misalignment):
	Ditto.
	* config/riscv/riscv.cc (riscv_support_vector_misalignment):
	Ditto.
	* config/rs6000/rs6000.cc (rs6000_builtin_support_vector_misalignment):
	Ditto.
	* config/s390/s390.cc (s390_support_vector_misalignment):
	Ditto.
	* doc/tm.texi: Adjust vector misalignment docs.
	* target.def: Ditto.
	* targhooks.cc (default_builtin_support_vector_misalignment):
	Remove type.
	* targhooks.h (default_builtin_support_vector_misalignment):
	Ditto.
	* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p):
	Set misalignment for gather/scatter and remove type.
	(vect_supportable_dr_alignment): Ditto.
2025-10-09 09:19:03 +02:00
Sam James
b52a90e7a0 doc: type-punning through a union is a GNU extension for C++
We didn't explicitly say that type-punning through a union is undefined
behavior in C++. Mention that, and that we support it as a GNU extension.

This was reported on LLVM's Discourse (forums) [0].

[0] https://discourse.llvm.org/t/ub-when-type-punning-through-unions/88527/6

gcc/ChangeLog:
	PR c++/117219

	* doc/invoke.texi (-fstrict-aliasing): Explain that type-punning
	through a union in C++ is supported as a GNU extension.
2025-10-09 04:11:48 +01:00
Sam James
24ba6f2f96 doc: fix grammar nit
gcc/ChangeLog:

	* doc/invoke.texi: Add missing full stop.
2025-10-09 04:11:42 +01:00
Sam James
c3f8414d18 doc: mention -Wmaybe-uninitialized vs CCP
CCP interacts poorly with -Wmaybe-uninitialized in some cases by assuming a value
which stops us warning about it (false negatives). Inform users about this
infamous interaction.

gcc/ChangeLog:
	PR tree-optimization/18501

	* doc/invoke.texi (-Wmaybe-uninitialized): Mention interaction with
	CCP.
2025-10-09 04:11:37 +01:00
GCC Administrator
954b679175 Daily bump. 2025-10-09 00:21:21 +00:00
Joseph Myers
921d6497ae c: Implement C23 rules for undefined static functions in _Generic
A fairly late change in C23, the resolution of CD2 ballot comments
US-077 and US-078, added certain locations in _Generic to the
obviously unevaluated locations where it is permitted to have a
reference to a static function that is never defined.

Implement this feature in GCC.  The main complication is that, unlike
previous cases where it's known at the end of an operand to a
construct such as sizeof whether that operand is obviously unevaluated
and so an appropriate argument can be passed to pop_maybe_used, in the
case of a default generic association in _Generic it may not be known
until the end of that _Generic expression whether that case is
evaluated or not.  Thus, we arrange for the state of the
maybe_used_decls stack to be saved in this case and later restored
once the correct argument to pop_maybe_used is known.

There may well be further changes in this area in C2y (if the
"discarded" proposal is adopted, further locations will be OK for such
references to undefined static functions).  For now, only expressions
and not type names in _Generic have this special treatment.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c/
	* c-typeck.cc (in_generic, save_maybe_used, restore_maybe_used):
	New.
	(mark_decl_used, record_maybe_used_decl, pop_maybe_used): Use
	in_generic.
	(struct maybe_used_decl): Move to c-tree.h.
	* c-tree.h (struct maybe_used_decl): Move from c-typeck.cc.
	(in_generic, save_maybe_used, restore_maybe_used): Declare.
	* c-parser.cc (c_parser_generic_selection): Increment and
	decrement in_generic.  Use pop_maybe_used, save_maybe_used and
	restore_maybe_used.

gcc/testsuite/
	* gcc.dg/c11-generic-4.c, gcc.dg/c23-generic-5.c,
	gcc.dg/c2y-generic-5.c: New tests.
2025-10-08 23:12:11 +00:00
Harald Anlauf
50959e53e4 Fortran: fix warnings for symbols with C binding and declared PRIVATE [PR49111]
The Fortran standard does not prohibit restricting the accessibility of a
symbol by use of the PRIVATE attribute and exposing it via a C binding
label.  Instead of unconditionally generating a warning, only warn if the
binding label is surprisingly identical to the privatized Fortran symbol
and when -Wsurprising is specified.

	PR fortran/49111

gcc/fortran/ChangeLog:

	* decl.cc (verify_bind_c_sym): Modify condition for generation of
	accessibility warning, and adjust warning message.

gcc/testsuite/ChangeLog:

	* gfortran.dg/binding_label_tests_9.f03: Adjust test.
	* gfortran.dg/module_private_2.f90: Likewise.
	* gfortran.dg/public_private_module_2.f90: Likewise.
	* gfortran.dg/binding_label_tests_35.f90: New test.
2025-10-08 20:20:09 +02:00
Martin Uecker
d4077ce639 c: Allow variably-modified types in generic associations for C2Y
This implements part of N3348 to allow variably-modified types in
generic associations in C2Y and making it a pedantic warning before.
Allowing star * is not yet implemented.

gcc/c/ChangeLog:
	* c-parser.cc (c_parser_generic_selection): Change
	error_at to pedwarn_c23.

gcc/testsuite/ChangeLog:
	* gcc.dg/c11-generic-2.c: Adapt error message.
	* gcc.dg/c2y-generic-3.c: Adapt test.
	* gcc.dg/c2y-generic-4.c: New test.
2025-10-08 19:18:24 +02:00
Jonathan Wakely
3f70e62553 libstdc++: Update dead links to PSTL upstream in docs
The pstl code has been removed from the llvm repo so point to the Intel
upstream project where it really originates from.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2017.xml: Replace broken link to PSTL
	upstream.
	* doc/xml/manual/status_cxx2020.xml: Likewise.
	* doc/html/manual/status.html: Regenerate.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-10-08 17:33:21 +01:00
Jonathan Wakely
65b6d374fc libstdc++: Remove unused config/cpu/i486/atomicity.h file
This file is no longer used, because we always use the definitions in
config/cpu/generic/atomicity_builtins/atomicity.h now.

libstdc++-v3/ChangeLog:

	* config/cpu/i486/atomicity.h: Removed.

Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
2025-10-08 17:06:21 +01:00
Jonathan Wakely
bca9dd1105 libstdc++: Remove unused config/cpu/cris/atomicity.h file [PR122172]
This file is no longer used, because we always use the definitions in
config/cpu/generic/atomicity_builtins/atomicity.h now.

H-P confirmed that the code generated by __atomic_fetch_add is fine and
we don't need the handwritten assembly.

libstdc++-v3/ChangeLog:

	PR libstdc++/122172
	* config/cpu/cris/atomicity.h: Removed.

Reviewed-by: Hans-Peter Nilsson <hp@axis.com>
2025-10-08 17:06:20 +01:00
Jonathan Wakely
152f4daab4 libstdc++: Fix allocator propagation and tests for std::indirect and std::polymorphic
I noticed that several tests were doing:

static_assert([] { /* ... */; return true; });

i.e. just testing a lambda, not invoking it and testing the result. This
change fixes that, so that all the lambdas are invoked.

After fixing that, most of the tests failed because they were using
__gnu_test::tracker_allocator or std::scoped_allocator_adaptor in
constexpr functions. The tracker_allocator modifies global state, so can
never be constexpr, and none of std::scoped_allocator_adaptor's members
are marked constexpr.

This change makes __gnu_test::uneq_allocator and
__gnu_test::propagating_allocator usable in constant expressions, which
allows some of the tests which can't be constexpr to be duplicated to
new functions which use uneq_allocator or propagating_allocator instead
of tracker_allocator. This new functions can be tested with the
static_assert calling a lambda.

In some cases none of the tests could be adapted to be constexpr, so the
static_assert and lambda were just removed.

Two changes were also needed for the actual library code, because the
move assignment operators for std::indirect and std::polymorphic were
using copy-assignment on the allocator. Although the semantics of
move-assignment for allocators should be equivalent to copy-assignment,
an allocator isn't actually required to support copy-assignment unless
propagate_on_container_copy_assignment is true. So we have to use
move-assignment for propagate_on_container_move_assignment cases.

libstdc++-v3/ChangeLog:

	* include/bits/indirect.h (indirect::operator=(indirect&&)):
	Move assign allocator when POCMA is true.
	(polymorphic::operator=(polymorphic&&)): Likewise.
	* testsuite/std/memory/indirect/copy.cc: Remove constexpr from
	functions that use tracker_allocator. Add test_constexpr().
	* testsuite/std/memory/indirect/copy_alloc.cc: Remove constexpr
	from all functions and remove static_assert.
	* testsuite/std/memory/indirect/ctor.cc: Do not use
	scoped_allocator_adaptor during constant evaluation.
	* testsuite/std/memory/indirect/move.cc: Remove constexpr from
	functions that use tracker_allocator. Add test_constexpr().
	* testsuite/std/memory/indirect/move_alloc.cc: Remove constexpr
	from all functions and remove static_assert.
	* testsuite/std/memory/indirect/relops.cc: Invoke lambda in
	static_assert.
	* testsuite/std/memory/polymorphic/copy.cc: Remove constexpr
	from functions that use tracker_allocator. Add test_constexpr().
	* testsuite/std/memory/polymorphic/copy_alloc.cc: Remove
	constexpr from all functions and remove static_assert.
	* testsuite/std/memory/polymorphic/ctor.cc: Do not use
	scoped_allocator_adaptor during constant evaluation.
	* testsuite/std/memory/polymorphic/ctor_poly.cc: Likewise.
	* testsuite/std/memory/polymorphic/move.cc: Remove constexpr
	from functions that use tracker_allocator. Add test_constexpr().
	* testsuite/std/memory/polymorphic/move_alloc.cc: Remove
	constexpr from all functions and remove static_assert.
	* testsuite/util/testsuite_allocator.h (tracker_allocator):
	Remove redundant 'inline' from friend.
	(uneq_allocator): Make all functions constexpr.
	(uneq_allocator::base, uneq_allocator::swap_base): Remove.
	(uneq_allocator::~uneq_allocator): Remove.
	(uneq_allocator::allocate, uneq_allocator::deallocate): Do not
	use map of allocations during constant evaluation.
	(propagating_allocator): Make all functions constexpr.
	(propagating_allocator::base): Remove.
	(propagating_allocator::swap_base): Simplify.
	(ExplicitConsAlloc, CustomPointerAlloc, NullablePointer): Add
	constexpr to all functions.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-10-08 17:06:20 +01:00
Jakub Jelinek
0c0847158c Update to Unicode 17.0.0
The following patch updates GCC from Unicode 16.0.0 to 17.0.0.

I've followed what the README says and updated also one script from
glibc, but that needed another Unicode file - HangulSyllableType.txt -
around as well, so I'm adding it.
I've added one new test to named-universal-char-escape-1.c for
randomly chosen character from new CJK block.
Note, Unicode 17.0.0 authors forgot to adjust the 4-8 table, I've filed
bugreports about that but the UnicodeData.txt changes for the range ends
and the new range seems to match e.g. what is in the glyph tables, so
the patch follows UnicodeData.txt and not 4-8 table here.

Another thing was that makeuname2c.cc didn't handle correctly when
the size of the generated string table modulo 77 was 76 or 77, in which
case it forgot to emit a semicolon after the string literal and so failed
to compile.

And as can be seen in the emoji-data.txt diff, some properties like
Extended_Pictographic have been removed from certain characters, e.g.
from the Mahjong cards characters except U+1F004, and one libstdc++
test was testing that property exactly on U+1F000.  Dunno why that was
changed, but U+1F004 is the only colored one among tons of black and white
ones.

2025-10-08  Jakub Jelinek  <jakub@redhat.com>

contrib/
	* unicode/README: Add HangulSyllableType.txt file to the
	list as newest utf8_gen.py from glibc now needs it.  Adjust
	git commit hash and change unicode 16 version to 17.
	* unicode/from_glibc/utf8_gen.py: Updated from glibc.
	* unicode/DerivedCoreProperties.txt: Updated from Unicode 17.0.0.
	* unicode/emoji-data.txt: Likewise.
	* unicode/PropList.txt: Likewise.
	* unicode/GraphemeBreakProperty.txt: Likewise.
	* unicode/DerivedNormalizationProps.txt: Likewise.
	* unicode/NameAliases.txt: Likewise.
	* unicode/UnicodeData.txt: Likewise.
	* unicode/EastAsianWidth.txt: Likewise.
	* unicode/DerivedGeneralCategory.txt: Likewise.
	* unicode/HangulSyllableType.txt: New file.
gcc/testsuite/
	* c-c++-common/cpp/named-universal-char-escape-1.c: Add test for
	\N{CJK UNIFIED IDEOGRAPH-3340E}.
libcpp/
	* makeucnid.cc (write_copyright): Adjust copyright year.
	* makeuname2c.cc (generated_ranges): Adjust end points for a couple
	of ranges based on UnicodeData.txt Last changes and add a whole new
	CJK UNIFIED IDEOGRAPH- entry.  None of these changes are in the 4-8
	table, but clearly it has just been forgotten.
	(write_copyright): Adjust copyright year.
	(write_dict): Fix up condition when to print semicolon.
	* generated_cpp_wcwidth.h: Regenerate.
	* ucnid.h: Regenerate.
	* uname2c.h: Regenerate.
libstdc++-v3/
	* include/bits/unicode-data.h: Regenerate.
	* testsuite/ext/unicode/properties.cc: Test __is_extended_pictographic
	on U+1F004 rather than U+1F000.
2025-10-08 18:02:39 +02:00
Jason Merrill
d77b548fb6 c++: clobber non-placement new
And also add the clobber for non-placement new.

For now let's limit the clobber of an array with non-constant bound to
placement new in constant evaluation, where we need it to set the active
member of a union.

And catch some additional cases of there being no actual data to clobber.

This changes the diagnostics in a couple of analyzer tests, but the new
diagnostics are also valid.

It also adds some -Wuninitialized warnings which seem like an improvement;
the lines that now warn about an uninitialized vptr are correct, since
trying to assign to a member of a virtual base reads the vptr of an object
that was never created.

gcc/cp/ChangeLog:

	* init.cc (build_new_1): Also clobber for non-placement new.
	Only loop clobber in constexpr.
	* expr.cc (wrap_with_if_consteval): New.
	* cp-tree.h (wrap_with_if_consteval): Declare.

gcc/testsuite/ChangeLog:

	* g++.dg/analyzer/new-2.C: Adjust diags.
	* g++.dg/analyzer/noexcept-new.C: Adjust diags.
	* g++.dg/warn/Warray-bounds-23.C: Add warnings.
	* g++.dg/warn/Warray-bounds-24.C: Add warnings.
	* g++.dg/cpp26/constexpr-new4a.C: New test.
2025-10-08 16:09:49 +01:00
Antoni Boucher
d52a81fdb3 Regenerate gcc/configure
Use autoconf 2.69 to regenerate gcc/configure

gcc/ChangeLog:

	* configure: Regenerate.
2025-10-08 09:59:06 -04:00
Tomasz Kamiński
43f524c1c4 libstdc++: Fix type in computation of _M_weekday_index.
The value should use divide instead of modulo, as given 1st of month
being weekday X (Mon, Tue, ...), 01 is always X[1], 08 is X[2], e.t.c.

This values is currently not observable, as there is no user-accessible
format specifier that will print it, however it may be exposed in future.

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (_ChronoData::_M_fill_day): Replace
	'%' by '/'.
2025-10-08 15:14:04 +02:00
Trevor Gross
8b6a18ecaf x86-64: mingw: Pass and return _Float16 in vector registers [PR115054]
For MinGW on x86-64, GCC currently passes and returns `_Float16` in
GPRs. Microsoft does not specify an ABI for the type so this is purely
an extension; however, there are a few reasons the current ABI is not
ideal:

1. `float` and `double` are both passed and returned in xmm registers
   under the MSVC ABI, there isn't any reason for `_Float16` to deviate.
2. `_Float16` is returned in xmm0 on Windows x86-32 by both GCC and
   Clang.
3. There is a platform-natural ABI with AVX512-FP16, which requires
   half-precision operands to be in vector registers.
4. System V uses vector registers for `_Float16`.

Thus, update the `HFmode` ABI to both pass and return in vector
registers, meaning its ABI is now identical to `float` and `double`.
This is already Clang's behavior on both its x64 MSVC and MinGW targets,
so the change here also resolves an ABI incompatibility (originally
reported in linked issue).

The results can be verified by evaluating the change in assembly output
with this source:

    void pass_f16(_Float16 x, _Float16 *dst) {
        *dst = x;
    }

    void callee_f16(_Float16);
    void call_f16() {
        callee_f16(1.0);
    }

    _Float16 ret_f16(_Float16 *x) {
        return *x;
    }

    /* Check libcall ABI */

    void extend_f16(_Float16 *x, _Float32 *dst) {
        *dst = (_Float32)*x;
    }

    void trunc_f16(_Float32 *x, _Float16 *dst) {
        *dst = (_Float16)*x;
    }

    /* Float varargs should be in vregs with a zeroed shadow GPR */

    void va(_Float16, ...);
    void va_f16() {
        va(1.0f16, 2.0f16, 3.0f16, 4.0f16, 5.0f16);
    }

While modifying the `function_value_ms_64` `switch` statement, a
redundant condition and trailing whitespace in the 16-byte case is
cleaned up.

2025-09-13  Trevor Gross  <tmgross@umich.edu>

gcc:
	PR target/115054
	* config/i386/i386.cc (function_arg_ms_64,
	function_value_ms_64): Pass and return _Float16 in vector
	registers on Windows.

Signed-off-by: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2025-10-08 12:17:30 +00:00
Jonathan Wakely
9e2db0f899 libstdc++: Add missing include to std/time/format/format.cc
libstdc++-v3/ChangeLog:

	* testsuite/std/time/format/format.cc: Include <vector>.
2025-10-08 12:53:15 +01:00
Richard Biener
055c6cc038 Add boolean pattern for bitwise ops
As we consider bitwise operations possible mask operations we have
to consider the case of only one operand arriving as mask.  The
following compensates for this by creating mask from the other operand
and insert possibly required mask conversions.

	PR tree-optimization/110223
	PR tree-optimization/122128
	* tree-vect-patterns.cc (vect_recog_bool_pattern): Add
	compensation for mixed mask/data bitwise operations.

	* gcc.dg/vect/vect-bool-2.c: New testcase.
	* gcc.dg/vect/vect-bool-cmp-3.c: Likewise.
	* gcc.dg/vect/vect-bool-cmp-4.c: Likewise.
2025-10-08 13:39:05 +02:00
Richard Biener
94f203a369 Check non-strictly vect_internal_def internal defs in integer_type_for_mask
We are missing masks produced by inductions or reductions otherwise.

	* tree-vect-patterns.cc (integer_type_for_mask): Only
	reject vect_external_defs.
2025-10-08 13:39:05 +02:00
Richard Biener
8ba0bb5a4d Adjust g++.dg/vect/pr64410.cc scan
We are now vectorizing more loops in standard library functions.
Restrict the dump scan to the loop we're interested in.

	PR testsuite/120100
	* g++.dg/vect/pr64410.cc: Adjust.
2025-10-08 12:51:56 +02:00
Luc Grosheintz
e269268e45 libstdc++: Implement submdspan_mapping_result. [PR110352]
Implement the class submdspan_mapping_result and add it to the std
module.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (submdspan_mapping_result): New class.
	* src/c++23/std.cc.in (submdspan_mapping_result): Add.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:39:44 +02:00
Luc Grosheintz
15498d5f96 libstdc++: Implement full_extent_t. [PR110352]
Add the class and updates the std module.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (full_extent_t): New class.
	* src/c++23/std.cc.in (full_extent_t): Add.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:35:19 +02:00
Luc Grosheintz
61061664e8 libstdc++: Implement strided_slice from <mdspan>. [PR110352]
Adds strided_slice as standardized in N5014. Also creates
the internal feature testing macro for submdspan.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/bits/version.def (submdspan): New internal macro.
	* include/bits/version.h: Regenerate.
	* include/std/mdspan (strided_slice): New class.
	* src/c++23/std.cc.in (strided_slice): Add.
	* testsuite/23_containers/mdspan/submdspan/strided_slice.cc: New test.
	* testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:32:17 +02:00