aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog108
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_attr.adb13
-rw-r--r--gcc/attribs.cc22
-rw-r--r--gcc/attribs.h1
-rw-r--r--gcc/auto-profile.cc52
-rw-r--r--gcc/auto-profile.h2
-rw-r--r--gcc/basic-block.h5
-rw-r--r--gcc/c-family/c.opt.urls3
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.cc3
-rw-r--r--gcc/cfgexpand.cc6
-rw-r--r--gcc/config/aarch64/aarch64.cc28
-rw-r--r--gcc/diagnostics/output-spec.cc654
-rw-r--r--gcc/diagnostics/output-spec.h24
-rw-r--r--gcc/doc/tm.texi19
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/fold-const.cc2
-rw-r--r--gcc/fortran/ChangeLog15
-rw-r--r--gcc/fortran/decl.cc2
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/module.cc8
-rw-r--r--gcc/fortran/resolve.cc90
-rw-r--r--gcc/fortran/trans-decl.cc7
-rw-r--r--gcc/fortran/trans-stmt.cc15
-rw-r--r--gcc/gimple-lower-bitint.cc8
-rw-r--r--gcc/gimple.h2
-rw-r--r--gcc/gimplify.cc3
-rw-r--r--gcc/ipa-devirt.cc2
-rw-r--r--gcc/ipa-param-manipulation.cc2
-rw-r--r--gcc/ipa-profile.cc8
-rw-r--r--gcc/ipa-prop.cc2
-rw-r--r--gcc/libgdiagnostics.cc7
-rw-r--r--gcc/multiple_target.cc114
-rw-r--r--gcc/opts-diagnostic.cc26
-rw-r--r--gcc/sched-rgn.cc7
-rw-r--r--gcc/target.def22
-rw-r--r--gcc/testsuite/ChangeLog41
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection1.C40
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection2.C40
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection3.C25
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection4.C30
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection5.C28
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection6.C27
-rw-r--r--gcc/testsuite/g++.target/aarch64/fmv-selection7.C65
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c2
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_11.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_15.f036
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_20.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_23.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_3.f037
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_39.f034
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_40.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_49.f0319
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_50.f0354
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_51.f0357
-rw-r--r--gcc/testsuite/gnat.dg/reduce1.adb14
-rw-r--r--gcc/testsuite/lib/sarif.py1
-rw-r--r--gcc/tree-cfg.cc31
-rw-r--r--gcc/tree-if-conv.cc2
-rw-r--r--gcc/tree-ssa-alias.cc4
-rw-r--r--gcc/tree-vect-loop.cc6
-rw-r--r--gcc/tree.h2
-rw-r--r--libgcc/ChangeLog6
-rw-r--r--libgcc/config/t-softfp12
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/std/inplace_vector9
-rw-r--r--libstdc++-v3/testsuite/std/memory/polymorphic/copy.cc18
70 files changed, 1359 insertions, 505 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63fd0f2..65a07a1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,111 @@
+2025-09-30 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostics/output-spec.cc (text_scheme_handler::make_sink): Use
+ the value of the "color" to determine if the sink's printer is
+ colorized.
+
+2025-09-30 David Malcolm <dmalcolm@redhat.com>
+
+ * 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.
+
+2025-09-30 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostics/output-spec.cc: Move class scheme_handler out from
+ inside class output_factory.
+
+2025-09-30 David Malcolm <dmalcolm@redhat.com>
+
+ * 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.
+
+2025-09-30 Alfie Richards <alfie.richards@arm.com>
+
+ * 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.
+
+2025-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ * auto-profile.h (maybe_hot_afdo_count_p): Fix comment typos,
+ possiby -> possibly and ture -> true.
+ * gimplify.cc (build_asan_poison_call_expr): Change "of a for"
+ to "memory of the" in a comment.
+ * ipa-devirt.cc (add_type_duplicate): Fix comment typo,
+ mangles -> mangled.
+ * auto-profile.cc: Fix comment typo, -fauto-profile-inlinig
+ -> -fauto-profile-inlining.
+ (maybe_hot_afdo_count_p): Fix comment typos, possiby -> possibly
+ and ture -> true.
+ (function_instance::removed_icall_target): Fix comment typo,
+ Reutrn -> Return.
+ (function_instance::in_worklist_): Fix comment typo, Ture -> True.
+ (function_instance::offline): Fix comment typo, tolevel -> toplevel.
+ (function_instance::match): Fix comment typo, craeate_gcov ->
+ create_gcov.
+ (autofdo_source_profile::offline_external_functions): Fix comment
+ typos, tolevel -> toplevel and porfile -> profile.
+ (autofdo_source_profile::get_function_instance_by_inline_stack): Fix
+ comment typo, chekcing -> checking.
+ (struct scale): Fix comment typo, scalle -> scale.
+ * gimple.h (currently_expanding_gimple_stmt): Fix comment typo,
+ comminucating -> communicating.
+ * tree.h (canonical_type_used_p): Fix comment typo, ture -> true.
+ * tree-ssa-alias.cc (types_equal_for_same_type_for_tbaa_p): Likewise.
+ * ipa-profile.cc (contains_hot_call_p): Likewise.
+ * cfgexpand.cc (add_scope_conflicts_2): Fix comment typos,
+ Querry -> Query, referendd -> referenced and Querrying -> Querying.
+ * ipa-param-manipulation.cc (currently_expanding_gimple_stmt): Fix
+ comment typo, comminucating -> communicating.
+ * ipa-prop.cc (ipa_cst_ref_desc::refcount): Fix comment typo,
+ if -> is.
+ * tree-if-conv.cc (version_loop_for_if_conversion): Fix comment typos,
+ porfile -> profile and confistency -> consistency.
+ * fold-const.cc: Change size_int_wide in comment to size_int as
+ size_int_wide doesn't exit for 21 years.
+
+2025-09-30 Jan Hubicka <hubicka@ucw.cz>
+
+ * auto-profile.cc (function_instance::match): Sanity check
+ that gimple PHI has no location.
+ * tree-cfg.cc (assign_discriminators): Also remap locations
+ of gimple PHI arguments.
+
+2025-09-30 Jan Hubicka <hubicka@ucw.cz>
+
+ * basic-block.h (GCOV_COMPUTE_SCALE): Remove.
+ * ipa-profile.cc (ipa_profile_generate_summary): Use
+ profile-count scaling.
+ * sched-rgn.cc (compute_trg_info): Likewise.
+
+2025-09-30 Jan Hubicka <hubicka@ucw.cz>
+
+ * auto-profile.cc (stmt_loc_used_by_debug_info): New function.
+ (autofdo_source_profile::get_count_info): Use it.
+ (afdo_set_bb_count): Likewise.
+ (afdo_vpt_for_early_inline): Likewise.
+
+2025-09-30 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * gimple-lower-bitint.cc (bitint_precision_kind): Fix inconsistency in
+ results between first and consecutive calls to this function.
+
2025-09-28 liuhongt <hongtao.liu@intel.com>
PR target/121970
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c5ef3a2..ce6a0ae 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250930
+20251001
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 16653d2..db7a3d1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2025-09-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/117517
+ * sem_attr.adb (Resolve_Attribute) <Attribute_Reduce>: Try to
+ resolve the reducer first. Fix casing of error message.
+
2025-09-29 Tonu Naks <naks@adacore.com>
* doc/gnat_rm/implementation_advice.rst: PolyORB
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index bde4d40..e9e245a 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -12851,7 +12851,10 @@ package body Sem_Attr is
end Proper_Op;
begin
- Resolve (Init_Value_Exp, Typ);
+ -- First try to resolve the reducer and then, if this succeeds,
+ -- resolve the initial value. This nicely deals with confused
+ -- programmers who swap the two items.
+
if Is_Overloaded (Reducer_Subp_Name) then
Outer :
for Retry in Boolean loop
@@ -12873,14 +12876,18 @@ package body Sem_Attr is
then
Op := Reducer_Subp_Name;
- elsif Proper_Op (Entity (Reducer_Subp_Name)) then
+ elsif Is_Entity_Name (Reducer_Subp_Name)
+ and then Proper_Op (Entity (Reducer_Subp_Name))
+ then
Op := Entity (Reducer_Subp_Name);
Set_Etype (N, Typ);
end if;
if No (Op) then
- Error_Msg_N ("No suitable reducer subprogram found",
+ Error_Msg_N ("no suitable reducer subprogram found",
Reducer_Subp_Name);
+ else
+ Resolve (Init_Value_Exp, Typ);
end if;
end;
diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index 29b88b8..7d7f8f3 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -1086,6 +1086,28 @@ make_attribute (string_slice name, string_slice arg_name, tree chain)
return attr;
}
+/* Default implementation of TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A.
+ Used to check very basically if DECL_B is callable from DECL_A.
+ For now this checks if the version strings are the same. */
+
+bool
+functions_b_resolvable_from_a (tree decl_a, tree decl_b,
+ tree base ATTRIBUTE_UNUSED)
+{
+ const char *attr_name = TARGET_HAS_FMV_TARGET_ATTRIBUTE
+ ? "target"
+ : "target_version";
+
+ tree attr_a = lookup_attribute (attr_name, DECL_ATTRIBUTES (decl_a));
+ tree attr_b = lookup_attribute (attr_name, DECL_ATTRIBUTES (decl_b));
+
+ gcc_assert (attr_b);
+ if (!attr_a)
+ return false;
+
+ return attribute_value_equal (attr_a, attr_b);
+}
+
/* Comparator function to be used in qsort routine to sort attribute
specification strings to "target". */
diff --git a/gcc/attribs.h b/gcc/attribs.h
index c4a4fb0..b6f3d5a 100644
--- a/gcc/attribs.h
+++ b/gcc/attribs.h
@@ -56,6 +56,7 @@ extern struct scoped_attributes *
extern char *sorted_attr_string (tree);
extern tree make_dispatcher_decl (const tree);
extern bool is_function_default_version (const tree);
+extern bool functions_b_resolvable_from_a (tree, tree, tree);
extern void handle_ignored_attributes_option (vec<char *> *);
/* Return a type like TTYPE except that its TYPE_ATTRIBUTES
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index e71689d..8c8d9be 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -100,7 +100,7 @@ along with GCC; see the file COPYING3. If not see
significantly form one inline instance to another and from the
offline version.
- This is controlled by -fauto-profile-inlinig and is independent
+ This is controlled by -fauto-profile-inlining and is independent
of -fearly-inlining.
Phase 4: In AFDO pass.
@@ -128,7 +128,7 @@ along with GCC; see the file COPYING3. If not see
considered cols. */
gcov_type afdo_hot_bb_threshod = -1;
-/* Return ture if COUNT is possiby hot. */
+/* Return true if COUNT is possibly hot. */
bool
maybe_hot_afdo_count_p (profile_count count)
{
@@ -136,6 +136,24 @@ maybe_hot_afdo_count_p (profile_count count)
return count.ipa ().to_gcov_type () >= afdo_hot_bb_threshod;
}
+/* Return true if location of STMT may be expressed by debug info. */
+
+static bool
+stmt_loc_used_by_debug_info (gimple *stmt)
+{
+ /* Only inline_entry and gimple_bind's locations
+ are not output into debug output. */
+ if (is_gimple_debug (stmt))
+ return gimple_debug_begin_stmt_p (stmt);
+ if (gimple_code (stmt) == GIMPLE_LABEL
+ || gimple_code (stmt) == GIMPLE_NOP
+ || gimple_code (stmt) == GIMPLE_PREDICT)
+ return false;
+ if (gimple_clobber_p (stmt))
+ return false;
+ return true;
+}
+
namespace autofdo
{
@@ -354,7 +372,7 @@ public:
removed_icall_target_ = true;
}
- /* Reutrn true if function is removed from indir target list. */
+ /* Return true if function is removed from indir target list. */
bool
removed_icall_target ()
{
@@ -488,7 +506,7 @@ private:
to it. */
bool realized_;
- /* Ture if function is in worklist for merging/offlining. */
+ /* True if function is in worklist for merging/offlining. */
bool in_worklist_;
/* Pointer to outer function instance or NULL if this
@@ -1072,7 +1090,7 @@ function_instance::merge (function_instance *other,
}
/* Make inline function FN offline.
- If tolevel function of same name already exists, then merge profiles.
+ If toplevel function of same name already exists, then merge profiles.
Otherwise turn FN toplevel. Return true if new toplevel function
was introduced.
If new toplevel functions are created and NEW_FUNCTIONS != NULL,
@@ -1353,10 +1371,13 @@ function_instance::match (cgraph_node *node,
gphi *phi = gpi.phi ();
inline_stack stack;
+ /* We do not assign discriminators to PHI nodes.
+ In case we every start using them, we wil need to
+ update tree-cfg.cc::assign_discriminators. */
+ gcc_assert (gimple_location (phi) == UNKNOWN_LOCATION);
get_inline_stack_in_node (gimple_location (phi), &stack, node);
count_info *info = lookup_count (gimple_location (phi), stack, node);
- if (info)
- counts.add (info);
+ gcc_assert (!info);
dump_stmt (phi, info, NULL, stack);
counts.add (info);
for (edge e : bb->succs)
@@ -1620,7 +1641,7 @@ function_instance::match (cgraph_node *node,
unsigned int start_location = get_combined_location
(DECL_STRUCT_FUNCTION (node->decl)->function_start_locus, node->decl);
/* When outputting code to builtins location we use line number 0.
- craeate_gcov is stupid and hapilly computes offsets across files.
+ create_gcov is stupid and happily computes offsets across files.
Silently ignore it. */
unsigned int zero_location
= ((unsigned)(1-DECL_SOURCE_LINE (node->decl))) << 16;
@@ -2072,11 +2093,11 @@ autofdo_source_profile::offline_external_functions ()
seen.add (iter.first);
}
- /* Now process all tolevel (offline) function instances.
+ /* Now process all toplevel (offline) function instances.
If instance has no definition in this translation unit,
first offline all inlined functions which are defined here
- (so we do not lose porfile due to cross-module inlining
+ (so we do not lose profile due to cross-module inlining
done by link-time optimizers).
If instance has a definition, look into all inlined functions
@@ -2417,6 +2438,7 @@ bool
autofdo_source_profile::get_count_info (gimple *stmt, count_info *info,
cgraph_node *node) const
{
+ gcc_checking_assert (stmt_loc_used_by_debug_info (stmt));
return get_count_info (gimple_location (stmt), info, node);
}
@@ -2675,7 +2697,7 @@ autofdo_source_profile::get_function_instance_by_inline_stack (
if (s == NULL)
{
/* afdo inliner extends the stack by last entry with unknown
- location while chekcing if function was inlined during train run.
+ location while checking if function was inlined during train run.
We do not want to print diagnostics about every function
which is not inlined. */
if (s && dump_enabled_p () && stack[i].location != UNKNOWN_LOCATION)
@@ -2967,7 +2989,7 @@ afdo_set_bb_count (basic_block bb, hash_set <basic_block> &zero_bbs)
{
count_info info;
gimple *stmt = gsi_stmt (gsi);
- if (gimple_clobber_p (stmt))
+ if (!stmt_loc_used_by_debug_info (stmt))
continue;
if (afdo_source_profile->get_count_info (stmt, &info))
{
@@ -3419,7 +3441,7 @@ cmp (const void *a, const void *b)
return 0;
}
-/* To scalle a connected component of graph we collect desired scales of
+/* To scale a connected component of graph we collect desired scales of
basic blocks on the boundary and then compute a robust average. */
struct scale
@@ -4135,8 +4157,10 @@ afdo_vpt_for_early_inline (cgraph_node *node)
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
- autofdo::count_info info;
gimple *stmt = gsi_stmt (gsi);
+ if (!stmt_loc_used_by_debug_info (stmt))
+ continue;
+ autofdo::count_info info;
if (autofdo::afdo_source_profile->get_count_info (stmt, &info, node))
bb_count = MAX (bb_count, info.count);
}
diff --git a/gcc/auto-profile.h b/gcc/auto-profile.h
index 639e263..3cce5f2 100644
--- a/gcc/auto-profile.h
+++ b/gcc/auto-profile.h
@@ -39,7 +39,7 @@ extern void remove_afdo_speculative_target (cgraph_edge *);
considered cols. */
extern gcov_type afdo_hot_bb_threshold;
-/* Return ture if COUNT is possiby hot. */
+/* Return true if COUNT is possibly hot. */
extern bool maybe_hot_afdo_count_p (profile_count count);
#endif /* AUTO_PROFILE_H */
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 049631d..410a03c 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -293,11 +293,6 @@ enum cfg_bb_flags
/* Return expected execution frequency of the edge E. */
#define EDGE_FREQUENCY(e) e->count ().to_frequency (cfun)
-/* Compute a scale factor (or probability) suitable for scaling of
- gcov_type values via apply_probability() and apply_scale(). */
-#define GCOV_COMPUTE_SCALE(num,den) \
- ((den) ? RDIV ((num) * REG_BR_PROB_BASE, (den)) : REG_BR_PROB_BASE)
-
/* Return nonzero if edge is critical. */
#define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \
&& EDGE_COUNT ((e)->dest->preds) >= 2)
diff --git a/gcc/c-family/c.opt.urls b/gcc/c-family/c.opt.urls
index e09d51d..6c01a7d 100644
--- a/gcc/c-family/c.opt.urls
+++ b/gcc/c-family/c.opt.urls
@@ -595,6 +595,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wmultichar)
Wmultiple-inheritance
UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wmultiple-inheritance)
+Wmultiple-parameter-fwd-decl-lists
+UrlSuffix(gcc/Warning-Options.html#index-Wmultiple-parameter-fwd-decl-lists)
+
Wmultistatement-macros
UrlSuffix(gcc/Warning-Options.html#index-Wmultistatement-macros)
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index ef985ba..dea3113 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2025-09-30 Martin Uecker <uecker@tugraz.at>
+
+ PR target/121933
+ * c-typeck.cc (mark_decl_used): Set DECL_NONLOCAL
+ only for VAR_DECL, FUNC_DECL, PARM_DECL.
+
2025-09-26 Alejandro Colomar <alx@kernel.org>
* c-decl.cc (c_scope): Rename {warned > had}_forward_parm_decls.
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index b96215a..9b2aeea 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -3696,7 +3696,8 @@ mark_decl_used (tree ref, bool address)
if (static_p)
C_DECL_USED (ref) = 1;
- if (nonloc_p)
+ if (nonloc_p && (VAR_OR_FUNCTION_DECL_P (ref)
+ || TREE_CODE (ref) == PARM_DECL))
DECL_NONLOCAL (ref) = 1;
/* Nothing to do anymore. */
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 8950294..5c3ba50 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -90,7 +90,7 @@ along with GCC; see the file COPYING3. If not see
struct ssaexpand SA;
/* This variable holds the currently expanded gimple statement for purposes
- of comminucating the profile info to the builtin expanders. */
+ of communicating the profile info to the builtin expanders. */
gimple *currently_expanding_gimple_stmt;
static rtx expand_debug_expr (tree);
@@ -834,8 +834,8 @@ add_scope_conflicts_2 (vars_ssa_cache &cache, tree name,
{
gcc_assert (TREE_CODE (name) == SSA_NAME);
- /* Querry the cache for the mapping of addresses that are referendd by
- ssa name NAME. Querrying it will fill in it. */
+ /* Query the cache for the mapping of addresses that are referenced by
+ ssa name NAME. Querying it will fill in it. */
bitmap_iterator bi;
unsigned i;
const_bitmap bmap = cache (name);
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 9ccee4b..031da86 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -20640,6 +20640,30 @@ aarch64_compare_version_priority (tree decl1, tree decl2)
return compare_feature_masks (mask1, mask2);
}
+/* Implement TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A. */
+
+bool
+aarch64_functions_b_resolvable_from_a (tree decl_a, tree decl_b, tree baseline)
+{
+ auto baseline_isa = aarch64_get_isa_flags
+ (TREE_TARGET_OPTION (aarch64_fndecl_options (baseline)));
+ auto isa_a = baseline_isa;
+ auto isa_b = baseline_isa;
+
+ auto a_version = get_target_version (decl_a);
+ auto b_version = get_target_version (decl_b);
+ if (a_version.is_valid ())
+ aarch64_parse_fmv_features (a_version, &isa_a, NULL, NULL);
+ if (b_version.is_valid ())
+ aarch64_parse_fmv_features (b_version, &isa_b, NULL, NULL);
+
+ /* Are there any bits of b that arent in a. */
+ if (isa_b & (~isa_a))
+ return false;
+
+ return true;
+}
+
/* Build the struct __ifunc_arg_t type:
struct __ifunc_arg_t
@@ -32854,6 +32878,10 @@ aarch64_libgcc_floating_mode_supported_p
#undef TARGET_COMPARE_VERSION_PRIORITY
#define TARGET_COMPARE_VERSION_PRIORITY aarch64_compare_version_priority
+#undef TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A
+#define TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A \
+ aarch64_functions_b_resolvable_from_a
+
#undef TARGET_GENERATE_VERSION_DISPATCHER_BODY
#define TARGET_GENERATE_VERSION_DISPATCHER_BODY \
aarch64_generate_version_dispatcher_body
diff --git a/gcc/diagnostics/output-spec.cc b/gcc/diagnostics/output-spec.cc
index 8ec638a..28ea044f 100644
--- a/gcc/diagnostics/output-spec.cc
+++ b/gcc/diagnostics/output-spec.cc
@@ -42,13 +42,24 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostics/output-spec.h"
/* A namespace for handling the DSL of the arguments of
- -fdiagnostics-add-output= and -fdiagnostics-set-output=. */
+ -fdiagnostics-add-output= and -fdiagnostics-set-output=
+ which look like:
+ SCHEME[:KEY=VALUE(,KEY=VALUE)*]
+ We call this an output spec. */
namespace diagnostics {
namespace output_spec {
+class scheme_handler;
+
/* Decls. */
+/* A class for the result of the first stage of parsing an output spec,
+ where values are represented as untyped strings.
+ The scheme might not exist.
+ The keys have not been validated against the scheme.
+ The values have not been validated against their keys. */
+
struct scheme_name_and_params
{
std::string m_scheme_name;
@@ -62,94 +73,12 @@ struct scheme_name_and_params
class output_factory
{
public:
- class scheme_handler
- {
- public:
- scheme_handler (std::string scheme_name)
- : m_scheme_name (std::move (scheme_name))
- {}
- virtual ~scheme_handler () {}
-
- const std::string &get_scheme_name () const { return m_scheme_name; }
-
- virtual std::unique_ptr<sink>
- make_sink (const context &ctxt,
- diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const = 0;
-
- protected:
- bool
- parse_bool_value (const context &ctxt,
- const char *unparsed_arg,
- const std::string &key,
- const std::string &value,
- bool &out) const
- {
- if (value == "yes")
- {
- out = true;
- return true;
- }
- else if (value == "no")
- {
- out = false;
- return true;
- }
- else
- {
- ctxt.report_error
- ("%<%s%s%>:"
- " unexpected value %qs for key %qs; expected %qs or %qs",
- ctxt.get_option_name (), unparsed_arg,
- value.c_str (),
- key.c_str (),
- "yes", "no");
-
- return false;
- }
- }
- template <typename EnumType, size_t NumValues>
- bool
- parse_enum_value (const context &ctxt,
- const char *unparsed_arg,
- const std::string &key,
- const std::string &value,
- const std::array<std::pair<const char *, EnumType>, NumValues> &value_names,
- EnumType &out) const
- {
- for (auto &iter : value_names)
- if (value == iter.first)
- {
- out = iter.second;
- return true;
- }
-
- auto_vec<const char *> known_values;
- for (auto iter : value_names)
- known_values.safe_push (iter.first);
- pp_markup::comma_separated_quoted_strings e (known_values);
- ctxt.report_error
- ("%<%s%s%>:"
- " unexpected value %qs for key %qs; known values: %e",
- ctxt.get_option_name (), unparsed_arg,
- value.c_str (),
- key.c_str (),
- &e);
- return false;
- }
-
- private:
- const std::string m_scheme_name;
- };
-
output_factory ();
std::unique_ptr<sink>
make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg);
+ const scheme_name_and_params &scheme_and_kvs);
const scheme_handler *get_scheme_handler (const std::string &scheme_name);
@@ -157,44 +86,158 @@ private:
std::vector<std::unique_ptr<scheme_handler>> m_scheme_handlers;
};
-class text_scheme_handler : public output_factory::scheme_handler
+class scheme_handler
{
public:
+ scheme_handler (std::string scheme_name)
+ : m_scheme_name (std::move (scheme_name))
+ {}
+ virtual ~scheme_handler () {}
+
+ const std::string &get_scheme_name () const { return m_scheme_name; }
+
+ virtual std::unique_ptr<sink>
+ make_sink (const context &ctxt,
+ diagnostics::context &dc,
+ const scheme_name_and_params &scheme_and_kvs) const = 0;
+
+protected:
+ bool
+ parse_bool_value (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ bool &out) const
+ {
+ if (value == "yes")
+ {
+ out = true;
+ return true;
+ }
+ else if (value == "no")
+ {
+ out = false;
+ return true;
+ }
+ else
+ {
+ ctxt.report_error
+ ("%<%s%s%>:"
+ " unexpected value %qs for key %qs; expected %qs or %qs",
+ ctxt.get_option_name (), ctxt.get_unparsed_spec (),
+ value.c_str (),
+ key.c_str (),
+ "yes", "no");
+
+ return false;
+ }
+ }
+ template <typename EnumType, size_t NumValues>
+ bool
+ parse_enum_value (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ const std::array<std::pair<const char *, EnumType>, NumValues> &value_names,
+ EnumType &out) const
+ {
+ for (auto &iter : value_names)
+ if (value == iter.first)
+ {
+ out = iter.second;
+ return true;
+ }
+
+ auto_vec<const char *> known_values;
+ for (auto iter : value_names)
+ known_values.safe_push (iter.first);
+ pp_markup::comma_separated_quoted_strings e (known_values);
+ ctxt.report_error
+ ("%<%s%s%>:"
+ " unexpected value %qs for key %qs; known values: %e",
+ ctxt.get_option_name (), ctxt.get_unparsed_spec (),
+ value.c_str (),
+ key.c_str (),
+ &e);
+ return false;
+ }
+
+private:
+ const std::string m_scheme_name;
+};
+
+class text_scheme_handler : public scheme_handler
+{
+public:
+ struct decoded_args
+ {
+ bool m_show_color;
+ bool m_show_nesting;
+ bool m_show_locations_in_nesting;
+ bool m_show_levels;
+ };
+
text_scheme_handler () : scheme_handler ("text") {}
std::unique_ptr<sink>
make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const final override;
+ const scheme_name_and_params &scheme_and_kvs) const final override;
+
+ bool
+ decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &out_opts) const;
};
-class sarif_scheme_handler : public output_factory::scheme_handler
+class sarif_scheme_handler : public scheme_handler
{
public:
+ struct decoded_args
+ {
+ label_text m_filename;
+ enum sarif_serialization_kind m_serialization_kind;
+ sarif_generation_options m_generation_opts;
+ };
+
sarif_scheme_handler () : scheme_handler ("sarif") {}
std::unique_ptr<sink>
make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const final override;
+ const scheme_name_and_params &scheme_and_kvs) const final override;
+
+ bool
+ decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &out_opts) const;
private:
static std::unique_ptr<sarif_serialization_format>
make_sarif_serialization_object (enum sarif_serialization_kind);
};
-class html_scheme_handler : public output_factory::scheme_handler
+class html_scheme_handler : public scheme_handler
{
public:
+ struct decoded_args
+ {
+ label_text m_filename;
+ html_generation_options m_html_gen_opts;
+ };
+
html_scheme_handler () : scheme_handler ("experimental-html") {}
std::unique_ptr<sink>
make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const final override;
+ const scheme_name_and_params &scheme_and_kvs) const final override;
+
+ bool
+ decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &opts_out) const;
};
/* struct context. */
@@ -209,8 +252,7 @@ context::report_error (const char *gmsgid, ...) const
}
void
-context::report_unknown_key (const char *unparsed_arg,
- const std::string &key,
+context::report_unknown_key (const std::string &key,
const std::string &scheme_name,
auto_vec<const char *> &known_keys) const
{
@@ -218,13 +260,12 @@ context::report_unknown_key (const char *unparsed_arg,
report_error
("%<%s%s%>:"
" unknown key %qs for format %qs; known keys: %e",
- get_option_name (), unparsed_arg,
+ get_option_name (), get_unparsed_spec (),
key.c_str (), scheme_name.c_str (), &e);
}
void
-context::report_missing_key (const char *unparsed_arg,
- const std::string &key,
+context::report_missing_key (const std::string &key,
const std::string &scheme_name,
const char *metavar) const
{
@@ -232,7 +273,7 @@ context::report_missing_key (const char *unparsed_arg,
("%<%s%s%>:"
" missing required key %qs for format %qs;"
" try %<%s%s:%s=%s%>",
- get_option_name (), unparsed_arg,
+ get_option_name (), get_unparsed_spec (),
key.c_str (), scheme_name.c_str (),
get_option_name (), scheme_name.c_str (), key.c_str (), metavar);
}
@@ -250,12 +291,13 @@ context::open_output_file (label_text &&filename) const
}
static std::unique_ptr<scheme_name_and_params>
-parse (const context &ctxt, const char *unparsed_arg)
+parse (const context &ctxt)
{
scheme_name_and_params result;
- if (const char *const colon = strchr (unparsed_arg, ':'))
+ const char *const unparsed_spec = ctxt.get_unparsed_spec ();
+ if (const char *const colon = strchr (unparsed_spec, ':'))
{
- result.m_scheme_name = std::string (unparsed_arg, colon - unparsed_arg);
+ result.m_scheme_name = std::string (unparsed_spec, colon - unparsed_spec);
/* Expect zero of more of KEY=VALUE,KEY=VALUE, etc .*/
const char *iter = colon + 1;
const char *last_separator = ":";
@@ -271,7 +313,7 @@ parse (const context &ctxt, const char *unparsed_arg)
" expected KEY=VALUE-style parameter for format %qs"
" after %qs;"
" got %qs",
- ctxt.get_option_name (), unparsed_arg,
+ ctxt.get_option_name (), ctxt.get_unparsed_spec (),
result.m_scheme_name.c_str (),
last_separator,
iter);
@@ -295,23 +337,22 @@ parse (const context &ctxt, const char *unparsed_arg)
}
}
else
- result.m_scheme_name = unparsed_arg;
+ result.m_scheme_name = unparsed_spec;
return std::make_unique<scheme_name_and_params> (std::move (result));
}
std::unique_ptr<sink>
-context::parse_and_make_sink (const char *unparsed_arg,
- diagnostics::context &dc)
+context::parse_and_make_sink (diagnostics::context &dc)
{
- auto parsed_arg = parse (*this, unparsed_arg);
+ auto parsed_arg = parse (*this);
if (!parsed_arg)
return nullptr;
output_factory factory;
- return factory.make_sink (*this, dc, unparsed_arg, *parsed_arg);
+ return factory.make_sink (*this, dc, *parsed_arg);
}
-/* class output_factory::scheme_handler. */
+/* class scheme_handler. */
/* class output_factory. */
@@ -322,7 +363,7 @@ output_factory::output_factory ()
m_scheme_handlers.push_back (std::make_unique<html_scheme_handler> ());
}
-const output_factory::scheme_handler *
+const scheme_handler *
output_factory::get_scheme_handler (const std::string &scheme_name)
{
for (auto &iter : m_scheme_handlers)
@@ -334,10 +375,9 @@ output_factory::get_scheme_handler (const std::string &scheme_name)
std::unique_ptr<sink>
output_factory::make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg)
+ const scheme_name_and_params &scheme_and_kvs)
{
- auto scheme_handler = get_scheme_handler (parsed_arg.m_scheme_name);
+ auto scheme_handler = get_scheme_handler (scheme_and_kvs.m_scheme_name);
if (!scheme_handler)
{
auto_vec<const char *> strings;
@@ -346,155 +386,97 @@ output_factory::make_sink (const context &ctxt,
pp_markup::comma_separated_quoted_strings e (strings);
ctxt.report_error ("%<%s%s%>:"
" unrecognized format %qs; known formats: %e",
- ctxt.get_option_name (), unparsed_arg,
- parsed_arg.m_scheme_name.c_str (), &e);
+ ctxt.get_option_name (), ctxt.get_unparsed_spec (),
+ scheme_and_kvs.m_scheme_name.c_str (), &e);
return nullptr;
}
- return scheme_handler->make_sink (ctxt, dc, unparsed_arg, parsed_arg);
+ return scheme_handler->make_sink (ctxt, dc, scheme_and_kvs);
}
-/* class text_scheme_handler : public output_factory::scheme_handler. */
+/* class text_scheme_handler : public scheme_handler. */
std::unique_ptr<sink>
text_scheme_handler::make_sink (const context &ctxt,
diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const
+ const scheme_name_and_params &scheme_and_kvs) const
{
- bool show_color = pp_show_color (dc.get_reference_printer ());
- bool show_nesting = true;
- bool show_locations_in_nesting = true;
- bool show_levels = false;
- for (auto& iter : parsed_arg.m_kvs)
+ decoded_args opts;
+ opts.m_show_color = pp_show_color (dc.get_reference_printer ());
+ opts.m_show_nesting = true;
+ opts.m_show_locations_in_nesting = true;
+ opts.m_show_levels = false;
+ for (auto& iter : scheme_and_kvs.m_kvs)
{
const std::string &key = iter.first;
const std::string &value = iter.second;
- if (key == "color")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value, show_color))
- return nullptr;
- continue;
- }
- if (key == "show-nesting")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- show_nesting))
- return nullptr;
- continue;
- }
- if (key == "show-nesting-locations")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- show_locations_in_nesting))
- return nullptr;
- continue;
- }
- if (key == "show-nesting-levels")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value, show_levels))
- return nullptr;
- continue;
- }
-
- /* Key not found. */
- auto_vec<const char *> known_keys;
- known_keys.safe_push ("color");
- known_keys.safe_push ("show-nesting");
- known_keys.safe_push ("show-nesting-locations");
- known_keys.safe_push ("show-nesting-levels");
- ctxt.report_unknown_key (unparsed_arg, key, get_scheme_name (),
- known_keys);
- return nullptr;
+ if (!decode_kv (ctxt, key, value, opts))
+ return nullptr;
}
auto sink = std::make_unique<diagnostics::text_sink> (dc);
- sink->set_show_nesting (show_nesting);
- sink->set_show_locations_in_nesting (show_locations_in_nesting);
- sink->set_show_nesting_levels (show_levels);
+ sink->set_show_nesting (opts.m_show_nesting);
+ sink->set_show_locations_in_nesting (opts.m_show_locations_in_nesting);
+ sink->set_show_nesting_levels (opts.m_show_levels);
+ pp_show_color (sink->get_printer ()) = opts.m_show_color;
return sink;
}
-/* class sarif_scheme_handler : public output_factory::scheme_handler. */
+bool
+text_scheme_handler::decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &opts_out) const
+{
+ if (key == "color")
+ return parse_bool_value (ctxt, key, value, opts_out.m_show_color);
+ if (key == "show-nesting")
+ return parse_bool_value (ctxt, key, value, opts_out.m_show_nesting);
+ if (key == "show-nesting-locations")
+ return parse_bool_value (ctxt, key, value,
+ opts_out.m_show_locations_in_nesting);
+ if (key == "show-nesting-levels")
+ return parse_bool_value (ctxt, key, value, opts_out.m_show_levels);
+
+ /* Key not found. */
+ auto_vec<const char *> known_keys;
+ known_keys.safe_push ("color");
+ known_keys.safe_push ("show-nesting");
+ known_keys.safe_push ("show-nesting-locations");
+ known_keys.safe_push ("show-nesting-levels");
+ ctxt.report_unknown_key (key, get_scheme_name (), known_keys);
+ return false;
+}
+
+/* class sarif_scheme_handler : public scheme_handler. */
std::unique_ptr<sink>
-sarif_scheme_handler::make_sink (const context &ctxt,
- diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const
+sarif_scheme_handler::
+make_sink (const context &ctxt,
+ diagnostics::context &dc,
+ const scheme_name_and_params &scheme_and_kvs) const
{
- label_text filename;
- enum sarif_serialization_kind serialization_kind
- = sarif_serialization_kind::json;
- sarif_generation_options sarif_gen_opts;
- for (auto& iter : parsed_arg.m_kvs)
+ decoded_args opts;
+ opts.m_serialization_kind = sarif_serialization_kind::json;
+
+ for (auto& iter : scheme_and_kvs.m_kvs)
{
const std::string &key = iter.first;
const std::string &value = iter.second;
- if (key == "file")
- {
- filename = label_text::take (xstrdup (value.c_str ()));
- continue;
- }
- if (key == "serialization")
- {
- static const std::array<std::pair<const char *, enum sarif_serialization_kind>,
- (size_t)sarif_serialization_kind::num_values> value_names
- {{{"json", sarif_serialization_kind::json}}};
-
- if (!parse_enum_value<enum sarif_serialization_kind>
- (ctxt, unparsed_arg,
- key, value,
- value_names,
- serialization_kind))
- return nullptr;
- continue;
- }
- if (key == "version")
- {
- static const std::array<std::pair<const char *, enum sarif_version>,
- (size_t)sarif_version::num_versions> value_names
- {{{"2.1", sarif_version::v2_1_0},
- {"2.2-prerelease", sarif_version::v2_2_prerelease_2024_08_08}}};
-
- if (!parse_enum_value<enum sarif_version>
- (ctxt, unparsed_arg,
- key, value,
- value_names,
- sarif_gen_opts.m_version))
- return nullptr;
- continue;
- }
- if (key == "state-graphs")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- sarif_gen_opts.m_state_graph))
- return nullptr;
- continue;
- }
-
- /* Key not found. */
- auto_vec<const char *> known_keys;
- known_keys.safe_push ("file");
- known_keys.safe_push ("serialization");
- known_keys.safe_push ("state-graphs");
- known_keys.safe_push ("version");
- ctxt.report_unknown_key (unparsed_arg, key, get_scheme_name (),
- known_keys);
- return nullptr;
+ if (!decode_kv (ctxt, key, value, opts))
+ return nullptr;
}
output_file output_file_;
- if (filename.get ())
- output_file_ = ctxt.open_output_file (std::move (filename));
+ if (opts.m_filename.get ())
+ output_file_ = ctxt.open_output_file (std::move (opts.m_filename));
else
// Default filename
{
const char *basename = ctxt.get_base_filename ();
if (!basename)
{
- ctxt.report_missing_key (unparsed_arg,
- "file",
+ ctxt.report_missing_key ("file",
get_scheme_name (),
"FILENAME");
return nullptr;
@@ -503,21 +485,71 @@ sarif_scheme_handler::make_sink (const context &ctxt,
= open_sarif_output_file (dc,
ctxt.get_affected_location_mgr (),
basename,
- serialization_kind);
+ opts.m_serialization_kind);
}
if (!output_file_)
return nullptr;
- auto serialization_obj = make_sarif_serialization_object (serialization_kind);
+ auto serialization_obj
+ = make_sarif_serialization_object (opts.m_serialization_kind);
auto sink = make_sarif_sink (dc,
*ctxt.get_affected_location_mgr (),
std::move (serialization_obj),
- sarif_gen_opts,
+ opts.m_generation_opts,
std::move (output_file_));
+
return sink;
}
+bool
+sarif_scheme_handler::decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &opts_out) const
+{
+ if (key == "file")
+ {
+ opts_out.m_filename = label_text::take (xstrdup (value.c_str ()));
+ return true;
+ }
+ if (key == "serialization")
+ {
+ static const std::array<std::pair<const char *, enum sarif_serialization_kind>,
+ (size_t)sarif_serialization_kind::num_values> value_names
+ {{{"json", sarif_serialization_kind::json}}};
+ return parse_enum_value<enum sarif_serialization_kind>
+ (ctxt,
+ key, value,
+ value_names,
+ opts_out.m_serialization_kind);
+ }
+ if (key == "version")
+ {
+ static const std::array<std::pair<const char *, enum sarif_version>,
+ (size_t)sarif_version::num_versions> value_names
+ {{{"2.1", sarif_version::v2_1_0},
+ {"2.2-prerelease", sarif_version::v2_2_prerelease_2024_08_08}}};
+ return parse_enum_value<enum sarif_version>
+ (ctxt,
+ key, value,
+ value_names,
+ opts_out.m_generation_opts.m_version);
+ }
+ if (key == "state-graphs")
+ return parse_bool_value (ctxt, key, value,
+ opts_out.m_generation_opts.m_state_graph);
+
+ /* Key not found. */
+ auto_vec<const char *> known_keys;
+ known_keys.safe_push ("file");
+ known_keys.safe_push ("serialization");
+ known_keys.safe_push ("state-graphs");
+ known_keys.safe_push ("version");
+ ctxt.report_unknown_key (key, get_scheme_name (), known_keys);
+ return false;
+}
+
std::unique_ptr<sarif_serialization_format>
sarif_scheme_handler::
make_sarif_serialization_object (enum sarif_serialization_kind kind)
@@ -532,85 +564,33 @@ make_sarif_serialization_object (enum sarif_serialization_kind kind)
}
}
-/* class html_scheme_handler : public output_factory::scheme_handler. */
+/* class html_scheme_handler : public scheme_handler. */
std::unique_ptr<sink>
-html_scheme_handler::make_sink (const context &ctxt,
- diagnostics::context &dc,
- const char *unparsed_arg,
- const scheme_name_and_params &parsed_arg) const
+html_scheme_handler::
+make_sink (const context &ctxt,
+ diagnostics::context &dc,
+ const scheme_name_and_params &scheme_and_kvs) const
{
- label_text filename;
- html_generation_options html_gen_opts;
- for (auto& iter : parsed_arg.m_kvs)
+ decoded_args opts;
+ for (auto& iter : scheme_and_kvs.m_kvs)
{
const std::string &key = iter.first;
const std::string &value = iter.second;
- if (key == "css")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- html_gen_opts.m_css))
- return nullptr;
- continue;
- }
- if (key == "file")
- {
- filename = label_text::take (xstrdup (value.c_str ()));
- continue;
- }
- if (key == "javascript")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- html_gen_opts.m_javascript))
- return nullptr;
- continue;
- }
- if (key == "show-state-diagrams")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- html_gen_opts.m_show_state_diagrams))
- return nullptr;
- continue;
- }
- if (key == "show-state-diagrams-dot-src")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- html_gen_opts.m_show_state_diagrams_dot_src))
- return nullptr;
- continue;
- }
- if (key == "show-state-diagrams-sarif")
- {
- if (!parse_bool_value (ctxt, unparsed_arg, key, value,
- html_gen_opts.m_show_state_diagrams_sarif))
- return nullptr;
- continue;
- }
-
- /* Key not found. */
- auto_vec<const char *> known_keys;
- known_keys.safe_push ("css");
- known_keys.safe_push ("file");
- known_keys.safe_push ("javascript");
- known_keys.safe_push ("show-state-diagrams");
- known_keys.safe_push ("show-state-diagram-dot-src");
- known_keys.safe_push ("show-state-diagram-sarif");
- ctxt.report_unknown_key (unparsed_arg, key, get_scheme_name (),
- known_keys);
- return nullptr;
+ if (!decode_kv (ctxt, key, value, opts))
+ return nullptr;
}
output_file output_file_;
- if (filename.get ())
- output_file_ = ctxt.open_output_file (std::move (filename));
+ if (opts.m_filename.get ())
+ output_file_ = ctxt.open_output_file (std::move (opts.m_filename));
else
// Default filename
{
const char *basename = ctxt.get_base_filename ();
if (!basename)
{
- ctxt.report_missing_key (unparsed_arg,
- "file",
+ ctxt.report_missing_key ("file",
get_scheme_name (),
"FILENAME");
return nullptr;
@@ -626,11 +606,51 @@ html_scheme_handler::make_sink (const context &ctxt,
auto sink = make_html_sink (dc,
*ctxt.get_affected_location_mgr (),
- html_gen_opts,
+ opts.m_html_gen_opts,
std::move (output_file_));
return sink;
}
+bool
+html_scheme_handler::decode_kv (const context &ctxt,
+ const std::string &key,
+ const std::string &value,
+ decoded_args &opts_out) const
+{
+ if (key == "css")
+ return parse_bool_value (ctxt, key, value, opts_out.m_html_gen_opts.m_css);
+ if (key == "file")
+ {
+ opts_out.m_filename = label_text::take (xstrdup (value.c_str ()));
+ return true;
+ }
+ if (key == "javascript")
+ return parse_bool_value (ctxt, key, value,
+ opts_out.m_html_gen_opts.m_javascript);
+ if (key == "show-state-diagrams")
+ return parse_bool_value (ctxt, key, value,
+ opts_out.m_html_gen_opts.m_show_state_diagrams);
+ if (key == "show-state-diagrams-dot-src")
+ return parse_bool_value
+ (ctxt, key, value,
+ opts_out.m_html_gen_opts.m_show_state_diagrams_dot_src);
+ if (key == "show-state-diagrams-sarif")
+ return parse_bool_value
+ (ctxt, key, value,
+ opts_out.m_html_gen_opts.m_show_state_diagrams_sarif);
+
+ /* Key not found. */
+ auto_vec<const char *> known_keys;
+ known_keys.safe_push ("css");
+ known_keys.safe_push ("file");
+ known_keys.safe_push ("javascript");
+ known_keys.safe_push ("show-state-diagrams");
+ known_keys.safe_push ("show-state-diagram-dot-src");
+ known_keys.safe_push ("show-state-diagram-sarif");
+ ctxt.report_unknown_key (key, get_scheme_name (), known_keys);
+ return false;
+}
+
} // namespace output_spec
#if CHECKING_P
@@ -668,12 +688,14 @@ struct parser_test
test_spec_context (diagnostics::context &dc,
line_maps *location_mgr,
location_t loc,
- const char *option_name)
+ const char *option_name,
+ const char *unparsed_arg)
: dc_spec_context (dc,
location_mgr,
location_mgr,
loc,
- option_name)
+ option_name,
+ unparsed_arg)
{
}
@@ -684,18 +706,18 @@ struct parser_test
}
};
- parser_test ()
+ parser_test (const char *unparsed_spec)
: m_dc (),
- m_ctxt (m_dc, line_table, UNKNOWN_LOCATION, "-fOPTION="),
+ m_ctxt (m_dc, line_table, UNKNOWN_LOCATION, "-fOPTION=", unparsed_spec),
m_fmt (m_dc.get_sink (0))
{
pp_buffer (m_fmt.get_printer ())->m_flush_p = false;
}
std::unique_ptr<diagnostics::output_spec::scheme_name_and_params>
- parse (const char *unparsed_arg)
+ parse ()
{
- return diagnostics::output_spec::parse (m_ctxt, unparsed_arg);
+ return diagnostics::output_spec::parse (m_ctxt);
}
bool execution_failed_p () const
@@ -725,8 +747,8 @@ test_output_arg_parsing ()
/* Minimal correct example. */
{
- parser_test pt;
- auto result = pt.parse ("foo");
+ parser_test pt ("foo");
+ auto result = pt.parse ();
ASSERT_EQ (result->m_scheme_name, "foo");
ASSERT_EQ (result->m_kvs.size (), 0);
ASSERT_FALSE (pt.execution_failed_p ());
@@ -734,8 +756,8 @@ test_output_arg_parsing ()
/* Stray trailing colon with no key/value pairs. */
{
- parser_test pt;
- auto result = pt.parse ("foo:");
+ parser_test pt ("foo:");
+ auto result = pt.parse ();
ASSERT_EQ (result, nullptr);
ASSERT_TRUE (pt.execution_failed_p ());
ASSERT_STREQ (pt.get_diagnostic_text (),
@@ -747,8 +769,8 @@ test_output_arg_parsing ()
/* No key before '='. */
{
- parser_test pt;
- auto result = pt.parse ("foo:=");
+ parser_test pt ("foo:=");
+ auto result = pt.parse ();
ASSERT_EQ (result, nullptr);
ASSERT_TRUE (pt.execution_failed_p ());
ASSERT_STREQ (pt.get_diagnostic_text (),
@@ -760,8 +782,8 @@ test_output_arg_parsing ()
/* No value for key. */
{
- parser_test pt;
- auto result = pt.parse ("foo:key,");
+ parser_test pt ("foo:key,");
+ auto result = pt.parse ();
ASSERT_EQ (result, nullptr);
ASSERT_TRUE (pt.execution_failed_p ());
ASSERT_STREQ (pt.get_diagnostic_text (),
@@ -773,8 +795,8 @@ test_output_arg_parsing ()
/* Correct example, with one key/value pair. */
{
- parser_test pt;
- auto result = pt.parse ("foo:key=value");
+ parser_test pt ("foo:key=value");
+ auto result = pt.parse ();
ASSERT_EQ (result->m_scheme_name, "foo");
ASSERT_EQ (result->m_kvs.size (), 1);
ASSERT_EQ (result->m_kvs[0].first, "key");
@@ -784,8 +806,8 @@ test_output_arg_parsing ()
/* Stray trailing comma. */
{
- parser_test pt;
- auto result = pt.parse ("foo:key=value,");
+ parser_test pt ("foo:key=value,");
+ auto result = pt.parse ();
ASSERT_EQ (result, nullptr);
ASSERT_TRUE (pt.execution_failed_p ());
ASSERT_STREQ (pt.get_diagnostic_text (),
@@ -797,8 +819,8 @@ test_output_arg_parsing ()
/* Correct example, with two key/value pairs. */
{
- parser_test pt;
- auto result = pt.parse ("foo:color=red,shape=circle");
+ parser_test pt ("foo:color=red,shape=circle");
+ auto result = pt.parse ();
ASSERT_EQ (result->m_scheme_name, "foo");
ASSERT_EQ (result->m_kvs.size (), 2);
ASSERT_EQ (result->m_kvs[0].first, "color");
diff --git a/gcc/diagnostics/output-spec.h b/gcc/diagnostics/output-spec.h
index c84d237..e24002b 100644
--- a/gcc/diagnostics/output-spec.h
+++ b/gcc/diagnostics/output-spec.h
@@ -34,22 +34,19 @@ class context
{
public:
std::unique_ptr<sink>
- parse_and_make_sink (const char *,
- diagnostics::context &dc);
+ parse_and_make_sink (diagnostics::context &dc);
void
report_error (const char *gmsgid, ...) const
ATTRIBUTE_GCC_DIAG(2,3);
void
- report_unknown_key (const char *unparsed_arg,
- const std::string &key,
+ report_unknown_key (const std::string &key,
const std::string &scheme_name,
auto_vec<const char *> &known_keys) const;
void
- report_missing_key (const char *unparsed_arg,
- const std::string &key,
+ report_missing_key (const std::string &key,
const std::string &scheme_name,
const char *metavar) const;
@@ -59,6 +56,9 @@ class context
const char *
get_option_name () const { return m_option_name; }
+ const char *
+ get_unparsed_spec () const { return m_unparsed_spec; }
+
line_maps *
get_affected_location_mgr () const { return m_affected_location_mgr; }
@@ -72,13 +72,20 @@ class context
protected:
context (const char *option_name,
+ const char *unparsed_spec,
line_maps *affected_location_mgr)
: m_option_name (option_name),
+ m_unparsed_spec (unparsed_spec),
m_affected_location_mgr (affected_location_mgr)
{
}
+ // e.g. "-fdiagnostics-add-output="
const char *m_option_name;
+
+ // e.g. "scheme:foo=bar,key=value"
+ const char *m_unparsed_spec;
+
line_maps *m_affected_location_mgr;
};
@@ -91,8 +98,9 @@ public:
line_maps *affected_location_mgr,
line_maps *control_location_mgr,
location_t loc,
- const char *option_name)
- : context (option_name, affected_location_mgr),
+ const char *option_name,
+ const char *unparsed_spec)
+ : context (option_name, unparsed_spec, affected_location_mgr),
m_dc (dc),
m_control_location_mgr (control_location_mgr),
m_loc (loc)
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 218bf3a..981bb2d 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10983,6 +10983,25 @@ This target hook returns @code{true} if the target/target-version strings
@var{fn1} and @var{fn2} imply the same function version.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A (tree @var{decl_a}, tree @var{decl_v}, tree @var{base})
+@var{decl_b} is a function declaration with a function multi-versioning
+(FMV) attribute; this attribute is either @code{target} or
+@code{target_version}, depending on @code{TARGET_HAS_FMV_TARGET_ATTRIBUTE}.
+@var{decl_a} is a function declaration that may or may not have an FMV
+attribute.
+
+Return true if we have enough information to determine that the
+requirements of @var{decl_b}'s FMV attribute are met whenever @var{decl_a}
+is executed, given that the target supports all features required by
+function declaration @var{base}.
+
+The default implementation just checks whether @var{decl_a} has the same
+FMV attribute as @var{decl_b}. This is conservatively correct,
+but ports can do better by taking the relationships between architecture
+features into account. For example, on AArch64, @code{sve} is present
+whenever @code{sve2} is present.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee})
This target hook returns @code{false} if the @var{caller} function
cannot inline @var{callee}, based on target specific information. By
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 57653a1..842ea12 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7142,6 +7142,8 @@ with the target specific attributes. The default value is @code{','}.
@hook TARGET_OPTION_SAME_FUNCTION_VERSIONS
+@hook TARGET_OPTION_FUNCTIONS_B_RESOLVABLE_FROM_A
+
@hook TARGET_CAN_INLINE_P
@hook TARGET_UPDATE_IPA_FN_TARGET_INFO
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index fe7a5fe..e8cfee8 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
@@ This would also make life easier when this technology is used
@@ for cross-compilers. */
-/* The entry points in this file are fold, size_int_wide and size_binop.
+/* The entry points in this file are fold, size_int and size_binop.
fold takes a tree as argument and returns a simplified tree.
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 31a19ed..ad537f7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,18 @@
+2025-09-30 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/102241
+ * gfortran.h: Add symbol attribute 'pdt_comp'.
+ * module.cc : Add 'pdt_comp' to 'ab_attribute' and 'attr_bits'.
+ (mio_symbol_attribute): Set 'pdt_comp'.
+ * resolve.cc (resolve_component): If a PDT component is found
+ in a non-PDT type, generate the PDT instance, if necessary, and
+ set the 'pdt_comp' attribute. Fix some whitespace issues.
+ * trans-decl.cc (gfc_get_symbol_decl, gfc_trans_deferred_vars):
+ If 'pdt_comp' set, initialize the PDT components.
+ * trans-stmt.cc (gfc_trans_deallocate): Verify that a typespec
+ parameter list is available for PDT components of ordinary
+ derived types.
+
2025-09-27 Paul Thomas <pault@gcc.gnu.org>
PR fortran/87908
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index a891dc8..f00f0e1 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -4076,6 +4076,8 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym,
/* Start building the new instance of the parameterized type. */
gfc_copy_attr (&instance->attr, &pdt->attr, &pdt->declared_at);
+ if (pdt->attr.use_assoc)
+ instance->module = pdt->module;
instance->attr.pdt_template = 0;
instance->attr.pdt_type = 1;
instance->declared_at = gfc_current_locus;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 74fcd1a..219c4b6 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1033,7 +1033,7 @@ typedef struct
/* These are the attributes required for parameterized derived
types. */
unsigned pdt_kind:1, pdt_len:1, pdt_type:1, pdt_template:1,
- pdt_array:1, pdt_string:1;
+ pdt_array:1, pdt_string:1, pdt_comp:1;
/* This is omp_{out,in,priv,orig} artificial variable in
!$OMP DECLARE REDUCTION. */
diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 3168a60..c489dec 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -2093,7 +2093,7 @@ enum ab_attribute
AB_OACC_DECLARE_COPYIN, AB_OACC_DECLARE_DEVICEPTR,
AB_OACC_DECLARE_DEVICE_RESIDENT, AB_OACC_DECLARE_LINK,
AB_OMP_DECLARE_TARGET_LINK, AB_PDT_KIND, AB_PDT_LEN, AB_PDT_TYPE,
- AB_PDT_TEMPLATE, AB_PDT_ARRAY, AB_PDT_STRING,
+ AB_PDT_COMP, AB_PDT_TEMPLATE, AB_PDT_ARRAY, AB_PDT_STRING,
AB_OACC_ROUTINE_LOP_GANG, AB_OACC_ROUTINE_LOP_WORKER,
AB_OACC_ROUTINE_LOP_VECTOR, AB_OACC_ROUTINE_LOP_SEQ,
AB_OACC_ROUTINE_NOHOST,
@@ -2172,6 +2172,7 @@ static const mstring attr_bits[] =
minit ("PDT_TEMPLATE", AB_PDT_TEMPLATE),
minit ("PDT_ARRAY", AB_PDT_ARRAY),
minit ("PDT_STRING", AB_PDT_STRING),
+ minit ("PDT_COMP", AB_PDT_COMP),
minit ("OACC_ROUTINE_LOP_GANG", AB_OACC_ROUTINE_LOP_GANG),
minit ("OACC_ROUTINE_LOP_WORKER", AB_OACC_ROUTINE_LOP_WORKER),
minit ("OACC_ROUTINE_LOP_VECTOR", AB_OACC_ROUTINE_LOP_VECTOR),
@@ -2404,6 +2405,8 @@ mio_symbol_attribute (symbol_attribute *attr)
MIO_NAME (ab_attribute) (AB_PDT_LEN, attr_bits);
if (attr->pdt_type)
MIO_NAME (ab_attribute) (AB_PDT_TYPE, attr_bits);
+ if (attr->pdt_comp)
+ MIO_NAME (ab_attribute) (AB_PDT_COMP , attr_bits);
if (attr->pdt_template)
MIO_NAME (ab_attribute) (AB_PDT_TEMPLATE, attr_bits);
if (attr->pdt_array)
@@ -2681,6 +2684,9 @@ mio_symbol_attribute (symbol_attribute *attr)
case AB_PDT_TYPE:
attr->pdt_type = 1;
break;
+ case AB_PDT_COMP:
+ attr->pdt_comp = 1;
+ break;
case AB_PDT_TEMPLATE:
attr->pdt_template = 1;
break;
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index daff3b3..00b143c 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -16663,6 +16663,26 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
return false;
}
+ if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.pdt_template
+ && !sym->attr.pdt_type && !sym->attr.pdt_template
+ && !(gfc_get_derived_super_type (sym)
+ && (gfc_get_derived_super_type (sym)->attr.pdt_type
+ || gfc_get_derived_super_type (sym)->attr.pdt_template)))
+ {
+ gfc_actual_arglist *type_spec_list;
+ if (gfc_get_pdt_instance (c->param_list, &c->ts.u.derived,
+ &type_spec_list)
+ != MATCH_YES)
+ return false;
+ gfc_free_actual_arglist (c->param_list);
+ c->param_list = type_spec_list;
+ if (!sym->attr.pdt_type)
+ sym->attr.pdt_comp = 1;
+ }
+ else if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.pdt_type
+ && !sym->attr.pdt_type)
+ sym->attr.pdt_comp = 1;
+
if (c->attr.proc_pointer && c->ts.interface)
{
gfc_symbol *ifc = c->ts.interface;
@@ -16863,16 +16883,16 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
}
if (c->ts.type == BT_CHARACTER && !c->attr.proc_pointer
- && !c->ts.deferred)
+ && !c->ts.deferred)
{
- if (c->ts.u.cl->length == NULL
- || (!resolve_charlen(c->ts.u.cl))
- || !gfc_is_constant_expr (c->ts.u.cl->length))
- {
- gfc_error ("Character length of component %qs needs to "
- "be a constant specification expression at %L",
- c->name,
- c->ts.u.cl->length ? &c->ts.u.cl->length->where : &c->loc);
+ if (c->ts.u.cl->length == NULL
+ || (!resolve_charlen(c->ts.u.cl))
+ || !gfc_is_constant_expr (c->ts.u.cl->length))
+ {
+ gfc_error ("Character length of component %qs needs to "
+ "be a constant specification expression at %L",
+ c->name,
+ c->ts.u.cl->length ? &c->ts.u.cl->length->where : &c->loc);
return false;
}
@@ -16894,8 +16914,8 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
&& !c->attr.pointer && !c->attr.allocatable)
{
gfc_error ("Character component %qs of %qs at %L with deferred "
- "length must be a POINTER or ALLOCATABLE",
- c->name, sym->name, &c->loc);
+ "length must be a POINTER or ALLOCATABLE",
+ c->name, sym->name, &c->loc);
return false;
}
@@ -16910,14 +16930,14 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
sprintf (name, "_%s_length", c->name);
strlen = gfc_find_component (sym, name, true, true, NULL);
if (strlen == NULL)
- {
- if (!gfc_add_component (sym, name, &strlen))
- return false;
- strlen->ts.type = BT_INTEGER;
- strlen->ts.kind = gfc_charlen_int_kind;
- strlen->attr.access = ACCESS_PRIVATE;
- strlen->attr.artificial = 1;
- }
+ {
+ if (!gfc_add_component (sym, name, &strlen))
+ return false;
+ strlen->ts.type = BT_INTEGER;
+ strlen->ts.kind = gfc_charlen_int_kind;
+ strlen->attr.access = ACCESS_PRIVATE;
+ strlen->attr.artificial = 1;
+ }
}
if (c->ts.type == BT_DERIVED
@@ -16927,27 +16947,27 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
&& !c->ts.u.derived->attr.use_assoc
&& !gfc_check_symbol_access (c->ts.u.derived)
&& !gfc_notify_std (GFC_STD_F2003, "the component %qs is a "
- "PRIVATE type and cannot be a component of "
- "%qs, which is PUBLIC at %L", c->name,
- sym->name, &sym->declared_at))
+ "PRIVATE type and cannot be a component of "
+ "%qs, which is PUBLIC at %L", c->name,
+ sym->name, &sym->declared_at))
return false;
if ((sym->attr.sequence || sym->attr.is_bind_c) && c->ts.type == BT_CLASS)
{
gfc_error ("Polymorphic component %s at %L in SEQUENCE or BIND(C) "
- "type %s", c->name, &c->loc, sym->name);
+ "type %s", c->name, &c->loc, sym->name);
return false;
}
if (sym->attr.sequence)
{
if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.sequence == 0)
- {
+ {
gfc_error ("Component %s of SEQUENCE type declared at %L does "
- "not have the SEQUENCE attribute",
- c->ts.u.derived->name, &sym->declared_at);
- return false;
- }
+ "not have the SEQUENCE attribute",
+ c->ts.u.derived->name, &sym->declared_at);
+ return false;
+ }
}
if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.generic)
@@ -16955,7 +16975,7 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
else if (c->ts.type == BT_CLASS && c->attr.class_ok
&& CLASS_DATA (c)->ts.u.derived->attr.generic)
CLASS_DATA (c)->ts.u.derived
- = gfc_find_dt_in_generic (CLASS_DATA (c)->ts.u.derived);
+ = gfc_find_dt_in_generic (CLASS_DATA (c)->ts.u.derived);
/* If an allocatable component derived type is of the same type as
the enclosing derived type, we need a vtable generating so that
@@ -16968,10 +16988,10 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
derived type list; even in formal namespaces, where derived type
pointer components might not have been declared. */
if (c->ts.type == BT_DERIVED
- && c->ts.u.derived
- && c->ts.u.derived->components
- && c->attr.pointer
- && sym != c->ts.u.derived)
+ && c->ts.u.derived
+ && c->ts.u.derived->components
+ && c->attr.pointer
+ && sym != c->ts.u.derived)
add_dt_to_dt_list (c->ts.u.derived);
if (c->as && c->as->type != AS_DEFERRED
@@ -16979,8 +16999,8 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
return false;
if (!gfc_resolve_array_spec (c->as,
- !(c->attr.pointer || c->attr.proc_pointer
- || c->attr.allocatable)))
+ !(c->attr.pointer || c->attr.proc_pointer
+ || c->attr.allocatable)))
return false;
if (c->initializer && !sym->attr.vtype
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 055698b..c31c756 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -1688,6 +1688,11 @@ gfc_get_symbol_decl (gfc_symbol * sym)
&& !(sym->attr.use_assoc || sym->attr.dummy))
gfc_defer_symbol_init (sym);
+ if ((sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.pdt_comp)
+ && gfc_current_ns == sym->ns
+ && !(sym->attr.use_assoc || sym->attr.dummy))
+ gfc_defer_symbol_init (sym);
+
/* Dummy PDT 'len' parameters should be checked when they are explicit. */
if ((sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)
&& (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
@@ -4921,7 +4926,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
if (sym->ts.type == BT_DERIVED
&& sym->ts.u.derived
- && sym->ts.u.derived->attr.pdt_type)
+ && (sym->ts.u.derived->attr.pdt_type || sym->ts.u.derived->attr.pdt_comp))
{
is_pdt_type = true;
gfc_init_block (&tmpblock);
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index f4e6c57..f25335d 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -7922,6 +7922,8 @@ gfc_trans_deallocate (gfc_code *code)
gfc_expr *expr = gfc_copy_expr (al->expr);
bool is_coarray = false, is_coarray_array = false;
int caf_mode = 0;
+ gfc_ref * ref;
+ gfc_actual_arglist * param_list;
gcc_assert (expr->expr_type == EXPR_VARIABLE);
@@ -7937,9 +7939,18 @@ gfc_trans_deallocate (gfc_code *code)
/* Deallocate PDT components that are parameterized. */
tmp = NULL;
+ param_list = expr->param_list;
+ if (!param_list && expr->symtree->n.sym->param_list)
+ param_list = expr->symtree->n.sym->param_list;
+ for (ref = expr->ref; ref; ref = ref->next)
+ if (ref->type == REF_COMPONENT
+ && ref->u.c.component->ts.type == BT_DERIVED
+ && ref->u.c.component->ts.u.derived->attr.pdt_type
+ && ref->u.c.component->param_list)
+ param_list = ref->u.c.component->param_list;
if (expr->ts.type == BT_DERIVED
- && expr->ts.u.derived->attr.pdt_type
- && expr->symtree->n.sym->param_list)
+ && ((expr->ts.u.derived->attr.pdt_type && param_list)
+ || expr->ts.u.derived->attr.pdt_comp))
tmp = gfc_deallocate_pdt_comp (expr->ts.u.derived, se.expr, expr->rank);
else if (expr->ts.type == BT_CLASS
&& CLASS_DATA (expr)->ts.u.derived->attr.pdt_type
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index 01ce548..28802e3 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -105,7 +105,7 @@ bitint_precision_kind (int prec)
bitint_big_endian = info.big_endian;
bitint_extended = info.extended;
if (!large_min_prec
- && GET_MODE_PRECISION (limb_mode) < MAX_FIXED_MODE_SIZE)
+ && GET_MODE_PRECISION (limb_mode) <= MAX_FIXED_MODE_SIZE)
large_min_prec = MAX_FIXED_MODE_SIZE + 1;
if (!limb_prec)
limb_prec = GET_MODE_PRECISION (limb_mode);
@@ -125,9 +125,9 @@ bitint_precision_kind (int prec)
mid_min_prec = prec;
return bitint_prec_middle;
}
- if (large_min_prec && prec <= large_min_prec)
- return bitint_prec_large;
- return bitint_prec_huge;
+ if (huge_min_prec && prec >= huge_min_prec)
+ return bitint_prec_huge;
+ return bitint_prec_large;
}
/* Same for a TYPE. */
diff --git a/gcc/gimple.h b/gcc/gimple.h
index da32651..0356bc5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1545,7 +1545,7 @@ extern size_t const gimple_ops_offset_[];
extern enum gimple_statement_structure_enum const gss_for_code_[];
/* This variable holds the currently expanded gimple statement for purposes
- of comminucating the profile info to the builtin expanders. */
+ of communicating the profile info to the builtin expanders. */
extern gimple *currently_expanding_gimple_stmt;
size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 9009683..9c5aa06 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -1280,7 +1280,8 @@ build_stack_save_restore (gcall **save, gcall **restore)
1, tmp_var);
}
-/* Generate IFN_ASAN_MARK call that poisons shadow of a for DECL variable. */
+/* Generate IFN_ASAN_MARK call that poisons shadow memory of the DECL
+ variable. */
static tree
build_asan_poison_call_expr (tree decl)
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index 9953833..c10d67f 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -1801,7 +1801,7 @@ add_type_duplicate (odr_type val, tree type)
before we can pass them to odr_types_equivalent_p (PR lto/83121). */
if (lto_location_cache::current_cache)
lto_location_cache::current_cache->apply_location_cache ();
- /* As a special case we stream mangles names of integer types so we can see
+ /* As a special case we stream mangled names of integer types so we can see
if they are believed to be same even though they have different
representation. Avoid bogus warning on mismatches in these. */
if (TREE_CODE (type) != INTEGER_TYPE
diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
index 9b74fe2..4878867 100644
--- a/gcc/ipa-param-manipulation.cc
+++ b/gcc/ipa-param-manipulation.cc
@@ -1672,7 +1672,7 @@ ipa_param_body_adjustments
in ADJUSTMENTS. FNDECL designates the new function clone which is being
modified. OLD_FNDECL is the function of which FNDECL is a clone (and which
at the time of invocation still share DECL_ARGUMENTS). ID is the
- copy_body_data structure driving the wholy body copying process. VARS is a
+ copy_body_data structure driving the whole body copying process. VARS is a
pointer to the head of the list of new local variables, TREE_MAP is the map
that drives tree substitution in the cloning process. */
diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc
index d4725ce..e4c0ff5 100644
--- a/gcc/ipa-profile.cc
+++ b/gcc/ipa-profile.cc
@@ -316,7 +316,11 @@ ipa_profile_generate_summary (void)
count = all;
}
speculative_call_target item (
- val, GCOV_COMPUTE_SCALE (count, all));
+ val,
+ profile_count::from_gcov_type (count)
+ .probability_in
+ (profile_count::from_gcov_type (all))
+ .to_reg_br_prob_base ());
csum->speculative_call_targets.safe_push (item);
}
@@ -621,7 +625,7 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data)
return edge != NULL;
}
-/* Return ture if NODE contains hot calls. */
+/* Return true if NODE contains hot calls. */
bool
contains_hot_call_p (struct cgraph_node *node)
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 84d4fb5..bf52ffe 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -130,7 +130,7 @@ struct ipa_cst_ref_desc
/* Linked list of duplicates created when call graph edges are cloned. */
struct ipa_cst_ref_desc *next_duplicate;
/* Number of references in IPA structures, IPA_UNDESCRIBED_USE if the value
- if out of control. */
+ is out of control. */
int refcount;
};
diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc
index cceddff..6b269a1 100644
--- a/gcc/libgdiagnostics.cc
+++ b/gcc/libgdiagnostics.cc
@@ -2481,9 +2481,10 @@ struct spec_context : public diagnostics::output_spec::context
{
public:
spec_context (const char *option_name,
+ const char *unparsed_spec,
diagnostic_manager &affected_mgr,
diagnostic_manager &control_mgr)
- : context (option_name, affected_mgr.get_line_table ()),
+ : context (option_name, unparsed_spec, affected_mgr.get_line_table ()),
m_control_mgr (control_mgr)
{}
@@ -2519,8 +2520,8 @@ diagnostic_manager_add_sink_from_spec (diagnostic_manager *affected_mgr,
FAIL_IF_NULL (spec);
FAIL_IF_NULL (control_mgr);
- spec_context ctxt (option_name, *affected_mgr, *control_mgr);
- auto inner_sink = ctxt.parse_and_make_sink (spec, affected_mgr->get_dc ());
+ spec_context ctxt (option_name, spec, *affected_mgr, *control_mgr);
+ auto inner_sink = ctxt.parse_and_make_sink (affected_mgr->get_dc ());
if (!inner_sink)
return -1;
affected_mgr->get_dc ().add_sink (std::move (inner_sink));
diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc
index e85d7e7..02353d9 100644
--- a/gcc/multiple_target.cc
+++ b/gcc/multiple_target.cc
@@ -423,61 +423,100 @@ expand_target_clones (struct cgraph_node *node, bool definition)
return true;
}
-/* When NODE is a target clone, consider all callees and redirect
- to a clone with equal target attributes. That prevents multiple
- multi-versioning dispatches and a call-chain can be optimized.
-
- This optimisation might pick the wrong version in some cases, since knowing
- that we meet the target requirements for a matching callee version does not
- tell us that we won't also meet the target requirements for a higher
- priority callee version at runtime. Since this is longstanding behaviour
- for x86 and powerpc, we preserve it for those targets, but skip the optimisation
- for targets that use the "target_version" attribute for multi-versioning. */
+/* When NODE is part of an FMV function set, consider all callees and check if
+ any can provably always resolve a certain version and then call that version
+ directly. */
static void
redirect_to_specific_clone (cgraph_node *node)
{
- cgraph_function_version_info *fv = node->function_version ();
- if (fv == NULL)
- return;
-
- gcc_assert (TARGET_HAS_FMV_TARGET_ATTRIBUTE);
- tree attr_target = lookup_attribute ("target", DECL_ATTRIBUTES (node->decl));
- if (attr_target == NULL_TREE)
+ if (!targetm.compare_version_priority || !optimize)
return;
/* We need to remember NEXT_CALLER as it could be modified in the loop. */
for (cgraph_edge *e = node->callees; e ; e = e->next_callee)
{
- cgraph_function_version_info *fv2 = e->callee->function_version ();
- if (!fv2)
+ /* Only if this is a call to a dispatched symbol. */
+ if (!e->callee->dispatcher_function)
continue;
- tree attr_target2 = lookup_attribute ("target",
- DECL_ATTRIBUTES (e->callee->decl));
+ cgraph_function_version_info *callee_v
+ = e->callee->function_version ();
+ cgraph_function_version_info *caller_v
+ = e->caller->function_version ();
+
+ gcc_assert (callee_v);
- /* Function is not calling proper target clone. */
- if (attr_target2 == NULL_TREE
- || !attribute_value_equal (attr_target, attr_target2))
+ /* Find the default nodes for both callee and caller (if present). */
+ cgraph_function_version_info *callee_default_v = callee_v->next;
+ cgraph_function_version_info *caller_default_v = caller_v;
+ if (caller_v)
{
- while (fv2->prev != NULL)
- fv2 = fv2->prev;
+ while (caller_default_v->prev)
+ caller_default_v = caller_default_v->prev;
+ if (!is_function_default_version (caller_default_v->this_node->decl))
+ caller_default_v = NULL;
+ }
+
+ /* If this is not the TU that contains the definition of the default
+ version we are not guaranteed to have visibility of all versions
+ so cannot reason about them. */
+ if (!callee_default_v
+ || !callee_default_v->this_node->binds_to_current_def_p ())
+ continue;
+
+ cgraph_function_version_info *highest_callable_fn = NULL;
+ for (cgraph_function_version_info *ver = callee_v->next;
+ ver;
+ ver = ver->next)
+ if (targetm.target_option.functions_b_resolvable_from_a
+ (node->decl, ver->this_node->decl, node->decl))
+ highest_callable_fn = ver;
- /* Try to find a clone with equal target attribute. */
- for (; fv2 != NULL; fv2 = fv2->next)
+ if (!highest_callable_fn)
+ continue;
+
+ bool inlinable = true;
+
+ /* If there are higher priority versions of callee and caller has no
+ more version information, then not callable. */
+ if (highest_callable_fn->next)
+ {
+ /* If this is not the TU where the callee default is defined then
+ cannot reason about the caller versions. */
+ if (!caller_default_v
+ || !caller_default_v->this_node->binds_to_current_def_p ())
+ continue;
+
+ /* If every higher priority version would imply a higher priority
+ version of caller would have been selected, then this is
+ callable. */
+ for (cgraph_function_version_info *callee_ver
+ = highest_callable_fn->next;
+ callee_ver; callee_ver = callee_ver->next)
{
- cgraph_node *callee = fv2->this_node;
- attr_target2 = lookup_attribute ("target",
- DECL_ATTRIBUTES (callee->decl));
- if (attr_target2 != NULL_TREE
- && attribute_value_equal (attr_target, attr_target2))
+ bool is_possible = true;
+ for (cgraph_function_version_info *caller_ver = caller_v->next;
+ caller_ver; caller_ver = caller_ver->next)
+ if (targetm.target_option.functions_b_resolvable_from_a
+ (callee_ver->this_node->decl, caller_ver->this_node->decl,
+ node->decl))
+ {
+ is_possible = false;
+ break;
+ }
+ if (is_possible)
{
- e->redirect_callee (callee);
- cgraph_edge::redirect_call_stmt_to_callee (e);
+ inlinable = false;
break;
}
}
}
+ if (inlinable)
+ {
+ e->redirect_callee (highest_callable_fn->this_node);
+ cgraph_edge::redirect_call_stmt_to_callee (e);
+ }
}
}
@@ -566,9 +605,8 @@ ipa_target_clone (bool early)
for (unsigned i = 0; i < to_dispatch.length (); i++)
create_dispatcher_calls (to_dispatch[i]);
- if (TARGET_HAS_FMV_TARGET_ATTRIBUTE)
- FOR_EACH_FUNCTION (node)
- redirect_to_specific_clone (node);
+ FOR_EACH_FUNCTION (node)
+ redirect_to_specific_clone (node);
return 0;
}
diff --git a/gcc/opts-diagnostic.cc b/gcc/opts-diagnostic.cc
index 0e0296a..6f459ec 100644
--- a/gcc/opts-diagnostic.cc
+++ b/gcc/opts-diagnostic.cc
@@ -47,12 +47,14 @@ public:
diagnostics::context &dc,
line_maps *location_mgr,
location_t loc,
- const char *option_name)
+ const char *option_name,
+ const char *option_value)
: dc_spec_context (dc,
location_mgr,
location_mgr,
loc,
- option_name),
+ option_name,
+ option_value),
m_opts (opts)
{}
@@ -72,17 +74,17 @@ public:
void
handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts,
diagnostics::context &dc,
- const char *arg,
+ const char *unparsed_spec,
location_t loc)
{
- gcc_assert (arg);
+ gcc_assert (unparsed_spec);
gcc_assert (line_table);
const char *const option_name = "-fdiagnostics-add-output=";
DIAGNOSTICS_LOG_SCOPE_PRINTF2 (dc.get_logger (),
- "handling: %s%s", option_name, arg);
- opt_spec_context ctxt (opts, dc, line_table, loc, option_name);
- auto sink = ctxt.parse_and_make_sink (arg, dc);
+ "handling: %s%s", option_name, unparsed_spec);
+ opt_spec_context ctxt (opts, dc, line_table, loc, option_name, unparsed_spec);
+ auto sink = ctxt.parse_and_make_sink (dc);
if (!sink)
return;
@@ -93,17 +95,17 @@ handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts,
void
handle_OPT_fdiagnostics_set_output_ (const gcc_options &opts,
diagnostics::context &dc,
- const char *arg,
+ const char *unparsed_spec,
location_t loc)
{
- gcc_assert (arg);
+ gcc_assert (unparsed_spec);
gcc_assert (line_table);
const char *const option_name = "-fdiagnostics-set-output=";
DIAGNOSTICS_LOG_SCOPE_PRINTF2 (dc.get_logger (),
- "handling: %s%s", option_name, arg);
- opt_spec_context ctxt (opts, dc, line_table, loc, option_name);
- auto sink = ctxt.parse_and_make_sink (arg, dc);
+ "handling: %s%s", option_name, unparsed_spec);
+ opt_spec_context ctxt (opts, dc, line_table, loc, option_name, unparsed_spec);
+ auto sink = ctxt.parse_and_make_sink (dc);
if (!sink)
return;
diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index adae784..5382fde 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -1532,7 +1532,12 @@ compute_trg_info (int trg)
int tf = prob[trg], cf = prob[i];
/* In CFGs with low probability edges TF can possibly be zero. */
- sp->src_prob = (tf ? GCOV_COMPUTE_SCALE (cf, tf) : 0);
+ sp->src_prob = (tf ?
+ profile_count::from_gcov_type (cf)
+ .probability_in
+ (profile_count::from_gcov_type (tf))
+ .to_reg_br_prob_base ()
+ : 0);
sp->is_valid = (sp->src_prob >= min_spec_prob);
}
diff --git a/gcc/target.def b/gcc/target.def
index b6f95f3..3e58dcf 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -6934,6 +6934,28 @@ DEFHOOK
bool, (string_slice fn1, string_slice fn2),
hook_stringslice_stringslice_unreachable)
+/* Checks if we can be certain that function DECL_A could resolve DECL_B. */
+DEFHOOK
+(functions_b_resolvable_from_a,
+ "@var{decl_b} is a function declaration with a function multi-versioning\n\
+(FMV) attribute; this attribute is either @code{target} or\n\
+@code{target_version}, depending on @code{TARGET_HAS_FMV_TARGET_ATTRIBUTE}.\n\
+@var{decl_a} is a function declaration that may or may not have an FMV\n\
+attribute.\n\
+\n\
+Return true if we have enough information to determine that the\n\
+requirements of @var{decl_b}'s FMV attribute are met whenever @var{decl_a}\n\
+is executed, given that the target supports all features required by\n\
+function declaration @var{base}.\n\
+\n\
+The default implementation just checks whether @var{decl_a} has the same\n\
+FMV attribute as @var{decl_b}. This is conservatively correct,\n\
+but ports can do better by taking the relationships between architecture\n\
+features into account. For example, on AArch64, @code{sve} is present\n\
+whenever @code{sve2} is present.",
+ bool, (tree decl_a, tree decl_v, tree base),
+ functions_b_resolvable_from_a)
+
/* Function to determine if one function can inline another function. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a4c4a17..a7d81ad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,44 @@
+2025-09-30 David Malcolm <dmalcolm@redhat.com>
+
+ * lib/sarif.py: Remove import of ET.
+
+2025-09-30 Alfie Richards <alfie.richards@arm.com>
+
+ * 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.
+
+2025-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/vect/tsvc/vect-tsvc-s1244.c (s1244): Fix comment typo,
+ ture -> true.
+ * gcc.dg/vect/tsvc/vect-tsvc-s2244.c (s2244): Likewise.
+
+2025-09-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/reduce1.adb: New test.
+
+2025-09-30 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/105380
+ PR fortran/102241
+ * gfortran.dg/pdt_49.f03: New test.
+ * gfortran.dg/pdt_11.f03: Deallocate 'o_fdef'.
+ * gfortran.dg/pdt_15.f03: Reinstate final 'pop_8' and update
+ the tree dump counts.
+ * gfortran.dg/pdt_20.f03: Deallocate 'x'.
+ * gfortran.dg/pdt_23.f03: Deallocate 'x'.
+ * gfortran.dg/pdt_3.f03: Eliminate the temporary 'matrix' and
+ use w%d directly in the allocation. Change the TODO comment and
+ comment on memory leak in allocation.
+ * gfortran.dg/pdt_39.f03: Comments on memory leaks.
+ * gfortran.dg/pdt_40.f03: Deallocate 'foo' and bar%x.
+ * gfortran.dg/pdt_50.f03: New test.
+
2025-09-29 YunQiang Su <yunqiang@isrc.iscas.ac.cn>
* gcc.target/mips/pr99217-2.c: New test.
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection1.C b/gcc/testsuite/g++.target/aarch64/fmv-selection1.C
new file mode 100644
index 0000000..4ee5446
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection1.C
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 1;
+}
+
+__attribute__((target_version("rng")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 2;
+}
+
+__attribute__((target_version("flagm")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 3;
+}
+
+__attribute__((target_version("rng+flagm")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 4;
+}
+
+int bar()
+{
+ return foo ();
+}
+
+/* Cannot optimize */
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection2.C b/gcc/testsuite/g++.target/aarch64/fmv-selection2.C
new file mode 100644
index 0000000..f580dac
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection2.C
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a+rng+flagm" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 1;
+}
+
+__attribute__((target_version("rng")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 2;
+}
+
+__attribute__((target_version("flagm")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 3;
+}
+
+__attribute__((target_version("rng+flagm")))
+__attribute__((optimize("O0")))
+int foo ()
+{
+ return 4;
+}
+
+int bar()
+{
+ return foo ();
+}
+
+/* Can optimize to highest priority function */
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\._MrngMflagm\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection3.C b/gcc/testsuite/g++.target/aarch64/fmv-selection3.C
new file mode 100644
index 0000000..6b52fd4
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection3.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{ return 1; }
+
+__attribute__((target_version("rng")))
+int foo ();
+__attribute__((target_version("flagm")))
+int foo ();
+__attribute__((target_version("rng+flagm")))
+int foo ();
+
+__attribute__((target_version("rng+flagm")))
+int bar()
+{
+ return foo ();
+}
+
+/* Cannot optimize */
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\._MrngMflagm\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection4.C b/gcc/testsuite/g++.target/aarch64/fmv-selection4.C
new file mode 100644
index 0000000..155145d
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection4.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{ return 1; }
+
+__attribute__((target_version("rng")))
+int foo ();
+__attribute__((target_version("flagm")))
+int foo ();
+__attribute__((target_version("rng+flagm")))
+int foo ();
+
+__attribute__((target_version("default")))
+int bar()
+{
+ return foo ();
+}
+
+__attribute__((target_version("rng")))
+int bar();
+
+__attribute__((target_version("flagm")))
+int bar();
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\.default\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection5.C b/gcc/testsuite/g++.target/aarch64/fmv-selection5.C
new file mode 100644
index 0000000..4d6d38e
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection5.C
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{ return 1; }
+
+__attribute__((target_version("rng")))
+int foo ();
+__attribute__((target_version("flagm")))
+int foo ();
+__attribute__((target_version("rng+flagm")))
+int foo ();
+
+__attribute__((target_version("default")))
+int bar()
+{
+ return foo ();
+}
+
+__attribute__((target_version("flagm")))
+int bar();
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\.default\n" 0 } } */
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection6.C b/gcc/testsuite/g++.target/aarch64/fmv-selection6.C
new file mode 100644
index 0000000..db384e1
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection6.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a+rng" } */
+
+__attribute__((target_version("default")))
+__attribute__((optimize("O0")))
+int foo ()
+{ return 1; }
+
+__attribute__((target_version("rng")))
+int foo ();
+__attribute__((target_version("flagm")))
+int foo ();
+__attribute__((target_version("rng+flagm")))
+int foo ();
+
+__attribute__((target_version("default")))
+int bar()
+{
+ return foo ();
+}
+
+__attribute__((target_version("flagm")))
+int bar();
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3foov\._Mrng\n" 1 } } */
+
diff --git a/gcc/testsuite/g++.target/aarch64/fmv-selection7.C b/gcc/testsuite/g++.target/aarch64/fmv-selection7.C
new file mode 100644
index 0000000..41e7462
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/fmv-selection7.C
@@ -0,0 +1,65 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2 -march=armv8-a" } */
+
+[[gnu::optimize("O0")]]
+[[gnu::target_version ("default")]]
+int bar () {
+ return 1;
+}
+
+[[gnu::optimize("O0")]]
+[[gnu::target ("+sve2")]]
+[[gnu::target_version ("sve")]]
+int bar ();
+
+[[gnu::target ("+sve")]]
+int foo () {
+ return bar();
+}
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z3barv\._Msve\n" 1 } } */
+
+[[gnu::target_version ("default")]]
+int bar2 () {
+ return 1;
+}
+
+[[gnu::target_version ("sve2")]]
+int bar2 ();
+
+[[gnu::target_version ("default")]]
+int foo2 ();
+
+[[gnu::target_version ("sve")]]
+[[gnu::target ("+sve2")]]
+int foo2 () {
+ return bar2();
+}
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z4bar2v\._Msve2\n" 1 } } */
+
+[[gnu::target_version ("default")]]
+int bar3 () {
+ return 1;
+}
+
+[[gnu::target_version ("sve")]]
+int bar3 ();
+
+[[gnu::target ("+rng")]]
+[[gnu::target_version ("sve2")]]
+int bar3 ();
+
+[[gnu::target_version ("default")]]
+int foo3 ();
+
+[[gnu::target_version ("sve")]]
+int foo3 () {
+ return bar3 ();
+}
+
+[[gnu::target_version ("sve2+rng")]]
+int foo3 ();
+
+/* { dg-final { scan-assembler-times "\n\tb\t_Z4bar3v\n" 1 } } */
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c
index 94a3041..3b76bb3 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c
@@ -9,7 +9,7 @@
real_t s1244(struct args_t * func_args)
{
// node splitting
-// cycle with ture and anti dependency
+// cycle with true and anti dependency
initialise_arrays(__func__);
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c
index 9b0ca74..277ebb8 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c
@@ -9,7 +9,7 @@
real_t s2244(struct args_t * func_args)
{
// node splitting
-// cycle with ture and anti dependency
+// cycle with true and anti dependency
initialise_arrays(__func__);
diff --git a/gcc/testsuite/gfortran.dg/pdt_11.f03 b/gcc/testsuite/gfortran.dg/pdt_11.f03
index 41b506a..3ddbafe 100644
--- a/gcc/testsuite/gfortran.dg/pdt_11.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_11.f03
@@ -47,6 +47,7 @@ program test
write(*,*) 'o_fdef FAIL'
STOP 2
end if
+ deallocate (o_fdef)
end program test
diff --git a/gcc/testsuite/gfortran.dg/pdt_15.f03 b/gcc/testsuite/gfortran.dg/pdt_15.f03
index 4ae1983..17d4d37 100644
--- a/gcc/testsuite/gfortran.dg/pdt_15.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_15.f03
@@ -98,9 +98,9 @@ contains
if (int (pop_8 (root)) .ne. 3) STOP 1
if (int (pop_8 (root)) .ne. 2) STOP 2
if (int (pop_8 (root)) .ne. 1) STOP 3
-! if (int (pop_8 (root)) .ne. 0) STOP 4
+ if (int (pop_8 (root)) .ne. 0) STOP 4
end subroutine
end program ch2701
! { dg-final { scan-tree-dump-times "Pdtlink_8._deallocate " 5 "original" } }
-! { dg-final { scan-tree-dump-times ".n.data = 0B" 8 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_free" 14 "original" } }
+! { dg-final { scan-tree-dump-times ".n.data = 0B" 9 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_free" 15 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pdt_20.f03 b/gcc/testsuite/gfortran.dg/pdt_20.f03
index 3aa9b2e..3c4b5b8 100644
--- a/gcc/testsuite/gfortran.dg/pdt_20.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_20.f03
@@ -17,4 +17,5 @@ program p
if (x%b .ne. 3) STOP 1
if (x%b .ne. size (x%r, 1)) STOP 2
if (x%r%a .ne. 1) STOP 3
+! deallocate (x) ! Segmentation fault: triggered at trans-array.cc:11009.
end
diff --git a/gcc/testsuite/gfortran.dg/pdt_23.f03 b/gcc/testsuite/gfortran.dg/pdt_23.f03
index c0cec9a..dadea11 100644
--- a/gcc/testsuite/gfortran.dg/pdt_23.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_23.f03
@@ -30,4 +30,5 @@ program p
buffer = "lmn"
read (buffer, *) x ! PDT IO was incorrect (PRs 84143/84432).
if (x%c .ne. 'lmn') STOP 5
+! if (allocated (x)) deallocate (x) ! Used to seg fault - invalid memory reference.
end
diff --git a/gcc/testsuite/gfortran.dg/pdt_3.f03 b/gcc/testsuite/gfortran.dg/pdt_3.f03
index 6800768..7359519 100644
--- a/gcc/testsuite/gfortran.dg/pdt_3.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_3.f03
@@ -32,7 +32,6 @@ end module
type (mytype (b=s*2)) :: mat2
end type x
- real, allocatable :: matrix (:,:)
type(thytype(ftype, 4, 4)) :: w
type(x(ftype,ftype,256)) :: q
class(mytype(ftype, :)), allocatable :: cz
@@ -54,10 +53,9 @@ end module
if (size (q%mat2%d) .ne. 4*mat_dim**2) STOP 10
! Now check some basic OOP with PDTs
- matrix = w%d
-! TODO - for some reason, using w%d directly in the source causes a seg fault.
- allocate (cz, source = mytype(ftype, d_dim)( 0, matrix))
+! Using w%d directly in the source used to cause a seg fault.
+ allocate (cz, source = mytype(ftype, d_dim)( 0, w%d)) ! Leaks 64 bytes in 1 block.
select type (cz)
type is (mytype(ftype, *))
if (int (sum (cz%d)) .ne. 136) STOP 11
@@ -76,5 +74,4 @@ end module
end select
deallocate (cz)
- deallocate (matrix)
end
diff --git a/gcc/testsuite/gfortran.dg/pdt_39.f03 b/gcc/testsuite/gfortran.dg/pdt_39.f03
index 7378cf5..7cfd232 100644
--- a/gcc/testsuite/gfortran.dg/pdt_39.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_39.f03
@@ -49,7 +49,7 @@ contains
subroutine geta_r8(a_lhs, t_rhs)
real(r8), allocatable, intent(out) :: a_lhs(:,:)
class(mat_t(k=r8,c=*,r=*)), intent(in) :: t_rhs
- a_lhs = t_rhs%m_a
+ a_lhs = t_rhs%m_a ! Leaks 152 bytes in 2 blocks
return
end subroutine geta_r8
@@ -94,7 +94,7 @@ program p
if (mat_r4%c /= N) stop 2
if (mat_r4%r /= M) stop 3
mat_r4 = reshape( [ (real(i, kind=mat_r4%k), i=1,N*M) ], [ N, M ] )
- a_r4 = mat_r4
+ a_r4 = mat_r4 ! Leaks 24 bytes in 1 block.
if (int (sum (a_r4)) /= 21) stop 4
N = 4
M = 4
diff --git a/gcc/testsuite/gfortran.dg/pdt_40.f03 b/gcc/testsuite/gfortran.dg/pdt_40.f03
index 4853508..673ffde 100644
--- a/gcc/testsuite/gfortran.dg/pdt_40.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_40.f03
@@ -22,4 +22,5 @@
if (bar%x%ell /= parm) stop 1 ! Then these component references failed in
if (bar%x%i /= 2 * parm) stop 2 ! translation.
+ deallocate (foo, bar%x)
end
diff --git a/gcc/testsuite/gfortran.dg/pdt_49.f03 b/gcc/testsuite/gfortran.dg/pdt_49.f03
new file mode 100644
index 0000000..9ddfd14
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_49.f03
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! Check PR105380 has gone away. Used to ICE with, "internal compiler error:
+! tree check: expected array_type, have record_type in ....."
+!
+! Contributed by Martin Liska <marxin@gcc.gnu.org>
+!
+program p
+ type t(n)
+ integer, len :: n
+ end type
+ type t2(m)
+ integer, len :: m
+ type(t(1)) :: a(m)
+ end type
+ type(t2(3)) :: x
+
+ print *, x%m, size (x%a), x%a%n ! Outputs 3 3 1 as expected.
+end
diff --git a/gcc/testsuite/gfortran.dg/pdt_50.f03 b/gcc/testsuite/gfortran.dg/pdt_50.f03
new file mode 100644
index 0000000..9c036e4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_50.f03
@@ -0,0 +1,54 @@
+! { dg-do compile }
+! ! { dg-options "-fdump-tree-original" }
+!
+! Test the fix for PR102241, which caused an ICE in gfc_get_derived_type.
+! The test in comment 4 used to cause a spurious error.
+!
+! Contributed by Roland Wirth <roland_wirth@web.de>
+!
+ MODULE mo
+ TYPE t1(n)
+ INTEGER, LEN :: n
+ INTEGER :: a(n)
+ END TYPE
+
+ TYPE t2
+ TYPE(t1(:)), allocatable :: p_t1
+ END TYPE
+ END MODULE
+
+!---Check test in comment 4 now works---
+ MODULE mo2
+ TYPE u1(n)
+ INTEGER, LEN :: n
+ INTEGER :: a(n)
+ END TYPE
+
+ TYPE u2
+ TYPE(u1(2)), POINTER :: p_u1
+ END TYPE
+
+ CONTAINS
+
+ SUBROUTINE sr
+
+ type(u1(2)), target :: tgt
+ type(u2) :: pt
+
+ tgt = u1(2)([42,84])
+ pt%p_u1 => tgt
+ if (any (pt%p_u1%a /= [42,84])) stop 1
+ END SUBROUTINE
+ END MODULE
+!------
+
+ use mo
+ use mo2
+ type(t2) :: d
+ d%p_t1 = t1(8)([42,43,44,45,42,43,44,45])
+ if (any (d%p_t1%a /= [42,43,44,45,42,43,44,45])) stop 2
+ call sr
+ deallocate (d%p_t1)
+end
+! { dg-final { scan-tree-dump-times "__builtin_malloc" 8 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_free" 9 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pdt_51.f03 b/gcc/testsuite/gfortran.dg/pdt_51.f03
new file mode 100644
index 0000000..46697bf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_51.f03
@@ -0,0 +1,57 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! Test the fix for PR122089 in which the generic interface checking failed.
+!
+! Contributed by Damian Rouson <damian@archaeologic.codes>
+!
+module tensor_m
+ implicit none
+
+ type tensor_t(k)
+ integer, kind :: k = kind(1.)
+ real(k) values_
+ contains
+ generic :: values => double_precision_values
+ procedure double_precision_values
+ end type
+
+contains
+ function double_precision_values(self)
+ class(tensor_t(kind(1D0))) self
+ double precision double_precision_values
+ double_precision_values = self%values_
+ end function
+end module
+
+module input_output_pair_m
+ use tensor_m, only : tensor_t
+ implicit none
+
+ type input_output_pair_t(k)
+ integer, kind :: k = kind(1.)
+ type(tensor_t(k)) inputs_
+ end type
+
+ interface
+ module subroutine double_precision_write_to_stdout(input_output_pairs)
+ implicit none
+ type(input_output_pair_t(kind(1D0))) input_output_pairs
+ end subroutine
+ end interface
+end module
+
+submodule(input_output_pair_m) input_output_pair_s
+ implicit none
+contains
+ module procedure double_precision_write_to_stdout
+ print *, input_output_pairs%inputs_%values()
+ end procedure
+end submodule
+
+ use input_output_pair_m
+ type(input_output_pair_t(kind(1d0))) :: tgt
+ tgt%inputs_%values_ = 42d0
+ call double_precision_write_to_stdout(tgt)
+end
+! { dg-final { scan-tree-dump-times "double_precision_write_to_stdout \\(&tgt\\);" 1 "original" } }
diff --git a/gcc/testsuite/gnat.dg/reduce1.adb b/gcc/testsuite/gnat.dg/reduce1.adb
new file mode 100644
index 0000000..601be4b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/reduce1.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+-- { dg-options "-gnat2022" }
+
+procedure Reduce1 is
+
+ type Arr is array (Positive range <>) of Positive;
+
+ A: Arr := (2, 87);
+
+ B: Positive := A'Reduce (1, Positive'Max); -- { dg-error "no suitable" }
+
+begin
+ null;
+end;
diff --git a/gcc/testsuite/lib/sarif.py b/gcc/testsuite/lib/sarif.py
index d75a87e..f0b3ddd 100644
--- a/gcc/testsuite/lib/sarif.py
+++ b/gcc/testsuite/lib/sarif.py
@@ -1,6 +1,5 @@
import json
import os
-import xml.etree.ElementTree as ET
def sarif_from_env():
# return parsed JSON content a SARIF_PATH file
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index c388344..39aeb16 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -1132,8 +1132,8 @@ assign_discriminators (void)
{
location_t prev_loc = UNKNOWN_LOCATION, prev_replacement = UNKNOWN_LOCATION;
/* Traverse the basic block, if two function calls within a basic block
- are mapped to the same line, assign a new discriminator because a call
- stmt could be a split point of a basic block. */
+ are mapped to the same line, assign a new discriminator because a call
+ stmt could be a split point of a basic block. */
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1149,8 +1149,8 @@ assign_discriminators (void)
prev_replacement = assign_discriminator (loc, bb_id, map);
gimple_set_location (stmt, prev_replacement);
}
- /* Break basic blocks after each call. This is requires so each
- call site has unque discriminator.
+ /* Break basic blocks after each call. This is required so each
+ call site has unique discriminator.
More correctly, we can break after each statement that can possibly
terinate execution of the basic block, but for auto-profile this
precision is probably not useful. */
@@ -1160,16 +1160,27 @@ assign_discriminators (void)
bb_id++;
}
}
- /* IF basic block has multiple sucessors, consdier every edge as a separate
- block. */
+ /* If basic block has multiple sucessors, consdier every edge as a
+ separate block. */
if (!single_succ_p (bb))
bb_id++;
for (edge e : bb->succs)
- if (e->goto_locus != UNKNOWN_LOCATION)
- {
+ {
+ if (e->goto_locus != UNKNOWN_LOCATION)
e->goto_locus = assign_discriminator (e->goto_locus, bb_id, map);
- bb_id++;
- }
+ for (gphi_iterator gpi = gsi_start_phis (bb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
+ {
+ gphi *phi = gpi.phi ();
+ location_t phi_loc
+ = gimple_phi_arg_location_from_edge (phi, e);
+ if (phi_loc == UNKNOWN_LOCATION)
+ continue;
+ gimple_phi_arg_set_location
+ (phi, e->dest_idx, assign_discriminator (phi_loc, bb_id, map));
+ }
+ bb_id++;
+ }
bb_id++;
}
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index e96c89e..0bb3de9 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3444,7 +3444,7 @@ version_loop_for_if_conversion (class loop *loop, vec<gimple *> *preds)
}
initialize_original_copy_tables ();
- /* At this point we invalidate porfile confistency until IFN_LOOP_VECTORIZED
+ /* At this point we invalidate profile consistency until IFN_LOOP_VECTORIZED
is re-merged in the vectorizer. */
new_loop = loop_version (loop, cond, &cond_bb,
profile_probability::always (),
diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 9b028e0..76aac6f 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -4167,7 +4167,7 @@ attr_fnspec::verify ()
}
}
-/* Return ture if TYPE1 and TYPE2 will always give the same answer
+/* Return true if TYPE1 and TYPE2 will always give the same answer
when compared with other types using same_type_for_tbaa. */
static bool
@@ -4191,7 +4191,7 @@ types_equal_for_same_type_for_tbaa_p (tree type1, tree type2,
return TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2);
}
-/* Return ture if TYPE1 and TYPE2 will always give the same answer
+/* Return true if TYPE1 and TYPE2 will always give the same answer
when compared with other types using same_type_for_tbaa. */
bool
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 1836037..1d549e4 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7187,7 +7187,11 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
return false;
/* Do not try to vectorize bit-precision reductions. */
- if (!type_has_mode_precision_p (op.type))
+ if (!VECTOR_BOOLEAN_TYPE_P (vectype_out)
+ && !type_has_mode_precision_p (op.type)
+ && op.code != BIT_AND_EXPR
+ && op.code != BIT_IOR_EXPR
+ && op.code != BIT_XOR_EXPR)
return false;
/* Lane-reducing ops also never can be used in a SLP reduction group
diff --git a/gcc/tree.h b/gcc/tree.h
index b1d1434..4c8ad98 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5960,7 +5960,7 @@ tree_code_for_canonical_type_merging (enum tree_code code)
return code;
}
-/* Return ture if get_alias_set care about TYPE_CANONICAL of given type.
+/* Return true if get_alias_set care about TYPE_CANONICAL of given type.
We don't define the types for pointers, arrays and vectors. The reason is
that pointers are handled specially: ptr_type_node accesses conflict with
accesses to all other pointers. This is done by alias.cc.
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 7e401bb..f9059af 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2025-09-30 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * config/t-softfp: Don't use softfp_wrap for bitint functions.
+ (softfp_cflags): New parameter that is passed to the building of bitint
+ functions.
+
2025-09-25 John David Anglin <danglin@gcc.gnu.org>
* config/pa/sync-libfuncs.c (atomic_store_8): Fix asm.
diff --git a/libgcc/config/t-softfp b/libgcc/config/t-softfp
index b352dfa..c08b681 100644
--- a/libgcc/config/t-softfp
+++ b/libgcc/config/t-softfp
@@ -73,12 +73,15 @@ softfp_bid_list += bitintpow10 \
floatti$(m) floatunti$(m))
endif
+softfp_bitint_func_list := \
+ $(foreach m,sf df,$(softfp_floatbitint_funcs)) \
+ $(bitint_extras)
+
softfp_func_list := \
$(foreach m,$(softfp_float_modes), \
$(softfp_float_funcs) \
$(foreach i,$(softfp_int_modes), \
$(softfp_floatint_funcs))) \
- $(foreach m,sf df,$(softfp_floatbitint_funcs)) \
$(foreach e,$(softfp_extensions),extend$(e)2) \
$(foreach t,$(softfp_truncations),trunc$(t)2) \
$(softfp_extras)
@@ -93,7 +96,8 @@ softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \
endif
ifeq ($(softfp_compat),y)
-softfp_file_list := $(addsuffix .c,$(softfp_func_list))
+softfp_file_list := $(addsuffix .c,$(softfp_func_list)) \
+ $(addsuffix .c,$(softfp_bitint_func_list))
ifeq ($(enable_shared),yes)
softfp_map_dep := libgcc.map.in
@@ -124,6 +128,8 @@ else
softfp_file_list := \
$(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list)))
endif
+softfp_file_list += \
+ $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_bitint_func_list)))
endif
softfp_bid_file_list := \
$(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_bid_list)))
@@ -137,7 +143,7 @@ soft-fp-objects-base = $(basename $(notdir $(softfp_file_list)))
soft-fp-objects = $(addsuffix $(objext), $(soft-fp-objects-base)) \
$(addsuffix _s$(objext), $(soft-fp-objects-base))
-$(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits
+$(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits $(softfp_cflags)
LIB2ADD += $(softfp_file_list)
LIB2ADD_ST += $(softfp_bid_file_list)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b215b3a..0403156 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2025-09-30 François Dumont <frs.dumont@gmail.com>
+
+ * 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.
+
2025-09-27 Jonathan Wakely <jwakely@redhat.com>
* testsuite/20_util/allocator_traits/members/allocate_hint.cc:
diff --git a/libstdc++-v3/include/std/inplace_vector b/libstdc++-v3/include/std/inplace_vector
index 91ceace..7aa6f9d 100644
--- a/libstdc++-v3/include/std/inplace_vector
+++ b/libstdc++-v3/include/std/inplace_vector
@@ -823,6 +823,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::__synth3way);
}
+ // [inplace.vector.special], specialized algorithms
constexpr friend void
swap(inplace_vector& __x, inplace_vector& __y)
noexcept(is_nothrow_swappable_v<_Tp> && is_nothrow_move_constructible_v<_Tp>)
@@ -907,13 +908,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
};
- // [inplace.vector.special], specialized algorithms
- template<typename _Tp, size_t _Nm>
- constexpr void
- swap(inplace_vector<_Tp, _Nm>& __x, inplace_vector<_Tp, _Nm>& __y)
- noexcept(noexcept(__x.swap(__y)))
- { __x.swap(__y); }
-
// specialization for zero capacity, that is required to be trivally copyable
// and empty regardless of _Tp.
template<typename _Tp>
@@ -992,6 +986,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (__il.size() != 0)
__throw_bad_alloc();
+ return *this;
}
template<__any_input_iterator _InputIterator>
diff --git a/libstdc++-v3/testsuite/std/memory/polymorphic/copy.cc b/libstdc++-v3/testsuite/std/memory/polymorphic/copy.cc
index bea05ac..d66cc06 100644
--- a/libstdc++-v3/testsuite/std/memory/polymorphic/copy.cc
+++ b/libstdc++-v3/testsuite/std/memory/polymorphic/copy.cc
@@ -44,14 +44,14 @@ private:
using __gnu_test::tracker_allocator;
using Counter = __gnu_test::tracker_allocator_counter;
-using Polymorhic = std::polymorphic<Base, tracker_allocator<Base>>;
-const Polymorhic src(std::in_place_type<Derived>, 1, 2, 3);
+using Polymorphic = std::polymorphic<Base, tracker_allocator<Base>>;
+const Polymorphic src(std::in_place_type<Derived>, 1, 2, 3);
constexpr void
test_ctor()
{
Counter::reset();
- Polymorhic i1(src);
+ Polymorphic i1(src);
VERIFY( *i1 == *src );
VERIFY( &*i1 != &*src );
VERIFY( Counter::get_allocation_count() >= sizeof(Derived) );
@@ -60,7 +60,7 @@ test_ctor()
VERIFY( Counter::get_destruct_count() == 0 );
Counter::reset();
- Polymorhic i2(std::allocator_arg, {}, src);
+ Polymorphic i2(std::allocator_arg, {}, src);
VERIFY( *i2 == *src );
VERIFY( &*i2 != &*src );
VERIFY( Counter::get_allocation_count() >= sizeof(Derived) );
@@ -73,7 +73,7 @@ constexpr void
test_assign()
{
Counter::reset();
- Polymorhic i1(std::in_place_type<Derived>);
+ Polymorphic i1(std::in_place_type<Derived>);
const size_t holderSize = Counter::get_allocation_count();
VERIFY( holderSize >= sizeof(Derived) );
Counter::reset();
@@ -101,26 +101,26 @@ test_assign()
constexpr void
test_valueless()
{
- Polymorhic e(std::in_place_type<Derived>);
+ Polymorphic e(std::in_place_type<Derived>);
auto(std::move(e));
VERIFY( e.valueless_after_move() );
Counter::reset();
- Polymorhic i1(e);
+ Polymorphic i1(e);
VERIFY( i1.valueless_after_move() );
VERIFY( Counter::get_allocation_count() == 0 );
VERIFY( Counter::get_deallocation_count() == 0 );
VERIFY( Counter::get_construct_count() == 0 );
VERIFY( Counter::get_destruct_count() == 0 );
- Polymorhic i2(std::allocator_arg, {}, e);
+ Polymorphic i2(std::allocator_arg, {}, e);
VERIFY( i2.valueless_after_move() );
VERIFY( Counter::get_allocation_count() == 0 );
VERIFY( Counter::get_deallocation_count() == 0 );
VERIFY( Counter::get_construct_count() == 0 );
VERIFY( Counter::get_destruct_count() == 0 );
- Polymorhic i3(src);
+ Polymorphic i3(src);
Counter::reset();
i3 = e;
VERIFY( i3.valueless_after_move() );