diff options
320 files changed, 12474 insertions, 3786 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6dcf4f3..0eaaf7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,413 @@ +2025-06-14 Georg-Johann Lay <avr@gjlay.de> + + Backported from master: + 2025-06-14 Georg-Johann Lay <avr@gjlay.de> + + PR rtl-optimization/120423 + PR rtl-optimization/116389 + * config/avr/avr.md [-mno-lra]: Add pre-reload split to transform + (left shift of) a paradoxical subreg to a (left shift of) zero-extend. + +2025-06-13 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * cfgexpand.cc (expand_split_edge): New function. + (expand_gimple_cond, construct_init_block): Use it. + +2025-06-13 Spencer Abson <spencer.abson@arm.com> + + PR target/118150 + * config/aarch64/aarch64-sve.md (*one_cmpl<mode>3_cc): New + combiner pattern. + (*one_cmpl<mode>3_ptest): Likewise. + +2025-06-13 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * cfgexpand.cc (construct_init_block): If first_block isn't BB_RTL, + has any PHI nodes and false_edge->dest_idx before redirection is + different from make_single_succ_edge result's dest_idx, swap the + latter with the former last pred edge and their dest_idx members. + +2025-06-13 Kito Cheng <kito.cheng@sifive.com> + + * gcc.cc (driver::set_up_specs): Use gcc_exec_prefix to + read the spec file rather than standard_exec_prefix. + +2025-06-13 H.J. Lu <hjl.tools@gmail.com> + + PR target/120589 + * config/mcore/mcore.cc (mcore_mark_dllimport): Don't use + gen_rtx_MEM. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/120638 + * tree-ssa-math-opts.cc (pass_cse_reciprocals::execute): Call + reset_flow_sensitive_info on arg1. + +2025-06-12 Stafford Horne <shorne@gmail.com> + + PR target/120587 + * config/or1k/or1k.cc (or1k_can_change_mode_class): Allow + changing flags mode from BI to SI to allow for paradoxical + subregs. + +2025-06-12 Uros Bizjak <ubizjak@gmail.com> + + PR target/120604 + * config/i386/i386-expand.cc (ix86_expand_int_movcc): Make sure + we can represent the difference between two 64-bit DImode + immediate values in 64-bit HOST_WIDE_INT. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * cfgexpand.cc (expand_gimple_cond): If dest bb isn't BB_RTL, + has any PHI nodes and false_edge->dest_idx before redirection is + different from make_single_succ_edge result's dest_idx, swap the + latter with the former last pred edge and their dest_idx members. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-v.cc (expand_vx_binary_vec_dup_vec): Add new + case SMAX. + (expand_vx_binary_vec_vec_dup): Ditto. + * config/riscv/riscv.cc (riscv_rtx_costs): Ditto. + * config/riscv/vector-iterators.md: Add new op smax. + +2025-06-12 Richard Sandiford <richard.sandiford@arm.com> + + PR target/120624 + * config/aarch64/aarch64.md (SME_STATE_REGNUM): Expand on comments. + * config/aarch64/aarch64-sme.md (aarch64_restore_za): Also set + SME_STATE_REGNUM + +2025-06-12 Alfie Richards <alfie.richards@arm.com> + + * cgraph.cc (cgraph_node::record_function_versions): Refactor and + rename to... + (cgraph_node::add_function_version): new function. + * cgraph.h (cgraph_node::record_function_versions): Refactor and + rename to... + (cgraph_node::add_function_version): new function. + * config/aarch64/aarch64.cc (aarch64_get_function_versions_dispatcher): + Remove reordering. + * config/i386/i386-features.cc (ix86_get_function_versions_dispatcher): + Remove reordering. + * config/riscv/riscv.cc (riscv_get_function_versions_dispatcher): + Remove reordering. + * config/rs6000/rs6000.cc (rs6000_get_function_versions_dispatcher): + Remove reordering. + +2025-06-12 Alfie Richards <alfie.richards@arm.com> + + * attribs.cc (is_function_default_version): Add target_version logic. + +2025-06-12 Hu, Lin1 <lin1.hu@intel.com> + + * config/i386/x86-tune-sched.cc (ix86_issue_rate): Set 4 for SRF, + 6 for GRR, GNR, CWF, DMR, ARL, PTL. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * diagnostic-format-html.cc: Include "selftest-xml.h". + (html_builder::make_element_for_diagnostic): Move... + (class html_token_printer): ...from local to the function + to the global namespace. + (struct selftest::token_printer_test): New. + (selftest::test_token_printer): New. + (selftest::test_simple_log): Simplify using ASSERT_XML_PRINT_EQ. + (selftest::test_metadata): Likewise. + (selftest::diagnostic_format_html_cc_tests): Run the new test. + * selftest-xml.h: New file. + * xml.cc: Include "selftest-xml.h". + (selftest::assert_xml_print_eq): New. + (selftest::test_no_dtd): Simplify using ASSERT_XML_PRINT_EQ. + (selftest::test_printer): Likewise. + (selftest::test_attribute_ordering): Likewise. + +2025-06-11 Edwin Lu <ewlu@rivosinc.com> + + * config/riscv/riscv.cc (struct riscv_tune_param): Add tune + param. + (riscv_sched_can_speculate_insn): Implement. + (TARGET_SCHED_CAN_SPECULATE_INSN): Ditto. + +2025-06-11 Uros Bizjak <ubizjak@gmail.com> + + PR target/120604 + * config/i386/i386-expand.cc (ix86_expand_int_movcc): Cast operands of + signed 64-bit HOST_WIDE_INT subtractions to (unsigned HOST_WIDE_INT). + +2025-06-11 Paul-Antoine Arras <parras@baylibre.com> + + PR target/119100 + * config/riscv/autovec-opt.md (*<optab>_vf_<mode>): Only handle vfmadd + and vfmsub. + (*vfnmsub_<mode>): New pattern. + (*vfnmadd_<mode>): New pattern. + * config/riscv/riscv.cc (get_vector_binary_rtx_cost): Add cost model for + NEG and VEC_DUPLICATE. + +2025-06-11 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * gimple-range-fold.cc: Include rtl.h. + (fold_using_range::range_of_range_op): Handle bb ending with + GIMPLE_COND during RTL expansion where there is only one succ + edge instead of two. + +2025-06-11 Jakub Jelinek <jakub@redhat.com> + + * internal-fn.cc (expand_POPCOUNT): Use + expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE) instead of + expand_normal (lhs). + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * diagnostic-format-html.cc: Include "diagnostic-path.h" and + "diagnostic-client-data-hooks.h". + (html_builder::m_logical_loc_mgr): New field. + (html_builder::m_cur_nesting_levels): New field. + (html_builder::m_last_logical_location): New field. + (html_builder::m_last_location): New field. + (html_builder::m_last_expanded_location): New field. + (HTML_STYLE): Add "white-space: pre;" to .source and .annotation. + Add "gcc-quoted-text" CSS class. + (html_builder::html_builder): Initialize the new fields. If CSS + is enabled, add CDN links to PatternFly 3 stylesheets. + (html_builder::add_stylesheet): New. + (html_builder::on_report_diagnostic): Add "alert" param to + make_element_for_diagnostic, setting it by default, but unsetting + it for nested diagnostics below the top level. Use + add_at_nesting_level for nested diagnostics. + (add_nesting_level_attr): New. + (html_builder::add_at_nesting_level): New. + (get_pf_class_for_alert_div): New. + (get_pf_class_for_alert_icon): New. + (get_label_for_logical_location_kind): New. + (add_labelled_value): New. + (html_builder::make_element_for_diagnostic): Add leading comment. + Add "alert" param. Drop class="gcc-diagnostic" from <div> tag, + instead adding the class for a PatternFly 3 alert if "alert" is + true, and adding a <span> with an alert icon, both according to + the diagnostic severity. Add a severity prefix to the message for + alerts. Add any metadata/option text as suffixes to the message. + Show any logical location. Show any physical location. Don't + show the locus if the last location is unchanged within the + diagnostic_group. Wrap any execution path element in a + <div id="execution-path"> and add a label to it. Wrap any + generated patch in a <div id="suggested-fix"> and add a label + to it. + (selftest::test_simple_log): Update expected HTML. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + * diagnostic-path-output.cc: Use xml::printer::add_text_from_pp. + * diagnostic-show-locus.cc: Likewise. + * xml-printer.h (xml::printer::add_text_from_pp): New decl. + * xml.cc (xml::node_with_children::add_text_from_pp): New. + (xml::printer::add_text_from_pp): New. + * xml.h (xml::node_with_children::add_text_from_pp): New decl. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/120610 + * diagnostic-format-html.cc (html_builder::html_builder): Update + for new param of xml::printer::pop_tag. + (html_path_label_writer::end_label): Likewise. + (html_builder::make_element_for_diagnostic::html_token_printer): + Give the instance its own xml::printer. Update for new param of + xml::printer::pop_tag. + (html_builder::make_element_for_diagnostic): Give the instance its + own xml::printer. + (html_builder::make_metadata_element): Update for new param of + xml::printer::pop_tag. + (html_builder::flush_to_file): Likewise. + * diagnostic-path-output.cc (begin_html_stack_frame): Likewise. + (begin_html_stack_frame): Likewise. + (end_html_stack_frame): Likewise. + (print_path_summary_as_html): Likewise. + * diagnostic-show-locus.cc + (struct to_text::auto_check_tag_nesting): New. + (struct to_html:: auto_check_tag_nesting): New. + (to_text::pop_html_tag): Change param to const char *. + (to_html::pop_html_tag): Likewise; rename param to + "expected_name". + (default_diagnostic_start_span_fn<to_html>): Update for new param + of xml::printer::pop_tag. + (layout_printer<to_html>::end_label): Likewise. + (layout_printer<Sink>::print_trailing_fixits): Add RAII sentinel + to check tag nesting for the HTML case. Delete stray popping + of "td" in the presence of fix-it hints. + (layout_printer<Sink>::print_line): Add RAII sentinel + to check tag nesting for the HTML case. + (diagnostic_source_print_policy::print_as_html): Likewise. + (layout_printer<Sink>::print): Likewise. + * xml-printer.h (xml::printer::printer): Add optional + "check_popped_tags" param. + (xml::printer::pop_tag): Add "expected_name" param. + (xml::printer::get_num_open_tags): New accessor. + (xml::printer::dump): New decl. + (xml::printer::m_check_popped_tags): New field. + (class xml::auto_check_tag_nesting): New. + (class xml::auto_print_element): Update for new param of pop_tag. + * xml.cc: Move pragma pop so that the pragma also covers + xml::printer's member functions, "dump" in particular. + (xml::printer::printer): Add param "check_popped_tags". + (xml::printer::pop_tag): Add param "expected_name" and use it to assert + that the popped tag is as expected. Assert that we have a tag to + pop. + (xml::printer::dump): New. + (selftest::test_printer): Update for new param of pop_tag. + (selftest::test_attribute_ordering): Likewise. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + * gimple-ssa-warn-access.cc + (pass_waccess::maybe_check_dealloc_call): Add missing + auto_diagnostic_group to nest the "returned from %qD" + note within the warning. + +2025-06-10 Jan Hubicka <hubicka@ucw.cz> + + * cgraph.cc (cgraph_node::make_profile_local): New member function. + (cgraph_node::make_profile_global0): New member function. + (cgraph_node::apply_scale): Do not call adjust_for_ipa_scalling. + (cgraph_node::scale_profile_to): New member function. + * cgraph.h (cgraph_node::make_profile_local, + cgraph_node::make_profile_global0, cgraph_node::scale_profile_to): + Declare. + * ipa-cp.cc (lenient_count_portion_handling): Fix logic dropping count + to local. + (update_counts_for_self_gen_clones): Use scale_profile_to. + (update_profiling_info): Use make_profile_local, make_profile_global0 + and scale_profile_to. + (update_specialized_profile): Likewise. + * ipa-inline-transform.cc (clone_inlined_nodes): Call + adjust_for_ipa_scalling. + +2025-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * expr.cc (expand_expr_real_2) <CASE_CONVERT>: If get_range_pos_neg + at -O2 for scalar integer extension suggests the most significant + bit of op0 is not set, try both unsigned and signed conversion and + choose the cheaper one. If both are the same cost, choose one + based on TYPE_UNSIGNED (TREE_TYPE (treeop0)). + +2025-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * config/i386/i386.md (*bsr_rex64_2): Rename to ... + (*bsr_rex64<u>_2): ... this. Use any_extend instead of sign_extend. + (*bsr_2): Rename to ... + (*bsr<u>_2): ... this. Use any_extend instead of sign_extend. + (bsr splitters after those): Use any_extend instead of sign_extend. + +2025-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * cfgrtl.h (update_bb_for_insn_chain): Declare. + * cfgrtl.cc (update_bb_for_insn_chain): No longer static. + * cfgexpand.h (expand_remove_edge): Declare. + * cfgexpand.cc: Include "gimple-range.h". + (head_end_for_bb): New variable. + (label_rtx_for_bb): Drop ATTRIBUTE_UNUSED from bb argument. + Use head_end_for_bb if possible for non-BB_RTL bbs. + (expand_remove_edge): New function. + (maybe_cleanup_end_of_block): Use it instead of remove_edge. + (expand_gimple_cond): Don't clear EDGE_TRUE_VALUE and + EDGE_FALSE_VALUE just yet. Use head_end_for_bb elts instead + of BB_END and update_bb_for_insn_chain instead of update_bb_for_insn. + (expand_gimple_tailcall): Use expand_remove_edge instead of + remove_edge. Use head_end_for_bb elts instead of BB_END and + update_bb_for_insn_chain instead of update_bb_for_insn. + (expand_gimple_basic_block): Don't change bb to BB_RTL here, instead + use head_end_for_bb elts instead of BB_HEAD and BB_END. Use + update_bb_for_insn_chain instead of update_bb_for_insn. + (pass_expand::execute): Enable ranger before expand_gimple_basic_block + calls and create head_end_for_bb vector. Disable ranger after + those calls, turn still non-BB_RTL blocks into BB_RTL and set their + BB_HEAD and BB_END from head_end_for_bb elts, and clear EDGE_TRUE_VALUE + and EDGE_FALSE_VALUE flags on edges. Release head_end_for_bb + vector. + * tree-outof-ssa.cc (expand_phi_nodes): Don't clear phi nodes here. + * tree.h (get_range_pos_neg): Add gimple * argument defaulted to NULL. + * tree.cc (get_range_pos_neg): Add stmt argument. Use + get_range_query (cfun) instead of get_global_range_query () and pass + stmt as third argument to range_of_expr. + * expr.cc (expand_expr_divmod): Pass currently_expanding_gimple_stmt + to get_range_pos_neg. + (expand_expr_real_1) <case SSA_NAME>: Change internal fn handling + to avoid temporarily overwriting gimple_call_lhs of ifn, instead + temporarily overwrite SSA_NAME_VAR of its lhs. + (maybe_optimize_pow2p_mod_cmp): Pass currently_expanding_gimple_stmt + to get_range_pos_neg. + (maybe_optimize_mod_cmp): Likewise. + * internal-fn.cc (get_min_precision): Likewise. Use + get_range_query (cfun) instead of get_global_range_query () and pass + currently_expanding_gimple_stmt as third argument to range_of_expr. + Pass g to get_range_pos_neg. + (expand_addsub_overflow): Pass currently_expanding_gimple_stmt + to get_range_pos_neg. + (expand_mul_overflow): Likewise. + (expand_arith_overflow): Pass stmt to get_range_pos_neg. + * gimple-range-edge.cc: Include rtl.h. + (gimple_outgoing_range_stmt_p): Return NULL for BB_RTL bbs. + (gimple_outgoing_range::calc_switch_range): If default_edge is NULL, + assert currently_expanding_to_rtl and return before trying to + set range on that edge. + * builtins.cc (expand_builtin_strnlen): Use get_range_query (cfun) + instead of get_global_range_query () and pass + currently_expanding_gimple_stmt as third argument to range_of_expr. + (determine_block_size): Likewise. + * gimple-range.cc (gimple_ranger::range_on_exit): Set s to NULL + instead of last_nondebug_stmt for BB_RTL bbs. + * stmt.cc: Include cfgexpand.h. + (expand_case): Use expand_remove_edge instead of remove_edge. + +2025-06-10 Andrew MacLeod <amacleod@redhat.com> + + * value-range.cc (irange::set_range_from_bitmask): When the bitmask + result is a singleton, check if it is contained in the range. + +2025-06-10 Tobias Burnus <tburnus@baylibre.com> + + * config/gcn/gcn-devices.def: Add gfx942, gfx950 and gfx9-4-generic. + * config/gcn/gcn-opts.h (TARGET_CDNA3, TARGET_CDNA3_PLUS, + TARGET_GLC_NAME, TARGET_TARGET_SC_CACHE): Define. + (TARGET_ARCHITECTED_FLAT_SCRATCH): Use also for CDNA3. + * config/gcn/gcn.h (gcn_isa): Add ISA_CDNA3 to the enum. + * config/gcn/gcn.cc (print_operand): Update 'g' to use + TARGET_GLC_NAME; add 'G' to print TARGET_GLC_NAME unconditionally. + * config/gcn/gcn-valu.md (scatter, gather): Use TARGET_GLC_NAME. + * config/gcn/gcn.md: Use %G<num> instead of glc; use 'buffer_inv sc1' + for TARGET_TARGET_SC_CACHE. + * doc/invoke.texi (march): Add gfx942, gfx950 and gfx9-4-generic. + * doc/install.texi (amdgcn*-*-*): Add gfx942, gfx950 and gfx9-4-generic. + * config/gcn/gcn-tables.opt: Regenerate. + +2025-06-10 Jeff Law <jlaw@ventanamicro.com> + + * config/riscv/riscv.md (lui-constraint<X:mode>and_to_or): Do not use + the RTL template for split code. Emit it directly taking care to avoid + emitting a constant load that needed synthesis. Fix formatting. + +2025-06-10 Kito Cheng <kito.cheng@sifive.com> + + * doc/riscv-ext.texi: Regen. + +2025-06-10 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-v.cc (expand_vx_binary_vec_vec_dup): Add new + case UMOD. + * config/riscv/riscv.cc (riscv_rtx_costs): Ditto. + * config/riscv/vector-iterators.md: Add new op umod. + 2025-06-09 David Malcolm <dmalcolm@redhat.com> * diagnostic-format-sarif.cc (maybe_get_sarif_kind): Update for diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 52988ae..caed742 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250610 +20250615 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3af5b5d..f51e899 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,346 @@ +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Generate + a zero-initialization for the anonymous object of a small aggregate + allocated on the stack. + (inline_status_for_subprog): Minor tweak. + +2025-06-12 Tonu Naks <naks@adacore.com> + + * comperr.adb: update support instructions + * switch.adb: update support instructions + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sinfo.ads: Fix RM reference. + +2025-06-12 Piotr Trojanek <trojanek@adacore.com> + + * sem_ch3.adb (Apply_External_Initialization): Reuse local constant. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * doc/gnat_rm/gnat_language_extensions.rst + (Generalized Finalization): Document the actual implementation. + (No_Raise): Move to separate section. + * gnat_rm.texi: Regenerate. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * libgnat/s-valuer.adb (Scan_Raw_Real): Apply tweak. + +2025-06-12 Tonu Naks <naks@adacore.com> + + * comperr.adb: replace report@ with support@ + * gnatcmd.adb: replace report@ with support@ + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Build_Derived_Private_Type): Fix test. + (Build_Derived_Record_Type): Adjust error recovery paths. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * einfo.ads (Has_Homonym): Fix inaccuracy in description. + * sem_ch8.ads (Find_Direct_Name): Remove obsolete description. + * sem_ch12.adb (Analyze_Associations): Rename I_Node parameter + into N and adjust description. + (Analyze_Subprogram_Instantiation): Add missing description. + (Contains_Instance_Of): Fix description. + (Associations): Rename Generic_Actual_Rec into Actual_Rec and + Gen_Assocs_Rec into Match_Rec. + (Analyze_One_Association): Rename I_Node parameter into N. + (Check_Fixed_Point_Warning): Rename Gen_Assocs parameter into + Match. + (Body of Associations): Minor cleanups and tweaks. + (Analyze_Associations): Rename I_Node parameter into N and + adjust implementation. + (Analyze_One_Association): Likewise. + (Analyze_Package_Instantiation): Remove obsolete code and clean up. + (Check_Fixed_Point_Warning): Rename Gen_Assocs parameter into + Match and adjust implementation. + (Freeze_Package_Instance): Simplify condition. + (Get_Unit_Instantiation_Node): Add support for instantiations of + subprograms and stop the loop properly in case of errors. + * sem_util.ads (Add_Global_Declaration): Rename N parameter into + Decl and fix description. + * sem_util.adb (Add_Global_Declaration): Rename N parameter into + Decl and adjust implementation. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * libgnat/s-valuer.adb (Scan_Raw_Real): Add RM reference. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * libgnat/s-valuer.adb (Scan_Raw_Real): Remove subexpression. Improve + surrounding comments. + +2025-06-12 Bob Duff <duff@adacore.com> + + * vast.adb: Check basic tree properties. + * atree.adb (Traverse_Field): Minor. + * treepr.adb (Destroy): Minor comment. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valuer.adb (Round_Extra): Use multiplicative test. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * einfo-utils.adb (Set_Convention): Remove obsolete test. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Discriminants): Set Ekind earlier. + * sem_util.adb (Enter_Name): Adjust error processing. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valuef.adb (Integer_To_Fixed): Enable overflow checks. + Deal specifically with Val = 2**(Int'Size - 1) if Minus is not set. + Exit the loop when V saturates to 0 in the case of (huge) negative + exponents. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * exp_util.adb (Insert_Actions): Refine test. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler + switches) <-O>: Fix long line. + * gnat_ugn.texi: Regenerate. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * doc/gnat_ugn/building_executable_programs_with_gnat.rst (List of + all switches): Add -gnatRh subswitch. + (Debugging Control): Document -gnatRh subswitch. + * opt.ads (List_Representation_Info_Holes): New boolean variable. + * repinfo.adb: Add with clause for GNAT.Heap_Sort_G. + (List_Common_Type_Info): Relax assertion. + (List_Object_Info): Replace assertion with additional test. + (List_Record_Layout): If -gnatRh is specified, make sure that the + components are ordered by increasing offsets. Output a comment + line giving the number of unused bits if there is a hole between + consecutive components. Streamline the control flow of the loop. + (List_Record_Info): Use the original record type giving the layout + of components, if any, to display the layout of the record. + * switch-c.adb (Scan_Front_End_Switches) <-gnatR>: Add support for + -gnatRh subswitch. + * usage.adb (Usage): Document -gnatRh subswitch. + * gnat_ugn.texi: Regenerate. + +2025-06-12 Johannes Kliemann <kliemann@adacore.com> + + * libgnat/s-secsta.adb (SS_Allocate): Add comment about + conservative alignment padding calculation. + * libgnat/s-secsta__cheri.adb (SS_Allocate): Add comment about + conservative alignment padding calculation. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_warn.adb (Check_References): Rewrite expression + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Constrain_Index, Make_Index, Array_Type_Declaration, + Analyze_Number_Declaration): Remove uses of E_Void. + +2025-06-12 Eric Botcazou <ebotcazou@adacore.com> + + * usage.adb (Usage): Justify the documentation of common switches + like that of other switches. Rework that of the -O switch. + * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler + switches) <-O>: Rework and document 'z' and 'g' operands. + * doc/gnat_ugn/gnat_and_program_execution.rst (Optimization Levels): + Rework and document -Oz and -Og switches. + * gnat_ugn.texi: Regenerate. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Constrain_Index): Avoid unused itypes. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Constrain_Index): Factorize return statement. + +2025-06-12 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Build_Derived_Numeric_Type): Remove duplicate call. + +2025-06-10 Piotr Trojanek <trojanek@adacore.com> + + * gen_il-gen-gen_entities.adb (Formal_Object_Kind): Remove + Entry_Component field. + +2025-06-10 Piotr Trojanek <trojanek@adacore.com> + + * sem_attr.adb (Resolve_Attribute): Remove redundant guard. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * inline.adb (Analyze_Inlined_Bodies): Minor comment tweak. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * inline.adb (Instantiate_Body): Do not call Add_Scope_To_Clean if + the main unit is generic. + (Instantiate_Bodies): Do not deal with generic main units here. + * sem_ch12.adb (Need_Subprogram_Instance_Body): Return false if the + main unit is generic. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * Makefile.rtl (ADA_EXCLUDE_SRCS): Add the 128-bit support files. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Factorize code. + +2025-06-10 Bob Duff <duff@adacore.com> + + * einfo.ads (Associated_Node_For_Itype): Document that + Parent field may be empty. + * vast.adb: Allow empty Parent in Itypes. + +2025-06-10 Gary Dismukes <dismukes@adacore.com> + + * einfo.ads: Revise comment about Dynamic_Predicate flag to make it + more accurate. + * sem_case.adb (Check_Choices): Test "not Has_Static_Predicate_Aspect" + as additional guard for error about use of subtype with nonstatic + predicate as a case choice. Improve related error message. + +2025-06-10 Tonu Naks <naks@adacore.com> + + * libgnat/s-valueu.adb: add explict raise + * libgnat/s-valueu.ads: update annotation + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch6.adb, sem_ch6.ads (Check_Discriminant_Conformance): Move to … + * sem_ch3.adb (Check_Discriminant_Conformance): … here. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * freeze.adb (Freeze_Static_Object): Do not issue any error message + for compiler-generated entities. + +2025-06-10 Bob Duff <duff@adacore.com> + + * vast.adb: Implement two checks. Improve debugging + outputs. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch4.adb (Insert_Conditional_Object_Declaration): Deal with a + transient scope being created around the declaration. + * freeze.adb (Freeze_Entity): Do not call Freeze_Static_Object for + a renaming declaration. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-vafi32.ads: Fix head description. + * libgnat/s-vafi64.ads: Likewise. + * libgnat/s-vafi128.ads: Likewise. + +2025-06-10 Bob Duff <duff@adacore.com> + + * vast.adb: Initial implementation. + * vast.ads: Rename procedure. Remove parameter; body should decide + what to do. + * lib.ads (ipu): Minor: Rewrite comment for brevity, and because + of an inconvenient misspelling. + (Num_Units): Not used; remove. + (Remove_Unit): Minor: Remove "Currently" (which was current a decade + ago from) comment. + * lib.adb (Num_Units): Not used; remove. + * debug_a.adb (Debug_A_Entry): Fix bug: Use Write_Name_For_Debug, + so this won't crash on the Error node. + * debug.adb: Document -gnatd_V and -gnatd_W compiler switches. + * exp_ch6.adb (Validate_Subprogram_Calls): Remove redundant check for + Serious_Errors_Detected. (We turn off code gen when errors are + detected.) + * frontend.adb: Move decisions into VAST body. + * namet.ads (Present): Remove unnecessary overriding; these are + inherited by the derived types. + * namet.adb (Present): Likewise. + +2025-06-10 Gary Dismukes <dismukes@adacore.com> + + * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos + to Entity (Expr) rather than Expr. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Find_Type_Of_Object): Fix comment. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Analyze_Component_Declaration): Rename constant. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Constrain_Array): Simplify. + (Process_Subtype): Adjust. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find + the root type of an aggregate of a derived tagged type. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks. + +2025-06-10 Viljar Indus <indus@adacore.com> + + * sem_prag.adb (Is_Configuration_Pragma): Check that nodes + preceding the pragma are pragma nodes or originally were + pragma nodes. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and + use its value to call Bad_Value on boundary values. + (Scan_Decimal): Adjust call to Integer_to_Decimal. + (Value_Decimal): Likewise. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.ads (Process_Subtype): New formal. + * sem_ch3.adb (Process_Subtype): Likewise. + (Analyze_Subtype_Declaration, Access_Type_Declaration): Use new + formal. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Fix recursive call. + +2025-06-10 Eric Botcazou <ebotcazou@adacore.com> + + * par-ch5.adb (P_Declare_Statement): Rename local variable. + (P_Begin_Statement): Likewise. + +2025-06-10 Piotr Trojanek <trojanek@adacore.com> + + * einfo.ads (Overridden_Operation, Static_Initialization): Remove + comments about a reused entity field. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Tweak formatting. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Add assertion. + +2025-06-10 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Factorize initialization of variable. + 2025-06-09 Gary Dismukes <dismukes@adacore.com> * sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index, diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 3fa55a7..17538de 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -2702,9 +2702,9 @@ package body Atree is -- tail recursive step won't go past the end. declare - Cur_Field : Offset_Array_Index := Traversed_Offset_Array'First; Offsets : Traversed_Offset_Array renames Traversed_Fields (Nkind (Cur_Node)); + Cur_Field : Offset_Array_Index := Traversed_Offset_Array'First; begin if Offsets (Traversed_Offset_Array'First) /= No_Field_Offset then diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb index 180ea94..602b13d 100644 --- a/gcc/ada/comperr.adb +++ b/gcc/ada/comperr.adb @@ -307,16 +307,16 @@ package body Comperr is Write_Str ("| Please submit a bug report by email " & - "to report@adacore.com."); + "to support@adacore.com."); End_Line; Write_Str - ("| GAP members can alternatively use GNAT Tracker:"); + ("| GAP members can alternatively use GNATtracker:"); End_Line; Write_Str - ("| https://www.adacore.com/login?mode=gap " & - "section 'Create New Ticket'."); + ("| https://support.adacore.com/csm " & + "by using the button 'Create A New Case'."); End_Line; Write_Str @@ -326,17 +326,17 @@ package body Comperr is else Write_Str - ("| Please submit a bug report using GNAT Tracker:"); + ("| Please submit a bug report using GNATtracker at"); End_Line; Write_Str - ("| https://www.adacore.com/login " & - "section 'Create New Ticket'."); + ("| https://support.adacore.com/csm " & + "by using the button 'Create New Case'."); End_Line; Write_Str ("| Or submit a bug report by email " & - "to report@adacore.com"); + "to support@adacore.com"); End_Line; Write_Str diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index 1713f56..0a08a83 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -1469,97 +1469,60 @@ that the record type must be a root type, in other words not a derived type. The aspect additionally makes it possible to specify relaxed semantics for the finalization operations by means of the ``Relaxed_Finalization`` setting. - -Example: +Here is the archetypal example: .. code-block:: ada - type Ctrl is record - Id : Natural := 0; + type T is record + ... end record with Finalizable => (Initialize => Initialize, Adjust => Adjust, Finalize => Finalize, Relaxed_Finalization => True); - procedure Adjust (Obj : in out Ctrl); - procedure Finalize (Obj : in out Ctrl); - procedure Initialize (Obj : in out Ctrl); - -The three procedures have the same profile, taking a single ``in out T`` -parameter. + procedure Adjust (Obj : in out T); + procedure Finalize (Obj : in out T); + procedure Initialize (Obj : in out T); -We follow the same dynamic semantics as controlled objects: +The three procedures have the same profile, with a single ``in out`` parameter, +and also have the same dynamic semantics as for controlled types: - ``Initialize`` is called when an object of type ``T`` is declared without - default expression. + initialization expression. - ``Adjust`` is called after an object of type ``T`` is assigned a new value. - ``Finalize`` is called when an object of type ``T`` goes out of scope (for - stack-allocated objects) or is explicitly deallocated (for heap-allocated - objects). It is also called when on the value being replaced in an - assignment. - -However the following differences are enforced by default when compared to the -current Ada controlled-objects finalization model: - -* No automatic finalization of heap allocated objects: ``Finalize`` is only - called when an object is implicitly deallocated. As a consequence, no-runtime - support is needed for the implicit case, and no header will be maintained for - this in heap-allocated controlled objects. - - Heap-allocated objects allocated through a nested access type definition will - hence **not** be deallocated either. The result is simply that memory will be - leaked in those cases. - -* The ``Finalize`` procedure should have have the :ref:`No_Raise_Aspect` specified. - If that's not the case, a compilation error will be raised. - -Additionally, two other configuration aspects are added, -``Legacy_Heap_Finalization`` and ``Exceptions_In_Finalize``: - -* ``Legacy_Heap_Finalization``: Uses the legacy automatic finalization of - heap-allocated objects - -* ``Exceptions_In_Finalize``: Allow users to have a finalizer that raises exceptions - **NB!** note that using this aspect introduces execution time penalities. - -.. _No_Raise_Aspect: - -No_Raise aspect ----------------- + stack-allocated objects) or is deallocated (for heap-allocated objects). + It is also called when the value is replaced by an assignment. -The ``No_Raise`` aspect can be applied to a subprogram to declare that this subprogram is not -expected to raise any exceptions. Should an exception still occur during the execution of -this subprogram, ``Program_Error`` is raised. +However, when ``Relaxed_Finalization`` is either ``True`` or not explicitly +specified, the following differences are implemented relative to the semantics +of controlled types: -New specification for ``Ada.Finalization.Controlled`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* The compiler has permission to perform no automatic finalization of + heap-allocated objects: ``Finalize`` is only called when such an object + is explicitly deallocated, or when the designated object is assigned a new + value. As a consequence, no runtime support is needed for performing + implicit deallocation. In particular, no per-object header data is needed + for heap-allocated objects. -``Ada.Finalization.Controlled`` is now specified as: - -.. code-block:: ada - - type Controlled is abstract tagged null record - with Initialize => Initialize, - Adjust => Adjust, - Finalize => Finalize, - Legacy_Heap_Finalization, Exceptions_In_Finalize; - - procedure Initialize (Self : in out Controlled) is abstract; - procedure Adjust (Self : in out Controlled) is abstract; - procedure Finalize (Self : in out Controlled) is abstract; + Heap-allocated objects allocated through a nested access type will therefore + **not** be deallocated either. The result is simply that memory will be leaked + in this case. +* The ``Adjust`` and ``Finalize`` procedures are automatically considered as + having the :ref:`No_Raise_Aspect` specified for them. In particular, the + compiler has permission to enforce none of the guarantees specified by the + RM 7.6.1 (14/1) and subsequent subclauses. -### Examples - -A simple example of a ref-counted type: +Simple example of ref-counted type: .. code-block:: ada type T is record - Value : Integer; + Value : Integer; Ref_Count : Natural := 0; end record; @@ -1571,8 +1534,8 @@ A simple example of a ref-counted type: type T_Ref is record Value : T_Access; end record - with Adjust => Adjust, - Finalize => Finalize; + with Finalizable => (Adjust => Adjust, + Finalize => Finalize); procedure Adjust (Ref : in out T_Ref) is begin @@ -1584,8 +1547,7 @@ A simple example of a ref-counted type: Def_Ref (Ref.Value); end Finalize; - -A simple file handle that ensures resources are properly released: +Simple file handle that ensures resources are properly released: .. code-block:: ada @@ -1595,51 +1557,47 @@ A simple file handle that ensures resources are properly released: function Open (Path : String) return File; procedure Close (F : in out File); + private type File is limited record Handle : ...; end record - with Finalize => Close; - - -Finalized tagged types -^^^^^^^^^^^^^^^^^^^^^^^ + with Finalizable (Finalize => Close); + end P; -Aspects are inherited by derived types and optionally overriden by those. The -compiler-generated calls to the user-defined operations are then -dispatching whenever it makes sense, i.e. the object in question is of -class-wide type and the class includes at least one finalized tagged type. +Finalizable tagged types +^^^^^^^^^^^^^^^^^^^^^^^^ -However note that for simplicity, it is forbidden to change the value of any of -those new aspects in derived types. +The aspect is inherited by derived types and the primitives may be overridden +by the derivation. The compiler-generated calls to these operations are then +dispatching whenever it makes sense, i.e. when the object in question is of a +class-wide type and the class includes at least one finalizable tagged type. Composite types ^^^^^^^^^^^^^^^ -When a finalized type is used as a component of a composite type, the latter -becomes finalized as well. The three primitives are derived automatically -in order to call the primitives of their components. - -If that composite type was already user-finalized, then the compiler -calls the primitives of the components so as to stay consistent with today's -controlled types's behavior. - -So, ``Initialize`` and ``Adjust`` are called on components before they -are called on the composite object, but ``Finalize`` is called on the composite -object first. +When a finalizable type is used as a component of a composite type, the latter +becomes finalizable as well. The three primitives are derived automatically +in order to call the primitives of their components. The dynamic semantics is +the same as for controlled components of composite types. Interoperability with controlled types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -As a consequence of the redefinition of the ``Controlled`` type as a base type -with the new aspects defined, interoperability with controlled type naturally -follows the definition of the above rules. In particular: +Finalizable types are fully interoperable with controlled types, in particular +it is possible for a finalizable type to have a controlled component and vice +versa, but the stricter dynamic semantics, in other words that of controlled +types, is applied in this case. -* It is possible to have a new finalized type have a controlled type - component -* It is possible to have a controlled type have a finalized type - component +.. _No_Raise_Aspect: + +No_Raise aspect +---------------- +The ``No_Raise`` aspect can be applied to a subprogram to declare that this +subprogram is not expected to raise an exception. Should an exception still +be raised during the execution of the subprogram, it is caught at the end of +this execution and ``Program_Error`` is propagated to the caller. Inference of Dependent Types in Generic Instantiations ------------------------------------------------------ diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index 4f46fba..b99eba7 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -2112,7 +2112,7 @@ Alphabetical List of All Switches .. index:: -gnatR (gcc) -:switch:`-gnatR[0|1|2|3|4][e][j][m][s]` +:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]` Output representation information for declared types, objects and subprograms. Note that this switch is not allowed if a previous :switch:`-gnatD` switch has been given, since these two switches @@ -2259,15 +2259,16 @@ Alphabetical List of All Switches ======= ================================================================== *n* Effect ------- ------------------------------------------------------------------ - *0* No optimization, the default setting if no :switch:`-O` appears - *1* Normal optimization, the default if you specify :switch:`-O` without an - operand. A good compromise between code quality and compilation - time. - *2* Extensive optimization, may improve execution time, possibly at + *0* No optimization, the default setting if no :switch:`-O` appears. + *1* Moderate optimization, same as :switch:`-O` without an operand. + A good compromise between code quality and compilation time. + *2* Extensive optimization, should improve execution time, possibly at the cost of substantially increased compilation time. - *3* Same as :switch:`-O2`, and also includes inline expansion for small - subprograms in the same unit. - *s* Optimize space usage + *3* Full optimization, may further improve execution time, possibly at + the cost of substantially larger generated code. + *s* Optimize for size (code and data) rather than speed. + *z* Optimize aggressively for size (code and data) rather than speed. + *g* Optimize for debugging experience rather than speed. ======= ================================================================== See also :ref:`Optimization_Levels`. @@ -6088,7 +6089,7 @@ Debugging Control .. index:: -gnatR (gcc) -:switch:`-gnatR[0|1|2|3|4][e][j][m][s]` +:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]` This switch controls output from the compiler of a listing showing representation information for declared types, objects and subprograms. For :switch:`-gnatR0`, no information is output (equivalent to omitting @@ -6116,17 +6117,21 @@ Debugging Control extended representation information for record sub-components of records is included. + If the switch is followed by a ``h`` (e.g. :switch:`-gnatR3h`), then + the components of records are sorted by increasing offsets and holes + between consecutive components are flagged. + If the switch is followed by an ``m`` (e.g. :switch:`-gnatRm`), then subprogram conventions and parameter passing mechanisms for all the subprograms are included. - If the switch is followed by a ``j`` (e.g., :switch:`-gnatRj`), then + If the switch is followed by a ``j`` (e.g. :switch:`-gnatRj`), then the output is in the JSON data interchange format specified by the ECMA-404 standard. The semantic description of this JSON output is available in the specification of the Repinfo unit present in the compiler sources. - If the switch is followed by an ``s`` (e.g., :switch:`-gnatR3s`), then + If the switch is followed by an ``s`` (e.g. :switch:`-gnatR3s`), then the output is to a file with the name :file:`file.rep` where ``file`` is the name of the corresponding source file, except if ``j`` is also specified, in which case the file name is :file:`file.json`. diff --git a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst index 756bc74..4ecb3cf 100644 --- a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst +++ b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst @@ -1584,18 +1584,16 @@ Turning on optimization makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. -If you use multiple :switch:`-O` switches, with or without level -numbers, the last such switch is the one that's used. - -You can use the -:switch:`-O` switch (the permitted forms are :switch:`-O0`, :switch:`-O1` -:switch:`-O2`, :switch:`-O3`, and :switch:`-Os`) -to ``gcc`` to control the optimization level: +You can pass the :switch:`-O` switch, with or without an operand +(the permitted forms with an operand are :switch:`-O0`, :switch:`-O1`, +:switch:`-O2`, :switch:`-O3`, :switch:`-Os`, :switch:`-Oz`, and +:switch:`-Og`) to ``gcc`` to control the optimization level. If you +pass multiple :switch:`-O` switches, with or without an operand, +the last such switch is the one that's used: * :switch:`-O0` - No optimization (the default); - generates unoptimized code but has + No optimization (the default); generates unoptimized code but has the fastest compilation time. Debugging is easiest with this switch. Note that many other compilers do substantial optimization even if @@ -1606,32 +1604,45 @@ to ``gcc`` to control the optimization level: mind when doing performance comparisons. * :switch:`-O1` - Moderate optimization; optimizes reasonably well but does not - degrade compilation time significantly. You may not be able to see - some variables in the debugger and changing the value of some - variables in the debugger may not have the effect you desire. + Moderate optimization (same as :switch:`-O` without an operand); + optimizes reasonably well but does not degrade compilation time + significantly. You may not be able to see some variables in the + debugger, and changing the value of some variables in the debugger + may not have the effect you desire. * :switch:`-O2` - Full optimization; - generates highly optimized code and has - the slowest compilation time. You may see significant impacts on + Extensive optimization; generates highly optimized code but has + an increased compilation time. You may see significant impacts on your ability to display and modify variables in the debugger. * :switch:`-O3` - Full optimization as in :switch:`-O2`; - also uses more aggressive automatic inlining of subprograms within a unit - (:ref:`Inlining_of_Subprograms`) and attempts to vectorize loops. - + Full optimization; attempts more sophisticated transformations, in + particular on loops, possibly at the cost of larger generated code. + You may be hardly able to use the debugger at this optimization level. * :switch:`-Os` - Optimize space usage (code and data) of resulting program. + Optimize for size (code and data) of resulting binary rather than + speed; based on the :switch:`-O2` optimization level, but disables + some of its transformations that often increase code size, as well + as performs further optimizations designed to reduce code size. + +* :switch:`-Oz` + Optimize aggressively for size (code and data) of resulting binary + rather than speed; may increase the number of instructions executed + if these instructions require fewer bytes to be encoded. + +* :switch:`-Og` + Optimize for debugging experience rather than speed; based on the + :switch:`-O1` optimization level, but attempts to eliminate all the + negative effects of optimization on debugging. + Higher optimization levels perform more global transformations on the program and apply more expensive analysis algorithms in order to generate faster and more compact code. The price in compilation time, and the -resulting improvement in execution time, -both depend on the particular application and the hardware environment. -You should experiment to find the best level for your application. +resulting improvement in execution time, both depend on the particular +application and the hardware environment. You should experiment to find +the best level for your application. Since the precise set of optimizations done at each level will vary from release to release (and sometime from target to target), it is best to think diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index 15f5b99..91d273c 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -2639,14 +2639,7 @@ package body Einfo.Utils is -- anonymous protected types, since protected types always have the -- default convention. - if Present (Etype (E)) - and then (Is_Object (E) - - -- Allow E_Void (happens for pragma Convention appearing - -- in the middle of a record applying to a component) - - or else Ekind (E) = E_Void) - then + if Present (Etype (E)) and then Is_Object (E) then declare Typ : constant Entity_Id := Etype (E); diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 495a193..d8958d6 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1689,7 +1689,7 @@ package Einfo is -- -- Has_Homonym -- Defined in all entities. Set if an entity has a homonym in the same --- scope. Used by the backend to generate unique names for all entities. +-- scope. Used by Exp_Dbug to generate unique names for all entities. -- Has_Implicit_Dereference -- Defined in types and discriminants. Set if the type has an aspect diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 8ac1b90..45eb808 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -8228,19 +8228,31 @@ package body Exp_Util is return; end if; - -- the expansion of Task and protected type declarations can + -- The expansion of task and protected type declarations can -- create declarations for temporaries which, like other actions - -- are inserted and analyzed before the current declaraation. - -- However, the current scope is the synchronized type, and - -- for unnesting it is critical that the proper scope for these - -- generated entities be the enclosing one. + -- are inserted and analyzed before the current declaration. + -- However, in some cases, the current scope is the synchronized + -- type, and for unnesting it is critical that the proper scope + -- for these generated entities be the enclosing one. when N_Task_Type_Declaration | N_Protected_Type_Declaration => - Push_Scope (Scope (Current_Scope)); - Insert_List_Before_And_Analyze (P, Ins_Actions); - Pop_Scope; + declare + Skip_Scope : constant Boolean := + Ekind (Current_Scope) in Concurrent_Kind; + begin + if Skip_Scope then + Push_Scope (Scope (Current_Scope)); + end if; + + Insert_List_Before_And_Analyze (P, Ins_Actions); + + if Skip_Scope then + Pop_Scope; + end if; + end; + return; -- A special case, N_Raise_xxx_Error can act either as a statement diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 1694b4e..972607a 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -1228,6 +1228,24 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnu_expr = gnat_build_constructor (gnu_type, v); } + /* If we are allocating the anonymous object of a small aggregate on + the stack, zero-initialize it so that the entire object is assigned + and the subsequent assignments need not preserve unknown bits, but + do it only when optimization is enabled for the sake of consistency + with the gimplifier which does the same for CONSTRUCTORs. */ + else if (definition + && !imported_p + && !static_flag + && !gnu_expr + && TREE_CODE (gnu_type) == RECORD_TYPE + && TREE_CODE (gnu_object_size) == INTEGER_CST + && compare_tree_int (gnu_object_size, MAX_FIXED_MODE_SIZE) <= 0 + && Present (Related_Expression (gnat_entity)) + && Nkind (Original_Node (Related_Expression (gnat_entity))) + == N_Aggregate + && optimize) + gnu_expr = build_constructor (gnu_type, NULL); + /* Convert the expression to the type of the object if need be. */ if (gnu_expr && initial_value_needs_conversion (gnu_type, gnu_expr)) gnu_expr = convert (gnu_type, gnu_expr); @@ -5251,7 +5269,7 @@ inline_status_for_subprog (Entity_Id subprog) && Is_Record_Type (Etype (First_Formal (subprog))) && (gnu_type = gnat_to_gnu_type (Etype (First_Formal (subprog)))) && !TYPE_IS_BY_REFERENCE_P (gnu_type) - && tree_fits_uhwi_p (TYPE_SIZE (gnu_type)) + && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST && compare_tree_int (TYPE_SIZE (gnu_type), MAX_FIXED_MODE_SIZE) <= 0) return is_prescribed; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index f44260b..0ae1a24 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -942,10 +942,9 @@ Simpler Accessibility Model * Subprogram parameters:: * Function results:: -No_Raise aspect +Generalized Finalization -* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled. -* Finalized tagged types:: +* Finalizable tagged types:: * Composite types:: * Interoperability with controlled types:: @@ -30939,27 +30938,24 @@ that the record type must be a root type, in other words not a derived type. The aspect additionally makes it possible to specify relaxed semantics for the finalization operations by means of the @code{Relaxed_Finalization} setting. - -Example: +Here is the archetypal example: @example -type Ctrl is record - Id : Natural := 0; +type T is record + ... end record with Finalizable => (Initialize => Initialize, Adjust => Adjust, Finalize => Finalize, Relaxed_Finalization => True); -procedure Adjust (Obj : in out Ctrl); -procedure Finalize (Obj : in out Ctrl); -procedure Initialize (Obj : in out Ctrl); +procedure Adjust (Obj : in out T); +procedure Finalize (Obj : in out T); +procedure Initialize (Obj : in out T); @end example -The three procedures have the same profile, taking a single @code{in out T} -parameter. - -We follow the same dynamic semantics as controlled objects: +The three procedures have the same profile, with a single @code{in out} parameter, +and also have the same dynamic semantics as for controlled types: @quotation @@ -30968,98 +30964,49 @@ We follow the same dynamic semantics as controlled objects: @item @code{Initialize} is called when an object of type @code{T} is declared without -default expression. +initialization expression. @item @code{Adjust} is called after an object of type @code{T} is assigned a new value. @item @code{Finalize} is called when an object of type @code{T} goes out of scope (for -stack-allocated objects) or is explicitly deallocated (for heap-allocated -objects). It is also called when on the value being replaced in an -assignment. +stack-allocated objects) or is deallocated (for heap-allocated objects). +It is also called when the value is replaced by an assignment. @end itemize @end quotation -However the following differences are enforced by default when compared to the -current Ada controlled-objects finalization model: +However, when @code{Relaxed_Finalization} is either @code{True} or not explicitly +specified, the following differences are implemented relative to the semantics +of controlled types: @itemize * @item -No automatic finalization of heap allocated objects: @code{Finalize} is only -called when an object is implicitly deallocated. As a consequence, no-runtime -support is needed for the implicit case, and no header will be maintained for -this in heap-allocated controlled objects. +The compiler has permission to perform no automatic finalization of +heap-allocated objects: @code{Finalize} is only called when such an object +is explicitly deallocated, or when the designated object is assigned a new +value. As a consequence, no runtime support is needed for performing +implicit deallocation. In particular, no per-object header data is needed +for heap-allocated objects. -Heap-allocated objects allocated through a nested access type definition will -hence `not' be deallocated either. The result is simply that memory will be -leaked in those cases. +Heap-allocated objects allocated through a nested access type will therefore +`not' be deallocated either. The result is simply that memory will be leaked +in this case. @item -The @code{Finalize} procedure should have have the @ref{466,,No_Raise aspect} specified. -If that’s not the case, a compilation error will be raised. +The @code{Adjust} and @code{Finalize} procedures are automatically considered as +having the @ref{466,,No_Raise aspect} specified for them. In particular, the +compiler has permission to enforce none of the guarantees specified by the +RM 7.6.1 (14/1) and subsequent subclauses. @end itemize -Additionally, two other configuration aspects are added, -@code{Legacy_Heap_Finalization} and @code{Exceptions_In_Finalize}: - - -@itemize * - -@item -@code{Legacy_Heap_Finalization}: Uses the legacy automatic finalization of -heap-allocated objects - -@item -@code{Exceptions_In_Finalize}: Allow users to have a finalizer that raises exceptions -`NB!' note that using this aspect introduces execution time penalities. -@end itemize - -@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions id3}@anchor{467}@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{466} -@subsection No_Raise aspect - - -The @code{No_Raise} aspect can be applied to a subprogram to declare that this subprogram is not -expected to raise any exceptions. Should an exception still occur during the execution of -this subprogram, @code{Program_Error} is raised. - -@menu -* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled. -* Finalized tagged types:: -* Composite types:: -* Interoperability with controlled types:: - -@end menu - -@node New specification for Ada Finalization Controlled,Finalized tagged types,,No_Raise aspect -@anchor{gnat_rm/gnat_language_extensions new-specification-for-ada-finalization-controlled}@anchor{468} -@subsubsection New specification for @code{Ada.Finalization.Controlled} - - -@code{Ada.Finalization.Controlled} is now specified as: - -@example -type Controlled is abstract tagged null record - with Initialize => Initialize, - Adjust => Adjust, - Finalize => Finalize, - Legacy_Heap_Finalization, Exceptions_In_Finalize; - - procedure Initialize (Self : in out Controlled) is abstract; - procedure Adjust (Self : in out Controlled) is abstract; - procedure Finalize (Self : in out Controlled) is abstract; -@end example - -### Examples - -A simple example of a ref-counted type: +Simple example of ref-counted type: @example type T is record - Value : Integer; + Value : Integer; Ref_Count : Natural := 0; end record; @@ -31071,8 +31018,8 @@ type T_Access is access all T; type T_Ref is record Value : T_Access; end record - with Adjust => Adjust, - Finalize => Finalize; + with Finalizable => (Adjust => Adjust, + Finalize => Finalize); procedure Adjust (Ref : in out T_Ref) is begin @@ -31085,7 +31032,7 @@ begin end Finalize; @end example -A simple file handle that ensures resources are properly released: +Simple file handle that ensures resources are properly released: @example package P is @@ -31094,66 +31041,64 @@ package P is function Open (Path : String) return File; procedure Close (F : in out File); + private type File is limited record Handle : ...; end record - with Finalize => Close; + with Finalizable (Finalize => Close); +end P; @end example -@node Finalized tagged types,Composite types,New specification for Ada Finalization Controlled,No_Raise aspect -@anchor{gnat_rm/gnat_language_extensions finalized-tagged-types}@anchor{469} -@subsubsection Finalized tagged types - +@menu +* Finalizable tagged types:: +* Composite types:: +* Interoperability with controlled types:: -Aspects are inherited by derived types and optionally overriden by those. The -compiler-generated calls to the user-defined operations are then -dispatching whenever it makes sense, i.e. the object in question is of -class-wide type and the class includes at least one finalized tagged type. +@end menu -However note that for simplicity, it is forbidden to change the value of any of -those new aspects in derived types. +@node Finalizable tagged types,Composite types,,Generalized Finalization +@anchor{gnat_rm/gnat_language_extensions finalizable-tagged-types}@anchor{467} +@subsubsection Finalizable tagged types -@node Composite types,Interoperability with controlled types,Finalized tagged types,No_Raise aspect -@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{46a} -@subsubsection Composite types +The aspect is inherited by derived types and the primitives may be overridden +by the derivation. The compiler-generated calls to these operations are then +dispatching whenever it makes sense, i.e. when the object in question is of a +class-wide type and the class includes at least one finalizable tagged type. -When a finalized type is used as a component of a composite type, the latter -becomes finalized as well. The three primitives are derived automatically -in order to call the primitives of their components. +@node Composite types,Interoperability with controlled types,Finalizable tagged types,Generalized Finalization +@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{468} +@subsubsection Composite types -If that composite type was already user-finalized, then the compiler -calls the primitives of the components so as to stay consistent with today’s -controlled types’s behavior. -So, @code{Initialize} and @code{Adjust} are called on components before they -are called on the composite object, but @code{Finalize} is called on the composite -object first. +When a finalizable type is used as a component of a composite type, the latter +becomes finalizable as well. The three primitives are derived automatically +in order to call the primitives of their components. The dynamic semantics is +the same as for controlled components of composite types. -@node Interoperability with controlled types,,Composite types,No_Raise aspect -@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{46b} +@node Interoperability with controlled types,,Composite types,Generalized Finalization +@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{469} @subsubsection Interoperability with controlled types -As a consequence of the redefinition of the @code{Controlled} type as a base type -with the new aspects defined, interoperability with controlled type naturally -follows the definition of the above rules. In particular: - +Finalizable types are fully interoperable with controlled types, in particular +it is possible for a finalizable type to have a controlled component and vice +versa, but the stricter dynamic semantics, in other words that of controlled +types, is applied in this case. -@itemize * +@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions +@anchor{gnat_rm/gnat_language_extensions id3}@anchor{46a}@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{466} +@subsection No_Raise aspect -@item -It is possible to have a new finalized type have a controlled type -component -@item -It is possible to have a controlled type have a finalized type -component -@end itemize +The @code{No_Raise} aspect can be applied to a subprogram to declare that this +subprogram is not expected to raise an exception. Should an exception still +be raised during the execution of the subprogram, it is caught at the end of +this execution and @code{Program_Error} is propagated to the caller. @node Inference of Dependent Types in Generic Instantiations,External_Initialization Aspect,No_Raise aspect,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{46c} +@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{46b} @subsection Inference of Dependent Types in Generic Instantiations @@ -31230,7 +31175,7 @@ package Int_Array_Operations is new Array_Operations @end example @node External_Initialization Aspect,Finally construct,Inference of Dependent Types in Generic Instantiations,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{46d} +@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{46c} @subsection External_Initialization Aspect @@ -31271,7 +31216,7 @@ The maximum size of loaded files is limited to 2@w{^31} bytes. @end cartouche @node Finally construct,,External_Initialization Aspect,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46e} +@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46d} @subsection Finally construct @@ -31288,7 +31233,7 @@ This feature is similar to the one with the same name in other languages such as @end menu @node Syntax<2>,Legality Rules<2>,,Finally construct -@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46f} +@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46e} @subsubsection Syntax @@ -31303,7 +31248,7 @@ handled_sequence_of_statements ::= @end example @node Legality Rules<2>,Dynamic Semantics<2>,Syntax<2>,Finally construct -@anchor{gnat_rm/gnat_language_extensions id5}@anchor{470} +@anchor{gnat_rm/gnat_language_extensions id5}@anchor{46f} @subsubsection Legality Rules @@ -31313,7 +31258,7 @@ to be transferred outside the finally part are forbidden. Goto & exit where the target is outside of the finally’s @code{sequence_of_statements} are forbidden @node Dynamic Semantics<2>,,Legality Rules<2>,Finally construct -@anchor{gnat_rm/gnat_language_extensions id6}@anchor{471} +@anchor{gnat_rm/gnat_language_extensions id6}@anchor{470} @subsubsection Dynamic Semantics @@ -31328,7 +31273,7 @@ execution, that is the finally block must be executed in full even if the contai aborted, or if the control is transferred out of the block. @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top -@anchor{gnat_rm/security_hardening_features doc}@anchor{472}@anchor{gnat_rm/security_hardening_features id1}@anchor{473}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} +@anchor{gnat_rm/security_hardening_features doc}@anchor{471}@anchor{gnat_rm/security_hardening_features id1}@anchor{472}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} @chapter Security Hardening Features @@ -31350,7 +31295,7 @@ change. @end menu @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features -@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{474} +@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{473} @section Register Scrubbing @@ -31386,7 +31331,7 @@ programming languages, see @cite{Using the GNU Compiler Collection (GCC)}. @c Stack Scrubbing: @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{475} +@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{474} @section Stack Scrubbing @@ -31530,7 +31475,7 @@ Bar_Callable_Ptr. @c Hardened Conditionals: @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{476} +@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{475} @section Hardened Conditionals @@ -31620,7 +31565,7 @@ be used with other programming languages supported by GCC. @c Hardened Booleans: @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{477} +@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{476} @section Hardened Booleans @@ -31681,7 +31626,7 @@ and more details on that attribute, see @cite{Using the GNU Compiler Collection @c Control Flow Redundancy: @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features -@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{478} +@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{477} @section Control Flow Redundancy @@ -31849,7 +31794,7 @@ see @cite{Using the GNU Compiler Collection (GCC)}. These options can be used with other programming languages supported by GCC. @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top -@anchor{gnat_rm/obsolescent_features doc}@anchor{479}@anchor{gnat_rm/obsolescent_features id1}@anchor{47a}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} +@anchor{gnat_rm/obsolescent_features doc}@anchor{478}@anchor{gnat_rm/obsolescent_features id1}@anchor{479}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} @chapter Obsolescent Features @@ -31868,7 +31813,7 @@ compatibility purposes. @end menu @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id2}@anchor{47b}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{47c} +@anchor{gnat_rm/obsolescent_features id2}@anchor{47a}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{47b} @section pragma No_Run_Time @@ -31881,7 +31826,7 @@ preferred usage is to use an appropriately configured run-time that includes just those features that are to be made accessible. @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id3}@anchor{47d}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47e} +@anchor{gnat_rm/obsolescent_features id3}@anchor{47c}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47d} @section pragma Ravenscar @@ -31890,7 +31835,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma is part of the new Ada 2005 standard. @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id4}@anchor{47f}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{480} +@anchor{gnat_rm/obsolescent_features id4}@anchor{47e}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{47f} @section pragma Restricted_Run_Time @@ -31900,7 +31845,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for this kind of implementation dependent addition. @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id5}@anchor{481}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{482} +@anchor{gnat_rm/obsolescent_features id5}@anchor{480}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{481} @section pragma Task_Info @@ -31926,7 +31871,7 @@ in the spec of package System.Task_Info in the runtime library. @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features -@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{483}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{484} +@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{482}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{483} @section package System.Task_Info (@code{s-tasinf.ads}) @@ -31936,7 +31881,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package standard replacement for GNAT’s @code{Task_Info} functionality. @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top -@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{486} +@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{484}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{485} @chapter Compatibility and Porting Guide @@ -31958,7 +31903,7 @@ applications developed in other Ada environments. @end menu @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{488} +@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{486}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{487} @section Writing Portable Fixed-Point Declarations @@ -32080,7 +32025,7 @@ If you follow this scheme you will be guaranteed that your fixed-point types will be portable. @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{489}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{48a} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{488}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{489} @section Compatibility with Ada 83 @@ -32108,7 +32053,7 @@ following subsections treat the most likely issues to be encountered. @end menu @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{48b}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{48c} +@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{48a}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{48b} @subsection Legal Ada 83 programs that are illegal in Ada 95 @@ -32208,7 +32153,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration. @end itemize @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{48d}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48e} +@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{48c}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48d} @subsection More deterministic semantics @@ -32236,7 +32181,7 @@ which open select branches are executed. @end itemize @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48f}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{490} +@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48e}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{48f} @subsection Changed semantics @@ -32278,7 +32223,7 @@ covers only the restricted range. @end itemize @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{491}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{492} +@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{490}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{491} @subsection Other language compatibility issues @@ -32311,7 +32256,7 @@ include @code{pragma Interface} and the floating point type attributes @end itemize @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{493}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{494} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{492}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{493} @section Compatibility between Ada 95 and Ada 2005 @@ -32383,7 +32328,7 @@ can declare a function returning a value from an anonymous access type. @end itemize @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{495}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{496} +@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{494}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{495} @section Implementation-dependent characteristics @@ -32406,7 +32351,7 @@ transition from certain Ada 83 compilers. @end menu @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{497}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{498} +@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{496}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{497} @subsection Implementation-defined pragmas @@ -32428,7 +32373,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not relevant in a GNAT context and hence are not otherwise implemented. @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{499}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{49a} +@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{498}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{499} @subsection Implementation-defined attributes @@ -32442,7 +32387,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and @code{Type_Class}. @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{49b}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{49c} +@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{49a}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{49b} @subsection Libraries @@ -32471,7 +32416,7 @@ be preferable to retrofit the application using modular types. @end itemize @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{49d}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49e} +@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{49c}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49d} @subsection Elaboration order @@ -32507,7 +32452,7 @@ pragmas either globally (as an effect of the `-gnatE' switch) or locally @end itemize @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49f}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{4a0} +@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49e}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{49f} @subsection Target-specific aspects @@ -32520,10 +32465,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus Ada 2005 and Ada 2012) are sometimes incompatible with typical Ada 83 compiler practices regarding implicit packing, the meaning of the Size attribute, and the size of access values. -GNAT’s approach to these issues is described in @ref{4a1,,Representation Clauses}. +GNAT’s approach to these issues is described in @ref{4a0,,Representation Clauses}. @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{4a2}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{4a3} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{4a1}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{4a2} @section Compatibility with Other Ada Systems @@ -32566,7 +32511,7 @@ far beyond this minimal set, as described in the next section. @end itemize @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a4}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{4a1} +@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a3}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{4a0} @section Representation Clauses @@ -32659,7 +32604,7 @@ with thin pointers. @end itemize @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a5}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a6} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a4}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a5} @section Compatibility with HP Ada 83 @@ -32689,7 +32634,7 @@ extension of package System. @end itemize @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top -@anchor{share/gnu_free_documentation_license doc}@anchor{4a7}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a8} +@anchor{share/gnu_free_documentation_license doc}@anchor{4a6}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a7} @chapter GNU Free Documentation License diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 0a3cdb5..639708b 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -9850,7 +9850,7 @@ Treat pragma Restrictions as Restriction_Warnings. @table @asis -@item @code{-gnatR[0|1|2|3|4][e][j][m][s]} +@item @code{-gnatR[0|1|2|3|4][e][h][m][j][s]} Output representation information for declared types, objects and subprograms. Note that this switch is not allowed if a previous @@ -10076,7 +10076,7 @@ Library (RTL) ALI files. @code{n} controls the optimization level: -@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item `n' @@ -10091,7 +10091,7 @@ Effect @tab -No optimization, the default setting if no @code{-O} appears +No optimization, the default setting if no @code{-O} appears. @item @@ -10099,9 +10099,8 @@ No optimization, the default setting if no @code{-O} appears @tab -Normal optimization, the default if you specify @code{-O} without an -operand. A good compromise between code quality and compilation -time. +Moderate optimization, same as @code{-O} without an operand. +A good compromise between code quality and compilation time. @item @@ -10109,7 +10108,7 @@ time. @tab -Extensive optimization, may improve execution time, possibly at +Extensive optimization, should improve execution time, possibly at the cost of substantially increased compilation time. @item @@ -10118,8 +10117,8 @@ the cost of substantially increased compilation time. @tab -Same as @code{-O2}, and also includes inline expansion for small -subprograms in the same unit. +Full optimization, may further improve execution time, possibly at +the cost of substantially larger generated code. @item @@ -10127,7 +10126,23 @@ subprograms in the same unit. @tab -Optimize space usage +Optimize for size (code and data) rather than speed. + +@item + +`z' + +@tab + +Optimize aggressively for size (code and data) rather than speed. + +@item + +`g' + +@tab + +Optimize for debugging experience rather than speed. @end multitable @@ -15270,7 +15285,7 @@ restriction warnings rather than restrictions. @table @asis -@item @code{-gnatR[0|1|2|3|4][e][j][m][s]} +@item @code{-gnatR[0|1|2|3|4][e][h][m][j][s]} This switch controls output from the compiler of a listing showing representation information for declared types, objects and subprograms. @@ -15299,17 +15314,21 @@ If the switch is followed by an @code{e} (e.g. @code{-gnatR2e}), then extended representation information for record sub-components of records is included. +If the switch is followed by a @code{h} (e.g. @code{-gnatR3h}), then +the components of records are sorted by increasing offsets and holes +between consecutive components are flagged. + If the switch is followed by an @code{m} (e.g. @code{-gnatRm}), then subprogram conventions and parameter passing mechanisms for all the subprograms are included. -If the switch is followed by a @code{j} (e.g., @code{-gnatRj}), then +If the switch is followed by a @code{j} (e.g. @code{-gnatRj}), then the output is in the JSON data interchange format specified by the ECMA-404 standard. The semantic description of this JSON output is available in the specification of the Repinfo unit present in the compiler sources. -If the switch is followed by an @code{s} (e.g., @code{-gnatR3s}), then +If the switch is followed by an @code{s} (e.g. @code{-gnatR3s}), then the output is to a file with the name @code{file.rep} where @code{file} is the name of the corresponding source file, except if @code{j} is also specified, in which case the file name is @code{file.json}. @@ -20281,13 +20300,12 @@ Turning on optimization makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. -If you use multiple @code{-O} switches, with or without level -numbers, the last such switch is the one that’s used. - -You can use the -@code{-O} switch (the permitted forms are @code{-O0}, @code{-O1} -@code{-O2}, @code{-O3}, and @code{-Os}) -to @code{gcc} to control the optimization level: +You can pass the @code{-O} switch, with or without an operand +(the permitted forms with an operand are @code{-O0}, @code{-O1}, +@code{-O2}, @code{-O3}, @code{-Os}, @code{-Oz}, and +@code{-Og}) to @code{gcc} to control the optimization level. If you +pass multiple @code{-O} switches, with or without an operand, +the last such switch is the one that’s used: @itemize * @@ -20298,8 +20316,7 @@ to @code{gcc} to control the optimization level: @item @code{-O0} -No optimization (the default); -generates unoptimized code but has +No optimization (the default); generates unoptimized code but has the fastest compilation time. Debugging is easiest with this switch. Note that many other compilers do substantial optimization even if @@ -20316,10 +20333,11 @@ mind when doing performance comparisons. @item @code{-O1} -Moderate optimization; optimizes reasonably well but does not -degrade compilation time significantly. You may not be able to see -some variables in the debugger and changing the value of some -variables in the debugger may not have the effect you desire. +Moderate optimization (same as @code{-O} without an operand); +optimizes reasonably well but does not degrade compilation time +significantly. You may not be able to see some variables in the +debugger, and changing the value of some variables in the debugger +may not have the effect you desire. @end table @item @@ -20328,9 +20346,8 @@ variables in the debugger may not have the effect you desire. @item @code{-O2} -Full optimization; -generates highly optimized code and has -the slowest compilation time. You may see significant impacts on +Extensive optimization; generates highly optimized code but has +an increased compilation time. You may see significant impacts on your ability to display and modify variables in the debugger. @end table @@ -20340,9 +20357,9 @@ your ability to display and modify variables in the debugger. @item @code{-O3} -Full optimization as in @code{-O2}; -also uses more aggressive automatic inlining of subprograms within a unit -(@ref{104,,Inlining of Subprograms}) and attempts to vectorize loops. +Full optimization; attempts more sophisticated transformations, in +particular on loops, possibly at the cost of larger generated code. +You may be hardly able to use the debugger at this optimization level. @end table @item @@ -20351,16 +20368,41 @@ also uses more aggressive automatic inlining of subprograms within a unit @item @code{-Os} -Optimize space usage (code and data) of resulting program. +Optimize for size (code and data) of resulting binary rather than +speed; based on the @code{-O2} optimization level, but disables +some of its transformations that often increase code size, as well +as performs further optimizations designed to reduce code size. +@end table + +@item + +@table @asis + +@item @code{-Oz} + +Optimize aggressively for size (code and data) of resulting binary +rather than speed; may increase the number of instructions executed +if these instructions require fewer bytes to be encoded. +@end table + +@item + +@table @asis + +@item @code{-Og} + +Optimize for debugging experience rather than speed; based on the +@code{-O1} optimization level, but attempts to eliminate all the +negative effects of optimization on debugging. @end table @end itemize Higher optimization levels perform more global transformations on the program and apply more expensive analysis algorithms in order to generate faster and more compact code. The price in compilation time, and the -resulting improvement in execution time, -both depend on the particular application and the hardware environment. -You should experiment to find the best level for your application. +resulting improvement in execution time, both depend on the particular +application and the hardware environment. You should experiment to find +the best level for your application. Since the precise set of optimizations done at each level will vary from release to release (and sometime from target to target), it is best to think diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 546dbca..5e3802e 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -368,7 +368,7 @@ begin -- --help flag. Set_Standard_Output; Write_Eol; - Write_Line ("Report bugs to report@adacore.com"); + Write_Line ("Report bugs to support@adacore.com"); return; end if; diff --git a/gcc/ada/libgnat/s-secsta.adb b/gcc/ada/libgnat/s-secsta.adb index 2749658..9d78b86 100644 --- a/gcc/ada/libgnat/s-secsta.adb +++ b/gcc/ada/libgnat/s-secsta.adb @@ -633,6 +633,15 @@ package body System.Secondary_Stack is if Over_Aligning then Padding := Alignment; + + -- Typically the padding would be + -- Alignment - (Addr mod Alignment) + -- however Addr in this case is not known yet. It depends on the + -- type of the secondary stack (Dynamic/Static). The allocation + -- routine for the respective type of stack requires to know the + -- allocation size before the address is known. To ensure a + -- sufficient allocation size to fit the padding, the padding is + -- calculated conservatively. end if; -- Round the requested size (plus the needed padding in case of diff --git a/gcc/ada/libgnat/s-secsta__cheri.adb b/gcc/ada/libgnat/s-secsta__cheri.adb index a24b50e..9a65ed28 100644 --- a/gcc/ada/libgnat/s-secsta__cheri.adb +++ b/gcc/ada/libgnat/s-secsta__cheri.adb @@ -662,6 +662,15 @@ package body System.Secondary_Stack is if Over_Aligning then Over_Align_Padding := Alignment; + + -- Typically the padding would be + -- Alignment - (Addr mod Alignment) + -- however Addr in this case is not known yet. It depends on the + -- type of the secondary stack (Dynamic/Static). The allocation + -- routine for the respective type of stack requires to know the + -- allocation size before the address is known. To ensure a + -- sufficient allocation size to fit the padding, the padding is + -- calculated conservatively. end if; -- It should not be possible to request an allocation of negative diff --git a/gcc/ada/libgnat/s-valuef.adb b/gcc/ada/libgnat/s-valuef.adb index 9930740..7baa3b3 100644 --- a/gcc/ada/libgnat/s-valuef.adb +++ b/gcc/ada/libgnat/s-valuef.adb @@ -156,6 +156,9 @@ package body System.Value_F is pragma Assert (Num < 0 and then Den < 0); -- Accept only negative numbers to allow -2**(Int'Size - 1) + pragma Unsuppress (Overflow_Check); + -- Use overflow check to catch bad values + function Safe_Expont (Base : Int; Exp : in out Natural; @@ -224,38 +227,52 @@ package body System.Value_F is B : constant Int := Int (Base); - V : Uns := Val; - E : Uns := Uns (Extra); + V : Uns := Val; + S : Integer := ScaleB; + E : Uns := Uns (Extra); Y, Z, Q1, R1, Q2, R2 : Int; begin + -- The implementation of Value_R uses fully symmetric arithmetics + -- but here we cannot handle 2**(Int'Size - 1) if Minus is not set. + + if V = 2**(Int'Size - 1) and then not Minus then + E := V rem Uns (B); + V := V / Uns (B); + S := S + 1; + end if; + -- We will use a scaled divide operation for which we must control the -- magnitude of operands so that an overflow exception is not unduly -- raised during the computation. The only real concern is the exponent. - -- If ScaleB is too negative, then drop trailing digits, but preserve - -- the last dropped digit. + -- If S is too negative, then drop trailing digits, but preserve the + -- last dropped digit, until V saturates to 0. - if ScaleB < 0 then + if S < 0 then declare - LS : Integer := -ScaleB; + LS : Integer := -S; begin Y := Den; Z := Safe_Expont (B, LS, Num); for J in 1 .. LS loop + if V = 0 then + E := 0; + exit; + end if; E := V rem Uns (B); V := V / Uns (B); end loop; end; - -- If ScaleB is too positive, then scale V up, which may then overflow + -- If S is too positive, then scale V up, which may then overflow - elsif ScaleB > 0 then + elsif S > 0 then declare - LS : Integer := ScaleB; + LS : Integer := S; begin Y := Safe_Expont (B, LS, Den); @@ -271,7 +288,7 @@ package body System.Value_F is end loop; end; - -- If ScaleB is zero, then proceed directly + -- If S is zero, then proceed directly else Y := Den; diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb index 6f557e9..cc1f778 100644 --- a/gcc/ada/libgnat/s-valuer.adb +++ b/gcc/ada/libgnat/s-valuer.adb @@ -135,7 +135,9 @@ package body System.Value_R is B : constant Uns := Uns (Base); begin - if Digit >= Base / 2 then + -- Beware that Base may be odd + + if 2 * Unsigned (Digit) >= Base then -- If Extra is maximum, round Value @@ -578,8 +580,8 @@ package body System.Value_R is if Str (Index) in '0' .. '9' then After_Point := False; - -- If this is a digit it can indicates either the float decimal - -- part or the base to use. + -- If this is a digit it can indicate either the integral part or the + -- base to use. Scan_Integral_Digits (Str, Index, Max, Base, False, Value, Scale, N, @@ -602,7 +604,8 @@ package body System.Value_R is Bad_Value (Str); end if; - -- Check if the first number encountered is a base + -- Check if the first number encountered is a base. ':' is allowed in + -- place of '#' in virtue of RM J.2 (3). pragma Assert (Index >= Str'First); @@ -611,7 +614,13 @@ package body System.Value_R is then Base_Char := Str (Index); - if N = 1 and then Value (1) in 2 .. 16 then + -- Functionally, "(Parts = 1 or else N = 1)" in the condition of the + -- following if statement could replaced by the simpler "N = 1". The + -- reason we use a more complicated expression is to accommodate + -- machine-code-based coverage tools: the simple version makes it + -- impossible to fully cover generic instances of System.Value_R with + -- Parts = 1. + if (Parts = 1 or else N = 1) and then Value (1) in 2 .. 16 then Base := Unsigned (Value (1)); else Base_Violation := True; @@ -630,10 +639,10 @@ package body System.Value_R is end if; end if; - -- Scan the integral part if still necessary + -- Scan the integral part if there was a base and no point right after if Base_Char /= ASCII.NUL and then not After_Point then - if Index > Max or else As_Digit (Str (Index)) not in Valid_Digit then + if As_Digit (Str (Index)) not in Valid_Digit then Bad_Value (Str); end if; diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index cbe4701..e595b08 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -943,6 +943,21 @@ package Opt is -- WARNING: There is a matching C declaration of this variable in fe.h + List_Representation_Info_Extended : Boolean := False; + -- GNAT + -- Set true by -gnatRe switch. Causes extended information for record types + -- to be included in the representation output information. + + List_Representation_Info_Holes : Boolean := False; + -- GNAT + -- Set true by -gnatRh switch. Causes information for holes between record + -- components to be included in the representation output information. + + List_Representation_Info_Mechanisms : Boolean := False; + -- GNAT + -- Set true by -gnatRm switch. Causes information on mechanisms to be + -- included in the representation output information. + List_Representation_Info_To_File : Boolean := False; -- GNAT -- Set true by -gnatRs switch. Causes information from -gnatR[1-4]m to be @@ -955,16 +970,6 @@ package Opt is -- Set true by -gnatRj switch. Causes information from -gnatR[1-4]m to be -- output in the JSON data interchange format. - List_Representation_Info_Mechanisms : Boolean := False; - -- GNAT - -- Set true by -gnatRm switch. Causes information on mechanisms to be - -- included in the representation output information. - - List_Representation_Info_Extended : Boolean := False; - -- GNAT - -- Set true by -gnatRe switch. Causes extended information for record types - -- to be included in the representation output information. - List_Preprocessing_Symbols : Boolean := False; -- GNAT, GNATPREP -- Set to True if symbols for preprocessing a source are to be listed diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index a6dff7c..ddbb58e 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -30,6 +30,7 @@ with Debug; use Debug; with Einfo; use Einfo; with Einfo.Entities; use Einfo.Entities; with Einfo.Utils; use Einfo.Utils; +with GNAT.Heap_Sort_G; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; @@ -413,9 +414,9 @@ package body Repinfo is Write_Line (";"); end if; - -- Alignment is not always set for task, protected, and class-wide - -- types, or when doing semantic analysis only. Representation aspects - -- are not computed for types in a generic unit. + -- Alignment is not always set for concurrent types, class-wide types, + -- cloned subtypes, or when doing semantic analysis only. Representation + -- aspects are not computed for types declared in a generic unit. else -- Add unknown alignment entry in JSON format to ensure the format is @@ -426,11 +427,13 @@ package body Repinfo is Write_Unknown_Val; end if; - pragma Assert - (not Expander_Active or else - Is_Concurrent_Type (Ent) or else - Is_Class_Wide_Type (Ent) or else - Sem_Util.In_Generic_Scope (Ent)); + pragma Assert (not Expander_Active + or else Is_Concurrent_Type (Ent) + or else Is_Class_Wide_Type (Ent) + or else (Ekind (Ent) = E_Record_Subtype + and then Present (Cloned_Subtype (Ent)) + and then Has_Delayed_Freeze (Cloned_Subtype (Ent))) + or else Sem_Util.In_Generic_Scope (Ent)); end if; end List_Common_Type_Info; @@ -856,8 +859,7 @@ package body Repinfo is -- generic unit, or if the back end is not being run), don't try to -- print them. - pragma Assert (Known_Esize (Ent) = Known_Alignment (Ent)); - if not Known_Alignment (Ent) then + if not Known_Esize (Ent) or else not Known_Alignment (Ent) then return; end if; @@ -882,6 +884,7 @@ package body Repinfo is Write_Eol; Write_Line ("}"); + else Write_Str ("for "); List_Name (Ent); @@ -1223,11 +1226,135 @@ package body Repinfo is Starting_First_Bit : Uint := Uint_0; Prefix : String := "") is - Comp : Entity_Id; - First : Boolean := True; + function First_Comp_Or_Discr (Ent : Entity_Id) return Entity_Id; + -- Like First_Component_Or_Discriminant, but reorder the components + -- according to their bit offset if need be. + + ------------------------- + -- First_Comp_Or_Discr -- + ------------------------- + + function First_Comp_Or_Discr (Ent : Entity_Id) return Entity_Id is + + function Is_Placed_Before (C1, C2 : Entity_Id) return Boolean; + -- Return True if component C1 is placed before component C2 + + ---------------------- + -- Is_Placed_Before -- + ---------------------- + + function Is_Placed_Before (C1, C2 : Entity_Id) return Boolean is + begin + return Known_Static_Component_Bit_Offset (C1) + and then Known_Static_Component_Bit_Offset (C2) + and then + Component_Bit_Offset (C1) < Component_Bit_Offset (C2); + end Is_Placed_Before; + + -- Local variables + + Comp : Entity_Id; + N_Comp : Natural := 0; + Prev : Entity_Id; + Reorder : Boolean := False; + + -- Start of processing for First_Comp_Or_Discr + + begin + -- Reordering is needed only for -gnatRh + + if not List_Representation_Info_Holes then + return First_Component_Or_Discriminant (Ent); + end if; + + -- Count the number of components and whether reordering is needed + + Comp := First_Component_Or_Discriminant (Ent); + Prev := Comp; + + while Present (Comp) loop + N_Comp := N_Comp + 1; + + if not Reorder then + Reorder := Is_Placed_Before (Comp, Prev); + end if; + + Prev := Comp; + Next_Component_Or_Discriminant (Comp); + end loop; + + -- Reorder the components, if need be, by directly reshuffling the + -- list of entities between First_Entity and Last_Entity, which is + -- safe because we are invoked after compilation is finished. + + if Reorder then + declare + Comps : array (Natural range 0 .. N_Comp) of Entity_Id; + -- Support array for the heapsort + + function Lt (Op1, Op2 : Natural) return Boolean is + (Is_Placed_Before (Comps (Op1), Comps (Op2))); + -- Compare function for the heapsort + + procedure Move (From : Natural; To : Natural); + pragma Inline (Move); + -- Move procedure for the heapsort + + ---------- + -- Move -- + ---------- + + procedure Move (From : Natural; To : Natural) is + begin + Comps (To) := Comps (From); + end Move; + + package HS is new GNAT.Heap_Sort_G (Lt => Lt, Move => Move); + -- The heapsort for record components + + begin + -- Pack the components into the array + + N_Comp := 0; + Comp := First_Component_Or_Discriminant (Ent); + + while Present (Comp) loop + N_Comp := N_Comp + 1; + Comps (N_Comp) := Comp; + + Next_Component_Or_Discriminant (Comp); + end loop; + + -- Sort the array + + HS.Sort (N_Comp); + + -- Unpack the component into the list of entities + + Set_First_Entity (Ent, Comps (1)); + Set_Prev_Entity (Comps (1), Empty); + for J in 1 .. N_Comp - 1 loop + Set_Next_Entity (Comps (J), Comps (J + 1)); + Set_Prev_Entity (Comps (J + 1), Comps (J)); + end loop; + Set_Next_Entity (Comps (N_Comp), Empty); + Set_Last_Entity (Ent, Comps (N_Comp)); + end; + end if; + + return First_Component_Or_Discriminant (Ent); + end First_Comp_Or_Discr; + + -- Local variables + + Bit_Offset : Uint := Uint_0; + Comp : Entity_Id; + First : Boolean := True; + + -- Start of processing for List_Record_Layout begin - Comp := First_Component_Or_Discriminant (Ent); + Comp := First_Comp_Or_Discr (Ent); while Present (Comp) loop -- Skip a completely hidden discriminant or a discriminant in an @@ -1237,69 +1364,98 @@ package body Repinfo is and then (Is_Completely_Hidden (Comp) or else Is_Unchecked_Union (Ent)) then - goto Continue; - end if; + null; -- Skip _Parent component in extension (to avoid overlap) - if Chars (Comp) = Name_uParent then - goto Continue; - end if; + elsif Chars (Comp) = Name_uParent then + null; -- All other cases - declare - Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp)); - Npos : constant Uint := Normalized_Position (Comp); - Fbit : constant Uint := Normalized_First_Bit (Comp); - Spos : Uint; - Sbit : Uint; + else + declare + C : constant Entity_Id := + (if Known_Normalized_Position (Comp) + then Comp + else Original_Record_Component (Comp)); + -- The Parent_Subtype in an extension is not back-annotated + -- but its layout is the same as that of the parent type. - begin - Get_Decoded_Name_String (Chars (Comp)); - Set_Casing (Unit_Casing); + Ctyp : constant Entity_Id := Underlying_Type (Etype (C)); - -- If extended information is requested, recurse fully into - -- record components, i.e. skip the outer level. + begin + Get_Decoded_Name_String (Chars (C)); + Set_Casing (Unit_Casing); - if List_Representation_Info_Extended - and then Is_Record_Type (Ctyp) - and then Known_Static_Normalized_Position (Comp) - and then Known_Static_Normalized_First_Bit (Comp) - then - Spos := Starting_Position + Npos; - Sbit := Starting_First_Bit + Fbit; + -- If extended information is requested, recurse fully into + -- record components, i.e. skip the outer level. - if Sbit >= SSU then - Spos := Spos + 1; - Sbit := Sbit - SSU; - end if; + if List_Representation_Info_Extended + and then Is_Record_Type (Ctyp) + and then Known_Static_Normalized_Position (C) + and then Known_Static_Normalized_First_Bit (C) + then + declare + Npos : constant Uint := Normalized_Position (C); + Fbit : constant Uint := Normalized_First_Bit (C); + Pref : constant String := + Prefix & Name_Buffer (1 .. Name_Len) & "."; - List_Record_Layout (Ctyp, - Spos, Sbit, Prefix & Name_Buffer (1 .. Name_Len) & "."); + Spos : Uint; + Sbit : Uint; - goto Continue; - end if; + begin + Spos := Starting_Position + Npos; + Sbit := Starting_First_Bit + Fbit; + + if Sbit >= SSU then + Spos := Spos + 1; + Sbit := Sbit - SSU; + end if; + + List_Record_Layout (Ctyp, Spos, Sbit, Pref); + end; - if List_Representation_Info_To_JSON then - if First then - Write_Eol; - First := False; else - Write_Line (","); - end if; - end if; + if List_Representation_Info_To_JSON then + if First then + Write_Eol; + First := False; + else + Write_Line (","); + end if; + end if; - -- The Parent_Subtype in an extension is not back-annotated + -- If information about holes is requested, update the + -- current bit offset and report any (static) gap. - List_Component_Layout ( - (if Known_Normalized_Position (Comp) - then Comp - else Original_Record_Component (Comp)), - Starting_Position, Starting_First_Bit, Prefix); - end; + if List_Representation_Info_Holes + and then Known_Static_Component_Bit_Offset (C) + then + declare + Gap : constant Uint := + Component_Bit_Offset (C) - Bit_Offset; + begin + if Gap > Uint_0 then + Write_Str (" -- "); + UI_Write (Gap, Decimal); + Write_Line (" bits unused --"); + end if; + + if Known_Static_Esize (C) then + Bit_Offset := + Component_Bit_Offset (C) + Esize (C); + end if; + end; + end if; + + List_Component_Layout + (C, Starting_Position, Starting_First_Bit, Prefix); + end if; + end; + end if; - <<Continue>> Next_Component_Or_Discriminant (Comp); end loop; end List_Record_Layout; @@ -1610,6 +1766,17 @@ package body Repinfo is end loop; end List_Structural_Record_Layout; + -- Use the original record type giving the layout of components + -- to avoid repeated reordering when -gnatRh is specified. + + Rec : constant Entity_Id := + (if Ekind (Ent) = E_Record_Subtype + and then Present (Cloned_Subtype (Ent)) + then (if Is_Private_Type (Cloned_Subtype (Ent)) + then Full_View (Cloned_Subtype (Ent)) + else Cloned_Subtype (Ent)) + else Ent); + -- Start of processing for List_Record_Info begin @@ -1624,7 +1791,7 @@ package body Repinfo is -- First find out max line length and max starting position -- length, for the purpose of lining things up nicely. - Compute_Max_Length (Ent); + Compute_Max_Length (Rec); -- Then do actual output based on those values @@ -1636,21 +1803,21 @@ package body Repinfo is -- declared in the extended main source unit for the time being, -- because otherwise declarations might not be processed at all. - if Is_Base_Type (Ent) then + if Is_Base_Type (Rec) then begin - List_Structural_Record_Layout (Ent, Ent); + List_Structural_Record_Layout (Rec, Rec); exception when Incomplete_Layout | Not_In_Extended_Main => - List_Record_Layout (Ent); + List_Record_Layout (Rec); when others => raise Program_Error; end; else - List_Record_Layout (Ent); + List_Record_Layout (Rec); end if; Write_Eol; @@ -1660,7 +1827,7 @@ package body Repinfo is List_Name (Ent); Write_Line (" use record"); - List_Record_Layout (Ent); + List_Record_Layout (Rec); Write_Line ("end record;"); end if; diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 1d94780..062251f 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -479,18 +479,19 @@ package body Sem_Ch12 is -- Create a new access type with the given designated type function Analyze_Associations - (I_Node : Node_Id; + (N : Node_Id; Formals : List_Id; F_Copy : List_Id) return List_Id; -- At instantiation time, build the list of associations between formals -- and actuals. Each association becomes a renaming declaration for the - -- formal entity. F_Copy is the analyzed list of formals in the generic - -- copy. It is used to apply legality checks to the actuals. I_Node is the - -- instantiation node. + -- formal entity. N is the instantiation node. Formals is the list of + -- unanalyzed formals. F_Copy is the analyzed list of formals in the + -- generic copy. procedure Analyze_Subprogram_Instantiation (N : Node_Id; K : Entity_Kind); + -- Analyze subprogram instantiation N, either a function or a procedure procedure Build_Instance_Compilation_Unit_Nodes (N : Node_Id; @@ -609,12 +610,12 @@ package body Sem_Ch12 is (Inner : Entity_Id; Outer : Entity_Id; N : Node_Id) return Boolean; - -- Inner is instantiated within the generic Outer. Check whether Inner - -- directly or indirectly contains an instance of Outer or of one of its - -- parents, in the case of a subunit. Each generic unit holds a list of - -- the entities instantiated within (at any depth). This procedure - -- determines whether the set of such lists contains a cycle, i.e. an - -- illegal circular instantiation. + -- Inner is being instantiated within Outer. If Outer is also a generic + -- unit, check whether Inner directly or indirectly contains an instance + -- of Outer or of one of its parents (case of subunit). Each generic unit + -- holds a list of the entities instantiated within (at any depth). This + -- procedure determines whether the set of such lists contains a cycle, + -- i.e. an illegal circular instantiation. function Denotes_Formal_Package (Pack : Entity_Id; @@ -1009,8 +1010,8 @@ package body Sem_Ch12 is procedure Set_Next_Assoc (E : Assoc_Ptr; Next : Assoc_Ptr); function Next_Assoc (E : Assoc_Ptr) return Assoc_Ptr; - function Get_Gen_Id (E : Assoc_Ptr) return Entity_Id; - function Hash (F : Entity_Id) return HTable_Range; + function Get_Gen_Id (E : Assoc_Ptr) return Entity_Id; + function Hash (F : Entity_Id) return HTable_Range; package Generic_Renamings_HTable is new GNAT.HTable.Static_HTable ( Header_Num => HTable_Range, @@ -1158,19 +1159,29 @@ package body Sem_Ch12 is -- kinds for N_Box_Subp_Default, N_Box_Actual, N_Null_Default, and -- N_Exp_Func_Default. - type Generic_Actual_Rec (Kind : Actual_Kind := None) is record - -- Representation of one generic actual parameter + type Actual_Rec (Kind : Actual_Kind := None) is record case Kind is - when None | None_Use_Clause | Box_Subp_Default | Box_Actual | - Null_Default | Dummy_Assoc => + when None + | None_Use_Clause + | Box_Subp_Default + | Box_Actual + | Null_Default + | Dummy_Assoc + => null; - when Name_Exp | Exp_Func_Default => + when Name_Exp + | Exp_Func_Default + => Name_Exp : Node_Id; end case; end record; + -- Representation of one generic actual parameter type Actual_Origin_Enum is - (None, From_Explicit_Actual, From_Default, From_Inference, + (None, + From_Explicit_Actual, + From_Default, + From_Inference, From_Others_Box); -- Indication of where the Actual came from -- explicitly in the -- instantiation, inferred from some other type, or defaulted. @@ -1179,16 +1190,16 @@ package body Sem_Ch12 is -- Reason an actual type corresponding to a formal type was (or could -- be) inferred from the actual type corresponding to another formal -- type. - (Designated_Type, -- designated type from formal access - Index_Type, -- index type from formal array - Component_Type, -- component type from formal array + (Designated_Type, -- designated type from formal access + Index_Type, -- index type from formal array + Component_Type, -- component type from formal array Discriminant_Type); -- discriminant type from formal discriminated function Image (Reason : Inference_Reason) return String is (case Reason is - when Designated_Type => "designated type", - when Index_Type => "index type", - when Component_Type => "component type", + when Designated_Type => "designated type", + when Index_Type => "index type", + when Component_Type => "component type", when Discriminant_Type => "discriminant type"); type Assoc_Index is new Pos; @@ -1210,7 +1221,7 @@ package body Sem_Ch12 is Explicit_Assoc : Opt_N_Generic_Association_Id; -- Explicit association, if any, from the source or generated. - Actual : Generic_Actual_Rec; + Actual : Actual_Rec; -- Generic actual parameter corresponding to Un_Formal/An_Formal, -- possibly from defaults or others/boxes. @@ -1224,7 +1235,7 @@ package body Sem_Ch12 is -- inferred. Inferred_From : Assoc_Index; - -- Index of a later Assoc_Rec in the same Gen_Assocs_Rec from which + -- Index of a later Assoc_Rec in the same Match_Rec from which -- this one was inferred, or could be inferred. -- Valid only if Info_Inferred_Actual is present. @@ -1237,10 +1248,10 @@ package body Sem_Ch12 is -- One element for each formal and (if legal) for each corresponding -- actual. - type Gen_Assocs_Rec (Num_Assocs : Assoc_Count) is record - -- Representation of formal/actual matching. Num_Assocs - -- is the number of formals and (if legal) the number - -- of actuals. + type Match_Rec (Num_Assocs : Assoc_Count) is record + -- Representation of formal/actual matching. Num_Assocs is the + -- number of formals and (if legal) the number of actuals. + Gen_Unit : Entity_Id; -- the generic unit being instantiated Others_Present : Boolean; @@ -1251,25 +1262,26 @@ package body Sem_Ch12 is end record; function Match_Assocs - (I_Node : Node_Id; Formals : List_Id; F_Copy : List_Id) - return Gen_Assocs_Rec; - -- I_Node is the instantiation node. Formals is the list of unanalyzed + (N : Node_Id; + Formals : List_Id; + F_Copy : List_Id) return Match_Rec; + -- N is the instantiation node. Formals is the list of unanalyzed -- formals. F_Copy is the analyzed list of formals in the generic copy. - -- Return a Gen_Assocs_Rec with formals, explicit actuals, and default + -- Return a Match_Rec with formals, explicit actuals, and default -- actuals filled in. Check legality rules related to formal/actual -- matching. procedure Note_Potential_Inference - (I_Node : Node_Id; Gen_Assocs : Gen_Assocs_Rec); + (N : Node_Id; + Match : Match_Rec); -- If -gnatd_I, print "info:" messages about type inference that could -- have been done. end Associations; procedure Analyze_One_Association - (I_Node : Node_Id; -- instantiation node - Assoc : Associations.Assoc_Rec; - -- Logical 'in out' parameters: + (N : Node_Id; + Assoc : Associations.Assoc_Rec; Result_Renamings : List_Id; Default_Actuals : List_Id; Actuals_To_Freeze : Elist_Id); @@ -1279,12 +1291,12 @@ package body Sem_Ch12 is -- appended onto Actuals_To_Freeze. procedure Check_Fixed_Point_Warning - (Gen_Assocs : Associations.Gen_Assocs_Rec; + (Match : Associations.Match_Rec; Renamings : List_Id); -- Warn if any actual is a fixed-point type that has user-defined -- arithmetic operators, but there is no corresponding formal in the -- generic, in which case the predefined operators will be used. This - -- merits a warning because of the special semantics of fixed point + -- deserves a warning because of the special semantics of fixed point -- operators. However, do not warn if the formal is private, because there -- can be no arithmetic operators in the generic so there no danger of -- confusion. @@ -1315,27 +1327,29 @@ package body Sem_Ch12 is -- analyzed formals in cases where there are multiple ones -- corresponding to a particular unanalyzed one. - function Num_An_Formals (F_Copy : List_Id) return Assoc_Count; + function Num_An_Formals (F_Copy : List_Id) return Assoc_Count; -- Number of analyzed formals that correspond directly to unanalyzed -- formals. There are all sorts of other things in F_Copy, which -- are not counted. - procedure Check_Box (I_Node, Actual : Node_Id); + procedure Check_Box (N, Actual : Node_Id); -- Check for errors in "others => <>" and "Name => <>" - function Default (Un_Formal : Node_Id) return Generic_Actual_Rec; + function Default (Un_Formal : Node_Id) return Actual_Rec; -- Return the default for a given formal, which can be a name, -- expression, box, etc. procedure Match_Positional - (Src_Assoc : in out Node_Id; Assoc : in out Assoc_Rec); + (Src_Assoc : in out Node_Id; + Assoc : in out Assoc_Rec); -- Called by Match_Assocs to match one positional parameter association. -- If the current formal (in Assoc) is not a use clause, then there is a -- match, and we set Assoc.Actual and move Src_Assoc to the next one. procedure Match_Named - (Src_Assoc : Node_Id; Assoc : in out Assoc_Rec; - Found : in out Boolean); + (Src_Assoc : Node_Id; + Assoc : in out Assoc_Rec; + Found : in out Boolean); -- Called by Match_Assocs to match one named parameter association. -- If the current formal (in Assoc) is not a use clause, and the -- selector name matches the formal name, then there is a match, @@ -1343,48 +1357,50 @@ package body Sem_Ch12 is -- the matched formal, and set Found to True. procedure Inference_Msg - (Gen_Unit : Entity_Id; - Inferred_To, Inferred_From : Assoc_Rec; - Was_Inferred : Boolean); + (Gen_Unit : Entity_Id; + Inferred_To : Assoc_Rec; + Inferred_From : Assoc_Rec; + Was_Inferred : Boolean); -- If Was_Inferred is True, this prints out an "info:" message -- showing the inference. -- If Was_Inferred is False, the message says that it could have -- been inferred. function Find_Assoc - (Gen_Assocs : Gen_Assocs_Rec; F : Entity_Id) return Assoc_Index; - -- Return the index of F in Gen_Assocs.Assocs, which must be - -- present. + (Match : Match_Rec; + F : Entity_Id) return Assoc_Index; + -- Return the index of F in Match.Assocs, which must be present procedure Maybe_Infer_One - (Gen_Assocs : in out Gen_Assocs_Rec; - FF, AA : N_Entity_Id; Inferred_From : Assoc_Index; - Reason : Inference_Reason); + (Match : in out Match_Rec; + FF, AA : N_Entity_Id; + Inferred_From : Assoc_Index; + Reason : Inference_Reason); -- If it makes sense to infer that formal FF is associated with -- actual AA, then do so. procedure Infer_From_Access - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id); -- Try to infer the designated type procedure Infer_From_Array - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id); -- Try to infer the index and component types procedure Infer_From_Discriminated - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id); -- Try to infer the types of discriminants - procedure Infer_Actuals (Gen_Assocs : in out Gen_Assocs_Rec); + procedure Infer_Actuals (Match : in out Match_Rec); -- Called by Match_Assocs after processing explicit and defaulted -- parameters to infer any that are still missing. @@ -1542,13 +1558,13 @@ package body Sem_Ch12 is -- Check_Box -- --------------- - procedure Check_Box (I_Node, Actual : Node_Id) is + procedure Check_Box (N, Actual : Node_Id) is begin -- "... => <>" is allowed only in formal packages, not old-fashioned -- instantiations. - if Nkind (I_Node) /= N_Formal_Package_Declaration - and then Comes_From_Source (I_Node) + if Nkind (N) /= N_Formal_Package_Declaration + and then Comes_From_Source (N) then if Actual in N_Others_Choice_Id then Error_Msg_N @@ -1573,9 +1589,9 @@ package body Sem_Ch12 is -- Default -- ------------- - function Default (Un_Formal : Node_Id) return Generic_Actual_Rec is + function Default (Un_Formal : Node_Id) return Actual_Rec is begin - return Result : Generic_Actual_Rec do + return Result : Actual_Rec do case Nkind (Un_Formal) is when N_Formal_Object_Declaration => if Present (Default_Expression (Un_Formal)) then @@ -1727,22 +1743,24 @@ package body Sem_Ch12 is ------------------ function Match_Assocs - (I_Node : Node_Id; Formals : List_Id; F_Copy : List_Id) - return Gen_Assocs_Rec + (N : Node_Id; + Formals : List_Id; + F_Copy : List_Id) return Match_Rec is - Src_Assocs : constant List_Id := Generic_Associations (I_Node); - Gen_Unit : constant Entity_Id := Defining_Entity (Parent (F_Copy)); + Src_Assocs : constant List_Id := Generic_Associations (N); + Gen_Unit : constant Entity_Id := Defining_Entity (Parent (F_Copy)); + begin pragma Assert (Num_An_Formals (F_Copy) = Num_Formals (Formals) or else Serious_Errors_Detected > 0); - return Result : Gen_Assocs_Rec (Num_Assocs => Num_Formals (Formals)) + return Result : Match_Rec (Num_Assocs => Num_Formals (Formals)) do Result.Gen_Unit := Gen_Unit; Result.Others_Present := False; - -- Loop through the unanalyzed formals: + -- Loop through the unanalyzed formals declare procedure Set_Formal (F : Node_Id; Index : Assoc_Index); @@ -1779,7 +1797,7 @@ package body Sem_Ch12 is Iter (Formals); end; - -- Loop through the analyzed copy of the formals: + -- Loop through the analyzed copy of the formals declare procedure Set_An_Formal (F : Node_Id; Index : Assoc_Index); @@ -1836,7 +1854,7 @@ package body Sem_Ch12 is Iter (F_Copy); end; - -- Loop through actual source associations: + -- Loop through actual source associations declare Src_Assoc : Node_Id := First (Src_Assocs); @@ -1864,7 +1882,7 @@ package body Sem_Ch12 is -- Loop through named actuals and "others => <>": while Present (Src_Assoc) loop - Check_Box (I_Node, Src_Assoc); + Check_Box (N, Src_Assoc); if Src_Assoc in N_Others_Choice_Id then Result.Others_Present := True; exit; @@ -1942,8 +1960,8 @@ package body Sem_Ch12 is end; end loop; - if Nkind (I_Node) /= N_Formal_Package_Declaration then - Infer_Actuals (Gen_Assocs => Result); + if Nkind (N) /= N_Formal_Package_Declaration then + Infer_Actuals (Result); end if; -- Check for missing actuals @@ -1969,9 +1987,10 @@ package body Sem_Ch12 is ------------------- procedure Inference_Msg - (Gen_Unit : Entity_Id; - Inferred_To, Inferred_From : Assoc_Rec; - Was_Inferred : Boolean) + (Gen_Unit : Entity_Id; + Inferred_To : Assoc_Rec; + Inferred_From : Assoc_Rec; + Was_Inferred : Boolean) is pragma Assert (Debug_Flag_Underscore_II); -- This is only for -gnatd_I @@ -2009,7 +2028,8 @@ package body Sem_Ch12 is ------------------------------ procedure Note_Potential_Inference - (I_Node : Node_Id; Gen_Assocs : Gen_Assocs_Rec) + (N : Node_Id; + Match : Match_Rec) is begin if not Debug_Flag_Underscore_II or else Serious_Errors_Detected > 0 @@ -2017,20 +2037,21 @@ package body Sem_Ch12 is return; end if; - for Index in Gen_Assocs.Assocs'Range loop + for Index in Match.Assocs'Range loop declare - Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Index); + Assoc : Assoc_Rec renames Match.Assocs (Index); + begin if Assoc.Actual_Origin = From_Explicit_Actual and then Present (Assoc.Info_Inferred_Actual) - and then In_Extended_Main_Source_Unit (I_Node) - and then not In_Internal_Unit (I_Node) + and then In_Extended_Main_Source_Unit (N) + and then not In_Internal_Unit (N) then Inference_Msg - (Gen_Assocs.Gen_Unit, - Inferred_To => Assoc, - Inferred_From => Gen_Assocs.Assocs (Assoc.Inferred_From), - Was_Inferred => False); + (Match.Gen_Unit, + Inferred_To => Assoc, + Inferred_From => Match.Assocs (Assoc.Inferred_From), + Was_Inferred => False); end if; end; end loop; @@ -2041,11 +2062,12 @@ package body Sem_Ch12 is -------------- function Find_Assoc - (Gen_Assocs : Gen_Assocs_Rec; F : Entity_Id) return Assoc_Index + (Match : Match_Rec; + F : Entity_Id) return Assoc_Index is begin - for Index in Gen_Assocs.Assocs'Range loop - if Defining_Entity (Gen_Assocs.Assocs (Index).An_Formal) = F then + for Index in Match.Assocs'Range loop + if Defining_Entity (Match.Assocs (Index).An_Formal) = F then return Index; end if; end loop; @@ -2058,13 +2080,14 @@ package body Sem_Ch12 is --------------------- procedure Maybe_Infer_One - (Gen_Assocs : in out Gen_Assocs_Rec; - FF, AA : N_Entity_Id; Inferred_From : Assoc_Index; - Reason : Inference_Reason) + (Match : in out Match_Rec; + FF, AA : N_Entity_Id; + Inferred_From : Assoc_Index; + Reason : Inference_Reason) is begin if not (Is_Generic_Type (FF) - and then Scope (FF) = Gen_Assocs.Gen_Unit) + and then Scope (FF) = Match.Gen_Unit) then return; -- no inference if not a formal type of this generic end if; @@ -2074,12 +2097,12 @@ package body Sem_Ch12 is end if; declare - Index : constant Assoc_Index := Find_Assoc (Gen_Assocs, FF); - Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Index); + Index : constant Assoc_Index := Find_Assoc (Match, FF); + Assoc : Assoc_Rec renames Match.Assocs (Index); pragma Assert (Defining_Entity (Assoc.An_Formal) = FF); From_Actual : constant Node_Id := - Gen_Assocs.Assocs (Inferred_From).Actual.Name_Exp; + Match.Assocs (Inferred_From).Actual.Name_Exp; begin Assoc.Info_Inferred_Actual := AA; @@ -2097,23 +2120,23 @@ package body Sem_Ch12 is if Debug_Flag_Underscore_II then Inference_Msg - (Gen_Assocs.Gen_Unit, - Inferred_To => Assoc, - Inferred_From => Gen_Assocs.Assocs (Assoc.Inferred_From), - Was_Inferred => True); + (Match.Gen_Unit, + Inferred_To => Assoc, + Inferred_From => Match.Assocs (Assoc.Inferred_From), + Was_Inferred => True); end if; end if; end; end Maybe_Infer_One; - ------------------- - -- Infer_Actuals -- - ------------------- + ----------------------- + -- Infer_From_Access -- + ----------------------- procedure Infer_From_Access - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id) is begin @@ -2124,7 +2147,7 @@ package body Sem_Ch12 is AA : constant Entity_Id := Designated_Type (A_Full); begin Maybe_Infer_One - (Gen_Assocs, + (Match, FF, AA, Inferred_From => Index, @@ -2133,10 +2156,14 @@ package body Sem_Ch12 is end if; end Infer_From_Access; + ---------------------- + -- Infer_From_Array -- + ---------------------- + procedure Infer_From_Array - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id) is begin @@ -2150,7 +2177,7 @@ package body Sem_Ch12 is while Present (F_Index_Type) and then Present (A_Index_Type) loop Maybe_Infer_One - (Gen_Assocs, + (Match, Etype (F_Index_Type), Etype (A_Index_Type), Inferred_From => Index, @@ -2168,7 +2195,7 @@ package body Sem_Ch12 is Component_Type (A_Full); begin Maybe_Infer_One - (Gen_Assocs, + (Match, F_Comp_Type, A_Comp_Type, Inferred_From => Index, @@ -2177,10 +2204,14 @@ package body Sem_Ch12 is end if; end Infer_From_Array; + ------------------------------ + -- Infer_From_Discriminated -- + ------------------------------ + procedure Infer_From_Discriminated - (Gen_Assocs : in out Gen_Assocs_Rec; - Index : Assoc_Index; - F : Node_Id; + (Match : in out Match_Rec; + Index : Assoc_Index; + F : Node_Id; A_Full : Entity_Id) is begin @@ -2196,7 +2227,7 @@ package body Sem_Ch12 is begin while Present (F_Discrim) loop Maybe_Infer_One - (Gen_Assocs, + (Match, Etype (F_Discrim), Etype (A_Discrim), Inferred_From => Index, @@ -2210,23 +2241,27 @@ package body Sem_Ch12 is end if; end Infer_From_Discriminated; - procedure Infer_Actuals (Gen_Assocs : in out Gen_Assocs_Rec) is - -- Note that we can infer FROM defaults, but we cannot infer TO a - -- parameter that has a default. We can also infer from inferred - -- types. + ------------------- + -- Infer_Actuals -- + ------------------- - -- We don't need to check that multiple inferences get the same - -- answer; the second one will get a type mismatch or nonstatically - -- matching error. + -- Note that we can infer FROM defaults, but we cannot infer TO a + -- parameter that has a default. We can also infer from inferred + -- types. - -- This code needs to be robust, in the sense of tolerating illegal - -- code, because we have not yet checked all legality rules. For - -- example, if a formal type F has a discriminant whose type is - -- another formal type, then we want to infer the type of the - -- discriminant from the actual for F. That actual must have - -- discriminants, but we have not checked that rule yet, so we - -- need to tolerate an actual for F that has no discriminants. + -- We don't need to check that multiple inferences get the same + -- answer; the second one will get a type mismatch or nonstatically + -- matching error. + -- This code needs to be robust, in the sense of tolerating illegal + -- code, because we have not yet checked all legality rules. For + -- example, if a formal type F has a discriminant whose type is + -- another formal type, then we want to infer the type of the + -- discriminant from the actual for F. That actual must have + -- discriminants, but we have not checked that rule yet, so we + -- need to tolerate an actual for F that has no discriminants. + + procedure Infer_Actuals (Match : in out Match_Rec) is begin -- For each parameter, check whether we can infer FROM that one TO -- other ones. @@ -2240,12 +2275,12 @@ package body Sem_Ch12 is -- designated type. The reverse loop implies that we will see the -- array type, then the access type, then the designated type. - for Index in reverse Gen_Assocs.Assocs'Range loop -- NB: "reverse" - if Gen_Assocs.Assocs (Index).Actual.Kind = Name_Exp then + for Index in reverse Match.Assocs'Range loop -- NB: "reverse" + if Match.Assocs (Index).Actual.Kind = Name_Exp then declare - F : constant Node_Id := Gen_Assocs.Assocs (Index).An_Formal; + F : constant Node_Id := Match.Assocs (Index).An_Formal; A_E : constant Node_Id := - Gen_Assocs.Assocs (Index).Actual.Name_Exp; + Match.Assocs (Index).Actual.Name_Exp; A_Full : Entity_Id := Empty; begin if Nkind (A_E) in N_Has_Entity then @@ -2264,7 +2299,7 @@ package body Sem_Ch12 is then case Ekind (Defining_Entity (F)) is when E_Access_Type | E_General_Access_Type => - Infer_From_Access (Gen_Assocs, Index, F, A_Full); + Infer_From_Access (Match, Index, F, A_Full); when E_Access_Subtype | E_Access_Attribute_Type @@ -2274,7 +2309,7 @@ package body Sem_Ch12 is raise Program_Error; when E_Array_Type | E_Array_Subtype => - Infer_From_Array (Gen_Assocs, Index, F, A_Full); + Infer_From_Array (Match, Index, F, A_Full); when E_String_Literal_Subtype => raise Program_Error; @@ -2283,13 +2318,12 @@ package body Sem_Ch12 is null; end case; - Infer_From_Discriminated (Gen_Assocs, Index, F, A_Full); + Infer_From_Discriminated (Match, Index, F, A_Full); end if; end; end if; end loop; end Infer_Actuals; - end Associations; --------------------------- @@ -2316,46 +2350,49 @@ package body Sem_Ch12 is -------------------------- function Analyze_Associations - (I_Node : Node_Id; + (N : Node_Id; Formals : List_Id; F_Copy : List_Id) return List_Id is use Associations; - Result_Renamings : constant List_Id := New_List; + Actuals_To_Freeze : constant Elist_Id := New_Elmt_List; + Default_Actuals : constant List_Id := New_List; + Result_Renamings : constant List_Id := New_List; -- To be returned. Includes "renamings" broadly interpreted -- (e.g. subtypes are used for types). - Actuals_To_Freeze : constant Elist_Id := New_Elmt_List; - Default_Actuals : constant List_Id := New_List; - - Gen_Assocs : constant Gen_Assocs_Rec := - Match_Assocs (I_Node, Formals, F_Copy); + Match : constant Match_Rec := Match_Assocs (N, Formals, F_Copy); begin - for Matching_Actual_Index in Gen_Assocs.Assocs'Range loop + for Index in Match.Assocs'Range loop declare - Assoc : Assoc_Rec renames - Gen_Assocs.Assocs (Matching_Actual_Index); + Assoc : Assoc_Rec renames Match.Assocs (Index); + begin if Nkind (Assoc.Un_Formal) = N_Formal_Package_Declaration and then Error_Posted (Assoc.An_Formal) then -- Restrict this to N_Formal_Package_Declaration, -- because otherwise we miss errors. + Abandon_Instantiation (Instantiation_Node); end if; - if Nkind (Assoc.Un_Formal) in - N_Use_Package_Clause | N_Use_Type_Clause + if Nkind (Assoc.Un_Formal) in N_Use_Package_Clause + | N_Use_Type_Clause then - -- Copy the use clause to where it belongs: + -- Copy the use clause to where it belongs + Append (New_Copy_Tree (Assoc.Un_Formal), Result_Renamings); else Analyze_One_Association - (I_Node, Assoc, - Result_Renamings, Default_Actuals, Actuals_To_Freeze); + (N, + Assoc, + Result_Renamings, + Default_Actuals, + Actuals_To_Freeze); end if; end; end loop; @@ -2366,9 +2403,10 @@ package body Sem_Ch12 is declare Elmt : Elmt_Id := First_Elmt (Actuals_To_Freeze); + begin while Present (Elmt) loop - Freeze_Before (I_Node, Node (Elmt)); + Freeze_Before (N, Node (Elmt)); Next_Elmt (Elmt); end loop; end; @@ -2388,17 +2426,17 @@ package body Sem_Ch12 is Next (Default); end loop; - if No (Generic_Associations (I_Node)) then - Set_Generic_Associations (I_Node, Default_Actuals); + if No (Generic_Associations (N)) then + Set_Generic_Associations (N, Default_Actuals); else - Append_List_To (Generic_Associations (I_Node), Default_Actuals); + Append_List_To (Generic_Associations (N), Default_Actuals); end if; end; end if; - Note_Potential_Inference (I_Node, Gen_Assocs); + Note_Potential_Inference (N, Match); - Check_Fixed_Point_Warning (Gen_Assocs, Result_Renamings); + Check_Fixed_Point_Warning (Match, Result_Renamings); return Result_Renamings; end Analyze_Associations; @@ -2408,9 +2446,8 @@ package body Sem_Ch12 is ----------------------------- procedure Analyze_One_Association - (I_Node : Node_Id; - Assoc : Associations.Assoc_Rec; - -- Logical 'in out' parameters: + (N : Node_Id; + Assoc : Associations.Assoc_Rec; Result_Renamings : List_Id; Default_Actuals : List_Id; Actuals_To_Freeze : Elist_Id) @@ -2482,11 +2519,11 @@ package body Sem_Ch12 is if No (Match) and then not Inside_A_Generic then Append_To (Default_Actuals, - Make_Generic_Association (Sloc (I_Node), + Make_Generic_Association (Sloc (N), Selector_Name => New_Occurrence_Of (Defining_Identifier - (Assoc.Un_Formal), Sloc (I_Node)), + (Assoc.Un_Formal), Sloc (N)), Explicit_Generic_Actual_Parameter => New_Copy_Tree (Default_Expression (Assoc.Un_Formal)))); end if; @@ -2607,7 +2644,7 @@ package body Sem_Ch12 is -- unless this is a rewritten formal package, or the -- formal is an Ada 2012 formal incomplete type. - if Nkind (I_Node) = N_Formal_Package_Declaration + if Nkind (N) = N_Formal_Package_Declaration or else (Ada_Version >= Ada_2012 and then @@ -2693,7 +2730,7 @@ package body Sem_Ch12 is -- An instantiation is a freeze point for the actuals, -- unless this is a rewritten formal package. - if Nkind (I_Node) /= N_Formal_Package_Declaration + if Nkind (N) /= N_Formal_Package_Declaration and then Nkind (Match) = N_Identifier and then Is_Subprogram (Entity (Match)) @@ -2711,7 +2748,7 @@ package body Sem_Ch12 is -- subprograms defined in Standard which are used -- as generic actuals. - and then In_Same_Code_Unit (Entity (Match), I_Node) + and then In_Same_Code_Unit (Entity (Match), N) and then Has_Fully_Defined_Profile (Entity (Match)) then -- Mark the subprogram as having a delayed freeze @@ -2734,11 +2771,11 @@ package body Sem_Ch12 is begin Append_To (Default_Actuals, - Make_Generic_Association (Sloc (I_Node), + Make_Generic_Association (Sloc (N), Selector_Name => - New_Occurrence_Of (Subp, Sloc (I_Node)), + New_Occurrence_Of (Subp, Sloc (N)), Explicit_Generic_Actual_Parameter => - New_Occurrence_Of (Subp, Sloc (I_Node)))); + New_Occurrence_Of (Subp, Sloc (N)))); end; end if; @@ -2851,13 +2888,13 @@ package body Sem_Ch12 is if not Expander_Active or else not Has_Completion (Actual) - or else not In_Same_Source_Unit (I_Node, Actual) + or else not In_Same_Source_Unit (N, Actual) or else Is_Frozen (Actual) or else (Present (Renamed_Entity (Actual)) and then not In_Same_Source_Unit - (I_Node, (Renamed_Entity (Actual)))) + (N, (Renamed_Entity (Actual)))) then null; @@ -2869,7 +2906,7 @@ package body Sem_Ch12 is Needs_Freezing := True; - P := Parent (I_Node); + P := Parent (N); while Nkind (P) /= N_Compilation_Unit loop if Nkind (P) = N_Handled_Sequence_Of_Statements then @@ -3586,7 +3623,7 @@ package body Sem_Ch12 is Decls := Analyze_Associations - (I_Node => Original_Node (N), + (N => Original_Node (N), Formals => Generic_Formal_Declarations (Act_Tree), F_Copy => Generic_Formal_Declarations (Gen_Decl)); @@ -3602,9 +3639,8 @@ package body Sem_Ch12 is if No (Visible_Declarations (Specification (Pack_Decl))) then Set_Visible_Declarations (Specification (Pack_Decl), Decls); else - Insert_List_Before - (First (Visible_Declarations (Specification (Pack_Decl))), - Decls); + Prepend_List_To + (Visible_Declarations (Specification (Pack_Decl)), Decls); end if; return Pack_Decl; @@ -4860,11 +4896,10 @@ package body Sem_Ch12 is -- Local declarations - Gen_Id : constant Node_Id := Name (N); - Inst_Id : constant Entity_Id := Defining_Entity (N); - Is_Actual_Pack : constant Boolean := Is_Internal (Inst_Id); - Loc : constant Source_Ptr := Sloc (N); - + Gen_Id : constant Node_Id := Name (N); + Loc : constant Source_Ptr := Sloc (N); + Is_Abbrev : constant Boolean := + Is_Abbreviated_Instance (Defining_Entity (N)); Saved_GM : constant Ghost_Mode_Type := Ghost_Mode; Saved_IGR : constant Node_Id := Ignored_Ghost_Region; Saved_ISMP : constant Boolean := @@ -4877,7 +4912,6 @@ package body Sem_Ch12 is -- Save style check mode for restore on exit Act_Decl : Node_Id; - Act_Decl_Name : Node_Id; Act_Decl_Id : Entity_Id; Act_Spec : Node_Id; Act_Tree : Node_Id; @@ -4918,29 +4952,7 @@ package body Sem_Ch12 is Instantiation_Node := N; - -- Case of instantiation of a generic package - - if Nkind (N) = N_Package_Instantiation then - Act_Decl_Id := New_Copy (Defining_Entity (N)); - - if Nkind (Defining_Unit_Name (N)) = N_Defining_Program_Unit_Name then - Act_Decl_Name := - Make_Defining_Program_Unit_Name (Loc, - Name => - New_Copy_Tree (Name (Defining_Unit_Name (N))), - Defining_Identifier => Act_Decl_Id); - else - Act_Decl_Name := Act_Decl_Id; - end if; - - -- Case of instantiation of a formal package - - else - Act_Decl_Id := Defining_Identifier (N); - Act_Decl_Name := Act_Decl_Id; - end if; - - Generate_Definition (Act_Decl_Id); + Act_Decl_Id := New_Copy (Defining_Entity (N)); Mutate_Ekind (Act_Decl_Id, E_Package); Set_Is_Not_Self_Hidden (Act_Decl_Id); @@ -4972,7 +4984,7 @@ package body Sem_Ch12 is -- Except for an abbreviated instance created to check a formal package, -- install the parent if this is a generic child unit. - if not Is_Abbreviated_Instance (Inst_Id) then + if not Is_Abbrev then Check_Generic_Child_Unit (Gen_Id, Parent_Installed); end if; @@ -5075,9 +5087,6 @@ package body Sem_Ch12 is goto Leave; else - Mutate_Ekind (Inst_Id, E_Package); - Set_Scope (Inst_Id, Current_Scope); - -- If the context of the instance is subject to SPARK_Mode "off" or -- the annotation is altogether missing, set the global flag which -- signals Analyze_Pragma to ignore all SPARK_Mode pragmas within @@ -5115,22 +5124,38 @@ package body Sem_Ch12 is -- If this is the instance created to validate an actual package, -- only the formals matter, do not examine the package spec itself. - if Is_Actual_Pack then + if Is_Abbrev then Set_Visible_Declarations (Act_Spec, New_List); Set_Private_Declarations (Act_Spec, New_List); end if; Renamings := Analyze_Associations - (I_Node => N, + (N => N, Formals => Generic_Formal_Declarations (Act_Tree), F_Copy => Generic_Formal_Declarations (Gen_Decl)); Vis_Prims_List := Check_Hidden_Primitives (Renamings); + -- Set minimal decoration on the original entity + + Mutate_Ekind (Defining_Entity (N), E_Package); + Set_Scope (Defining_Entity (N), Current_Scope); + Set_Instance_Env (Gen_Unit, Act_Decl_Id); - Set_Defining_Unit_Name (Act_Spec, Act_Decl_Name); Set_Is_Generic_Instance (Act_Decl_Id); + Generate_Definition (Act_Decl_Id); + + if Nkind (Defining_Unit_Name (N)) = N_Defining_Program_Unit_Name then + Set_Defining_Unit_Name (Act_Spec, + Make_Defining_Program_Unit_Name (Loc, + Name => + New_Copy_Tree (Name (Defining_Unit_Name (N))), + Defining_Identifier => Act_Decl_Id)); + else + Set_Defining_Unit_Name (Act_Spec, Act_Decl_Id); + end if; + Set_Generic_Parent (Act_Spec, Gen_Unit); -- References to the generic in its own declaration or its body are @@ -5274,7 +5299,7 @@ package body Sem_Ch12 is and then (not Is_Child_Unit (Gen_Unit) or else not Is_Generic_Unit (Scope (Gen_Unit))) and then Might_Inline_Subp (Gen_Unit) - and then not Is_Actual_Pack + and then not Is_Abbrev then if not Back_End_Inlining and then (Front_End_Inlining or else Has_Inline_Always) @@ -5319,7 +5344,7 @@ package body Sem_Ch12 is or else Enclosing_Body_Present or else Present (Corresponding_Body (Gen_Decl))) and then Needs_Body_Instantiated (Gen_Unit) - and then not Is_Actual_Pack + and then not Is_Abbrev and then not Inline_Now and then (Operating_Mode = Generate_Code or else (Operating_Mode = Check_Semantics @@ -6455,7 +6480,7 @@ package body Sem_Ch12 is Renamings := Analyze_Associations - (I_Node => N, + (N => N, Formals => Generic_Formal_Declarations (Act_Tree), F_Copy => Generic_Formal_Declarations (Gen_Decl)); @@ -7563,14 +7588,15 @@ package body Sem_Ch12 is ------------------------------- procedure Check_Fixed_Point_Warning - (Gen_Assocs : Associations.Gen_Assocs_Rec; + (Match : Associations.Match_Rec; Renamings : List_Id) is use Associations; + begin - for Type_Index in Gen_Assocs.Assocs'Range loop + for Type_Index in Match.Assocs'Range loop declare - Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Type_Index); + Assoc : Assoc_Rec renames Match.Assocs (Type_Index); begin if Nkind (Assoc.An_Formal) = N_Formal_Type_Declaration and then Is_Fixed_Point_Type (Defining_Entity (Assoc.An_Formal)) @@ -7599,9 +7625,9 @@ package body Sem_Ch12 is Op := Alias (Node (Elem)); for Op_Index in Type_Index + 1 .. - Gen_Assocs.Assocs'Last + Match.Assocs'Last loop - Formal := Gen_Assocs.Assocs (Op_Index).Un_Formal; + Formal := Match.Assocs (Op_Index).Un_Formal; if Nkind (Formal) = N_Formal_Concrete_Subprogram_Declaration @@ -10058,13 +10084,12 @@ package body Sem_Ch12 is -- the freeze node for Inst must be inserted after that of -- Parent_Inst. This relation is established by comparing -- the Slocs of Parent_Inst freeze node and Inst. - -- We examine the parents of the enclosing lists to handle + -- We examine the parents (of the enclosing lists) to handle -- the case where the parent instance is in the visible part -- of a package declaration, and the inner instance is in -- the corresponding private part. - if Parent (List_Containing (Freeze_Node (Par_Id))) - = Parent (List_Containing (N)) + if Parent (Freeze_Node (Par_Id)) = Parent (N) and then Sloc (Freeze_Node (Par_Id)) <= Sloc (N) then Insert_Freeze_Node_For_Instance (N, F_Node); @@ -10383,7 +10408,8 @@ package body Sem_Ch12 is -- investigated, and would allow this function to be significantly -- simplified. ??? - Inst := Package_Instantiation (A); + Inst := + (if Ekind (A) = E_Package then Package_Instantiation (A) else Empty); if Present (Inst) then if Nkind (Inst) = N_Package_Instantiation then @@ -10430,10 +10456,11 @@ package body Sem_Ch12 is else Inst := Next (Decl); - while Nkind (Inst) not in N_Formal_Package_Declaration - | N_Function_Instantiation - | N_Package_Instantiation - | N_Procedure_Instantiation + while Present (Inst) + and then Nkind (Inst) not in N_Formal_Package_Declaration + | N_Function_Instantiation + | N_Package_Instantiation + | N_Procedure_Instantiation loop Next (Inst); end loop; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 75901bb..425d624 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3713,8 +3713,8 @@ package body Sem_Ch3 is Set_Is_Static_Expression (E, True); Set_Etype (E, Universal_Integer); - Set_Etype (Id, Universal_Integer); Mutate_Ekind (Id, E_Named_Integer); + Set_Etype (Id, Universal_Integer); Set_Is_Frozen (Id, True); Set_Debug_Info_Needed (Id); @@ -3774,8 +3774,8 @@ package body Sem_Ch3 is if Is_Integer_Type (T) then Resolve (E, T); - Set_Etype (Id, Universal_Integer); Mutate_Ekind (Id, E_Named_Integer); + Set_Etype (Id, Universal_Integer); elsif Is_Real_Type (T) then @@ -3806,15 +3806,15 @@ package body Sem_Ch3 is end if; Resolve (E, T); - Set_Etype (Id, Universal_Real); Mutate_Ekind (Id, E_Named_Real); + Set_Etype (Id, Universal_Real); else Wrong_Type (E, Any_Numeric); Resolve (E, T); - Set_Etype (Id, T); Mutate_Ekind (Id, E_Constant); + Set_Etype (Id, T); Set_Never_Set_In_Source (Id, True); Set_Is_True_Constant (Id, True); return; @@ -3963,7 +3963,7 @@ package body Sem_Ch3 is Data_Path_String : constant String := Absolute_Dir & System.OS_Lib.Directory_Separator - & Stringt.To_String (Strval (Def)); + & S; begin Data_Path := Name_Find (Data_Path_String); @@ -6468,12 +6468,15 @@ package body Sem_Ch3 is Priv : Entity_Id; Related_Id : Entity_Id; Has_FLB_Index : Boolean := False; + K : Entity_Kind; begin if Nkind (Def) = N_Constrained_Array_Definition then Index := First (Discrete_Subtype_Definitions (Def)); + K := E_Array_Subtype; else Index := First (Subtype_Marks (Def)); + K := E_Array_Type; end if; -- Find proper names for the implicit types which may be public. In case @@ -6652,7 +6655,7 @@ package body Sem_Ch3 is -- them unique suffixes, because GNATprove require distinct types to -- have different names. - T := Create_Itype (E_Void, P, Related_Id, 'T', Suffix_Index => -1); + T := Create_Itype (K, P, Related_Id, 'T', Suffix_Index => -1); end if; -- Constrained array case @@ -8133,9 +8136,6 @@ package body Sem_Ch3 is Set_Non_Binary_Modulus (Implicit_Base, Non_Binary_Modulus (Parent_Base)); - Set_Is_Known_Valid - (Implicit_Base, Is_Known_Valid (Parent_Base)); - elsif Is_Floating_Point_Type (Parent_Type) then -- Digits of base type is always copied from the digits value of @@ -8508,11 +8508,19 @@ package body Sem_Ch3 is Analyze (Decl); - pragma Assert (Has_Discriminants (Full_Der) - and then not Has_Unknown_Discriminants (Full_Der)); + pragma + Assert + ((Has_Discriminants (Full_Der) + and then not Has_Unknown_Discriminants (Full_Der)) + or else Serious_Errors_Detected > 0); Uninstall_Declarations (Par_Scope); + if Etype (Full_Der) = Any_Type then + pragma Assert (Serious_Errors_Detected > 0); + return; + end if; + -- Freeze the underlying record view, to prevent generation of -- useless dispatching information, which is simply shared with -- the real derived type. @@ -9477,8 +9485,8 @@ package body Sem_Ch3 is if Constraint_Present then if not Has_Discriminants (Parent_Base) or else - (Has_Unknown_Discriminants (Parent_Base) - and then Is_Private_Type (Parent_Base)) + (Has_Unknown_Discriminants (Parent_Type) + and then Is_Private_Type (Parent_Type)) then Error_Msg_N ("invalid constraint: type has no discriminant", @@ -15218,17 +15226,24 @@ package body Sem_Ch3 is R : Node_Id := Empty; T : constant Entity_Id := Etype (Index); Is_FLB_Index : Boolean := False; + Is_Range : constant Boolean := + Nkind (S) = N_Range + or else (Nkind (S) = N_Attribute_Reference + and then Attribute_Name (S) = Name_Range); + Is_Indic : constant Boolean := Nkind (S) = N_Subtype_Indication; + K : constant Entity_Kind := + (if Is_Modular_Integer_Type (T) then E_Modular_Integer_Subtype + elsif Is_Integer_Type (T) then E_Signed_Integer_Subtype + else E_Enumeration_Subtype); begin - Def_Id := - Create_Itype (E_Void, Related_Nod, Related_Id, Suffix, Suffix_Index); - Set_Etype (Def_Id, Base_Type (T)); + if Is_Range or else Is_Indic then + Def_Id := + Create_Itype (K, Related_Nod, Related_Id, Suffix, Suffix_Index); + Set_Etype (Def_Id, Base_Type (T)); + end if; - if Nkind (S) = N_Range - or else - (Nkind (S) = N_Attribute_Reference - and then Attribute_Name (S) = Name_Range) - then + if Is_Range then -- A Range attribute will be transformed into N_Range by Resolve -- If a range has an Empty upper bound, then remember that for later @@ -15263,7 +15278,7 @@ package body Sem_Ch3 is end if; end if; - elsif Nkind (S) = N_Subtype_Indication then + elsif Is_Indic then -- The parser has verified that this is a discrete indication @@ -15318,27 +15333,19 @@ package body Sem_Ch3 is S, Entity (S)); end if; - return; - else Error_Msg_N ("invalid index constraint", S); Rewrite (S, New_Occurrence_Of (T, Sloc (S))); - return; end if; + + return; end if; -- Complete construction of the Itype - if Is_Modular_Integer_Type (T) then - Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype); - - elsif Is_Integer_Type (T) then - Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype); - - else - Mutate_Ekind (Def_Id, E_Enumeration_Subtype); + if K = E_Enumeration_Subtype then Set_Is_Character_Type (Def_Id, Is_Character_Type (T)); - Set_First_Literal (Def_Id, First_Literal (T)); + Set_First_Literal (Def_Id, First_Literal (T)); end if; Set_Size_Info (Def_Id, (T)); @@ -20603,17 +20610,17 @@ package body Sem_Ch3 is if No (Def_Id) then Def_Id := - Create_Itype (E_Void, Related_Nod, Related_Id, 'D', Suffix_Index); + Create_Itype + ((if Is_Signed_Integer_Type (T) then E_Signed_Integer_Subtype + elsif Is_Modular_Integer_Type (T) then E_Modular_Integer_Subtype + else E_Enumeration_Subtype), + Related_Nod, + Related_Id, + 'D', + Suffix_Index); Set_Etype (Def_Id, Base_Type (T)); - if Is_Signed_Integer_Type (T) then - Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype); - - elsif Is_Modular_Integer_Type (T) then - Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype); - - else - Mutate_Ekind (Def_Id, E_Enumeration_Subtype); + if Ekind (Def_Id) = E_Enumeration_Subtype then Set_Is_Character_Type (Def_Id, Is_Character_Type (T)); Set_First_Literal (Def_Id, First_Literal (T)); end if; @@ -21247,6 +21254,12 @@ package body Sem_Ch3 is Discr := First (Discriminant_Specifications (N)); while Present (Discr) loop + if Ekind (Defining_Identifier (Discr)) = E_In_Parameter then + Reinit_Field_To_Zero + (Defining_Identifier (Discr), F_Discriminal_Link); + end if; + + Mutate_Ekind (Defining_Identifier (Discr), E_Discriminant); Enter_Name (Defining_Identifier (Discr)); -- For navigation purposes we add a reference to the discriminant @@ -21522,11 +21535,6 @@ package body Sem_Ch3 is while Present (Discr) loop Id := Defining_Identifier (Discr); - if Ekind (Id) = E_In_Parameter then - Reinit_Field_To_Zero (Id, F_Discriminal_Link); - end if; - - Mutate_Ekind (Id, E_Discriminant); Set_Is_Not_Self_Hidden (Id); Reinit_Component_Location (Id); Reinit_Esize (Id); diff --git a/gcc/ada/sem_ch8.ads b/gcc/ada/sem_ch8.ads index 70fbcf2..f915f2c 100644 --- a/gcc/ada/sem_ch8.ads +++ b/gcc/ada/sem_ch8.ads @@ -100,11 +100,6 @@ package Sem_Ch8 is -- entries in the current scope, and that will give all homonyms that are -- declared before the point of call in the current scope. This is useful -- for example in the processing for pragma Inline. - -- - -- Flag Errors_OK should be set when error diagnostics are desired. Flag - -- Marker_OK should be set when a N_Variable_Reference_Marker needs to be - -- generated for a SPARK object in order to detect elaboration issues. Flag - -- Reference_OK should be set when N must generate a cross reference. procedure Find_Selected_Component (N : Node_Id); -- Resolve various cases of selected components, recognize expanded names diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 3c80d23..679d0ee 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -333,7 +333,7 @@ package body Sem_Util is -- Add_Global_Declaration -- ---------------------------- - procedure Add_Global_Declaration (N : Node_Id) is + procedure Add_Global_Declaration (Decl : Node_Id) is Aux_Node : constant Node_Id := Aux_Decls_Node (Cunit (Current_Sem_Unit)); begin @@ -341,8 +341,8 @@ package body Sem_Util is Set_Declarations (Aux_Node, New_List); end if; - Append_To (Declarations (Aux_Node), N); - Analyze (N); + Append_To (Declarations (Aux_Node), Decl); + Analyze (Decl); end Add_Global_Declaration; -------------------------------- @@ -8026,6 +8026,7 @@ package body Sem_Util is -- but the error should be posted on it, not on the component. elsif Ekind (E) = E_Discriminant + and then Is_Not_Self_Hidden (E) and then Present (Scope (Def_Id)) and then Scope (Def_Id) /= Current_Scope then @@ -8051,7 +8052,10 @@ package body Sem_Util is -- Avoid cascaded messages with duplicate components in -- derived types. - if Ekind (E) in E_Component | E_Discriminant then + if Ekind (E) = E_Component + or else (Ekind (E) = E_Discriminant + and then Is_Not_Self_Hidden (E)) + then return; end if; end if; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 0e97806..8d5bda0 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -54,12 +54,12 @@ package Sem_Util is -- Add A to the list of access types to process when expanding the -- freeze node of E. - procedure Add_Global_Declaration (N : Node_Id); - -- These procedures adds a declaration N at the library level, to be + procedure Add_Global_Declaration (Decl : Node_Id); + -- This procedure adds a declaration Decl at the library level, to be -- elaborated before any other code in the unit. It is used for example -- for the entity that marks whether a unit has been elaborated. The -- declaration is added to the Declarations list of the Aux_Decls_Node - -- for the current unit. The declarations are added in the current scope, + -- for the current unit. The declared entity is added to current scope, -- so the caller should push a new scope as required before the call. function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id; diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 1bc97a8..74f9fe3 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -1712,17 +1712,11 @@ package body Sem_Warn is and then Ekind (E1) /= E_Class_Wide_Type - -- Objects other than parameters of task types are allowed to - -- be non-referenced, since they start up tasks. + -- Objects that are not parameters and whose types have tasks + -- are allowed to be non-referenced since they start up tasks. - and then ((Ekind (E1) /= E_Variable - and then Ekind (E1) /= E_Constant - and then Ekind (E1) /= E_Component) - - -- Check that E1T is not a task or a composite type - -- with a task component. - - or else not Has_Task (E1T)) + and then not (Ekind (E1) in E_Variable | E_Constant | E_Component + and then Has_Task (E1T)) -- For subunits, only place warnings on the main unit itself, -- since parent units are not completely compiled. diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index a0c7314..9b5d3c2 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -8172,7 +8172,7 @@ package Sinfo is -- An implicit label declaration is created for every occurrence of a -- label on a statement or a label on a block or loop. It is chained -- in the declarations of the innermost enclosing block as specified - -- in RM section 5.1 (3). + -- in RM section 5.1 (12). -- The Defining_Identifier is the actual identifier for the statement -- identifier. Note that the occurrence of the label is a reference, NOT diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 1e54340..efad12c 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -1220,17 +1220,20 @@ package body Switch.C is List_Representation_Info := Character'Pos (C) - Character'Pos ('0'); - when 's' => - List_Representation_Info_To_File := True; + when 'e' => + List_Representation_Info_Extended := True; - when 'j' => - List_Representation_Info_To_JSON := True; + when 'h' => + List_Representation_Info_Holes := True; when 'm' => List_Representation_Info_Mechanisms := True; - when 'e' => - List_Representation_Info_Extended := True; + when 'j' => + List_Representation_Info_To_JSON := True; + + when 's' => + List_Representation_Info_To_File := True; when others => Bad_Switch ("-gnatR" & Switch_Chars (Ptr .. Max)); @@ -1245,6 +1248,12 @@ package body Switch.C is Osint.Fail ("-gnatRe is incompatible with -gnatRj"); end if; + if List_Representation_Info_To_JSON + and then List_Representation_Info_Holes + then + Osint.Fail ("-gnatRh is incompatible with -gnatRj"); + end if; + -- -gnats (syntax check only) when 's' => diff --git a/gcc/ada/switch.adb b/gcc/ada/switch.adb index b1abe1e..691abc0 100644 --- a/gcc/ada/switch.adb +++ b/gcc/ada/switch.adb @@ -93,7 +93,7 @@ package body Switch is Set_Standard_Output; Usage; Write_Eol; - Write_Line ("Report bugs to report@adacore.com"); + Write_Line ("Report bugs to support@adacore.com"); Exit_Program (E_Success); end if; end Check_Version_And_Help_G; diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index b1a2c34..16e2bc8 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -87,7 +87,7 @@ package body Treepr is procedure Destroy (Value : in out Nat) is null; pragma Annotate (CodePeer, False_Positive, "unassigned parameter", "in out parameter is required to instantiate generic"); - -- Dummy routine for destroing hashed values + -- Dummy routine for destroying hashed values package Serial_Numbers is new Dynamic_Hash_Tables (Key_Type => Int, diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index efa38b5..5b87bb5 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -92,17 +92,17 @@ begin -- Common switches available everywhere - Write_Switch_Char ("g ", ""); + Write_Switch_Char ("g ", ""); Write_Line ("Generate debugging information"); - Write_Switch_Char ("Idir ", ""); + Write_Switch_Char ("Idir ", ""); Write_Line ("Specify source files search path"); - Write_Switch_Char ("I- ", ""); + Write_Switch_Char ("I- ", ""); Write_Line ("Do not look for sources in current directory"); - Write_Switch_Char ("O[0123] ", ""); - Write_Line ("Control the optimization level"); + Write_Switch_Char ("O[?] ", ""); + Write_Line ("Control the optimization level (?=0/1/2/3/s/z/g)"); Write_Eol; @@ -402,7 +402,7 @@ begin Write_Switch_Char ("R?"); Write_Line - ("List rep info (?=0/1/2/3/4/e/m for none/types/all/sym/cg/ext/mech)"); + ("List rep info (?=1/2/3/4/e/h/m for types/all/sym/cg/ext/holes/mech)"); Write_Switch_Char ("R?j"); Write_Line ("List rep info in the JSON data interchange format"); Write_Switch_Char ("R?s"); diff --git a/gcc/ada/vast.adb b/gcc/ada/vast.adb index acb48b6..59470fd 100644 --- a/gcc/ada/vast.adb +++ b/gcc/ada/vast.adb @@ -29,58 +29,285 @@ pragma Assertion_Policy (Check); -- we want to run VAST with a compiler built without checks. Anyway, it's -- harmless, because VAST is not run by default. -with Atree; use Atree; +with Ada.Unchecked_Deallocation; + +with System.Case_Util; + +with Atree; use Atree; with Debug; -with Debug_A; use Debug_A; -with Lib; use Lib; -with Namet; use Namet; -with Output; use Output; -with Opt; use Opt; -with Sinfo.Nodes; use Sinfo.Nodes; with Einfo.Entities; use Einfo.Entities; -with Types; use Types; +with Lib; use Lib; +with Namet; use Namet; +with Nlists; use Nlists; +with Opt; use Opt; +with Output; +with Sinfo.Nodes; use Sinfo.Nodes; +with Sinput; +with Table; +with Types; use Types; package body VAST is + -- ???Basic tree properties not yet checked: + -- - No dangling trees. Every node that is reachable at all is reachable + -- by some syntactic path. + -- - Basic properties of Nlists/Elists (next/prev pointers make sense, + -- for example). + Force_Enable_VAST : constant Boolean := False; -- Normally, VAST is enabled by the the -gnatd_V switch. -- To force it to be enabled independent of any switches, - -- change the above to True. - Print_Disabled_Failing_Checks : constant Boolean := True; - -- False means disabled checks are silent; True means we print a message - -- (but still don't raise VAST_Failure). - - type Check_Enum is (Check_Other, Check_Error_Nodes); - Enabled_Checks : constant array (Check_Enum) of Boolean := - (Check_Other => True, --- others => False); - others => True); - -- Passing checks are Check_Other, which should always be enabled. + -- set this to True. + + type Check_Enum is + (Check_Other, + Check_Sloc, + Check_Analyzed, + Check_Error_Nodes, + Check_Sharing, + Check_Parent_Present, + Check_Parent_Correct); + + type Check_Status is + -- Action in case of check failure: + (Disabled, -- Do nothing + Enabled, -- Print messages, and raise an exception + Print_And_Continue); -- Print a message + + pragma Warnings (Off, "Status*could be declared constant"); + Status : array (Check_Enum) of Check_Status := + (Check_Other => Enabled, + Check_Sloc => Disabled, + Check_Analyzed => Disabled, + Check_Error_Nodes => Print_And_Continue, + Check_Sharing => Disabled, + Check_Parent_Present => Print_And_Continue, + Check_Parent_Correct => Disabled); +-- others => Print_And_Continue); +-- others => Enabled); +-- others => Disabled); + -- Passing checks are Check_Other, which should always be Enabled. -- Currently-failing checks are different enumerals in Check_Enum, -- which can be disabled individually until we fix the bugs, or enabled -- when debugging particular bugs. Pass a nondefault Check_Enum to -- Assert in order to deal with bugs we have not yet fixed, - -- and play around with the value of Enabled_Checks above - -- for testing and debugging. + -- and play around with the value of Status above for + -- testing and debugging. -- -- Note: Once a bug is fixed, and the check passes reliably, we may choose -- to remove that check from Check_Enum and use Check_Other instead. + type Node_Stack_Index is new Pos; + subtype Node_Stack_Count is + Node_Stack_Index'Base range 0 .. Node_Stack_Index'Last; + + package Node_Stack is new Table.Table + (Table_Component_Type => Node_Id, + Table_Index_Type => Node_Stack_Index'Base, + Table_Low_Bound => 1, + Table_Initial => 1, + Table_Increment => 100, + Table_Name => "Node_Stack"); + procedure Assert (Condition : Boolean; Check : Check_Enum := Check_Other; Detail : String := ""); - -- Check that the Condition is True, and raise an exception otherwise. - -- Check enables/disables the checking, according to Enabled_Checks above, - -- and is printed on failure. Detail is an additional error message, - -- also printed on failure. - - function Do_Node (N : Node_Id) return Traverse_Result; - procedure Traverse is new Traverse_Proc (Do_Node); + -- Check that the Condition is True. Status determines action on failure. + + function To_Mixed (A : String) return String; + -- Copied from System.Case_Util; old versions of that package do not have + -- this function, so this is needed for bootstrapping. + + function Image (Kind : Node_Kind) return String is (To_Mixed (Kind'Img)); + function Image (Kind : Entity_Kind) return String is (To_Mixed (Kind'Img)); + + procedure Put (S : String); + procedure Put_Line (S : String); + procedure Put_Node (N : Node_Id); + procedure Put_Node_Stack; + -- Output routines; print only if -gnatd_W (VAST in verbose mode) is + -- enabled. + + procedure Put_Indentation; + -- Print spaces to indicate nesting depth of Node_Stack + + procedure Enter_Node (N : Node_Id); + procedure Leave_Node (N : Node_Id); + -- Called for each node while walking the tree. + -- Push/pop N to/from Node_Stack. + -- Print enter/leave debugging messages. + -- ???Possible improvements to messages: + -- Walk subtrees in a better order. + -- Print field names. + -- Don't print boring fields (such as N_Empty nodes). + -- Print more info (value of literals, "A.B.C" for expanded names, etc.). + -- Share some code with Treepr. + + procedure Do_Tree (N : Node_Id); -- Do VAST checking on a tree of nodes + function Has_Subtrees (N : Node_Id) return Boolean; + -- True if N has one or more syntactic fields + + procedure Do_Subtrees (N : Node_Id); + -- Call Do_Tree on all the subtrees (i.e. syntactic fields) of N + + procedure Do_List (L : List_Id); + -- Call Do_Tree on the list elements + procedure Do_Unit (U : Unit_Number_Type); - -- Call Do_Node on the root node of a compilation unit + -- Call Do_Tree on the root node of a compilation unit + + function Ancestor_Node (Count : Node_Stack_Count) return Node_Id; + -- Nth ancestor on the Node_Stack. Ancestor_Node(0) is the current node, + -- Ancestor_Node(1) is its parent, Ancestor_Node(2) is its grandparent, + -- and so on. + + function Top_Node return Node_Id is (Ancestor_Node (0)); + + type Node_Set is array (Node_Id range <>) of Boolean; + pragma Pack (Node_Set); + type Node_Set_Ptr is access all Node_Set; + procedure Free is new Ada.Unchecked_Deallocation (Node_Set, Node_Set_Ptr); + + Visited : Node_Set_Ptr; + -- Giant array of Booleans; Visited (N) is True if and only if we have + -- visited N in the tree walk. Used to detect incorrect sharing of subtrees + -- or (worse) cycles. We don't allocate the set on the stack, for fear of + -- Storage_Error. + + function Get_Node_Field_Union is new + Atree.Atree_Private_Part.Get_32_Bit_Field (Union_Id) with Inline; + + -------------- + -- To_Mixed -- + -------------- + + function To_Mixed (A : String) return String is + Result : String := A; + begin + System.Case_Util.To_Mixed (Result); + return Result; + end To_Mixed; + + --------- + -- Put -- + --------- + + procedure Put (S : String) is + begin + if Debug.Debug_Flag_Underscore_WW then + Output.Write_Str (S); + end if; + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (S : String) is + begin + if Debug.Debug_Flag_Underscore_WW then + Output.Write_Line (S); + end if; + end Put_Line; + + -------------- + -- Put_Node -- + -------------- + + procedure Put_Node (N : Node_Id) is + begin + if Debug.Debug_Flag_Underscore_WW then + if Nkind (N) in N_Entity then + Put (Image (Ekind (N))); + else + Put (Image (Nkind (N))); + end if; + + Put (N'Img & " "); + Sinput.Write_Location (Sloc (N)); + + if Comes_From_Source (N) then + Put (" (s)"); + end if; + + case Nkind (N) is + when N_Has_Chars => + Put (" "); + Write_Name_For_Debug (Chars (N), Quote => """"); + when others => null; + end case; + + end if; + end Put_Node; + + --------------------- + -- Put_Indentation -- + --------------------- + + procedure Put_Indentation is + begin + Put (String'(Natural (Node_Stack.First) .. + Natural (Node_Stack.Last) * 2 => ' ')); + end Put_Indentation; + + ---------------- + -- Enter_Node -- + ---------------- + + procedure Enter_Node (N : Node_Id) is + begin + Node_Stack.Append (N); -- push + + if Has_Subtrees (N) then + Put ("-->"); + else + -- If no subtrees, just print one line for enter/leave + Put (" "); + end if; + Put_Indentation; + Put_Node (N); + Put_Line (""); + end Enter_Node; + + ---------------- + -- Leave_Node -- + ---------------- + + procedure Leave_Node (N : Node_Id) is + begin + if Has_Subtrees (N) then + Put ("<--"); + Put_Indentation; + Put_Node (N); + Put_Line (""); + end if; + + Node_Stack.Decrement_Last; -- pop + end Leave_Node; + + -------------------- + -- Put_Node_Stack -- + -------------------- + + procedure Put_Node_Stack is + begin + for J in reverse Node_Stack.First .. Node_Stack.Last loop + Put_Node (Node_Stack.Table (J)); + Put_Line (""); + end loop; + end Put_Node_Stack; + + ------------------- + -- Ancestor_Node -- + ------------------- + + function Ancestor_Node (Count : Node_Stack_Count) return Node_Id is + begin + return Node_Stack.Table (Node_Stack.Last - Count); + end Ancestor_Node; ------------ -- Assert -- @@ -98,34 +325,70 @@ package body VAST is declare Part1 : constant String := "VAST fail"; Part2 : constant String := - (if Check = Check_Other then "" else ": " & Check'Img); + (if Check = Check_Other then "" + else ": " & To_Mixed (Check'Img)); Part3 : constant String := (if Detail = "" then "" else " -- " & Detail); Message : constant String := Part1 & Part2 & Part3; + Save : constant Boolean := Debug.Debug_Flag_Underscore_WW; begin - if Enabled_Checks (Check) or else Print_Disabled_Failing_Checks - then - -- ???This Special_Output business is kind of ugly. - -- We can do better. - Cancel_Special_Output; - Write_Line (Message); - Set_Special_Output (Ignore_Output'Access); - end if; - - if Enabled_Checks (Check) then - raise VAST_Failure with Message; - end if; + case Status (Check) is + when Disabled => null; + when Enabled | Print_And_Continue => + Debug.Debug_Flag_Underscore_WW := True; + -- ???We should probably avoid changing the debug flag here + Put (Message & ": "); + Put_Node (Top_Node); + Put_Line (""); + + if Status (Check) = Enabled then + Put_Node_Stack; + raise VAST_Failure with Message; + end if; + + Debug.Debug_Flag_Underscore_WW := Save; + end case; end; end if; end Assert; ------------- - -- Do_Node -- + -- Do_Tree -- ------------- - function Do_Node (N : Node_Id) return Traverse_Result is + procedure Do_Tree (N : Node_Id) is begin - Debug_A_Entry ("do ", N); + Enter_Node (N); + + -- Skip the rest if empty. Check Sloc: + + case Nkind (N) is + when N_Empty => + Assert (No (Sloc (N))); + goto Done; -- --------------> + -- Don't do any further checks on Empty + + -- ???Some nodes, including exception handlers, have no Sloc; + -- it's unclear why. + + when N_Exception_Handler => + Assert (if Comes_From_Source (N) then Present (Sloc (N))); + when others => + Assert (Present (Sloc (N)), Check_Sloc); + end case; + + -- All reachable nodes should have been analyzed by the time we get + -- here: + + Assert (Analyzed (N), Check_Analyzed); + + -- If we visit the same node more than once, then there are shared + -- nodes; the "tree" is not a tree: + + Assert (not Visited (N), Check_Sharing); + Visited (N) := True; + + -- Misc checks based on node/entity kind: case Nkind (N) is when N_Unused_At_Start | N_Unused_At_End => @@ -148,27 +411,105 @@ package body VAST is -- Check that N has a Parent, except in certain cases: - if Nkind (N) = N_Compilation_Unit then - Assert (No (Parent (N))); - -- The root of each unit should not have a parent - - elsif N in N_Entity_Id and then Is_Itype (N) then - null; -- An Itype might or might not have a parent + case Nkind (N) is + when N_Empty => + raise Program_Error; -- can't get here - else - if Nkind (N) = N_Error then + when N_Error => Assert (False, Check_Error_Nodes); -- The error node has no parent, but we shouldn't even be seeing - -- error nodes in VAST at all. See "when N_Error" above. - else - Assert (Present (Parent (N)), Detail => "missing parent"); + -- error nodes in VAST at all. See earlier "when N_Error". + + when N_Compilation_Unit => + Assert (No (Parent (N))); + -- The parent of the root of each unit is empty. + + when N_Entity => + if not Is_Itype (N) then + -- An Itype might or might not have a parent + + Assert + (Present (Parent (N)), Detail => "missing parent of entity"); + Assert (Parent (N) = Ancestor_Node (1), Check_Parent_Correct); + end if; + + when others => + Assert (Present (Parent (N)), Check_Parent_Present); -- All other nodes should have a parent - end if; - end if; + if Status (Check_Parent_Present) = Enabled then + Assert (Parent (N) = Ancestor_Node (1), Check_Parent_Correct); + end if; + end case; - Debug_A_Exit ("do ", N, " (done)"); - return OK; - end Do_Node; + Do_Subtrees (N); + + <<Done>> + Leave_Node (N); + end Do_Tree; + + ----------------- + -- Has_Subtrees -- + ----------------- + + function Has_Subtrees (N : Node_Id) return Boolean is + Offsets : Traversed_Offset_Array renames + Traversed_Fields (Nkind (N)); + begin + -- True if sentinel comes first + return Offsets (Offsets'First) /= No_Field_Offset; + end Has_Subtrees; + + ----------------- + -- Do_Subtrees -- + ----------------- + + procedure Do_Subtrees (N : Node_Id) is + -- ???Do we need tail recursion elimination here, + -- as in Atree.Traverse_Func? + Offsets : Traversed_Offset_Array renames + Traversed_Fields (Nkind (N)); + begin + for Cur_Field in Offset_Array_Index loop + exit when Offsets (Cur_Field) = No_Field_Offset; + + declare + F : constant Union_Id := + Get_Node_Field_Union (N, Offsets (Cur_Field)); + begin + if F in Node_Range then + Do_Tree (Node_Id (F)); + elsif F in List_Range then + Do_List (List_Id (F)); + else + raise Program_Error; + end if; + end; + end loop; + end Do_Subtrees; + + ------------- + -- Do_List -- + ------------- + + procedure Do_List (L : List_Id) is + Elmt : Node_Id := First (L); + Len : constant String := List_Length (L)'Img; + begin + if Is_Non_Empty_List (L) then + Put ("-->"); + Put_Indentation; + Put_Line ("list len=" & Len); + + while Present (Elmt) loop + Do_Tree (Elmt); + Next (Elmt); + end loop; + + Put ("<--"); + Put_Indentation; + Put_Line ("list len=" & Len); + end if; + end Do_List; ------------- -- Do_Unit -- @@ -183,8 +524,10 @@ package body VAST is (if Is_Predefined_Unit (U) then " (predef)" elsif Is_Internal_Unit (U) then " (gnat)" else ""); + Is_Main : constant String := + (if U = Main_Unit then " (main unit)" else ""); Msg : constant String := - "VAST for unit" & U'Img & " " & U_Name_S & Predef; + "VAST for unit" & U'Img & " " & U_Name_S & Predef & Is_Main; Is_Preprocessing_Dependency : constant Boolean := U_Name = No_Unit_Name; @@ -194,24 +537,26 @@ package body VAST is Root : constant Node_Id := Cunit (U); begin + pragma Assert (Node_Stack.Last = 0); Assert (No (Root) = Is_Preprocessing_Dependency); -- All compilation units except these bogus ones should have a Cunit. - Write_Line (Msg); + Put_Line (Msg); if Is_Preprocessing_Dependency then - Write_Line ("Skipping preprocessing dependency"); + Put_Line ("Skipping preprocessing dependency"); return; end if; Assert (Present (Root)); - Traverse (Root); - Write_Line (Msg & " (done)"); + Do_Tree (Root); + Put_Line (Msg & " (done)"); + pragma Assert (Node_Stack.Last = 0); end Do_Unit; - ---------------- - -- Check_Tree -- - ---------------- + ---------- + -- VAST -- + ---------- procedure VAST is pragma Assert (Expander_Active = (Operating_Mode = Generate_Code)); @@ -228,12 +573,10 @@ package body VAST is end if; -- If -gnatd_W (VAST in verbose mode) is enabled, then that should imply - -- -gnatd_V (enable VAST). In addition, we use the Debug_A routines to - -- print debugging information, so enable -gnatda. + -- -gnatd_V (enable VAST). if Debug_Flag_Underscore_WW then Debug_Flag_Underscore_VV := True; - Debug_Flag_A := True; end if; -- Do nothing if VAST is disabled @@ -244,22 +587,34 @@ package body VAST is -- Turn off output unless verbose mode is enabled - if not Debug_Flag_Underscore_WW then - Set_Special_Output (Ignore_Output'Access); - end if; - Write_Line ("VAST"); + Put_Line ("VAST"); -- Operating_Mode = Generate_Code implies there are no legality errors: Assert (Serious_Errors_Detected = 0); - Write_Line ("VAST checking" & Last_Unit'Img & " units"); - for U in Main_Unit .. Last_Unit loop - Do_Unit (U); - end loop; + Put_Line ("VAST checking" & Last_Unit'Img & " units"); + + declare + use Atree_Private_Part; + Last_Node : constant Node_Id := Node_Offsets.Last; + begin + pragma Assert (Visited = null); + Visited := new Node_Set'(Node_Id'First .. Last_Node => False); + + for U in Main_Unit .. Last_Unit loop + -- Main_Unit is the one passed to the back end, but here we are + -- walking all the units. + Do_Unit (U); + end loop; + + -- We shouldn't have allocated any new nodes during VAST: + + pragma Assert (Node_Offsets.Last = Last_Node); + Free (Visited); + end; - Write_Line ("VAST done."); - Cancel_Special_Output; + Put_Line ("VAST done."); end VAST; end VAST; diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 56dd18c..f666783 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -1279,18 +1279,31 @@ make_dispatcher_decl (const tree decl) return func_decl; } -/* Returns true if DECL is multi-versioned using the target attribute, and this - is the default version. This function can only be used for targets that do - not support the "target_version" attribute. */ +/* Returns true if DECL a multiversioned default. + With the target attribute semantics, returns true if the function is marked + as default with the target version. + With the target_version attribute semantics, returns true if the function + is either not annotated, or annotated as default. */ bool is_function_default_version (const tree decl) { - if (TREE_CODE (decl) != FUNCTION_DECL - || !DECL_FUNCTION_VERSIONED (decl)) + tree attr; + if (TREE_CODE (decl) != FUNCTION_DECL) return false; - tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (decl)); - gcc_assert (attr); + if (TARGET_HAS_FMV_TARGET_ATTRIBUTE) + { + if (!DECL_FUNCTION_VERSIONED (decl)) + return false; + attr = lookup_attribute ("target", DECL_ATTRIBUTES (decl)); + gcc_assert (attr); + } + else + { + attr = lookup_attribute ("target_version", DECL_ATTRIBUTES (decl)); + if (!attr) + return true; + } attr = TREE_VALUE (TREE_VALUE (attr)); return (TREE_CODE (attr) == STRING_CST && strcmp (TREE_STRING_POINTER (attr), "default") == 0); diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index cd96e82..3ffe3e0 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2025-06-12 Gwenole Beauchesne <gb.devel@gmail.com> + Andrew Pinski <quic_apinski@quicinc.com> + + PR c++/41201 + PR c++/48026 + * c-pragma.cc (init_pragma): Use c_register_pragma_with_early_handler + instead of c_register_pragma for `#pragma GCC optimize`. + 2025-06-03 Martin Uecker <uecker@tugraz.at> PR c/120078 diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 8b5cdcc..137b83bf 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -1847,7 +1847,9 @@ init_pragma (void) c_register_pragma_with_early_handler ("GCC", "target", handle_pragma_target, handle_pragma_target); - c_register_pragma ("GCC", "optimize", handle_pragma_optimize); + c_register_pragma_with_early_handler ("GCC", "optimize", + handle_pragma_optimize, + handle_pragma_optimize); c_register_pragma_with_early_handler ("GCC", "push_options", handle_pragma_push_options, handle_pragma_push_options); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 351eb4e..47f828f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,34 @@ +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + * c-lang.h (union lang_type::maybe_objc_info): New type. + (struct lang_type): Use union maybe_objc_info info member + instead of tree objc_info. + * c-decl.cc (finish_struct): Allocate struct lang_type using + ggc_internal_cleared_alloc instead of ggc_cleared_alloc, + and use sizeof (struct lang_type) for ObjC and otherwise + offsetof (struct lang_type, info) as size. + (finish_enum): Likewise. + +2025-06-11 Martin Uecker <uecker@tugraz.at> + + PR c/120510 + * c-typeck.cc (composite_type_internal): Activate checking + assertions for all types and also inputs. + (comptypes_for_composite_check): New helper function. + (function_types_compatible_p): Add exception. + +2025-06-11 Martin Uecker <uecker@tugraz.at> + + * c-typeck.cc (function_types_compatible_p): Remove unused + variables and return true/false instead of 1/0. + (type_lists_compatible_p): Return false instead of 0. + +2025-06-11 Martin Uecker <uecker@tugraz.at> + + PR c/120303 + * c-parser.cc (c_parser_generic_selection): Handle error + condition. + 2025-06-09 Martin Uecker <uecker@tugraz.at> PR c/120510 diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 2b0bd66..8bbd6eb 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -9790,12 +9790,17 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, len += list_length (x); /* Use the same allocation policy here that make_node uses, to - ensure that this lives as long as the rest of the struct decl. - All decls in an inline function need to be saved. */ - - space = ggc_cleared_alloc<struct lang_type> (); - space2 = (sorted_fields_type *) ggc_internal_alloc - (sizeof (struct sorted_fields_type) + len * sizeof (tree)); + ensure that this lives as long as the rest of the struct decl. + All decls in an inline function need to be saved. */ + + space = ((struct lang_type *) + ggc_internal_cleared_alloc (c_dialect_objc () + ? sizeof (struct lang_type) + : offsetof (struct lang_type, + info))); + space2 = ((sorted_fields_type *) + ggc_internal_alloc (sizeof (struct sorted_fields_type) + + len * sizeof (tree))); len = 0; space->s = space2; @@ -10269,7 +10274,10 @@ finish_enum (tree enumtype, tree values, tree attributes) /* Record the min/max values so that we can warn about bit-field enumerations that are too small for the values. */ - lt = ggc_cleared_alloc<struct lang_type> (); + lt = ((struct lang_type *) + ggc_internal_cleared_alloc (c_dialect_objc () + ? sizeof (struct lang_type) + : offsetof (struct lang_type, info))); lt->enum_min = minnode; lt->enum_max = maxnode; TYPE_LANG_SPECIFIC (enumtype) = lt; diff --git a/gcc/c/c-lang.h b/gcc/c/c-lang.h index 4b93d18..2e99b4d 100644 --- a/gcc/c/c-lang.h +++ b/gcc/c/c-lang.h @@ -35,10 +35,14 @@ struct GTY(()) lang_type { /* In an ENUMERAL_TYPE, the min and max values. */ tree enum_min; tree enum_max; - /* In a RECORD_TYPE, information specific to Objective-C, such - as a list of adopted protocols or a pointer to a corresponding - @interface. See objc/objc-act.h for details. */ - tree objc_info; + union maybe_objc_info { + /* If not c_dialect_objc, this part is not even allocated. */ + char GTY((tag ("0"))) non_objc; + /* In a RECORD_TYPE, information specific to Objective-C, such + as a list of adopted protocols or a pointer to a corresponding + @interface. See objc/objc-act.h for details. */ + tree GTY((tag ("1"))) objc_info; + } GTY ((desc ("c_dialect_objc ()"))) info; }; struct GTY(()) lang_decl { diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 85580c5..faa50a4 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -11146,8 +11146,14 @@ c_parser_generic_selection (c_parser *parser) "ISO C does not support use of type name as %<_Generic%> " "controlling operand before C2Y"); struct c_type_name *type = c_parser_type_name (parser); - selector_type = groktypename (type, NULL, NULL); + if (type) + selector_type = groktypename (type, NULL, NULL); c_inhibit_evaluation_warnings--; + if (!type) + { + c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL); + return error_expr; + } } else { diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 539d481..e24629b 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -136,6 +136,7 @@ static int lvalue_or_else (location_t, const_tree, enum lvalue_use); static void record_maybe_used_decl (tree); static bool comptypes_internal (const_tree, const_tree, struct comptypes_data *data); +static bool comptypes_check_for_composite (tree t1, tree t2); /* Return true if EXP is a null pointer constant, false otherwise. */ @@ -1002,15 +1003,13 @@ composite_type_internal (tree t1, tree t2, struct composite_cache* cache) tree composite_type (tree t1, tree t2) { + gcc_checking_assert (comptypes_check_for_composite (t1, t2)); + struct composite_cache cache = { }; tree n = composite_type_internal (t1, t2, &cache); - /* For function types there are some cases where qualifiers do - not match. See PR120510. */ - if (FUNCTION_TYPE != TREE_CODE (n)) - { - gcc_checking_assert (comptypes (n, t1)); - gcc_checking_assert (comptypes (n, t2)); - } + + gcc_checking_assert (comptypes_check_for_composite (n, t1)); + gcc_checking_assert (comptypes_check_for_composite (n, t2)); return n; } @@ -1454,16 +1453,39 @@ comptypes_verify (tree type1, tree type2) } struct comptypes_data { + + /* output */ bool enum_and_int_p; bool different_types_p; bool warning_needed; + + /* context */ bool anon_field; bool pointedto; + + /* configuration */ bool equiv; + bool ignore_promoting_args; const struct tagged_tu_seen_cache* cache; }; + +/* Helper function for composite_type. This function ignores when the + function type of an old-style declaration is incompatible with a type + of a declaration with prototype because some are arguments are not + self-promoting. This is ignored only for function types but not + ignored in a nested context. */ + +static bool +comptypes_check_for_composite (tree t1, tree t2) +{ + struct comptypes_data data = { }; + data.ignore_promoting_args = FUNCTION_TYPE == TREE_CODE (t1); + return comptypes_internal (t1, t2, &data); +} + + /* C implementation of compatible_types_for_indirection_note_p. */ bool @@ -1593,6 +1615,10 @@ comptypes_equiv_p (tree type1, tree type2) permitted in C11 typedef redeclarations, then this sets 'different_types_p' in DATA to true; it is never set to false, but may or may not be set if the types are incompatible. + If two functions types are not compatible only because one is + an old-style definition that does not have self-promoting arguments, + then this can be ignored by setting 'ignore_promoting_args_p'. + For 'equiv' we can compute equivalency classes (see above). This differs from comptypes, in that we don't free the seen types. */ @@ -2016,14 +2042,8 @@ static bool function_types_compatible_p (const_tree f1, const_tree f2, struct comptypes_data *data) { - tree args1, args2; - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - int val = 1; - int val1; - tree ret1, ret2; - - ret1 = TREE_TYPE (f1); - ret2 = TREE_TYPE (f2); + tree ret1 = TREE_TYPE (f1); + tree ret2 = TREE_TYPE (f2); /* 'volatile' qualifiers on a function's return type used to mean the function is noreturn. */ @@ -2035,12 +2055,17 @@ function_types_compatible_p (const_tree f1, const_tree f2, if (TYPE_VOLATILE (ret2)) ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2), TYPE_QUALS (ret2) & ~TYPE_QUAL_VOLATILE); - val = comptypes_internal (ret1, ret2, data); - if (val == 0) - return 0; - args1 = TYPE_ARG_TYPES (f1); - args2 = TYPE_ARG_TYPES (f2); + bool ignore_pargs = data->ignore_promoting_args; + data->ignore_promoting_args = false; + + if (!comptypes_internal (ret1, ret2, data)) + return false; + + data->ignore_promoting_args = ignore_pargs; + + tree args1 = TYPE_ARG_TYPES (f1); + tree args2 = TYPE_ARG_TYPES (f2); if ((args1 == NULL_TREE) != (args2 == NULL_TREE)) data->different_types_p = true; @@ -2051,40 +2076,33 @@ function_types_compatible_p (const_tree f1, const_tree f2, if (args1 == NULL_TREE) { if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2)) - return 0; - if (!self_promoting_args_p (args2)) - return 0; + return false; + if (!(data->ignore_promoting_args || self_promoting_args_p (args2))) + return false; + data->ignore_promoting_args = false; /* If one of these types comes from a non-prototype fn definition, compare that with the other type's arglist. If they don't match, ask for a warning (but no error). */ if (TYPE_ACTUAL_ARG_TYPES (f1) - && type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1), - data) != 1) - { - val = 1; - data->warning_needed = true; - } - return val; + && !type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1), data)) + data->warning_needed = true; + return true; } if (args2 == NULL_TREE) { if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2)) - return 0; - if (!self_promoting_args_p (args1)) - return 0; + return false; + if (!(data->ignore_promoting_args || self_promoting_args_p (args1))) + return false; + data->ignore_promoting_args = false; if (TYPE_ACTUAL_ARG_TYPES (f2) - && type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2), - data) != 1) - { - val = 1; - data->warning_needed = true; - } - return val; + && !type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2), data)) + data->warning_needed = true; + return true; } /* Both types have argument lists: compare them and propagate results. */ - val1 = type_lists_compatible_p (args1, args2, data); - return val1; + return type_lists_compatible_p (args1, args2, data); } /* Check two lists of types for compatibility, returning false for @@ -2101,7 +2119,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2, /* If one list is shorter than the other, they fail to match. */ if (args1 == NULL_TREE || args2 == NULL_TREE) - return 0; + return false; tree a1 = TREE_VALUE (args1); tree a2 = TREE_VALUE (args2); tree mv1 = remove_qualifiers (a1); @@ -2115,12 +2133,12 @@ type_lists_compatible_p (const_tree args1, const_tree args2, if (a1 == NULL_TREE) { if (c_type_promotes_to (a2) != a2) - return 0; + return false; } else if (a2 == NULL_TREE) { if (c_type_promotes_to (a1) != a1) - return 0; + return false; } /* If one of the lists has an error marker, ignore this arg. */ else if (TREE_CODE (a1) == ERROR_MARK @@ -2147,7 +2165,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2, break; } if (memb == NULL_TREE) - return 0; + return false; } else if (TREE_CODE (a2) == UNION_TYPE && (TYPE_NAME (a2) == NULL_TREE @@ -2165,10 +2183,10 @@ type_lists_compatible_p (const_tree args1, const_tree args2, break; } if (memb == NULL_TREE) - return 0; + return false; } else - return 0; + return false; } args1 = TREE_CHAIN (args1); diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 49b0b14..e1cdb71 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -2830,6 +2830,31 @@ expand_remove_edge (edge e) remove_edge (e); } +/* Split edge E during expansion and instead of creating a new + bb on that edge, add there BB. FLAGS should be flags on the + new edge from BB to former E->dest. */ + +static void +expand_split_edge (edge e, basic_block bb, int flags) +{ + unsigned int dest_idx = e->dest_idx; + basic_block dest = e->dest; + redirect_edge_succ (e, bb); + e = make_single_succ_edge (bb, dest, flags); + if ((dest->flags & BB_RTL) == 0 + && phi_nodes (dest) + && e->dest_idx != dest_idx) + { + /* If there are any PHI nodes on dest, swap the new succ edge + with the one moved into false_edge's former position, so that + PHI arguments don't need adjustment. */ + edge e2 = EDGE_PRED (dest, dest_idx); + std::swap (e->dest_idx, e2->dest_idx); + std::swap (EDGE_PRED (dest, e->dest_idx), + EDGE_PRED (dest, e2->dest_idx)); + } +} + /* A subroutine of expand_gimple_cond. Given E, a fallthrough edge of a basic block where we just expanded the conditional at the end, @@ -3013,7 +3038,7 @@ expand_gimple_cond (basic_block bb, gcond *stmt) new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb); dest = false_edge->dest; - redirect_edge_succ (false_edge, new_bb); + expand_split_edge (false_edge, new_bb, 0); false_edge->flags |= EDGE_FALLTHRU; new_bb->count = false_edge->count (); loop_p loop = find_common_loop (bb->loop_father, dest->loop_father); @@ -3021,7 +3046,6 @@ expand_gimple_cond (basic_block bb, gcond *stmt) if (loop->latch == bb && loop->header == dest) loop->latch = new_bb; - make_single_succ_edge (new_bb, dest, 0); if (BARRIER_P (BB_END (new_bb))) BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); update_bb_for_insn (new_bb); @@ -6525,7 +6549,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) static basic_block construct_init_block (void) { - basic_block init_block, first_block; + basic_block init_block; edge e = NULL; int flags; @@ -6556,11 +6580,7 @@ construct_init_block (void) init_block->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; add_bb_to_loop (init_block, ENTRY_BLOCK_PTR_FOR_FN (cfun)->loop_father); if (e) - { - first_block = e->dest; - redirect_edge_succ (e, init_block); - make_single_succ_edge (init_block, first_block, flags); - } + expand_split_edge (e, init_block, flags); else make_single_succ_edge (init_block, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FALLTHRU); diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 4a037a7..93353cb 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -179,26 +179,128 @@ cgraph_node::function_version (void) return cgraph_fnver_htab->find (&key); } -/* Scale profile by NUM/DEN. Walk into inlined clones. */ +/* If profile is IPA, turn it into local one. */ +void +cgraph_node::make_profile_local () +{ + if (!count.ipa ().initialized_p ()) + return; + if (!(count == profile_count::zero ())) + count = count.guessed_local (); + for (cgraph_edge *e = callees; e; e = e->next_callee) + { + if (!e->inline_failed) + e->callee->make_profile_local (); + if (!(e->count == profile_count::zero ())) + e->count = e->count.guessed_local (); + } + for (cgraph_edge *e = indirect_calls; e; e = e->next_callee) + if (!(e->count == profile_count::zero ())) + e->count = e->count.guessed_local (); +} +/* Turn profile to global0. Walk into inlined functions. + QUALITY must be GUESSED_GLOBAL0 or GUESSED_GLOBAL0_ADJUSTED */ void -cgraph_node::apply_scale (profile_count num, profile_count den) +cgraph_node::make_profile_global0 (profile_quality quality) { - struct cgraph_edge *e; + if (count == profile_count::zero ()) + ; + else if (quality == GUESSED_GLOBAL0) + { + if (count.quality () == GUESSED_GLOBAL0) + return; + count = count.global0 (); + } + else if (quality == GUESSED_GLOBAL0_ADJUSTED) + { + if (count.quality () == GUESSED_GLOBAL0 + || count.quality () == GUESSED_GLOBAL0_ADJUSTED) + return; + count = count.global0adjusted (); + } + else + gcc_unreachable (); + for (cgraph_edge *e = callees; e; e = e->next_callee) + { + if (!e->inline_failed) + e->callee->make_profile_global0 (quality); + if (e->count == profile_count::zero ()) + ; + else if (quality == GUESSED_GLOBAL0) + e->count = e->count.global0 (); + else if (quality == GUESSED_GLOBAL0_ADJUSTED) + e->count = e->count.global0adjusted (); + else + gcc_unreachable (); + } + for (cgraph_edge *e = indirect_calls; e; e = e->next_callee) + if (e->count == profile_count::zero ()) + ; + else if (quality == GUESSED_GLOBAL0) + e->count = e->count.global0 (); + else if (quality == GUESSED_GLOBAL0_ADJUSTED) + e->count = e->count.global0adjusted (); + else + gcc_unreachable (); +} - profile_count::adjust_for_ipa_scaling (&num, &den); +/* Scale profile by NUM/DEN. Walk into inlined functions. */ - for (e = callees; e; e = e->next_callee) +void +cgraph_node::apply_scale (profile_count num, profile_count den) +{ + if (num == den) + return; + + for (cgraph_edge *e = callees; e; e = e->next_callee) { if (!e->inline_failed) e->callee->apply_scale (num, den); e->count = e->count.apply_scale (num, den); } - for (e = indirect_calls; e; e = e->next_callee) + for (cgraph_edge *e = indirect_calls; e; e = e->next_callee) e->count = e->count.apply_scale (num, den); count = count.apply_scale (num, den); } +/* Scale profile to given IPA_COUNT. + IPA_COUNT should pass ipa_p () with a single exception. + It can be also GUESSED_LOCAL in case we want to + drop any IPA info about the profile. */ + +void +cgraph_node::scale_profile_to (profile_count ipa_count) +{ + /* If we do not know the adjustment, it is better to keep profile + as it is. */ + if (!ipa_count.initialized_p () + || ipa_count == count) + return; + /* ipa-cp converts value to guessed-local in case it believes + that we lost track of IPA profile. */ + if (ipa_count.quality () == GUESSED_LOCAL) + { + make_profile_local (); + return; + } + if (ipa_count == profile_count::zero ()) + { + make_profile_global0 (GUESSED_GLOBAL0); + return; + } + if (ipa_count == profile_count::adjusted_zero ()) + { + make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED); + return; + } + gcc_assert (ipa_count.ipa () == ipa_count + && !inlined_to); + profile_count num = count.combine_with_ipa_count (ipa_count); + profile_count den = count; + profile_count::adjust_for_ipa_scaling (&num, &den); +} + /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab corresponding to cgraph_node NODE. */ cgraph_function_version_info * @@ -251,45 +353,60 @@ cgraph_node::delete_function_version_by_decl (tree decl) decl_node->remove (); } -/* Record that DECL1 and DECL2 are semantically identical function +/* Add decl to the structure of semantically identical function versions. + The node is inserted at the point maintaining the priority ordering on the versions. */ void -cgraph_node::record_function_versions (tree decl1, tree decl2) +cgraph_node::add_function_version (cgraph_function_version_info *fn_v, + tree decl) { - cgraph_node *decl1_node = cgraph_node::get_create (decl1); - cgraph_node *decl2_node = cgraph_node::get_create (decl2); - cgraph_function_version_info *decl1_v = NULL; - cgraph_function_version_info *decl2_v = NULL; - cgraph_function_version_info *before; - cgraph_function_version_info *after; - - gcc_assert (decl1_node != NULL && decl2_node != NULL); - decl1_v = decl1_node->function_version (); - decl2_v = decl2_node->function_version (); + cgraph_node *decl_node = cgraph_node::get_create (decl); + cgraph_function_version_info *decl_v = NULL; - if (decl1_v != NULL && decl2_v != NULL) - return; + gcc_assert (decl_node != NULL); - if (decl1_v == NULL) - decl1_v = decl1_node->insert_new_function_version (); + decl_v = decl_node->function_version (); - if (decl2_v == NULL) - decl2_v = decl2_node->insert_new_function_version (); - - /* Chain decl2_v and decl1_v. All semantically identical versions - will be chained together. */ - - before = decl1_v; - after = decl2_v; + /* If the nodes are already linked, skip. */ + if (decl_v != NULL && (decl_v->next || decl_v->prev)) + return; - while (before->next != NULL) - before = before->next; + if (decl_v == NULL) + decl_v = decl_node->insert_new_function_version (); + + gcc_assert (decl_v); + gcc_assert (fn_v); + + /* Go to start of the FMV structure. */ + while (fn_v->prev) + fn_v = fn_v->prev; + + cgraph_function_version_info *insert_point_before = NULL; + cgraph_function_version_info *insert_point_after = fn_v; + + /* Find the insertion point for the new version to maintain ordering. + The default node must always go at the beginning. */ + if (!is_function_default_version (decl)) + while (insert_point_after + && (targetm.compare_version_priority + (decl, insert_point_after->this_node->decl) > 0 + || is_function_default_version + (insert_point_after->this_node->decl) + || lookup_attribute + ("target_clones", + DECL_ATTRIBUTES (insert_point_after->this_node->decl)))) + { + insert_point_before = insert_point_after; + insert_point_after = insert_point_after->next; + } - while (after->prev != NULL) - after= after->prev; + decl_v->prev = insert_point_before; + decl_v->next= insert_point_after; - before->next = after; - after->prev = before; + if (insert_point_before) + insert_point_before->next = decl_v; + if (insert_point_after) + insert_point_after->prev = decl_v; } /* Initialize callgraph dump file. */ diff --git a/gcc/cgraph.h b/gcc/cgraph.h index ba9a8a2..deca564 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1256,9 +1256,21 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node it is not used in any other non-standard way. */ bool only_called_directly_p (void); - /* Scale profile by NUM/DEN. Walk into inlined clones. */ + /* Turn profile to global0. Walk into inlined functions. */ + void make_profile_local (); + + /* Turn profile to global0. Walk into inlined functions. */ + void make_profile_global0 (profile_quality quality); + + /* Scale profile by NUM/DEN. Walk into inlined funtion. */ void apply_scale (profile_count num, profile_count den); + /* Scale profile to given IPA_COUNT. + IPA_COUNT should pass ipa_p () with a single exception. + It can be also GUESSED_LOCAL in case we want to + drop any IPA info about the profile. */ + void scale_profile_to (profile_count ipa_count); + /* Return true when function is only called directly or it has alias. i.e. it is not externally visible, address was not taken and it is not used in any other non-standard way. */ @@ -1327,9 +1339,9 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node return m_summary_id; } - /* Record that DECL1 and DECL2 are semantically identical function - versions. */ - static void record_function_versions (tree decl1, tree decl2); + /* Adds DECL to the FN_V structure of semantically identical functions. */ + static void add_function_version (cgraph_function_version_info *fn_v, + tree decl); /* Remove the cgraph_function_version_info and cgraph_node for DECL. This DECL is a duplicate declaration. */ diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index dff1523..4c1d1e9 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -1,3 +1,12 @@ +2025-06-10 James K. Lowden <jklowden@cobolworx.com> + + * Make-lang.in: cobol.clean does not remove libgcobol files. + * cdf.y: Suppress 1 cppcheck false positive. + * cdfval.h (scanner_parsing): Partial via cppcheck for PR119324. + * gcobol.1: Fix groff errors. + * gcobolspec.cc (append_arg): Const parameter. + * parse_ante.h (intrinsic_call_2): Avoid NULL dereference. + 2025-06-06 Robert Dubner <rdubner@symas.com> James K. Lowden <jklowden@cobolworx.com> diff --git a/gcc/config/aarch64/aarch64-sme.md b/gcc/config/aarch64/aarch64-sme.md index c49affd..f7958c9 100644 --- a/gcc/config/aarch64/aarch64-sme.md +++ b/gcc/config/aarch64/aarch64-sme.md @@ -373,6 +373,8 @@ (reg:DI SME_STATE_REGNUM) (reg:DI TPIDR2_SETUP_REGNUM) (reg:DI ZA_SAVED_REGNUM)] UNSPEC_RESTORE_ZA)) + (set (reg:DI SME_STATE_REGNUM) + (unspec:DI [(reg:DI SME_STATE_REGNUM)] UNSPEC_TPIDR2_RESTORE)) (clobber (reg:DI R0_REGNUM)) (clobber (reg:DI R14_REGNUM)) (clobber (reg:DI R15_REGNUM)) diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index c5d3e8c..7cb13e7 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -3948,6 +3948,7 @@ ;; ------------------------------------------------------------------------- ;; Includes: ;; - NOT +;; - NOTS ;; ------------------------------------------------------------------------- ;; Unpredicated predicate inverse. @@ -3972,6 +3973,42 @@ "not\t%0.b, %1/z, %2.b" ) +;; Predicated predicate inverse in which the flags are set in the same +;; way as a PTEST. +(define_insn "*one_cmpl<mode>3_cc" + [(set (reg:CC_NZC CC_REGNUM) + (unspec:CC_NZC + [(match_operand:VNx16BI 1 "register_operand" "Upa") + (match_operand 3) + (match_operand:SI 4 "aarch64_sve_ptrue_flag") + (and:PRED_ALL + (not:PRED_ALL + (match_operand:PRED_ALL 2 "register_operand" "Upa")) + (match_dup 3))] + UNSPEC_PTEST)) + (set (match_operand:PRED_ALL 0 "register_operand" "=Upa") + (and:PRED_ALL (not:PRED_ALL (match_dup 2)) (match_dup 3)))] + "TARGET_SVE" + "nots\t%0.b, %1/z, %2.b" +) + +;; Same, where only the flags result is interesting. +(define_insn "*one_cmpl<mode>3_ptest" + [(set (reg:CC_NZC CC_REGNUM) + (unspec:CC_NZC + [(match_operand:VNx16BI 1 "register_operand" "Upa") + (match_operand 3) + (match_operand:SI 4 "aarch64_sve_ptrue_flag") + (and:PRED_ALL + (not:PRED_ALL + (match_operand:PRED_ALL 2 "register_operand" "Upa")) + (match_dup 3))] + UNSPEC_PTEST)) + (clobber (match_scratch:PRED_ALL 0 "=Upa"))] + "TARGET_SVE" + "nots\t%0.b, %1/z, %2.b" +) + ;; ========================================================================= ;; == Binary arithmetic ;; ========================================================================= diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 59ac084..c8977b5 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -20862,7 +20862,6 @@ aarch64_get_function_versions_dispatcher (void *decl) struct cgraph_node *node = NULL; struct cgraph_node *default_node = NULL; struct cgraph_function_version_info *node_v = NULL; - struct cgraph_function_version_info *first_v = NULL; tree dispatch_decl = NULL; @@ -20879,37 +20878,16 @@ aarch64_get_function_versions_dispatcher (void *decl) if (node_v->dispatcher_resolver != NULL) return node_v->dispatcher_resolver; - /* Find the default version and make it the first node. */ - first_v = node_v; - /* Go to the beginning of the chain. */ - while (first_v->prev != NULL) - first_v = first_v->prev; - default_version_info = first_v; - while (default_version_info != NULL) - { - if (get_feature_mask_for_version - (default_version_info->this_node->decl) == 0ULL) - break; - default_version_info = default_version_info->next; - } + /* The default node is always the beginning of the chain. */ + default_version_info = node_v; + while (default_version_info->prev) + default_version_info = default_version_info->prev; + default_node = default_version_info->this_node; /* If there is no default node, just return NULL. */ - if (default_version_info == NULL) + if (!is_function_default_version (default_node->decl)) return NULL; - /* Make default info the first node. */ - if (first_v != default_version_info) - { - default_version_info->prev->next = default_version_info->next; - if (default_version_info->next) - default_version_info->next->prev = default_version_info->prev; - first_v->prev = default_version_info; - default_version_info->next = first_v; - default_version_info->prev = NULL; - } - - default_node = default_version_info->this_node; - if (targetm.has_ifunc_p ()) { struct cgraph_function_version_info *it_v = NULL; diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 6dbc9fa..e11e130 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -136,6 +136,14 @@ ;; The actual value can sometimes vary, because it does not track ;; changes to PSTATE.ZA that happen during a lazy save and restore. ;; Those effects are instead tracked by ZA_SAVED_REGNUM. + ;; + ;; Sequences also write to this register if they synchronize the + ;; actual contents of ZA and PSTATE.ZA with the current function's + ;; ZA_REGNUM and SME_STATE_REGNUM. Conceptually, these extra writes + ;; do not change the value of SME_STATE_REGNUM. They simply act as + ;; sequencing points. They means that all direct accesses to ZA can + ;; depend only on ZA_REGNUM and SME_STATE_REGNUM, rather than also + ;; depending on ZA_SAVED_REGNUM etc. (SME_STATE_REGNUM 89) ;; Instructions write to this register if they set TPIDR2_EL0 to a diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 01b8e4b..f8bbdc7 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -5273,6 +5273,41 @@ ;;<< << << << << << << << << << << << << << << << << << << << << << << << << << ;; arithmetic shift left +;; Work around PR120423: Transform left shift of a paradoxical subreg +;; into left shift of the zero-extended entity. +(define_split ; PR120423 + [(set (match_operand:HISI 0 "register_operand") + (ashift:HISI (subreg:HISI (match_operand:QIPSI 1 "nonimmediate_operand") + 0) + (match_operand:QI 2 "const_int_operand")))] + "!reload_completed + && !avropt_lra_p + && <HISI:SIZE> > <QIPSI:SIZE>" + [(set (match_dup 4) + (zero_extend:HISI (match_dup 5))) + (set (match_dup 0) + (ashift:HISI (match_dup 4) + (match_dup 2)))] + { + operands[4] = gen_reg_rtx (<HISI:MODE>mode); + operands[5] = force_reg (<QIPSI:MODE>mode, operands[1]); + }) + +;; Similar happens for PR116389. +(define_split ; PR116389 + [(set (match_operand:HISI 0 "register_operand") + (subreg:HISI (match_operand:QIPSI 1 "nonimmediate_operand") + 0))] + "!reload_completed + && !avropt_lra_p + && <HISI:SIZE> > <QIPSI:SIZE>" + [(set (match_dup 0) + (zero_extend:HISI (match_dup 2)))] + { + operands[2] = force_reg (<QIPSI:MODE>mode, operands[1]); + }) + + ;; "ashlqi3" ;; "ashlqq3" "ashluqq3" (define_expand "ashl<mode>3" diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 181e64a..4946f87 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -3609,7 +3609,11 @@ ix86_expand_int_movcc (rtx operands[]) negate_cc_compare_p = true; } - diff = ct - cf; + diff = (unsigned HOST_WIDE_INT) ct - cf; + /* Make sure we can represent the difference between the two values. */ + if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct)) + return false; + /* Sign bit compares are better done using shifts than we do by using sbb. */ if (sign_bit_compare_p @@ -3667,7 +3671,12 @@ ix86_expand_int_movcc (rtx operands[]) PUT_CODE (compare_op, reverse_condition (GET_CODE (compare_op))); } - diff = ct - cf; + + diff = (unsigned HOST_WIDE_INT) ct - cf; + /* Make sure we can represent the difference + between the two values. */ + if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct)) + return false; if (reg_overlap_mentioned_p (out, compare_op)) tmp = gen_reg_rtx (mode); @@ -3685,7 +3694,12 @@ ix86_expand_int_movcc (rtx operands[]) else { std::swap (ct, cf); - diff = ct - cf; + + diff = (unsigned HOST_WIDE_INT) ct - cf; + /* Make sure we can represent the difference + between the two values. */ + if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct)) + return false; } tmp = emit_store_flag (tmp, code, op0, op1, VOIDmode, 0, -1); } @@ -3752,9 +3766,15 @@ ix86_expand_int_movcc (rtx operands[]) tmp = expand_simple_unop (mode, NOT, tmp, copy_rtx (tmp), 1); } + HOST_WIDE_INT ival = (unsigned HOST_WIDE_INT) cf - ct; + /* Make sure we can represent the difference + between the two values. */ + if ((ival > 0) != ((ct < 0) != (cf < 0) ? ct < 0 : ct < cf)) + return false; + tmp = expand_simple_binop (mode, AND, copy_rtx (tmp), - gen_int_mode (cf - ct, mode), + gen_int_mode (ival, mode), copy_rtx (tmp), 1, OPTAB_DIRECT); if (ct) tmp = expand_simple_binop (mode, PLUS, @@ -3791,7 +3811,13 @@ ix86_expand_int_movcc (rtx operands[]) if (new_code != UNKNOWN) { std::swap (ct, cf); - diff = -diff; + + diff = (unsigned HOST_WIDE_INT) ct - cf; + /* Make sure we can represent the difference + between the two values. */ + if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct)) + return false; + code = new_code; } } @@ -3994,8 +4020,14 @@ ix86_expand_int_movcc (rtx operands[]) copy_rtx (out), 1, OPTAB_DIRECT); } + HOST_WIDE_INT ival = (unsigned HOST_WIDE_INT) cf - ct; + /* Make sure we can represent the difference + between the two values. */ + if ((ival > 0) != ((ct < 0) != (cf < 0) ? ct < 0 : ct < cf)) + return false; + out = expand_simple_binop (mode, AND, copy_rtx (out), - gen_int_mode (cf - ct, mode), + gen_int_mode (ival, mode), copy_rtx (out), 1, OPTAB_DIRECT); if (ct) out = expand_simple_binop (mode, PLUS, copy_rtx (out), GEN_INT (ct), diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index b1682c2..56ab7f2 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -4284,7 +4284,6 @@ ix86_get_function_versions_dispatcher (void *decl) struct cgraph_node *node = NULL; struct cgraph_node *default_node = NULL; struct cgraph_function_version_info *node_v = NULL; - struct cgraph_function_version_info *first_v = NULL; tree dispatch_decl = NULL; @@ -4301,37 +4300,16 @@ ix86_get_function_versions_dispatcher (void *decl) if (node_v->dispatcher_resolver != NULL) return node_v->dispatcher_resolver; - /* Find the default version and make it the first node. */ - first_v = node_v; - /* Go to the beginning of the chain. */ - while (first_v->prev != NULL) - first_v = first_v->prev; - default_version_info = first_v; - while (default_version_info != NULL) - { - if (is_function_default_version - (default_version_info->this_node->decl)) - break; - default_version_info = default_version_info->next; - } + /* The default node is always the beginning of the chain. */ + default_version_info = node_v; + while (default_version_info->prev != NULL) + default_version_info = default_version_info->prev; + default_node = default_version_info->this_node; /* If there is no default node, just return NULL. */ - if (default_version_info == NULL) + if (!is_function_default_version (default_node->decl)) return NULL; - /* Make default info the first node. */ - if (first_v != default_version_info) - { - default_version_info->prev->next = default_version_info->next; - if (default_version_info->next) - default_version_info->next->prev = default_version_info->prev; - first_v->prev = default_version_info; - default_version_info->next = first_v; - default_version_info->prev = NULL; - } - - default_node = default_version_info->this_node; - #if defined (ASM_OUTPUT_TYPE_DIRECTIVE) if (targetm.has_ifunc_p ()) { diff --git a/gcc/config/i386/x86-tune-sched.cc b/gcc/config/i386/x86-tune-sched.cc index 15d3d91..61b1a26 100644 --- a/gcc/config/i386/x86-tune-sched.cc +++ b/gcc/config/i386/x86-tune-sched.cc @@ -80,6 +80,7 @@ ix86_issue_rate (void) case PROCESSOR_ALDERLAKE: case PROCESSOR_YONGFENG: case PROCESSOR_SHIJIDADAO: + case PROCESSOR_SIERRAFOREST: case PROCESSOR_GENERIC: /* For znver5 decoder can handle 4 or 8 instructions per cycle, op cache 12 instruction/cycle, dispatch 8 instructions @@ -99,6 +100,14 @@ ix86_issue_rate (void) return 5; case PROCESSOR_SAPPHIRERAPIDS: + case PROCESSOR_GRANITERAPIDS: + case PROCESSOR_GRANITERAPIDS_D: + case PROCESSOR_DIAMONDRAPIDS: + case PROCESSOR_GRANDRIDGE: + case PROCESSOR_CLEARWATERFOREST: + case PROCESSOR_ARROWLAKE: + case PROCESSOR_ARROWLAKE_S: + case PROCESSOR_PANTHERLAKE: return 6; default: diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc index cd5f2c5..c4fc145 100644 --- a/gcc/config/mcore/mcore.cc +++ b/gcc/config/mcore/mcore.cc @@ -2984,9 +2984,7 @@ mcore_mark_dllimport (tree decl) /* ??? At least I think that's why we do this. */ idp = get_identifier (newname); - newrtl = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (Pmode, - IDENTIFIER_POINTER (idp))); + newrtl = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp)); XEXP (DECL_RTL (decl), 0) = newrtl; } diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc index 62e2168..f1c92c6 100644 --- a/gcc/config/or1k/or1k.cc +++ b/gcc/config/or1k/or1k.cc @@ -1408,8 +1408,9 @@ static bool or1k_can_change_mode_class (machine_mode from, machine_mode to, reg_class_t rclass) { + /* Allow cnoverting special flags to SI mode subregs. */ if (rclass == FLAG_REGS) - return from == to; + return from == to || (from == BImode && to == SImode); return true; } diff --git a/gcc/config/riscv/autovec-opt.md b/gcc/config/riscv/autovec-opt.md index 4465eb2..e829313 100644 --- a/gcc/config/riscv/autovec-opt.md +++ b/gcc/config/riscv/autovec-opt.md @@ -1719,9 +1719,11 @@ ;; Include ;; - vfmadd.vf ;; - vfmsub.vf +;; - vfnmadd.vf +;; - vfnmsub.vf ;; ============================================================================= - +;; vfmadd.vf, vfmsub.vf (define_insn_and_split "*<optab>_vf_<mode>" [(set (match_operand:V_VLSF 0 "register_operand" "=vd") (plus_minus:V_VLSF @@ -1744,9 +1746,10 @@ [(set_attr "type" "vfmuladd")] ) -(define_insn_and_split "*<optab>_vf_<mode>" +;; vfnmsub.vf +(define_insn_and_split "*vfnmsub_<mode>" [(set (match_operand:V_VLSF 0 "register_operand" "=vd") - (plus_minus:V_VLSF + (minus:V_VLSF (match_operand:V_VLSF 3 "register_operand" " vr") (mult:V_VLSF (vec_duplicate:V_VLSF @@ -1759,7 +1762,31 @@ { rtx ops[] = {operands[0], operands[1], operands[2], operands[3], operands[2]}; - riscv_vector::emit_vlmax_insn (code_for_pred_mul_scalar (<CODE>, <MODE>mode), + riscv_vector::emit_vlmax_insn (code_for_pred_mul_neg_scalar (PLUS, <MODE>mode), + riscv_vector::TERNARY_OP_FRM_DYN, ops); + DONE; + } + [(set_attr "type" "vfmuladd")] +) + +;; vfnmadd.vf +(define_insn_and_split "*vfnmadd_<mode>" + [(set (match_operand:V_VLSF 0 "register_operand" "=vd") + (minus:V_VLSF + (mult:V_VLSF + (neg:V_VLSF + (match_operand:V_VLSF 2 "register_operand" " 0")) + (vec_duplicate:V_VLSF + (match_operand:<VEL> 1 "register_operand" " f"))) + (match_operand:V_VLSF 3 "register_operand" " vr")))] + "TARGET_VECTOR && can_create_pseudo_p ()" + "#" + "&& 1" + [(const_int 0)] + { + rtx ops[] = {operands[0], operands[1], operands[2], operands[3], + operands[2]}; + riscv_vector::emit_vlmax_insn (code_for_pred_mul_neg_scalar (MINUS, <MODE>mode), riscv_vector::TERNARY_OP_FRM_DYN, ops); DONE; } diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 420baa5..ef69991 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -5537,6 +5537,7 @@ expand_vx_binary_vec_dup_vec (rtx op_0, rtx op_1, rtx op_2, case IOR: case XOR: case MULT: + case SMAX: icode = code_for_pred_scalar (code, mode); break; case MINUS: @@ -5571,6 +5572,7 @@ expand_vx_binary_vec_vec_dup (rtx op_0, rtx op_1, rtx op_2, case UDIV: case MOD: case UMOD: + case SMAX: icode = code_for_pred_scalar (code, mode); break; default: diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index d5ab128..f6608bd 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -302,6 +302,7 @@ struct riscv_tune_param bool vector_unaligned_access; bool use_divmod_expansion; bool overlap_op_by_pieces; + bool speculative_sched_vsetvl; unsigned int fusible_ops; const struct cpu_vector_cost *vec_costs; const char *function_align; @@ -464,6 +465,7 @@ static const struct riscv_tune_param rocket_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -486,6 +488,7 @@ static const struct riscv_tune_param sifive_7_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -508,6 +511,7 @@ static const struct riscv_tune_param sifive_p400_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_LUI_ADDI | RISCV_FUSE_AUIPC_ADDI, /* fusible_ops */ &generic_vector_cost, /* vector cost */ NULL, /* function_align */ @@ -530,6 +534,7 @@ static const struct riscv_tune_param sifive_p600_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_LUI_ADDI | RISCV_FUSE_AUIPC_ADDI, /* fusible_ops */ &generic_vector_cost, /* vector cost */ NULL, /* function_align */ @@ -552,6 +557,7 @@ static const struct riscv_tune_param thead_c906_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -574,6 +580,7 @@ static const struct riscv_tune_param xiangshan_nanhu_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_ZEXTW | RISCV_FUSE_ZEXTH, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -596,6 +603,7 @@ static const struct riscv_tune_param generic_ooo_tune_info = { true, /* vector_unaligned_access */ false, /* use_divmod_expansion */ true, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ &generic_vector_cost, /* vector cost */ NULL, /* function_align */ @@ -618,6 +626,7 @@ static const struct riscv_tune_param tt_ascalon_d8_tune_info = { true, /* vector_unaligned_access */ true, /* use_divmod_expansion */ true, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ &generic_vector_cost, /* vector cost */ NULL, /* function_align */ @@ -640,6 +649,7 @@ static const struct riscv_tune_param optimize_size_tune_info = { false, /* vector_unaligned_access */ false, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -662,6 +672,7 @@ static const struct riscv_tune_param mips_p8700_tune_info = { false, /* vector_unaligned_access */ true, /* use_divmod_expansion */ false, /* overlap_op_by_pieces */ + false, /* speculative_sched_vsetvl */ RISCV_FUSE_NOTHING, /* fusible_ops */ NULL, /* vector cost */ NULL, /* function_align */ @@ -3911,6 +3922,8 @@ get_vector_binary_rtx_cost (rtx x, int scalar2vr_cost) if (GET_CODE (op_0) == VEC_DUPLICATE || GET_CODE (op_1) == VEC_DUPLICATE) return (scalar2vr_cost + 1) * COSTS_N_INSNS (1); + else if (GET_CODE (op_0) == NEG && GET_CODE (op_1) == VEC_DUPLICATE) + return (scalar2vr_cost + 1) * COSTS_N_INSNS (1); else return COSTS_N_INSNS (1); } @@ -3965,6 +3978,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN case IOR: case XOR: case MULT: + case SMAX: { rtx op; rtx op_0 = XEXP (x, 0); @@ -10439,6 +10453,27 @@ riscv_sched_adjust_cost (rtx_insn *, int, rtx_insn *insn, int cost, return new_cost; } +/* Implement TARGET_SCHED_CAN_SPECULATE_INSN hook. Return true if insn can + can be scheduled for speculative execution. Reject vsetvl instructions to + prevent the scheduler from hoisting them out of basic blocks without + checking for data dependencies PR117974. */ +static bool +riscv_sched_can_speculate_insn (rtx_insn *insn) +{ + /* Gate speculative scheduling of vsetvl instructions behind tune param. */ + if (tune_param->speculative_sched_vsetvl) + return true; + + switch (get_attr_type (insn)) + { + case TYPE_VSETVL: + case TYPE_VSETVL_PRE: + return false; + default: + return true; + } +} + /* Auxiliary function to emit RISC-V ELF attribute. */ static void riscv_emit_attribute () @@ -13919,7 +13954,6 @@ riscv_get_function_versions_dispatcher (void *decl) struct cgraph_node *node = NULL; struct cgraph_node *default_node = NULL; struct cgraph_function_version_info *node_v = NULL; - struct cgraph_function_version_info *first_v = NULL; tree dispatch_decl = NULL; @@ -13936,41 +13970,16 @@ riscv_get_function_versions_dispatcher (void *decl) if (node_v->dispatcher_resolver != NULL) return node_v->dispatcher_resolver; - /* Find the default version and make it the first node. */ - first_v = node_v; - /* Go to the beginning of the chain. */ - while (first_v->prev != NULL) - first_v = first_v->prev; - default_version_info = first_v; - - while (default_version_info != NULL) - { - struct riscv_feature_bits res; - int priority; /* Unused. */ - parse_features_for_version (default_version_info->this_node->decl, - res, priority); - if (res.length == 0) - break; - default_version_info = default_version_info->next; - } + /* The default node is always the beginning of the chain. */ + default_version_info = node_v; + while (default_version_info->prev) + default_version_info = default_version_info->prev; + default_node = default_version_info->this_node; /* If there is no default node, just return NULL. */ - if (default_version_info == NULL) + if (!is_function_default_version (default_node->decl)) return NULL; - /* Make default info the first node. */ - if (first_v != default_version_info) - { - default_version_info->prev->next = default_version_info->next; - if (default_version_info->next) - default_version_info->next->prev = default_version_info->prev; - first_v->prev = default_version_info; - default_version_info->next = first_v; - default_version_info->prev = NULL; - } - - default_node = default_version_info->this_node; - if (targetm.has_ifunc_p ()) { struct cgraph_function_version_info *it_v = NULL; @@ -14743,6 +14752,9 @@ synthesize_and (rtx operands[3]) #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST riscv_sched_adjust_cost +#undef TARGET_SCHED_CAN_SPECULATE_INSN +#define TARGET_SCHED_CAN_SPECULATE_INSN riscv_sched_can_speculate_insn + #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL riscv_function_ok_for_sibcall diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md index 42fc04c..c9b836c 100644 --- a/gcc/config/riscv/vector-iterators.md +++ b/gcc/config/riscv/vector-iterators.md @@ -4042,11 +4042,11 @@ ]) (define_code_iterator any_int_binop_no_shift_v_vdup [ - plus minus and ior xor mult div udiv mod umod + plus minus and ior xor mult div udiv mod umod smax ]) (define_code_iterator any_int_binop_no_shift_vdup_v [ - plus minus and ior xor mult + plus minus and ior xor mult smax ]) (define_code_iterator any_int_unop [neg not]) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 7375c36..7ee26e5 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -25312,7 +25312,6 @@ rs6000_get_function_versions_dispatcher (void *decl) struct cgraph_node *node = NULL; struct cgraph_node *default_node = NULL; struct cgraph_function_version_info *node_v = NULL; - struct cgraph_function_version_info *first_v = NULL; tree dispatch_decl = NULL; @@ -25332,38 +25331,16 @@ rs6000_get_function_versions_dispatcher (void *decl) if (node_v->dispatcher_resolver != NULL) return node_v->dispatcher_resolver; - /* Find the default version and make it the first node. */ - first_v = node_v; - /* Go to the beginning of the chain. */ - while (first_v->prev != NULL) - first_v = first_v->prev; - - default_version_info = first_v; - while (default_version_info != NULL) - { - const tree decl2 = default_version_info->this_node->decl; - if (is_function_default_version (decl2)) - break; - default_version_info = default_version_info->next; - } + /* The default node is always the beginning of the chain. */ + default_version_info = node_v; + while (default_version_info->prev) + default_version_info = default_version_info->prev; + default_node = default_version_info->this_node; /* If there is no default node, just return NULL. */ - if (default_version_info == NULL) + if (!is_function_default_version (default_node->decl)) return NULL; - /* Make default info the first node. */ - if (first_v != default_version_info) - { - default_version_info->prev->next = default_version_info->next; - if (default_version_info->next) - default_version_info->next->prev = default_version_info->prev; - first_v->prev = default_version_info; - default_version_info->next = first_v; - default_version_info->prev = NULL; - } - - default_node = default_version_info->this_node; - #ifndef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB error_at (DECL_SOURCE_LOCATION (default_node->decl), "%<target_clones%> attribute needs GLIBC (2.23 and newer) that " diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8ffde5c..41d68ed 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,42 @@ +2025-06-14 Iain Sandoe <iain@sandoe.co.uk> + + * coroutines.cc (build_co_await): Identify diagnostics + for initial and final await expressions. + (cp_coroutine_transform::wrap_original_function_body): Do + not handle initial and final await expressions here ... + (cp_coroutine_transform::apply_transforms): ... handle them + here and avoid duplicate diagnostics. + * coroutines.h: Declare inital and final await expressions + in the transform class. Save the function closing brace + location. + +2025-06-13 Iain Sandoe <iain@sandoe.co.uk> + + PR c++/116775 + * coroutines.cc (analyze_expression_awaits): When we see + a builtin_constant_p call, and that contains one or more + await expressions, then replace the call with its result + and discard the unevaluated operand. + +2025-06-13 Iain Sandoe <iain@sandoe.co.uk> + + * coroutines.cc (build_actor_fn): Set can_throw. + +2025-06-12 Alfie Richards <alfie.richards@arm.com> + + * decl.cc (maybe_version_functions): Change record_function_versions + call to add_function_version. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + * cp-tree.h (union lang_type::maybe_objc_info): New type. + (struct lang_type): Use union maybe_objc_info info member + instead of tree objc_info. + * lex.cc (copy_lang_type): Use sizeof (struct lang_type) + just for ObjC++ and otherwise offsetof (struct lang_type, info). + (maybe_add_lang_type_raw): Likewise. + (cxx_make_type): Formatting fix. + 2025-06-09 Iain Sandoe <iain@sandoe.co.uk> PR c++/120495 diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 97eee6e..4057a07 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -1277,8 +1277,14 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind, if (TREE_CODE (o_type) != RECORD_TYPE) { - error_at (loc, "awaitable type %qT is not a structure", - o_type); + if (suspend_kind == FINAL_SUSPEND_POINT) + error_at (loc, "%qs awaitable type %qT is not a structure", + "final_suspend()", o_type); + else if (suspend_kind == INITIAL_SUSPEND_POINT) + error_at (loc, "%qs awaitable type %qT is not a structure", + "initial_suspend()", o_type); + else + error_at (loc, "awaitable type %qT is not a structure", o_type); return error_mark_node; } @@ -2406,6 +2412,11 @@ build_actor_fn (location_t loc, tree coro_frame_type, tree actor, tree fnbody, bool spf = start_preparsed_function (actor, NULL_TREE, SF_PRE_PARSED); gcc_checking_assert (spf); gcc_checking_assert (cfun && current_function_decl && TREE_STATIC (actor)); + if (flag_exceptions) + /* We, unconditionally, add a try/catch and rethrow. + TODO: Determine if the combination of initial suspend and the original + body cannot throw, and elide these additions. */ + cp_function_chain->can_throw = true; tree stmt = begin_function_body (); tree actor_bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); @@ -3420,7 +3431,8 @@ maybe_promote_temps (tree *stmt, void *d) return cp_walk_tree (stmt, register_awaits, d, &visited); } -/* Lightweight callback to determine two key factors: +/* Relatively lightweight callback to do initial assessment: + 0) Rewrite some await expressions. 1) If the statement/expression contains any await expressions. 2) If the statement/expression potentially requires a re-write to handle TRUTH_{AND,OR}IF_EXPRs since, in most cases, they will need expansion @@ -3437,6 +3449,26 @@ analyze_expression_awaits (tree *stmt, int *do_subtree, void *d) switch (TREE_CODE (*stmt)) { default: return NULL_TREE; + case CALL_EXPR: + { + tree fn = cp_get_callee_fndecl_nofold (*stmt); + /* Special-cases where we want to re-write await expressions to some + other value before they are otherwise processed. */ + if (fn && DECL_IS_BUILTIN_CONSTANT_P (fn)) + { + gcc_checking_assert (call_expr_nargs (*stmt) == 1); + tree expr = CALL_EXPR_ARG (*stmt, 0); + if (cp_walk_tree (&expr, find_any_await, nullptr, NULL)) + { + if (TREE_CONSTANT (maybe_constant_value (expr))) + *stmt = integer_one_node; + else + *stmt = integer_zero_node; + } + *do_subtree = 0; + } + } + break; case CO_YIELD_EXPR: /* co_yield is syntactic sugar, re-write it to co_await. */ *stmt = TREE_OPERAND (*stmt, 1); @@ -4330,7 +4362,6 @@ cp_coroutine_transform::wrap_original_function_body () /* Wrap the function body in a try {} catch (...) {} block, if exceptions are enabled. */ tree var_list = NULL_TREE; - tree initial_await = build_init_or_final_await (fn_start, false); /* [stmt.return.coroutine] / 3 If p.return_void() is a valid expression, flowing off the end of a @@ -4524,7 +4555,8 @@ cp_coroutine_transform::wrap_original_function_body () zero_resume = build2_loc (loc, MODIFY_EXPR, act_des_fn_ptr_type, resume_fn_ptr, zero_resume); finish_expr_stmt (zero_resume); - finish_expr_stmt (build_init_or_final_await (fn_start, true)); + finish_expr_stmt (final_await); + BIND_EXPR_BODY (update_body) = pop_stmt_list (BIND_EXPR_BODY (update_body)); BIND_EXPR_VARS (update_body) = nreverse (var_list); BLOCK_VARS (top_block) = BIND_EXPR_VARS (update_body); @@ -5181,9 +5213,10 @@ cp_coroutine_transform::cp_coroutine_transform (tree _orig_fn, bool _inl) } /* We don't have the locus of the opening brace - it's filled in later (and - there doesn't really seem to be any easy way to get at it). - The closing brace is assumed to be input_location. */ + there doesn't really seem to be any easy way to get at it). */ fn_start = DECL_SOURCE_LOCATION (orig_fn_decl); + /* The closing brace is assumed to be input_location. */ + fn_end = input_location; /* Build types we need. */ tree fr_name = get_fn_local_identifier (orig_fn_decl, "Frame"); @@ -5262,6 +5295,16 @@ cp_coroutine_transform::apply_transforms () = coro_build_actor_or_destroy_function (orig_fn_decl, act_des_fn_type, frame_ptr_type, false); + /* Avoid repeating diagnostics about promise or awaiter fails. */ + if (!seen_error ()) + { + iloc_sentinel stable_input_loc (fn_start); + initial_await = build_init_or_final_await (fn_start, false); + input_location = fn_end; + if (initial_await && initial_await != error_mark_node) + final_await = build_init_or_final_await (fn_end, true); + } + /* Transform the function body as per [dcl.fct.def.coroutine] / 5. */ wrap_original_function_body (); diff --git a/gcc/cp/coroutines.h b/gcc/cp/coroutines.h index 55caa6e..919dc9a 100644 --- a/gcc/cp/coroutines.h +++ b/gcc/cp/coroutines.h @@ -102,6 +102,7 @@ private: tree orig_fn_decl; /* The original function decl. */ tree orig_fn_body = NULL_TREE; /* The original function body. */ location_t fn_start = UNKNOWN_LOCATION; + location_t fn_end = UNKNOWN_LOCATION; tree resumer = error_mark_node; tree destroyer = error_mark_node; tree coroutine_body = NULL_TREE; @@ -126,6 +127,9 @@ private: bool inline_p = false; bool valid_coroutine = false; + tree initial_await = error_mark_node; + tree final_await = error_mark_node; + void analyze_fn_parms (); void wrap_original_function_body (); bool build_ramp_function (); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3cf4a76..d663d6e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2514,12 +2514,16 @@ struct GTY(()) lang_type { tree key_method; tree decl_list; tree befriending_classes; - /* In a RECORD_TYPE, information specific to Objective-C++, such - as a list of adopted protocols or a pointer to a corresponding - @interface. See objc/objc-act.h for details. */ - tree objc_info; /* FIXME reuse another field? */ tree lambda_expr; + union maybe_objc_info { + /* If not c_dialect_objc, this part is not even allocated. */ + char GTY((tag ("0"))) non_objc; + /* In a RECORD_TYPE, information specific to Objective-C, such + as a list of adopted protocols or a pointer to a corresponding + @interface. See objc/objc-act.h for details. */ + tree GTY((tag ("1"))) objc_info; + } GTY ((desc ("c_dialect_objc ()"))) info; }; /* We used to have a variant type for lang_type. Keep the name of the diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 9a20ed6..4c8a205 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -1311,7 +1311,15 @@ maybe_version_functions (tree newdecl, tree olddecl, bool record) } if (record) - cgraph_node::record_function_versions (olddecl, newdecl); + { + /* Add the new version to the function version structure. */ + cgraph_node *fn_node = cgraph_node::get_create (olddecl); + cgraph_function_version_info *fn_v = fn_node->function_version (); + if (!fn_v) + fn_v = fn_node->insert_new_function_version (); + + cgraph_node::add_function_version (fn_v, newdecl); + } return true; } diff --git a/gcc/cp/lex.cc b/gcc/cp/lex.cc index 12af81e..08a6348 100644 --- a/gcc/cp/lex.cc +++ b/gcc/cp/lex.cc @@ -1082,15 +1082,17 @@ copy_lang_type (tree node) if (! TYPE_LANG_SPECIFIC (node)) return; - auto *lt = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type)); + size_t sz = (c_dialect_objc () ? sizeof (struct lang_type) + : offsetof (struct lang_type, info)); + auto *lt = (struct lang_type *) ggc_internal_alloc (sz); - memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type))); + memcpy (lt, TYPE_LANG_SPECIFIC (node), sz); TYPE_LANG_SPECIFIC (node) = lt; if (GATHER_STATISTICS) { tree_node_counts[(int)lang_type] += 1; - tree_node_sizes[(int)lang_type] += sizeof (struct lang_type); + tree_node_sizes[(int)lang_type] += sz; } } @@ -1114,14 +1116,15 @@ maybe_add_lang_type_raw (tree t) if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t))) return false; - auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc - (sizeof (struct lang_type))); + size_t sz = (c_dialect_objc () ? sizeof (struct lang_type) + : offsetof (struct lang_type, info)); + auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc (sz)); TYPE_LANG_SPECIFIC (t) = lt; if (GATHER_STATISTICS) { tree_node_counts[(int)lang_type] += 1; - tree_node_sizes[(int)lang_type] += sizeof (struct lang_type); + tree_node_sizes[(int)lang_type] += sz; } return true; @@ -1135,8 +1138,8 @@ cxx_make_type (enum tree_code code MEM_STAT_DECL) if (maybe_add_lang_type_raw (t)) { /* Set up some flags that give proper default behavior. */ - struct c_fileinfo *finfo = - get_fileinfo (LOCATION_FILE (input_location)); + struct c_fileinfo *finfo + = get_fileinfo (LOCATION_FILE (input_location)); SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown); CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only; } diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc index ddf6ba0..45d0881 100644 --- a/gcc/diagnostic-format-html.cc +++ b/gcc/diagnostic-format-html.cc @@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-format-text.h" #include "diagnostic-output-file.h" #include "diagnostic-buffer.h" +#include "diagnostic-path.h" +#include "diagnostic-client-data-hooks.h" #include "selftest.h" #include "selftest-diagnostic.h" #include "pretty-print-format-impl.h" @@ -40,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "xml.h" #include "xml-printer.h" #include "json.h" +#include "selftest-xml.h" // struct html_generation_options @@ -139,26 +142,45 @@ public: } private: + void + add_stylesheet (std::string url); + std::unique_ptr<xml::element> make_element_for_diagnostic (const diagnostic_info &diagnostic, - diagnostic_t orig_diag_kind); + diagnostic_t orig_diag_kind, + bool alert); std::unique_ptr<xml::element> make_metadata_element (label_text label, label_text url); + void + add_at_nesting_level (size_t nesting_level, + std::unique_ptr<xml::element> child_diag_element); + + void + push_nesting_level (); + + void + pop_nesting_level (); + diagnostic_context &m_context; pretty_printer *m_printer; const line_maps *m_line_maps; html_generation_options m_html_gen_opts; + const logical_location_manager *m_logical_loc_mgr; std::unique_ptr<xml::document> m_document; xml::element *m_head_element; xml::element *m_title_element; xml::element *m_diagnostics_element; std::unique_ptr<xml::element> m_cur_diagnostic_element; + std::vector<xml::element *> m_cur_nesting_levels; int m_next_diag_id; // for handing out unique IDs json::array m_ui_focus_ids; + logical_location m_last_logical_location; + location_t m_last_location; + expanded_location m_last_expanded_location; }; static std::unique_ptr<xml::element> @@ -237,8 +259,10 @@ static const char * const HTML_STYLE " .ruler { color: red;\n" " white-space: pre; }\n" " .source { color: blue;\n" + " background-color: white;\n" " white-space: pre; }\n" " .annotation { color: green;\n" + " background-color: white;\n" " white-space: pre; }\n" " .linenum-gap { text-align: center;\n" " border-top: 1px solid black;\n" @@ -269,6 +293,8 @@ static const char * const HTML_STYLE " font-weight: bold; }\n" " .highlight-b { color: #3f9c35;\n" // pf-green-400 " font-weight: bold; }\n" + " .gcc-quoted-text { font-weight: bold;\n" + " font-family: mono; }\n" " </style>\n"); /* A little JavaScript for ease of navigation. @@ -351,13 +377,19 @@ html_builder::html_builder (diagnostic_context &context, m_printer (&pp), m_line_maps (line_maps), m_html_gen_opts (html_gen_opts), + m_logical_loc_mgr (nullptr), m_head_element (nullptr), m_title_element (nullptr), m_diagnostics_element (nullptr), - m_next_diag_id (0) + m_next_diag_id (0), + m_last_location (UNKNOWN_LOCATION), + m_last_expanded_location ({}) { gcc_assert (m_line_maps); + if (auto client_data_hooks = context.get_client_data_hooks ()) + m_logical_loc_mgr = client_data_hooks->get_logical_location_manager (); + m_document = std::make_unique<xml::document> (); m_document->m_doctypedecl = std::make_unique<html_doctypedecl> (); { @@ -374,15 +406,20 @@ html_builder::html_builder (diagnostic_context &context, xml::auto_print_element title (xp, "title", true); m_title_element = xp.get_insertion_point (); } + if (m_html_gen_opts.m_css) - xp.add_raw (HTML_STYLE); + { + add_stylesheet ("https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.24.0/css/patternfly.min.css"); + add_stylesheet ("https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.24.0/css/patternfly-additions.min.css"); + xp.add_raw (HTML_STYLE); + } if (m_html_gen_opts.m_javascript) { xp.push_tag ("script"); /* Escaping rules are different for HTML <script> elements, so add the script "raw" for now. */ xp.add_raw (HTML_SCRIPT); - xp.pop_tag (); // script + xp.pop_tag ("script"); } } @@ -408,6 +445,18 @@ html_builder::set_main_input_filename (const char *name) } } +void +html_builder::add_stylesheet (std::string url) +{ + gcc_assert (m_head_element); + + xml::printer xp (*m_head_element); + xp.push_tag ("link", false); + xp.set_attr ("rel", "stylesheet"); + xp.set_attr ("type", "text/css"); + xp.set_attr ("href", std::move (url)); +} + /* Implementation of "on_report_diagnostic" for HTML output. */ void @@ -425,8 +474,14 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic, fnotice (stderr, "Internal compiler error:\n"); } + const int nesting_level = m_context.get_diagnostic_nesting_level (); + bool alert = true; + if (m_cur_diagnostic_element && nesting_level > 0) + alert = false; + if (!m_cur_diagnostic_element) + m_last_logical_location = logical_location (); auto diag_element - = make_element_for_diagnostic (diagnostic, orig_diag_kind); + = make_element_for_diagnostic (diagnostic, orig_diag_kind, alert); if (buffer) { gcc_assert (!m_cur_diagnostic_element); @@ -435,14 +490,79 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic, else { if (m_cur_diagnostic_element) - /* Nested diagnostic. */ - m_cur_diagnostic_element->add_child (std::move (diag_element)); + { + /* Nested diagnostic. */ + gcc_assert (nesting_level >= 0); + add_at_nesting_level (nesting_level, std::move (diag_element)); + } else /* Top-level diagnostic. */ - m_cur_diagnostic_element = std::move (diag_element); + { + m_cur_diagnostic_element = std::move (diag_element); + m_cur_nesting_levels.clear (); + } } } +// For ease of comparison with experimental-nesting-show-levels=yes + +static void +add_nesting_level_attr (xml::element &element, + int nesting_level) +{ + element.set_attr ("nesting-level", std::to_string (nesting_level)); +} + +void +html_builder:: +add_at_nesting_level (size_t nesting_level, + std::unique_ptr<xml::element> child_diag_element) +{ + gcc_assert (m_cur_diagnostic_element); + while (nesting_level > m_cur_nesting_levels.size ()) + push_nesting_level (); + while (nesting_level < m_cur_nesting_levels.size ()) + pop_nesting_level (); + + if (nesting_level > 0) + { + gcc_assert (!m_cur_nesting_levels.empty ()); + auto current_nesting_level = m_cur_nesting_levels.back (); + xml::printer xp (*current_nesting_level); + xp.push_tag ("li"); + add_nesting_level_attr (*xp.get_insertion_point (), + m_cur_nesting_levels.size ()); + xp.append (std::move (child_diag_element)); + xp.pop_tag ("li"); + } + else + m_cur_diagnostic_element->add_child (std::move (child_diag_element)); +} + +void +html_builder::push_nesting_level () +{ + gcc_assert (m_cur_diagnostic_element); + auto new_nesting_level = std::make_unique<xml::element> ("ul", false); + add_nesting_level_attr (*new_nesting_level, + m_cur_nesting_levels.size () + 1); + xml::element *current_nesting_level = nullptr; + if (!m_cur_nesting_levels.empty ()) + current_nesting_level = m_cur_nesting_levels.back (); + m_cur_nesting_levels.push_back (new_nesting_level.get ()); + if (current_nesting_level) + current_nesting_level->add_child (std::move (new_nesting_level)); + else + m_cur_diagnostic_element->add_child (std::move (new_nesting_level)); +} + +void +html_builder::pop_nesting_level () +{ + gcc_assert (m_cur_diagnostic_element); + m_cur_nesting_levels.pop_back (); +} + /* Custom subclass of html_label_writer. Wrap labels within a <span> element, supplying them with event IDs. Add the IDs to the list of focus IDs. */ @@ -472,7 +592,7 @@ public: void end_label () final override { - m_xp.pop_tag (); // span + m_xp.pop_tag ("span"); // from begin_label } private: @@ -482,81 +602,225 @@ private: int m_next_event_idx; }; -std::unique_ptr<xml::element> -html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, - diagnostic_t orig_diag_kind) +/* See https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts */ +static const char * +get_pf_class_for_alert_div (diagnostic_t diag_kind) { - class html_token_printer : public token_printer - { - public: - html_token_printer (xml::printer &xp) - : m_xp (xp) + switch (diag_kind) { + case DK_DEBUG: + case DK_NOTE: + return "alert alert-info"; + + case DK_ANACHRONISM: + case DK_WARNING: + return "alert alert-warning"; + + case DK_ERROR: + case DK_SORRY: + case DK_ICE: + case DK_ICE_NOBT: + case DK_FATAL: + return "alert alert-danger"; + + default: + gcc_unreachable (); } - void print_tokens (pretty_printer */*pp*/, - const pp_token_list &tokens) final override +} + +static const char * +get_pf_class_for_alert_icon (diagnostic_t diag_kind) +{ + switch (diag_kind) { - /* Implement print_tokens by adding child elements to - m_parent_element. */ - for (auto iter = tokens.m_first; iter; iter = iter->m_next) - switch (iter->m_kind) + case DK_DEBUG: + case DK_NOTE: + return "pficon pficon-info"; + + case DK_ANACHRONISM: + case DK_WARNING: + return "pficon pficon-warning-triangle-o"; + + case DK_ERROR: + case DK_SORRY: + case DK_ICE: + case DK_ICE_NOBT: + case DK_FATAL: + return "pficon pficon-error-circle-o"; + + default: + gcc_unreachable (); + } +} + +static const char * +get_label_for_logical_location_kind (enum logical_location_kind kind) +{ + switch (kind) + { + default: + gcc_unreachable (); + case logical_location_kind::unknown: + return nullptr; + + /* Kinds within executable code. */ + case logical_location_kind::function: + return "Function"; + case logical_location_kind::member: + return "Member"; + case logical_location_kind::module_: + return "Module"; + case logical_location_kind::namespace_: + return "Namespace"; + case logical_location_kind::type: + return "Type"; + case logical_location_kind::return_type: + return "Return type"; + case logical_location_kind::parameter: + return "Parameter"; + case logical_location_kind::variable: + return "Variable"; + + /* Kinds within XML or HTML documents. */ + case logical_location_kind::element: + return "Element"; + case logical_location_kind::attribute: + return "Attribute"; + case logical_location_kind::text: + return "Text"; + case logical_location_kind::comment: + return "Comment"; + case logical_location_kind::processing_instruction: + return "Processing Instruction"; + case logical_location_kind::dtd: + return "DTD"; + case logical_location_kind::declaration: + return "Declaration"; + + /* Kinds within JSON documents. */ + case logical_location_kind::object: + return "Object"; + case logical_location_kind::array: + return "Array"; + case logical_location_kind::property: + return "Property"; + case logical_location_kind::value: + return "Value"; + } +} + +static void +add_labelled_value (xml::printer &xp, + std::string id, + std::string label, + std::string value, + bool quote_value) +{ + xp.push_tag ("div", true); + xp.set_attr ("id", id); + xp.push_tag ("span"); + xp.add_text (label); + xp.add_text (" "); + xp.pop_tag ("span"); + xp.push_tag ("span"); + if (quote_value) + xp.set_attr ("class", "gcc-quoted-text"); + xp.add_text (std::move (value)); + xp.pop_tag ("span"); + xp.pop_tag ("div"); +} + +class html_token_printer : public token_printer +{ +public: + html_token_printer (xml::element &parent_element) + /* Ideally pp_token_lists that reach a token_printer should be + "balanced", but for now they can have mismatching pp_tokens + e.g. a begin_color without an end_color (PR other/120610). + Give html_token_printer its own xml::printer as a firewall to + limit the scope of the mismatches in the HTML. */ + : m_xp (parent_element, + /* Similarly we don't check that the popped tags match. */ + false) + { + } + void print_tokens (pretty_printer */*pp*/, + const pp_token_list &tokens) final override + { + /* Implement print_tokens by adding child elements to + m_parent_element. */ + for (auto iter = tokens.m_first; iter; iter = iter->m_next) + switch (iter->m_kind) + { + default: + gcc_unreachable (); + + case pp_token::kind::text: { - default: - gcc_unreachable (); - - case pp_token::kind::text: - { - pp_token_text *sub = as_a <pp_token_text *> (iter); - /* The value might be in the obstack, so we may need to - copy it. */ - m_xp.add_text (sub->m_value.get ()); + pp_token_text *sub = as_a <pp_token_text *> (iter); + /* The value might be in the obstack, so we may need to + copy it. */ + m_xp.add_text (sub->m_value.get ()); } - break; + break; - case pp_token::kind::begin_color: - { - pp_token_begin_color *sub = as_a <pp_token_begin_color *> (iter); - gcc_assert (sub->m_value.get ()); - m_xp.push_tag_with_class ("span", sub->m_value.get ()); - } - break; + case pp_token::kind::begin_color: + { + pp_token_begin_color *sub = as_a <pp_token_begin_color *> (iter); + gcc_assert (sub->m_value.get ()); + m_xp.push_tag_with_class ("span", sub->m_value.get ()); + } + break; - case pp_token::kind::end_color: - m_xp.pop_tag (); - break; + case pp_token::kind::end_color: + m_xp.pop_tag ("span"); + break; - case pp_token::kind::begin_quote: - { - m_xp.add_text (open_quote); - m_xp.push_tag_with_class ("span", "gcc-quoted-text"); - } - break; - case pp_token::kind::end_quote: - { - m_xp.pop_tag (); - m_xp.add_text (close_quote); - } - break; + case pp_token::kind::begin_quote: + { + m_xp.add_text (open_quote); + m_xp.push_tag_with_class ("span", "gcc-quoted-text"); + } + break; + case pp_token::kind::end_quote: + { + m_xp.pop_tag ("span"); + m_xp.add_text (close_quote); + } + break; - case pp_token::kind::begin_url: - { - pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter); - m_xp.push_tag ("a", true); - m_xp.set_attr ("href", sub->m_value.get ()); - } - break; - case pp_token::kind::end_url: - m_xp.pop_tag (); - break; + case pp_token::kind::begin_url: + { + pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter); + m_xp.push_tag ("a", true); + m_xp.set_attr ("href", sub->m_value.get ()); } - } + break; + case pp_token::kind::end_url: + m_xp.pop_tag ("a"); + break; + } + } - private: - xml::printer &m_xp; - }; +private: + xml::printer m_xp; +}; - auto diag_element = make_div ("gcc-diagnostic"); +/* Make a <div class="gcc-diagnostic"> for DIAGNOSTIC. + If ALERT is true, make it be a PatternFly alert (see + https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts) and + show severity text (e.g. "error: "). + + If ALERT is false, don't show the severity text and don't show + the filename if it's the same as the previous diagnostic within the + diagnostic group. */ + +std::unique_ptr<xml::element> +html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, + diagnostic_t orig_diag_kind, + bool alert) +{ const int diag_idx = m_next_diag_id++; std::string diag_id; { @@ -564,30 +828,75 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, pp_printf (&pp, "gcc-diag-%i", diag_idx); diag_id = pp_formatted_text (&pp); } - diag_element->set_attr ("id", diag_id); // TODO: might be nice to emulate the text output format, but colorize it - auto message_span = make_span ("gcc-message"); - std::string message_span_id (diag_id + "-message"); - message_span->set_attr ("id", message_span_id); - add_focus_id (message_span_id); + /* See https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts + which has this example: +<div class="alert alert-danger"> + <span class="pficon pficon-error-circle-o"></span> + <strong>Hey there is a problem!</strong> Yeah this is really messed up and you should <a href="#" class="alert-link">know about it</a>. +</div> + */ + auto diag_element = make_div ("gcc-diagnostic"); + diag_element->set_attr ("id", diag_id); + if (alert) + diag_element->set_attr ("class", + get_pf_class_for_alert_div (diagnostic.kind)); + + xml::printer xp (*diag_element.get ()); + const size_t depth_within_alert_div = 1; + + gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); + + if (alert) + { + xp.push_tag_with_class ("span", + get_pf_class_for_alert_icon (diagnostic.kind), + true); + xp.add_text (" "); + xp.pop_tag ("span"); + } + + // The rest goes in the <div>... + gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); + + xp.push_tag_with_class ("div", "gcc-message", true); + std::string message_alert_id (diag_id + "-message"); + xp.set_attr ("id", message_alert_id); + add_focus_id (message_alert_id); + + const size_t depth_within_message_div = depth_within_alert_div + 1; + gcc_assert (xp.get_num_open_tags () == depth_within_message_div); - xml::printer xp (*message_span.get ()); - html_token_printer tok_printer (xp); + // Severity e.g. "warning: " + bool show_severity = true; + if (!alert) + show_severity = false; + if (show_severity) + { + xp.push_tag ("strong"); + xp.add_text (_(get_diagnostic_kind_text (diagnostic.kind))); + xp.pop_tag ("strong"); + xp.add_text (" "); + } + + // Add the message itself: + html_token_printer tok_printer (*xp.get_insertion_point ()); m_printer->set_token_printer (&tok_printer); pp_output_formatted_text (m_printer, m_context.get_urlifier ()); m_printer->set_token_printer (nullptr); pp_clear_output_area (m_printer); - diag_element->add_child (std::move (message_span)); + // Add any metadata as a suffix to the message if (diagnostic.metadata) { - diag_element->add_text (" "); - diag_element->add_child - (make_element_for_metadata (*diagnostic.metadata)); + xp.add_text (" "); + xp.append (make_element_for_metadata (*diagnostic.metadata)); } + // Add any option as a suffix to the message + label_text option_text = label_text::take (m_context.make_option_name (diagnostic.option_id, orig_diag_kind, diagnostic.kind)); @@ -596,7 +905,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, label_text option_url = label_text::take (m_context.make_option_url (diagnostic.option_id)); - diag_element->add_text (" "); + xp.add_text (" "); auto option_span = make_span ("gcc-option"); option_span->add_text ("["); { @@ -611,35 +920,110 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, option_span->add_text (option_text.get ()); option_span->add_text ("]"); } - diag_element->add_child (std::move (option_span)); + xp.append (std::move (option_span)); + } + + gcc_assert (xp.get_num_open_tags () == depth_within_message_div); + + xp.pop_tag ("div"); + + gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); + + /* Show any logical location. */ + if (m_logical_loc_mgr) + if (auto client_data_hooks = m_context.get_client_data_hooks ()) + if (auto logical_loc = client_data_hooks->get_current_logical_location ()) + if (logical_loc != m_last_logical_location) + { + enum logical_location_kind kind + = m_logical_loc_mgr->get_kind (logical_loc);; + if (const char *label = get_label_for_logical_location_kind (kind)) + if (const char *name_with_scope + = m_logical_loc_mgr->get_name_with_scope (logical_loc)) + add_labelled_value (xp, "logical-location", + label, name_with_scope, true); + m_last_logical_location = logical_loc; + } + + /* Show any physical location. */ + const expanded_location s + = diagnostic_expand_location (&diagnostic); + if (s != m_last_expanded_location + || alert) + { + if (s.file + && (s.file != m_last_expanded_location.file + || alert)) + add_labelled_value (xp, "file", "File", s.file, false); + if (s.line) + { + add_labelled_value (xp, "line", "Line", std::to_string (s.line), false); + diagnostic_column_policy column_policy (m_context); + int converted_column = column_policy.converted_column (s); + if (converted_column >= 0) + add_labelled_value (xp, "column", "Column", + std::to_string (converted_column), + false); + } + if (s.file) + m_last_expanded_location = s; } /* Source (and fix-it hints). */ { - xml::printer xp (*diag_element); - m_context.m_last_location = UNKNOWN_LOCATION; + // TODO: m_context.m_last_location should be moved into the sink + location_t saved = m_context.m_last_location; + m_context.m_last_location = m_last_location; m_context.maybe_show_locus_as_html (*diagnostic.richloc, m_context.m_source_printing, diagnostic.kind, xp, nullptr, nullptr); + m_context.m_last_location = saved; + m_last_location = m_context.m_last_location; } + gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); + /* Execution path. */ if (auto path = diagnostic.richloc->get_path ()) { - xml::printer xp (*diag_element); + xp.push_tag ("div"); + xp.set_attr ("id", "execution-path"); + + xp.push_tag ("label", true); + const int num_events = path->num_events (); + pretty_printer pp; + pp_printf_n (&pp, num_events, + "Execution path with %i event", + "Execution path with %i events", + num_events); + xp.add_text_from_pp (pp); + xp.pop_tag ("label"); + std::string event_id_prefix (diag_id + "-event-"); html_path_label_writer event_label_writer (xp, *this, event_id_prefix); diagnostic_source_print_policy dspp (m_context); print_path_as_html (xp, *path, m_context, &event_label_writer, dspp); + + xp.pop_tag ("div"); } + gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); + if (auto patch_element = make_element_for_patch (diagnostic)) - diag_element->add_child (std::move (patch_element)); + { + xp.push_tag ("div"); + xp.set_attr ("id", "suggested-fix"); + xp.push_tag ("label", true); + xp.add_text ("Suggested fix"); + xp.pop_tag ("label"); + xp.append (std::move (patch_element)); + xp.pop_tag ("div"); + } return diag_element; } @@ -680,7 +1064,7 @@ html_builder::make_metadata_element (label_text label, } xp.add_text (label.get ()); if (url.get ()) - xp.pop_tag (); + xp.pop_tag ("a"); } xp.add_text ("]"); return item; @@ -755,7 +1139,7 @@ html_builder::flush_to_file (FILE *outf) m_ui_focus_ids.print (&pp, true); pp_string (&pp, ";\n"); xp.add_raw (pp_formatted_text (&pp)); - xp.pop_tag (); // script + xp.pop_tag ("script"); } auto top = m_document.get (); top->dump (outf); @@ -946,6 +1330,53 @@ make_html_sink (diagnostic_context &context, namespace selftest { +/* Helper for writing tests of html_token_printer. + Printing to m_pp will appear as HTML within m_top_element, a <div>. */ + +struct token_printer_test +{ + token_printer_test () + : m_top_element ("div", true), + m_tok_printer (m_top_element) + { + m_pp.set_token_printer (&m_tok_printer); + } + + xml::element m_top_element; + html_token_printer m_tok_printer; + pretty_printer m_pp; +}; + +static void +test_token_printer () +{ + { + token_printer_test t; + pp_printf (&t.m_pp, "hello world"); + ASSERT_XML_PRINT_EQ + (t.m_top_element, + "<div>hello world</div>\n"); + } + + { + token_printer_test t; + pp_printf (&t.m_pp, "%qs: %qs", "foo", "bar"); + ASSERT_XML_PRINT_EQ + (t.m_top_element, + "<div>" + "`" + "<span class=\"gcc-quoted-text\">" + "foo" + "</span>" + "': `" + "<span class=\"gcc-quoted-text\">" + "bar" + "</span>" + "'" + "</div>\n"); + } +} + /* A subclass of html_output_format for writing selftests. The XML output is cached internally, rather than written out to a file. */ @@ -1011,10 +1442,8 @@ test_simple_log () const xml::document &doc = dc.get_document (); - pretty_printer pp; - doc.write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (doc, ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE html\n" " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" @@ -1025,8 +1454,9 @@ test_simple_log () " </head>\n" " <body>\n" " <div class=\"gcc-diagnostic-list\">\n" - " <div class=\"gcc-diagnostic\" id=\"gcc-diag-0\">\n" - " <span class=\"gcc-message\" id=\"gcc-diag-0-message\">this is a test: `<span class=\"gcc-quoted-text\">foo</span>'</span>\n" + " <div class=\"alert alert-danger\" id=\"gcc-diag-0\">\n" + " <span class=\"pficon pficon-error-circle-o\"> </span>\n" + " <div class=\"gcc-message\" id=\"gcc-diag-0-message\"><strong>error: </strong> this is a test: `<span class=\"gcc-quoted-text\">foo</span>'</div>\n" " </div>\n" " </div>\n" " </body>\n" @@ -1043,10 +1473,8 @@ test_metadata () diagnostic_metadata metadata; metadata.add_cwe (415); auto element = b.make_element_for_metadata (metadata); - pretty_printer pp; - element->write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (*element, "<span class=\"gcc-metadata\">" "<span class=\"gcc-metadata-item\">" "[" @@ -1064,10 +1492,8 @@ test_metadata () "http://example.com"); metadata.add_rule (rule); auto element = b.make_element_for_metadata (metadata); - pretty_printer pp; - element->write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (*element, "<span class=\"gcc-metadata\">" "<span class=\"gcc-metadata-item\">" "[" @@ -1086,6 +1512,7 @@ void diagnostic_format_html_cc_tests () { auto_fix_quotes fix_quotes; + test_token_printer (); test_simple_log (); test_metadata (); } diff --git a/gcc/diagnostic-path-output.cc b/gcc/diagnostic-path-output.cc index 4c17865..bae24bf 100644 --- a/gcc/diagnostic-path-output.cc +++ b/gcc/diagnostic-path-output.cc @@ -321,7 +321,7 @@ begin_html_stack_frame (xml::printer &xp, { xp.push_tag_with_class ("td", "interprocmargin", false); xp.set_attr ("style", "padding-left: 100px"); - xp.pop_tag (); + xp.pop_tag ("td"); } xp.push_tag_with_class ("td", "stack-frame", false); label_text funcname @@ -331,8 +331,8 @@ begin_html_stack_frame (xml::printer &xp, xp.push_tag_with_class ("div", "frame-funcname", false); xp.push_tag ("span", true); xp.add_text (funcname.get ()); - xp.pop_tag (); // span - xp.pop_tag (); // div + xp.pop_tag ("span"); + xp.pop_tag ("div"); } } return std::make_unique<stack_frame> (std::move (parent), @@ -350,9 +350,9 @@ end_html_stack_frame (xml::printer &xp, auto parent = std::move (frame->m_parent); if (frame->m_logical_loc) { - xp.pop_tag (); // td - xp.pop_tag (); // tr - xp.pop_tag (); // table + xp.pop_tag ("td"); + xp.pop_tag ("tr"); + xp.pop_tag ("table"); } return parent; } @@ -689,7 +689,7 @@ struct event_range iter_event.print_desc (pp); if (event_label_writer) event_label_writer->begin_label (); - xp.add_text (pp_formatted_text (&pp)); + xp.add_text_from_pp (pp); if (event_label_writer) event_label_writer->end_label (); } @@ -1230,7 +1230,7 @@ print_path_summary_as_html (const path_summary &ps, { xp.push_tag_with_class ("span", "funcname", true); xp.add_text (funcname.get ()); - xp.pop_tag (); //span + xp.pop_tag ("span"); xp.add_text (": "); } } @@ -1243,8 +1243,8 @@ print_path_summary_as_html (const path_summary &ps, else pp_printf (&pp, "events %i-%i", range->m_start_idx + 1, range->m_end_idx + 1); - xp.add_text (pp_formatted_text (&pp)); - xp.pop_tag (); // span + xp.add_text_from_pp (pp); + xp.pop_tag ("span"); } if (show_depths) { @@ -1252,10 +1252,10 @@ print_path_summary_as_html (const path_summary &ps, xp.push_tag_with_class ("span", "depth", true); pretty_printer pp; pp_printf (&pp, "(depth %i)", range->m_stack_depth); - xp.add_text (pp_formatted_text (&pp)); - xp.pop_tag (); //span + xp.add_text_from_pp (pp); + xp.pop_tag ("span"); } - xp.pop_tag (); // div + xp.pop_tag ("div"); /* Print a run of events. */ thread_event_printer &tep = thread_event_printers[swimlane_idx]; @@ -1267,16 +1267,16 @@ print_path_summary_as_html (const path_summary &ps, range, &effect_info); last_out_edge_column = effect_info.m_trailing_out_edge_column; - xp.pop_tag (); // td - xp.pop_tag (); // tr - xp.pop_tag (); // table + xp.pop_tag ("td"); + xp.pop_tag ("tr"); + xp.pop_tag ("table"); } /* Close outstanding frames. */ while (curr_frame) curr_frame = end_html_stack_frame (xp, std::move (curr_frame)); - xp.pop_tag (); // div + xp.pop_tag ("div"); } } /* end of anonymous namespace for path-printing code. */ diff --git a/gcc/diagnostic-show-locus.cc b/gcc/diagnostic-show-locus.cc index 3654102..ffb72da 100644 --- a/gcc/diagnostic-show-locus.cc +++ b/gcc/diagnostic-show-locus.cc @@ -408,6 +408,12 @@ struct to_text { friend class layout_printer<to_text>; + // This is a RAII class for HTML, but is a no-op for text. + struct auto_check_tag_nesting + { + auto_check_tag_nesting (to_text &) {} + }; + to_text (pretty_printer &pp, colorizer &colorizer) : m_pp (pp), @@ -446,7 +452,7 @@ struct to_text { // no-op for text } - void pop_html_tag (std::string) + void pop_html_tag (const char *) { // no-op for text } @@ -538,6 +544,16 @@ struct to_html { friend class layout_printer<to_html>; + // RAII class for ensuring that the tags nested correctly + struct auto_check_tag_nesting : public xml::auto_check_tag_nesting + { + public: + auto_check_tag_nesting (to_html &sink) + : xml::auto_check_tag_nesting (sink.m_xp) + { + } + }; + to_html (xml::printer &xp, const rich_location *richloc, html_label_writer *html_label_writer) @@ -569,9 +585,9 @@ struct to_html preserve_whitespace); } - void pop_html_tag (std::string /*name*/) + void pop_html_tag (const char *expected_name) { - m_xp.pop_tag (); + m_xp.pop_tag (expected_name); } void add_html_tag_with_class (std::string name, @@ -598,7 +614,7 @@ struct to_html { pp_clear_output_area (&m_scratch_pp); pp_unicode_character (&m_scratch_pp, ch); - m_xp.add_text (pp_formatted_text (&m_scratch_pp)); + m_xp.add_text_from_pp (m_scratch_pp); } void add_utf8_byte (char b) @@ -728,7 +744,7 @@ default_diagnostic_start_span_fn<to_html> (const diagnostic_location_print_polic false); sink.m_xp.push_tag_with_class ("span", "location", true); sink.m_xp.add_text (text.get ()); - sink.m_xp.pop_tag (); // span + sink.m_xp.pop_tag ("span"); } namespace { @@ -2719,7 +2735,7 @@ layout_printer<to_html>::end_label (int range_idx, bool is_label_text) { if (m_sink.get_highlight_color_for_range_idx (range_idx)) - m_sink.m_xp.pop_tag (); + m_sink.m_xp.pop_tag ("span"); if (is_label_text && m_sink.m_html_label_writer) m_sink.m_html_label_writer->end_label (); @@ -3438,6 +3454,8 @@ template<typename Sink> void layout_printer<Sink>::print_trailing_fixits (linenum_type row) { + typename Sink::auto_check_tag_nesting sentinel (m_sink); + /* Build a list of correction instances for the line, potentially consolidating hints (for the sake of readability). */ line_corrections corrections (m_layout.m_file_cache, m_layout.m_char_policy, @@ -3509,9 +3527,6 @@ layout_printer<Sink>::print_trailing_fixits (linenum_type row) } } - if (!corrections.m_corrections.is_empty ()) - m_sink.pop_html_tag ("td"); - /* Add a trailing newline, if necessary. */ move_to_column (&column, 1 + m_layout.m_x_offset_display, false); } @@ -3691,6 +3706,8 @@ template<typename Sink> void layout_printer<Sink>::print_line (linenum_type row) { + typename Sink::auto_check_tag_nesting sentinel (m_sink); + char_span line = m_layout.m_file_cache.get_source_line (m_layout.m_exploc.file, row); if (!line) @@ -3948,6 +3965,7 @@ diagnostic_source_print_policy::print_as_html (xml::printer &xp, to_html sink (xp, &richloc, label_writer); layout_printer<to_html> lp (sink, layout, diagnostic_kind == DK_DIAGNOSTIC_PATH); + xml::auto_check_tag_nesting sentinel (xp); lp.print (*this); } @@ -3955,6 +3973,8 @@ template <typename Sink> void layout_printer<Sink>::print (const diagnostic_source_print_policy &source_policy) { + typename Sink::auto_check_tag_nesting sentinel (m_sink); + m_sink.push_html_tag_with_class ("table", "locus", false); if (get_options ().show_ruler_p) diff --git a/gcc/expr.cc b/gcc/expr.cc index 08a58fb..ac4fdfa 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -9879,14 +9879,68 @@ expand_expr_real_2 (const_sepops ops, rtx target, machine_mode tmode, op0 = gen_rtx_fmt_e (TYPE_UNSIGNED (TREE_TYPE (treeop0)) ? ZERO_EXTEND : SIGN_EXTEND, mode, op0); + else if (SCALAR_INT_MODE_P (GET_MODE (op0)) + && optimize >= 2 + && SCALAR_INT_MODE_P (mode) + && (GET_MODE_SIZE (as_a <scalar_int_mode> (mode)) + > GET_MODE_SIZE (as_a <scalar_int_mode> (GET_MODE (op0)))) + && get_range_pos_neg (treeop0, + currently_expanding_gimple_stmt) == 1) + { + /* If argument is known to be positive when interpreted + as signed, we can expand it as both sign and zero + extension. Choose the cheaper sequence in that case. */ + bool speed_p = optimize_insn_for_speed_p (); + rtx uns_ret = NULL_RTX, sgn_ret = NULL_RTX; + do_pending_stack_adjust (); + start_sequence (); + if (target == NULL_RTX) + uns_ret = convert_to_mode (mode, op0, 1); + else + convert_move (target, op0, 1); + rtx_insn *uns_insns = end_sequence (); + start_sequence (); + if (target == NULL_RTX) + sgn_ret = convert_to_mode (mode, op0, 0); + else + convert_move (target, op0, 0); + rtx_insn *sgn_insns = end_sequence (); + unsigned uns_cost = seq_cost (uns_insns, speed_p); + unsigned sgn_cost = seq_cost (sgn_insns, speed_p); + bool was_tie = false; + + /* If costs are the same then use as tie breaker the other other + factor. */ + if (uns_cost == sgn_cost) + { + uns_cost = seq_cost (uns_insns, !speed_p); + sgn_cost = seq_cost (sgn_insns, !speed_p); + was_tie = true; + } + + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, ";; positive extension:%s unsigned cost: %u; " + "signed cost: %u\n", + was_tie ? " (needed tie breaker)" : "", + uns_cost, sgn_cost); + if (uns_cost < sgn_cost + || (uns_cost == sgn_cost && TYPE_UNSIGNED (TREE_TYPE (treeop0)))) + { + emit_insn (uns_insns); + sgn_ret = uns_ret; + } + else + emit_insn (sgn_insns); + if (target == NULL_RTX) + op0 = sgn_ret; + else + op0 = target; + } else if (target == 0) - op0 = convert_to_mode (mode, op0, - TYPE_UNSIGNED (TREE_TYPE - (treeop0))); + op0 = convert_to_mode (mode, op0, TYPE_UNSIGNED (TREE_TYPE (treeop0))); else { - convert_move (target, op0, - TYPE_UNSIGNED (TREE_TYPE (treeop0))); + convert_move (target, op0, TYPE_UNSIGNED (TREE_TYPE (treeop0))); op0 = target; } diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 857eb72..7a19e5e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2025-06-12 Yuao Ma <c8ef@outlook.com> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/113152 + * intrinsic.texi: Document new half-revolution trigonometric + functions. Reorder doc for atand. + 2025-06-06 Tobias Burnus <tburnus@baylibre.com> Sandra Loosemore <sloosemore@baylibre.com> diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 48c2d60..5831995 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -24,15 +24,22 @@ Some basic guidelines for editing this document: @tex \gdef\acosd{\mathop{\rm acosd}\nolimits} -\gdef\asind{\mathop{\rm asind}\nolimits} -\gdef\atand{\mathop{\rm atand}\nolimits} -\gdef\acos{\mathop{\rm acos}\nolimits} -\gdef\asin{\mathop{\rm asin}\nolimits} -\gdef\atan{\mathop{\rm atan}\nolimits} \gdef\acosh{\mathop{\rm acosh}\nolimits} +\gdef\acospi{\mathop{\rm acospi}\nolimits} +\gdef\acos{\mathop{\rm acos}\nolimits} +\gdef\asind{\mathop{\rm asind}\nolimits} \gdef\asinh{\mathop{\rm asinh}\nolimits} +\gdef\asinpi{\mathop{\rm asinpi}\nolimits} +\gdef\asin{\mathop{\rm asin}\nolimits} +\gdef\atan2pi{\mathop{\rm atan2pi}\nolimits} +\gdef\atand{\mathop{\rm atand}\nolimits} \gdef\atanh{\mathop{\rm atanh}\nolimits} +\gdef\atanpi{\mathop{\rm atanpi}\nolimits} +\gdef\atan{\mathop{\rm atan}\nolimits} \gdef\cosd{\mathop{\rm cosd}\nolimits} +\gdef\cospi{\mathop{\rm cospi}\nolimits} +\gdef\sinpi{\mathop{\rm sinpi}\nolimits} +\gdef\tanpi{\mathop{\rm tanpi}\nolimits} @end tex @@ -49,6 +56,7 @@ Some basic guidelines for editing this document: * @code{ACOS}: ACOS, Arccosine function * @code{ACOSD}: ACOSD, Arccosine function, degrees * @code{ACOSH}: ACOSH, Inverse hyperbolic cosine function +* @code{ACOSPI}: ACOSPI, Circular arc cosine function * @code{ADJUSTL}: ADJUSTL, Left adjust a string * @code{ADJUSTR}: ADJUSTR, Right adjust a string * @code{AIMAG}: AIMAG, Imaginary part of complex number @@ -62,12 +70,15 @@ Some basic guidelines for editing this document: * @code{ASIN}: ASIN, Arcsine function * @code{ASIND}: ASIND, Arcsine function, degrees * @code{ASINH}: ASINH, Inverse hyperbolic sine function +* @code{ASINPI}: ASINPI, Circular arc sine function * @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair * @code{ATAN}: ATAN, Arctangent function -* @code{ATAND}: ATAND, Arctangent function, degrees * @code{ATAN2}: ATAN2, Arctangent function * @code{ATAN2D}: ATAN2D, Arctangent function, degrees +* @code{ATAN2PI}: ATAN2PI, Circular arc tangent function +* @code{ATAND}: ATAND, Arctangent function, degrees * @code{ATANH}: ATANH, Inverse hyperbolic tangent function +* @code{ATANPI}: ATANPI, Circular arc tangent function * @code{ATOMIC_ADD}: ATOMIC_ADD, Atomic ADD operation * @code{ATOMIC_AND}: ATOMIC_AND, Atomic bitwise AND operation * @code{ATOMIC_CAS}: ATOMIC_CAS, Atomic compare and swap @@ -116,6 +127,7 @@ Some basic guidelines for editing this document: * @code{COS}: COS, Cosine function * @code{COSD}: COSD, Cosine function, degrees * @code{COSH}: COSH, Hyperbolic cosine function +* @code{COSPI}: COSPI, Circular cosine function * @code{COTAN}: COTAN, Cotangent function * @code{COTAND}: COTAND, Cotangent function, degrees * @code{COUNT}: COUNT, Count occurrences of TRUE in an array @@ -296,6 +308,7 @@ Some basic guidelines for editing this document: * @code{SIN}: SIN, Sine function * @code{SIND}: SIND, Sine function, degrees * @code{SINH}: SINH, Hyperbolic sine function +* @code{SINPI}: SINPI, Circular sine function * @code{SIZE}: SIZE, Function to determine the size of an array * @code{SIZEOF}: SIZEOF, Determine the size in bytes of an expression * @code{SLEEP}: SLEEP, Sleep for the specified number of seconds @@ -312,6 +325,7 @@ Some basic guidelines for editing this document: * @code{TAN}: TAN, Tangent function * @code{TAND}: TAND, Tangent function, degrees * @code{TANH}: TANH, Hyperbolic tangent function +* @code{TANPI}: TANPI, Circular tangent function * @code{TEAM_NUMBER}: TEAM_NUMBER, Retrieve team id of given team * @code{THIS_IMAGE}: THIS_IMAGE, Cosubscript index of this image * @code{TIME}: TIME, Time function @@ -754,6 +768,62 @@ Inverse function: @* +@node ACOSPI +@section @code{ACOSPI} --- Circular arc cosine function +@fnindex ACOSPI +@cindex trigonometric function, cosine, inverse + +@table @asis +@item @emph{Description}: +@code{ACOSPI(X)} computes @math{ \acos(x) / \pi}, which is a measure +of an angle in half-revolutions. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = ACOSPI(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL} with @math{-1 \leq x \leq 1}. +@end multitable + +@item @emph{Return value}: +The return value has the same type and kind as @var{X}. +It is expressed in half-revolutions and satisfies +@math{ 0 \leq \acospi (x) \leq 1}. + +@item @emph{Example}: +@smallexample +program test_acospi + implicit none + real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8] + real, parameter :: a = acospi(x), b(3) = acospi(y) + call foo(x, y) +contains + subroutine foo(u, v) + real, intent(in) :: u, v(:) + real :: f, g(size(v)) + f = acospi(u) + g = acospi(v) + if (abs(a - f) > 8 * epsilon(f)) stop 1 + if (any(abs(g - b) > 8 * epsilon(f))) stop 2 + end subroutine foo +end program test_acospi +@end smallexample + +@item @emph{See also}: +@ref{ASINPI} @* +@ref{ATAN2PI} @* +@ref{ATANPI} @* +@end table + + + @node ADJUSTL @section @code{ADJUSTL} --- Left adjust a string @fnindex ADJUSTL @@ -1469,6 +1539,62 @@ Inverse function: @* +@node ASINPI +@section @code{ASINPI} --- Circular arc sine function +@fnindex ASINPI +@cindex trigonometric function, sine, inverse + +@table @asis +@item @emph{Description}: +@code{ASINPI(X)} computes @math{ \asin(x) / \pi}, which is a measure +of an angle in half-revolutions. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = ASINPI(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL} with @math{-1 \leq x \leq 1}. +@end multitable + +@item @emph{Return value}: +The return value has the same type and kind as @var{X}. +It is expressed in half-revolutions and satisfies +@math{ -0.5 \leq \asinpi (x) \leq 0.5}. + +@item @emph{Example}: +@smallexample +program test_asinpi + implicit none + real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8] + real, parameter :: a = asinpi(x), b(3) = asinpi(y) + call foo(x, y) +contains + subroutine foo(u, v) + real, intent(in) :: u, v(:) + real :: f, g(size(v)) + f = asinpi(u) + g = asinpi(v) + if (abs(a - f) > 8 * epsilon(f)) stop 1 + if (any(abs(g - b) > 8 * epsilon(f))) stop 2 + end subroutine foo +end program test_asinpi +@end smallexample + +@item @emph{See also}: +@ref{ACOSPI} @* +@ref{ATAN2PI} @* +@ref{ATANPI} @* +@end table + + + @node ASSOCIATED @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair @fnindex ASSOCIATED @@ -1608,68 +1734,6 @@ Degrees function: @* -@node ATAND -@section @code{ATAND} --- Arctangent function, degrees -@fnindex ATAND -@fnindex DATAND -@cindex trigonometric function, tangent, inverse, degrees -@cindex tangent, inverse, degrees - -@table @asis -@item @emph{Synopsis}: -@multitable @columnfractions .80 -@item @code{RESULT = ATAND(X)} -@item @code{RESULT = ATAND(Y, X)} -@end multitable - -@item @emph{Description}: -@code{ATAND(X)} computes the arctangent of @var{X} in degrees (inverse of -@ref{TAND}). - -@item @emph{Class}: -Elemental function - -@item @emph{Arguments}: -@multitable @columnfractions .15 .70 -@item @var{X} @tab The type shall be @code{REAL}. -@item @var{Y} @tab The type and kind type parameter shall be the same as @var{X}. -@end multitable - -@item @emph{Return value}: -The return value is of the same type and kind as @var{X}. -If @var{Y} is present, the result is identical to @code{ATAN2D(Y, X)}. -Otherwise, the result is in degrees and lies in the range -@math{-90 \leq \atand(x) \leq 90}. - -@item @emph{Example}: -@smallexample -program test_atand - real(8) :: x = 2.866_8 - real(4) :: x1 = 1.e0_4, y1 = 0.5e0_4 - x = atand(x) - x1 = atand(y1, x1) -end program test_atand -@end smallexample - -@item @emph{Specific names}: -@multitable @columnfractions .23 .23 .20 .30 -@headitem Name @tab Argument @tab Return type @tab Standard -@item @code{ATAND(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 2023 -@item @code{DATAND(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension -@end multitable - -@item @emph{Standard}: -Fortran 2023 - -@item @emph{See also}: -Inverse function: @* -@ref{TAND} @* -Radians function: @* -@ref{ATAN} -@end table - - - @node ATAN2 @section @code{ATAN2} --- Arctangent function @fnindex ATAN2 @@ -1798,6 +1862,117 @@ Radians function: @* @ref{ATAN2} @end table + + +@node ATAN2PI +@section @code{ATAN2PI} --- Circular arc tangent function +@fnindex ATAN2PI +@cindex trigonometric function, tangent, inverse + +@table @asis +@item @emph{Description}: +@code{ATAN2PI(Y, X)} computes @math{ {\rm {atan2}}(y, x) / \pi}, +and provides a measure of an angle in half-revolutions within +the proper quadrant. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = ATAN2PI(Y, X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{Y} @tab The type shall be @code{REAL}. +@item @var{X} @tab The type and kind type parameter shall be the +same as @var{Y}. If @var{Y} is zero, then @var{X} shall be nonzero. +@end multitable + +@item @emph{Return value}: +The return value has the same type and kind type parameter as @var{Y} +and satisfies @math{-1 \leq {\rm {atan2}}(y, x) / \pi \leq 1}. + +@item @emph{Example}: +@smallexample +program test_atan2pi + real(kind=4) :: x = 1.e0_4, y = 0.5e0_4 + x = atan2pi(y, x) +end program test_atan2pi +@end smallexample + +@item @emph{See also}: +@ref{ACOSPI} @* +@ref{ASINPI} @* +@ref{ATANPI} @* +@end table + + + +@node ATAND +@section @code{ATAND} --- Arctangent function, degrees +@fnindex ATAND +@fnindex DATAND +@cindex trigonometric function, tangent, inverse, degrees +@cindex tangent, inverse, degrees + +@table @asis +@item @emph{Synopsis}: +@multitable @columnfractions .80 +@item @code{RESULT = ATAND(X)} +@item @code{RESULT = ATAND(Y, X)} +@end multitable + +@item @emph{Description}: +@code{ATAND(X)} computes the arctangent of @var{X} in degrees (inverse of +@ref{TAND}). + +@item @emph{Class}: +Elemental function + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL}. +@item @var{Y} @tab The type and kind type parameter shall be the same as @var{X}. +@end multitable + +@item @emph{Return value}: +The return value is of the same type and kind as @var{X}. +If @var{Y} is present, the result is identical to @code{ATAN2D(Y, X)}. +Otherwise, the result is in degrees and lies in the range +@math{-90 \leq \atand(x) \leq 90}. + +@item @emph{Example}: +@smallexample +program test_atand + real(8) :: x = 2.866_8 + real(4) :: x1 = 1.e0_4, y1 = 0.5e0_4 + x = atand(x) + x1 = atand(y1, x1) +end program test_atand +@end smallexample + +@item @emph{Specific names}: +@multitable @columnfractions .23 .23 .20 .30 +@headitem Name @tab Argument @tab Return type @tab Standard +@item @code{ATAND(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 2023 +@item @code{DATAND(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension +@end multitable + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{See also}: +Inverse function: @* +@ref{TAND} @* +Radians function: @* +@ref{ATAN} +@end table + + + @node ATANH @section @code{ATANH} --- Inverse hyperbolic tangent function @fnindex ATANH @@ -1851,6 +2026,70 @@ Inverse function: @* +@node ATANPI +@section @code{ATANPI} --- Circular arc tangent function +@fnindex ATANPI +@cindex trigonometric function, tangent, inverse + +@table @asis +@item @emph{Description}: +@code{ATANPI(X)} computes @math{ \atan(x) / \pi}. +@code{ATANPI(Y, X)} computes @math{ {\rm atan2}(y, x) / \pi}. +These provide a measure of an angle in half-revolutions. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@multitable @columnfractions .80 +@item @code{RESULT = ATANPI(X)} +@item @code{RESULT = ATANPI(Y, X)} +@end multitable + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{Y} @tab The type shall be @code{REAL}. +@item @var{X} @tab If @var{Y} appears, @var{X} shall have the same type +and kind as @var{Y}. If @var{Y} is zero, then @var{X} shall not be zero. +If @var{Y} does not appear in a function reference, then @var{X} shall be +@code{REAL}. +@end multitable + +@item @emph{Return value}: +The return value has the same type and kind as @var{X}. +It is expressed in half-revolutions and satisfies +@math{ -0.5 \leq \atanpi (x) \leq 0.5}. + +@item @emph{Example}: +@smallexample +program test_atanpi + implicit none + real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8] + real, parameter :: a = atanpi(x), b(3) = atanpi(y) + call foo(x, y) +contains + subroutine foo(u, v) + real, intent(in) :: u, v(:) + real :: f, g(size(v)) + f = atanpi(u) + g = atanpi(v) + if (abs(a - f) > 8 * epsilon(f)) stop 1 + if (any(abs(g - b) > 8 * epsilon(f))) stop 2 + end subroutine foo +end program test_atanpi +@end smallexample + +@item @emph{See also}: +@ref{ACOSPI} @* +@ref{ASINPI} @* +@ref{ATAN2PI} @* +@end table + + + @node ATOMIC_ADD @section @code{ATOMIC_ADD} --- Atomic ADD operation @fnindex ATOMIC_ADD @@ -4391,6 +4630,57 @@ Inverse function: @* +@node COSPI +@section @code{COSPI} --- Circular cosine function +@fnindex COSPI +@cindex trigonometric function, cosine +@cindex cosine + +@table @asis +@item @emph{Description}: +@code{COSPI(X)} computes @math{\cos(\pi x)} without performing +an explicit multiplication by @math{\pi}. This is achieved +through argument reduction where @math{ x = n + r } with +@math{n} an integer and @math{0 \leq r \le 1}. +Due to the +properties of floating-point arithmetic, the useful range +for @var{X} is defined by +@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = COSPI(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL}. +@end multitable + +@item @emph{Return value}: +The return value is of the same type and kind as @var{X}. +The result is in half-revolutions and satisfies +@math{ -1 \leq \cospi (x) \leq 1}. + +@item @emph{Example}: +@smallexample +program test_cospi + real :: x = 0.0 + x = cospi(x) +end program test_cospi +@end smallexample + +@item @emph{See also}: +@ref{ACOSPI} @* +@ref{COS} @* +@end table + + + @node COTAN @section @code{COTAN} --- Cotangent function @fnindex COTAN @@ -13677,6 +13967,57 @@ a GNU extension +@node SINPI +@section @code{SINPI} --- Circular sine function +@fnindex SINPI +@cindex trigonometric function, sine +@cindex sine + +@table @asis +@item @emph{Description}: +@code{SINPI(X)} computes @math{\sin(\pi x)} without performing +an explicit multiplication by @math{\pi}. This is achieved +through argument reduction where @math{ |x| = n + r } with +@math{n} an integer and @math{0 \leq r \le 1}. +Due to the +properties of floating-point arithmetic, the useful range +for @var{X} is defined by +@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = SINPI(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL}. +@end multitable + +@item @emph{Return value}: +The return value is of the same type and kind as @var{X}. +The result is in half-revolutions and satisfies +@math{ -1 \leq \sinpi (x) \leq 1}. + +@item @emph{Example}: +@smallexample +program test_sinpi + real :: x = 0.0 + x = sinpi(x) +end program test_sinpi +@end smallexample + +@item @emph{See also}: +@ref{ASINPI} @* +@ref{SIN} @* +@end table + + + @node SIZE @section @code{SIZE} --- Determine the size of an array @fnindex SIZE @@ -14574,6 +14915,55 @@ Fortran 2018 and later. +@node TANPI +@section @code{TANPI} --- Circular tangent function +@fnindex TANPI +@cindex trigonometric function, tangent +@cindex tangent + +@table @asis +@item @emph{Description}: +@code{TANPI(X)} computes @math{\tan(\pi x)} without performing +an explicit multiplication by @math{\pi}. This is achieved +through argument reduction where @math{ |x| = n + r } with +@math{n} an integer and @math{0 \leq r \le 1}. +Due to the +properties of floating-point arithmetic, the useful range +for @var{X} is defined by +@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}. + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{Class}: +Elemental function + +@item @emph{Syntax}: +@code{RESULT = TANPI(X)} + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{X} @tab The type shall be @code{REAL}. +@end multitable + +@item @emph{Return value}: +The return value is of the same type and kind as @var{X}. + +@item @emph{Example}: +@smallexample +program test_tanpi + real :: x = 0.0 + x = tanpi(x) +end program test_tanpi +@end smallexample + +@item @emph{See also}: +@ref{ATANPI} @* +@ref{TAN} @* +@end table + + + @node THIS_IMAGE @section @code{THIS_IMAGE} --- Function that returns the cosubscript index of this image @fnindex THIS_IMAGE @@ -8506,11 +8506,13 @@ driver::set_up_specs () const spec_machine_suffix = just_machine_suffix; #endif + const char *exec_prefix + = gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix; /* We need to check standard_exec_prefix/spec_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = (char *) alloca (strlen (standard_exec_prefix) - + strlen (spec_machine_suffix) + sizeof ("specs")); - strcpy (specs_file, standard_exec_prefix); + specs_file = (char *) alloca ( + strlen (exec_prefix) + strlen (spec_machine_suffix) + sizeof ("specs")); + strcpy (specs_file, exec_prefix); strcat (specs_file, spec_machine_suffix); strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index aed5c7d..d18b37b 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "sreal.h" #include "ipa-cp.h" #include "ipa-prop.h" +#include "rtl.h" // Construct a fur_source, and set the m_query field. fur_source::fur_source (range_query *q) @@ -778,11 +779,14 @@ fold_using_range::range_of_range_op (vrange &r, { basic_block bb = gimple_bb (s); edge e0 = EDGE_SUCC (bb, 0); - edge e1 = EDGE_SUCC (bb, 1); + /* During RTL expansion one of the edges can be removed + if expansion proves the jump is unconditional. */ + edge e1 = single_succ_p (bb) ? NULL : EDGE_SUCC (bb, 1); + gcc_checking_assert (e1 || currently_expanding_to_rtl); if (!single_pred_p (e0->dest)) e0 = NULL; - if (!single_pred_p (e1->dest)) + if (e1 && !single_pred_p (e1->dest)) e1 = NULL; src.register_outgoing_edges (as_a<gcond *> (s), as_a <irange> (r), e0, e1); diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc index 305b6356..0f4aff6 100644 --- a/gcc/gimple-ssa-warn-access.cc +++ b/gcc/gimple-ssa-warn-access.cc @@ -3767,6 +3767,7 @@ pass_waccess::maybe_check_dealloc_call (gcall *call) if (is_gimple_call (def_stmt)) { + auto_diagnostic_group d; bool warned = false; if (gimple_call_alloc_p (def_stmt)) { diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc index a0a73fe..3f4ac93 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -5561,7 +5561,7 @@ expand_POPCOUNT (internal_fn fn, gcall *stmt) expand_unary_optab_fn (fn, stmt, popcount_optab); rtx_insn *popcount_insns = end_sequence (); start_sequence (); - rtx plhs = expand_normal (lhs); + rtx plhs = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); rtx pcmp = emit_store_flag (NULL_RTX, EQ, plhs, const1_rtx, lhsmode, 0, 0); if (pcmp == NULL_RTX) { @@ -5603,7 +5603,7 @@ expand_POPCOUNT (internal_fn fn, gcall *stmt) { start_sequence (); emit_insn (cmp_insns); - plhs = expand_normal (lhs); + plhs = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); if (GET_MODE (cmp) != GET_MODE (plhs)) cmp = convert_to_mode (GET_MODE (plhs), cmp, 1); /* For `<= 1`, we need to produce `2 - cmp` or `cmp ? 1 : 2` as that diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 92e234e..3bf0117 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -4528,7 +4528,7 @@ lenient_count_portion_handling (profile_count remainder, cgraph_node *orig_node) if (remainder.ipa_p () && !remainder.ipa ().nonzero_p () && orig_node->count.ipa_p () && orig_node->count.ipa ().nonzero_p () && opt_for_fn (orig_node->decl, flag_profile_partial_training)) - remainder = remainder.guessed_local (); + remainder = orig_node->count.guessed_local (); return remainder; } @@ -4669,7 +4669,7 @@ update_counts_for_self_gen_clones (cgraph_node *orig_node, profile_count new_count = (redist_sum / self_gen_clones.length () + other_edges_count[i]); new_count = lenient_count_portion_handling (new_count, orig_node); - n->apply_scale (new_count, n->count); + n->scale_profile_to (new_count); for (cgraph_edge *cs = n->callees; cs; cs = cs->next_callee) processed_edges.add (cs); @@ -4769,16 +4769,12 @@ update_profiling_info (struct cgraph_node *orig_node, bool orig_edges_processed = false; if (new_sum > orig_node_count) { - /* TODO: Profile has alreay gone astray, keep what we have but lower it - to global0 category. */ - remainder = orig_node->count.global0 (); - - for (cgraph_edge *cs = orig_node->callees; cs; cs = cs->next_callee) - cs->count = cs->count.global0 (); - for (cgraph_edge *cs = orig_node->indirect_calls; - cs; - cs = cs->next_callee) - cs->count = cs->count.global0 (); + /* Profile has alreay gone astray, keep what we have but lower it + to global0adjusted or to local if we have partial training. */ + if (opt_for_fn (orig_node->decl, flag_profile_partial_training)) + orig_node->make_profile_local (); + else + orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED); orig_edges_processed = true; } else if (stats.rec_count_sum.nonzero_p ()) @@ -4805,23 +4801,9 @@ update_profiling_info (struct cgraph_node *orig_node, are still unmodified copies of ORIG_NODE's. Just clear the latter and bail out. */ if (opt_for_fn (orig_node->decl, flag_profile_partial_training)) - orig_node->count = orig_node->count.guessed_local (); + orig_node->make_profile_local (); else - orig_node->count = orig_node->count.global0adjusted (); - for (cgraph_edge *cs = orig_node->callees; - cs; - cs = cs->next_callee) - if (opt_for_fn (orig_node->decl, flag_profile_partial_training)) - cs->count = orig_node->count.guessed_local (); - else - cs->count = orig_node->count.global0adjusted (); - for (cgraph_edge *cs = orig_node->indirect_calls; - cs; - cs = cs->next_callee) - if (opt_for_fn (orig_node->decl, flag_profile_partial_training)) - cs->count = orig_node->count.guessed_local (); - else - cs->count = orig_node->count.global0adjusted (); + orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED); return; } } @@ -4870,13 +4852,10 @@ update_profiling_info (struct cgraph_node *orig_node, remainder = lenient_count_portion_handling (orig_node_count - new_sum, orig_node); - new_sum = orig_node_count.combine_with_ipa_count (new_sum); - orig_node->count = remainder; - - new_node->apply_scale (new_sum, new_node->count); + new_node->scale_profile_to (new_sum); if (!orig_edges_processed) - orig_node->apply_scale (remainder, orig_node->count); + orig_node->scale_profile_to (remainder); if (dump_file) { @@ -4906,13 +4885,11 @@ update_specialized_profile (struct cgraph_node *new_node, || !redirected_sum.nonzero_p ()) return; - orig_node->apply_scale + orig_node->scale_profile_to (lenient_count_portion_handling (orig_node->count.ipa () - redirected_sum, - orig_node), - orig_node->count); + orig_node)); - new_node->apply_scale (new_node->count.ipa () + redirected_sum, - new_node->count); + new_node->scale_profile_to (new_node->count.ipa () + redirected_sum); if (dump_file) { diff --git a/gcc/ipa-inline-transform.cc b/gcc/ipa-inline-transform.cc index 3c6a845..07a1024 100644 --- a/gcc/ipa-inline-transform.cc +++ b/gcc/ipa-inline-transform.cc @@ -191,7 +191,10 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, } duplicate = false; e->callee->externally_visible = false; - e->callee->apply_scale (e->count, e->callee->count); + profile_count num = e->count; + profile_count den = e->callee->count; + profile_count::adjust_for_ipa_scaling (&num, &den); + e->callee->apply_scale (num, den); dump_callgraph_transformation (e->callee, inlining_into, "inlining to"); diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 57c995d..1037f5c 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,13 @@ +2025-06-12 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/119650 + * gm2-libs/ARRAYOFCHAR.def: Remove comment about non + existent read. + * target-independent/m2/Builtins.texi: Regenerate. + * target-independent/m2/SYSTEM-iso.texi: Ditto. + * target-independent/m2/SYSTEM-pim.texi: Ditto. + * target-independent/m2/gm2-libs.texi: Ditto. + 2025-06-09 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/120606 diff --git a/gcc/m2/gm2-libs/ARRAYOFCHAR.def b/gcc/m2/gm2-libs/ARRAYOFCHAR.def index 451eb56..7767a52 100644 --- a/gcc/m2/gm2-libs/ARRAYOFCHAR.def +++ b/gcc/m2/gm2-libs/ARRAYOFCHAR.def @@ -30,8 +30,7 @@ FROM FIO IMPORT File ; (* - Description: provides write and read procedures for - ARRAY OF CHAR. + Description: provides write procedures for ARRAY OF CHAR. *) PROCEDURE Write (f: File; str: ARRAY OF CHAR) ; diff --git a/gcc/m2/target-independent/m2/Builtins.texi b/gcc/m2/target-independent/m2/Builtins.texi index 4ebad46..57daddd 100644 --- a/gcc/m2/target-independent/m2/Builtins.texi +++ b/gcc/m2/target-independent/m2/Builtins.texi @@ -348,6 +348,15 @@ PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ; @findex strrchr PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ; +@findex clz +PROCEDURE __BUILTIN__ clz (value: CARDINAL) : INTEGER ; +@findex clzll +PROCEDURE __BUILTIN__ clzll (value: LONGCARD) : INTEGER ; +@findex ctz +PROCEDURE __BUILTIN__ ctz (value: CARDINAL) : INTEGER ; +@findex ctzll +PROCEDURE __BUILTIN__ ctzll (value: LONGCARD) : INTEGER ; + (* longjmp - this GCC builtin restricts the val to always 1. *) diff --git a/gcc/m2/target-independent/m2/SYSTEM-iso.texi b/gcc/m2/target-independent/m2/SYSTEM-iso.texi index dbcc534..d195095 100644 --- a/gcc/m2/target-independent/m2/SYSTEM-iso.texi +++ b/gcc/m2/target-independent/m2/SYSTEM-iso.texi @@ -8,7 +8,7 @@ DEFINITION MODULE SYSTEM; (* The constants and types define underlying properties of storage *) EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD, - LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (* + LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, COFF_T, (* Target specific data types. *) ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE, SHIFT, CAST, TSIZE, diff --git a/gcc/m2/target-independent/m2/SYSTEM-pim.texi b/gcc/m2/target-independent/m2/SYSTEM-pim.texi index bd446bd..59abfbe 100644 --- a/gcc/m2/target-independent/m2/SYSTEM-pim.texi +++ b/gcc/m2/target-independent/m2/SYSTEM-pim.texi @@ -3,7 +3,7 @@ DEFINITION MODULE SYSTEM ; EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD, - ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (* + ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, CARDINAL64, (* Target specific data types. *) ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ; (* SIZE is also exported if -fpim2 is used. *) diff --git a/gcc/m2/target-independent/m2/gm2-libs.texi b/gcc/m2/target-independent/m2/gm2-libs.texi index e707396..b4d4ffb 100644 --- a/gcc/m2/target-independent/m2/gm2-libs.texi +++ b/gcc/m2/target-independent/m2/gm2-libs.texi @@ -35,17 +35,21 @@ type results in a number of equivalent modules that can either handle These modules have been extensively tested and are used throughout building the GNU Modula-2 compiler. @menu +* gm2-libs/ARRAYOFCHAR::ARRAYOFCHAR.def * gm2-libs/ASCII::ASCII.def * gm2-libs/Args::Args.def * gm2-libs/Assertion::Assertion.def * gm2-libs/Break::Break.def * gm2-libs/Builtins::Builtins.def +* gm2-libs/CFileSysOp::CFileSysOp.def +* gm2-libs/CHAR::CHAR.def * gm2-libs/COROUTINES::COROUTINES.def * gm2-libs/CmdArgs::CmdArgs.def * gm2-libs/Debug::Debug.def * gm2-libs/DynamicStrings::DynamicStrings.def * gm2-libs/Environment::Environment.def * gm2-libs/FIO::FIO.def +* gm2-libs/FileSysOp::FileSysOp.def * gm2-libs/FormatStrings::FormatStrings.def * gm2-libs/FpuIO::FpuIO.def * gm2-libs/GetOpt::GetOpt.def @@ -76,7 +80,9 @@ building the GNU Modula-2 compiler. * gm2-libs/StrCase::StrCase.def * gm2-libs/StrIO::StrIO.def * gm2-libs/StrLib::StrLib.def +* gm2-libs/String::String.def * gm2-libs/StringConvert::StringConvert.def +* gm2-libs/StringFileSysOp::StringFileSysOp.def * gm2-libs/SysExceptions::SysExceptions.def * gm2-libs/SysStorage::SysStorage.def * gm2-libs/TimeString::TimeString.def @@ -95,7 +101,30 @@ building the GNU Modula-2 compiler. * gm2-libs/wrapc::wrapc.def @end menu -@node gm2-libs/ASCII, gm2-libs/Args, , Base libraries +@node gm2-libs/ARRAYOFCHAR, gm2-libs/ASCII, , Base libraries +@subsection gm2-libs/ARRAYOFCHAR + +@example +DEFINITION MODULE ARRAYOFCHAR ; + +FROM FIO IMPORT File ; + + +(* + Description: provides write procedures for ARRAY OF CHAR. +*) + +@findex Write +PROCEDURE Write (f: File; str: ARRAY OF CHAR) ; +@findex WriteLn +PROCEDURE WriteLn (f: File) ; + + +END ARRAYOFCHAR. +@end example +@page + +@node gm2-libs/ASCII, gm2-libs/Args, gm2-libs/ARRAYOFCHAR, Base libraries @subsection gm2-libs/ASCII @example @@ -232,7 +261,7 @@ END Break. @end example @page -@node gm2-libs/Builtins, gm2-libs/COROUTINES, gm2-libs/Break, Base libraries +@node gm2-libs/Builtins, gm2-libs/CFileSysOp, gm2-libs/Break, Base libraries @subsection gm2-libs/Builtins @example @@ -584,6 +613,15 @@ PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ; @findex strrchr PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ; +@findex clz +PROCEDURE __BUILTIN__ clz (value: CARDINAL) : INTEGER ; +@findex clzll +PROCEDURE __BUILTIN__ clzll (value: LONGCARD) : INTEGER ; +@findex ctz +PROCEDURE __BUILTIN__ ctz (value: CARDINAL) : INTEGER ; +@findex ctzll +PROCEDURE __BUILTIN__ ctzll (value: LONGCARD) : INTEGER ; + (* longjmp - this GCC builtin restricts the val to always 1. *) @@ -632,7 +670,100 @@ END Builtins. @end example @page -@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/Builtins, Base libraries +@node gm2-libs/CFileSysOp, gm2-libs/CHAR, gm2-libs/Builtins, Base libraries +@subsection gm2-libs/CFileSysOp + +@example +DEFINITION MODULE CFileSysOp ; + +FROM SYSTEM IMPORT ADDRESS ; + + +(* + Description: provides access to filesystem operations. + The implementation module is written in C + and the parameters behave as their C + counterparts. +*) + +TYPE +@findex AccessMode (type) + AccessMode = SET OF AccessStatus ; +@findex AccessStatus (type) + AccessStatus = (F_OK, R_OK, W_OK, X_OK, A_FAIL) ; + + +@findex Unlink +PROCEDURE Unlink (filename: ADDRESS) : INTEGER ; + + +(* + Access - test access to a path or file. The behavior is + the same as defined in access(2). Except that + on A_FAIL is only used during the return result + indicating the underlying C access has returned + -1 (and errno can be checked). +*) + +@findex Access +PROCEDURE Access (pathname: ADDRESS; mode: AccessMode) : AccessMode ; + + +(* Return TRUE if the caller can see the existance of the file or + directory on the filesystem. *) + +(* + IsDir - return true if filename is a regular directory. +*) + +@findex IsDir +PROCEDURE IsDir (dirname: ADDRESS) : BOOLEAN ; + + +(* + IsFile - return true if filename is a regular file. +*) + +@findex IsFile +PROCEDURE IsFile (filename: ADDRESS) : BOOLEAN ; + + +(* + Exists - return true if pathname exists. +*) + +@findex Exists +PROCEDURE Exists (pathname: ADDRESS) : BOOLEAN ; + + +END CFileSysOp. +@end example +@page + +@node gm2-libs/CHAR, gm2-libs/COROUTINES, gm2-libs/CFileSysOp, Base libraries +@subsection gm2-libs/CHAR + +@example +DEFINITION MODULE CHAR ; + +FROM FIO IMPORT File ; + + +(* + Write a single character ch to file f. +*) + +@findex Write +PROCEDURE Write (f: File; ch: CHAR) ; +@findex WriteLn +PROCEDURE WriteLn (f: File) ; + + +END CHAR. +@end example +@page + +@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/CHAR, Base libraries @subsection gm2-libs/COROUTINES @example @@ -1179,7 +1310,7 @@ END Environment. @end example @page -@node gm2-libs/FIO, gm2-libs/FormatStrings, gm2-libs/Environment, Base libraries +@node gm2-libs/FIO, gm2-libs/FileSysOp, gm2-libs/Environment, Base libraries @subsection gm2-libs/FIO @example @@ -1543,7 +1674,37 @@ END FIO. @end example @page -@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FIO, Base libraries +@node gm2-libs/FileSysOp, gm2-libs/FormatStrings, gm2-libs/FIO, Base libraries +@subsection gm2-libs/FileSysOp + +@example +DEFINITION MODULE FileSysOp ; + +FROM CFileSysOp IMPORT AccessMode ; + + +(* + Description: provides access to filesystem operations using + Modula-2 base types. +*) + +@findex Exists +PROCEDURE Exists (filename: ARRAY OF CHAR) : BOOLEAN ; +@findex IsDir +PROCEDURE IsDir (dirname: ARRAY OF CHAR) : BOOLEAN ; +@findex IsFile +PROCEDURE IsFile (filename: ARRAY OF CHAR) : BOOLEAN ; +@findex Unlink +PROCEDURE Unlink (filename: ARRAY OF CHAR) : BOOLEAN ; +@findex Access +PROCEDURE Access (pathname: ARRAY OF CHAR; mode: AccessMode) : AccessMode ; + + +END FileSysOp. +@end example +@page + +@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FileSysOp, Base libraries @subsection gm2-libs/FormatStrings @example @@ -1986,6 +2147,15 @@ PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ; PROCEDURE IsEmpty (i: Index) : BOOLEAN ; +(* + FindIndice - returns the indice containing a. + It returns zero if a is not found in array i. +*) + +@findex FindIndice +PROCEDURE FindIndice (i: Index; a: ADDRESS) : CARDINAL ; + + END Indexing. @end example @page @@ -3303,7 +3473,7 @@ END SMathLib0. DEFINITION MODULE SYSTEM ; EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD, - ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (* + ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, CARDINAL64, (* Target specific data types. *) ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ; (* SIZE is also exported if -fpim2 is used. *) @@ -3872,7 +4042,7 @@ END StrIO. @end example @page -@node gm2-libs/StrLib, gm2-libs/StringConvert, gm2-libs/StrIO, Base libraries +@node gm2-libs/StrLib, gm2-libs/String, gm2-libs/StrIO, Base libraries @subsection gm2-libs/StrLib @example @@ -3946,7 +4116,25 @@ END StrLib. @end example @page -@node gm2-libs/StringConvert, gm2-libs/SysExceptions, gm2-libs/StrLib, Base libraries +@node gm2-libs/String, gm2-libs/StringConvert, gm2-libs/StrLib, Base libraries +@subsection gm2-libs/String + +@example +DEFINITION MODULE String ; + +FROM DynamicStrings IMPORT String ; +FROM FIO IMPORT File ; + +@findex Write +PROCEDURE Write (f: File; str: String) ; +@findex WriteLn +PROCEDURE WriteLn (f: File) ; + +END String. +@end example +@page + +@node gm2-libs/StringConvert, gm2-libs/StringFileSysOp, gm2-libs/String, Base libraries @subsection gm2-libs/StringConvert @example @@ -4290,7 +4478,33 @@ END StringConvert. @end example @page -@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringConvert, Base libraries +@node gm2-libs/StringFileSysOp, gm2-libs/SysExceptions, gm2-libs/StringConvert, Base libraries +@subsection gm2-libs/StringFileSysOp + +@example +DEFINITION MODULE StringFileSysOp ; + +FROM DynamicStrings IMPORT String ; +FROM CFileSysOp IMPORT AccessMode ; + + +@findex Exists +PROCEDURE Exists (filename: String) : BOOLEAN ; +@findex IsDir +PROCEDURE IsDir (dirname: String) : BOOLEAN ; +@findex IsFile +PROCEDURE IsFile (filename: String) : BOOLEAN ; +@findex Unlink +PROCEDURE Unlink (filename: String) : BOOLEAN ; +@findex Access +PROCEDURE Access (pathname: String; mode: AccessMode) : AccessMode ; + + +END StringFileSysOp. +@end example +@page + +@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringFileSysOp, Base libraries @subsection gm2-libs/SysExceptions @example @@ -4476,7 +4690,10 @@ EXPORT UNQUALIFIED alloca, memcpy, index, rindex, memcmp, memset, memmove, strcat, strncat, strcpy, strncpy, strcmp, strncmp, - strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr ; + strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr, + + clz, clzll, + ctz, ctzll ; @findex alloca PROCEDURE alloca (i: CARDINAL) : ADDRESS ; @@ -4732,6 +4949,16 @@ PROCEDURE strchr (s: ADDRESS; c: INTEGER) : ADDRESS ; @findex strrchr PROCEDURE strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ; +@findex clz +PROCEDURE clz (value: CARDINAL) : INTEGER ; +@findex clzll +PROCEDURE clzll (value: CARDINAL) : INTEGER ; +@findex ctz +PROCEDURE ctz (value: CARDINAL) : INTEGER ; +@findex ctzll +PROCEDURE ctzll (value: CARDINAL) : INTEGER ; + + END cbuiltin. @end example @page @@ -4893,7 +5120,7 @@ PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ; @findex dtoa PROCEDURE dtoa (d : REAL; - mode : Mode; + mode : INTEGER; ndigits : INTEGER; VAR decpt: INTEGER; VAR sign : BOOLEAN) : ADDRESS ; @@ -4999,7 +5226,7 @@ PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ; @findex ldtoa PROCEDURE ldtoa (d : LONGREAL; - mode : Mode; + mode : INTEGER; ndigits : INTEGER; VAR decpt: INTEGER; VAR sign : BOOLEAN) : ADDRESS ; @@ -5015,9 +5242,11 @@ END ldtoa. @example DEFINITION MODULE FOR "C" libc ; -FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T ; +FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T, COFF_T ; EXPORT UNQUALIFIED time_t, timeb, tm, ptrToTM, + atof, atoi, atol, atoll, + strtod, strtof, strtold, strtol, strtoll, strtoul, strtoull, write, read, system, abort, malloc, free, @@ -5072,6 +5301,99 @@ TYPE (* + double atof(const char *nptr) +*) + +@findex atof +PROCEDURE atof (nptr: ADDRESS) : REAL ; + + +(* + int atoi(const char *nptr) +*) + +@findex atoi +PROCEDURE atoi (nptr: ADDRESS) : INTEGER ; + + +(* + long atol(const char *nptr); +*) + +@findex atol +PROCEDURE atol (nptr: ADDRESS) : CSSIZE_T ; + + +(* + long long atoll(const char *nptr); +*) + +@findex atoll +PROCEDURE atoll (nptr: ADDRESS) : LONGINT ; + + +(* + double strtod(const char *restrict nptr, char **_Nullable restrict endptr) +*) + +@findex strtod +PROCEDURE strtod (nptr, endptr: ADDRESS) : REAL ; + + +(* + float strtof(const char *restrict nptr, char **_Nullable restrict endptr) +*) + +@findex strtof +PROCEDURE strtof (nptr, endptr: ADDRESS) : SHORTREAL ; + + +(* + long double strtold(const char *restrict nptr, + char **_Nullable restrict endptr) +*) + +@findex strtold +PROCEDURE strtold (nptr, endptr: ADDRESS) : LONGREAL ; + + +(* + long strtol(const char *restrict nptr, char **_Nullable restrict endptr, + int base) +*) + +@findex strtol +PROCEDURE strtol (nptr, endptr: ADDRESS; base: INTEGER) : CSSIZE_T ; + + +(* + long long strtoll(const char *restrict nptr, + char **_Nullable restrict endptr, int base) +*) + +@findex strtoll +PROCEDURE strtoll (nptr, endptr: ADDRESS; base: INTEGER) : LONGINT ; + + +(* + unsigned long strtoul(const char *restrict nptr, + char **_Nullable restrict endptr, int base) +*) + +@findex strtoul +PROCEDURE strtoul (nptr, endptr: ADDRESS; base: INTEGER) : CSIZE_T ; + + +(* + unsigned long long strtoull(const char *restrict nptr, + char **_Nullable restrict endptr, int base) +*) + +@findex strtoull +PROCEDURE strtoull (nptr, endptr: ADDRESS; base: INTEGER) : LONGCARD ; + + +(* ssize_t write (int d, void *buf, size_t nbytes) *) @@ -5222,7 +5544,7 @@ PROCEDURE close (d: INTEGER) : [ INTEGER ] ; *) @findex open -PROCEDURE open (filename: ADDRESS; oflag: INTEGER; ...) : INTEGER ; +PROCEDURE open (filename: ADDRESS; oflag: INTEGER; mode: INTEGER) : INTEGER ; (* @@ -5240,7 +5562,7 @@ PROCEDURE creat (filename: ADDRESS; mode: CARDINAL) : INTEGER; *) @findex lseek -PROCEDURE lseek (fd: INTEGER; offset: CSSIZE_T; whence: INTEGER) : [ CSSIZE_T ] ; +PROCEDURE lseek (fd: INTEGER; offset: COFF_T; whence: INTEGER) : [ COFF_T ] ; (* @@ -6720,7 +7042,7 @@ PROCEDURE BlockMoveBackward (dest, src: ADDRESS; n: CARDINAL) ; (* - BlockClear - fills, block..block+n-1, with zero's. + BlockClear - fills, block..block+n-1, with zeros. *) @findex BlockClear @@ -7381,7 +7703,7 @@ PROCEDURE Doio (VAR f: File) ; *) @findex FileNameChar -PROCEDURE FileNameChar (ch: CHAR) ; +PROCEDURE FileNameChar (ch: CHAR) : CHAR ; END FileSystem. @@ -7512,7 +7834,7 @@ VAR (* OpenInput - reads a string from stdin as the filename for reading. - If the filename ends with `.' then it appends the defext + If the filename ends with '.' then it appends the defext extension. The global variable Done is set if all was successful. *) @@ -7532,7 +7854,7 @@ PROCEDURE CloseInput ; (* OpenOutput - reads a string from stdin as the filename for writing. - If the filename ends with `.' then it appends the defext + If the filename ends with '.' then it appends the defext extension. The global variable Done is set if all was successful. *) @@ -8424,7 +8746,7 @@ EXPORT QUALIFIED SEMAPHORE, DESCRIPTOR, TYPE @findex SEMAPHORE (type) - SEMAPHORE ; (* defines Dijkstra's semaphores *) + SEMAPHORE ; (* defines Dijkstras semaphores *) @findex DESCRIPTOR (type) DESCRIPTOR ; (* handle onto a process *) @@ -8483,7 +8805,7 @@ PROCEDURE InitSemaphore (v: CARDINAL; Name: ARRAY OF CHAR) : SEMAPHORE ; (* - Wait - performs dijkstra's P operation on a semaphore. + Wait - performs dijkstras P operation on a semaphore. A process which calls this procedure will wait until the value of the semaphore is > 0 and then it will decrement this value. @@ -8494,7 +8816,7 @@ PROCEDURE Wait (s: SEMAPHORE) ; (* - Signal - performs dijkstra's V operation on a semaphore. + Signal - performs dijkstras V operation on a semaphore. A process which calls the procedure will increment the semaphores value. *) @@ -8621,7 +8943,7 @@ DEFINITION MODULE SYSTEM ; FROM COROUTINES IMPORT PROTECTION ; EXPORT QUALIFIED (* the following are built into the compiler: *) - ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (* + ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, (* Target specific data types. *) ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE, (* SIZE is exported depending upon -fpim2 and @@ -13322,7 +13644,7 @@ DEFINITION MODULE SYSTEM; (* The constants and types define underlying properties of storage *) EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD, - LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (* + LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, COFF_T, (* Target specific data types. *) ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE, SHIFT, CAST, TSIZE, @@ -14878,12 +15200,16 @@ IMPORT IOChan ; PROCEDURE SkipSpaces (cid: IOChan.ChanId) ; -(* The following procedures do not read past line marks. *) +(* CharAvailable returns TRUE if IOChan.ReadResult is notKnown or + allRight. *) @findex CharAvailable PROCEDURE CharAvailable (cid: IOChan.ChanId) : BOOLEAN ; +(* EofOrEoln returns TRUE if IOChan.ReadResult is endOfLine or + endOfInput. *) + @findex EofOrEoln PROCEDURE EofOrEoln (cid: IOChan.ChanId) : BOOLEAN ; diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index e6429a0..f615b07 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + * objc-act.h (TYPE_OBJC_INFO): Define to info.objc_info + instead of objc_info. + 2024-11-22 Andrew Pinski <quic_apinski@quicinc.com> PR bootstrap/117737 diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index 39c2989..c7f9259 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -228,7 +228,7 @@ enum objc_property_nullability { /* The following three macros must be overridden (in objcp/objcp-decl.h) for Objective-C++. */ -#define TYPE_OBJC_INFO(TYPE) TYPE_LANG_SPECIFIC (TYPE)->objc_info +#define TYPE_OBJC_INFO(TYPE) TYPE_LANG_SPECIFIC (TYPE)->info.objc_info #define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type) #define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \ do { \ diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index 90357fe..ab029d4 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,8 @@ +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + * objcp-decl.h (TYPE_OBJC_INFO): Define to info.objc_info + instead of objc_info. + 2024-11-22 Andrew Pinski <quic_apinski@quicinc.com> PR bootstrap/117737 diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h index 747fdae..2489620 100644 --- a/gcc/objcp/objcp-decl.h +++ b/gcc/objcp/objcp-decl.h @@ -60,7 +60,7 @@ extern tree objcp_end_compound_stmt (tree, int); #define OBJC_SET_TYPE_NAME(type, name) (TYPE_IDENTIFIER (type) = (name)) #undef TYPE_OBJC_INFO -#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info +#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->info.objc_info #undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC #define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type) #undef ALLOC_OBJC_TYPE_LANG_SPECIFIC diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 1e5e07a..487defa 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2025-06-12 Joseph Myers <josmyers@redhat.com> + + * es.po: Update. + 2025-05-15 Joseph Myers <josmyers@redhat.com> * zh_CN.po: Update. diff --git a/gcc/po/es.po b/gcc/po/es.po index 6033f331..2959212 100644 --- a/gcc/po/es.po +++ b/gcc/po/es.po @@ -2,7 +2,7 @@ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc. # This file is distributed under the same license as the gcc package. # Cristian Othón MartÃnez Vera <cfuga@cfuga.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020 +# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020, 2025 # # Agradezco a Juan Cuquejo Mira por sus comentarios sobre esta traducción # @@ -40,10 +40,10 @@ # msgid "" msgstr "" -"Project-Id-Version: gcc 10.1-b20200209\n" +"Project-Id-Version: gcc 15.1.0\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2025-04-23 19:27+0000\n" -"PO-Revision-Date: 2020-03-22 16:48+0100\n" +"PO-Revision-Date: 2025-06-12 23:08+0200\n" "Last-Translator: Antonio Ceballos Roa <aceballos@gmail.com>\n" "Language-Team: Spanish <es@tp.org.es>\n" "Language: es\n" @@ -15533,12 +15533,12 @@ msgstr "Activa las opciones comunes para generar información de análisis de pe #: common.opt:2648 #, no-c-format msgid "Register the profile information in the .gcov_info section instead of using a constructor/destructor." -msgstr "" +msgstr "Registra la información de análisis de perfil en la sección .gcov_info en lugar de utilizar un constructor/destructor." #: common.opt:2652 #, no-c-format msgid "Register the profile information in the specified section instead of using a constructor/destructor." -msgstr "" +msgstr "Registra la información de análisis de perfil en la sección especificada en lugar de utilizar un constructor/destructor." #: common.opt:2656 #, no-c-format @@ -18902,7 +18902,7 @@ msgstr "" #: gcov-tool.cc:157 gcov-tool.cc:300 #, c-format msgid "no profile files were merged\n" -msgstr "" +msgstr "no se han mezclado ficheros de perfil\n" #: gcov-tool.cc:169 #, c-format @@ -18925,26 +18925,22 @@ msgid " -w, --weight <w1,w2> Set weights (float point values)\ msgstr " -w, --weight <p1,p2> Establece los pesos (valores de coma flotante)\n" #: gcov-tool.cc:188 -#, fuzzy, c-format -#| msgid "Merge subcomand usage:" +#, c-format msgid "Merge subcommand usage:" msgstr "Modo de empleo de la suborden de mezcla:" #: gcov-tool.cc:240 -#, fuzzy, c-format -#| msgid "" -#| " -l, --long-file-names Use long output file names for included\n" -#| " source files\n" +#, c-format msgid "" " merge-stream [options] [<file>] Merge coverage stream file (or stdin)\n" " and coverage file contents\n" msgstr "" -" -l, --long-file-names Usa nombres largos de ficheros para los\n" -" ficheros fuentes incluidos\n" +" merge-stream [options] [<fich>] Mezcla el fichero de flujo de cobertura\n" +" (o stdin) y el contenido del fichero de\n" +" cobertura\n" #: gcov-tool.cc:258 -#, fuzzy, c-format -#| msgid "Merge subcomand usage:" +#, c-format msgid "Merge-stream subcommand usage:" msgstr "Modo de empleo de la suborden de mezcla:" @@ -19014,8 +19010,7 @@ msgid " -t <float>, --hot_threshold <float> Set the threshold for hotness\n" msgstr " -t <float>, --hot_threshold <float> Establece el umbral de calentura\n" #: gcov-tool.cc:510 -#, fuzzy, c-format -#| msgid "Overlap subcomand usage:" +#, c-format msgid "Overlap subcommand usage:" msgstr "Modo de empleo de la suborden de solapamiento:" @@ -19059,10 +19054,9 @@ msgstr "" "%s.\n" #: gcov-tool.cc:595 -#, fuzzy, c-format -#| msgid "Copyright %s 2019 Free Software Foundation, Inc.\n" +#, c-format msgid "Copyright %s 2025 Free Software Foundation, Inc.\n" -msgstr "Copyright %s 2019 Free Software Foundation, Inc.\n" +msgstr "Copyright %s 2025 Free Software Foundation, Inc.\n" #: gcov.cc:1096 #, c-format @@ -19102,22 +19096,21 @@ msgstr "" " en lugar de los porcentajes\n" #: gcov.cc:1102 -#, fuzzy, c-format -#| msgid "" -#| " -c, --branch-counts Output counts of branches taken\n" -#| " rather than percentages\n" +#, c-format msgid "" " -g, --conditions Include modified condition/decision\n" " coverage (masking MC/DC) in output\n" msgstr "" -" -c, --branch-counts Se muestra el número de ramificaciones\n" -" en lugar de los porcentajes\n" +" -g, --conditions Incluye la cobertura de condición/decisión\n" +" modificada (enmascarando MC/DC) en la\n" +" salida\n" #: gcov.cc:1104 -#, fuzzy, c-format -#| msgid " -p, --preserve-paths Preserve all pathname components\n" +#, c-format msgid " -e, --prime-paths Show prime path coverage summary\n" -msgstr " -p, --preserve-paths Preserva todos los nombres de ruta de los componentes\n" +msgstr "" +" -e, --prime-paths Muestra el resumen de la cobertura de camino\n" +" primario\n" #: gcov.cc:1105 #, c-format @@ -19127,6 +19120,10 @@ msgid "" " TYPE is 'covered', 'uncovered', or 'both'\n" " and defaults to 'uncovered'\n" msgstr "" +" --prime-paths-lines[=TIPO] Incluye los caminos en la salida\n" +" modo de traza de lÃnea - no afecta a json\n" +" TIPO es 'covered', 'uncovered' o 'both'\n" +" y el predefinido es 'uncovered'\n" #: gcov.cc:1109 #, c-format @@ -19136,6 +19133,10 @@ msgid "" " TYPE is 'covered', 'uncovered', or 'both'\n" " and defaults to 'uncovered'\n" msgstr "" +" --prime-paths-source[=TIPO] Incluye los caminos en la salida\n" +" modo de traza de fuente - no afecta a json\n" +" TIPO es 'covered', 'uncovered' o 'both'\n" +" y el predefinido es 'uncovered'\n" #: gcov.cc:1113 #, c-format @@ -19145,7 +19146,7 @@ msgstr " -d, --display-progress Muestra información de progreso\n" #: gcov.cc:1114 #, c-format msgid " -D, --debug\t\t\t Display debugging dumps\n" -msgstr "" +msgstr " -D, --debug\t\t\t Muestra volcados de depuración\n" #: gcov.cc:1115 #, c-format @@ -19153,16 +19154,14 @@ msgid " -f, --function-summaries Output summaries for each function\n" msgstr " -f, --function-summaries Muestra sumarios para cada función\n" #: gcov.cc:1116 -#, fuzzy, c-format -#| msgid " -f, --function Print function level info\n" +#, c-format msgid " --include Include functions matching this regex\n" -msgstr " -f, --function Imprime información sobre el nivel de funciones\n" +msgstr " --include Incluye funciones coincidentes con esta regex\n" #: gcov.cc:1117 -#, fuzzy, c-format -#| msgid " -h, --help Print this help, then exit\n" +#, c-format msgid " --exclude Exclude functions matching this regex\n" -msgstr " -h, --help Muestra esta información, y finaliza\n" +msgstr " --exclude Excluye funciones coincidentes con esta regex\n" #: gcov.cc:1118 #, c-format @@ -19170,18 +19169,18 @@ msgid " -h, --help Print this help, then exit\n" msgstr " -h, --help Muestra esta información, y finaliza\n" #: gcov.cc:1119 -#, fuzzy, c-format -#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n" +#, c-format msgid "" " -j, --json-format Output JSON intermediate format\n" " into .gcov.json.gz file\n" -msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n" +msgstr "" +" -j, --json-format EnvÃa el formato intermedio JSON\n" +" al fichero .gcov.json.gz\n" #: gcov.cc:1121 -#, fuzzy, c-format -#| msgid " -j, --human-readable Output human readable numbers\n" +#, c-format msgid " -H, --human-readable Output human readable numbers\n" -msgstr " -j, --human-readable Salida con números legibles para humanos\n" +msgstr " -H, --human-readable Salida con números legibles para humanos\n" #: gcov.cc:1122 #, c-format @@ -19200,19 +19199,16 @@ msgstr "" #: gcov.cc:1125 #, c-format msgid " -m, --demangled-names Output demangled function names\n" -msgstr " -m, --demangled-names Nombres de función mutilados de salida\n" +msgstr " -m, --demangled-names Saca nombres de función desofuscados\n" #: gcov.cc:1126 -#, fuzzy, c-format -#| msgid "" -#| " -l, --long-file-names Use long output file names for included\n" -#| " source files\n" +#, c-format msgid "" " -M, --filter-on-demangled Make --include/--exclude match on demangled\n" " names. This does not imply -m\n" msgstr "" -" -l, --long-file-names Usa nombres largos de ficheros para los\n" -" ficheros fuentes incluidos\n" +" -M, --filter-on-demangled Aplica --include/--exclude a los nombres\n" +" desofuscados. No implica -m\n" #: gcov.cc:1128 #, c-format @@ -19270,24 +19266,23 @@ msgid " -x, --hash-filenames Hash long pathnames\n" msgstr " -x, --hash-filenames Nombres de ruta largos de Hash\n" #: gcov.cc:1139 -#, fuzzy, c-format -#| msgid "Options:\n" +#, c-format msgid "" "\n" "Obsolete options:\n" -msgstr "Opciones:\n" +msgstr "" +"\n" +"Opciones obsoletas:\n" #: gcov.cc:1140 -#, fuzzy, c-format -#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n" +#, c-format msgid " -i, --json-format Replaced with -j, --json-format\n" -msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n" +msgstr " -i, --json-format Reemplazado por -j, --json-format\n" #: gcov.cc:1141 -#, fuzzy, c-format -#| msgid " -j, --human-readable Output human readable numbers\n" +#, c-format msgid " -j, --human-readable Replaced with -H, --human-readable\n" -msgstr " -j, --human-readable Salida con números legibles para humanos\n" +msgstr " -j, --human-readable Reemplazado por -H, --human-readable\n" #: gcov.cc:1152 #, c-format @@ -19295,20 +19290,19 @@ msgid "gcov %s%s\n" msgstr "gcov %s%s\n" #: gcov.cc:1153 -#, fuzzy, c-format -#| msgid "collect2 version %s\n" +#, c-format msgid "JSON format version: %s\n" -msgstr "collect2 versión %s\n" +msgstr "versión del formato JSON: %s\n" #: gcov.cc:1237 #, c-format msgid "invalid argument '%s' for '--prime-paths-lines'. Valid arguments are: 'covered', 'uncovered', 'both'\n" -msgstr "" +msgstr "argumento no válido '%s' para --prime-paths-lines'. Argumentos válidos: 'covered', 'uncovered', 'both'\n" #: gcov.cc:1258 #, c-format msgid "invalid argument '%s' for '--prime-paths-source'. Valid arguments are: 'covered', 'uncovered', 'both'\n" -msgstr "" +msgstr "argumento no válido '%s' para --prime-paths-source'. Argumentos válidos: 'covered', 'uncovered', 'both'\n" #: gcov.cc:1726 #, c-format @@ -19376,10 +19370,9 @@ msgid "%s:already seen blocks for '%s'\n" msgstr "%s:ya se vieron bloques para '%s'\n" #: gcov.cc:2391 -#, fuzzy, c-format -#| msgid "%s:already seen blocks for '%s'\n" +#, c-format msgid "%s:already seen conditions for '%s'\n" -msgstr "%s:ya se vieron bloques para '%s'\n" +msgstr "%s:condiciones ya vistas para '%s'\n" #: gcov.cc:2449 gcov.cc:2589 #, c-format @@ -19482,28 +19475,24 @@ msgid "No calls\n" msgstr "No hay llamadas\n" #: gcov.cc:3090 gcov.cc:3144 -#, fuzzy, c-format -#| msgid "Lines executed:%s of %d\n" +#, c-format msgid "Condition outcomes covered:%s of %d\n" -msgstr "LÃneas ejecutadas:%s de %d\n" +msgstr "Salidas de condiciones cubiertas:%s de %d\n" #: gcov.cc:3095 gcov.cc:3149 -#, fuzzy, c-format -#| msgid "bad condition code" +#, c-format msgid "No conditions\n" -msgstr "código de condición erróneo" +msgstr "No hay condiciones\n" #: gcov.cc:3101 gcov.cc:3155 -#, fuzzy, c-format -#| msgid "Branches executed:%s of %d\n" +#, c-format msgid "Prime paths covered:%s of %d\n" -msgstr "Ramificaciones ejecutadas:%s de %d\n" +msgstr "Caminos primarios cubiertos:%s de %d\n" #: gcov.cc:3105 gcov.cc:3159 -#, fuzzy, c-format -#| msgid "Display this information." +#, c-format msgid "No path information\n" -msgstr "Muestra esta información." +msgstr "No hay información de caminos\n" #: gcov.cc:3379 #, c-format @@ -19513,13 +19502,12 @@ msgstr "%s:no hay lÃneas para '%s'\n" #: gcov.cc:3515 #, c-format msgid "condition outcomes covered %d/%d\n" -msgstr "" +msgstr "salidas de condiciones cubiertas %d/%d\n" #: gcov.cc:3528 -#, fuzzy, c-format -#| msgid "unconditional %2d taken %s\n" +#, c-format msgid "condition %2u not covered (%s%s)\n" -msgstr "el incondicional %2d tomado %s\n" +msgstr "condición %2u no cubierta (%s%s)\n" #: gcov.cc:3542 #, c-format @@ -19537,10 +19525,9 @@ msgid "branch %2d taken %s%s" msgstr "ramificación %2d tomada %s%s" #: gcov.cc:3557 -#, fuzzy, c-format -#| msgid "branch %2d never executed" +#, c-format msgid "branch %2d never executed%s" -msgstr "la ramificacion %2d nunca se ejecuta" +msgstr "la ramificacion %2d nunca se ejecuta%s" #: gcov.cc:3562 #, c-format @@ -19558,15 +19545,14 @@ msgid "unconditional %2d never executed\n" msgstr "el incondicional %2d nunca se ejecuta\n" #: gcov.cc:3729 -#, fuzzy, c-format -#| msgid "parameter name omitted" +#, c-format msgid "path coverage omitted\n" -msgstr "se omitió el nombre del parámetro" +msgstr "cobertura de caminos omitida\n" #: gcov.cc:3731 #, c-format msgid "paths covered %u of %zu\n" -msgstr "" +msgstr "caminos cubiertos %u de %zu\n" #: gcov.cc:3806 #, c-format @@ -19612,16 +19598,14 @@ msgid "End of search list.\n" msgstr "Fin de la lista de búsqueda.\n" #: incpath.cc:408 -#, fuzzy, c-format -#| msgid "#include <...> search starts here:\n" +#, c-format msgid "#embed <...> search starts here:\n" -msgstr "la búsqueda de #include <...> inicia aquÃ:\n" +msgstr "la búsqueda de #embed <...> comienza aquÃ:\n" #: incpath.cc:411 -#, fuzzy, c-format -#| msgid "End of search list.\n" +#, c-format msgid "End of #embed search list.\n" -msgstr "Fin de la lista de búsqueda.\n" +msgstr "Fin de la lista de búsqueda de #embed.\n" #: input.cc:35 msgid "<built-in>" @@ -27144,10 +27128,9 @@ msgid "wrong number of arguments to %%:dwarf-version-gt" msgstr "número erróneo de argumentos para %%:debug-level-gt" #: gcov-tool.cc:75 -#, fuzzy, gcc-internal-format, gfc-internal-format -#| msgid "error in removing %s\n" +#, gcc-internal-format, gfc-internal-format msgid "error in removing %s" -msgstr "error al quitar %s\n" +msgstr "error al quitar %s" #: gcov-tool.cc:106 #, gcc-internal-format, gfc-internal-format @@ -27167,19 +27150,17 @@ msgstr "No se puede cambiar al directorio %s" #: gcov-tool.cc:125 #, gcc-internal-format, gfc-internal-format msgid "output file %s already exists in folder %s" -msgstr "" +msgstr "el fichero de salida %s ya existe en la carpeta %s" #: gcov-tool.cc:217 gcov-tool.cc:285 -#, fuzzy, gcc-internal-format -#| msgid "weights need to be non-negative\n" +#, gcc-internal-format msgid "weights need to be non-negative" -msgstr "los pesos tienen que ser no negativos\n" +msgstr "los pesos han de ser no negativos" #: gcov-tool.cc:424 -#, fuzzy, gcc-internal-format -#| msgid "scale needs to be non-negative\n" +#, gcc-internal-format msgid "scale needs to be non-negative" -msgstr "la escala tiene que ser no negativa\n" +msgstr "la escala ha de ser no negativa" #: gcse.cc:4194 #, gcc-internal-format, gfc-internal-format diff --git a/gcc/selftest-xml.h b/gcc/selftest-xml.h new file mode 100644 index 0000000..fd5c0af --- /dev/null +++ b/gcc/selftest-xml.h @@ -0,0 +1,50 @@ +/* Selftest support for XML. + Copyright (C) 2025 Free Software Foundation, Inc. + Contributed by David Malcolm <dmalcolm@redhat.com>. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_SELFTEST_XML_H +#define GCC_SELFTEST_XML_H + +#include "xml.h" + +/* The selftest code should entirely disappear in a production + configuration, hence we guard all of it with #if CHECKING_P. */ + +#if CHECKING_P + +namespace selftest { + +/* Assert that NODE written with indentation as xml source + equals EXPECTED_VALUE. + Use LOC for any failures. */ + +void +assert_xml_print_eq (const location &loc, + const xml::node &node, + const char *expected_value); +#define ASSERT_XML_PRINT_EQ(XML_NODE, EXPECTED_VALUE) \ + assert_xml_print_eq ((SELFTEST_LOCATION), \ + (XML_NODE), \ + (EXPECTED_VALUE)) + +} // namespace selftest + +#endif /* #if CHECKING_P */ + +#endif /* GCC_SELFTEST_XML_H */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fbf5fe..c339beb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,294 @@ +2025-06-14 Georg-Johann Lay <avr@gjlay.de> + + Backported from master: + 2025-06-14 Georg-Johann Lay <avr@gjlay.de> + + PR rtl-optimization/120423 + PR rtl-optimization/116389 + * gcc.target/avr/torture/pr120423-1.c: New test. + * gcc.target/avr/torture/pr120423-2.c: New test. + * gcc.target/avr/torture/pr120423-116389.c: New test. + +2025-06-14 Iain Sandoe <iain@sandoe.co.uk> + + * g++.dg/coroutines/coro1-missing-await-method.C: Adjust for + improved diagnostics. + * g++.dg/coroutines/coro-missing-final-suspend.C: Likewise. + * g++.dg/coroutines/pr104051.C: Move to... + * g++.dg/coroutines/pr104051-0.C: ...here. + * g++.dg/coroutines/pr104051-1.C: New test. + +2025-06-13 Iain Sandoe <iain@sandoe.co.uk> + + PR c++/116775 + * g++.dg/coroutines/pr116775.C: New test. + +2025-06-13 Spencer Abson <spencer.abson@arm.com> + + PR target/118150 + * gcc.target/aarch64/sve/acle/general/not_1.c: New test. + +2025-06-13 Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu> + + PR testsuite/119862 + * gcc.dg/pr119160.c: Added empty definitions for + `__cyg_profile_func_enter` and `__cyg_profile_func_exit` + functions. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/120638 + * gcc.dg/pr120638.c: New test. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120630 + * gcc.dg/pr120630.c: New test. + * gcc.c-torture/execute/pr120630.c: New test. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * g++.dg/opt/pr120629.C: New test. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check + for vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check + for vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check + for max func 1 vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c: New test. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check + for max func 1 vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test + helper macros. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test + data for run test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c: New test. + +2025-06-12 Richard Sandiford <richard.sandiford@arm.com> + + PR target/120624 + * gcc.target/aarch64/sme/za_state_7.c: New test. + +2025-06-12 Georg-Johann Lay <avr@gjlay.de> + + PR middle-end/117811 + PR testsuite/52641 + * gcc.dg/torture/pr117811.c: Fix for int < 32 bit. + +2025-06-12 Gwenole Beauchesne <gb.devel@gmail.com> + Andrew Pinski <quic_apinski@quicinc.com> + + PR c++/41201 + PR c++/48026 + * c-c++-common/pragma-optimize-1.c: New test. + * g++.target/i386/vect-pragma-target-1.C: New test. + * g++.target/i386/vect-pragma-target-2.C: New test. + * gcc.target/i386/vect-pragma-target-1.c: New test. + * gcc.target/i386/vect-pragma-target-2.c: New test. + +2025-06-11 Martin Uecker <uecker@tugraz.at> + + PR c/120510 + * gcc.dg/old-style-prom-4.c: New test. + +2025-06-11 Edwin Lu <ewlu@rivosinc.com> + + * gcc.target/riscv/rvv/vsetvl/pr117974.c: New test. + +2025-06-11 Paul-Antoine Arras <parras@baylibre.com> + + PR target/119100 + * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfnmadd and + vfnmsub. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h: Add support for neg + variants. Fix sign for sub. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h: Add data for neg + variants. Fix data for sub. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h: Rename x to f. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c: Add neg + argument. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c: Likewise. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c: New test. + +2025-06-11 Martin Uecker <uecker@tugraz.at> + + PR c/120303 + * gcc.dg/pr120303.c: New test. + +2025-06-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/90693 + * gcc.target/i386/pr90693-3.c: New test. + * gcc.target/i386/pr90693-4.c: New test. + * gcc.target/i386/pr90693-5.c: New test. + * gcc.target/i386/pr90693-6.c: New test. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * gcc.dg/html-output/missing-semicolon.py: Update for changes + to diagnostic elements. + * gcc.dg/format/diagnostic-ranges-html.py: Likewise. + * gcc.dg/plugin/diagnostic-test-metadata-html.py: Likewise. Drop + out-of-date comment. + * gcc.dg/plugin/diagnostic-test-paths-2.py: Likewise. + * gcc.dg/plugin/diagnostic-test-paths-4.py: Likewise. Drop + out-of-date comment. + * gcc.dg/plugin/diagnostic-test-show-locus.py: Likewise. + * lib/htmltest.py (get_diag_by_index): Update to use search by id. + (get_message_within_diag): Update to use search by class. + +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/120610 + * gcc.dg/format/diagnostic-ranges-html.py: Remove out-of-date + comment. + +2025-06-10 Vineet Gupta <vineetg@rivosinc.com> + + * gcc.target/riscv/rvv/vtype-call-clobbered.c: Fix -mabi. + +2025-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * gcc.target/i386/pr120434-2.c: New test. + +2025-06-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120434 + * gcc.target/i386/pr120434-1.c: New test. + +2025-06-10 Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/ventana-16122.c: New test. + +2025-06-10 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c: Add asm check + for vremu.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c: Ditto. + +2025-06-10 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check + for vremu.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test + data for run test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c: New test. + +2025-06-10 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Adjust the + asm check for vremu. + * gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto. + 2025-06-09 Martin Uecker <uecker@tugraz.at> PR c/120510 diff --git a/gcc/testsuite/c-c++-common/pragma-optimize-1.c b/gcc/testsuite/c-c++-common/pragma-optimize-1.c new file mode 100644 index 0000000..1446e5a --- /dev/null +++ b/gcc/testsuite/c-c++-common/pragma-optimize-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +/* PR c++/48026 */ +/* Make sure `#pragma GCC optimize` affects the pre-defined macros too */ + +#pragma GCC optimize ("no-fast-math") +#ifdef __FAST_MATH__ +# error Hey yo, What you doing on FAST_MATH?? +#endif diff --git a/gcc/testsuite/g++.dg/coroutines/coro-missing-final-suspend.C b/gcc/testsuite/g++.dg/coroutines/coro-missing-final-suspend.C index 6a0878c..b252231 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro-missing-final-suspend.C +++ b/gcc/testsuite/g++.dg/coroutines/coro-missing-final-suspend.C @@ -7,10 +7,10 @@ #include "coro1-ret-int-yield-int.h" coro1 -my_coro () // { dg-error {no member named 'final_suspend' in} } +my_coro () { co_return 0; -} +} // { dg-error {no member named 'final_suspend' in} } // check we have not messed up continuation of the compilation. template <class... Args> diff --git a/gcc/testsuite/g++.dg/coroutines/coro1-missing-await-method.C b/gcc/testsuite/g++.dg/coroutines/coro1-missing-await-method.C index c1869e0..c6a3188 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro1-missing-await-method.C +++ b/gcc/testsuite/g++.dg/coroutines/coro1-missing-await-method.C @@ -7,7 +7,7 @@ #include "coro1-ret-int-yield-int.h" coro1 -bar0 () // { dg-error {no member named 'await_suspend' in 'coro1::suspend_always_prt'} } +bar0 () { co_await coro1::suspend_never_prt{}; // { dg-error {no member named 'await_ready' in 'coro1::suspend_never_prt'} } co_yield 5; // { dg-error {no member named 'await_suspend' in 'coro1::suspend_always_prt'} } diff --git a/gcc/testsuite/g++.dg/coroutines/pr104051.C b/gcc/testsuite/g++.dg/coroutines/pr104051-0.C index f77a915..bf878b2 100644 --- a/gcc/testsuite/g++.dg/coroutines/pr104051.C +++ b/gcc/testsuite/g++.dg/coroutines/pr104051-0.C @@ -24,7 +24,7 @@ template <typename T> struct task { std::coroutine_handle<> await_suspend(std::coroutine_handle<>); T await_resume(); }; -task<std::vector<int>> foo() { // { dg-error {awaitable type 'bool' is not a structure} } +task<std::vector<int>> foo() { while ((co_await foo()).empty()) ; -} +} // { dg-error {'final_suspend\(\)' awaitable type 'bool' is not a structure} } diff --git a/gcc/testsuite/g++.dg/coroutines/pr104051-1.C b/gcc/testsuite/g++.dg/coroutines/pr104051-1.C new file mode 100644 index 0000000..35b5e2c --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr104051-1.C @@ -0,0 +1,23 @@ +// { dg-additional-options "-fsyntax-only" } +// { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } +#include <coroutine> +template <typename> +struct promise { + auto get_return_object() { + return std::coroutine_handle<promise>::from_promise(*this); + } + auto initial_suspend() { return 42.0; } + auto final_suspend() noexcept { return true; } + void unhandled_exception(); + void return_void (); +}; +template <typename T> struct task { + using promise_type = promise<T>; + task(std::coroutine_handle<promise<T>>); + bool await_ready(); + std::coroutine_handle<> await_suspend(std::coroutine_handle<>); + T await_resume(); +}; +task<double> foo() { // { dg-error {'initial_suspend\(\)' awaitable type 'double' is not a structure} } + co_return; +} diff --git a/gcc/testsuite/g++.dg/coroutines/pr116775.C b/gcc/testsuite/g++.dg/coroutines/pr116775.C new file mode 100644 index 0000000..981e27a --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr116775.C @@ -0,0 +1,68 @@ +// { dg-additional-options "-fsyntax-only" } +// PR116775 +#include <coroutine> +#ifndef OUTPUT +# define PRINT(X) +# define PRINTF(...) +#else +#include <cstdio> +# define PRINT(X) puts(X) +# define PRINTF(...) printf(__VA_ARGS__) +#endif + +struct awaitable { + awaitable(int n) : delay{n} {} + + constexpr bool await_ready() const noexcept { return false; } + auto await_suspend(std::coroutine_handle<> h) const { + __builtin_trap (); + return false; + } + int await_resume() const noexcept { + return delay; + } + + int delay; +}; + +struct Task { + struct promise_type { + promise_type() = default; + Task get_return_object() { return {}; } + std::suspend_never initial_suspend() { return {}; } + std::suspend_always final_suspend() noexcept { return {}; } + void unhandled_exception() {} + void return_void () {} + awaitable yield_value (int v) { return {v}; } + }; +}; + +Task foo() noexcept { + if (__builtin_constant_p (true ? 1 : co_await awaitable{10})) + PRINT ("const OK"); + else + { + PRINT ("failed : should be const"); + __builtin_abort (); + } + if (__builtin_constant_p (false ? 1 : co_await awaitable{15})) + { + PRINT ("failed : should not be const"); + __builtin_abort (); + } + else + PRINT ("not const, OK"); + if (__builtin_constant_p (5 == (co_yield 42))) + { + PRINT ("failed : should not be const"); + __builtin_abort (); + } + else + PRINT ("not const, OK"); + co_return; +} + +//call foo +int main() { + foo(); +} diff --git a/gcc/testsuite/g++.dg/opt/pr120629.C b/gcc/testsuite/g++.dg/opt/pr120629.C new file mode 100644 index 0000000..70a9cdd --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr120629.C @@ -0,0 +1,53 @@ +// PR middle-end/120629 +// { dg-do run } +// { dg-options "-O2 -fprofile-generate -fno-exceptions -fno-rtti" } +// { dg-require-profiling "-fprofile-generate" } + +__attribute__((noipa, noreturn, cold)) void +foo (const char *, int, const char *) +{ + __builtin_abort (); +} + +struct S +{ + __attribute__((noipa)) void bar (void *); + static const int a = 8; + unsigned int b[a + 1]; +}; + +__attribute__((noipa)) unsigned long +baz (void *) +{ + static int x = 8; + return --x; +} + +__attribute__((noipa)) void +S::bar (void *x) +{ + unsigned int c; + int k = 0; + + do + { + ((void) (!(k <= a) ? foo ("foo", 42, __FUNCTION__), 0 : 0)); + c = b[k++] = baz (x); + } + while (c); + while (k <= a) + b[k++] = 0; +} + +int +main () +{ + struct T { S a; unsigned int b; } s = {}; + s.b = 0x1234; + s.a.bar (0); + for (int i = 0; i < 9; ++i) + if (s.a.b[i] != (i == 8 ? 0 : 7 - i)) + __builtin_abort (); + if (s.b != 0x1234) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C b/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C new file mode 100644 index 0000000..2f360cf --- /dev/null +++ b/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C @@ -0,0 +1,6 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */ +#include "../../gcc.target/i386/vect-pragma-target-1.c" diff --git a/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C b/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C new file mode 100644 index 0000000..b85bc93 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C @@ -0,0 +1,6 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */ +#include "../../gcc.target/i386/vect-pragma-target-2.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120630.c b/gcc/testsuite/gcc.c-torture/execute/pr120630.c new file mode 100644 index 0000000..46cfac9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr120630.c @@ -0,0 +1,29 @@ +/* PR middle-end/120630 */ + +__attribute__((noipa)) int +foo (const char *x, ...) +{ + return *x; +} + +int a, b, c; +unsigned d = 1; + +int +main () +{ + if (a) + foo ("0"); + int e = -1; + if (a < 1) + { + e = c; + if (c) + while (1) + ; + } + b = (~e + 0UL) / -1; + if (d > b) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py index 91383d6..b0b59d9 100644 --- a/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py +++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py @@ -19,17 +19,20 @@ def test_message(html_tree): diag = get_diag_by_index(html_tree, 0) msg = get_message_within_diag(diag) - assert_tag(msg[0], 'span') - assert_class(msg[0], 'gcc-quoted-text') - assert_highlighted_text(msg[0][0], 'highlight-a', '%i') - + assert_tag(msg[0], 'strong') + assert msg[0].text == 'warning: ' + assert_tag(msg[1], 'span') assert_class(msg[1], 'gcc-quoted-text') - assert_highlighted_text(msg[1][0], 'highlight-a', 'int') + assert_highlighted_text(msg[1][0], 'highlight-a', '%i') assert_tag(msg[2], 'span') assert_class(msg[2], 'gcc-quoted-text') - assert_highlighted_text(msg[2][0], 'highlight-b', 'const char *') + assert_highlighted_text(msg[2][0], 'highlight-a', 'int') + + assert_tag(msg[3], 'span') + assert_class(msg[3], 'gcc-quoted-text') + assert_highlighted_text(msg[3][0], 'highlight-b', 'const char *') def test_annotations(html_tree): """ @@ -74,26 +77,3 @@ def test_annotations(html_tree): assert_class(tds[1], 'annotation') assert_highlighted_text(tds[1][0], 'highlight-a', 'int') assert_highlighted_text(tds[1][1], 'highlight-b', 'const char *') - -# For reference, here's the generated HTML: -""" - <span class="gcc-message" id="gcc-diag-0-message">format '<span class="gcc-quoted-text"><span class="high -light-a">%i</span></span>' expects argument of type '<span class="gcc-quoted-text"><span class="highlight-a" ->int</span></span>', but argument 2 has type '<span class="gcc-quoted-text"><span class="highlight-b">const -char *</span></span>'</span> - - <span class="gcc-option">[<a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat">-Wfo -rmat=</a>]</span> - <table class="locus"> - <tbody class="line-span"> - <tr><td class="left-margin"> </td><td class="source"> printf("hello <span class="highlight-a">%i</span>", <span class="highlight-b">msg</span>); /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */</td></tr> - <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">~^</spa -n> <span class="highlight-b">~~~</span></td></tr> - <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">|</spa -n> <span class="highlight-b">|</span></td></tr> - <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">int</s -pan> <span class="highlight-b">const char *</span></td></tr> - <tr><td class="left-margin"> </td><td class="annotation"> %s</td></tr> - </tbody> - </table> -""" diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py index 880fcc0..3adaa52 100644 --- a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py +++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py @@ -37,22 +37,68 @@ def test_basics(html_tree): diag = diag_list.find('xhtml:div', ns) assert diag is not None - assert diag.attrib['class'] == 'gcc-diagnostic' + assert diag.attrib['class'] == 'alert alert-danger' + assert diag.attrib['id'] == 'gcc-diag-0' - message = diag.find('xhtml:span', ns) + icon = diag.find('xhtml:span', ns) + assert icon.attrib['class'] == 'pficon pficon-error-circle-o' + + # The message line: + message = diag.find("./xhtml:div[@class='gcc-message']", ns) assert message is not None - assert message.attrib['class'] == 'gcc-message' - assert message.text == "expected '" - assert message[0].tag == make_tag('span') - assert message[0].attrib['class'] == 'gcc-quoted-text' - assert message[0].text == ';' - assert message[0].tail == "' before '" + # <html:div xmlns:html="http://www.w3.org/1999/xhtml" class="gcc-message" id="gcc-diag-0-message"><html:strong>error: </html:strong> expected '<html:span class="gcc-quoted-text">;</html:span>' before '<html:span class="gcc-quoted-text">}</html:span>' token</html:div> + assert message[0].tag == make_tag('strong') + assert message[0].text == 'error: ' + assert message[0].tail == " expected '" assert message[1].tag == make_tag('span') assert message[1].attrib['class'] == 'gcc-quoted-text' - assert message[1].text == '}' - assert message[1].tail == "' token" + assert message[1].text == ';' + assert message[1].tail == "' before '" + assert message[2].tag == make_tag('span') + assert message[2].attrib['class'] == 'gcc-quoted-text' + assert message[2].text == '}' + assert message[2].tail == "' token" + + # Logical location + logical_loc = diag.find("./xhtml:div[@id='logical-location']", ns) + assert logical_loc is not None + assert len(logical_loc) == 2 + assert logical_loc[0].tag == make_tag('span') + assert logical_loc[0].text == 'Function ' + assert logical_loc[1].tag == make_tag('span') + assert logical_loc[1].text == 'missing_semicolon' + assert logical_loc[1].attrib['class'] == 'gcc-quoted-text' + + # Physical location + file_ = diag.find("./xhtml:div[@id='file']", ns) + assert file_ is not None + assert len(file_) == 2 + assert file_[0].tag == make_tag('span') + assert file_[0].text == 'File ' + assert file_[1].tag == make_tag('span') + assert file_[1].text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c') + + line = diag.find("./xhtml:div[@id='line']", ns) + assert line is not None + assert len(line) == 2 + assert line[0].tag == make_tag('span') + assert line[0].text == 'Line ' + assert line[1].tag == make_tag('span') + assert line[1].text == '8' + + column = diag.find("./xhtml:div[@id='column']", ns) + assert column is not None + assert len(column) == 2 + assert column[0].tag == make_tag('span') + assert column[0].text == 'Column ' + assert column[1].tag == make_tag('span') + assert column[1].text == '12' - pre = diag.find('xhtml:pre', ns) + # Suggested fix + fix = diag.find("./xhtml:div[@id='suggested-fix']", ns) + label = fix.find('xhtml:label', ns) + assert label.text == "Suggested fix" + pre = fix.find('xhtml:pre', ns) assert pre is not None assert pre.attrib['class'] == 'gcc-generated-patch' assert pre.text.startswith('--- ') diff --git a/gcc/testsuite/gcc.dg/old-style-prom-4.c b/gcc/testsuite/gcc.dg/old-style-prom-4.c new file mode 100644 index 0000000..3632fa6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/old-style-prom-4.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu17" } */ + +int g(float a, float b); +int g(a, b) + float a; + float b; +{ +} + +int f(float a, float (*b)()); /* { dg-error "prototype declaration" } */ + +int f(a, b) + float a; + float (*b)(float); /* { dg-error "match prototype" } */ +{ +} + +int (*e(float a))(float (*b)()); + +int (*e(a))(float (*b)(float)) /* { dg-error "conflicting types" } */ + float a; +{ +} + diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py index b4c75b2..67fb241 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py @@ -21,10 +21,24 @@ def test_metadata(html_tree): diag = diag_list.find('xhtml:div', ns) assert diag is not None - assert diag.attrib['class'] == 'gcc-diagnostic' + assert diag.attrib['class'] == 'alert alert-warning' - spans = diag.findall('xhtml:span', ns) - metadata = spans[1] + icon = diag.find('xhtml:span', ns) + assert icon.attrib['class'] == 'pficon pficon-warning-triangle-o' + + message = diag.find("./xhtml:div[@class='gcc-message']", ns) + assert message.attrib['id'] == 'gcc-diag-0-message' + + assert message[0].tag == make_tag('strong') + assert message[0].text == 'warning: ' + assert message[0].tail == " never use '" + + assert message[1].tag == make_tag('span') + assert message[1].attrib['class'] == 'gcc-quoted-text' + assert message[1].text == 'gets' + assert message[1].tail == "' " + + metadata = message[2] assert metadata.attrib['class'] == 'gcc-metadata' assert metadata[0].tag == make_tag('span') assert metadata[0].attrib['class'] == 'gcc-metadata-item' @@ -57,21 +71,3 @@ def test_metadata(html_tree): annotation_tr = rows[1] assert_annotation_line(annotation_tr, ' ^~~~~~~~~~') - -# For reference, here's the generated HTML: -""" - <body> - <div class="gcc-diagnostic-list"> - <div class="gcc-diagnostic"> - <span class="gcc-message">never use '<span class="gcc-quoted-text">gets</span>'</span> - <span class="gcc-metadata"><span class="gcc-metadata-item">[<a href="https://cwe.mitre.org/data/definitions/242.html">CWE-242</a>]</span><span class="gcc-metadata-item">[<a href="https://example.com/">STR34-C</a>]</span></span><table class="locus"> -<tbody class="line-span"> -<tr><td class="linenum"> 10</td> <td class="source"> gets (buf);</td></tr> -<tr><td class="linenum"/><td class="annotation"> ^~~~~~~~~~</td></tr> -</tbody> -</table> - - </div> - </div> - </body> -""" diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py index 59bee24..f0fed45 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py @@ -21,9 +21,16 @@ def test_paths(html_tree): diag = diag_list.find('xhtml:div', ns) assert diag is not None - assert diag.attrib['class'] == 'gcc-diagnostic' + assert diag.attrib['class'] == 'alert alert-danger' + assert diag.attrib['id'] == 'gcc-diag-0' - event_ranges = diag.find('xhtml:div', ns) + exec_path = diag.find("./xhtml:div[@id='execution-path']", ns) + assert exec_path is not None + + label = exec_path.find('xhtml:label', ns) + assert label.text == 'Execution path with 3 events' + + event_ranges = exec_path.find('xhtml:div', ns) assert_class(event_ranges, 'event-ranges') frame_margin = event_ranges.find('xhtml:table', ns) diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py index e738729..d2bc67c 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py @@ -25,7 +25,13 @@ def test_paths(html_tree): assert_annotation_line(annotation_tr, ' ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') - event_ranges = diag.find('xhtml:div', ns) + exec_path = diag.find("./xhtml:div[@id='execution-path']", ns) + assert exec_path is not None + + label = exec_path.find('xhtml:label', ns) + assert label.text == 'Execution path with 9 events' + + event_ranges = exec_path.find('xhtml:div', ns) assert_class(event_ranges, 'event-ranges') test_frame_margin = event_ranges.find('xhtml:table', ns) @@ -41,150 +47,3 @@ def test_paths(html_tree): test_frame = tds[1] assert_frame(test_frame, 'test') assert_event_range_with_margin(test_frame[1]) - -# For reference, generated HTML looks like this: -""" -<table class="stack-frame-with-margin"><tr> - <td class="interprocmargin" style="padding-left: 100px"/> - <td class="stack-frame"> -<div class="frame-funcname"><span>test</span></div><table class="event-range-with-margin"><tr> - <td class="event-range"> - <div class="events-hdr"><span class="funcname">test</span>: <span class="event-ids">events 1-2</span></div> -<table class="locus"> -<tbody class="line-span"> -<tr><td class="linenum"> 27</td> <td class="source">{</td></tr> -<tr><td class="linenum"/><td class="annotation">^</td></tr> -<tr><td class="linenum"/><td class="annotation">|</td></tr> -<tr><td class="linenum"/><td class="annotation">(1) entering 'test'</td></tr> -<tr><td class="linenum"> 28</td> <td class="source"> register_handler ();</td></tr> -<tr><td class="linenum"/><td class="annotation"> ~~~~~~~~~~~~~~~~~~~</td></tr> -<tr><td class="linenum"/><td class="annotation"> |</td></tr> -<tr><td class="linenum"/><td class="annotation"> (2) calling 'register_handler'</td></tr> -</tbody> -</table> -</td></tr></table> -<div class="between-ranges-call"> - <svg height="30" width="150"> - <defs> - <marker id="arrowhead" markerWidth="10" markerHeight="7" - refX="0" refY="3.5" orient="auto" stroke="#0088ce" fill="#0088ce"> - <polygon points="0 0, 10 3.5, 0 7"/> - </marker> - </defs> - <polyline points="20,0 20,10 120,10 120,20" - style="fill:none;stroke: #0088ce" - marker-end="url(#arrowhead)"/> - </svg> -</div> - -<table class="stack-frame-with-margin"><tr> - <td class="interprocmargin" style="padding-left: 100px"/> - <td class="stack-frame"> -<div class="frame-funcname"><span>register_handler</span></div><table class="event-range-with-margin"><tr> - <td class="event-range"> - <div class="events-hdr"><span class="funcname">register_handler</span>: <span class="event-ids">events 3-4</span></div> -<table class="locus"> -<tbody class="line-span"> -<tr><td class="linenum"> 22</td> <td class="source">{</td></tr> -<tr><td class="linenum"/><td class="annotation">^</td></tr> -<tr><td class="linenum"/><td class="annotation">|</td></tr> -<tr><td class="linenum"/><td class="annotation">(3) entering 'register_handler'</td></tr> -<tr><td class="linenum"> 23</td> <td class="source"> signal(SIGINT, int_handler);</td></tr> -<tr><td class="linenum"/><td class="annotation"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~</td></tr> -<tr><td class="linenum"/><td class="annotation"> |</td></tr> -<tr><td class="linenum"/><td class="annotation"> (4) registering 'int_handler' as signal handler</td></tr> -</tbody> -</table> -</td></tr></table> -</td></tr></table> -</td></tr></table> -<div class="between-ranges-return"> - <svg height="30" width="250"> - <defs> - <marker id="arrowhead" markerWidth="10" markerHeight="7" - refX="0" refY="3.5" orient="auto" stroke="#0088ce" fill="#0088ce"> - <polygon points="0 0, 10 3.5, 0 7"/> - </marker> - </defs> - <polyline points="220,0 220,10 20,10 20,20" - style="fill:none;stroke: #0088ce" - marker-end="url(#arrowhead)"/> - </svg> -</div> - -<table class="event-range-with-margin"><tr> - <td class="event-range"> - <div class="events-hdr"><span class="event-ids">event 5</span></div> - (5): later on, when the signal is delivered to the process -</td></tr></table> -<div class="between-ranges-call"> - <svg height="30" width="150"> - <defs> - <marker id="arrowhead" markerWidth="10" markerHeight="7" - refX="0" refY="3.5" orient="auto" stroke="#0088ce" fill="#0088ce"> - <polygon points="0 0, 10 3.5, 0 7"/> - </marker> - </defs> - <polyline points="20,0 20,10 120,10 120,20" - style="fill:none;stroke: #0088ce" - marker-end="url(#arrowhead)"/> - </svg> -</div> - -<table class="stack-frame-with-margin"><tr> - <td class="interprocmargin" style="padding-left: 100px"/> - <td class="stack-frame"> -<div class="frame-funcname"><span>int_handler</span></div><table class="event-range-with-margin"><tr> - <td class="event-range"> - <div class="events-hdr"><span class="funcname">int_handler</span>: <span class="event-ids">events 6-7</span></div> -<table class="locus"> -<tbody class="line-span"> -<tr><td class="linenum"> 17</td> <td class="source">{</td></tr> -<tr><td class="linenum"/><td class="annotation">^</td></tr> -<tr><td class="linenum"/><td class="annotation">|</td></tr> -<tr><td class="linenum"/><td class="annotation">(6) entering 'int_handler'</td></tr> -<tr><td class="linenum"> 18</td> <td class="source"> custom_logger("got signal");</td></tr> -<tr><td class="linenum"/><td class="annotation"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~</td></tr> -<tr><td class="linenum"/><td class="annotation"> |</td></tr> -<tr><td class="linenum"/><td class="annotation"> (7) calling 'custom_logger'</td></tr> -</tbody> -</table> -</td></tr></table> -<div class="between-ranges-call"> - <svg height="30" width="150"> - <defs> - <marker id="arrowhead" markerWidth="10" markerHeight="7" - refX="0" refY="3.5" orient="auto" stroke="#0088ce" fill="#0088ce"> - <polygon points="0 0, 10 3.5, 0 7"/> - </marker> - </defs> - <polyline points="20,0 20,10 120,10 120,20" - style="fill:none;stroke: #0088ce" - marker-end="url(#arrowhead)"/> - </svg> -</div> - -<table class="stack-frame-with-margin"><tr> - <td class="interprocmargin" style="padding-left: 100px"/> - <td class="stack-frame"> -<div class="frame-funcname"><span>custom_logger</span></div><table class="event-range-with-margin"><tr> - <td class="event-range"> - <div class="events-hdr"><span class="funcname">custom_logger</span>: <span class="event-ids">events 8-9</span></div> -<table class="locus"> -<tbody class="line-span"> -<tr><td class="linenum"> 12</td> <td class="source">{</td></tr> -<tr><td class="linenum"/><td class="annotation">^</td></tr> -<tr><td class="linenum"/><td class="annotation">|</td></tr> -<tr><td class="linenum"/><td class="annotation">(8) entering 'custom_logger'</td></tr> -<tr><td class="linenum"> 13</td> <td class="source"> fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to 'fprintf' from within signal handler" } */</td></tr> -<tr><td class="linenum"/><td class="annotation"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</td></tr> -<tr><td class="linenum"/><td class="annotation"> |</td></tr> -<tr><td class="linenum"/><td class="annotation"> (9) calling 'fprintf'</td></tr> -</tbody> -</table> -</td></tr></table> -</td></tr></table> -</td></tr></table> - -</div> - """ diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py index d963b29..aca1b6c 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py @@ -46,7 +46,8 @@ def test_very_wide_line(html_tree): def test_fixit_insert(html_tree): diag = get_diag_by_index(html_tree, 3) msg = get_message_within_diag(diag) - assert msg.text == 'example of insertion hints' + assert msg[0].text == 'warning: ' + assert msg[0].tail == ' example of insertion hints' src = get_locus_within_diag(diag) @@ -62,7 +63,8 @@ def test_fixit_insert(html_tree): def test_fixit_remove(html_tree): diag = get_diag_by_index(html_tree, 4) msg = get_message_within_diag(diag) - assert msg.text == 'example of a removal hint' + assert msg[0].text == 'warning: ' + assert msg[0].tail == ' example of a removal hint' src = get_locus_within_diag(diag) @@ -78,7 +80,8 @@ def test_fixit_remove(html_tree): def test_fixit_replace(html_tree): diag = get_diag_by_index(html_tree, 5) msg = get_message_within_diag(diag) - assert msg.text == 'example of a replacement hint' + assert msg[0].text == 'warning: ' + assert msg[0].tail == ' example of a replacement hint' src = get_locus_within_diag(diag) @@ -94,7 +97,8 @@ def test_fixit_replace(html_tree): def test_fixit_insert_newline(html_tree): diag = get_diag_by_index(html_tree, 6) msg = get_message_within_diag(diag) - assert msg.text == 'example of newline insertion hint' + assert msg[0].text == 'warning: ' + assert msg[0].tail == ' example of newline insertion hint' src = get_locus_within_diag(diag) diff --git a/gcc/testsuite/gcc.dg/pr119160.c b/gcc/testsuite/gcc.dg/pr119160.c index 5743b3b..c3d9b81 100644 --- a/gcc/testsuite/gcc.dg/pr119160.c +++ b/gcc/testsuite/gcc.dg/pr119160.c @@ -4,6 +4,19 @@ typedef __attribute__((__vector_size__ (32))) int V; +/* Add empty implementations of __cyg_profile_func_enter() and + __cyg_profile_func_exit() to avoid problems on non-glibc + systems. */ +void __attribute__((no_instrument_function)) +__cyg_profile_func_enter(void *this_fn, void *call_site) +{ +} + +void __attribute__((no_instrument_function)) +__cyg_profile_func_exit(void *this_fn, void *call_site) +{ +} + void foo (V v, V, V, V *r) { diff --git a/gcc/testsuite/gcc.dg/pr120303.c b/gcc/testsuite/gcc.dg/pr120303.c new file mode 100644 index 0000000..caeff92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120303.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c2y" } */ + +int t = _Generic (char(1)); /* { dg-error "before numeric constant" } */ + diff --git a/gcc/testsuite/gcc.dg/pr120630.c b/gcc/testsuite/gcc.dg/pr120630.c new file mode 100644 index 0000000..14b0aaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120630.c @@ -0,0 +1,25 @@ +/* PR middle-end/120630 */ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch" } */ + +int a, c, d; + +void +foo (int b) +{ + a = b; +} + +int +main () +{ + while (d) + ; + for (c = 0; c > -3; c--) + { + long f = c; + foo (f >> 2); + } + if (a != -1) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/pr120638.c b/gcc/testsuite/gcc.dg/pr120638.c new file mode 100644 index 0000000..4a057a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120638.c @@ -0,0 +1,31 @@ +/* PR tree-optimization/120638 */ +/* { dg-do run } */ +/* { dg-options "-O2 -ffast-math" } */ + +extern float sqrtf (float x); + +__attribute__((noipa)) float +foo (unsigned int s) +{ + return 0.5f / sqrtf (1.f + s); +} + +__attribute__((noipa)) float +bar (float s) +{ + if (s < 0.0 || s > 65535.0f) + __builtin_unreachable (); + return 0.5f / sqrtf (1.f + s); +} + +int +main () +{ + if (__builtin_fabsf (foo (3) - 0.25f) > 0.00390625f + || __builtin_fabsf (foo (15) - 0.125f) > 0.00390625f + || __builtin_fabsf (foo (63) - 0.0625f) > 0.00390625f + || __builtin_fabsf (bar (3.0f) - 0.25f) > 0.00390625f + || __builtin_fabsf (bar (15.0f) - 0.125f) > 0.00390625f + || __builtin_fabsf (bar (63.0f) - 0.0625f) > 0.00390625f) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c index 13d7e13..05e8622 100644 --- a/gcc/testsuite/gcc.dg/torture/pr117811.c +++ b/gcc/testsuite/gcc.dg/torture/pr117811.c @@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift) int main () { +#if __SIZEOF_INT__ >= 4 v4 vec = {0x1000000, 0x2000, 0x300, 0x40}; v4 vec2 = {0x100000, 0x200, 0x30, 0x4}; +#else + v4 vec = {0x4000, 0x2000, 0x300, 0x40}; + v4 vec2 = {0x400, 0x200, 0x30, 0x4}; +#endif do_shift (&vec, 4); if (memcmp (&vec, &vec2, sizeof (v4)) != 0) __builtin_abort (); diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c new file mode 100644 index 0000000..38bc134 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c @@ -0,0 +1,21 @@ +// { dg-options "-O -fno-optimize-sibling-calls -fomit-frame-pointer" } + +#include <arm_sme.h> + +void callee(); + +__arm_new("za") __arm_locally_streaming int test() +{ + svbool_t all = svptrue_b8(); + svint8_t expected = svindex_s8(1, 1); + svwrite_hor_za8_m(0, 0, all, expected); + + callee(); + + svint8_t actual = svread_hor_za8_m(svdup_s8(0), all, 0, 0); + return svptest_any(all, svcmpne(all, expected, actual)); +} + +// { dg-final { scan-assembler {\tbl\t__arm_tpidr2_save\n} } } +// { dg-final { scan-assembler {\tbl\t__arm_tpidr2_restore\n} } } +// { dg-final { scan-assembler-times {\tsmstart\tza\n} 2 } } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/not_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/not_1.c new file mode 100644 index 0000000..875d788 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/not_1.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include <arm_sve.h> + +void +test1 (svbool_t pg, svbool_t x, int *any, svbool_t *ptr) +{ + svbool_t res = svnot_z (pg, x); + *any = svptest_last (pg, res); + *ptr = res; +} + +int +test2 (svbool_t pg, svbool_t x) +{ + svbool_t res = svnot_z (pg, x); + return svptest_first (pg, res); +} + +/* { dg-final { scan-assembler-times {\tnots\t} 2 } } */ +/* { dg-final { scan-assembler-not {\tnot\t} } } */ diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c new file mode 100644 index 0000000..91b4bbc --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +struct data +{ + int a; + int b; + long c; +}; + +unsigned char val; +unsigned val2; + +void func1 (struct data *d) +{ + d->a = 0; + d->b = 0x100 * val - 1; +} + +void func2 (struct data *d) +{ + d->a = 0; + d->c = 0x10000 * val2 - 1; +} + +void func3 (struct data *d) +{ + d->a = 0; + d->c = 0x1000000 * val - 1; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c new file mode 100644 index 0000000..928c135 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +struct T { int val; }; + +void f_int (int); +char* get_pos (void); +struct T* get_pT (void); + +void func (char i) +{ + struct T t = * get_pT (); + unsigned diff = get_pos () - &i; + + if (diff) + { + long val32 = t.val; + if (get_pos ()) + val32 = diff; + if (get_pos ()) + f_int (2 * val32); + } +} diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c new file mode 100644 index 0000000..56e6141 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ffixed-18 -ffixed-20 -ffixed-22" } */ + +struct data +{ + int a; + int b; + long c; +}; + +unsigned char val; +unsigned val2; + +void func1 (struct data *d) +{ + d->a = 0; + d->b = 0x100 * val - 1; +} + +void func2 (struct data *d) +{ + d->a = 0; + d->c = 0x10000 * val2 - 1; +} + +void func3 (struct data *d) +{ + d->a = 0; + d->c = 0x1000000 * val - 1; +} diff --git a/gcc/testsuite/gcc.target/i386/pr120434-2.c b/gcc/testsuite/gcc.target/i386/pr120434-2.c new file mode 100644 index 0000000..4381e3b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120434-2.c @@ -0,0 +1,15 @@ +/* PR middle-end/120434 */ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -mtune=generic -masm=att" } */ +/* { dg-final { scan-assembler-not "\tmovslq\t%edi, %rdi" } } */ +/* { dg-final { scan-assembler "\tmovl\t%edi, %edi" } } */ + +extern unsigned long long foo (unsigned long long x); + +unsigned long long +bar (int x) +{ + if (x < 50) + return 0; + return foo (x); +} diff --git a/gcc/testsuite/gcc.target/i386/pr90693-3.c b/gcc/testsuite/gcc.target/i386/pr90693-3.c new file mode 100644 index 0000000..601c83c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90693-3.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/90693 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mpopcnt" } */ + +#include "pr90693.c" diff --git a/gcc/testsuite/gcc.target/i386/pr90693-4.c b/gcc/testsuite/gcc.target/i386/pr90693-4.c new file mode 100644 index 0000000..b149159 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90693-4.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/90693 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mpopcnt" } */ + +#include "pr90693-2.c" diff --git a/gcc/testsuite/gcc.target/i386/pr90693-5.c b/gcc/testsuite/gcc.target/i386/pr90693-5.c new file mode 100644 index 0000000..0a6a637 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90693-5.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/90693 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mabm" } */ + +#include "pr90693.c" diff --git a/gcc/testsuite/gcc.target/i386/pr90693-6.c b/gcc/testsuite/gcc.target/i386/pr90693-6.c new file mode 100644 index 0000000..4040b52 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90693-6.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/90693 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mabm" } */ + +#include "pr90693-2.c" diff --git a/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c b/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c new file mode 100644 index 0000000..f5e71e4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c @@ -0,0 +1,194 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */ +#ifndef CHECK_DEFINES +#define CHECK_DEFINES 0 +#endif + +#define N 1024 + +/* Optimization flags and tree vectorizer shall be disabled at this point */ +#if CHECK_DEFINES && defined(__OPTIMIZE__) +#error "__OPTIMIZE__ is defined (not compiled with -O0?)" +#endif + +#pragma GCC push_options +#pragma GCC optimize ("O2", "tree-vectorize") + +/* Optimization flags and tree vectorizer shall be enabled at this point */ +#if CHECK_DEFINES && !defined(__OPTIMIZE__) +#error "__OPTIMIZE__ is not defined" +#endif + +#pragma GCC push_options +#pragma GCC target ("sse4.2") +#ifdef __cplusplus +namespace { +#endif + +/* Target flags up to including SSE4.2 shall be enabled at this point */ +#if CHECK_DEFINES && !defined(__SSE3__) +#error "Target flag (SSE3) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSSE3__) +#error "Target flag (SSSE3) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSE4_1__) +#error "Target flag (SSE4.1) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSE4_2__) +#error "Target flag (SSE4.2) is not defined" +#endif + +void +__attribute__((__noinline__, __used__)) +vec_saxpy_i32(int y[N], const int a[N], const int x[N]) +{ + int i; + for (i = 0; i < N; i++) + y[i] += a[i] * x[i]; +} + +#ifdef __cplusplus +} +#endif +#pragma GCC pop_options + +/* Target flags up to including SSE4.2 shall be disabled at this point */ +#if CHECK_DEFINES && defined(__SSE3__) +#error "Target flag (SSE3) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSSE3__) +#error "Target flag (SSSE3) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSE4_1__) +#error "Target flag (SSE4.1) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSE4_2__) +#error "Target flag (SSE4.2) is still defined" +#endif + +#pragma GCC push_options +#pragma GCC target ("avx2", "fma") +#ifdef __cplusplus +struct A { +#endif + +/* Target flags up to including AVX2+FMA shall be enabled at this point */ +#if CHECK_DEFINES && !defined(__SSE3__) +#error "Target flag (SSE3) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSSE3__) +#error "Target flag (SSSE3) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSE4_1__) +#error "Target flag (SSE4.1) is not defined" +#endif +#if CHECK_DEFINES && !defined(__SSE4_2__) +#error "Target flag (SSE4.2) is not defined" +#endif +#if CHECK_DEFINES && !defined(__AVX__) +#error "Target flag (AVX) is not defined" +#endif +#if CHECK_DEFINES && !defined(__AVX2__) +#error "Target flag (AVX2) is not defined" +#endif +#if CHECK_DEFINES && !defined(__FMA__) +#error "Target flag (FMA) is not defined" +#endif + +void +__attribute__((__noinline__, __used__)) +vec_saxpy_f32(float y[N], const float a[N], const float x[N]) +{ + int i; + for (i = 0; i < N; i++) + y[i] += a[i] * x[i]; +} + +#ifdef __cplusplus +}; +#endif +#pragma GCC pop_options + +/* Target flags up to including AVX2+FMA shall be disabled at this point */ +#if CHECK_DEFINES && defined(__SSE3__) +#error "Target flag (SSE3) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSSE3__) +#error "Target flag (SSSE3) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSE4_1__) +#error "Target flag (SSE4.1) is still defined" +#endif +#if CHECK_DEFINES && defined(__SSE4_2__) +#error "Target flag (SSE4.2) is still defined" +#endif +#if CHECK_DEFINES && defined(__AVX__) +#error "Target flag (AVX) is still defined" +#endif +#if CHECK_DEFINES && defined(__AVX2__) +#error "Target flag (AVX2) is still defined" +#endif +#if CHECK_DEFINES && defined(__FMA__) +#error "Target flag (FMA) is still defined" +#endif + +#pragma GCC push_options +#pragma GCC target ("arch=x86-64-v4") +#ifdef __cplusplus +namespace avx512 { +struct A { +#endif + +/* Essential AVX512 target flags shall be enabled at this point */ +#if CHECK_DEFINES && !defined(__AVX512F__) +#error "Target flag (AVX512F) is not defined" +#endif +#if CHECK_DEFINES && !defined(__AVX512VL__) +#error "Target flag (AVX512VL) is not defined" +#endif +#if CHECK_DEFINES && !defined(__AVX512DQ__) +#error "Target flag (AVX512DQ) is not defined" +#endif +#if CHECK_DEFINES && !defined(__AVX512BW__) +#error "Target flag (AVX512BW) is not defined" +#endif + +void +__attribute__((__noinline__, __used__)) +vec_saxpy_i16(short y[N], const short a[N], const short x[N]) +{ + int i; + for (i = 0; i < N; i++) + y[i] += a[i] * x[i]; +} + +#ifdef __cplusplus +}; +} +#endif +#pragma GCC pop_options + +/* Essential AVX512 target flags shall be disabled at this point */ +#if CHECK_DEFINES && defined(__AVX512F__) +#error "Target flag (AVX512F) is still defined" +#endif +#if CHECK_DEFINES && defined(__AVX512VL__) +#error "Target flag (AVX512VL) is still defined" +#endif +#if CHECK_DEFINES && defined(__AVX512DQ__) +#error "Target flag (AVX512DQ) is still defined" +#endif +#if CHECK_DEFINES && defined(__AVX512BW__) +#error "Target flag (AVX512BW) is still defined" +#endif + +#pragma GCC pop_options + +/* Optimization flags and tree vectorizer shall be disabled at this point */ +#if CHECK_DEFINES && defined(__OPTIMIZE__) +#error "__OPTIMIZE__ is still defined" +#endif diff --git a/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c b/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c new file mode 100644 index 0000000..3496804 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */ +/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */ +#define CHECK_DEFINES 1 +#include "vect-pragma-target-1.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c index 821e5c5..09f4b71 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(_Float16, +, add) -DEF_VF_MULOP_CASE_0(_Float16, -, sub) +DEF_VF_MULOP_CASE_0 (_Float16, +, +, add) +DEF_VF_MULOP_CASE_0 (_Float16, -, +, sub) +DEF_VF_MULOP_CASE_0 (_Float16, +, -, nadd) +DEF_VF_MULOP_CASE_0 (_Float16, -, -, nsub) /* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */ /* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c index 49b4287..b21ae49 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(float, +, add) -DEF_VF_MULOP_CASE_0(float, -, sub) +DEF_VF_MULOP_CASE_0 (float, +, +, add) +DEF_VF_MULOP_CASE_0 (float, -, +, sub) +DEF_VF_MULOP_CASE_0 (float, +, -, nadd) +DEF_VF_MULOP_CASE_0 (float, -, -, nsub) /* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */ /* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c index 2bb5d89..56a44dd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(double, +, add) -DEF_VF_MULOP_CASE_0(double, -, sub) +DEF_VF_MULOP_CASE_0 (double, +, +, add) +DEF_VF_MULOP_CASE_0 (double, -, +, sub) +DEF_VF_MULOP_CASE_0 (double, +, -, nadd) +DEF_VF_MULOP_CASE_0 (double, -, -, nsub) /* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */ /* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */ +/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c index cbb43ca..22180cb 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(_Float16, +, add) -DEF_VF_MULOP_CASE_0(_Float16, -, sub) +DEF_VF_MULOP_CASE_0 (_Float16, +, +, add) +DEF_VF_MULOP_CASE_0 (_Float16, -, +, sub) +DEF_VF_MULOP_CASE_0 (_Float16, +, -, nadd) +DEF_VF_MULOP_CASE_0 (_Float16, -, -, nsub) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c index 66ff9b8..318c281 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(float, +, add) -DEF_VF_MULOP_CASE_0(float, -, sub) +DEF_VF_MULOP_CASE_0 (float, +, +, add) +DEF_VF_MULOP_CASE_0 (float, -, +, sub) +DEF_VF_MULOP_CASE_0 (float, +, -, nadd) +DEF_VF_MULOP_CASE_0 (float, -, -, nsub) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c index 66ff9b8..318c281 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_0(float, +, add) -DEF_VF_MULOP_CASE_0(float, -, sub) +DEF_VF_MULOP_CASE_0 (float, +, +, add) +DEF_VF_MULOP_CASE_0 (float, -, +, sub) +DEF_VF_MULOP_CASE_0 (float, +, -, nadd) +DEF_VF_MULOP_CASE_0 (float, -, -, nsub) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c index 45980f4..382f7ef5 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(_Float16, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(_Float16, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler {vfmadd.vf} } } */ /* { dg-final { scan-assembler {vfmsub.vf} } } */ +/* { dg-final { scan-assembler {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c index c853620..db2cd2e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(float, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(float, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler {vfmadd.vf} } } */ /* { dg-final { scan-assembler {vfmsub.vf} } } */ +/* { dg-final { scan-assembler {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c index d38ae8b..423b4db 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(double, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(double, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler {vfmadd.vf} } } */ /* { dg-final { scan-assembler {vfmsub.vf} } } */ +/* { dg-final { scan-assembler {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c index f1ca34e..1482ff0 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(_Float16, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(_Float16, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (_Float16, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c index 6730d4b..d1368e7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(float, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(float, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (float, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c index bcb6a6e..8e4bdd4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c @@ -3,8 +3,12 @@ #include "vf_mulop.h" -DEF_VF_MULOP_CASE_1(double, +, add, VF_MULOP_BODY_X16) -DEF_VF_MULOP_CASE_1(double, -, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, +, +, add, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, -, +, sub, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, +, -, nadd, VF_MULOP_BODY_X16) +DEF_VF_MULOP_CASE_1 (double, -, -, nsub, VF_MULOP_BODY_X16) /* { dg-final { scan-assembler-not {vfmadd.vf} } } */ /* { dg-final { scan-assembler-not {vfmsub.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */ +/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h index 5253978..433a16e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h @@ -3,59 +3,63 @@ #include <stdint.h> -#define DEF_VF_MULOP_CASE_0(T, OP, NAME) \ - void test_vf_mulop_##NAME##_##T##_case_0(T *restrict out, T *restrict in, \ - T x, unsigned n) { \ +#define DEF_VF_MULOP_CASE_0(T, OP, NEG, NAME) \ + void test_vf_mulop_##NAME##_##T##_case_0 (T *restrict out, T *restrict in, \ + T f, unsigned n) \ + { \ for (unsigned i = 0; i < n; i++) \ - out[i] = in[i] OP out[i] * x; \ + out[i] = NEG (f * out[i] OP in[i]); \ } -#define DEF_VF_MULOP_CASE_0_WRAP(T, OP, NAME) DEF_VF_MULOP_CASE_0(T, OP, NAME) +#define DEF_VF_MULOP_CASE_0_WRAP(T, OP, NEG, NAME) \ + DEF_VF_MULOP_CASE_0 (T, OP, NEG, NAME) #define RUN_VF_MULOP_CASE_0(T, NAME, out, in, x, n) \ test_vf_mulop_##NAME##_##T##_case_0(out, in, x, n) #define RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) \ RUN_VF_MULOP_CASE_0(T, NAME, out, in, x, n) -#define VF_MULOP_BODY(op) \ - out[k + 0] = in[k + 0] op tmp * out[k + 0]; \ - out[k + 1] = in[k + 1] op tmp * out[k + 1]; \ +#define VF_MULOP_BODY(op, neg) \ + out[k + 0] = neg (tmp * out[k + 0] op in[k + 0]); \ + out[k + 1] = neg (tmp * out[k + 1] op in[k + 1]); \ k += 2; -#define VF_MULOP_BODY_X4(op) \ - VF_MULOP_BODY(op) \ - VF_MULOP_BODY(op) +#define VF_MULOP_BODY_X4(op, neg) \ + VF_MULOP_BODY (op, neg) \ + VF_MULOP_BODY (op, neg) -#define VF_MULOP_BODY_X8(op) \ - VF_MULOP_BODY_X4(op) \ - VF_MULOP_BODY_X4(op) +#define VF_MULOP_BODY_X8(op, neg) \ + VF_MULOP_BODY_X4 (op, neg) \ + VF_MULOP_BODY_X4 (op, neg) -#define VF_MULOP_BODY_X16(op) \ - VF_MULOP_BODY_X8(op) \ - VF_MULOP_BODY_X8(op) +#define VF_MULOP_BODY_X16(op, neg) \ + VF_MULOP_BODY_X8 (op, neg) \ + VF_MULOP_BODY_X8 (op, neg) -#define VF_MULOP_BODY_X32(op) \ - VF_MULOP_BODY_X16(op) \ - VF_MULOP_BODY_X16(op) +#define VF_MULOP_BODY_X32(op, neg) \ + VF_MULOP_BODY_X16 (op, neg) \ + VF_MULOP_BODY_X16 (op, neg) -#define VF_MULOP_BODY_X64(op) \ - VF_MULOP_BODY_X32(op) \ - VF_MULOP_BODY_X32(op) +#define VF_MULOP_BODY_X64(op, neg) \ + VF_MULOP_BODY_X32 (op, neg) \ + VF_MULOP_BODY_X32 (op, neg) -#define VF_MULOP_BODY_X128(op) \ - VF_MULOP_BODY_X64(op) \ - VF_MULOP_BODY_X64(op) +#define VF_MULOP_BODY_X128(op, neg) \ + VF_MULOP_BODY_X64 (op, neg) \ + VF_MULOP_BODY_X64 (op, neg) -#define DEF_VF_MULOP_CASE_1(T, OP, NAME, BODY) \ - void test_vf_mulop_##NAME##_##T##_case_1(T *restrict out, T *restrict in, \ - T x, unsigned n) { \ +#define DEF_VF_MULOP_CASE_1(T, OP, NEG, NAME, BODY) \ + void test_vf_mulop_##NAME##_##T##_case_1 (T *restrict out, T *restrict in, \ + T x, unsigned n) \ + { \ unsigned k = 0; \ T tmp = x + 3; \ \ - while (k < n) { \ - tmp = tmp * 0x3f; \ - BODY(OP) \ - } \ + while (k < n) \ + { \ + tmp = tmp * 0x3f; \ + BODY (OP, NEG) \ + } \ } -#define DEF_VF_MULOP_CASE_1_WRAP(T, OP, NAME, BODY) \ - DEF_VF_MULOP_CASE_1(T, OP, NAME, BODY) +#define DEF_VF_MULOP_CASE_1_WRAP(T, OP, NEG, NAME, BODY) \ + DEF_VF_MULOP_CASE_1 (T, OP, NEG, NAME, BODY) #endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h index c16c1a9..ffa3d28 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h @@ -211,6 +211,408 @@ double TEST_MULOP_DATA(double, add)[][4][N] = _Float16 TEST_MULOP_DATA(_Float16, sub)[][4][N] = { { + { 5.94f16 }, + { + -20.1f16, -20.1f16, -20.1f16, -20.1f16, + -13.1f16, -13.1f16, -13.1f16, -13.1f16, + -8.92f16, -8.92f16, -8.92f16, -8.92f16, + -43.1f16, -43.1f16, -43.1f16, -43.1f16, + }, + { + 7.44f16, 7.44f16, 7.44f16, 7.44f16, + 5.9f16, 5.9f16, 5.9f16, 5.9f16, + 6.81f16, 6.81f16, 6.81f16, 6.81f16, + 9.03f16, 9.03f16, 9.03f16, 9.03f16, + }, + { + 64.2f16, 64.2f16, 64.2f16, 64.2f16, + 48.1f16, 48.1f16, 48.1f16, 48.1f16, + 49.4f16, 49.4f16, 49.4f16, 49.4f16, + 96.7f16, 96.7f16, 96.7f16, 96.7f16, + } + }, + { + { 0.0475f16 }, + { + -0.0965f16, -0.0965f16, -0.0965f16, -0.0965f16, + -0.23f16, -0.23f16, -0.23f16, -0.23f16, + -0.267f16, -0.267f16, -0.267f16, -0.267f16, + -0.455f16, -0.455f16, -0.455f16, -0.455f16, + }, + { + 0.0748f16, 0.0748f16, 0.0748f16, 0.0748f16, + 0.0372f16, 0.0372f16, 0.0372f16, 0.0372f16, + 0.0183f16, 0.0183f16, 0.0183f16, 0.0183f16, + 0.0411f16, 0.0411f16, 0.0411f16, 0.0411f16, + }, + { + 0.1f16, 0.1f16, 0.1f16, 0.1f16, + 0.232f16, 0.232f16, 0.232f16, 0.232f16, + 0.268f16, 0.268f16, 0.268f16, 0.268f16, + 0.457f16, 0.457f16, 0.457f16, 0.457f16, + } + }, + { + { 2.46e+01f16 }, + { + -1.46e+02f16, -1.46e+02f16, -1.46e+02f16, -1.46e+02f16, + 3.66e+02f16, 3.66e+02f16, 3.66e+02f16, 3.66e+02f16, + 3.47e+02f16, 3.47e+02f16, 3.47e+02f16, 3.47e+02f16, + 6.24e+02f16, 6.24e+02f16, 6.24e+02f16, 6.24e+02f16, + }, + { + 6.17e+00f16, 6.17e+00f16, 6.17e+00f16, 6.17e+00f16, + 2.46e+01f16, 2.46e+01f16, 2.46e+01f16, 2.46e+01f16, + 1.99e+01f16, 1.99e+01f16, 1.99e+01f16, 1.99e+01f16, + 3.29e+01f16, 3.29e+01f16, 3.29e+01f16, 3.29e+01f16, + }, + { + 2.97e+02f16, 2.97e+02f16, 2.97e+02f16, 2.97e+02f16, + 2.39e+02f16, 2.39e+02f16, 2.39e+02f16, 2.39e+02f16, + 1.42e+02f16, 1.42e+02f16, 1.42e+02f16, 1.42e+02f16, + 1.85e+02f16, 1.85e+02f16, 1.85e+02f16, 1.85e+02f16, + } + }, +}; + +float TEST_MULOP_DATA(float, sub)[][4][N] = +{ + { + { 5.96f }, + { + 7.74f, 7.74f, 7.74f, 7.74f, + -57.f, -57.f, -57.f, -57.f, + 32.7f, 32.7f, 32.7f, 32.7f, + 2.44f, 2.44f, 2.44f, 2.44f, + }, + { + 7.37f, 7.37f, 7.37f, 7.37f, + 5.6f, 5.6f, 5.6f, 5.6f, + 9.07f, 9.07f, 9.07f, 9.07f, + 2.87f, 2.87f, 2.87f, 2.87f, + }, + { + 36.2f, 36.2f, 36.2f, 36.2f, + 90.4f, 90.4f, 90.4f, 90.4f, + 21.3f, 21.3f, 21.3f, 21.3f, + 14.6f, 14.6f, 14.6f, 14.6f, + } + }, + { + { 3.00e-02f }, + { + -2.83e-01f, -2.83e-01f, -2.83e-01f, -2.83e-01f, + -5.37e-01f, -5.37e-01f, -5.37e-01f, -5.37e-01f, + -7.87e-01f, -7.87e-01f, -7.87e-01f, -7.87e-01f, + -3.65e-01f, -3.65e-01f, -3.65e-01f, -3.65e-01f, + }, + { + 8.84e-02f, 8.84e-02f, 8.84e-02f, 8.84e-02f, + 9.27e-02f, 9.27e-02f, 9.27e-02f, 9.27e-02f, + 6.51e-02f, 6.51e-02f, 6.51e-02f, 6.51e-02f, + 5.67e-02f, 5.67e-02f, 5.67e-02f, 5.67e-02f, + }, + { + 2.86e-01f, 2.86e-01f, 2.86e-01f, 2.86e-01f, + 5.40e-01f, 5.40e-01f, 5.40e-01f, 5.40e-01f, + 7.89e-01f, 7.89e-01f, 7.89e-01f, 7.89e-01f, + 3.67e-01f, 3.67e-01f, 3.67e-01f, 3.67e-01f, + } + }, + { + { 9.04e+01f }, + { + 2.76e+03f, 2.76e+03f, 2.76e+03f, 2.76e+03f, + 1.05e+03f, 1.05e+03f, 1.05e+03f, 1.05e+03f, + 5.17e+03f, 5.17e+03f, 5.17e+03f, 5.17e+03f, + 3.91e+03f, 3.91e+03f, 3.91e+03f, 3.91e+03f, + }, + { + 3.99e+01f, 3.99e+01f, 3.99e+01f, 3.99e+01f, + 1.38e+01f, 1.38e+01f, 1.38e+01f, 1.38e+01f, + 6.36e+01f, 6.36e+01f, 6.36e+01f, 6.36e+01f, + 4.77e+01f, 4.77e+01f, 4.77e+01f, 4.77e+01f, + }, + { + 8.39e+02f, 8.39e+02f, 8.39e+02f, 8.39e+02f, + 1.97e+02f, 1.97e+02f, 1.97e+02f, 1.97e+02f, + 5.77e+02f, 5.77e+02f, 5.77e+02f, 5.77e+02f, + 4.02e+02f, 4.02e+02f, 4.02e+02f, 4.02e+02f, + } + }, +}; + +double TEST_MULOP_DATA(double, sub)[][4][N] = +{ + { + { 1.69e+01 }, + { + 8.58e+02, 8.58e+02, 8.58e+02, 8.58e+02, + 2.87e+02, 2.87e+02, 2.87e+02, 2.87e+02, + 4.35e+02, 4.35e+02, 4.35e+02, 4.35e+02, + -6.35e+01, -6.35e+01, -6.35e+01, -6.35e+01, + }, + { + 8.02e+01, 8.02e+01, 8.02e+01, 8.02e+01, + 7.51e+01, 7.51e+01, 7.51e+01, 7.51e+01, + 5.85e+01, 5.85e+01, 5.85e+01, 5.85e+01, + 1.65e+01, 1.65e+01, 1.65e+01, 1.65e+01, + }, + { + 4.95e+02, 4.95e+02, 4.95e+02, 4.95e+02, + 9.80e+02, 9.80e+02, 9.80e+02, 9.80e+02, + 5.51e+02, 5.51e+02, 5.51e+02, 5.51e+02, + 3.42e+02, 3.42e+02, 3.42e+02, 3.42e+02, + } + }, + { + { 8.86e-10 }, + { + -8.82e-09, -8.82e-09, -8.82e-09, -8.82e-09, + -3.09e-09, -3.09e-09, -3.09e-09, -3.09e-09, + -4.87e-09, -4.87e-09, -4.87e-09, -4.87e-09, + -5.70e-09, -5.70e-09, -5.70e-09, -5.70e-09, + }, + { + 9.72e-10, 9.72e-10, 9.72e-10, 9.72e-10, + 5.78e-10, 5.78e-10, 5.78e-10, 5.78e-10, + 1.10e-10, 1.10e-10, 1.10e-10, 1.10e-10, + 4.62e-10, 4.62e-10, 4.62e-10, 4.62e-10, + }, + { + 8.82e-09, 8.82e-09, 8.82e-09, 8.82e-09, + 3.09e-09, 3.09e-09, 3.09e-09, 3.09e-09, + 4.87e-09, 4.87e-09, 4.87e-09, 4.87e-09, + 5.70e-09, 5.70e-09, 5.70e-09, 5.70e-09, + } + }, + { + { 1.09e-20 }, + { + -5.46e-19, -5.46e-19, -5.46e-19, -5.46e-19, + -2.28e-19, -2.28e-19, -2.28e-19, -2.28e-19, + -4.77e-19, -4.77e-19, -4.77e-19, -4.77e-19, + -1.76e-19, -1.76e-19, -1.76e-19, -1.76e-19, + }, + { + 5.52e-20, 5.52e-20, 5.52e-20, 5.52e-20, + 2.20e-20, 2.20e-20, 2.20e-20, 2.20e-20, + 2.97e-20, 2.97e-20, 2.97e-20, 2.97e-20, + 3.23e-20, 3.23e-20, 3.23e-20, 3.23e-20, + }, + { + 5.46e-19, 5.46e-19, 5.46e-19, 5.46e-19, + 2.28e-19, 2.28e-19, 2.28e-19, 2.28e-19, + 4.77e-19, 4.77e-19, 4.77e-19, 4.77e-19, + 1.76e-19, 1.76e-19, 1.76e-19, 1.76e-19, + } + }, +}; + +_Float16 TEST_MULOP_DATA(_Float16, nadd)[][4][N] = +{ + { + { 1.09f16 }, + { + -60.7f16, -60.7f16, -60.7f16, -60.7f16, + -25.2f16, -25.2f16, -25.2f16, -25.2f16, + -50.9f16, -50.9f16, -50.9f16, -50.9f16, + -21.1f16, -21.1f16, -21.1f16, -21.1f16, + }, + { + 5.52f16, 5.52f16, 5.52f16, 5.52f16, + 2.2f16, 2.2f16, 2.2f16, 2.2f16, + 2.97f16, 2.97f16, 2.97f16, 2.97f16, + 3.23f16, 3.23f16, 3.23f16, 3.23f16, + }, + { + 54.6f16, 54.6f16, 54.6f16, 54.6f16, + 22.8f16, 22.8f16, 22.8f16, 22.8f16, + 47.7f16, 47.7f16, 47.7f16, 47.7f16, + 17.6f16, 17.6f16, 17.6f16, 17.6f16, + } + }, + { + { 0.794f16 }, + { + -6.8f16, -6.8f16, -6.8f16, -6.8f16, + -6.1f16, -6.1f16, -6.1f16, -6.1f16, + -3.02f16, -3.02f16, -3.02f16, -3.02f16, + -3.15f16, -3.15f16, -3.15f16, -3.15f16, + }, + { + 0.119f16, 0.119f16, 0.119f16, 0.119f16, + 0.774f16, 0.774f16, 0.774f16, 0.774f16, + 0.302f16, 0.302f16, 0.302f16, 0.302f16, + 0.784f16, 0.784f16, 0.784f16, 0.784f16, + }, + { + 6.7f16, 6.7f16, 6.7f16, 6.7f16, + 5.49f16, 5.49f16, 5.49f16, 5.49f16, + 2.78f16, 2.78f16, 2.78f16, 2.78f16, + 2.52f16, 2.52f16, 2.52f16, 2.52f16, + } + }, + { + { -2.62f16 }, + { + 48.6f16, 48.6f16, 48.6f16, 48.6f16, + 28.1f16, 28.1f16, 28.1f16, 28.1f16, + -2.93f16, -2.93f16, -2.93f16, -2.93f16, + 80.6f16, 80.6f16, 80.6f16, 80.6f16, + }, + { + -1.18f16, -1.18f16, -1.18f16, -1.18f16, + -7.52f16, -7.52f16, -7.52f16, -7.52f16, + -5.37f16, -5.37f16, -5.37f16, -5.37f16, + -5.39f16, -5.39f16, -5.39f16, -5.39f16, + }, + { + -51.7f16, -51.7f16, -51.7f16, -51.7f16, + -47.8f16, -47.8f16, -47.8f16, -47.8f16, + -11.2f16, -11.2f16, -11.2f16, -11.2f16, + -94.8f16, -94.8f16, -94.8f16, -94.8f16, + } + }, +}; + +float TEST_MULOP_DATA(float, nadd)[][4][N] = +{ + { + { 1.19f }, + { + -21.4f, -21.4f, -21.4f, -21.4f, + -9.12f, -9.12f, -9.12f, -9.12f, + -51.1f, -51.1f, -51.1f, -51.1f, + -48.8f, -48.8f, -48.8f, -48.8f, + }, + { + 3.83f, 3.83f, 3.83f, 3.83f, + 2.9f, 2.9f, 2.9f, 2.9f, + 4.63f, 4.63f, 4.63f, 4.63f, + 0.65f, 0.65f, 0.65f, 0.65f, + }, + { + 16.8f, 16.8f, 16.8f, 16.8f, + 5.66f, 5.66f, 5.66f, 5.66f, + 45.5f, 45.5f, 45.5f, 45.5f, + 48.1f, 48.1f, 48.1f, 48.1f, + } + }, + { + { 1.60e+01f }, + { + -2.69e+02f, -2.69e+02f, -2.69e+02f, -2.69e+02f, + -5.05e+02f, -5.05e+02f, -5.05e+02f, -5.05e+02f, + -2.92e+02f, -2.92e+02f, -2.92e+02f, -2.92e+02f, + -3.91e+02f, -3.91e+02f, -3.91e+02f, -3.91e+02f, + }, + { + 6.28e+00f, 6.28e+00f, 6.28e+00f, 6.28e+00f, + 1.94e+01f, 1.94e+01f, 1.94e+01f, 1.94e+01f, + 1.02e+01f, 1.02e+01f, 1.02e+01f, 1.02e+01f, + 1.60e+01f, 1.60e+01f, 1.60e+01f, 1.60e+01f, + }, + { + 1.68e+02f, 1.68e+02f, 1.68e+02f, 1.68e+02f, + 1.95e+02f, 1.95e+02f, 1.95e+02f, 1.95e+02f, + 1.30e+02f, 1.30e+02f, 1.30e+02f, 1.30e+02f, + 1.35e+02f, 1.35e+02f, 1.35e+02f, 1.35e+02f, + } + }, + { + { -5.63e+01f }, + { + -3.59e+03f, -3.59e+03f, -3.59e+03f, -3.59e+03f, + -2.25e+02f, -2.25e+02f, -2.25e+02f, -2.25e+02f, + -4.85e+03f, -4.85e+03f, -4.85e+03f, -4.85e+03f, + -1.59e+03f, -1.59e+03f, -1.59e+03f, -1.59e+03f, + }, + { + -7.96e+01f, -7.96e+01f, -7.96e+01f, -7.96e+01f, + -1.07e+01f, -1.07e+01f, -1.07e+01f, -1.07e+01f, + -9.62e+01f, -9.62e+01f, -9.62e+01f, -9.62e+01f, + -3.86e+01f, -3.86e+01f, -3.86e+01f, -3.86e+01f, + }, + { + -8.83e+02f, -8.83e+02f, -8.83e+02f, -8.83e+02f, + -3.79e+02f, -3.79e+02f, -3.79e+02f, -3.79e+02f, + -5.62e+02f, -5.62e+02f, -5.62e+02f, -5.62e+02f, + -5.85e+02f, -5.85e+02f, -5.85e+02f, -5.85e+02f, + } + }, +}; + +double TEST_MULOP_DATA(double, nadd)[][4][N] = +{ + { + { 8.64e+20 }, + { + -2.89e+41, -2.89e+41, -2.89e+41, -2.89e+41, + -6.50e+41, -6.50e+41, -6.50e+41, -6.50e+41, + -8.11e+41, -8.11e+41, -8.11e+41, -8.11e+41, + -4.44e+41, -4.44e+41, -4.44e+41, -4.44e+41, + }, + { + 2.61e+20, 2.61e+20, 2.61e+20, 2.61e+20, + 4.25e+20, 4.25e+20, 4.25e+20, 4.25e+20, + 5.77e+20, 5.77e+20, 5.77e+20, 5.77e+20, + 3.74e+20, 3.74e+20, 3.74e+20, 3.74e+20, + }, + { + 6.38e+40, 6.38e+40, 6.38e+40, 6.38e+40, + 2.83e+41, 2.83e+41, 2.83e+41, 2.83e+41, + 3.13e+41, 3.13e+41, 3.13e+41, 3.13e+41, + 1.21e+41, 1.21e+41, 1.21e+41, 1.21e+41, + } + }, + { + { -3.01e+40 }, + { + -7.27e+81, -7.27e+81, -7.27e+81, -7.27e+81, + -4.10e+81, -4.10e+81, -4.10e+81, -4.10e+81, + -7.82e+81, -7.82e+81, -7.82e+81, -7.82e+81, + -1.54e+81, -1.54e+81, -1.54e+81, -1.54e+81, + }, + { + -5.71e+40, -5.71e+40, -5.71e+40, -5.71e+40, + -1.41e+40, -1.41e+40, -1.41e+40, -1.41e+40, + -3.01e+40, -3.01e+40, -3.01e+40, -3.01e+40, + -2.47e+40, -2.47e+40, -2.47e+40, -2.47e+40, + }, + { + 5.55e+81, 5.55e+81, 5.55e+81, 5.55e+81, + 3.67e+81, 3.67e+81, 3.67e+81, 3.67e+81, + 6.92e+81, 6.92e+81, 6.92e+81, 6.92e+81, + 7.96e+80, 7.96e+80, 7.96e+80, 7.96e+80, + } + }, + { + { 3.65e-20 }, + { + -4.11e-39, -4.11e-39, -4.11e-39, -4.11e-39, + -8.48e-39, -8.48e-39, -8.48e-39, -8.48e-39, + -8.93e-39, -8.93e-39, -8.93e-39, -8.93e-39, + -2.74e-39, -2.74e-39, -2.74e-39, -2.74e-39, + }, + { + 5.78e-20, 5.78e-20, 5.78e-20, 5.78e-20, + 1.61e-20, 1.61e-20, 1.61e-20, 1.61e-20, + 6.91e-20, 6.91e-20, 6.91e-20, 6.91e-20, + 6.18e-20, 6.18e-20, 6.18e-20, 6.18e-20, + }, + { + 2.00e-39, 2.00e-39, 2.00e-39, 2.00e-39, + 7.89e-39, 7.89e-39, 7.89e-39, 7.89e-39, + 6.41e-39, 6.41e-39, 6.41e-39, 6.41e-39, + 4.87e-40, 4.87e-40, 4.87e-40, 4.87e-40, + } + }, +}; + +_Float16 TEST_MULOP_DATA(_Float16, nsub)[][4][N] = +{ + { { 0.676f16 }, { 1.39f16, 1.39f16, 1.39f16, 1.39f16, @@ -275,7 +677,7 @@ _Float16 TEST_MULOP_DATA(_Float16, sub)[][4][N] = }, }; -float TEST_MULOP_DATA(float, sub)[][4][N] = +float TEST_MULOP_DATA(float, nsub)[][4][N] = { { {8.51f }, @@ -342,7 +744,7 @@ float TEST_MULOP_DATA(float, sub)[][4][N] = }, }; -double TEST_MULOP_DATA(double, sub)[][4][N] = +double TEST_MULOP_DATA(double, nsub)[][4][N] = { { { 80.54 }, diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h index bc6f483d..579f841 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h @@ -13,12 +13,12 @@ main () for (i = 0; i < sizeof (TEST_DATA) / sizeof (TEST_DATA[0]); i++) { - T x = TEST_DATA[i][0][0]; + T f = TEST_DATA[i][0][0]; T *in = TEST_DATA[i][1]; T *out = TEST_DATA[i][2]; T *expect = TEST_DATA[i][3]; - TEST_RUN (T, NAME, out, in, x, N); + TEST_RUN (T, NAME, out, in, f, N); for (k = 0; k < N; k++) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c index 1bcf9e0..9ec5303 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c @@ -7,7 +7,7 @@ #define T _Float16 #define NAME add -DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c index 199b9ad..222efec 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c @@ -7,7 +7,7 @@ #define T float #define NAME add -DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c index 3857f58..300d520 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c @@ -7,7 +7,7 @@ #define T double #define NAME add -DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c index 671c7d8..d11d446 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c @@ -7,7 +7,7 @@ #define T _Float16 #define NAME sub -DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c index f896963..500e1b2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c @@ -7,7 +7,7 @@ #define T float #define NAME sub -DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c index b42ab1e..a2c3294 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c @@ -7,7 +7,7 @@ #define T double #define NAME sub -DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME) +DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME) #define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) #define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c new file mode 100644 index 0000000..a45e1f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T _Float16 +#define NAME nadd + +DEF_VF_MULOP_CASE_0_WRAP(T, +, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c new file mode 100644 index 0000000..b8a7bc4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T float +#define NAME nadd + +DEF_VF_MULOP_CASE_0_WRAP (T, +, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c new file mode 100644 index 0000000..32664e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T double +#define NAME nadd + +DEF_VF_MULOP_CASE_0_WRAP (T, +, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c new file mode 100644 index 0000000..a1b0034 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T _Float16 +#define NAME nsub + +DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c new file mode 100644 index 0000000..6450573 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T float +#define NAME nsub + +DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c new file mode 100644 index 0000000..eb3ca1c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "--param=fpr2vr-cost=0" } */ + +#include "vf_mulop.h" +#include "vf_mulop_data.h" + +#define T double +#define NAME nsub + +DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME) + +#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vf_mulop_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c index 893d910..b070efd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vmul.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */ /* { dg-final { scan-assembler-times {vrem.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c index 26170de..3b51ca7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vmul.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */ /* { dg-final { scan-assembler-times {vrem.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c index 04d1fcb..b5ee457 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vmul.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */ /* { dg-final { scan-assembler-times {vrem.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c index 89d37af..7b0c89b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vmul.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */ /* { dg-final { scan-assembler-times {vrem.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c index b9f8bd9..eaa4959 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c index d2be881..5523256 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c index d1b85ee..9eb1025 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c index 30a3928..9a97112 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c index 5210c0d..5e0fe41 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c index 5b0db08..2b842de 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c index 8d528d8..9f981a5 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c index 85e79ac..a1d7cf4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, *, mul) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) +DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c index b35e4b7..5d684e6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X16) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c index fb01a6a..6c086d2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c index d9341d6..0abae20 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c index 02fdece..d2955b8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c index a9ea082..c42c58e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c index aaf37c5..a6d1ad0 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c index 4f80dab..ea9c526 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c index 85ef4f1..d1212ea 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c index 3ac5041..30e38f7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c index 32ce58a..f0b6bcd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c index 722282a..ef168ac 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler-not {vdiv.vx} } } */ /* { dg-final { scan-assembler-not {vrem.vx} } } */ +/* { dg-final { scan-assembler-not {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c index 27dffc7..9977ff3 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c @@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8) +DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler-not {vmul.vx} } } */ /* { dg-final { scan-assembler {vdiv.vx} } } */ /* { dg-final { scan-assembler {vrem.vx} } } */ +/* { dg-final { scan-assembler {vmax.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h index 66e238c..51e901d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h @@ -127,4 +127,97 @@ test_vx_binary_reverse_##NAME##_##T##_case_1 (T * restrict out, \ #define DEF_VX_BINARY_REVERSE_CASE_1_WRAP(T, OP, NAME, BODY) \ DEF_VX_BINARY_REVERSE_CASE_1(T, OP, NAME, BODY) +#define DEF_MAX_0(T) \ +static inline T \ +test_##T##_max_0 (T a, T b) \ +{ \ + return a > b ? a : b; \ +} + +#define DEF_MAX_1(T) \ +static inline T \ +test_##T##_max_1 (T a, T b) \ +{ \ + return a >= b ? a : b; \ +} + +DEF_MAX_0(int8_t) +DEF_MAX_0(int16_t) +DEF_MAX_0(int32_t) +DEF_MAX_0(int64_t) + +DEF_MAX_1(int8_t) +DEF_MAX_1(int16_t) +DEF_MAX_1(int32_t) +DEF_MAX_1(int64_t) + +#define MAX_FUNC_0(T) test_##T##_max_0 +#define MAX_FUNC_0_WARP(T) MAX_FUNC_0(T) + +#define MAX_FUNC_1(T) test_##T##_max_1 +#define MAX_FUNC_1_WARP(T) MAX_FUNC_1(T) + +#define DEF_VX_BINARY_CASE_2(T, FUNC, NAME) \ +void \ +test_vx_binary_##NAME##_##FUNC##_##T##_case_2 (T * restrict out, \ + T * restrict in, \ + T x, unsigned n) \ +{ \ + for (unsigned i = 0; i < n; i++) \ + out[i] = FUNC (in[i], x); \ +} +#define DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME) \ + DEF_VX_BINARY_CASE_2(T, FUNC, NAME) +#define RUN_VX_BINARY_CASE_2(T, NAME, FUNC, out, in, x, n) \ + test_vx_binary_##NAME##_##FUNC##_##T##_case_2(out, in, x, n) +#define RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) \ + RUN_VX_BINARY_CASE_2(T, NAME, FUNC, out, in, x, n) + +#define DEF_VX_BINARY_CASE_3(T, FUNC, NAME, BODY) \ +void \ +test_vx_binary_##NAME##_##FUNC##_##T##_case_3 (T * restrict out, \ + T * restrict in, \ + T x, unsigned n) \ +{ \ + unsigned k = 0; \ + T tmp = x + 3; \ + \ + while (k < n) \ + { \ + tmp = tmp ^ 0x82; \ + BODY(FUNC) \ + } \ +} +#define DEF_VX_BINARY_CASE_3_WRAP(T, FUNC, NAME, BODY) \ + DEF_VX_BINARY_CASE_3(T, FUNC, NAME, BODY) + +#define VX_BINARY_FUNC_BODY(func) \ + out[k + 0] = func (in[k + 0], tmp); \ + out[k + 1] = func (in[k + 1], tmp); \ + k += 2; + +#define VX_BINARY_FUNC_BODY_X4(op) \ + VX_BINARY_FUNC_BODY(op) \ + VX_BINARY_FUNC_BODY(op) + +#define VX_BINARY_FUNC_BODY_X8(op) \ + VX_BINARY_FUNC_BODY_X4(op) \ + VX_BINARY_FUNC_BODY_X4(op) + +#define VX_BINARY_FUNC_BODY_X16(op) \ + VX_BINARY_FUNC_BODY_X8(op) \ + VX_BINARY_FUNC_BODY_X8(op) + +#define VX_BINARY_FUNC_BODY_X32(op) \ + VX_BINARY_FUNC_BODY_X16(op) \ + VX_BINARY_FUNC_BODY_X16(op) + +#define VX_BINARY_FUNC_BODY_X64(op) \ + VX_BINARY_FUNC_BODY_X32(op) \ + VX_BINARY_FUNC_BODY_X32(op) + +#define VX_BINARY_FUNC_BODY_X128(op) \ + VX_BINARY_FUNC_BODY_X64(op) \ + VX_BINARY_FUNC_BODY_X64(op) + #endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h index ce183ca..9cef042 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h @@ -3338,4 +3338,200 @@ uint64_t TEST_BINARY_DATA(uint64_t, rem)[][3][N] = }, }; +int8_t TEST_BINARY_DATA(int8_t, max)[][3][N] = +{ + { + { 0 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + }, + { + { 127 }, + { + 127, 127, 127, 127, + -1, -1, -1, -1, + -128, -128, -128, -128, + -2, -2, -2, -2, + }, + { + 127, 127, 127, 127, + 127, 127, 127, 127, + 127, 127, 127, 127, + 127, 127, 127, 127, + }, + }, + { + { -128 }, + { + -128, -128, -128, -128, + 1, 1, 1, 1, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + { + -128, -128, -128, -128, + 1, 1, 1, 1, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + }, +}; + +int16_t TEST_BINARY_DATA(int16_t, max)[][3][N] = +{ + { + { 0 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + }, + { + { 32767 }, + { + 32767, 32767, 32767, 32767, + -1, -1, -1, -1, + -32768, -32768, -32768, -32768, + -2, -2, -2, -2, + }, + { + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + }, + }, + { + { -32768 }, + { + -32768, -32768, -32768, -32768, + 1, 1, 1, 1, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + { + -32768, -32768, -32768, -32768, + 1, 1, 1, 1, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + }, +}; + +int32_t TEST_BINARY_DATA(int32_t, max)[][3][N] = +{ + { + { 0 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + }, + { + { 2147483647 }, + { + 2147483647, 2147483647, 2147483647, 2147483647, + -1, -1, -1, -1, + -2147483648, -2147483648, -2147483648, -2147483648, + -2, -2, -2, -2, + }, + { + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + }, + }, + { + { -2147483648 }, + { + -2147483648, -2147483648, -2147483648, -2147483648, + 1, 1, 1, 1, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + { + -2147483648, -2147483648, -2147483648, -2147483648, + 1, 1, 1, 1, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + }, +}; + +int64_t TEST_BINARY_DATA(int64_t, max)[][3][N] = +{ + { + { 0 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + }, + { + { 9223372036854775807ll }, + { + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + -1, -1, -1, -1, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + -2, -2, -2, -2, + }, + { + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + }, + }, + { + { -9223372036854775808ull }, + { + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + 1, 1, 1, 1, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 2, 2, 2, 2, + }, + { + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + 1, 1, 1, 1, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 2, 2, 2, 2, + }, + }, +}; + #endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c new file mode 100644 index 0000000..d36495c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int16_t +#define NAME max +#define FUNC MAX_FUNC_0_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c new file mode 100644 index 0000000..acd8aeb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int32_t +#define NAME max +#define FUNC MAX_FUNC_0_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c new file mode 100644 index 0000000..5ecc206 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int64_t +#define NAME max +#define FUNC MAX_FUNC_0_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c new file mode 100644 index 0000000..5ac63e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int8_t +#define NAME max +#define FUNC MAX_FUNC_0_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c new file mode 100644 index 0000000..77445b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int16_t +#define NAME max +#define FUNC MAX_FUNC_1_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c new file mode 100644 index 0000000..fc4fb55 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int32_t +#define NAME max +#define FUNC MAX_FUNC_1_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c new file mode 100644 index 0000000..1afa12e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int64_t +#define NAME max +#define FUNC MAX_FUNC_1_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c new file mode 100644 index 0000000..9c1222b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c @@ -0,0 +1,17 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" +#include "vx_binary_data.h" + +#define T int8_t +#define NAME max +#define FUNC MAX_FUNC_1_WARP(T) +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) + +DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max) + +#define TEST_RUN(T, NAME, out, in, x, n) \ + RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c new file mode 100644 index 0000000..bf99240 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl256b -mabi=lp64d -mrvv-vector-bits=zvl -Ofast" } */ + +float g(float q[], int N){ + float dqnorm = 0.0; + + #pragma GCC unroll 4 + + for (int i=0; i < N; i++) { + dqnorm = dqnorm + q[i] * q[i]; + } + return dqnorm; +} + +/* need slightly different test for when -funroll-loops is enabled to keep + test output stable. Otherwise test may be flakey. */ +/* { dg-final { scan-assembler-times {beq\s+[a-x0-9]+,zero,.L12\s+vsetvli} 3 { target { no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {beq\s+[a-x0-9]+,[a-x0-9]+,.L12\s+vsetvli} 3 { target { any-opts "-funroll-loops" } } } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c index be9f312..78c8a4a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64 -O2" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O2" } */ /* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/lib/htmltest.py b/gcc/testsuite/lib/htmltest.py index 8e42a8c..49ed4b0 100644 --- a/gcc/testsuite/lib/htmltest.py +++ b/gcc/testsuite/lib/htmltest.py @@ -83,14 +83,11 @@ def get_diag_by_index(html_tree, index): assert diag_list is not None assert_class(diag_list, 'gcc-diagnostic-list') - diags = diag_list.findall('xhtml:div', ns) - diag = diags[index] - assert_class(diag, 'gcc-diagnostic') + diag = diag_list.find(f"xhtml:div[@id='gcc-diag-{index}']", ns) return diag def get_message_within_diag(diag_element): - msg = diag_element.find('xhtml:span', ns) - assert_class(msg, 'gcc-message') + msg = diag_element.find("xhtml:div[@class='gcc-message']", ns) return msg def get_locus_within_diag(diag_element): diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index 7e819f3..4cfcc42 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -1053,6 +1053,7 @@ pass_cse_reciprocals::execute (function *fun) continue; gimple_replace_ssa_lhs (call, arg1); + reset_flow_sensitive_info (arg1); if (gimple_call_internal_p (call) != (ifn != IFN_LAST)) { auto_vec<tree, 4> args; diff --git a/gcc/xml-printer.h b/gcc/xml-printer.h index b90390c..428da0a 100644 --- a/gcc/xml-printer.h +++ b/gcc/xml-printer.h @@ -32,18 +32,19 @@ class node; class printer { public: - printer (element &insertion_point); + printer (element &insertion_point, bool check_popped_tags = true); void push_tag (std::string name, bool preserve_whitespace = false); void push_tag_with_class (std::string name, std::string class_, bool preserve_whitespace = false); - void pop_tag (); + void pop_tag (const char *expected_name); void set_attr (const char *name, std::string value); void add_text (std::string text); + void add_text_from_pp (pretty_printer &pp); void add_raw (std::string text); @@ -53,9 +54,38 @@ public: element *get_insertion_point () const; + size_t get_num_open_tags () const { return m_open_tags.size (); } + + void DEBUG_FUNCTION dump () const; + private: // borrowed ptrs: std::vector<element *> m_open_tags; + bool m_check_popped_tags; +}; + +/* RAII class for ensuring that the tags nested correctly. + Verify that within an instance's lifetime that any pushes + to the printer's insertion point have been popped by the end. */ + +class auto_check_tag_nesting +{ +public: + auto_check_tag_nesting (const printer &xp) + : m_xp (xp), + m_initial_insertion_element (xp.get_insertion_point ()) + { + } + ~auto_check_tag_nesting () + { + /* Verify that we didn't pop too many tags within the printer, + or leave any tags open. */ + gcc_assert (m_initial_insertion_element == m_xp.get_insertion_point ()); + } + +private: + const printer &m_xp; + const element *m_initial_insertion_element; }; // RAII for push/pop element on xml::printer @@ -66,17 +96,19 @@ public: auto_print_element (printer &printer, std::string name, bool preserve_whitespace = false) - : m_printer (printer) + : m_printer (printer), + m_name (std::move (name)) { - m_printer.push_tag (name, preserve_whitespace); + m_printer.push_tag (m_name, preserve_whitespace); } ~auto_print_element () { - m_printer.pop_tag (); + m_printer.pop_tag (m_name.c_str ()); } private: printer &m_printer; + std::string m_name; }; } // namespace xml @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "xml-printer.h" #include "pretty-print.h" #include "selftest.h" +#include "selftest-xml.h" namespace xml { @@ -121,6 +122,11 @@ node_with_children::add_text (std::string str) add_child (std::make_unique <text> (std::move (str))); } +void +node_with_children::add_text_from_pp (pretty_printer &pp) +{ + add_text (pp_formatted_text (&pp)); +} /* struct document : public node_with_children. */ @@ -196,13 +202,11 @@ raw::write_as_xml (pretty_printer *pp, pp_string (pp, m_xml_src.c_str ()); } -#if __GNUC__ >= 10 -# pragma GCC diagnostic pop -#endif - // class printer -printer::printer (element &insertion_point) +printer::printer (element &insertion_point, + bool check_popped_tags) +: m_check_popped_tags (check_popped_tags) { m_open_tags.push_back (&insertion_point); } @@ -227,9 +231,16 @@ printer::push_tag_with_class (std::string name, std::string class_, push_element (std::move (new_element)); } +/* Pop the current topmost tag. + If m_check_popped_tags, assert that the tag we're popping is + EXPECTED_NAME. */ + void -printer::pop_tag () +printer::pop_tag (const char *expected_name ATTRIBUTE_UNUSED) { + gcc_assert (!m_open_tags.empty ()); + if (m_check_popped_tags) + gcc_assert (expected_name == get_insertion_point ()->m_kind); m_open_tags.pop_back (); } @@ -247,6 +258,13 @@ printer::add_text (std::string text) } void +printer::add_text_from_pp (pretty_printer &pp) +{ + element *parent = m_open_tags.back (); + parent->add_text_from_pp (pp); +} + +void printer::add_raw (std::string text) { element *parent = m_open_tags.back (); @@ -274,20 +292,47 @@ printer::get_insertion_point () const return m_open_tags.back (); } +void +printer::dump () const +{ + pretty_printer pp; + pp.set_output_stream (stderr); + pp_printf (&pp, "open tags: %i:", (int)m_open_tags.size ()); + for (auto iter : m_open_tags) + pp_printf (&pp, " <%s>", iter->m_kind.c_str ()); + pp_newline (&pp); + pp_printf (&pp, "xml:"); + pp_newline (&pp); + m_open_tags[0]->write_as_xml (&pp, 1, true); + pp_flush (&pp); +} + +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + } // namespace xml #if CHECKING_P namespace selftest { +void +assert_xml_print_eq (const location &loc, + const xml::node &node, + const char *expected_value) +{ + pretty_printer pp; + node.write_as_xml (&pp, 0, true); + ASSERT_STREQ_AT (loc, pp_formatted_text (&pp), expected_value); +} + static void test_no_dtd () { xml::document doc; - pretty_printer pp; - doc.write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (doc, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); } @@ -303,14 +348,12 @@ test_printer () xp.set_attr ("color", "red"); xp.add_text ("world"); xp.push_tag ("baz"); - xp.pop_tag (); - xp.pop_tag (); - xp.pop_tag (); + xp.pop_tag ("baz"); + xp.pop_tag ("bar"); + xp.pop_tag ("foo"); - pretty_printer pp; - top.write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (top, "<top>\n" " <foo>\n" " hello\n" @@ -334,18 +377,16 @@ test_attribute_ordering () xp.set_attr ("hastings", "1066"); xp.set_attr ("edgehill", "1642"); xp.set_attr ("naseby", "1645"); - xp.pop_tag (); + xp.pop_tag ("chronological"); xp.push_tag ("alphabetical"); xp.set_attr ("edgehill", "1642"); xp.set_attr ("hastings", "1066"); xp.set_attr ("maldon", "991"); xp.set_attr ("naseby", "1645"); - xp.pop_tag (); + xp.pop_tag ("alphabetical"); - pretty_printer pp; - top.write_as_xml (&pp, 0, true); - ASSERT_STREQ - (pp_formatted_text (&pp), + ASSERT_XML_PRINT_EQ + (top, "<top>\n" " <chronological maldon=\"991\" hastings=\"1066\" edgehill=\"1642\" naseby=\"1645\"/>\n" " <alphabetical edgehill=\"1642\" hastings=\"1066\" maldon=\"991\" naseby=\"1645\"/>\n" @@ -65,6 +65,7 @@ struct node_with_children : public node { void add_child (std::unique_ptr<node> node); void add_text (std::string str); + void add_text_from_pp (pretty_printer &pp); std::vector<std::unique_ptr<node>> m_children; }; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index eef6ec7..8c10718 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,12 @@ +2025-06-11 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * include/line-map.h (typedef expanded_location): Convert to... + (struct expanded_location): ...this. + (operator==): New decl, for expanded_location. + (operator!=): Likewise. + * line-map.cc (operator==): New decl, for expanded_location. + 2025-05-07 Jakub Jelinek <jakub@redhat.com> PR preprocessor/108900 diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 75cc1ad..83ebbde 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -1280,7 +1280,7 @@ linemap_location_before_p (const line_maps *set, return linemap_compare_locations (set, loc_a, loc_b) >= 0; } -typedef struct +struct expanded_location { /* The name of the source file involved. */ const char *file; @@ -1294,7 +1294,18 @@ typedef struct /* In a system header?. */ bool sysp; -} expanded_location; +}; + +extern bool +operator== (const expanded_location &a, + const expanded_location &b); +inline bool +operator!= (const expanded_location &a, + const expanded_location &b) +{ + return !(a == b); +} + /* This is enum is used by the function linemap_resolve_location below. The meaning of the values is explained in the comment of diff --git a/libcpp/line-map.cc b/libcpp/line-map.cc index cf65571..284af57 100644 --- a/libcpp/line-map.cc +++ b/libcpp/line-map.cc @@ -1949,6 +1949,28 @@ linemap_expand_location (const line_maps *set, return xloc; } +bool +operator== (const expanded_location &a, + const expanded_location &b) +{ + /* "file" can be null; for them to be equal they must both + have either null or nonnull values, and if non-null + they must compare as equal. */ + if ((a.file == nullptr) != (b.file == nullptr)) + return false; + if (a.file && strcmp (a.file, b.file)) + return false; + + if (a.line != b.line) + return false; + if (a.column != b.column) + return false; + if (a.data != b.data) + return false; + if (a.sysp != b.sysp) + return false; + return true; +} /* Dump line map at index IX in line table SET to STREAM. If STREAM is NULL, use stderr. IS_MACRO is true if the caller wants to diff --git a/libgcobol/ChangeLog b/libgcobol/ChangeLog index ceb78dc..2cb85e6 100644 --- a/libgcobol/ChangeLog +++ b/libgcobol/ChangeLog @@ -1,3 +1,20 @@ +2025-06-11 Robert Dubner <rdubner@symas.com> + + PR cobol/119975 + * intrinsic.cc (__gg__current_date): Eliminate CLOCK_REALTIME. + (__gg__seconds_past_midnight): Likewise. + (__gg__formatted_current_date): Likewise. + (__gg__random): Likewise. + (__gg__random_next): Likewise. + * libgcobol.cc: include <sys/time.h>. + (__gg__abort): Eliminate CLOCK_REALTIME. + (cobol_time): Likewise. + (get_time_nanoseconds): Rename. + (get_time_nanoseconds_local): Comment; Eliminate CLOCK_REALTIME. + (__gg__clock_gettime): Likewise. + (__gg__get_date_hhmmssff): Likewise. + * libgcobol.h (__gg__clock_gettime): Eliminate clockid_t from declaration. + 2025-06-06 Robert Dubner <rdubner@symas.com> James K. Lowden <jklowden@cobolworx.com> diff --git a/libgcobol/intrinsic.cc b/libgcobol/intrinsic.cc index 2d8d79c..81ae638 100644 --- a/libgcobol/intrinsic.cc +++ b/libgcobol/intrinsic.cc @@ -1219,7 +1219,7 @@ __gg__current_date(cblc_field_t *dest) { // FUNCTION CURRENT-DATE struct cbl_timespec tp = {}; - __gg__clock_gettime(CLOCK_REALTIME, &tp); // time_t tv_sec; long tv_nsec + __gg__clock_gettime(&tp); // time_t tv_sec; long tv_nsec char retval[DATE_STRING_BUFFER_SIZE]; timespec_to_string(retval, tp); @@ -1236,7 +1236,7 @@ __gg__seconds_past_midnight(cblc_field_t *dest) struct tm tm; __int128 retval=0; - __gg__clock_gettime(CLOCK_REALTIME, &tp); // time_t tv_sec; long tv_nsec + __gg__clock_gettime(&tp); // time_t tv_sec; long tv_nsec localtime_r(&tp.tv_sec, &tm); retval += tm.tm_hour; @@ -1460,7 +1460,7 @@ __gg__formatted_current_date( cblc_field_t *dest, // Destination string size_t input_offset, size_t input_size) { - // FUNCTION CURRENT-DATE + // FUNCTION FORMATTED-CURRENT-DATE // Establish the destination, and set it to spaces char *d = PTRCAST(char, dest->data); @@ -1485,7 +1485,7 @@ __gg__formatted_current_date( cblc_field_t *dest, // Destination string } struct cbl_timespec ts = {}; - __gg__clock_gettime(CLOCK_REALTIME, &ts); + __gg__clock_gettime(&ts); struct tm tm = {}; #ifdef HAVE_STRUCT_TM_TM_ZONE @@ -3433,7 +3433,7 @@ __gg__random( cblc_field_t *dest, state = (char *)malloc(state_len); struct cbl_timespec ts; - __gg__clock_gettime(CLOCK_REALTIME, &ts); + __gg__clock_gettime(&ts); initstate_r( ts.tv_nsec, state, state_len, buf); } int seed = (int)__gg__binary_value_from_qualified_field(&rdigits, @@ -3473,7 +3473,7 @@ __gg__random_next(cblc_field_t *dest) buf->state = NULL; state = (char *)malloc(state_len); struct cbl_timespec ts; - __gg__clock_gettime(CLOCK_REALTIME, &ts); + __gg__clock_gettime(&ts); initstate_r( ts.tv_nsec, state, state_len, buf); } random_r(buf, &retval_31); diff --git a/libgcobol/libgcobol.cc b/libgcobol/libgcobol.cc index f8697af..81b5b7a 100644 --- a/libgcobol/libgcobol.cc +++ b/libgcobol/libgcobol.cc @@ -69,6 +69,7 @@ #include <sys/resource.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/time.h> #include <execinfo.h> #include "exceptl.h" @@ -264,7 +265,7 @@ class ec_status_t { , operation(file_op_none) , mode(file_mode_none_e) , user_status(nullptr) - , filename(nullptr) + , filename(nullptr) {} explicit file_status_t( const cblc_file_t *file ) : ifile(file->symbol_table_index) @@ -558,7 +559,7 @@ __gg__abort(const char *msg) abort(); } -void +void __gg__mabort() { __gg__abort("Memory allocation error\n"); @@ -2290,7 +2291,7 @@ static time_t cobol_time() { struct cbl_timespec tp; - __gg__clock_gettime(CLOCK_REALTIME, &tp); + __gg__clock_gettime(&tp); return tp.tv_sec; } @@ -2402,12 +2403,28 @@ int_from_digits(const char * &p, int ndigits) return retval; } -uint64_t -get_time_nanoseconds() +// For testing purposes, this undef causes the use of gettimeofday(). +// #undef HAVE_CLOCK_GETTIME + +static uint64_t +get_time_nanoseconds_local() { // This code was unabashedly stolen from gcc/timevar.cc. // It returns the Unix epoch with nine decimal places. + /* Note: I am perplexed. I have been examining the gcc Makefiles and + configure.ac files, and I am unable to locate where HAVE_GETTIMEOFDAY + is established. There have been issues compiling on MacOS, where + apparently clock_gettime() is not available. But I don't see exactly + how gettimeofday() gets used, instead. But without the ability to + compile on a MacOS system, I am fumbling along as best I can. + + I decided to simply replace clock_gettime() with getttimeofday() when + clock_gettime() isn't available, even though gcc/timevar.cc handles + the situation differently. + + -- Bob Dubner, 2025-06-11*/ + uint64_t retval = 0; #ifdef HAVE_CLOCK_GETTIME @@ -2415,8 +2432,9 @@ get_time_nanoseconds() clock_gettime (CLOCK_REALTIME, &ts); retval = ts.tv_sec * 1000000000 + ts.tv_nsec; return retval; -#endif -#ifdef HAVE_GETTIMEOFDAY +//#endif +//#ifdef HAVE_GETTIMEOFDAY +#else struct timeval tv; gettimeofday (&tv, NULL); retval = tv.tv_sec * 1000000000 + tv.tv_usec * 1000; @@ -2427,7 +2445,7 @@ get_time_nanoseconds() extern "C" void -__gg__clock_gettime(clockid_t clk_id, struct cbl_timespec *tp) +__gg__clock_gettime(struct cbl_timespec *tp) { const char *p = getenv("GCOBOL_CURRENT_DATE"); @@ -2457,9 +2475,7 @@ __gg__clock_gettime(clockid_t clk_id, struct cbl_timespec *tp) } else { - timespec tm; - clock_gettime(clk_id, &tm); - uint64_t ns = get_time_nanoseconds(); + uint64_t ns = get_time_nanoseconds_local(); tp->tv_sec = ns/1000000000; tp->tv_nsec = ns%1000000000; } @@ -2472,7 +2488,7 @@ __gg__get_date_hhmmssff() char ach[32]; struct cbl_timespec tv; - __gg__clock_gettime(CLOCK_REALTIME, &tv); + __gg__clock_gettime(&tv); struct tm tm; localtime_r(&tv.tv_sec, &tm); @@ -3691,7 +3707,7 @@ compare_88( const char *list, } else { - cmpval = cstrncmp (test, + cmpval = cstrncmp (test, PTRCAST(char, conditional_location), conditional_length); if( cmpval == 0 && (int)strlen(test) != conditional_length ) @@ -4573,7 +4589,7 @@ __gg__compare_2(cblc_field_t *left_side, } static size_t right_string_size = MINIMUM_ALLOCATION_SIZE; - static char *right_string + static char *right_string = static_cast<char *>(malloc(right_string_size)); right_string = format_for_display_internal( diff --git a/libgcobol/libgcobol.h b/libgcobol/libgcobol.h index 4aa2cff..2e338c2 100644 --- a/libgcobol/libgcobol.h +++ b/libgcobol/libgcobol.h @@ -112,7 +112,7 @@ struct cbl_timespec long tv_nsec; // Nanoseconds. } ; -extern "C" void __gg__clock_gettime(clockid_t clk_id, struct cbl_timespec *tp); +extern "C" void __gg__clock_gettime(struct cbl_timespec *tp); extern "C" GCOB_FP128 __gg__float128_from_location( const cblc_field_t *var, diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index eaa8e36..f0f1597 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,17 @@ +2025-06-11 François-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/116400 + * Makefile.am: Simplify logic. + * Makefile.in: Regenerate. + * regenerate.sh: Add some checks. + +2025-06-10 François-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/116400 + * Makefile.am: Remove source file regeneration rules. + * Makefile.in: Regenerate. + * regenerate.sh: New file. + 2025-06-07 François-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/116400 diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am index ce35a67..4f3b303 100644 --- a/libgfortran/Makefile.am +++ b/libgfortran/Makefile.am @@ -240,102 +240,61 @@ runtime/stop.c endif -i_all_c= \ +i_matmul_c= \ +generated/matmul_i1.c \ +generated/matmul_i2.c \ +generated/matmul_i4.c \ +generated/matmul_i8.c \ +generated/matmul_i16.c \ +generated/matmul_r4.c \ +generated/matmul_r8.c \ +generated/matmul_r10.c \ +generated/matmul_r16.c \ +generated/matmul_r17.c \ +generated/matmul_c4.c \ +generated/matmul_c8.c \ +generated/matmul_c10.c \ +generated/matmul_c16.c \ +generated/matmul_c17.c + +i_matmulavx128_c= \ +generated/matmulavx128_i1.c \ +generated/matmulavx128_i2.c \ +generated/matmulavx128_i4.c \ +generated/matmulavx128_i8.c \ +generated/matmulavx128_i16.c \ +generated/matmulavx128_r4.c \ +generated/matmulavx128_r8.c \ +generated/matmulavx128_r10.c \ +generated/matmulavx128_r16.c \ +generated/matmulavx128_r17.c \ +generated/matmulavx128_c4.c \ +generated/matmulavx128_c8.c \ +generated/matmulavx128_c10.c \ +generated/matmulavx128_c16.c \ +generated/matmulavx128_c17.c + +i_matmull_c= \ +generated/matmul_l4.c \ +generated/matmul_l8.c \ +generated/matmul_l16.c + +gfor_built_src= \ generated/all_l1.c \ generated/all_l2.c \ generated/all_l4.c \ generated/all_l8.c \ -generated/all_l16.c - -i_any_c= \ +generated/all_l16.c \ generated/any_l1.c \ generated/any_l2.c \ generated/any_l4.c \ generated/any_l8.c \ -generated/any_l16.c - -i_bessel_c= \ -generated/bessel_r4.c \ -generated/bessel_r8.c \ -generated/bessel_r10.c \ -generated/bessel_r16.c \ -generated/bessel_r17.c - -i_count_c= \ +generated/any_l16.c \ generated/count_1_l.c \ generated/count_2_l.c \ generated/count_4_l.c \ generated/count_8_l.c \ -generated/count_16_l.c - -i_iall_c= \ -generated/iall_i1.c \ -generated/iall_i2.c \ -generated/iall_i4.c \ -generated/iall_i8.c \ -generated/iall_i16.c - -i_iany_c= \ -generated/iany_i1.c \ -generated/iany_i2.c \ -generated/iany_i4.c \ -generated/iany_i8.c \ -generated/iany_i16.c - -i_iparity_c= \ -generated/iparity_i1.c \ -generated/iparity_i2.c \ -generated/iparity_i4.c \ -generated/iparity_i8.c \ -generated/iparity_i16.c - -i_findloc0_c= \ -generated/findloc0_i1.c \ -generated/findloc0_i2.c \ -generated/findloc0_i4.c \ -generated/findloc0_i8.c \ -generated/findloc0_i16.c \ -generated/findloc0_r4.c \ -generated/findloc0_r8.c \ -generated/findloc0_r10.c \ -generated/findloc0_r16.c \ -generated/findloc0_r17.c \ -generated/findloc0_c4.c \ -generated/findloc0_c8.c \ -generated/findloc0_c10.c \ -generated/findloc0_c16.c \ -generated/findloc0_c17.c - -i_findloc0s_c= \ -generated/findloc0_s1.c \ -generated/findloc0_s4.c - -i_findloc1_c= \ -generated/findloc1_i1.c \ -generated/findloc1_i2.c \ -generated/findloc1_i4.c \ -generated/findloc1_i8.c \ -generated/findloc1_i16.c \ -generated/findloc1_r4.c \ -generated/findloc1_r8.c \ -generated/findloc1_r10.c \ -generated/findloc1_r16.c \ -generated/findloc1_r17.c \ -generated/findloc1_c4.c \ -generated/findloc1_c8.c \ -generated/findloc1_c10.c \ -generated/findloc1_c16.c \ -generated/findloc1_c17.c - -i_findloc1s_c= \ -generated/findloc1_s1.c \ -generated/findloc1_s4.c - -i_findloc2s_c= \ -generated/findloc2_s1.c \ -generated/findloc2_s4.c - -i_maxloc0_c= \ +generated/count_16_l.c \ generated/maxloc0_4_i1.c \ generated/maxloc0_8_i1.c \ generated/maxloc0_16_i1.c \ @@ -380,17 +339,7 @@ generated/maxloc0_8_r16.c \ generated/maxloc0_16_r16.c \ generated/maxloc0_4_r17.c \ generated/maxloc0_8_r17.c \ -generated/maxloc0_16_r17.c - -i_maxloc0s_c = \ -generated/maxloc0_4_s1.c \ -generated/maxloc0_4_s4.c \ -generated/maxloc0_8_s1.c \ -generated/maxloc0_8_s4.c \ -generated/maxloc0_16_s1.c \ -generated/maxloc0_16_s4.c - -i_maxloc1_c= \ +generated/maxloc0_16_r17.c \ generated/maxloc1_4_i1.c \ generated/maxloc1_8_i1.c \ generated/maxloc1_16_i1.c \ @@ -435,25 +384,7 @@ generated/maxloc1_8_r16.c \ generated/maxloc1_16_r16.c \ generated/maxloc1_4_r17.c \ generated/maxloc1_8_r17.c \ -generated/maxloc1_16_r17.c - -i_maxloc1s_c= \ -generated/maxloc1_4_s1.c \ -generated/maxloc1_4_s4.c \ -generated/maxloc1_8_s1.c \ -generated/maxloc1_8_s4.c \ -generated/maxloc1_16_s1.c \ -generated/maxloc1_16_s4.c - -i_maxloc2s_c= \ -generated/maxloc2_4_s1.c \ -generated/maxloc2_4_s4.c \ -generated/maxloc2_8_s1.c \ -generated/maxloc2_8_s4.c \ -generated/maxloc2_16_s1.c \ -generated/maxloc2_16_s4.c - -i_maxval_c= \ +generated/maxloc1_16_r17.c \ generated/maxval_i1.c \ generated/maxval_i2.c \ generated/maxval_i4.c \ @@ -468,17 +399,7 @@ generated/maxval_r4.c \ generated/maxval_r8.c \ generated/maxval_r10.c \ generated/maxval_r16.c \ -generated/maxval_r17.c - -i_maxval0s_c=\ -generated/maxval0_s1.c \ -generated/maxval0_s4.c - -i_maxval1s_c=\ -generated/maxval1_s1.c \ -generated/maxval1_s4.c - -i_minloc0_c= \ +generated/maxval_r17.c \ generated/minloc0_4_i1.c \ generated/minloc0_8_i1.c \ generated/minloc0_16_i1.c \ @@ -523,17 +444,7 @@ generated/minloc0_8_r16.c \ generated/minloc0_16_r16.c \ generated/minloc0_4_r17.c \ generated/minloc0_8_r17.c \ -generated/minloc0_16_r17.c - -i_minloc0s_c = \ -generated/minloc0_4_s1.c \ -generated/minloc0_4_s4.c \ -generated/minloc0_8_s1.c \ -generated/minloc0_8_s4.c \ -generated/minloc0_16_s1.c \ -generated/minloc0_16_s4.c - -i_minloc1_c= \ +generated/minloc0_16_r17.c \ generated/minloc1_4_i1.c \ generated/minloc1_8_i1.c \ generated/minloc1_16_i1.c \ @@ -578,25 +489,7 @@ generated/minloc1_8_r16.c \ generated/minloc1_16_r16.c \ generated/minloc1_4_r17.c \ generated/minloc1_8_r17.c \ -generated/minloc1_16_r17.c - -i_minloc1s_c= \ -generated/minloc1_4_s1.c \ -generated/minloc1_4_s4.c \ -generated/minloc1_8_s1.c \ -generated/minloc1_8_s4.c \ -generated/minloc1_16_s1.c \ -generated/minloc1_16_s4.c - -i_minloc2s_c= \ -generated/minloc2_4_s1.c \ -generated/minloc2_4_s4.c \ -generated/minloc2_8_s1.c \ -generated/minloc2_8_s4.c \ -generated/minloc2_16_s1.c \ -generated/minloc2_16_s4.c - -i_minval_c= \ +generated/minloc1_16_r17.c \ generated/minval_i1.c \ generated/minval_i2.c \ generated/minval_i4.c \ @@ -611,48 +504,7 @@ generated/minval_r4.c \ generated/minval_r8.c \ generated/minval_r10.c \ generated/minval_r16.c \ -generated/minval_r17.c - -i_minval0s_c=\ -generated/minval0_s1.c \ -generated/minval0_s4.c - -i_minval1s_c=\ -generated/minval1_s1.c \ -generated/minval1_s4.c - -i_norm2_c= \ -generated/norm2_r4.c \ -generated/norm2_r8.c \ -generated/norm2_r10.c \ -generated/norm2_r16.c \ -generated/norm2_r17.c - -i_parity_c = \ -generated/parity_l1.c \ -generated/parity_l2.c \ -generated/parity_l4.c \ -generated/parity_l8.c \ -generated/parity_l16.c - -i_sum_c= \ -generated/sum_i1.c \ -generated/sum_i2.c \ -generated/sum_i4.c \ -generated/sum_i8.c \ -generated/sum_i16.c \ -generated/sum_r4.c \ -generated/sum_r8.c \ -generated/sum_r10.c \ -generated/sum_r16.c \ -generated/sum_r17.c \ -generated/sum_c4.c \ -generated/sum_c8.c \ -generated/sum_c10.c \ -generated/sum_c16.c \ -generated/sum_c17.c - -i_product_c= \ +generated/minval_r17.c \ generated/product_i1.c \ generated/product_i2.c \ generated/product_i4.c \ @@ -667,55 +519,66 @@ generated/product_c4.c \ generated/product_c8.c \ generated/product_c10.c \ generated/product_c16.c \ -generated/product_c17.c - -i_matmul_c= \ -generated/matmul_i1.c \ -generated/matmul_i2.c \ -generated/matmul_i4.c \ -generated/matmul_i8.c \ -generated/matmul_i16.c \ -generated/matmul_r4.c \ -generated/matmul_r8.c \ -generated/matmul_r10.c \ -generated/matmul_r16.c \ -generated/matmul_r17.c \ -generated/matmul_c4.c \ -generated/matmul_c8.c \ -generated/matmul_c10.c \ -generated/matmul_c16.c \ -generated/matmul_c17.c - -i_matmulavx128_c= \ -generated/matmulavx128_i1.c \ -generated/matmulavx128_i2.c \ -generated/matmulavx128_i4.c \ -generated/matmulavx128_i8.c \ -generated/matmulavx128_i16.c \ -generated/matmulavx128_r4.c \ -generated/matmulavx128_r8.c \ -generated/matmulavx128_r10.c \ -generated/matmulavx128_r16.c \ -generated/matmulavx128_r17.c \ -generated/matmulavx128_c4.c \ -generated/matmulavx128_c8.c \ -generated/matmulavx128_c10.c \ -generated/matmulavx128_c16.c \ -generated/matmulavx128_c17.c - -i_matmull_c= \ -generated/matmul_l4.c \ -generated/matmul_l8.c \ -generated/matmul_l16.c - -i_shape_c= \ +generated/product_c17.c \ +generated/sum_i1.c \ +generated/sum_i2.c \ +generated/sum_i4.c \ +generated/sum_i8.c \ +generated/sum_i16.c \ +generated/sum_r4.c \ +generated/sum_r8.c \ +generated/sum_r10.c \ +generated/sum_r16.c \ +generated/sum_r17.c \ +generated/sum_c4.c \ +generated/sum_c8.c \ +generated/sum_c10.c \ +generated/sum_c16.c \ +generated/sum_c17.c \ +generated/bessel_r4.c \ +generated/bessel_r8.c \ +generated/bessel_r10.c \ +generated/bessel_r16.c \ +generated/bessel_r17.c \ +generated/iall_i1.c \ +generated/iall_i2.c \ +generated/iall_i4.c \ +generated/iall_i8.c \ +generated/iall_i16.c \ +generated/iany_i1.c \ +generated/iany_i2.c \ +generated/iany_i4.c \ +generated/iany_i8.c \ +generated/iany_i16.c \ +generated/iparity_i1.c \ +generated/iparity_i2.c \ +generated/iparity_i4.c \ +generated/iparity_i8.c \ +generated/iparity_i16.c \ +generated/norm2_r4.c \ +generated/norm2_r8.c \ +generated/norm2_r10.c \ +generated/norm2_r16.c \ +generated/norm2_r17.c \ +generated/parity_l1.c \ +generated/parity_l2.c \ +generated/parity_l4.c \ +generated/parity_l8.c \ +generated/parity_l16.c \ generated/shape_i1.c \ generated/shape_i2.c \ generated/shape_i4.c \ generated/shape_i8.c \ -generated/shape_i16.c - -i_reshape_c= \ +generated/shape_i16.c \ +generated/eoshift1_4.c \ +generated/eoshift1_8.c \ +generated/eoshift1_16.c \ +generated/eoshift3_4.c \ +generated/eoshift3_8.c \ +generated/eoshift3_16.c \ +generated/cshift1_4.c \ +generated/cshift1_8.c \ +generated/cshift1_16.c \ generated/reshape_i4.c \ generated/reshape_i8.c \ generated/reshape_i16.c \ @@ -728,88 +591,7 @@ generated/reshape_c4.c \ generated/reshape_c8.c \ generated/reshape_c10.c \ generated/reshape_c16.c \ -generated/reshape_c17.c - -i_eoshift1_c= \ -generated/eoshift1_4.c \ -generated/eoshift1_8.c \ -generated/eoshift1_16.c - -i_eoshift3_c= \ -generated/eoshift3_4.c \ -generated/eoshift3_8.c \ -generated/eoshift3_16.c - -i_cshift0_c= \ -generated/cshift0_i1.c \ -generated/cshift0_i2.c \ -generated/cshift0_i4.c \ -generated/cshift0_i8.c \ -generated/cshift0_i16.c \ -generated/cshift0_r4.c \ -generated/cshift0_r8.c \ -generated/cshift0_r10.c \ -generated/cshift0_r16.c \ -generated/cshift0_r17.c \ -generated/cshift0_c4.c \ -generated/cshift0_c8.c \ -generated/cshift0_c10.c \ -generated/cshift0_c16.c \ -generated/cshift0_c17.c - -i_cshift1_c= \ -generated/cshift1_4.c \ -generated/cshift1_8.c \ -generated/cshift1_16.c - -i_cshift1a_c = \ -generated/cshift1_4_i1.c \ -generated/cshift1_4_i2.c \ -generated/cshift1_4_i4.c \ -generated/cshift1_4_i8.c \ -generated/cshift1_4_i16.c \ -generated/cshift1_4_r4.c \ -generated/cshift1_4_r8.c \ -generated/cshift1_4_r10.c \ -generated/cshift1_4_r16.c \ -generated/cshift1_4_r17.c \ -generated/cshift1_4_c4.c \ -generated/cshift1_4_c8.c \ -generated/cshift1_4_c10.c \ -generated/cshift1_4_c16.c \ -generated/cshift1_4_c17.c \ -generated/cshift1_8_i1.c \ -generated/cshift1_8_i2.c \ -generated/cshift1_8_i4.c \ -generated/cshift1_8_i8.c \ -generated/cshift1_8_i16.c \ -generated/cshift1_8_r4.c \ -generated/cshift1_8_r8.c \ -generated/cshift1_8_r10.c \ -generated/cshift1_8_r16.c \ -generated/cshift1_8_r17.c \ -generated/cshift1_8_c4.c \ -generated/cshift1_8_c8.c \ -generated/cshift1_8_c10.c \ -generated/cshift1_8_c16.c \ -generated/cshift1_8_c17.c \ -generated/cshift1_16_i1.c \ -generated/cshift1_16_i2.c \ -generated/cshift1_16_i4.c \ -generated/cshift1_16_i8.c \ -generated/cshift1_16_i16.c \ -generated/cshift1_16_r4.c \ -generated/cshift1_16_r8.c \ -generated/cshift1_16_r10.c \ -generated/cshift1_16_r16.c \ -generated/cshift1_16_r17.c \ -generated/cshift1_16_c4.c \ -generated/cshift1_16_c8.c \ -generated/cshift1_16_c10.c \ -generated/cshift1_16_c16.c \ -generated/cshift1_16_c17.c - -in_pack_c = \ +generated/reshape_c17.c \ generated/in_pack_i1.c \ generated/in_pack_i2.c \ generated/in_pack_i4.c \ @@ -824,9 +606,7 @@ generated/in_pack_c4.c \ generated/in_pack_c8.c \ generated/in_pack_c10.c \ generated/in_pack_c16.c \ -generated/in_pack_c17.c - -in_unpack_c = \ +generated/in_pack_c17.c \ generated/in_unpack_i1.c \ generated/in_unpack_i2.c \ generated/in_unpack_i4.c \ @@ -841,9 +621,7 @@ generated/in_unpack_c4.c \ generated/in_unpack_c8.c \ generated/in_unpack_c10.c \ generated/in_unpack_c16.c \ -generated/in_unpack_c17.c - -i_pow_c = \ +generated/in_unpack_c17.c \ generated/pow_i4_i4.c \ generated/pow_i8_i4.c \ generated/pow_i16_i4.c \ @@ -879,36 +657,7 @@ generated/pow_c4_i16.c \ generated/pow_c8_i16.c \ generated/pow_c10_i16.c \ generated/pow_c16_i16.c \ -generated/pow_c17_i16.c - -i_powu_c = \ -generated/pow_m1_m1.c \ -generated/pow_m1_m2.c \ -generated/pow_m1_m4.c \ -generated/pow_m1_m8.c \ -generated/pow_m1_m16.c \ -generated/pow_m2_m1.c \ -generated/pow_m2_m2.c \ -generated/pow_m2_m4.c \ -generated/pow_m2_m8.c \ -generated/pow_m2_m16.c \ -generated/pow_m4_m1.c \ -generated/pow_m4_m2.c \ -generated/pow_m4_m4.c \ -generated/pow_m4_m8.c \ -generated/pow_m4_m16.c \ -generated/pow_m8_m1.c \ -generated/pow_m8_m2.c \ -generated/pow_m8_m4.c \ -generated/pow_m8_m8.c \ -generated/pow_m8_m16.c \ -generated/pow_m16_m1.c \ -generated/pow_m16_m2.c \ -generated/pow_m16_m4.c \ -generated/pow_m16_m8.c \ -generated/pow_m16_m16.c - -i_pack_c = \ +generated/pow_c17_i16.c \ generated/pack_i1.c \ generated/pack_i2.c \ generated/pack_i4.c \ @@ -923,9 +672,7 @@ generated/pack_c4.c \ generated/pack_c8.c \ generated/pack_c10.c \ generated/pack_c16.c \ -generated/pack_c17.c - -i_unpack_c = \ +generated/pack_c17.c \ generated/unpack_i1.c \ generated/unpack_i2.c \ generated/unpack_i4.c \ @@ -940,9 +687,7 @@ generated/unpack_c4.c \ generated/unpack_c8.c \ generated/unpack_c10.c \ generated/unpack_c16.c \ -generated/unpack_c17.c - -i_spread_c = \ +generated/unpack_c17.c \ generated/spread_i1.c \ generated/spread_i2.c \ generated/spread_i4.c \ @@ -957,43 +702,179 @@ generated/spread_c4.c \ generated/spread_c8.c \ generated/spread_c10.c \ generated/spread_c16.c \ -generated/spread_c17.c - -i_isobinding_c = \ -runtime/ISO_Fortran_binding.c - -m4_files= m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \ - m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval.m4 \ - m4/minloc0.m4 m4/minloc1.m4 m4/minval.m4 m4/product.m4 m4/sum.m4 \ - m4/matmul.m4 m4/matmull.m4 m4/ifunction_logical.m4 \ - m4/ctrig.m4 m4/cexp.m4 m4/chyp.m4 m4/mtype.m4 \ - m4/specific.m4 m4/specific2.m4 m4/head.m4 m4/shape.m4 m4/reshape.m4 \ - m4/eoshift1.m4 m4/eoshift3.m4 \ - m4/pow.m4 \ - m4/misc_specifics.m4 m4/pack.m4 \ - m4/unpack.m4 m4/spread.m4 m4/bessel.m4 m4/norm2.m4 m4/parity.m4 \ - m4/iall.m4 m4/iany.m4 m4/iparity.m4 m4/iforeach-s.m4 m4/findloc0.m4 \ - m4/findloc0s.m4 m4/ifindloc0.m4 m4/findloc1.m4 m4/ifindloc1.m4 \ - m4/findloc2s.m4 m4/ifindloc2.m4 - -gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ - $(i_maxloc1_c) $(i_maxval_c) $(i_minloc0_c) $(i_minloc1_c) $(i_minval_c) \ - $(i_product_c) $(i_sum_c) $(i_bessel_c) $(i_iall_c) $(i_iany_c) \ - $(i_iparity_c) $(i_norm2_c) $(i_parity_c) \ - $(i_matmul_c) $(i_matmull_c) $(i_shape_c) $(i_eoshift1_c) \ - $(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \ - $(i_pow_c) $(i_pack_c) $(i_unpack_c) $(i_matmulavx128_c) \ - $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \ - $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \ - include/ISO_Fortran_binding.h \ - $(i_cshift1a_c) $(i_maxloc0s_c) $(i_minloc0s_c) $(i_maxloc1s_c) \ - $(i_minloc1s_c) $(i_maxloc2s_c) $(i_minloc2s_c) $(i_maxvals_c) \ - $(i_maxval0s_c) $(i_minval0s_c) $(i_maxval1s_c) $(i_minval1s_c) \ - $(i_findloc0_c) $(i_findloc0s_c) $(i_findloc1_c) $(i_findloc1s_c) \ - $(i_findloc2s_c) $(i_isobinding_c) $(i_powu_c) - -# Machine generated specifics -gfor_built_specific_src= \ +generated/spread_c17.c \ +generated/cshift0_i1.c \ +generated/cshift0_i2.c \ +generated/cshift0_i4.c \ +generated/cshift0_i8.c \ +generated/cshift0_i16.c \ +generated/cshift0_r4.c \ +generated/cshift0_r8.c \ +generated/cshift0_r10.c \ +generated/cshift0_r16.c \ +generated/cshift0_r17.c \ +generated/cshift0_c4.c \ +generated/cshift0_c8.c \ +generated/cshift0_c10.c \ +generated/cshift0_c16.c \ +generated/cshift0_c17.c \ +generated/cshift1_4_i1.c \ +generated/cshift1_4_i2.c \ +generated/cshift1_4_i4.c \ +generated/cshift1_4_i8.c \ +generated/cshift1_4_i16.c \ +generated/cshift1_4_r4.c \ +generated/cshift1_4_r8.c \ +generated/cshift1_4_r10.c \ +generated/cshift1_4_r16.c \ +generated/cshift1_4_r17.c \ +generated/cshift1_4_c4.c \ +generated/cshift1_4_c8.c \ +generated/cshift1_4_c10.c \ +generated/cshift1_4_c16.c \ +generated/cshift1_4_c17.c \ +generated/cshift1_8_i1.c \ +generated/cshift1_8_i2.c \ +generated/cshift1_8_i4.c \ +generated/cshift1_8_i8.c \ +generated/cshift1_8_i16.c \ +generated/cshift1_8_r4.c \ +generated/cshift1_8_r8.c \ +generated/cshift1_8_r10.c \ +generated/cshift1_8_r16.c \ +generated/cshift1_8_r17.c \ +generated/cshift1_8_c4.c \ +generated/cshift1_8_c8.c \ +generated/cshift1_8_c10.c \ +generated/cshift1_8_c16.c \ +generated/cshift1_8_c17.c \ +generated/cshift1_16_i1.c \ +generated/cshift1_16_i2.c \ +generated/cshift1_16_i4.c \ +generated/cshift1_16_i8.c \ +generated/cshift1_16_i16.c \ +generated/cshift1_16_r4.c \ +generated/cshift1_16_r8.c \ +generated/cshift1_16_r10.c \ +generated/cshift1_16_r16.c \ +generated/cshift1_16_r17.c \ +generated/cshift1_16_c4.c \ +generated/cshift1_16_c8.c \ +generated/cshift1_16_c10.c \ +generated/cshift1_16_c16.c \ +generated/cshift1_16_c17.c \ +generated/findloc0_i1.c \ +generated/findloc0_i2.c \ +generated/findloc0_i4.c \ +generated/findloc0_i8.c \ +generated/findloc0_i16.c \ +generated/findloc0_r4.c \ +generated/findloc0_r8.c \ +generated/findloc0_r10.c \ +generated/findloc0_r16.c \ +generated/findloc0_r17.c \ +generated/findloc0_c4.c \ +generated/findloc0_c8.c \ +generated/findloc0_c10.c \ +generated/findloc0_c16.c \ +generated/findloc0_c17.c \ +generated/findloc0_s1.c \ +generated/findloc0_s4.c \ +generated/findloc1_i1.c \ +generated/findloc1_i2.c \ +generated/findloc1_i4.c \ +generated/findloc1_i8.c \ +generated/findloc1_i16.c \ +generated/findloc1_r4.c \ +generated/findloc1_r8.c \ +generated/findloc1_r10.c \ +generated/findloc1_r16.c \ +generated/findloc1_r17.c \ +generated/findloc1_c4.c \ +generated/findloc1_c8.c \ +generated/findloc1_c10.c \ +generated/findloc1_c16.c \ +generated/findloc1_c17.c \ +generated/findloc1_s1.c \ +generated/findloc1_s4.c \ +generated/findloc2_s1.c \ +generated/findloc2_s4.c \ +generated/maxloc0_4_s1.c \ +generated/maxloc0_4_s4.c \ +generated/maxloc0_8_s1.c \ +generated/maxloc0_8_s4.c \ +generated/maxloc0_16_s1.c \ +generated/maxloc0_16_s4.c \ +generated/maxloc1_4_s1.c \ +generated/maxloc1_4_s4.c \ +generated/maxloc1_8_s1.c \ +generated/maxloc1_8_s4.c \ +generated/maxloc1_16_s1.c \ +generated/maxloc1_16_s4.c \ +generated/maxloc2_4_s1.c \ +generated/maxloc2_4_s4.c \ +generated/maxloc2_8_s1.c \ +generated/maxloc2_8_s4.c \ +generated/maxloc2_16_s1.c \ +generated/maxloc2_16_s4.c \ +generated/maxval0_s1.c \ +generated/maxval0_s4.c \ +generated/maxval1_s1.c \ +generated/maxval1_s4.c \ +generated/minloc0_4_s1.c \ +generated/minloc0_4_s4.c \ +generated/minloc0_8_s1.c \ +generated/minloc0_8_s4.c \ +generated/minloc0_16_s1.c \ +generated/minloc0_16_s4.c \ +generated/minloc1_4_s1.c \ +generated/minloc1_4_s4.c \ +generated/minloc1_8_s1.c \ +generated/minloc1_8_s4.c \ +generated/minloc1_16_s1.c \ +generated/minloc1_16_s4.c \ +generated/minloc2_4_s1.c \ +generated/minloc2_4_s4.c \ +generated/minloc2_8_s1.c \ +generated/minloc2_8_s4.c \ +generated/minloc2_16_s1.c \ +generated/minloc2_16_s4.c \ +generated/minval0_s1.c \ +generated/minval0_s4.c \ +generated/minval1_s1.c \ +generated/minval1_s4.c \ +generated/pow_m1_m1.c \ +generated/pow_m1_m2.c \ +generated/pow_m1_m4.c \ +generated/pow_m1_m8.c \ +generated/pow_m1_m16.c \ +generated/pow_m2_m1.c \ +generated/pow_m2_m2.c \ +generated/pow_m2_m4.c \ +generated/pow_m2_m8.c \ +generated/pow_m2_m16.c \ +generated/pow_m4_m1.c \ +generated/pow_m4_m2.c \ +generated/pow_m4_m4.c \ +generated/pow_m4_m8.c \ +generated/pow_m4_m16.c \ +generated/pow_m8_m1.c \ +generated/pow_m8_m2.c \ +generated/pow_m8_m4.c \ +generated/pow_m8_m8.c \ +generated/pow_m8_m16.c \ +generated/pow_m16_m1.c \ +generated/pow_m16_m2.c \ +generated/pow_m16_m4.c \ +generated/pow_m16_m8.c \ +generated/pow_m16_m16.c \ +$(i_matmul_c) $(i_matmull_c) $(i_matmulavx128_c) \ +selected_int_kind.inc selected_real_kind.inc kinds.h \ +kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \ +include/ISO_Fortran_binding.h runtime/ISO_Fortran_binding.c + +# Specifics +gfor_specific_src= \ generated/_abs_c4.F90 \ generated/_abs_c8.F90 \ generated/_abs_c10.F90 \ @@ -1131,9 +1012,7 @@ generated/_anint_r4.F90 \ generated/_anint_r8.F90 \ generated/_anint_r10.F90 \ generated/_anint_r16.F90 \ -generated/_anint_r17.F90 - -gfor_built_specific2_src= \ +generated/_anint_r17.F90 \ generated/_sign_i4.F90 \ generated/_sign_i8.F90 \ generated/_sign_i16.F90 \ @@ -1162,14 +1041,8 @@ generated/_mod_r4.F90 \ generated/_mod_r8.F90 \ generated/_mod_r10.F90 \ generated/_mod_r16.F90 \ -generated/_mod_r17.F90 - -gfor_misc_specifics = generated/misc_specifics.F90 - -gfor_specific_src= \ -$(gfor_built_specific_src) \ -$(gfor_built_specific2_src) \ -$(gfor_misc_specifics) \ +generated/_mod_r17.F90 \ +generated/misc_specifics.F90 \ intrinsics/dprod_r8.f90 \ intrinsics/f2c_specifics.F90 \ intrinsics/random_init.f90 @@ -1221,8 +1094,7 @@ ieee_exceptions.mod: ieee/ieee_exceptions.lo ieee_arithmetic.mod: ieee/ieee_arithmetic.lo : -BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \ - $(gfor_built_specific2_src) $(gfor_misc_specifics) +BUILT_SOURCES=$(gfor_built_src) libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ $(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src) @@ -1262,7 +1134,7 @@ include/ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h clean-local: -rm -rf include $(version_dep) -EXTRA_DIST = $(m4_files) +EXTRA_DIST = m4 # target overrides -include $(tmake_file) diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in index f49ca02..dd88f88 100644 --- a/libgfortran/Makefile.in +++ b/libgfortran/Makefile.in @@ -231,37 +231,54 @@ libgfortran_la_LIBADD = am__objects_3 = runtime/bounds.lo runtime/compile_options.lo \ runtime/memory.lo runtime/string.lo runtime/select.lo \ $(am__objects_1) $(am__objects_2) -am__objects_4 = generated/all_l1.lo generated/all_l2.lo \ - generated/all_l4.lo generated/all_l8.lo generated/all_l16.lo -am__objects_5 = generated/any_l1.lo generated/any_l2.lo \ - generated/any_l4.lo generated/any_l8.lo generated/any_l16.lo -am__objects_6 = generated/count_1_l.lo generated/count_2_l.lo \ +am__objects_4 = generated/matmul_i1.lo generated/matmul_i2.lo \ + generated/matmul_i4.lo generated/matmul_i8.lo \ + generated/matmul_i16.lo generated/matmul_r4.lo \ + generated/matmul_r8.lo generated/matmul_r10.lo \ + generated/matmul_r16.lo generated/matmul_r17.lo \ + generated/matmul_c4.lo generated/matmul_c8.lo \ + generated/matmul_c10.lo generated/matmul_c16.lo \ + generated/matmul_c17.lo +am__objects_5 = generated/matmul_l4.lo generated/matmul_l8.lo \ + generated/matmul_l16.lo +am__objects_6 = generated/matmulavx128_i1.lo \ + generated/matmulavx128_i2.lo generated/matmulavx128_i4.lo \ + generated/matmulavx128_i8.lo generated/matmulavx128_i16.lo \ + generated/matmulavx128_r4.lo generated/matmulavx128_r8.lo \ + generated/matmulavx128_r10.lo generated/matmulavx128_r16.lo \ + generated/matmulavx128_r17.lo generated/matmulavx128_c4.lo \ + generated/matmulavx128_c8.lo generated/matmulavx128_c10.lo \ + generated/matmulavx128_c16.lo generated/matmulavx128_c17.lo +am__objects_7 = generated/all_l1.lo generated/all_l2.lo \ + generated/all_l4.lo generated/all_l8.lo generated/all_l16.lo \ + generated/any_l1.lo generated/any_l2.lo generated/any_l4.lo \ + generated/any_l8.lo generated/any_l16.lo \ + generated/count_1_l.lo generated/count_2_l.lo \ generated/count_4_l.lo generated/count_8_l.lo \ - generated/count_16_l.lo -am__objects_7 = generated/maxloc0_4_i1.lo generated/maxloc0_8_i1.lo \ - generated/maxloc0_16_i1.lo generated/maxloc0_4_i2.lo \ - generated/maxloc0_8_i2.lo generated/maxloc0_16_i2.lo \ - generated/maxloc0_4_i4.lo generated/maxloc0_8_i4.lo \ - generated/maxloc0_16_i4.lo generated/maxloc0_4_i8.lo \ - generated/maxloc0_8_i8.lo generated/maxloc0_16_i8.lo \ - generated/maxloc0_4_i16.lo generated/maxloc0_8_i16.lo \ - generated/maxloc0_16_i16.lo generated/maxloc0_4_m1.lo \ - generated/maxloc0_8_m1.lo generated/maxloc0_16_m1.lo \ - generated/maxloc0_4_m2.lo generated/maxloc0_8_m2.lo \ - generated/maxloc0_16_m2.lo generated/maxloc0_4_m4.lo \ - generated/maxloc0_8_m4.lo generated/maxloc0_16_m4.lo \ - generated/maxloc0_4_m8.lo generated/maxloc0_8_m8.lo \ - generated/maxloc0_16_m8.lo generated/maxloc0_4_m16.lo \ - generated/maxloc0_8_m16.lo generated/maxloc0_16_m16.lo \ - generated/maxloc0_4_r4.lo generated/maxloc0_8_r4.lo \ - generated/maxloc0_16_r4.lo generated/maxloc0_4_r8.lo \ - generated/maxloc0_8_r8.lo generated/maxloc0_16_r8.lo \ - generated/maxloc0_4_r10.lo generated/maxloc0_8_r10.lo \ - generated/maxloc0_16_r10.lo generated/maxloc0_4_r16.lo \ - generated/maxloc0_8_r16.lo generated/maxloc0_16_r16.lo \ - generated/maxloc0_4_r17.lo generated/maxloc0_8_r17.lo \ - generated/maxloc0_16_r17.lo -am__objects_8 = generated/maxloc1_4_i1.lo generated/maxloc1_8_i1.lo \ + generated/count_16_l.lo generated/maxloc0_4_i1.lo \ + generated/maxloc0_8_i1.lo generated/maxloc0_16_i1.lo \ + generated/maxloc0_4_i2.lo generated/maxloc0_8_i2.lo \ + generated/maxloc0_16_i2.lo generated/maxloc0_4_i4.lo \ + generated/maxloc0_8_i4.lo generated/maxloc0_16_i4.lo \ + generated/maxloc0_4_i8.lo generated/maxloc0_8_i8.lo \ + generated/maxloc0_16_i8.lo generated/maxloc0_4_i16.lo \ + generated/maxloc0_8_i16.lo generated/maxloc0_16_i16.lo \ + generated/maxloc0_4_m1.lo generated/maxloc0_8_m1.lo \ + generated/maxloc0_16_m1.lo generated/maxloc0_4_m2.lo \ + generated/maxloc0_8_m2.lo generated/maxloc0_16_m2.lo \ + generated/maxloc0_4_m4.lo generated/maxloc0_8_m4.lo \ + generated/maxloc0_16_m4.lo generated/maxloc0_4_m8.lo \ + generated/maxloc0_8_m8.lo generated/maxloc0_16_m8.lo \ + generated/maxloc0_4_m16.lo generated/maxloc0_8_m16.lo \ + generated/maxloc0_16_m16.lo generated/maxloc0_4_r4.lo \ + generated/maxloc0_8_r4.lo generated/maxloc0_16_r4.lo \ + generated/maxloc0_4_r8.lo generated/maxloc0_8_r8.lo \ + generated/maxloc0_16_r8.lo generated/maxloc0_4_r10.lo \ + generated/maxloc0_8_r10.lo generated/maxloc0_16_r10.lo \ + generated/maxloc0_4_r16.lo generated/maxloc0_8_r16.lo \ + generated/maxloc0_16_r16.lo generated/maxloc0_4_r17.lo \ + generated/maxloc0_8_r17.lo generated/maxloc0_16_r17.lo \ + generated/maxloc1_4_i1.lo generated/maxloc1_8_i1.lo \ generated/maxloc1_16_i1.lo generated/maxloc1_4_i2.lo \ generated/maxloc1_8_i2.lo generated/maxloc1_16_i2.lo \ generated/maxloc1_4_i4.lo generated/maxloc1_8_i4.lo \ @@ -283,16 +300,15 @@ am__objects_8 = generated/maxloc1_4_i1.lo generated/maxloc1_8_i1.lo \ generated/maxloc1_16_r10.lo generated/maxloc1_4_r16.lo \ generated/maxloc1_8_r16.lo generated/maxloc1_16_r16.lo \ generated/maxloc1_4_r17.lo generated/maxloc1_8_r17.lo \ - generated/maxloc1_16_r17.lo -am__objects_9 = generated/maxval_i1.lo generated/maxval_i2.lo \ - generated/maxval_i4.lo generated/maxval_i8.lo \ - generated/maxval_i16.lo generated/maxval_m1.lo \ - generated/maxval_m2.lo generated/maxval_m4.lo \ - generated/maxval_m8.lo generated/maxval_m16.lo \ - generated/maxval_r4.lo generated/maxval_r8.lo \ - generated/maxval_r10.lo generated/maxval_r16.lo \ - generated/maxval_r17.lo -am__objects_10 = generated/minloc0_4_i1.lo generated/minloc0_8_i1.lo \ + generated/maxloc1_16_r17.lo generated/maxval_i1.lo \ + generated/maxval_i2.lo generated/maxval_i4.lo \ + generated/maxval_i8.lo generated/maxval_i16.lo \ + generated/maxval_m1.lo generated/maxval_m2.lo \ + generated/maxval_m4.lo generated/maxval_m8.lo \ + generated/maxval_m16.lo generated/maxval_r4.lo \ + generated/maxval_r8.lo generated/maxval_r10.lo \ + generated/maxval_r16.lo generated/maxval_r17.lo \ + generated/minloc0_4_i1.lo generated/minloc0_8_i1.lo \ generated/minloc0_16_i1.lo generated/minloc0_4_i2.lo \ generated/minloc0_8_i2.lo generated/minloc0_16_i2.lo \ generated/minloc0_4_i4.lo generated/minloc0_8_i4.lo \ @@ -314,171 +330,140 @@ am__objects_10 = generated/minloc0_4_i1.lo generated/minloc0_8_i1.lo \ generated/minloc0_16_r10.lo generated/minloc0_4_r16.lo \ generated/minloc0_8_r16.lo generated/minloc0_16_r16.lo \ generated/minloc0_4_r17.lo generated/minloc0_8_r17.lo \ - generated/minloc0_16_r17.lo -am__objects_11 = generated/minloc1_4_i1.lo generated/minloc1_8_i1.lo \ - generated/minloc1_16_i1.lo generated/minloc1_4_i2.lo \ - generated/minloc1_8_i2.lo generated/minloc1_16_i2.lo \ - generated/minloc1_4_i4.lo generated/minloc1_8_i4.lo \ - generated/minloc1_16_i4.lo generated/minloc1_4_i8.lo \ - generated/minloc1_8_i8.lo generated/minloc1_16_i8.lo \ - generated/minloc1_4_i16.lo generated/minloc1_8_i16.lo \ - generated/minloc1_16_i16.lo generated/minloc1_4_m1.lo \ - generated/minloc1_8_m1.lo generated/minloc1_16_m1.lo \ - generated/minloc1_4_m2.lo generated/minloc1_8_m2.lo \ - generated/minloc1_16_m2.lo generated/minloc1_4_m4.lo \ - generated/minloc1_8_m4.lo generated/minloc1_16_m4.lo \ - generated/minloc1_4_m8.lo generated/minloc1_8_m8.lo \ - generated/minloc1_16_m8.lo generated/minloc1_4_m16.lo \ - generated/minloc1_8_m16.lo generated/minloc1_16_m16.lo \ - generated/minloc1_4_r4.lo generated/minloc1_8_r4.lo \ - generated/minloc1_16_r4.lo generated/minloc1_4_r8.lo \ - generated/minloc1_8_r8.lo generated/minloc1_16_r8.lo \ - generated/minloc1_4_r10.lo generated/minloc1_8_r10.lo \ - generated/minloc1_16_r10.lo generated/minloc1_4_r16.lo \ - generated/minloc1_8_r16.lo generated/minloc1_16_r16.lo \ - generated/minloc1_4_r17.lo generated/minloc1_8_r17.lo \ - generated/minloc1_16_r17.lo -am__objects_12 = generated/minval_i1.lo generated/minval_i2.lo \ + generated/minloc0_16_r17.lo generated/minloc1_4_i1.lo \ + generated/minloc1_8_i1.lo generated/minloc1_16_i1.lo \ + generated/minloc1_4_i2.lo generated/minloc1_8_i2.lo \ + generated/minloc1_16_i2.lo generated/minloc1_4_i4.lo \ + generated/minloc1_8_i4.lo generated/minloc1_16_i4.lo \ + generated/minloc1_4_i8.lo generated/minloc1_8_i8.lo \ + generated/minloc1_16_i8.lo generated/minloc1_4_i16.lo \ + generated/minloc1_8_i16.lo generated/minloc1_16_i16.lo \ + generated/minloc1_4_m1.lo generated/minloc1_8_m1.lo \ + generated/minloc1_16_m1.lo generated/minloc1_4_m2.lo \ + generated/minloc1_8_m2.lo generated/minloc1_16_m2.lo \ + generated/minloc1_4_m4.lo generated/minloc1_8_m4.lo \ + generated/minloc1_16_m4.lo generated/minloc1_4_m8.lo \ + generated/minloc1_8_m8.lo generated/minloc1_16_m8.lo \ + generated/minloc1_4_m16.lo generated/minloc1_8_m16.lo \ + generated/minloc1_16_m16.lo generated/minloc1_4_r4.lo \ + generated/minloc1_8_r4.lo generated/minloc1_16_r4.lo \ + generated/minloc1_4_r8.lo generated/minloc1_8_r8.lo \ + generated/minloc1_16_r8.lo generated/minloc1_4_r10.lo \ + generated/minloc1_8_r10.lo generated/minloc1_16_r10.lo \ + generated/minloc1_4_r16.lo generated/minloc1_8_r16.lo \ + generated/minloc1_16_r16.lo generated/minloc1_4_r17.lo \ + generated/minloc1_8_r17.lo generated/minloc1_16_r17.lo \ + generated/minval_i1.lo generated/minval_i2.lo \ generated/minval_i4.lo generated/minval_i8.lo \ generated/minval_i16.lo generated/minval_m1.lo \ generated/minval_m2.lo generated/minval_m4.lo \ generated/minval_m8.lo generated/minval_m16.lo \ generated/minval_r4.lo generated/minval_r8.lo \ generated/minval_r10.lo generated/minval_r16.lo \ - generated/minval_r17.lo -am__objects_13 = generated/product_i1.lo generated/product_i2.lo \ - generated/product_i4.lo generated/product_i8.lo \ - generated/product_i16.lo generated/product_r4.lo \ - generated/product_r8.lo generated/product_r10.lo \ - generated/product_r16.lo generated/product_r17.lo \ - generated/product_c4.lo generated/product_c8.lo \ - generated/product_c10.lo generated/product_c16.lo \ - generated/product_c17.lo -am__objects_14 = generated/sum_i1.lo generated/sum_i2.lo \ - generated/sum_i4.lo generated/sum_i8.lo generated/sum_i16.lo \ - generated/sum_r4.lo generated/sum_r8.lo generated/sum_r10.lo \ - generated/sum_r16.lo generated/sum_r17.lo generated/sum_c4.lo \ - generated/sum_c8.lo generated/sum_c10.lo generated/sum_c16.lo \ - generated/sum_c17.lo -am__objects_15 = generated/bessel_r4.lo generated/bessel_r8.lo \ + generated/minval_r17.lo generated/product_i1.lo \ + generated/product_i2.lo generated/product_i4.lo \ + generated/product_i8.lo generated/product_i16.lo \ + generated/product_r4.lo generated/product_r8.lo \ + generated/product_r10.lo generated/product_r16.lo \ + generated/product_r17.lo generated/product_c4.lo \ + generated/product_c8.lo generated/product_c10.lo \ + generated/product_c16.lo generated/product_c17.lo \ + generated/sum_i1.lo generated/sum_i2.lo generated/sum_i4.lo \ + generated/sum_i8.lo generated/sum_i16.lo generated/sum_r4.lo \ + generated/sum_r8.lo generated/sum_r10.lo generated/sum_r16.lo \ + generated/sum_r17.lo generated/sum_c4.lo generated/sum_c8.lo \ + generated/sum_c10.lo generated/sum_c16.lo generated/sum_c17.lo \ + generated/bessel_r4.lo generated/bessel_r8.lo \ generated/bessel_r10.lo generated/bessel_r16.lo \ - generated/bessel_r17.lo -am__objects_16 = generated/iall_i1.lo generated/iall_i2.lo \ - generated/iall_i4.lo generated/iall_i8.lo \ - generated/iall_i16.lo -am__objects_17 = generated/iany_i1.lo generated/iany_i2.lo \ - generated/iany_i4.lo generated/iany_i8.lo \ - generated/iany_i16.lo -am__objects_18 = generated/iparity_i1.lo generated/iparity_i2.lo \ - generated/iparity_i4.lo generated/iparity_i8.lo \ - generated/iparity_i16.lo -am__objects_19 = generated/norm2_r4.lo generated/norm2_r8.lo \ + generated/bessel_r17.lo generated/iall_i1.lo \ + generated/iall_i2.lo generated/iall_i4.lo generated/iall_i8.lo \ + generated/iall_i16.lo generated/iany_i1.lo \ + generated/iany_i2.lo generated/iany_i4.lo generated/iany_i8.lo \ + generated/iany_i16.lo generated/iparity_i1.lo \ + generated/iparity_i2.lo generated/iparity_i4.lo \ + generated/iparity_i8.lo generated/iparity_i16.lo \ + generated/norm2_r4.lo generated/norm2_r8.lo \ generated/norm2_r10.lo generated/norm2_r16.lo \ - generated/norm2_r17.lo -am__objects_20 = generated/parity_l1.lo generated/parity_l2.lo \ - generated/parity_l4.lo generated/parity_l8.lo \ - generated/parity_l16.lo -am__objects_21 = generated/matmul_i1.lo generated/matmul_i2.lo \ - generated/matmul_i4.lo generated/matmul_i8.lo \ - generated/matmul_i16.lo generated/matmul_r4.lo \ - generated/matmul_r8.lo generated/matmul_r10.lo \ - generated/matmul_r16.lo generated/matmul_r17.lo \ - generated/matmul_c4.lo generated/matmul_c8.lo \ - generated/matmul_c10.lo generated/matmul_c16.lo \ - generated/matmul_c17.lo -am__objects_22 = generated/matmul_l4.lo generated/matmul_l8.lo \ - generated/matmul_l16.lo -am__objects_23 = generated/shape_i1.lo generated/shape_i2.lo \ + generated/norm2_r17.lo generated/parity_l1.lo \ + generated/parity_l2.lo generated/parity_l4.lo \ + generated/parity_l8.lo generated/parity_l16.lo \ + generated/shape_i1.lo generated/shape_i2.lo \ generated/shape_i4.lo generated/shape_i8.lo \ - generated/shape_i16.lo -am__objects_24 = generated/eoshift1_4.lo generated/eoshift1_8.lo \ - generated/eoshift1_16.lo -am__objects_25 = generated/eoshift3_4.lo generated/eoshift3_8.lo \ - generated/eoshift3_16.lo -am__objects_26 = generated/cshift1_4.lo generated/cshift1_8.lo \ - generated/cshift1_16.lo -am__objects_27 = generated/reshape_i4.lo generated/reshape_i8.lo \ + generated/shape_i16.lo generated/eoshift1_4.lo \ + generated/eoshift1_8.lo generated/eoshift1_16.lo \ + generated/eoshift3_4.lo generated/eoshift3_8.lo \ + generated/eoshift3_16.lo generated/cshift1_4.lo \ + generated/cshift1_8.lo generated/cshift1_16.lo \ + generated/reshape_i4.lo generated/reshape_i8.lo \ generated/reshape_i16.lo generated/reshape_r4.lo \ generated/reshape_r8.lo generated/reshape_r10.lo \ generated/reshape_r16.lo generated/reshape_r17.lo \ generated/reshape_c4.lo generated/reshape_c8.lo \ generated/reshape_c10.lo generated/reshape_c16.lo \ - generated/reshape_c17.lo -am__objects_28 = generated/in_pack_i1.lo generated/in_pack_i2.lo \ - generated/in_pack_i4.lo generated/in_pack_i8.lo \ - generated/in_pack_i16.lo generated/in_pack_r4.lo \ - generated/in_pack_r8.lo generated/in_pack_r10.lo \ - generated/in_pack_r16.lo generated/in_pack_r17.lo \ - generated/in_pack_c4.lo generated/in_pack_c8.lo \ - generated/in_pack_c10.lo generated/in_pack_c16.lo \ - generated/in_pack_c17.lo -am__objects_29 = generated/in_unpack_i1.lo generated/in_unpack_i2.lo \ + generated/reshape_c17.lo generated/in_pack_i1.lo \ + generated/in_pack_i2.lo generated/in_pack_i4.lo \ + generated/in_pack_i8.lo generated/in_pack_i16.lo \ + generated/in_pack_r4.lo generated/in_pack_r8.lo \ + generated/in_pack_r10.lo generated/in_pack_r16.lo \ + generated/in_pack_r17.lo generated/in_pack_c4.lo \ + generated/in_pack_c8.lo generated/in_pack_c10.lo \ + generated/in_pack_c16.lo generated/in_pack_c17.lo \ + generated/in_unpack_i1.lo generated/in_unpack_i2.lo \ generated/in_unpack_i4.lo generated/in_unpack_i8.lo \ generated/in_unpack_i16.lo generated/in_unpack_r4.lo \ generated/in_unpack_r8.lo generated/in_unpack_r10.lo \ generated/in_unpack_r16.lo generated/in_unpack_r17.lo \ generated/in_unpack_c4.lo generated/in_unpack_c8.lo \ generated/in_unpack_c10.lo generated/in_unpack_c16.lo \ - generated/in_unpack_c17.lo -am__objects_30 = generated/pow_i4_i4.lo generated/pow_i8_i4.lo \ - generated/pow_i16_i4.lo generated/pow_r16_i4.lo \ - generated/pow_r17_i4.lo generated/pow_c4_i4.lo \ - generated/pow_c8_i4.lo generated/pow_c10_i4.lo \ - generated/pow_c16_i4.lo generated/pow_c17_i4.lo \ - generated/pow_i4_i8.lo generated/pow_i8_i8.lo \ - generated/pow_i16_i8.lo generated/pow_r4_i8.lo \ - generated/pow_r8_i8.lo generated/pow_r10_i8.lo \ - generated/pow_r16_i8.lo generated/pow_r17_i8.lo \ - generated/pow_c4_i8.lo generated/pow_c8_i8.lo \ - generated/pow_c10_i8.lo generated/pow_c16_i8.lo \ - generated/pow_c17_i8.lo generated/pow_i4_i16.lo \ - generated/pow_i8_i16.lo generated/pow_i16_i16.lo \ - generated/pow_r4_i16.lo generated/pow_r8_i16.lo \ - generated/pow_r10_i16.lo generated/pow_r16_i16.lo \ - generated/pow_r17_i16.lo generated/pow_c4_i16.lo \ - generated/pow_c8_i16.lo generated/pow_c10_i16.lo \ - generated/pow_c16_i16.lo generated/pow_c17_i16.lo -am__objects_31 = generated/pack_i1.lo generated/pack_i2.lo \ - generated/pack_i4.lo generated/pack_i8.lo \ + generated/in_unpack_c17.lo generated/pow_i4_i4.lo \ + generated/pow_i8_i4.lo generated/pow_i16_i4.lo \ + generated/pow_r16_i4.lo generated/pow_r17_i4.lo \ + generated/pow_c4_i4.lo generated/pow_c8_i4.lo \ + generated/pow_c10_i4.lo generated/pow_c16_i4.lo \ + generated/pow_c17_i4.lo generated/pow_i4_i8.lo \ + generated/pow_i8_i8.lo generated/pow_i16_i8.lo \ + generated/pow_r4_i8.lo generated/pow_r8_i8.lo \ + generated/pow_r10_i8.lo generated/pow_r16_i8.lo \ + generated/pow_r17_i8.lo generated/pow_c4_i8.lo \ + generated/pow_c8_i8.lo generated/pow_c10_i8.lo \ + generated/pow_c16_i8.lo generated/pow_c17_i8.lo \ + generated/pow_i4_i16.lo generated/pow_i8_i16.lo \ + generated/pow_i16_i16.lo generated/pow_r4_i16.lo \ + generated/pow_r8_i16.lo generated/pow_r10_i16.lo \ + generated/pow_r16_i16.lo generated/pow_r17_i16.lo \ + generated/pow_c4_i16.lo generated/pow_c8_i16.lo \ + generated/pow_c10_i16.lo generated/pow_c16_i16.lo \ + generated/pow_c17_i16.lo generated/pack_i1.lo \ + generated/pack_i2.lo generated/pack_i4.lo generated/pack_i8.lo \ generated/pack_i16.lo generated/pack_r4.lo \ generated/pack_r8.lo generated/pack_r10.lo \ generated/pack_r16.lo generated/pack_r17.lo \ generated/pack_c4.lo generated/pack_c8.lo \ generated/pack_c10.lo generated/pack_c16.lo \ - generated/pack_c17.lo -am__objects_32 = generated/unpack_i1.lo generated/unpack_i2.lo \ - generated/unpack_i4.lo generated/unpack_i8.lo \ - generated/unpack_i16.lo generated/unpack_r4.lo \ - generated/unpack_r8.lo generated/unpack_r10.lo \ - generated/unpack_r16.lo generated/unpack_r17.lo \ - generated/unpack_c4.lo generated/unpack_c8.lo \ - generated/unpack_c10.lo generated/unpack_c16.lo \ - generated/unpack_c17.lo -am__objects_33 = generated/matmulavx128_i1.lo \ - generated/matmulavx128_i2.lo generated/matmulavx128_i4.lo \ - generated/matmulavx128_i8.lo generated/matmulavx128_i16.lo \ - generated/matmulavx128_r4.lo generated/matmulavx128_r8.lo \ - generated/matmulavx128_r10.lo generated/matmulavx128_r16.lo \ - generated/matmulavx128_r17.lo generated/matmulavx128_c4.lo \ - generated/matmulavx128_c8.lo generated/matmulavx128_c10.lo \ - generated/matmulavx128_c16.lo generated/matmulavx128_c17.lo -am__objects_34 = generated/spread_i1.lo generated/spread_i2.lo \ + generated/pack_c17.lo generated/unpack_i1.lo \ + generated/unpack_i2.lo generated/unpack_i4.lo \ + generated/unpack_i8.lo generated/unpack_i16.lo \ + generated/unpack_r4.lo generated/unpack_r8.lo \ + generated/unpack_r10.lo generated/unpack_r16.lo \ + generated/unpack_r17.lo generated/unpack_c4.lo \ + generated/unpack_c8.lo generated/unpack_c10.lo \ + generated/unpack_c16.lo generated/unpack_c17.lo \ + generated/spread_i1.lo generated/spread_i2.lo \ generated/spread_i4.lo generated/spread_i8.lo \ generated/spread_i16.lo generated/spread_r4.lo \ generated/spread_r8.lo generated/spread_r10.lo \ generated/spread_r16.lo generated/spread_r17.lo \ generated/spread_c4.lo generated/spread_c8.lo \ generated/spread_c10.lo generated/spread_c16.lo \ - generated/spread_c17.lo -am__objects_35 = generated/cshift0_i1.lo generated/cshift0_i2.lo \ - generated/cshift0_i4.lo generated/cshift0_i8.lo \ - generated/cshift0_i16.lo generated/cshift0_r4.lo \ - generated/cshift0_r8.lo generated/cshift0_r10.lo \ - generated/cshift0_r16.lo generated/cshift0_r17.lo \ - generated/cshift0_c4.lo generated/cshift0_c8.lo \ - generated/cshift0_c10.lo generated/cshift0_c16.lo \ - generated/cshift0_c17.lo -am__objects_36 = generated/cshift1_4_i1.lo generated/cshift1_4_i2.lo \ + generated/spread_c17.lo generated/cshift0_i1.lo \ + generated/cshift0_i2.lo generated/cshift0_i4.lo \ + generated/cshift0_i8.lo generated/cshift0_i16.lo \ + generated/cshift0_r4.lo generated/cshift0_r8.lo \ + generated/cshift0_r10.lo generated/cshift0_r16.lo \ + generated/cshift0_r17.lo generated/cshift0_c4.lo \ + generated/cshift0_c8.lo generated/cshift0_c10.lo \ + generated/cshift0_c16.lo generated/cshift0_c17.lo \ + generated/cshift1_4_i1.lo generated/cshift1_4_i2.lo \ generated/cshift1_4_i4.lo generated/cshift1_4_i8.lo \ generated/cshift1_4_i16.lo generated/cshift1_4_r4.lo \ generated/cshift1_4_r8.lo generated/cshift1_4_r10.lo \ @@ -500,88 +485,70 @@ am__objects_36 = generated/cshift1_4_i1.lo generated/cshift1_4_i2.lo \ generated/cshift1_16_r16.lo generated/cshift1_16_r17.lo \ generated/cshift1_16_c4.lo generated/cshift1_16_c8.lo \ generated/cshift1_16_c10.lo generated/cshift1_16_c16.lo \ - generated/cshift1_16_c17.lo -am__objects_37 = generated/maxloc0_4_s1.lo generated/maxloc0_4_s4.lo \ - generated/maxloc0_8_s1.lo generated/maxloc0_8_s4.lo \ - generated/maxloc0_16_s1.lo generated/maxloc0_16_s4.lo -am__objects_38 = generated/minloc0_4_s1.lo generated/minloc0_4_s4.lo \ - generated/minloc0_8_s1.lo generated/minloc0_8_s4.lo \ - generated/minloc0_16_s1.lo generated/minloc0_16_s4.lo -am__objects_39 = generated/maxloc1_4_s1.lo generated/maxloc1_4_s4.lo \ - generated/maxloc1_8_s1.lo generated/maxloc1_8_s4.lo \ - generated/maxloc1_16_s1.lo generated/maxloc1_16_s4.lo -am__objects_40 = generated/minloc1_4_s1.lo generated/minloc1_4_s4.lo \ - generated/minloc1_8_s1.lo generated/minloc1_8_s4.lo \ - generated/minloc1_16_s1.lo generated/minloc1_16_s4.lo -am__objects_41 = generated/maxloc2_4_s1.lo generated/maxloc2_4_s4.lo \ - generated/maxloc2_8_s1.lo generated/maxloc2_8_s4.lo \ - generated/maxloc2_16_s1.lo generated/maxloc2_16_s4.lo -am__objects_42 = generated/minloc2_4_s1.lo generated/minloc2_4_s4.lo \ - generated/minloc2_8_s1.lo generated/minloc2_8_s4.lo \ - generated/minloc2_16_s1.lo generated/minloc2_16_s4.lo -am__objects_43 = generated/maxval0_s1.lo generated/maxval0_s4.lo -am__objects_44 = generated/minval0_s1.lo generated/minval0_s4.lo -am__objects_45 = generated/maxval1_s1.lo generated/maxval1_s4.lo -am__objects_46 = generated/minval1_s1.lo generated/minval1_s4.lo -am__objects_47 = generated/findloc0_i1.lo generated/findloc0_i2.lo \ - generated/findloc0_i4.lo generated/findloc0_i8.lo \ - generated/findloc0_i16.lo generated/findloc0_r4.lo \ - generated/findloc0_r8.lo generated/findloc0_r10.lo \ - generated/findloc0_r16.lo generated/findloc0_r17.lo \ - generated/findloc0_c4.lo generated/findloc0_c8.lo \ - generated/findloc0_c10.lo generated/findloc0_c16.lo \ - generated/findloc0_c17.lo -am__objects_48 = generated/findloc0_s1.lo generated/findloc0_s4.lo -am__objects_49 = generated/findloc1_i1.lo generated/findloc1_i2.lo \ + generated/cshift1_16_c17.lo generated/findloc0_i1.lo \ + generated/findloc0_i2.lo generated/findloc0_i4.lo \ + generated/findloc0_i8.lo generated/findloc0_i16.lo \ + generated/findloc0_r4.lo generated/findloc0_r8.lo \ + generated/findloc0_r10.lo generated/findloc0_r16.lo \ + generated/findloc0_r17.lo generated/findloc0_c4.lo \ + generated/findloc0_c8.lo generated/findloc0_c10.lo \ + generated/findloc0_c16.lo generated/findloc0_c17.lo \ + generated/findloc0_s1.lo generated/findloc0_s4.lo \ + generated/findloc1_i1.lo generated/findloc1_i2.lo \ generated/findloc1_i4.lo generated/findloc1_i8.lo \ generated/findloc1_i16.lo generated/findloc1_r4.lo \ generated/findloc1_r8.lo generated/findloc1_r10.lo \ generated/findloc1_r16.lo generated/findloc1_r17.lo \ generated/findloc1_c4.lo generated/findloc1_c8.lo \ generated/findloc1_c10.lo generated/findloc1_c16.lo \ - generated/findloc1_c17.lo -am__objects_50 = generated/findloc1_s1.lo generated/findloc1_s4.lo -am__objects_51 = generated/findloc2_s1.lo generated/findloc2_s4.lo -am__objects_52 = runtime/ISO_Fortran_binding.lo -am__objects_53 = generated/pow_m1_m1.lo generated/pow_m1_m2.lo \ - generated/pow_m1_m4.lo generated/pow_m1_m8.lo \ - generated/pow_m1_m16.lo generated/pow_m2_m1.lo \ - generated/pow_m2_m2.lo generated/pow_m2_m4.lo \ - generated/pow_m2_m8.lo generated/pow_m2_m16.lo \ - generated/pow_m4_m1.lo generated/pow_m4_m2.lo \ - generated/pow_m4_m4.lo generated/pow_m4_m8.lo \ - generated/pow_m4_m16.lo generated/pow_m8_m1.lo \ - generated/pow_m8_m2.lo generated/pow_m8_m4.lo \ - generated/pow_m8_m8.lo generated/pow_m8_m16.lo \ - generated/pow_m16_m1.lo generated/pow_m16_m2.lo \ - generated/pow_m16_m4.lo generated/pow_m16_m8.lo \ - generated/pow_m16_m16.lo -am__objects_54 = $(am__objects_4) $(am__objects_5) $(am__objects_6) \ - $(am__objects_7) $(am__objects_8) $(am__objects_9) \ - $(am__objects_10) $(am__objects_11) $(am__objects_12) \ - $(am__objects_13) $(am__objects_14) $(am__objects_15) \ - $(am__objects_16) $(am__objects_17) $(am__objects_18) \ - $(am__objects_19) $(am__objects_20) $(am__objects_21) \ - $(am__objects_22) $(am__objects_23) $(am__objects_24) \ - $(am__objects_25) $(am__objects_26) $(am__objects_27) \ - $(am__objects_28) $(am__objects_29) $(am__objects_30) \ - $(am__objects_31) $(am__objects_32) $(am__objects_33) \ - $(am__objects_34) $(am__objects_35) $(am__objects_36) \ - $(am__objects_37) $(am__objects_38) $(am__objects_39) \ - $(am__objects_40) $(am__objects_41) $(am__objects_42) \ - $(am__objects_43) $(am__objects_44) $(am__objects_45) \ - $(am__objects_46) $(am__objects_47) $(am__objects_48) \ - $(am__objects_49) $(am__objects_50) $(am__objects_51) \ - $(am__objects_52) $(am__objects_53) -@LIBGFOR_MINIMAL_FALSE@am__objects_55 = io/close.lo io/file_pos.lo \ + generated/findloc1_c17.lo generated/findloc1_s1.lo \ + generated/findloc1_s4.lo generated/findloc2_s1.lo \ + generated/findloc2_s4.lo generated/maxloc0_4_s1.lo \ + generated/maxloc0_4_s4.lo generated/maxloc0_8_s1.lo \ + generated/maxloc0_8_s4.lo generated/maxloc0_16_s1.lo \ + generated/maxloc0_16_s4.lo generated/maxloc1_4_s1.lo \ + generated/maxloc1_4_s4.lo generated/maxloc1_8_s1.lo \ + generated/maxloc1_8_s4.lo generated/maxloc1_16_s1.lo \ + generated/maxloc1_16_s4.lo generated/maxloc2_4_s1.lo \ + generated/maxloc2_4_s4.lo generated/maxloc2_8_s1.lo \ + generated/maxloc2_8_s4.lo generated/maxloc2_16_s1.lo \ + generated/maxloc2_16_s4.lo generated/maxval0_s1.lo \ + generated/maxval0_s4.lo generated/maxval1_s1.lo \ + generated/maxval1_s4.lo generated/minloc0_4_s1.lo \ + generated/minloc0_4_s4.lo generated/minloc0_8_s1.lo \ + generated/minloc0_8_s4.lo generated/minloc0_16_s1.lo \ + generated/minloc0_16_s4.lo generated/minloc1_4_s1.lo \ + generated/minloc1_4_s4.lo generated/minloc1_8_s1.lo \ + generated/minloc1_8_s4.lo generated/minloc1_16_s1.lo \ + generated/minloc1_16_s4.lo generated/minloc2_4_s1.lo \ + generated/minloc2_4_s4.lo generated/minloc2_8_s1.lo \ + generated/minloc2_8_s4.lo generated/minloc2_16_s1.lo \ + generated/minloc2_16_s4.lo generated/minval0_s1.lo \ + generated/minval0_s4.lo generated/minval1_s1.lo \ + generated/minval1_s4.lo generated/pow_m1_m1.lo \ + generated/pow_m1_m2.lo generated/pow_m1_m4.lo \ + generated/pow_m1_m8.lo generated/pow_m1_m16.lo \ + generated/pow_m2_m1.lo generated/pow_m2_m2.lo \ + generated/pow_m2_m4.lo generated/pow_m2_m8.lo \ + generated/pow_m2_m16.lo generated/pow_m4_m1.lo \ + generated/pow_m4_m2.lo generated/pow_m4_m4.lo \ + generated/pow_m4_m8.lo generated/pow_m4_m16.lo \ + generated/pow_m8_m1.lo generated/pow_m8_m2.lo \ + generated/pow_m8_m4.lo generated/pow_m8_m8.lo \ + generated/pow_m8_m16.lo generated/pow_m16_m1.lo \ + generated/pow_m16_m2.lo generated/pow_m16_m4.lo \ + generated/pow_m16_m8.lo generated/pow_m16_m16.lo \ + $(am__objects_4) $(am__objects_5) $(am__objects_6) \ + runtime/ISO_Fortran_binding.lo +@LIBGFOR_MINIMAL_FALSE@am__objects_8 = io/close.lo io/file_pos.lo \ @LIBGFOR_MINIMAL_FALSE@ io/format.lo io/inquire.lo \ @LIBGFOR_MINIMAL_FALSE@ io/intrinsics.lo io/list_read.lo \ @LIBGFOR_MINIMAL_FALSE@ io/lock.lo io/open.lo io/read.lo \ @LIBGFOR_MINIMAL_FALSE@ io/transfer.lo io/transfer128.lo \ @LIBGFOR_MINIMAL_FALSE@ io/unit.lo io/unix.lo io/write.lo \ @LIBGFOR_MINIMAL_FALSE@ io/fbuf.lo io/async.lo -am__objects_56 = io/size_from_kind.lo $(am__objects_55) -@LIBGFOR_MINIMAL_FALSE@am__objects_57 = intrinsics/access.lo \ +am__objects_9 = io/size_from_kind.lo $(am__objects_8) +@LIBGFOR_MINIMAL_FALSE@am__objects_10 = intrinsics/access.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/c99_functions.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/chdir.lo intrinsics/chmod.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/clock.lo \ @@ -605,8 +572,8 @@ am__objects_56 = io/size_from_kind.lo $(am__objects_55) @LIBGFOR_MINIMAL_FALSE@ intrinsics/system_clock.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/time.lo intrinsics/umask.lo \ @LIBGFOR_MINIMAL_FALSE@ intrinsics/unlink.lo -@IEEE_SUPPORT_TRUE@am__objects_58 = ieee/ieee_helper.lo -am__objects_59 = intrinsics/associated.lo intrinsics/abort.lo \ +@IEEE_SUPPORT_TRUE@am__objects_11 = ieee/ieee_helper.lo +am__objects_12 = intrinsics/associated.lo intrinsics/abort.lo \ intrinsics/args.lo intrinsics/cshift0.lo \ intrinsics/eoshift0.lo intrinsics/eoshift2.lo \ intrinsics/erfc_scaled.lo intrinsics/extends_type_of.lo \ @@ -621,12 +588,12 @@ am__objects_59 = intrinsics/associated.lo intrinsics/abort.lo \ intrinsics/selected_real_kind.lo intrinsics/trigd.lo \ intrinsics/unpack_generic.lo runtime/in_pack_generic.lo \ runtime/in_unpack_generic.lo runtime/in_pack_class.lo \ - runtime/in_unpack_class.lo $(am__objects_57) $(am__objects_58) -@IEEE_SUPPORT_TRUE@am__objects_60 = ieee/ieee_arithmetic.lo \ + runtime/in_unpack_class.lo $(am__objects_10) $(am__objects_11) +@IEEE_SUPPORT_TRUE@am__objects_13 = ieee/ieee_arithmetic.lo \ @IEEE_SUPPORT_TRUE@ ieee/ieee_exceptions.lo \ @IEEE_SUPPORT_TRUE@ ieee/ieee_features.lo -am__objects_61 = -am__objects_62 = generated/_abs_c4.lo generated/_abs_c8.lo \ +am__objects_14 = +am__objects_15 = generated/_abs_c4.lo generated/_abs_c8.lo \ generated/_abs_c10.lo generated/_abs_c16.lo \ generated/_abs_c17.lo generated/_abs_i4.lo \ generated/_abs_i8.lo generated/_abs_i16.lo \ @@ -694,8 +661,8 @@ am__objects_62 = generated/_abs_c4.lo generated/_abs_c8.lo \ generated/_aint_r10.lo generated/_aint_r16.lo \ generated/_aint_r17.lo generated/_anint_r4.lo \ generated/_anint_r8.lo generated/_anint_r10.lo \ - generated/_anint_r16.lo generated/_anint_r17.lo -am__objects_63 = generated/_sign_i4.lo generated/_sign_i8.lo \ + generated/_anint_r16.lo generated/_anint_r17.lo \ + generated/_sign_i4.lo generated/_sign_i8.lo \ generated/_sign_i16.lo generated/_sign_r4.lo \ generated/_sign_r8.lo generated/_sign_r10.lo \ generated/_sign_r16.lo generated/_sign_r17.lo \ @@ -709,14 +676,12 @@ am__objects_63 = generated/_sign_i4.lo generated/_sign_i8.lo \ generated/_mod_i8.lo generated/_mod_i16.lo \ generated/_mod_r4.lo generated/_mod_r8.lo \ generated/_mod_r10.lo generated/_mod_r16.lo \ - generated/_mod_r17.lo -am__objects_64 = generated/misc_specifics.lo -am__objects_65 = $(am__objects_62) $(am__objects_63) $(am__objects_64) \ + generated/_mod_r17.lo generated/misc_specifics.lo \ intrinsics/dprod_r8.lo intrinsics/f2c_specifics.lo \ intrinsics/random_init.lo -am_libgfortran_la_OBJECTS = $(am__objects_3) $(am__objects_54) \ - $(am__objects_56) $(am__objects_59) $(am__objects_60) \ - $(am__objects_61) $(am__objects_65) +am_libgfortran_la_OBJECTS = $(am__objects_3) $(am__objects_7) \ + $(am__objects_9) $(am__objects_12) $(am__objects_13) \ + $(am__objects_14) $(am__objects_15) libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -1048,102 +1013,61 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \ gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \ runtime/string.c runtime/select.c $(am__append_6) \ $(am__append_7) -i_all_c = \ +i_matmul_c = \ +generated/matmul_i1.c \ +generated/matmul_i2.c \ +generated/matmul_i4.c \ +generated/matmul_i8.c \ +generated/matmul_i16.c \ +generated/matmul_r4.c \ +generated/matmul_r8.c \ +generated/matmul_r10.c \ +generated/matmul_r16.c \ +generated/matmul_r17.c \ +generated/matmul_c4.c \ +generated/matmul_c8.c \ +generated/matmul_c10.c \ +generated/matmul_c16.c \ +generated/matmul_c17.c + +i_matmulavx128_c = \ +generated/matmulavx128_i1.c \ +generated/matmulavx128_i2.c \ +generated/matmulavx128_i4.c \ +generated/matmulavx128_i8.c \ +generated/matmulavx128_i16.c \ +generated/matmulavx128_r4.c \ +generated/matmulavx128_r8.c \ +generated/matmulavx128_r10.c \ +generated/matmulavx128_r16.c \ +generated/matmulavx128_r17.c \ +generated/matmulavx128_c4.c \ +generated/matmulavx128_c8.c \ +generated/matmulavx128_c10.c \ +generated/matmulavx128_c16.c \ +generated/matmulavx128_c17.c + +i_matmull_c = \ +generated/matmul_l4.c \ +generated/matmul_l8.c \ +generated/matmul_l16.c + +gfor_built_src = \ generated/all_l1.c \ generated/all_l2.c \ generated/all_l4.c \ generated/all_l8.c \ -generated/all_l16.c - -i_any_c = \ +generated/all_l16.c \ generated/any_l1.c \ generated/any_l2.c \ generated/any_l4.c \ generated/any_l8.c \ -generated/any_l16.c - -i_bessel_c = \ -generated/bessel_r4.c \ -generated/bessel_r8.c \ -generated/bessel_r10.c \ -generated/bessel_r16.c \ -generated/bessel_r17.c - -i_count_c = \ +generated/any_l16.c \ generated/count_1_l.c \ generated/count_2_l.c \ generated/count_4_l.c \ generated/count_8_l.c \ -generated/count_16_l.c - -i_iall_c = \ -generated/iall_i1.c \ -generated/iall_i2.c \ -generated/iall_i4.c \ -generated/iall_i8.c \ -generated/iall_i16.c - -i_iany_c = \ -generated/iany_i1.c \ -generated/iany_i2.c \ -generated/iany_i4.c \ -generated/iany_i8.c \ -generated/iany_i16.c - -i_iparity_c = \ -generated/iparity_i1.c \ -generated/iparity_i2.c \ -generated/iparity_i4.c \ -generated/iparity_i8.c \ -generated/iparity_i16.c - -i_findloc0_c = \ -generated/findloc0_i1.c \ -generated/findloc0_i2.c \ -generated/findloc0_i4.c \ -generated/findloc0_i8.c \ -generated/findloc0_i16.c \ -generated/findloc0_r4.c \ -generated/findloc0_r8.c \ -generated/findloc0_r10.c \ -generated/findloc0_r16.c \ -generated/findloc0_r17.c \ -generated/findloc0_c4.c \ -generated/findloc0_c8.c \ -generated/findloc0_c10.c \ -generated/findloc0_c16.c \ -generated/findloc0_c17.c - -i_findloc0s_c = \ -generated/findloc0_s1.c \ -generated/findloc0_s4.c - -i_findloc1_c = \ -generated/findloc1_i1.c \ -generated/findloc1_i2.c \ -generated/findloc1_i4.c \ -generated/findloc1_i8.c \ -generated/findloc1_i16.c \ -generated/findloc1_r4.c \ -generated/findloc1_r8.c \ -generated/findloc1_r10.c \ -generated/findloc1_r16.c \ -generated/findloc1_r17.c \ -generated/findloc1_c4.c \ -generated/findloc1_c8.c \ -generated/findloc1_c10.c \ -generated/findloc1_c16.c \ -generated/findloc1_c17.c - -i_findloc1s_c = \ -generated/findloc1_s1.c \ -generated/findloc1_s4.c - -i_findloc2s_c = \ -generated/findloc2_s1.c \ -generated/findloc2_s4.c - -i_maxloc0_c = \ +generated/count_16_l.c \ generated/maxloc0_4_i1.c \ generated/maxloc0_8_i1.c \ generated/maxloc0_16_i1.c \ @@ -1188,17 +1112,7 @@ generated/maxloc0_8_r16.c \ generated/maxloc0_16_r16.c \ generated/maxloc0_4_r17.c \ generated/maxloc0_8_r17.c \ -generated/maxloc0_16_r17.c - -i_maxloc0s_c = \ -generated/maxloc0_4_s1.c \ -generated/maxloc0_4_s4.c \ -generated/maxloc0_8_s1.c \ -generated/maxloc0_8_s4.c \ -generated/maxloc0_16_s1.c \ -generated/maxloc0_16_s4.c - -i_maxloc1_c = \ +generated/maxloc0_16_r17.c \ generated/maxloc1_4_i1.c \ generated/maxloc1_8_i1.c \ generated/maxloc1_16_i1.c \ @@ -1243,25 +1157,7 @@ generated/maxloc1_8_r16.c \ generated/maxloc1_16_r16.c \ generated/maxloc1_4_r17.c \ generated/maxloc1_8_r17.c \ -generated/maxloc1_16_r17.c - -i_maxloc1s_c = \ -generated/maxloc1_4_s1.c \ -generated/maxloc1_4_s4.c \ -generated/maxloc1_8_s1.c \ -generated/maxloc1_8_s4.c \ -generated/maxloc1_16_s1.c \ -generated/maxloc1_16_s4.c - -i_maxloc2s_c = \ -generated/maxloc2_4_s1.c \ -generated/maxloc2_4_s4.c \ -generated/maxloc2_8_s1.c \ -generated/maxloc2_8_s4.c \ -generated/maxloc2_16_s1.c \ -generated/maxloc2_16_s4.c - -i_maxval_c = \ +generated/maxloc1_16_r17.c \ generated/maxval_i1.c \ generated/maxval_i2.c \ generated/maxval_i4.c \ @@ -1276,17 +1172,7 @@ generated/maxval_r4.c \ generated/maxval_r8.c \ generated/maxval_r10.c \ generated/maxval_r16.c \ -generated/maxval_r17.c - -i_maxval0s_c = \ -generated/maxval0_s1.c \ -generated/maxval0_s4.c - -i_maxval1s_c = \ -generated/maxval1_s1.c \ -generated/maxval1_s4.c - -i_minloc0_c = \ +generated/maxval_r17.c \ generated/minloc0_4_i1.c \ generated/minloc0_8_i1.c \ generated/minloc0_16_i1.c \ @@ -1331,17 +1217,7 @@ generated/minloc0_8_r16.c \ generated/minloc0_16_r16.c \ generated/minloc0_4_r17.c \ generated/minloc0_8_r17.c \ -generated/minloc0_16_r17.c - -i_minloc0s_c = \ -generated/minloc0_4_s1.c \ -generated/minloc0_4_s4.c \ -generated/minloc0_8_s1.c \ -generated/minloc0_8_s4.c \ -generated/minloc0_16_s1.c \ -generated/minloc0_16_s4.c - -i_minloc1_c = \ +generated/minloc0_16_r17.c \ generated/minloc1_4_i1.c \ generated/minloc1_8_i1.c \ generated/minloc1_16_i1.c \ @@ -1386,25 +1262,7 @@ generated/minloc1_8_r16.c \ generated/minloc1_16_r16.c \ generated/minloc1_4_r17.c \ generated/minloc1_8_r17.c \ -generated/minloc1_16_r17.c - -i_minloc1s_c = \ -generated/minloc1_4_s1.c \ -generated/minloc1_4_s4.c \ -generated/minloc1_8_s1.c \ -generated/minloc1_8_s4.c \ -generated/minloc1_16_s1.c \ -generated/minloc1_16_s4.c - -i_minloc2s_c = \ -generated/minloc2_4_s1.c \ -generated/minloc2_4_s4.c \ -generated/minloc2_8_s1.c \ -generated/minloc2_8_s4.c \ -generated/minloc2_16_s1.c \ -generated/minloc2_16_s4.c - -i_minval_c = \ +generated/minloc1_16_r17.c \ generated/minval_i1.c \ generated/minval_i2.c \ generated/minval_i4.c \ @@ -1419,48 +1277,7 @@ generated/minval_r4.c \ generated/minval_r8.c \ generated/minval_r10.c \ generated/minval_r16.c \ -generated/minval_r17.c - -i_minval0s_c = \ -generated/minval0_s1.c \ -generated/minval0_s4.c - -i_minval1s_c = \ -generated/minval1_s1.c \ -generated/minval1_s4.c - -i_norm2_c = \ -generated/norm2_r4.c \ -generated/norm2_r8.c \ -generated/norm2_r10.c \ -generated/norm2_r16.c \ -generated/norm2_r17.c - -i_parity_c = \ -generated/parity_l1.c \ -generated/parity_l2.c \ -generated/parity_l4.c \ -generated/parity_l8.c \ -generated/parity_l16.c - -i_sum_c = \ -generated/sum_i1.c \ -generated/sum_i2.c \ -generated/sum_i4.c \ -generated/sum_i8.c \ -generated/sum_i16.c \ -generated/sum_r4.c \ -generated/sum_r8.c \ -generated/sum_r10.c \ -generated/sum_r16.c \ -generated/sum_r17.c \ -generated/sum_c4.c \ -generated/sum_c8.c \ -generated/sum_c10.c \ -generated/sum_c16.c \ -generated/sum_c17.c - -i_product_c = \ +generated/minval_r17.c \ generated/product_i1.c \ generated/product_i2.c \ generated/product_i4.c \ @@ -1475,55 +1292,66 @@ generated/product_c4.c \ generated/product_c8.c \ generated/product_c10.c \ generated/product_c16.c \ -generated/product_c17.c - -i_matmul_c = \ -generated/matmul_i1.c \ -generated/matmul_i2.c \ -generated/matmul_i4.c \ -generated/matmul_i8.c \ -generated/matmul_i16.c \ -generated/matmul_r4.c \ -generated/matmul_r8.c \ -generated/matmul_r10.c \ -generated/matmul_r16.c \ -generated/matmul_r17.c \ -generated/matmul_c4.c \ -generated/matmul_c8.c \ -generated/matmul_c10.c \ -generated/matmul_c16.c \ -generated/matmul_c17.c - -i_matmulavx128_c = \ -generated/matmulavx128_i1.c \ -generated/matmulavx128_i2.c \ -generated/matmulavx128_i4.c \ -generated/matmulavx128_i8.c \ -generated/matmulavx128_i16.c \ -generated/matmulavx128_r4.c \ -generated/matmulavx128_r8.c \ -generated/matmulavx128_r10.c \ -generated/matmulavx128_r16.c \ -generated/matmulavx128_r17.c \ -generated/matmulavx128_c4.c \ -generated/matmulavx128_c8.c \ -generated/matmulavx128_c10.c \ -generated/matmulavx128_c16.c \ -generated/matmulavx128_c17.c - -i_matmull_c = \ -generated/matmul_l4.c \ -generated/matmul_l8.c \ -generated/matmul_l16.c - -i_shape_c = \ +generated/product_c17.c \ +generated/sum_i1.c \ +generated/sum_i2.c \ +generated/sum_i4.c \ +generated/sum_i8.c \ +generated/sum_i16.c \ +generated/sum_r4.c \ +generated/sum_r8.c \ +generated/sum_r10.c \ +generated/sum_r16.c \ +generated/sum_r17.c \ +generated/sum_c4.c \ +generated/sum_c8.c \ +generated/sum_c10.c \ +generated/sum_c16.c \ +generated/sum_c17.c \ +generated/bessel_r4.c \ +generated/bessel_r8.c \ +generated/bessel_r10.c \ +generated/bessel_r16.c \ +generated/bessel_r17.c \ +generated/iall_i1.c \ +generated/iall_i2.c \ +generated/iall_i4.c \ +generated/iall_i8.c \ +generated/iall_i16.c \ +generated/iany_i1.c \ +generated/iany_i2.c \ +generated/iany_i4.c \ +generated/iany_i8.c \ +generated/iany_i16.c \ +generated/iparity_i1.c \ +generated/iparity_i2.c \ +generated/iparity_i4.c \ +generated/iparity_i8.c \ +generated/iparity_i16.c \ +generated/norm2_r4.c \ +generated/norm2_r8.c \ +generated/norm2_r10.c \ +generated/norm2_r16.c \ +generated/norm2_r17.c \ +generated/parity_l1.c \ +generated/parity_l2.c \ +generated/parity_l4.c \ +generated/parity_l8.c \ +generated/parity_l16.c \ generated/shape_i1.c \ generated/shape_i2.c \ generated/shape_i4.c \ generated/shape_i8.c \ -generated/shape_i16.c - -i_reshape_c = \ +generated/shape_i16.c \ +generated/eoshift1_4.c \ +generated/eoshift1_8.c \ +generated/eoshift1_16.c \ +generated/eoshift3_4.c \ +generated/eoshift3_8.c \ +generated/eoshift3_16.c \ +generated/cshift1_4.c \ +generated/cshift1_8.c \ +generated/cshift1_16.c \ generated/reshape_i4.c \ generated/reshape_i8.c \ generated/reshape_i16.c \ @@ -1536,88 +1364,7 @@ generated/reshape_c4.c \ generated/reshape_c8.c \ generated/reshape_c10.c \ generated/reshape_c16.c \ -generated/reshape_c17.c - -i_eoshift1_c = \ -generated/eoshift1_4.c \ -generated/eoshift1_8.c \ -generated/eoshift1_16.c - -i_eoshift3_c = \ -generated/eoshift3_4.c \ -generated/eoshift3_8.c \ -generated/eoshift3_16.c - -i_cshift0_c = \ -generated/cshift0_i1.c \ -generated/cshift0_i2.c \ -generated/cshift0_i4.c \ -generated/cshift0_i8.c \ -generated/cshift0_i16.c \ -generated/cshift0_r4.c \ -generated/cshift0_r8.c \ -generated/cshift0_r10.c \ -generated/cshift0_r16.c \ -generated/cshift0_r17.c \ -generated/cshift0_c4.c \ -generated/cshift0_c8.c \ -generated/cshift0_c10.c \ -generated/cshift0_c16.c \ -generated/cshift0_c17.c - -i_cshift1_c = \ -generated/cshift1_4.c \ -generated/cshift1_8.c \ -generated/cshift1_16.c - -i_cshift1a_c = \ -generated/cshift1_4_i1.c \ -generated/cshift1_4_i2.c \ -generated/cshift1_4_i4.c \ -generated/cshift1_4_i8.c \ -generated/cshift1_4_i16.c \ -generated/cshift1_4_r4.c \ -generated/cshift1_4_r8.c \ -generated/cshift1_4_r10.c \ -generated/cshift1_4_r16.c \ -generated/cshift1_4_r17.c \ -generated/cshift1_4_c4.c \ -generated/cshift1_4_c8.c \ -generated/cshift1_4_c10.c \ -generated/cshift1_4_c16.c \ -generated/cshift1_4_c17.c \ -generated/cshift1_8_i1.c \ -generated/cshift1_8_i2.c \ -generated/cshift1_8_i4.c \ -generated/cshift1_8_i8.c \ -generated/cshift1_8_i16.c \ -generated/cshift1_8_r4.c \ -generated/cshift1_8_r8.c \ -generated/cshift1_8_r10.c \ -generated/cshift1_8_r16.c \ -generated/cshift1_8_r17.c \ -generated/cshift1_8_c4.c \ -generated/cshift1_8_c8.c \ -generated/cshift1_8_c10.c \ -generated/cshift1_8_c16.c \ -generated/cshift1_8_c17.c \ -generated/cshift1_16_i1.c \ -generated/cshift1_16_i2.c \ -generated/cshift1_16_i4.c \ -generated/cshift1_16_i8.c \ -generated/cshift1_16_i16.c \ -generated/cshift1_16_r4.c \ -generated/cshift1_16_r8.c \ -generated/cshift1_16_r10.c \ -generated/cshift1_16_r16.c \ -generated/cshift1_16_r17.c \ -generated/cshift1_16_c4.c \ -generated/cshift1_16_c8.c \ -generated/cshift1_16_c10.c \ -generated/cshift1_16_c16.c \ -generated/cshift1_16_c17.c - -in_pack_c = \ +generated/reshape_c17.c \ generated/in_pack_i1.c \ generated/in_pack_i2.c \ generated/in_pack_i4.c \ @@ -1632,9 +1379,7 @@ generated/in_pack_c4.c \ generated/in_pack_c8.c \ generated/in_pack_c10.c \ generated/in_pack_c16.c \ -generated/in_pack_c17.c - -in_unpack_c = \ +generated/in_pack_c17.c \ generated/in_unpack_i1.c \ generated/in_unpack_i2.c \ generated/in_unpack_i4.c \ @@ -1649,9 +1394,7 @@ generated/in_unpack_c4.c \ generated/in_unpack_c8.c \ generated/in_unpack_c10.c \ generated/in_unpack_c16.c \ -generated/in_unpack_c17.c - -i_pow_c = \ +generated/in_unpack_c17.c \ generated/pow_i4_i4.c \ generated/pow_i8_i4.c \ generated/pow_i16_i4.c \ @@ -1687,36 +1430,7 @@ generated/pow_c4_i16.c \ generated/pow_c8_i16.c \ generated/pow_c10_i16.c \ generated/pow_c16_i16.c \ -generated/pow_c17_i16.c - -i_powu_c = \ -generated/pow_m1_m1.c \ -generated/pow_m1_m2.c \ -generated/pow_m1_m4.c \ -generated/pow_m1_m8.c \ -generated/pow_m1_m16.c \ -generated/pow_m2_m1.c \ -generated/pow_m2_m2.c \ -generated/pow_m2_m4.c \ -generated/pow_m2_m8.c \ -generated/pow_m2_m16.c \ -generated/pow_m4_m1.c \ -generated/pow_m4_m2.c \ -generated/pow_m4_m4.c \ -generated/pow_m4_m8.c \ -generated/pow_m4_m16.c \ -generated/pow_m8_m1.c \ -generated/pow_m8_m2.c \ -generated/pow_m8_m4.c \ -generated/pow_m8_m8.c \ -generated/pow_m8_m16.c \ -generated/pow_m16_m1.c \ -generated/pow_m16_m2.c \ -generated/pow_m16_m4.c \ -generated/pow_m16_m8.c \ -generated/pow_m16_m16.c - -i_pack_c = \ +generated/pow_c17_i16.c \ generated/pack_i1.c \ generated/pack_i2.c \ generated/pack_i4.c \ @@ -1731,9 +1445,7 @@ generated/pack_c4.c \ generated/pack_c8.c \ generated/pack_c10.c \ generated/pack_c16.c \ -generated/pack_c17.c - -i_unpack_c = \ +generated/pack_c17.c \ generated/unpack_i1.c \ generated/unpack_i2.c \ generated/unpack_i4.c \ @@ -1748,9 +1460,7 @@ generated/unpack_c4.c \ generated/unpack_c8.c \ generated/unpack_c10.c \ generated/unpack_c16.c \ -generated/unpack_c17.c - -i_spread_c = \ +generated/unpack_c17.c \ generated/spread_i1.c \ generated/spread_i2.c \ generated/spread_i4.c \ @@ -1765,44 +1475,180 @@ generated/spread_c4.c \ generated/spread_c8.c \ generated/spread_c10.c \ generated/spread_c16.c \ -generated/spread_c17.c - -i_isobinding_c = \ -runtime/ISO_Fortran_binding.c - -m4_files = m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \ - m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval.m4 \ - m4/minloc0.m4 m4/minloc1.m4 m4/minval.m4 m4/product.m4 m4/sum.m4 \ - m4/matmul.m4 m4/matmull.m4 m4/ifunction_logical.m4 \ - m4/ctrig.m4 m4/cexp.m4 m4/chyp.m4 m4/mtype.m4 \ - m4/specific.m4 m4/specific2.m4 m4/head.m4 m4/shape.m4 m4/reshape.m4 \ - m4/eoshift1.m4 m4/eoshift3.m4 \ - m4/pow.m4 \ - m4/misc_specifics.m4 m4/pack.m4 \ - m4/unpack.m4 m4/spread.m4 m4/bessel.m4 m4/norm2.m4 m4/parity.m4 \ - m4/iall.m4 m4/iany.m4 m4/iparity.m4 m4/iforeach-s.m4 m4/findloc0.m4 \ - m4/findloc0s.m4 m4/ifindloc0.m4 m4/findloc1.m4 m4/ifindloc1.m4 \ - m4/findloc2s.m4 m4/ifindloc2.m4 - -gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ - $(i_maxloc1_c) $(i_maxval_c) $(i_minloc0_c) $(i_minloc1_c) $(i_minval_c) \ - $(i_product_c) $(i_sum_c) $(i_bessel_c) $(i_iall_c) $(i_iany_c) \ - $(i_iparity_c) $(i_norm2_c) $(i_parity_c) \ - $(i_matmul_c) $(i_matmull_c) $(i_shape_c) $(i_eoshift1_c) \ - $(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \ - $(i_pow_c) $(i_pack_c) $(i_unpack_c) $(i_matmulavx128_c) \ - $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \ - $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \ - include/ISO_Fortran_binding.h \ - $(i_cshift1a_c) $(i_maxloc0s_c) $(i_minloc0s_c) $(i_maxloc1s_c) \ - $(i_minloc1s_c) $(i_maxloc2s_c) $(i_minloc2s_c) $(i_maxvals_c) \ - $(i_maxval0s_c) $(i_minval0s_c) $(i_maxval1s_c) $(i_minval1s_c) \ - $(i_findloc0_c) $(i_findloc0s_c) $(i_findloc1_c) $(i_findloc1s_c) \ - $(i_findloc2s_c) $(i_isobinding_c) $(i_powu_c) - - -# Machine generated specifics -gfor_built_specific_src = \ +generated/spread_c17.c \ +generated/cshift0_i1.c \ +generated/cshift0_i2.c \ +generated/cshift0_i4.c \ +generated/cshift0_i8.c \ +generated/cshift0_i16.c \ +generated/cshift0_r4.c \ +generated/cshift0_r8.c \ +generated/cshift0_r10.c \ +generated/cshift0_r16.c \ +generated/cshift0_r17.c \ +generated/cshift0_c4.c \ +generated/cshift0_c8.c \ +generated/cshift0_c10.c \ +generated/cshift0_c16.c \ +generated/cshift0_c17.c \ +generated/cshift1_4_i1.c \ +generated/cshift1_4_i2.c \ +generated/cshift1_4_i4.c \ +generated/cshift1_4_i8.c \ +generated/cshift1_4_i16.c \ +generated/cshift1_4_r4.c \ +generated/cshift1_4_r8.c \ +generated/cshift1_4_r10.c \ +generated/cshift1_4_r16.c \ +generated/cshift1_4_r17.c \ +generated/cshift1_4_c4.c \ +generated/cshift1_4_c8.c \ +generated/cshift1_4_c10.c \ +generated/cshift1_4_c16.c \ +generated/cshift1_4_c17.c \ +generated/cshift1_8_i1.c \ +generated/cshift1_8_i2.c \ +generated/cshift1_8_i4.c \ +generated/cshift1_8_i8.c \ +generated/cshift1_8_i16.c \ +generated/cshift1_8_r4.c \ +generated/cshift1_8_r8.c \ +generated/cshift1_8_r10.c \ +generated/cshift1_8_r16.c \ +generated/cshift1_8_r17.c \ +generated/cshift1_8_c4.c \ +generated/cshift1_8_c8.c \ +generated/cshift1_8_c10.c \ +generated/cshift1_8_c16.c \ +generated/cshift1_8_c17.c \ +generated/cshift1_16_i1.c \ +generated/cshift1_16_i2.c \ +generated/cshift1_16_i4.c \ +generated/cshift1_16_i8.c \ +generated/cshift1_16_i16.c \ +generated/cshift1_16_r4.c \ +generated/cshift1_16_r8.c \ +generated/cshift1_16_r10.c \ +generated/cshift1_16_r16.c \ +generated/cshift1_16_r17.c \ +generated/cshift1_16_c4.c \ +generated/cshift1_16_c8.c \ +generated/cshift1_16_c10.c \ +generated/cshift1_16_c16.c \ +generated/cshift1_16_c17.c \ +generated/findloc0_i1.c \ +generated/findloc0_i2.c \ +generated/findloc0_i4.c \ +generated/findloc0_i8.c \ +generated/findloc0_i16.c \ +generated/findloc0_r4.c \ +generated/findloc0_r8.c \ +generated/findloc0_r10.c \ +generated/findloc0_r16.c \ +generated/findloc0_r17.c \ +generated/findloc0_c4.c \ +generated/findloc0_c8.c \ +generated/findloc0_c10.c \ +generated/findloc0_c16.c \ +generated/findloc0_c17.c \ +generated/findloc0_s1.c \ +generated/findloc0_s4.c \ +generated/findloc1_i1.c \ +generated/findloc1_i2.c \ +generated/findloc1_i4.c \ +generated/findloc1_i8.c \ +generated/findloc1_i16.c \ +generated/findloc1_r4.c \ +generated/findloc1_r8.c \ +generated/findloc1_r10.c \ +generated/findloc1_r16.c \ +generated/findloc1_r17.c \ +generated/findloc1_c4.c \ +generated/findloc1_c8.c \ +generated/findloc1_c10.c \ +generated/findloc1_c16.c \ +generated/findloc1_c17.c \ +generated/findloc1_s1.c \ +generated/findloc1_s4.c \ +generated/findloc2_s1.c \ +generated/findloc2_s4.c \ +generated/maxloc0_4_s1.c \ +generated/maxloc0_4_s4.c \ +generated/maxloc0_8_s1.c \ +generated/maxloc0_8_s4.c \ +generated/maxloc0_16_s1.c \ +generated/maxloc0_16_s4.c \ +generated/maxloc1_4_s1.c \ +generated/maxloc1_4_s4.c \ +generated/maxloc1_8_s1.c \ +generated/maxloc1_8_s4.c \ +generated/maxloc1_16_s1.c \ +generated/maxloc1_16_s4.c \ +generated/maxloc2_4_s1.c \ +generated/maxloc2_4_s4.c \ +generated/maxloc2_8_s1.c \ +generated/maxloc2_8_s4.c \ +generated/maxloc2_16_s1.c \ +generated/maxloc2_16_s4.c \ +generated/maxval0_s1.c \ +generated/maxval0_s4.c \ +generated/maxval1_s1.c \ +generated/maxval1_s4.c \ +generated/minloc0_4_s1.c \ +generated/minloc0_4_s4.c \ +generated/minloc0_8_s1.c \ +generated/minloc0_8_s4.c \ +generated/minloc0_16_s1.c \ +generated/minloc0_16_s4.c \ +generated/minloc1_4_s1.c \ +generated/minloc1_4_s4.c \ +generated/minloc1_8_s1.c \ +generated/minloc1_8_s4.c \ +generated/minloc1_16_s1.c \ +generated/minloc1_16_s4.c \ +generated/minloc2_4_s1.c \ +generated/minloc2_4_s4.c \ +generated/minloc2_8_s1.c \ +generated/minloc2_8_s4.c \ +generated/minloc2_16_s1.c \ +generated/minloc2_16_s4.c \ +generated/minval0_s1.c \ +generated/minval0_s4.c \ +generated/minval1_s1.c \ +generated/minval1_s4.c \ +generated/pow_m1_m1.c \ +generated/pow_m1_m2.c \ +generated/pow_m1_m4.c \ +generated/pow_m1_m8.c \ +generated/pow_m1_m16.c \ +generated/pow_m2_m1.c \ +generated/pow_m2_m2.c \ +generated/pow_m2_m4.c \ +generated/pow_m2_m8.c \ +generated/pow_m2_m16.c \ +generated/pow_m4_m1.c \ +generated/pow_m4_m2.c \ +generated/pow_m4_m4.c \ +generated/pow_m4_m8.c \ +generated/pow_m4_m16.c \ +generated/pow_m8_m1.c \ +generated/pow_m8_m2.c \ +generated/pow_m8_m4.c \ +generated/pow_m8_m8.c \ +generated/pow_m8_m16.c \ +generated/pow_m16_m1.c \ +generated/pow_m16_m2.c \ +generated/pow_m16_m4.c \ +generated/pow_m16_m8.c \ +generated/pow_m16_m16.c \ +$(i_matmul_c) $(i_matmull_c) $(i_matmulavx128_c) \ +selected_int_kind.inc selected_real_kind.inc kinds.h \ +kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \ +include/ISO_Fortran_binding.h runtime/ISO_Fortran_binding.c + + +# Specifics +gfor_specific_src = \ generated/_abs_c4.F90 \ generated/_abs_c8.F90 \ generated/_abs_c10.F90 \ @@ -1940,9 +1786,7 @@ generated/_anint_r4.F90 \ generated/_anint_r8.F90 \ generated/_anint_r10.F90 \ generated/_anint_r16.F90 \ -generated/_anint_r17.F90 - -gfor_built_specific2_src = \ +generated/_anint_r17.F90 \ generated/_sign_i4.F90 \ generated/_sign_i8.F90 \ generated/_sign_i16.F90 \ @@ -1971,24 +1815,17 @@ generated/_mod_r4.F90 \ generated/_mod_r8.F90 \ generated/_mod_r10.F90 \ generated/_mod_r16.F90 \ -generated/_mod_r17.F90 - -gfor_misc_specifics = generated/misc_specifics.F90 -gfor_specific_src = \ -$(gfor_built_specific_src) \ -$(gfor_built_specific2_src) \ -$(gfor_misc_specifics) \ +generated/_mod_r17.F90 \ +generated/misc_specifics.F90 \ intrinsics/dprod_r8.f90 \ intrinsics/f2c_specifics.F90 \ intrinsics/random_init.f90 -BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \ - $(gfor_built_specific2_src) $(gfor_misc_specifics) - +BUILT_SOURCES = $(gfor_built_src) libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ $(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src) -EXTRA_DIST = $(m4_files) +EXTRA_DIST = m4 MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = @@ -2741,42 +2578,6 @@ generated/parity_l8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/parity_l16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_i1.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_i2.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_i4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_i8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_i16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_r4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_r8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_r10.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_r16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_r17.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_c4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_c8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_c10.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_c16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_c17.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_l4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_l8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmul_l16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) generated/shape_i1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/shape_i2.lo: generated/$(am__dirstamp) \ @@ -3023,36 +2824,6 @@ generated/unpack_c16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/unpack_c17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_i1.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_i2.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_i4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_i8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_i16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_r4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_r8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_r10.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_r16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_r17.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_c4.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_c8.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_c10.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_c16.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) -generated/matmulavx128_c17.lo: generated/$(am__dirstamp) \ - generated/$(DEPDIR)/$(am__dirstamp) generated/spread_i1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/spread_i2.lo: generated/$(am__dirstamp) \ @@ -3203,168 +2974,166 @@ generated/cshift1_16_c16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/cshift1_16_c17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_i1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_i2.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_i4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_i8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_i16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc0_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_r4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_r8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_r10.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_r16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_r17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_c4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc0_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_c8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_c10.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_c16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_c17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc0_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc0_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc1_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_i1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_i2.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_i4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_i8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_i16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_r4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc1_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_r8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_r10.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_r16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_r17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_c4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_c8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxloc2_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_c10.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_4_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_c16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_4_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_c17.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_8_s1.lo: generated/$(am__dirstamp) \ +generated/findloc1_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_8_s4.lo: generated/$(am__dirstamp) \ +generated/findloc1_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_16_s1.lo: generated/$(am__dirstamp) \ +generated/findloc2_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minloc2_16_s4.lo: generated/$(am__dirstamp) \ +generated/findloc2_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxval0_s1.lo: generated/$(am__dirstamp) \ +generated/maxloc0_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxval0_s4.lo: generated/$(am__dirstamp) \ +generated/maxloc0_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minval0_s1.lo: generated/$(am__dirstamp) \ +generated/maxloc0_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minval0_s4.lo: generated/$(am__dirstamp) \ +generated/maxloc0_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxval1_s1.lo: generated/$(am__dirstamp) \ +generated/maxloc0_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/maxval1_s4.lo: generated/$(am__dirstamp) \ +generated/maxloc0_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minval1_s1.lo: generated/$(am__dirstamp) \ +generated/maxloc1_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/minval1_s4.lo: generated/$(am__dirstamp) \ +generated/maxloc1_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_i1.lo: generated/$(am__dirstamp) \ +generated/maxloc1_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_i2.lo: generated/$(am__dirstamp) \ +generated/maxloc1_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_i4.lo: generated/$(am__dirstamp) \ +generated/maxloc1_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_i8.lo: generated/$(am__dirstamp) \ +generated/maxloc1_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_i16.lo: generated/$(am__dirstamp) \ +generated/maxloc2_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_r4.lo: generated/$(am__dirstamp) \ +generated/maxloc2_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_r8.lo: generated/$(am__dirstamp) \ +generated/maxloc2_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_r10.lo: generated/$(am__dirstamp) \ +generated/maxloc2_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_r16.lo: generated/$(am__dirstamp) \ +generated/maxloc2_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_r17.lo: generated/$(am__dirstamp) \ +generated/maxloc2_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_c4.lo: generated/$(am__dirstamp) \ +generated/maxval0_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_c8.lo: generated/$(am__dirstamp) \ +generated/maxval0_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_c10.lo: generated/$(am__dirstamp) \ +generated/maxval1_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_c16.lo: generated/$(am__dirstamp) \ +generated/maxval1_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_c17.lo: generated/$(am__dirstamp) \ +generated/minloc0_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_s1.lo: generated/$(am__dirstamp) \ +generated/minloc0_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc0_s4.lo: generated/$(am__dirstamp) \ +generated/minloc0_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_i1.lo: generated/$(am__dirstamp) \ +generated/minloc0_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_i2.lo: generated/$(am__dirstamp) \ +generated/minloc0_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_i4.lo: generated/$(am__dirstamp) \ +generated/minloc0_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_i8.lo: generated/$(am__dirstamp) \ +generated/minloc1_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_i16.lo: generated/$(am__dirstamp) \ +generated/minloc1_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_r4.lo: generated/$(am__dirstamp) \ +generated/minloc1_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_r8.lo: generated/$(am__dirstamp) \ +generated/minloc1_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_r10.lo: generated/$(am__dirstamp) \ +generated/minloc1_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_r16.lo: generated/$(am__dirstamp) \ +generated/minloc1_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_r17.lo: generated/$(am__dirstamp) \ +generated/minloc2_4_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_c4.lo: generated/$(am__dirstamp) \ +generated/minloc2_4_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_c8.lo: generated/$(am__dirstamp) \ +generated/minloc2_8_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_c10.lo: generated/$(am__dirstamp) \ +generated/minloc2_8_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_c16.lo: generated/$(am__dirstamp) \ +generated/minloc2_16_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_c17.lo: generated/$(am__dirstamp) \ +generated/minloc2_16_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_s1.lo: generated/$(am__dirstamp) \ +generated/minval0_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc1_s4.lo: generated/$(am__dirstamp) \ +generated/minval0_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc2_s1.lo: generated/$(am__dirstamp) \ +generated/minval1_s1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -generated/findloc2_s4.lo: generated/$(am__dirstamp) \ +generated/minval1_s4.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) -runtime/ISO_Fortran_binding.lo: runtime/$(am__dirstamp) \ - runtime/$(DEPDIR)/$(am__dirstamp) generated/pow_m1_m1.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/pow_m1_m2.lo: generated/$(am__dirstamp) \ @@ -3415,6 +3184,74 @@ generated/pow_m16_m8.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) generated/pow_m16_m16.lo: generated/$(am__dirstamp) \ generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_i1.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_i2.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_i4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_i8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_i16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_r4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_r8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_r10.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_r16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_r17.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_c4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_c8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_c10.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_c16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_c17.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_l4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_l8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmul_l16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_i1.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_i2.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_i4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_i8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_i16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_r4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_r8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_r10.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_r16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_r17.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_c4.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_c8.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_c10.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_c16.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +generated/matmulavx128_c17.lo: generated/$(am__dirstamp) \ + generated/$(DEPDIR)/$(am__dirstamp) +runtime/ISO_Fortran_binding.lo: runtime/$(am__dirstamp) \ + runtime/$(DEPDIR)/$(am__dirstamp) io/$(am__dirstamp): @$(MKDIR_P) io @: > io/$(am__dirstamp) diff --git a/libgfortran/regenerate.sh b/libgfortran/regenerate.sh index b5d3593..a016034 100755 --- a/libgfortran/regenerate.sh +++ b/libgfortran/regenerate.sh @@ -793,10 +793,6 @@ generated/spread_c16.c generated/spread_c17.c " -i_isobinding_c=" -runtime/ISO_Fortran_binding.c -" - gfor_built_specific_src=" generated/_abs_c4.F90 generated/_abs_c8.F90 @@ -1235,3 +1231,20 @@ for f in ${gfor_misc_specifics} ; do ../move-if-change $f.tmp $f done +# Check that all generated files are listed in Makefile.am + +for i in generated/*.c generated/*.F90 ; do + if ! grep -q "$i" Makefile.am ; then + echo "File $i is not present in Makefile.am" + fi +done + +# Check that all generated files listed in Makefile.am actually exist + +genlist=`tr ' ' '\n' < Makefile.am | grep 'generated/'` +for i in $genlist ; do + if ! test -e "$i" ; then + echo "File $i listed in Makefile.am does not exist" + fi +done + diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index b4da509..e21366c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2025-06-10 Tobias Burnus <tburnus@baylibre.com> + + * testsuite/libgomp.c/declare-variant-4.h (gfx942): New variant function. + * testsuite/libgomp.c/declare-variant-4-gfx942.c: New test. + 2025-06-06 Tobias Burnus <tburnus@baylibre.com> Sandra Loosemore <sloosemore@baylibre.com> diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4448928..deb3c24 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,442 @@ +2025-06-13 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/120397 + * include/bits/stl_uninitialized.h (_UninitDestroyGuard<I,void>): + Add new member function _S_destroy and call it from the + destructor (for C++17 only). + * testsuite/20_util/specialized_algorithms/uninitialized_default_construct/120397.cc: + New test. + * testsuite/20_util/specialized_algorithms/uninitialized_value_construct/120397.cc: + New test. + +2025-06-13 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + PR libstdc++/120648 + * include/bits/chrono_io.h (__formatter_chrono::_M_format_to): + Handle %c, %r, %x and %X by passing them to _M_c_r_x_X. + (__formatter_chrono::_M_c_r_x_X): Reworked from _M_c. + (__formatter_chrono::_M_c): Renamed into above. + (__formatter_chrono::_M_r, __formatter_chrono::_M_x) + (__formatter_chrono::_M_X): Removed. + * testsuite/std/time/format/pr117214.cc: New tests for %r, %x, + %X with date, time and durations. + +2025-06-13 Patrick Palka <ppalka@redhat.com> + + * include/bits/ranges_algo.h (__detail::__by_ref_or_value_fn): New. + (__detail::_Comp_proj): New. + (__detail::__make_comp_proj): Use it instead. + (__detail::_Pred_proj): New. + (__detail::__make_pred_proj): Use it instead. + +2025-06-13 Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> + + PR c++/120644 + * include/std/optional (format_kind): Do not use `auto`. + +2025-06-13 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * testsuite/23_containers/vector/bool/format.cc: Replaced _CharT + with CharT. + * testsuite/std/format/debug.cc: Likewise. + * testsuite/std/format/ranges/adaptors.cc: Likewise. + * testsuite/std/format/ranges/formatter.cc: Likewise. + * testsuite/std/format/ranges/map.cc: Likewise. + * testsuite/std/format/ranges/sequence.cc: Likewise. + * testsuite/std/format/ranges/string.cc: Likewise. + * testsuite/std/format/tuple.cc: Likewise. + * testsuite/std/time/format/empty_spec.cc: Likewise. + * testsuite/std/time/format/pr120114.cc: Likewise. + * testsuite/std/time/format/pr120481.cc: Likewise. + * testsuite/std/time/format/precision.cc: Likewise. + +2025-06-13 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (__formatter_chrono::_M_format): + Remove handling of empty _M_chrono_specs. + (__formatter_chrono::_M_format_to_ostream): Changed to accept + only chrono::duration and made public. + (std::formatter<chrono::duration<_Rep, _Period>, _CharT>): + Configure __defSpec and handle empty chrono-spec locally. + +2025-06-13 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (__format::__formatter_chrono_info) + [_GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI]: Define. + (std::formatter<chrono::sys_info, _CharT>) + (std::formatter<chrono::local_inf, _CharT>): Delegate to + __format::__formatter_chrono_info. + (std::operator<<(basic_ostream<_CharT, _Traits>& const sys_info&)): + Use format on sys_info with empty format spec. + +2025-06-13 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * testsuite/std/time/format/whitespace.cc: New test. + +2025-06-12 Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> + + PR libstdc++/119496 + * include/bits/stl_algo.h: Adjust calls to requested_size. + * include/bits/stl_tempbuf.h (requested_size): Rename with + an _M_ prefix. + * testsuite/17_intro/names.cc: Add a #define for + requested_size. + +2025-06-12 Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> + + * include/bits/formatfwd.h (format_kind): Move the definition + (and some supporting code) from <format>. + * include/std/format (format_kind): Likewise. + * include/bits/version.def (optional_range_support): Add + the feature-testing macro. + * include/bits/version.h: Regenerate. + * include/std/optional (iterator, const_iterator, begin, end): + Add range support. + (enable_view): Specialize for std::optional. + (format_kind): Specialize for std::optional. + * testsuite/20_util/optional/range.cc: New test. + * testsuite/20_util/optional/version.cc: Test the new + feature-testing macro. + +2025-06-12 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (_ChronoFormats::_S_ftz) + (_ChronoFormats::_S_ft, _ChronoFormats::_S_t): Define. + (__formatter_chrono::_M_format_to_ostream): Remove handling for + time_points. + (std::formatter<chrono::hh_mm_ss<_Dur>, _CharT>) + (std::formatter<chrono::sys_time<_Dur>, _CharT>) + (std::formatter<chrono::utc_time<_Dur>, _CharT>) + (std::formatter<chrono::tai_time<_Dur>, _CharT>) + (std::formatter<chrono::gps_time<_Dur>, _CharT>) + (std::formatter<chrono::file_time<_Dur>, _CharT>) + (std::formatter<chrono::local_time<_Dur>, _CharT>) + (std::formatter<chrono::__detail::__local_time_fmt<_Dur>, _CharT>) + (std::formatter<chrono::zoned_time<_Dur>, _CharT>): + Define __defSpec, and pass it as argument to _M_prase and + constructor of __formatter_chrono. + +2025-06-12 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (__format::_ChronoFormats): Define. + (__formatter_chrono::__formatter_chrono()) + (__formatter_chrono::__formatter_chrono(_ChronoSpec<_CharT>)): Define. + (__formatter_chrono::_M_parse): Add parameter with default spec, + and merge it with new values. Handle '%\0' as weekday index + specifier. + (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B) + (__formatter_chrono::_M_C_y_Y, __formatter_chrono::_M_d_e) + (__formatter_chrono::_M_F): Support _M_debug flag. + (__formatter_chrono::_M_wi, __formatter_chrono::_S_weekday_index): + Define. + (std::formatter<chrono::day, _CharT>) + (std::formatter<chrono::month, _CharT>) + (std::formatter<chrono::year, _CharT>) + (std::formatter<chrono::weekday, _CharT>) + (std::formatter<chrono::weekday_indexed, _CharT>) + (std::formatter<chrono::weekday_last, _CharT>) + (std::formatter<chrono::month_day, _CharT>) + (std::formatter<chrono::month_day_last, _CharT>) + (std::formatter<chrono::month_weekday, _CharT>) + (std::formatter<chrono::month_weekday_last, _CharT>) + (std::formatter<chrono::year_month, _CharT>) + (std::formatter<chrono::year_month_day, _CharT>) + (std::formatter<chrono::year_month_day_last, _CharT>) + (std::formatter<chrono::year_month_weekday, _CharT>) + (std::formatter<chrono::year_month_weekday_last, _CharT>): + Define __defSpec, and pass it as argument to _M_parse and + constructor of __formatter_chrono. + +2025-06-12 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * include/std/mdspan (__mdspan::__mapping_alike): Rename template + parameter from M to _M_p. + (layout_right::mapping): Replace class with typename in template + head. + (layout_stride::mapping): Fix typo in comment. + * testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc: + Changed B to function. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * include/std/mdspan (layout_left): Strengthen the exception + guarantees of layout_left::mapping(layout_stride::mapping). + * testsuite/23_containers/mdspan/layouts/ctors.cc: + Simplify tests to reflect the change. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc: Add + tests for layout_stride. + * testsuite/23_containers/mdspan/layouts/ctors.cc: Add test for + layout_stride and the interaction with other layouts. + * testsuite/23_containers/mdspan/layouts/empty.cc: Ditto. + * testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto. + * testsuite/23_containers/mdspan/layouts/stride.cc: New test. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * include/std/mdspan (layout_stride): New class. + * src/c++23/std.cc.in: Add layout_stride. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc: Add + tests for layout_right. + * testsuite/23_containers/mdspan/layouts/ctors.cc: Add tests for + layout_right and the interaction with layout_left. + * testsuite/23_containers/mdspan/layouts/empty.cc: ditto. + * testsuite/23_containers/mdspan/layouts/mapping.cc: ditto. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * include/std/mdspan (layout_right): New class. + * src/c++23/std.cc.in: Add layout_right. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc: New test. + * testsuite/23_containers/mdspan/layouts/ctors.cc: New test. + * testsuite/23_containers/mdspan/layouts/empty.cc: New test. + * testsuite/23_containers/mdspan/layouts/mapping.cc: New test. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * include/std/mdspan (layout_left): New class. + * src/c++23/std.cc.in: Add layout_left. + +2025-06-12 Luc Grosheintz <luc.grosheintz@gmail.com> + + * include/std/mdspan(__mdspan::_ExtentsStorage): Change name + of private member _M_dynamic_extens to _M_dyn_exts. + (extents): Change name of private member from _M_dynamic_extents + to _M_exts. + Fix two instances of whitespace errors. + * testsuite/23_containers/mdspan/extents/ctor_default.cc: Fix + integer comparison with cmp_equal. + +2025-06-12 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/test.xml: Improve discussion of copyright + notices in new test cases. + * doc/html/manual/test.html: Regenerate. + +2025-06-12 Jonathan Wakely <jwakely@redhat.com> + + * scripts/create_testsuite_files: Remove incorrect comment about + filtering out wchar_t tests. + +2025-06-12 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/120625 + * include/std/format (__format::__disabled): Remove. + (__formatter_disabled): New type. + (formatter<char*, wchar_t>, formatter<const char*, wchar_t>) + (formatter<char[N], wchar_t>, formatter<string, wchar_t>) + (formatter<string_view, wchar_t>): Use __formatter_disabled as + base class instead of formatter<__disabled, wchar_t>. + * testsuite/std/format/formatter/120625.cc: New test. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * doc/doxygen/user.cfg.in (PREDEFINED): Remove -D prefixes from + some macros. Define _GLIBCXX_USE_BUILTIN_TRAIT and + _GLIBCXX_HAVE_ICONV macros. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * libsupc++/exception: Remove redundant parentheses and adjust + whitespace. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * include/std/type_traits: Restore @cond and @endcond balance. + +2025-06-11 Tomasz KamiÅ„ski <tkaminsk@redhat.com> + + * testsuite/std/time/format/empty_spec.cc: New tests. + * testsuite/std/time/format/precision.cc: New test. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/stl_construct.h: Replace std::__addressof with + std::addressof in code that doesn't need to compile as C++98. + Replace std::__is_constant_evaluated with + std::is_constant_evaluated in code that doesn't need to compile + as C++17 or earlier. + * include/bits/stl_uninitialized.h: Likewise for __addressof. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/test.xml: Remove note about unused 'test' + variables for old definition of VERIFY. + * doc/html/manual/test.html: Regenerate. + * testsuite/experimental/net/buffer/arithmetic.cc: Remove unused + variable. + * testsuite/experimental/net/buffer/const.cc: Likewise. + * testsuite/experimental/net/buffer/mutable.cc: Likewise. + * testsuite/experimental/net/buffer/size.cc: Likewise. + * testsuite/experimental/net/timer/waitable/cons.cc: Likewise. + * testsuite/experimental/net/timer/waitable/dest.cc: Likewise. + * testsuite/experimental/net/timer/waitable/ops.cc: Likewise. + * testsuite/ext/special_functions/airy_ai/check_value.cc: + Likewise. + * testsuite/ext/special_functions/airy_bi/check_value.cc: + Likewise. + * testsuite/ext/special_functions/conf_hyperg/check_value.cc: + Likewise. + * testsuite/ext/special_functions/hyperg/check_value.cc: + Likewise. + * testsuite/special_functions/01_assoc_laguerre/check_value.cc: + Likewise. + * testsuite/special_functions/02_assoc_legendre/check_value.cc: + Likewise. + * testsuite/special_functions/02_assoc_legendre/pr86655.cc: + Likewise. + * testsuite/special_functions/03_beta/check_value.cc: Likewise. + * testsuite/special_functions/04_comp_ellint_1/check_value.cc: + Likewise. + * testsuite/special_functions/05_comp_ellint_2/check_value.cc: + Likewise. + * testsuite/special_functions/06_comp_ellint_3/check_value.cc: + Likewise. + * testsuite/special_functions/07_cyl_bessel_i/check_value.cc: + Likewise. + * testsuite/special_functions/08_cyl_bessel_j/check_value.cc: + Likewise. + * testsuite/special_functions/09_cyl_bessel_k/check_value.cc: + Likewise. + * testsuite/special_functions/10_cyl_neumann/check_value.cc: + Likewise. + * testsuite/special_functions/11_ellint_1/check_value.cc: + Likewise. + * testsuite/special_functions/12_ellint_2/check_value.cc: + Likewise. + * testsuite/special_functions/13_ellint_3/check_value.cc: + Likewise. + * testsuite/special_functions/14_expint/check_value.cc: + Likewise. + * testsuite/special_functions/15_hermite/check_value.cc: + Likewise. + * testsuite/special_functions/16_laguerre/check_value.cc: + Likewise. + * testsuite/special_functions/17_legendre/check_value.cc: + Likewise. + * testsuite/special_functions/18_riemann_zeta/check_value.cc: + Likewise. + * testsuite/special_functions/19_sph_bessel/check_value.cc: + Likewise. + * testsuite/special_functions/20_sph_legendre/check_value.cc: + Likewise. + * testsuite/special_functions/20_sph_legendre/pr86655.cc: + Likewise. + * testsuite/special_functions/21_sph_neumann/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_value_neg.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_value.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/pr86655.cc: + Likewise. + * testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc: + Likewise. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * include/std/sstream: Adjust whitespace. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/120390 + * include/bits/stl_construct.h (_Destroy_aux::__destroy_n): New + static member function. + (_Destroy_aux<true>::__destroy_n): Likewise. + (_Destroy_n_aux): Remove. + (_Destroy(ForwardIterator, ForwardIterator)): Remove + static_assert. Use is_trivially_destructible instead of + __has_trivial_destructor. + (_Destroy_n): Likewise. Use _Destroy_aux::__destroy_n instead of + _Destroy_n_aux::__destroy_n. + * testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc: + Adjust dg-error strings. Move destroy_n tests to ... + * testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_n_neg.cc: + New test. + * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: + Adjust dg-error strings. + * testsuite/23_containers/vector/cons/destructible_neg.cc: + Likewise. + +2025-06-11 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/27_io/basic_istringstream/cons/char/string_view.cc: + Only check get_allocator() for new string ABI. + * testsuite/27_io/basic_ostringstream/cons/char/string_view.cc: + Likewise. + * testsuite/27_io/basic_stringbuf/cons/char/string_view.cc: + Likewise. + * testsuite/27_io/basic_stringstream/cons/char/string_view.cc: + Likewise. + +2025-06-10 Patrick Palka <ppalka@redhat.com> + + * include/bits/max_size_type.h (__max_size_type::_M_val): Make + public instead of private. + (__max_size_type::_M_msb): Likewise. + (__max_diff_type::_M_rep): Likewise. + * testsuite/std/ranges/iota/max_size_type.cc: Verify + __max_diff_type and __max_size_type are structural. + +2025-06-10 Yihan Wang <yronglin777@gmail.com> + Jonathan Wakely <jwakely@redhat.com> + + * include/std/tuple (__can_make_from_tuple): New variable + template. + (__make_from_tuple_impl): Add static_assert. + (make_from_tuple): Constrain using __can_make_from_tuple. + * testsuite/20_util/tuple/dr3528.cc: New test. + 2025-06-09 Nathan Myers <ncm@cantrip.org> PR libstdc++/119741 diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index e926c67..536e035 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2350,8 +2350,8 @@ PREDEFINED = __cplusplus=202002L \ "_GLIBCXX_END_NAMESPACE_CONTAINER= " \ "_GLIBCXX_END_NAMESPACE_CXX11= " \ "_GLIBCXX_END_NAMESPACE_LDBL= " \ - "-D_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X)= " \ - "-D_GLIBCXX_END_INLINE_ABI_NAMESPACE(X)= " \ + "_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X)= " \ + "_GLIBCXX_END_INLINE_ABI_NAMESPACE(X)= " \ "_GLIBCXX_TEMPLATE_ARGS=... " \ "_GLIBCXX_DEPRECATED= " \ "_GLIBCXX_DEPRECATED_SUGGEST(E)= " \ @@ -2414,6 +2414,8 @@ PREDEFINED = __cplusplus=202002L \ _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE \ _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED \ _GLIBCXX_HAVE_BUILTIN_LAUNDER \ + "_GLIBCXX_USE_BUILTIN_TRAIT(X)=1" \ + _GLIBCXX_HAVE_ICONV=1 \ "_GLIBCXX_DOXYGEN_ONLY(X)=X " \ __exception_ptr=__unspecified__ \ diff --git a/libstdc++-v3/doc/html/manual/test.html b/libstdc++-v3/doc/html/manual/test.html index f2cf8c4..497ee1a 100644 --- a/libstdc++-v3/doc/html/manual/test.html +++ b/libstdc++-v3/doc/html/manual/test.html @@ -389,10 +389,15 @@ cat 27_io/objects/char/3_xin.in | a.out</pre></dd><dt><span class="term"><code c We no longer require that, because most tests are uninteresting and contain no "original authorship", and so would not be protected by copyright anyway. - If you do want to add the FSF copyright notice and GPL licence text, + Adding the FSF copyright notice to new tests is incorrect unless you + (or your employer) have a copyright assignment on file with the FSF, + or if the test contains code copied from another test under FSF copyright. + In particular, new tests that contain original code are not copyright FSF + if contributed under the <a class="link" href="https://gcc.gnu.org/dco.html" target="_top">DCO</a> terms. + If new tests do add the FSF copyright notice and GPL licence text, then the first copyright year should correspond to the date - the file was checked in to version control. If a test is copied from - an existing file it should retain the copyright years from the + the file was checked in to version control. If the test code is copied + from an existing file it should retain the copyright years from the original file. </p><p> The DejaGnu instructions say to always return <code class="literal">0</code> @@ -416,18 +421,6 @@ cat 27_io/objects/char/3_xin.in | a.out</pre></dd><dt><span class="term"><code c (to avoid using <code class="literal">assert</code> and being affected by <code class="literal">NDEBUG</code>). </p><p> - Prior to GCC 7.1, <code class="literal">VERIFY</code> was defined differently. - It usually expanded to the standard <code class="literal">assert</code> macro, but - allowed targets to define it to something different. In order to support - the alternative expansions of <code class="literal">VERIFY</code>, before any use - of the macro there needed to be a variable called <code class="varname">test</code> - in scope, which was usually defined like so (the attribute avoids - warnings about an unused variable): - </p><pre class="programlisting"> - bool test __attribute__((unused)) = true; - </pre><p> - This is no longer needed, and should not be added to new tests. - </p><p> The testsuite uses the DejaGnu framework to compile and run the tests. Test cases are normal C++ files which contain special directives in comments. These directives look like <code class="literal">{ dg-* ... }</code> diff --git a/libstdc++-v3/doc/xml/manual/test.xml b/libstdc++-v3/doc/xml/manual/test.xml index 8e2729e..df49f56 100644 --- a/libstdc++-v3/doc/xml/manual/test.xml +++ b/libstdc++-v3/doc/xml/manual/test.xml @@ -650,10 +650,16 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting> We no longer require that, because most tests are uninteresting and contain no "original authorship", and so would not be protected by copyright anyway. - If you do want to add the FSF copyright notice and GPL licence text, + Adding the FSF copyright notice to new tests is incorrect unless you + (or your employer) have a copyright assignment on file with the FSF, + or if the test contains code copied from another test under FSF copyright. + In particular, new tests that contain original code are not copyright FSF + if contributed under the <link xmlns:xlink="http://www.w3.org/1999/xlink" + xlink:href="https://gcc.gnu.org/dco.html">DCO</link> terms. + If new tests do add the FSF copyright notice and GPL licence text, then the first copyright year should correspond to the date - the file was checked in to version control. If a test is copied from - an existing file it should retain the copyright years from the + the file was checked in to version control. If the test code is copied + from an existing file it should retain the copyright years from the original file. </para> @@ -685,20 +691,6 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting> </para> <para> - Prior to GCC 7.1, <literal>VERIFY</literal> was defined differently. - It usually expanded to the standard <literal>assert</literal> macro, but - allowed targets to define it to something different. In order to support - the alternative expansions of <literal>VERIFY</literal>, before any use - of the macro there needed to be a variable called <varname>test</varname> - in scope, which was usually defined like so (the attribute avoids - warnings about an unused variable): - <programlisting> - bool test __attribute__((unused)) = true; - </programlisting> - This is no longer needed, and should not be added to new tests. - </para> - - <para> The testsuite uses the DejaGnu framework to compile and run the tests. Test cases are normal C++ files which contain special directives in comments. These directives look like <literal>{ dg-* ... }</literal> diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index c5c5e4b..abbf4efc 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -238,6 +238,108 @@ namespace __format operator|=(_ChronoParts& __x, _ChronoParts __y) noexcept { return __x = __x | __y; } + template<typename _CharT> + struct _ChronoFormats + { + using _String_view = basic_string_view<_CharT>; + + static consteval + _String_view + _S_ftz() noexcept + { return _GLIBCXX_WIDEN("%F %T %Z"); } + + static consteval + _String_view + _S_ft() noexcept + { return _S_ftz().substr(0, 5); } + + static consteval + _String_view + _S_f() noexcept + { return _S_ftz().substr(0, 2); } + + static consteval + _String_view + _S_t() noexcept + { return _S_ftz().substr(3, 2); } + + static consteval + _String_view + _S_ymd() noexcept + { return _GLIBCXX_WIDEN("%Y/%b/%d"); } + + static consteval + _String_view + _S_ym() noexcept + { return _S_ymd().substr(0, 5); } + + static consteval + _String_view + _S_md() noexcept + { return _S_ymd().substr(3); } + + static consteval + _String_view + _S_y() noexcept + { return _S_ymd().substr(0, 2); } + + static consteval + _String_view + _S_m() noexcept + { return _S_ymd().substr(3, 2); } + + static consteval + _String_view + _S_d() noexcept + { return _S_ymd().substr(6, 2); } + + static consteval + _String_view + _S_ymwi() noexcept + // %\0 is extension for handling weekday index + { return _String_view(_GLIBCXX_WIDEN("%Y/%b/%a[%\0]"), 12); } + + static consteval + _String_view + _S_mwi() noexcept + { return _S_ymwi().substr(3); } + + static consteval + _String_view + _S_wi() noexcept + { return _S_ymwi().substr(6); } + + static consteval + _String_view + _S_w() noexcept + { return _S_ymwi().substr(6, 2); } + + static consteval + _String_view + _S_ymwl() noexcept + { return _GLIBCXX_WIDEN("%Y/%b/%a[last]"); } + + static consteval + _String_view + _S_mwl() noexcept + { return _S_ymwl().substr(3); } + + static consteval + _String_view + _S_wl() noexcept + { return _S_ymwl().substr(6); } + + static consteval + _String_view + _S_yml() noexcept + { return _GLIBCXX_WIDEN("%Y/%b/last"); } + + static consteval + _String_view + _S_ml() noexcept + { return _S_yml().substr(3); } + }; + // TODO rename this to chrono::__formatter? or chrono::__detail::__formatter? template<typename _CharT> struct __formatter_chrono @@ -245,14 +347,22 @@ namespace __format using __string_view = basic_string_view<_CharT>; using __string = basic_string<_CharT>; + __formatter_chrono() = default; + + constexpr explicit + __formatter_chrono(_ChronoSpec<_CharT> __spec) noexcept + : _M_spec(__spec) + { } + template<typename _ParseContext> constexpr typename _ParseContext::iterator - _M_parse(_ParseContext& __pc, _ChronoParts __parts) + _M_parse(_ParseContext& __pc, _ChronoParts __parts, + const _ChronoSpec<_CharT>& __def = {}) { auto __first = __pc.begin(); auto __last = __pc.end(); - _ChronoSpec<_CharT> __spec{}; + _ChronoSpec<_CharT> __spec = __def; auto __finalize = [this, &__spec] { _M_spec = __spec; @@ -285,6 +395,7 @@ namespace __format return __first; } + __spec._M_localized = false; __first = __spec._M_parse_locale(__first, __last); if (__finished()) return __first; @@ -306,6 +417,9 @@ namespace __format // Parse chrono-specs in [first,last), checking each conversion-spec // against __parts (so fail for %Y if no year in parts). // Save range in __spec._M_chrono_specs. + __spec._M_debug = false; + __spec._M_locale_specific = true; + __spec._M_chrono_specs = __string_view(); const auto __chrono_specs = __first++; // Skip leading '%' if (*__chrono_specs != '%') @@ -492,14 +606,12 @@ namespace __format // that we instantiate fewer different specializations. Similar to // _Sink_iter for std::format. Replace each _S_year, _S_day etc. with // member functions of that type. + // pre: !_M_spec._M_chrono_specs.empty() template<typename _Tp, typename _FormatContext> typename _FormatContext::iterator _M_format(const _Tp& __t, _FormatContext& __fc, bool __is_neg = false) const { - if (_M_spec._M_chrono_specs.empty()) - return _M_format_to_ostream(__t, __fc, __is_neg); - #if defined _GLIBCXX_USE_NL_LANGINFO_L && __CHAR_BIT__ == 8 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 3565. Handling of encodings in localized formatting @@ -562,6 +674,10 @@ namespace __format _CharT __c = *__first++; switch (__c) { + // %\0 is extension for handling weekday index + case '\0': + __out = _M_wi(__t, std::move(__out), __fc); + break; case 'a': case 'A': __out = _M_a_A(__t, std::move(__out), __fc, __c == 'A'); @@ -572,7 +688,10 @@ namespace __format __out = _M_b_B(__t, std::move(__out), __fc, __c == 'B'); break; case 'c': - __out = _M_c(__t, std::move(__out), __fc, __mod == 'E'); + case 'r': + case 'x': + case 'X': + __out = _M_c_r_x_X(__t, std::move(__out), __fc, __c, __mod); break; case 'C': case 'y': @@ -623,9 +742,6 @@ namespace __format __throw_format_error("chrono format error: argument is " "not a duration"); break; - case 'r': - __out = _M_r(__t, __print_sign(), __fc); - break; case 'R': case 'T': __out = _M_R_T(__t, __print_sign(), __fc, __c == 'T'); @@ -643,12 +759,6 @@ namespace __format __out = _M_U_V_W(__t, std::move(__out), __fc, __c, __mod == 'O'); break; - case 'x': - __out = _M_x(__t, std::move(__out), __fc, __mod == 'E'); - break; - case 'X': - __out = _M_X(__t, __print_sign(), __fc, __mod == 'E'); - break; case 'z': __out = _M_z(__t, std::move(__out), __fc, (bool)__mod); break; @@ -694,6 +804,24 @@ namespace __format return std::move(__out); } + // Format duration for empty chrono-specs, e.g. "{}" (C++20 [time.format] p6). + template<typename _Rep, typename _Period, typename _FormatContext> + typename _FormatContext::iterator + _M_format_to_ostream(const chrono::duration<_Rep, _Period>& __d, + bool __is_neg, _FormatContext& __fc) const + { + basic_ostringstream<_CharT> __os; + __os.imbue(_M_locale(__fc)); + + if (__is_neg) [[unlikely]] + __os << _S_plus_minus[1]; + __os << __d; + + auto __str = std::move(__os).str(); + return __format::__write_padded_as_spec(__str, __str.size(), + __fc, _M_spec); + } + _ChronoSpec<_CharT> _M_spec; private: @@ -708,82 +836,6 @@ namespace __format return __fc.locale(); } - // Format for empty chrono-specs, e.g. "{}" (C++20 [time.format] p6). - // TODO: consider moving body of every operator<< into this function - // and use std::format("{}", t) to implement those operators. That - // would avoid std::format("{}", t) calling operator<< which calls - // std::format again. - template<typename _Tp, typename _FormatContext> - typename _FormatContext::iterator - _M_format_to_ostream(const _Tp& __t, _FormatContext& __fc, - bool __is_neg) const - { - using ::std::chrono::__detail::__utc_leap_second; - using ::std::chrono::__detail::__local_time_fmt; - - basic_ostringstream<_CharT> __os; - __os.imbue(_M_locale(__fc)); - - if constexpr (__is_specialization_of<_Tp, __local_time_fmt>) - { - // Format as "{:L%F %T}" - auto __days = chrono::floor<chrono::days>(__t._M_time); - __os << chrono::year_month_day(__days) << ' ' - << chrono::hh_mm_ss(__t._M_time - __days); - - // For __local_time_fmt the __is_neg flags says whether to - // append " %Z" to the result. - if (__is_neg) - { - if (!__t._M_abbrev) [[unlikely]] - __format::__no_timezone_available(); - else if constexpr (is_same_v<_CharT, char>) - __os << ' ' << *__t._M_abbrev; - else - { - __os << L' '; - for (char __c : *__t._M_abbrev) - __os << __c; - } - } - } - else - { - if constexpr (__is_specialization_of<_Tp, __utc_leap_second>) - __os << __t._M_date << ' ' << __t._M_time; - else if constexpr (chrono::__is_time_point_v<_Tp>) - { - // Need to be careful here because not all specializations - // of chrono::sys_time can be written to an ostream. - // For the specializations of time_point that can be - // formatted with an empty chrono-specs, either it's a - // sys_time with period greater or equal to days: - if constexpr (is_convertible_v<_Tp, chrono::sys_days>) - __os << _S_date(__t); - // Or a local_time with period greater or equal to days: - else if constexpr (is_convertible_v<_Tp, chrono::local_days>) - __os << _S_date(__t); - else // Or it's formatted as "{:L%F %T}": - { - auto __days = chrono::floor<chrono::days>(__t); - __os << chrono::year_month_day(__days) << ' ' - << chrono::hh_mm_ss(__t - __days); - } - } - else - { - if constexpr (chrono::__is_duration_v<_Tp>) - if (__is_neg) [[unlikely]] - __os << _S_plus_minus[1]; - __os << __t; - } - } - - auto __str = std::move(__os).str(); - return __format::__write_padded_as_spec(__str, __str.size(), - __fc, _M_spec); - } - static constexpr const _CharT* _S_chars = _GLIBCXX_WIDEN("0123456789:/ +-{}"); static constexpr _CharT _S_colon = _S_chars[10]; @@ -818,6 +870,22 @@ namespace __format template<typename _Tp, typename _FormatContext> typename _FormatContext::iterator + _M_wi(const _Tp& __t, typename _FormatContext::iterator __out, + _FormatContext& __ctx) const + { + // %\0 Extension to format weekday index, used only by empty format spec + unsigned __wi = _S_weekday_index(__t); + + _CharT __buf[3]; + __out = __format::__write(std::move(__out), _S_str_d1(__buf, __wi)); + if (_M_spec._M_debug && (__wi < 1 || __wi > 5)) + __out = __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid index"))); + return std::move(__out); + } + + template<typename _Tp, typename _FormatContext> + typename _FormatContext::iterator _M_a_A(const _Tp& __t, typename _FormatContext::iterator __out, _FormatContext& __ctx, bool __full) const { @@ -825,7 +893,16 @@ namespace __format // %A Locale's full weekday name. chrono::weekday __wd = _S_weekday(__t); if (!__wd.ok()) - __throw_format_error("format error: invalid weekday"); + { + if (!_M_spec._M_debug) + __throw_format_error("format error: invalid weekday"); + + _CharT __buf[3]; + __out = __format::__write(std::move(__out), + _S_str_d1(__buf, __wd.c_encoding())); + return __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid weekday"))); + } locale __loc = _M_locale(__ctx); const auto& __tp = use_facet<__timepunct<_CharT>>(__loc); @@ -847,7 +924,17 @@ namespace __format // %B Locale's full month name. chrono::month __m = _S_month(__t); if (!__m.ok()) - __throw_format_error("format error: invalid month"); + { + if (!_M_spec._M_debug) + __throw_format_error("format error: invalid month"); + + _CharT __buf[3]; + __out = __format::__write(std::move(__out), + _S_str_d1(__buf, (unsigned)__m)); + return __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid month"))); + } + locale __loc = _M_locale(__ctx); const auto& __tp = use_facet<__timepunct<_CharT>>(__loc); const _CharT* __months[12]; @@ -861,11 +948,16 @@ namespace __format template<typename _Tp, typename _FormatContext> typename _FormatContext::iterator - _M_c(const _Tp& __t, typename _FormatContext::iterator __out, - _FormatContext& __ctx, bool __mod = false) const + _M_c_r_x_X(const _Tp& __t, typename _FormatContext::iterator __out, + _FormatContext& __ctx, _CharT __conv, _CharT __mod) const { // %c Locale's date and time representation. // %Ec Locale's alternate date and time representation. + // %r Locale's 12-hour clock time. + // %x Locale's date rep + // %Ex Locale's alternative date representation. + // %X Locale's time rep + // %EX Locale's alternative time representation. using namespace chrono; using ::std::chrono::__detail::__utc_leap_second; @@ -899,23 +991,30 @@ namespace __format __tm.tm_zone = const_cast<char*>("UTC"); #endif - auto __d = _S_days(__t); // Either sys_days or local_days. - using _TDays = decltype(__d); - const year_month_day __ymd(__d); - const auto __y = __ymd.year(); - const auto __hms = _S_hms(__t); + if (__conv == 'c' || __conv == 'x') + { + auto __d = _S_days(__t); // Either sys_days or local_days. + using _TDays = decltype(__d); + const year_month_day __ymd(__d); + const auto __y = __ymd.year(); + + __tm.tm_year = (int)__y - 1900; + __tm.tm_yday = (__d - _TDays(__y/January/1)).count(); + __tm.tm_mon = (unsigned)__ymd.month() - 1; + __tm.tm_mday = (unsigned)__ymd.day(); + __tm.tm_wday = weekday(__d).c_encoding(); + } - __tm.tm_year = (int)__y - 1900; - __tm.tm_yday = (__d - _TDays(__y/January/1)).count(); - __tm.tm_mon = (unsigned)__ymd.month() - 1; - __tm.tm_mday = (unsigned)__ymd.day(); - __tm.tm_wday = weekday(__d).c_encoding(); - __tm.tm_hour = __hms.hours().count(); - __tm.tm_min = __hms.minutes().count(); - __tm.tm_sec = __hms.seconds().count(); - - return _M_locale_fmt(std::move(__out), _M_locale(__ctx), __tm, 'c', - __mod ? 'E' : '\0'); + if (__conv != 'x') + { + const auto __hms = _S_hms(__t); + __tm.tm_hour = __hms.hours().count(); + __tm.tm_min = __hms.minutes().count(); + __tm.tm_sec = __hms.seconds().count(); + } + + return _M_locale_fmt(std::move(__out), _M_locale(__ctx), __tm, + __conv, __mod); } template<typename _Tp, typename _FormatContext> @@ -974,7 +1073,11 @@ namespace __format } __out = __format::__write(std::move(__out), __sv); } - return std::move(__out); + + if (_M_spec._M_debug && __conv == 'Y' && !__y.ok()) [[unlikely]] + __out = __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid year"))); + return __out; } template<typename _Tp, typename _FormatContext> @@ -1039,7 +1142,12 @@ namespace __format __buf[0] = _S_space; __sv = {__buf, 2}; } - return __format::__write(std::move(__out), __sv); + + __out = __format::__write(std::move(__out), __sv); + if (_M_spec._M_debug && !__d.ok()) [[unlikely]] + __out = __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid day"))); + return std::move(__out); } template<typename _Tp, typename _FormatContext> @@ -1076,6 +1184,10 @@ namespace __format _S_fill_two_digits(__buf + 9, __di); __out = __format::__write(std::move(__out), __sv); } + + if (_M_spec._M_debug && !__ymd.ok()) + __out = __format::__write(std::move(__out), + __string_view(_GLIBCXX_WIDEN(" is not a valid date"))); return std::move(__out); } @@ -1243,25 +1355,6 @@ namespace __format template<typename _Tp, typename _FormatContext> typename _FormatContext::iterator - _M_r(const _Tp& __tt, typename _FormatContext::iterator __out, - _FormatContext& __ctx) const - { - // %r locale's 12-hour clock time. - auto __t = _S_floor_seconds(__tt); - locale __loc = _M_locale(__ctx); - const auto& __tp = use_facet<__timepunct<_CharT>>(__loc); - const _CharT* __ampm_fmt; - __tp._M_am_pm_format(&__ampm_fmt); - basic_string<_CharT> __fmt(_S_empty_spec); - __fmt.insert(1u, 1u, _S_colon); - __fmt.insert(2u, __ampm_fmt); - using _FmtStr = _Runtime_format_string<_CharT>; - return _M_write(std::move(__out), __loc, - std::format(__loc, _FmtStr(__fmt), __t)); - } - - template<typename _Tp, typename _FormatContext> - typename _FormatContext::iterator _M_R_T(const _Tp& __t, typename _FormatContext::iterator __out, _FormatContext& __ctx, bool __secs) const { @@ -1441,53 +1534,6 @@ namespace __format template<typename _Tp, typename _FormatContext> typename _FormatContext::iterator - _M_x(const _Tp& __t, typename _FormatContext::iterator __out, - _FormatContext& __ctx, bool __mod = false) const - { - // %x Locale's date rep - // %Ex Locale's alternative date representation. - locale __loc = _M_locale(__ctx); - const auto& __tp = use_facet<__timepunct<_CharT>>(__loc); - const _CharT* __date_reps[2]; - __tp._M_date_formats(__date_reps); - const _CharT* __rep = __date_reps[__mod]; - if (!*__rep) - return _M_D(__t, std::move(__out), __ctx); - - basic_string<_CharT> __fmt(_S_empty_spec); - __fmt.insert(1u, 1u, _S_colon); - __fmt.insert(2u, __rep); - using _FmtStr = _Runtime_format_string<_CharT>; - return _M_write(std::move(__out), __loc, - std::format(__loc, _FmtStr(__fmt), __t)); - } - - template<typename _Tp, typename _FormatContext> - typename _FormatContext::iterator - _M_X(const _Tp& __tt, typename _FormatContext::iterator __out, - _FormatContext& __ctx, bool __mod = false) const - { - // %X Locale's time rep - // %EX Locale's alternative time representation. - auto __t = _S_floor_seconds(__tt); - locale __loc = _M_locale(__ctx); - const auto& __tp = use_facet<__timepunct<_CharT>>(__loc); - const _CharT* __time_reps[2]; - __tp._M_time_formats(__time_reps); - const _CharT* __rep = __time_reps[__mod]; - if (!*__rep) - return _M_R_T(__t, std::move(__out), __ctx, true); - - basic_string<_CharT> __fmt(_S_empty_spec); - __fmt.insert(1u, 1u, _S_colon); - __fmt.insert(2u, __rep); - using _FmtStr = _Runtime_format_string<_CharT>; - return _M_write(std::move(__out), __loc, - std::format(__loc, _FmtStr(__fmt), __t)); - } - - template<typename _Tp, typename _FormatContext> - typename _FormatContext::iterator _M_z(const _Tp& __t, typename _FormatContext::iterator __out, _FormatContext&, bool __mod = false) const { @@ -1757,6 +1803,20 @@ namespace __format return weekday(_S_days(__t)); } + template<typename _Tp> + static unsigned + _S_weekday_index(const _Tp& __t) + { + using namespace ::std::chrono; + + if constexpr (is_same_v<_Tp, weekday_indexed>) + return __t.index(); + else if constexpr (requires { __t.weekday_indexed(); }) + return __t.weekday_indexed().index(); + else + return ((unsigned)_S_day(__t) + 6) / 7; + } + // Remove subsecond precision from a time_point. template<typename _Tp> static auto @@ -1801,6 +1861,84 @@ namespace __format } }; +#if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI + template<typename _CharT> + struct __formatter_chrono_info + { + constexpr typename basic_format_parse_context<_CharT>::iterator + parse(basic_format_parse_context<_CharT>& __pc) + { return _M_f._M_parse(__pc, _ChronoParts(), {}); } + + template<typename _Info, typename _Out> + typename basic_format_context<_Out, _CharT>::iterator + format(const _Info& __i, + basic_format_context<_Out, _CharT>& __fc) const + { + // n.b. only acceptable chrono-spec for info is one containing + // only whitespaces and %%, that do not depend on formatted object. + if (!_M_f._M_spec._M_chrono_specs.empty()) [[unlikely]] + return _M_f._M_format(chrono::day(1), __fc); + + const size_t __padwidth = _M_f._M_spec._M_get_width(__fc); + if (__padwidth == 0) + return _M_format_to(__fc.out(), __i); + + _Padding_sink<_Out, _CharT> __sink(__fc.out(), __padwidth); + _M_format_to(__sink.out(), __i); + return __sink._M_finish(_M_f._M_spec._M_align, _M_f._M_spec._M_fill); + } + + private: + template<typename _Out> + _Out + _M_format_to(_Out __out, const chrono::sys_info& __si) const + { + using _FmtStr = _Runtime_format_string<_CharT>; + // n.b. only decimal separator is locale dependent for specifiers + // used below, as sys_info uses seconds and minutes duration, the + // output is locale-independent. + constexpr auto* __fs + = _GLIBCXX_WIDEN("[{0:%F %T},{1:%F %T},{2:%T},{3:%Q%q},{0:%Z}]"); + const chrono::local_seconds __lb(__si.begin.time_since_epoch()); + return std::format_to(std::move(__out), _FmtStr(__fs), + chrono::local_time_format(__lb, &__si.abbrev), + __si.end, __si.offset, __si.save); + } + + template<typename _Out> + _Out + _M_format_to(_Out __out, const chrono::local_info& __li) const + { + *__out = _Separators<_CharT>::_S_squares()[0]; + ++__out; + if (__li.result == chrono::local_info::unique) + __out = _M_format_to(std::move(__out), __li.first); + else + { + basic_string_view<_CharT> __sv; + if (__li.result == chrono::local_info::nonexistent) + __sv =_GLIBCXX_WIDEN("nonexistent"); + else + __sv = _GLIBCXX_WIDEN("ambiguous"); + __out = __format::__write(std::move(__out), __sv); + + __sv = _GLIBCXX_WIDEN(" local time between "); + __out = __format::__write(std::move(__out), __sv); + __out = _M_format_to(std::move(__out), __li.first); + + __sv = _GLIBCXX_WIDEN(" and "); + __out = __format::__write(std::move(__out), __sv); + __out = _M_format_to(std::move(__out), __li.second); + } + *__out = _Separators<_CharT>::_S_squares()[1]; + ++__out; + return std::move(__out); + } + + __formatter_chrono<_CharT> _M_f; + }; +#endif + } // namespace __format /// @endcond @@ -1812,7 +1950,7 @@ namespace __format parse(basic_format_parse_context<_CharT>& __pc) { using namespace __format; - auto __it = _M_f._M_parse(__pc, _Duration|_TimeOfDay); + auto __it = _M_f._M_parse(__pc, _Duration|_TimeOfDay, __defSpec); if constexpr (!is_floating_point_v<_Rep>) if (_M_f._M_spec._M_prec_kind != __format::_WP_none) __throw_format_error("format error: invalid precision for duration"); @@ -1834,16 +1972,37 @@ namespace __format using _URep = make_unsigned_t<_Rep>; auto __ucnt = -static_cast<_URep>(__d.count()); auto __ud = chrono::duration<_URep, _Period>(__ucnt); - return _M_f._M_format(__ud, __fc, true); + return _M_format(__ud, true, __fc); } else - return _M_f._M_format(-__d, __fc, true); + return _M_format(-__d, true, __fc); } - return _M_f._M_format(__d, __fc, false); + return _M_format(__d, false, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = !is_integral_v<_Rep>; + if constexpr (is_integral_v<_Rep>) + __res._M_chrono_specs = _GLIBCXX_WIDEN("%Q%q"); + return __res; + }(); + + template<typename _Rep2, typename _Out> + typename basic_format_context<_Out, _CharT>::iterator + _M_format(const chrono::duration<_Rep2, _Period>& __d, + bool __is_neg, + basic_format_context<_Out, _CharT>& __fc) const + { + if constexpr (!is_integral_v<_Rep>) + if (_M_f._M_spec._M_chrono_specs.empty()) + return _M_f._M_format_to_ostream(__d, __is_neg, __fc); + return _M_f._M_format(__d, __fc, __is_neg); + } + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1851,7 +2010,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Day); } + { return _M_f._M_parse(__pc, __format::_Day, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1860,7 +2019,15 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_d(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1868,7 +2035,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Month); } + { return _M_f._M_parse(__pc, __format::_Month, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1877,7 +2044,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_m(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1885,7 +2062,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Year); } + { return _M_f._M_parse(__pc, __format::_Year, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1894,7 +2071,15 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_y(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1902,7 +2087,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Weekday); } + { return _M_f._M_parse(__pc, __format::_Weekday, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1911,7 +2096,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_w(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1919,7 +2114,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Weekday); } + { return _M_f._M_parse(__pc, __format::_Weekday, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1928,7 +2123,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_wi(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1936,7 +2141,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Weekday); } + { return _M_f._M_parse(__pc, __format::_Weekday, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1945,7 +2150,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_wl(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1953,7 +2168,10 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Month|__format::_Day); } + { + return _M_f._M_parse(__pc, __format::_Month|__format::_Day, + __defSpec); + } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1962,7 +2180,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_md(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1970,7 +2198,10 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Month|__format::_Day); } + { + return _M_f._M_parse(__pc, __format::_Month|__format::_Day, + __defSpec); + } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1979,7 +2210,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ml(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -1987,7 +2228,10 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday); } + { + return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday, + __defSpec); + } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -1996,7 +2240,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_mwi(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2004,7 +2258,10 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday); } + { + return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday, + __defSpec); + } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2013,7 +2270,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_mwl(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2021,7 +2288,10 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Year|__format::_Month); } + { + return _M_f._M_parse(__pc, __format::_Year|__format::_Month, + __defSpec); + } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2030,7 +2300,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ym(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2038,7 +2318,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Date); } + { return _M_f._M_parse(__pc, __format::_Date, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2047,7 +2327,15 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_f(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2055,7 +2343,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Date); } + { return _M_f._M_parse(__pc, __format::_Date, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2064,7 +2352,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_yml(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2072,7 +2370,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Date); } + { return _M_f._M_parse(__pc, __format::_Date, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2081,7 +2379,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ymwi(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<__format::__char _CharT> @@ -2089,7 +2397,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_Date); } + { return _M_f._M_parse(__pc, __format::_Date, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2098,7 +2406,17 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_debug = true; + __res._M_localized = true; + __res._M_locale_specific = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ymwl(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Rep, typename _Period, __format::__char _CharT> @@ -2106,7 +2424,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_TimeOfDay); } + { return _M_f._M_parse(__pc, __format::_TimeOfDay, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2115,7 +2433,15 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_t(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; #if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI @@ -2124,16 +2450,16 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ChronoParts{}); } + { return _M_f.parse(__pc); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator format(const chrono::sys_info& __i, basic_format_context<_Out, _CharT>& __fc) const - { return _M_f._M_format(__i, __fc); } + { return _M_f.format(__i, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + __format::__formatter_chrono_info<_CharT> _M_f; }; template<__format::__char _CharT> @@ -2141,16 +2467,16 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ChronoParts{}); } + { return _M_f.parse(__pc); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator format(const chrono::local_info& __i, basic_format_context<_Out, _CharT>& __fc) const - { return _M_f._M_format(__i, __fc); } + { return _M_f.format(__i, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + __format::__formatter_chrono_info<_CharT> _M_f; }; #endif @@ -2160,7 +2486,7 @@ namespace __format constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) { - auto __next = _M_f._M_parse(__pc, __format::_ZonedDateTime); + auto __next = _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); if constexpr (!__stream_insertable) if (_M_f._M_spec._M_chrono_specs.empty()) __format::__invalid_chrono_spec(); // chrono-specs can't be empty @@ -2178,7 +2504,22 @@ namespace __format = requires (basic_ostream<_CharT>& __os, chrono::sys_time<_Duration> __t) { __os << __t; }; - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + if constexpr (!__stream_insertable) + return __res; + else if constexpr (is_convertible_v<_Duration, chrono::days>) + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_f(); + else + { + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + } + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2187,11 +2528,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::utc_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::utc_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Adjust by removing leap seconds to get equivalent sys_time. @@ -2212,7 +2553,15 @@ namespace __format private: friend formatter<chrono::__detail::__utc_leap_second<_Duration>, _CharT>; - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2221,11 +2570,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::tai_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::tai_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Convert to __local_time_fmt with abbrev "TAI" and offset 0s. @@ -2243,7 +2592,15 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2252,11 +2609,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::gps_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::gps_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Convert to __local_time_fmt with abbrev "GPS" and offset 0s. @@ -2274,7 +2631,15 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2282,11 +2647,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::file_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::file_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { using namespace chrono; @@ -2294,24 +2659,45 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; - }; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; + }; template<typename _Duration, __format::__char _CharT> struct formatter<chrono::local_time<_Duration>, _CharT> { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_DateTime); } + { return _M_f._M_parse(__pc, __format::_DateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::local_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::local_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + if constexpr (is_convertible_v<_Duration, chrono::days>) + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_f(); + else + { + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + } + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2319,16 +2705,24 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::__detail::__local_time_fmt<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::__detail::__local_time_fmt<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const - { return _M_f._M_format(__t, __fc, /* use %Z for {} */ true); } + { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ftz(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; #if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI @@ -2337,8 +2731,8 @@ namespace __format : formatter<chrono::__detail::__local_time_fmt_for<_Duration>, _CharT> { template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::zoned_time<_Duration, _TimeZonePtr>& __tp, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::zoned_time<_Duration, _TimeZonePtr>& __tp, basic_format_context<_Out, _CharT>& __fc) const { using _Ltf = chrono::__detail::__local_time_fmt_for<_Duration>; @@ -2358,8 +2752,8 @@ namespace __format : formatter<chrono::utc_time<_Duration>, _CharT> { template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::__detail::__utc_leap_second<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::__detail::__utc_leap_second<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { return this->_M_f._M_format(__t, __fc); } }; @@ -2944,15 +3338,7 @@ namespace __detail basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_info& __i) { - // n.b. only decimal separator is locale dependent for specifiers - // used below, as sys_info uses seconds and minutes duration, the - // output is locale-independent. - constexpr auto* __fs - = _GLIBCXX_WIDEN("[{0:%F %T},{1:%F %T},{2:%T},{3:%Q%q},{0:%Z}]"); - local_seconds __lb(__i.begin.time_since_epoch()); - __os << std::format(__fs, local_time_format(__lb, &__i.abbrev), - __i.end, __i.offset, __i.save); - return __os; + return __os << std::format(__os.getloc(), _GLIBCXX_WIDEN("{}"), __i); } /// Writes a local_info object to an ostream in an unspecified format. diff --git a/libstdc++-v3/include/bits/formatfwd.h b/libstdc++-v3/include/bits/formatfwd.h index 777e629..314b55d 100644 --- a/libstdc++-v3/include/bits/formatfwd.h +++ b/libstdc++-v3/include/bits/formatfwd.h @@ -162,6 +162,32 @@ namespace __format using __maybe_const = __conditional_t<formattable<const _Tp, _CharT>, const _Tp, _Tp>; } + + // [format.range], formatting of ranges + // [format.range.fmtkind], variable template format_kind + enum class range_format { + disabled, + map, + set, + sequence, + string, + debug_string + }; + + /** @brief A constant determining how a range should be formatted. + * + * The primary template of `std::format_kind` cannot be instantiated. + * There is a partial specialization for input ranges and you can + * specialize the variable template for your own cv-unqualified types + * that satisfy the `ranges::input_range` concept. + * + * @since C++23 + */ + template<typename _Rg> + constexpr auto format_kind = []{ + static_assert(false, "cannot use primary template of 'std::format_kind'"); + return type_identity<_Rg>{}; + }(); #endif // format_ranges _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h index a62c3cd..5aca6e8 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -47,28 +47,60 @@ namespace ranges { namespace __detail { + template<typename _Fp> + using __by_ref_or_value_fn + = __conditional_t<is_scalar_v<_Fp> || is_empty_v<_Fp>, _Fp, _Fp&>; + template<typename _Comp, typename _Proj> - constexpr auto + struct _Comp_proj + { + [[no_unique_address]] __by_ref_or_value_fn<_Comp> _M_comp; + [[no_unique_address]] __by_ref_or_value_fn<_Proj> _M_proj; + + constexpr + _Comp_proj(_Comp& __comp, _Proj& __proj) + : _M_comp(__comp), _M_proj(__proj) + { } + + template<typename _Tp, typename _Up> + constexpr bool + operator()(_Tp&& __x, _Up&& __y) + { + return std::__invoke(_M_comp, + std::__invoke(_M_proj, std::forward<_Tp>(__x)), + std::__invoke(_M_proj, std::forward<_Up>(__y))); + } + }; + + template<typename _Comp, typename _Proj> + constexpr _Comp_proj<_Comp, _Proj> __make_comp_proj(_Comp& __comp, _Proj& __proj) + { return {__comp, __proj}; } + + template<typename _Pred, typename _Proj> + struct _Pred_proj { - return [&] (auto&& __lhs, auto&& __rhs) -> bool { - using _TL = decltype(__lhs); - using _TR = decltype(__rhs); - return std::__invoke(__comp, - std::__invoke(__proj, std::forward<_TL>(__lhs)), - std::__invoke(__proj, std::forward<_TR>(__rhs))); - }; - } + [[no_unique_address]] __by_ref_or_value_fn<_Pred> _M_pred; + [[no_unique_address]] __by_ref_or_value_fn<_Proj> _M_proj; + + constexpr + _Pred_proj(_Pred& __pred, _Proj& __proj) + : _M_pred(__pred), _M_proj(__proj) + { } + + template<typename _Tp> + constexpr bool + operator()(_Tp&& __x) + { + return std::__invoke(_M_pred, + std::__invoke(_M_proj, std::forward<_Tp>(__x))); + } + }; template<typename _Pred, typename _Proj> - constexpr auto + constexpr _Pred_proj<_Pred, _Proj> __make_pred_proj(_Pred& __pred, _Proj& __proj) - { - return [&] <typename _Tp> (_Tp&& __arg) -> bool { - return std::__invoke(__pred, - std::__invoke(__proj, std::forward<_Tp>(__arg))); - }; - } + { return {__pred, __proj}; } } // namespace __detail struct __all_of_fn diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 98c2249..3f4674d 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -2511,7 +2511,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) // [first,middle) and [middle,last). _TmpBuf __buf(__first, std::min(__len1, __len2)); - if (__builtin_expect(__buf.size() == __buf.requested_size(), true)) + if (__builtin_expect(__buf.size() == __buf._M_requested_size(), true)) std::__merge_adaptive (__first, __middle, __last, __len1, __len2, __buf.begin(), __comp); else if (__builtin_expect(__buf.begin() == 0, false)) @@ -5024,7 +5024,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO // so the buffer only needs to fit half the range at once. _TmpBuf __buf(__first, (__last - __first + 1) / 2); - if (__builtin_expect(__buf.requested_size() == __buf.size(), true)) + if (__builtin_expect(__buf._M_requested_size() == __buf.size(), true)) std::__stable_sort_adaptive(__first, __first + _DistanceType(__buf.size()), __last, __buf.begin(), __comp); diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h index 23b8fb7..217a041 100644 --- a/libstdc++-v3/include/bits/stl_construct.h +++ b/libstdc++-v3/include/bits/stl_construct.h @@ -82,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if constexpr (__cplusplus > 201703L && is_array_v<_Tp>) { for (auto& __x : *__location) - std::destroy_at(std::__addressof(__x)); + std::destroy_at(std::addressof(__x)); } else __location->~_Tp(); @@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Construct(_Tp* __p, _Args&&... __args) { #if __cpp_constexpr_dynamic_alloc // >= C++20 - if (std::__is_constant_evaluated()) + if (std::is_constant_evaluated()) { // Allow std::_Construct to be used in constant expressions. std::construct_at(__p, std::forward<_Args>(__args)...); @@ -181,6 +181,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION for (; __first != __last; ++__first) std::_Destroy(std::__addressof(*__first)); } + + template<typename _ForwardIterator, typename _Size> + static _GLIBCXX20_CONSTEXPR _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + for (; __count > 0; (void)++__first, --__count) + std::_Destroy(std::__addressof(*__first)); + return __first; + } }; template<> @@ -189,6 +198,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _ForwardIterator> static void __destroy(_ForwardIterator, _ForwardIterator) { } + + template<typename _ForwardIterator, typename _Size> + static _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + std::advance(__first, __count); + return __first; + } }; #endif @@ -204,16 +221,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename iterator_traits<_ForwardIterator>::value_type _Value_type; #if __cplusplus >= 201103L - // A deleted destructor is trivial, this ensures we reject such types: - static_assert(is_destructible<_Value_type>::value, - "value type is destructible"); - if constexpr (!__has_trivial_destructor(_Value_type)) + if constexpr (!is_trivially_destructible<_Value_type>::value) for (; __first != __last; ++__first) - std::_Destroy(std::__addressof(*__first)); + std::_Destroy(std::addressof(*__first)); #if __cpp_constexpr_dynamic_alloc // >= C++20 - else if (std::__is_constant_evaluated()) + else if (std::is_constant_evaluated()) for (; __first != __last; ++__first) - std::destroy_at(std::__addressof(*__first)); + std::destroy_at(std::addressof(*__first)); #endif #else std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: @@ -221,33 +235,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif } -#if __cplusplus < 201103L - template<bool> - struct _Destroy_n_aux - { - template<typename _ForwardIterator, typename _Size> - static _GLIBCXX20_CONSTEXPR _ForwardIterator - __destroy_n(_ForwardIterator __first, _Size __count) - { - for (; __count > 0; (void)++__first, --__count) - std::_Destroy(std::__addressof(*__first)); - return __first; - } - }; - - template<> - struct _Destroy_n_aux<true> - { - template<typename _ForwardIterator, typename _Size> - static _ForwardIterator - __destroy_n(_ForwardIterator __first, _Size __count) - { - std::advance(__first, __count); - return __first; - } - }; -#endif - /** * Destroy a range of objects. If the value_type of the object has * a trivial destructor, the compiler should optimize all of this @@ -260,22 +247,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename iterator_traits<_ForwardIterator>::value_type _Value_type; #if __cplusplus >= 201103L - // A deleted destructor is trivial, this ensures we reject such types: - static_assert(is_destructible<_Value_type>::value, - "value type is destructible"); - if constexpr (!__has_trivial_destructor(_Value_type)) + if constexpr (!is_trivially_destructible<_Value_type>::value) for (; __count > 0; (void)++__first, --__count) - std::_Destroy(std::__addressof(*__first)); + std::_Destroy(std::addressof(*__first)); #if __cpp_constexpr_dynamic_alloc // >= C++20 - else if (std::__is_constant_evaluated()) + else if (std::is_constant_evaluated()) for (; __count > 0; (void)++__first, --__count) - std::destroy_at(std::__addressof(*__first)); + std::destroy_at(std::addressof(*__first)); #endif else std::advance(__first, __count); return __first; #else - return std::_Destroy_n_aux<__has_trivial_destructor(_Value_type)>:: + return std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: __destroy_n(__first, __count); #endif } diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h index 7a7619e..8cc7b11 100644 --- a/libstdc++-v3/include/bits/stl_tempbuf.h +++ b/libstdc++-v3/include/bits/stl_tempbuf.h @@ -227,7 +227,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Returns the size requested by the constructor; may be >size(). size_type - requested_size() const + _M_requested_size() const { return _M_original_len; } /// As per Table mumble. diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index b1428db..f4b26cc 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -118,7 +118,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~_UninitDestroyGuard() { if (__builtin_expect(_M_cur != 0, 0)) +#if __cplusplus == 201703L + // std::uninitialized_{value,default}{,_n} can construct array types, + // but std::_Destroy cannot handle them until C++20 (PR 120397). + _S_destroy(_M_first, *_M_cur); +#else std::_Destroy(_M_first, *_M_cur); +#endif } _GLIBCXX20_CONSTEXPR @@ -129,6 +135,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: _UninitDestroyGuard(const _UninitDestroyGuard&); + +#if __cplusplus == 201703L + template<typename _Iter> + static void + _S_destroy(_Iter __first, _Iter __last) + { + using _ValT = typename iterator_traits<_Iter>::value_type; + if constexpr (is_array<_ValT>::value) + for (; __first != __last; ++__first) + _S_destroy(*__first, *__first + extent<_ValT>::value); + else + std::_Destroy(__first, __last); + } +#endif }; // This is the default implementation of std::uninitialized_copy. @@ -839,7 +859,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__first); for (; __first != __last; ++__first) - std::_Construct(std::__addressof(*__first)); + std::_Construct(std::addressof(*__first)); __guard.release(); } }; @@ -856,7 +876,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return; typename iterator_traits<_ForwardIterator>::value_type* __val - = std::__addressof(*__first); + = std::addressof(*__first); std::_Construct(__val); if (++__first != __last) std::fill(__first, __last, *__val); @@ -873,7 +893,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__first); for (; __n > 0; --__n, (void) ++__first) - std::_Construct(std::__addressof(*__first)); + std::_Construct(std::addressof(*__first)); __guard.release(); return __first; } @@ -890,7 +910,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__n > 0) { typename iterator_traits<_ForwardIterator>::value_type* __val - = std::__addressof(*__first); + = std::addressof(*__first); std::_Construct(__val); ++__first; __first = std::fill_n(__first, __n - 1, *__val); @@ -955,7 +975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __alloc); typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __first != __last; ++__first) - __traits::construct(__alloc, std::__addressof(*__first)); + __traits::construct(__alloc, std::addressof(*__first)); __guard.release(); } @@ -980,7 +1000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __alloc); typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __n > 0; --__n, (void) ++__first) - __traits::construct(__alloc, std::__addressof(*__first)); + __traits::construct(__alloc, std::addressof(*__first)); __guard.release(); return __first; } @@ -1007,7 +1027,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__first); for (; __first != __last; ++__first) - std::_Construct_novalue(std::__addressof(*__first)); + std::_Construct_novalue(std::addressof(*__first)); __guard.release(); } }; @@ -1033,7 +1053,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__first); for (; __n > 0; --__n, (void) ++__first) - std::_Construct_novalue(std::__addressof(*__first)); + std::_Construct_novalue(std::addressof(*__first)); __guard.release(); return __first; } @@ -1089,7 +1109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__result); for (; __n > 0; --__n, (void) ++__first, ++__result) - std::_Construct(std::__addressof(*__result), *__first); + std::_Construct(std::addressof(*__result), *__first); __guard.release(); return __result; } @@ -1112,7 +1132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _UninitDestroyGuard<_ForwardIterator> __guard(__result); for (; __n > 0; --__n, (void) ++__first, ++__result) - std::_Construct(std::__addressof(*__result), *__first); + std::_Construct(std::addressof(*__result), *__first); __guard.release(); return {__first, __result}; } @@ -1276,11 +1296,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION noexcept(noexcept(std::allocator_traits<_Allocator>::construct(__alloc, __dest, std::move(*__orig))) && noexcept(std::allocator_traits<_Allocator>::destroy( - __alloc, std::__addressof(*__orig)))) + __alloc, std::addressof(*__orig)))) { typedef std::allocator_traits<_Allocator> __traits; __traits::construct(__alloc, __dest, std::move(*__orig)); - __traits::destroy(__alloc, std::__addressof(*__orig)); + __traits::destroy(__alloc, std::addressof(*__orig)); } // This class may be specialized for specific types. @@ -1308,8 +1328,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "relocation is only possible for values of the same type"); _ForwardIterator __cur = __result; for (; __first != __last; ++__first, (void)++__cur) - std::__relocate_object_a(std::__addressof(*__cur), - std::__addressof(*__first), __alloc); + std::__relocate_object_a(std::addressof(*__cur), + std::addressof(*__first), __alloc); return __cur; } diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 7cf62e9..880586e 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -852,6 +852,14 @@ ftms = { }; ftms = { + name = optional_range_support; + values = { + v = 202406; + cxxmin = 26; + }; +}; + +ftms = { name = destroying_delete; values = { v = 201806; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 9f4cf9a..4300adb 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -955,6 +955,16 @@ #endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */ #undef __glibcxx_want_optional +#if !defined(__cpp_lib_optional_range_support) +# if (__cplusplus > 202302L) +# define __glibcxx_optional_range_support 202406L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional_range_support) +# define __cpp_lib_optional_range_support 202406L +# endif +# endif +#endif /* !defined(__cpp_lib_optional_range_support) && defined(__glibcxx_want_optional_range_support) */ +#undef __glibcxx_want_optional_range_support + #if !defined(__cpp_lib_destroying_delete) # if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete) # define __glibcxx_destroying_delete 201806L diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index ec76ab0..46bd5d5 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -3114,24 +3114,28 @@ namespace __format // _GLIBCXX_RESOLVE_LIB_DEFECTS // 3944. Formatters converting sequences of char to sequences of wchar_t - namespace __format { struct __disabled; } + struct __formatter_disabled + { + __formatter_disabled() = delete; // Cannot format char sequence to wchar_t + __formatter_disabled(const __formatter_disabled&) = delete; + __formatter_disabled& operator=(const __formatter_disabled&) = delete; + }; - // std::formatter<__disabled, C> uses the primary template, which is disabled. template<> struct formatter<char*, wchar_t> - : private formatter<__format::__disabled, wchar_t> { }; + : private __formatter_disabled { }; template<> struct formatter<const char*, wchar_t> - : private formatter<__format::__disabled, wchar_t> { }; + : private __formatter_disabled { }; template<size_t _Nm> struct formatter<char[_Nm], wchar_t> - : private formatter<__format::__disabled, wchar_t> { }; + : private __formatter_disabled { }; template<class _Traits, class _Allocator> struct formatter<basic_string<char, _Traits, _Allocator>, wchar_t> - : private formatter<__format::__disabled, wchar_t> { }; + : private __formatter_disabled { }; template<class _Traits> struct formatter<basic_string_view<char, _Traits>, wchar_t> - : private formatter<__format::__disabled, wchar_t> { }; + : private __formatter_disabled { }; #endif /// An iterator after the last character written, and the number of @@ -5479,32 +5483,6 @@ namespace __format #endif #if __glibcxx_format_ranges // C++ >= 23 && HOSTED - // [format.range], formatting of ranges - // [format.range.fmtkind], variable template format_kind - enum class range_format { - disabled, - map, - set, - sequence, - string, - debug_string - }; - - /** @brief A constant determining how a range should be formatted. - * - * The primary template of `std::format_kind` cannot be instantiated. - * There is a partial specialization for input ranges and you can - * specialize the variable template for your own cv-unqualified types - * that satisfy the `ranges::input_range` concept. - * - * @since C++23 - */ - template<typename _Rg> - constexpr auto format_kind = []{ - static_assert(false, "cannot use primary template of 'std::format_kind'"); - return type_identity<_Rg>{}; - }(); - /// @cond undocumented template<typename _Tp> consteval range_format diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index bcf2fa6..6dc2441 100644 --- a/libstdc++-v3/include/std/mdspan +++ b/libstdc++-v3/include/std/mdspan @@ -69,12 +69,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // // If __r is the index of a dynamic extent, then // _S_dynamic_index[__r] is the index of that extent in - // _M_dynamic_extents. + // _M_dyn_exts. static constexpr auto _S_dynamic_index = [] consteval { array<size_t, _S_rank+1> __ret; size_t __dyn = 0; - for(size_t __i = 0; __i < _S_rank; ++__i) + for (size_t __i = 0; __i < _S_rank; ++__i) { __ret[__i] = __dyn; __dyn += _S_is_dyn(_Extents[__i]); @@ -105,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { auto __se = _Extents[__r]; if (__se == dynamic_extent) - return _M_dynamic_extents[_S_dynamic_index[__r]]; + return _M_dyn_exts[_S_dynamic_index[__r]]; else return __se; } @@ -114,12 +114,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr void _M_init_dynamic_extents(_GetOtherExtent __get_extent) noexcept { - for(size_t __i = 0; __i < _S_rank_dynamic; ++__i) + for (size_t __i = 0; __i < _S_rank_dynamic; ++__i) { size_t __di = __i; if constexpr (_OtherRank != _S_rank_dynamic) __di = _S_dynamic_index_inv[__i]; - _M_dynamic_extents[__i] = _S_int_cast(__get_extent(__di)); + _M_dyn_exts[__i] = _S_int_cast(__get_extent(__di)); } } @@ -144,9 +144,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __exts[__i]; }); } + static constexpr span<const size_t> + _S_static_extents(size_t __begin, size_t __end) noexcept + { + return {_Extents.data() + __begin, _Extents.data() + __end}; + } + + constexpr span<const _IndexType> + _M_dynamic_extents(size_t __begin, size_t __end) const noexcept + requires (_Extents.size() > 0) + { + return {_M_dyn_exts + _S_dynamic_index[__begin], + _M_dyn_exts + _S_dynamic_index[__end]}; + } + private: using _S_storage = __array_traits<_IndexType, _S_rank_dynamic>::_Type; - [[no_unique_address]] _S_storage _M_dynamic_extents{}; + [[no_unique_address]] _S_storage _M_dyn_exts{}; }; template<typename _OIndexType, typename _SIndexType> @@ -160,6 +174,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION || _Extent <= numeric_limits<_IndexType>::max(); } + namespace __mdspan + { + template<typename _Extents> + constexpr span<const size_t> + __static_extents(size_t __begin = 0, size_t __end = _Extents::rank()) + noexcept + { return _Extents::_S_storage::_S_static_extents(__begin, __end); } + + template<typename _Extents> + constexpr span<const typename _Extents::index_type> + __dynamic_extents(const _Extents& __exts, size_t __begin = 0, + size_t __end = _Extents::rank()) noexcept + { + return __exts._M_exts._M_dynamic_extents(__begin, __end); + } + } + template<typename _IndexType, size_t... _Extents> class extents { @@ -197,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if constexpr (rank() == 0) __builtin_trap(); else - return _M_dynamic_extents._M_extent(__r); + return _M_exts._M_extent(__r); } constexpr @@ -233,14 +264,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION requires (_S_is_compatible_extents<_OExtents...>()) constexpr explicit(_S_ctor_explicit<_OIndexType, _OExtents...>()) extents(const extents<_OIndexType, _OExtents...>& __other) noexcept - : _M_dynamic_extents(__other._M_dynamic_extents) + : _M_exts(__other._M_exts) { } template<__mdspan::__valid_index_type<index_type>... _OIndexTypes> requires (sizeof...(_OIndexTypes) == rank() || sizeof...(_OIndexTypes) == rank_dynamic()) constexpr explicit extents(_OIndexTypes... __exts) noexcept - : _M_dynamic_extents(span<const _IndexType, sizeof...(_OIndexTypes)>( + : _M_exts(span<const _IndexType, sizeof...(_OIndexTypes)>( initializer_list{_S_storage::_S_int_cast(__exts)...})) { } @@ -248,15 +279,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION requires (_Nm == rank() || _Nm == rank_dynamic()) constexpr explicit(_Nm != rank_dynamic()) extents(span<_OIndexType, _Nm> __exts) noexcept - : _M_dynamic_extents(span<const _OIndexType, _Nm>(__exts)) + : _M_exts(span<const _OIndexType, _Nm>(__exts)) { } - template<__mdspan::__valid_index_type<index_type> _OIndexType, size_t _Nm> requires (_Nm == rank() || _Nm == rank_dynamic()) constexpr explicit(_Nm != rank_dynamic()) extents(const array<_OIndexType, _Nm>& __exts) noexcept - : _M_dynamic_extents(span<const _OIndexType, _Nm>(__exts)) + : _M_exts(span<const _OIndexType, _Nm>(__exts)) { } template<typename _OIndexType, size_t... _OExtents> @@ -276,9 +306,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } private: + friend span<const size_t> + __mdspan::__static_extents<extents>(size_t, size_t); + + friend span<const index_type> + __mdspan::__dynamic_extents<extents>(const extents&, size_t, size_t); + using _S_storage = __mdspan::_ExtentsStorage< _IndexType, array<size_t, sizeof...(_Extents)>{_Extents...}>; - [[no_unique_address]] _S_storage _M_dynamic_extents; + [[no_unique_address]] _S_storage _M_exts; template<typename _OIndexType, size_t... _OExtents> friend class extents; @@ -286,6 +322,69 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __mdspan { + template<typename _Tp, size_t _Nm> + constexpr bool + __contains_zero(span<_Tp, _Nm> __exts) noexcept + { + for (size_t __i = 0; __i < __exts.size(); ++__i) + if (__exts[__i] == 0) + return true; + return false; + } + + template<typename _Extents> + constexpr bool + __empty(const _Extents& __exts) noexcept + { + if constexpr (__contains_zero(__static_extents<_Extents>())) + return true; + else if constexpr (_Extents::rank_dynamic() > 0) + return __contains_zero(__dynamic_extents(__exts)); + else + return false; + } + + constexpr size_t + __static_extents_prod(const auto& __sta_exts) noexcept + { + size_t __ret = 1; + for (auto __factor : __sta_exts) + if (__factor != dynamic_extent) + __ret *= __factor; + return __ret; + } + + template<typename _Extents> + constexpr typename _Extents::index_type + __exts_prod(const _Extents& __exts, size_t __begin, size_t __end) noexcept + { + using _IndexType = typename _Extents::index_type; + + size_t __ret = 1; + if constexpr (_Extents::rank_dynamic() != _Extents::rank()) + { + auto __sta_exts = __static_extents<_Extents>(__begin, __end); + __ret = __static_extents_prod(__sta_exts); + if (__ret == 0) + return 0; + } + + if constexpr (_Extents::rank_dynamic() > 0) + for (auto __factor : __dynamic_extents(__exts, __begin, __end)) + __ret *= size_t(__factor); + return _IndexType(__ret); + } + + template<typename _Extents> + constexpr typename _Extents::index_type + __fwd_prod(const _Extents& __exts, size_t __r) noexcept + { return __exts_prod(__exts, 0, __r); } + + template<typename _Extents> + constexpr typename _Extents::index_type + __rev_prod(const _Extents& __exts, size_t __r) noexcept + { return __exts_prod(__exts, __r + 1, __exts.rank()); } + template<typename _IndexType, size_t... _Counts> auto __build_dextents_type(integer_sequence<size_t, _Counts...>) -> extents<_IndexType, ((void) _Counts, dynamic_extent)...>; @@ -304,6 +403,607 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit extents(_Integrals...) -> extents<size_t, __mdspan::__dynamic_extent<_Integrals>()...>; + struct layout_left + { + template<typename _Extents> + class mapping; + }; + + struct layout_right + { + template<typename _Extents> + class mapping; + }; + + struct layout_stride + { + template<typename _Extents> + class mapping; + }; + + namespace __mdspan + { + template<typename _Tp> + constexpr bool __is_extents = false; + + template<typename _IndexType, size_t... _Extents> + constexpr bool __is_extents<extents<_IndexType, _Extents...>> = true; + + template<typename _Extents, typename... _Indices> + constexpr typename _Extents::index_type + __linear_index_left(const _Extents& __exts, _Indices... __indices) + noexcept + { + using _IndexType = typename _Extents::index_type; + _IndexType __res = 0; + if constexpr (sizeof...(__indices) > 0) + { + _IndexType __mult = 1; + auto __update = [&, __pos = 0u](_IndexType __idx) mutable + { + __res += __idx * __mult; + __mult *= __exts.extent(__pos); + ++__pos; + }; + (__update(__indices), ...); + } + return __res; + } + + template<typename _Extents, + typename _IndexType = typename _Extents::index_type> + consteval _IndexType + __static_quotient(_IndexType __nom = numeric_limits<_IndexType>::max()) + { + auto __sta_exts = __static_extents<_Extents>(); + for (auto __factor : __sta_exts) + { + if (__factor != dynamic_extent) + __nom /= _IndexType(__factor); + if (__nom == 0) + break; + } + return __nom; + } + + template<typename _Extents> + constexpr bool + __is_representable_extents(const _Extents& __exts) noexcept + { + using _IndexType = _Extents::index_type; + + if constexpr (__contains_zero(__static_extents<_Extents>())) + return true; + else + { + constexpr auto __sta_quo = __static_quotient<_Extents>(); + if constexpr (_Extents::rank_dynamic() == 0) + return __sta_quo != 0; + else + { + auto __dyn_exts = __dynamic_extents(__exts); + if (__contains_zero(__dyn_exts)) + return true; + + if constexpr (__sta_quo == 0) + return false; + else + { + auto __dyn_quo = _IndexType(__sta_quo); + for (auto __factor : __dyn_exts) + { + __dyn_quo /= __factor; + if (__dyn_quo == 0) + return false; + } + return true; + } + } + } + } + + template<typename _Extents, typename _IndexType> + concept __representable_size = _Extents::rank_dynamic() != 0 + || __contains_zero(__static_extents<_Extents>()) + || (__static_quotient<_Extents, _IndexType>() != 0); + + template<typename _Layout, typename _Mapping> + concept __mapping_of = + is_same_v<typename _Layout::mapping<typename _Mapping::extents_type>, + _Mapping>; + + template<typename _Mapping> + concept __standardized_mapping = __mapping_of<layout_left, _Mapping> + || __mapping_of<layout_right, _Mapping> + || __mapping_of<layout_stride, _Mapping>; + + // A tag type to create internal ctors. + class __internal_ctor + { }; + } + + template<typename _Extents> + class layout_left::mapping + { + public: + using extents_type = _Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_left; + + static_assert(__mdspan::__representable_size<extents_type, index_type>, + "The size of extents_type must be representable as index_type"); + + constexpr + mapping() noexcept = default; + + constexpr + mapping(const mapping&) noexcept = default; + + constexpr + mapping(const extents_type& __extents) noexcept + : _M_extents(__extents) + { __glibcxx_assert(__mdspan::__is_representable_extents(_M_extents)); } + + template<typename _OExtents> + requires is_constructible_v<extents_type, _OExtents> + constexpr explicit(!is_convertible_v<_OExtents, extents_type>) + mapping(const mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { } + + template<typename _OExtents> + requires (extents_type::rank() <= 1) + && is_constructible_v<extents_type, _OExtents> + constexpr explicit(!is_convertible_v<_OExtents, extents_type>) + mapping(const layout_right::mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { } + + // noexcept for consistency with other layouts. + template<typename _OExtents> + requires is_constructible_v<extents_type, _OExtents> + constexpr explicit(extents_type::rank() > 0) + mapping(const layout_stride::mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { __glibcxx_assert(*this == __other); } + + constexpr mapping& + operator=(const mapping&) noexcept = default; + + constexpr const extents_type& + extents() const noexcept { return _M_extents; } + + constexpr index_type + required_span_size() const noexcept + { return __mdspan::__fwd_prod(_M_extents, extents_type::rank()); } + + template<__mdspan::__valid_index_type<index_type>... _Indices> + requires (sizeof...(_Indices) == extents_type::rank()) + constexpr index_type + operator()(_Indices... __indices) const noexcept + { + return __mdspan::__linear_index_left(_M_extents, + static_cast<index_type>(__indices)...); + } + + static constexpr bool + is_always_unique() noexcept { return true; } + + static constexpr bool + is_always_exhaustive() noexcept { return true; } + + static constexpr bool + is_always_strided() noexcept { return true; } + + static constexpr bool + is_unique() noexcept { return true; } + + static constexpr bool + is_exhaustive() noexcept { return true; } + + static constexpr bool + is_strided() noexcept { return true; } + + constexpr index_type + stride(rank_type __i) const noexcept + requires (extents_type::rank() > 0) + { + __glibcxx_assert(__i < extents_type::rank()); + return __mdspan::__fwd_prod(_M_extents, __i); + } + + template<typename _OExtents> + requires (extents_type::rank() == _OExtents::rank()) + friend constexpr bool + operator==(const mapping& __self, const mapping<_OExtents>& __other) + noexcept + { return __self.extents() == __other.extents(); } + + private: + template<typename _OExtents> + constexpr explicit + mapping(const _OExtents& __oexts, __mdspan::__internal_ctor) noexcept + : _M_extents(__oexts) + { + static_assert(__mdspan::__representable_size<_OExtents, index_type>, + "The size of OtherExtents must be representable as index_type"); + __glibcxx_assert(__mdspan::__is_representable_extents(_M_extents)); + } + + [[no_unique_address]] extents_type _M_extents{}; + }; + + namespace __mdspan + { + template<typename _Extents, typename... _Indices> + constexpr typename _Extents::index_type + __linear_index_right(const _Extents& __exts, _Indices... __indices) + noexcept + { + using _IndexType = typename _Extents::index_type; + array<_IndexType, sizeof...(__indices)> __ind_arr{__indices...}; + _IndexType __res = 0; + if constexpr (sizeof...(__indices) > 0) + { + _IndexType __mult = 1; + auto __update = [&, __pos = __exts.rank()](_IndexType) mutable + { + --__pos; + __res += __ind_arr[__pos] * __mult; + __mult *= __exts.extent(__pos); + }; + (__update(__indices), ...); + } + return __res; + } + } + + template<typename _Extents> + class layout_right::mapping + { + public: + using extents_type = _Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_right; + + static_assert(__mdspan::__representable_size<extents_type, index_type>, + "The size of extents_type must be representable as index_type"); + + constexpr + mapping() noexcept = default; + + constexpr + mapping(const mapping&) noexcept = default; + + constexpr + mapping(const extents_type& __extents) noexcept + : _M_extents(__extents) + { __glibcxx_assert(__mdspan::__is_representable_extents(_M_extents)); } + + template<typename _OExtents> + requires is_constructible_v<extents_type, _OExtents> + constexpr explicit(!is_convertible_v<_OExtents, extents_type>) + mapping(const mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { } + + template<typename _OExtents> + requires (extents_type::rank() <= 1) + && is_constructible_v<extents_type, _OExtents> + constexpr explicit(!is_convertible_v<_OExtents, extents_type>) + mapping(const layout_left::mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { } + + template<typename _OExtents> + requires is_constructible_v<extents_type, _OExtents> + constexpr explicit(extents_type::rank() > 0) + mapping(const layout_stride::mapping<_OExtents>& __other) noexcept + : mapping(__other.extents(), __mdspan::__internal_ctor{}) + { __glibcxx_assert(*this == __other); } + + constexpr mapping& + operator=(const mapping&) noexcept = default; + + constexpr const extents_type& + extents() const noexcept { return _M_extents; } + + constexpr index_type + required_span_size() const noexcept + { return __mdspan::__fwd_prod(_M_extents, extents_type::rank()); } + + template<__mdspan::__valid_index_type<index_type>... _Indices> + requires (sizeof...(_Indices) == extents_type::rank()) + constexpr index_type + operator()(_Indices... __indices) const noexcept + { + return __mdspan::__linear_index_right( + _M_extents, static_cast<index_type>(__indices)...); + } + + static constexpr bool + is_always_unique() noexcept + { return true; } + + static constexpr bool + is_always_exhaustive() noexcept + { return true; } + + static constexpr bool + is_always_strided() noexcept + { return true; } + + static constexpr bool + is_unique() noexcept + { return true; } + + static constexpr bool + is_exhaustive() noexcept + { return true; } + + static constexpr bool + is_strided() noexcept + { return true; } + + constexpr index_type + stride(rank_type __i) const noexcept + requires (extents_type::rank() > 0) + { + __glibcxx_assert(__i < extents_type::rank()); + return __mdspan::__rev_prod(_M_extents, __i); + } + + template<typename _OExtents> + requires (extents_type::rank() == _OExtents::rank()) + friend constexpr bool + operator==(const mapping& __self, const mapping<_OExtents>& __other) + noexcept + { return __self.extents() == __other.extents(); } + + private: + template<typename _OExtents> + constexpr explicit + mapping(const _OExtents& __oexts, __mdspan::__internal_ctor) noexcept + : _M_extents(__oexts) + { + static_assert(__mdspan::__representable_size<_OExtents, index_type>, + "The size of OtherExtents must be representable as index_type"); + __glibcxx_assert(__mdspan::__is_representable_extents(_M_extents)); + } + + [[no_unique_address]] extents_type _M_extents{}; + }; + + namespace __mdspan + { + template<typename _Mp> + concept __mapping_alike = requires + { + requires __is_extents<typename _Mp::extents_type>; + { _Mp::is_always_strided() } -> same_as<bool>; + { _Mp::is_always_exhaustive() } -> same_as<bool>; + { _Mp::is_always_unique() } -> same_as<bool>; + bool_constant<_Mp::is_always_strided()>::value; + bool_constant<_Mp::is_always_exhaustive()>::value; + bool_constant<_Mp::is_always_unique()>::value; + }; + + template<typename _Mapping> + constexpr typename _Mapping::index_type + __offset(const _Mapping& __m) noexcept + { + using _IndexType = typename _Mapping::index_type; + constexpr auto __rank = _Mapping::extents_type::rank(); + + if constexpr (__standardized_mapping<_Mapping>) + return 0; + else if (__empty(__m.extents())) + return 0; + else + { + auto __impl = [&__m]<size_t... _Counts>(index_sequence<_Counts...>) + { return __m(((void) _Counts, _IndexType(0))...); }; + return __impl(make_index_sequence<__rank>()); + } + } + + template<typename _Mapping, typename... _Indices> + constexpr typename _Mapping::index_type + __linear_index_strides(const _Mapping& __m, _Indices... __indices) + noexcept + { + using _IndexType = typename _Mapping::index_type; + _IndexType __res = 0; + if constexpr (sizeof...(__indices) > 0) + { + auto __update = [&, __pos = 0u](_IndexType __idx) mutable + { + __res += __idx * __m.stride(__pos++); + }; + (__update(__indices), ...); + } + return __res; + } + } + + template<typename _Extents> + class layout_stride::mapping + { + public: + using extents_type = _Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_stride; + + static_assert(__mdspan::__representable_size<extents_type, index_type>, + "The size of extents_type must be representable as index_type"); + + constexpr + mapping() noexcept + { + // The precondition is either statically asserted, or automatically + // satisfied because dynamic extents are zero-initialized. + size_t __stride = 1; + for (size_t __i = extents_type::rank(); __i > 0; --__i) + { + _M_strides[__i - 1] = index_type(__stride); + __stride *= size_t(_M_extents.extent(__i - 1)); + } + } + + constexpr + mapping(const mapping&) noexcept = default; + + template<__mdspan::__valid_index_type<index_type> _OIndexType> + constexpr + mapping(const extents_type& __exts, + span<_OIndexType, extents_type::rank()> __strides) noexcept + : _M_extents(__exts) + { + for (size_t __i = 0; __i < extents_type::rank(); ++__i) + _M_strides[__i] = index_type(as_const(__strides[__i])); + } + + template<__mdspan::__valid_index_type<index_type> _OIndexType> + constexpr + mapping(const extents_type& __exts, + const array<_OIndexType, extents_type::rank()>& __strides) + noexcept + : mapping(__exts, + span<const _OIndexType, extents_type::rank()>(__strides)) + { } + + template<__mdspan::__mapping_alike _StridedMapping> + requires (is_constructible_v<extents_type, + typename _StridedMapping::extents_type> + && _StridedMapping::is_always_unique() + && _StridedMapping::is_always_strided()) + constexpr explicit(!( + is_convertible_v<typename _StridedMapping::extents_type, extents_type> + && __mdspan::__standardized_mapping<_StridedMapping>)) + mapping(const _StridedMapping& __other) noexcept + : _M_extents(__other.extents()) + { + using _OIndexType = _StridedMapping::index_type; + using _OExtents = _StridedMapping::extents_type; + + __glibcxx_assert(__mdspan::__offset(__other) == 0); + static_assert(__mdspan::__representable_size<_OExtents, index_type>, + "The size of StridedMapping::extents_type must be representable as" + " index_type"); + if constexpr (cmp_greater(numeric_limits<_OIndexType>::max(), + numeric_limits<index_type>::max())) + __glibcxx_assert(!cmp_less(numeric_limits<index_type>::max(), + __other.required_span_size()) + && "other.required_span_size() must be representable" + " as index_type"); + if constexpr (extents_type::rank() > 0) + for (size_t __i = 0; __i < extents_type::rank(); ++__i) + _M_strides[__i] = index_type(__other.stride(__i)); + } + + constexpr mapping& + operator=(const mapping&) noexcept = default; + + constexpr const extents_type& + extents() const noexcept { return _M_extents; } + + constexpr array<index_type, extents_type::rank()> + strides() const noexcept + { + array<index_type, extents_type::rank()> __ret; + for (size_t __i = 0; __i < extents_type::rank(); ++__i) + __ret[__i] = _M_strides[__i]; + return __ret; + } + + constexpr index_type + required_span_size() const noexcept + { + if (__mdspan::__empty(_M_extents)) + return 0; + + index_type __ret = 1; + for (size_t __i = 0; __i < extents_type::rank(); ++__i) + __ret += (_M_extents.extent(__i) - 1) * _M_strides[__i]; + return __ret; + } + + template<__mdspan::__valid_index_type<index_type>... _Indices> + requires (sizeof...(_Indices) == extents_type::rank()) + constexpr index_type + operator()(_Indices... __indices) const noexcept + { + return __mdspan::__linear_index_strides(*this, + static_cast<index_type>(__indices)...); + } + + static constexpr bool + is_always_unique() noexcept { return true; } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4266. layout_stride::mapping should treat empty mappings as exhaustive + static constexpr bool + is_always_exhaustive() noexcept + { + return (_Extents::rank() == 0) || __mdspan::__contains_zero( + __mdspan::__static_extents<extents_type>()); + } + + static constexpr bool + is_always_strided() noexcept { return true; } + + static constexpr bool + is_unique() noexcept { return true; } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4266. layout_stride::mapping should treat empty mappings as exhaustive + constexpr bool + is_exhaustive() const noexcept + { + if constexpr (!is_always_exhaustive()) + { + constexpr auto __rank = extents_type::rank(); + auto __size = __mdspan::__fwd_prod(_M_extents, __rank); + if(__size > 0) + return __size == required_span_size(); + } + return true; + } + + static constexpr bool + is_strided() noexcept { return true; } + + constexpr index_type + stride(rank_type __r) const noexcept { return _M_strides[__r]; } + + template<__mdspan::__mapping_alike _OMapping> + requires ((extents_type::rank() == _OMapping::extents_type::rank()) + && _OMapping::is_always_strided()) + friend constexpr bool + operator==(const mapping& __self, const _OMapping& __other) noexcept + { + if (__self.extents() != __other.extents()) + return false; + if constexpr (extents_type::rank() > 0) + for (size_t __i = 0; __i < extents_type::rank(); ++__i) + if (!cmp_equal(__self.stride(__i), __other.stride(__i))) + return false; + return __mdspan::__offset(__other) == 0; + } + + private: + using _S_strides_t = typename __array_traits<index_type, + extents_type::rank()>::_Type; + [[no_unique_address]] extents_type _M_extents; + [[no_unique_address]] _S_strides_t _M_strides; + }; + _GLIBCXX_END_NAMESPACE_VERSION } #endif diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index a616dc0..cc7af5b 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -36,6 +36,7 @@ #define __glibcxx_want_freestanding_optional #define __glibcxx_want_optional +#define __glibcxx_want_optional_range_support #define __glibcxx_want_constrained_equality #include <bits/version.h> @@ -57,6 +58,11 @@ #if __cplusplus > 202002L # include <concepts> #endif +#ifdef __cpp_lib_optional_range_support // C++ >= 26 +# include <bits/formatfwd.h> +# include <bits/ranges_base.h> +# include <bits/stl_iterator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -858,6 +864,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: using value_type = _Tp; +#ifdef __cpp_lib_optional_range_support // >= C++26 + using iterator = __gnu_cxx::__normal_iterator<_Tp*, optional>; + using const_iterator = __gnu_cxx::__normal_iterator<const _Tp*, optional>; +#endif constexpr optional() noexcept { } @@ -1158,6 +1168,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } +#ifdef __cpp_lib_optional_range_support // >= C++26 + // Iterator support. + constexpr iterator begin() noexcept + { + return iterator( + this->_M_is_engaged() ? std::addressof(this->_M_get()) : nullptr + ); + } + + constexpr const_iterator begin() const noexcept + { + return const_iterator( + this->_M_is_engaged() ? std::addressof(this->_M_get()) : nullptr + ); + } + + constexpr iterator end() noexcept + { + return begin() + has_value(); + } + + constexpr const_iterator end() const noexcept + { + return begin() + has_value(); + } +#endif // __cpp_lib_optional_range_support + // Observers. constexpr const _Tp* operator->() const noexcept @@ -1772,6 +1809,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template <typename _Tp> optional(_Tp) -> optional<_Tp>; #endif +#ifdef __cpp_lib_optional_range_support // >= C++26 + template<typename _Tp> + inline constexpr bool + ranges::enable_view<optional<_Tp>> = true; + + template<typename _Tp> + inline constexpr range_format + format_kind<optional<_Tp>> = range_format::disabled; +#endif // __cpp_lib_optional_range_support + #undef _GLIBCXX_USE_CONSTRAINTS_FOR_OPTIONAL _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream index aee0986..b1b4126 100644 --- a/libstdc++-v3/include/std/sstream +++ b/libstdc++-v3/include/std/sstream @@ -165,7 +165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer explicit basic_stringbuf(const allocator_type& __a) : basic_stringbuf(ios_base::in | std::ios_base::out, __a) @@ -233,7 +233,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #endif // C++26 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a) : basic_stringbuf(std::move(__rhs), __a, __xfer_bufptrs(__rhs, this)) { __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); } @@ -572,7 +572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer // The move constructor initializes an __xfer_bufptrs temporary then // delegates to this constructor to performs moves during its lifetime. @@ -693,7 +693,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { __istream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer basic_istringstream(ios_base::openmode __mode, const allocator_type& __a) : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a) { this->init(std::__addressof(_M_stringbuf)); } @@ -959,7 +959,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { __ostream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a) : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a) { this->init(std::__addressof(_M_stringbuf)); } @@ -1221,7 +1221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { __iostream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - // P0408 Efficient access to basic_stringbuf buffer + // P0408 Efficient access to basic_stringbuf buffer basic_stringstream(ios_base::openmode __mode, const allocator_type& __a) : __iostream_type(), _M_stringbuf(__mode, __a) { this->init(std::__addressof(_M_stringbuf)); } diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index c8907fe..abff9f8 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1036,6 +1036,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_array_unknown_bounds<_Tp[]> : public true_type { }; + /// @endcond // Destructible and constructible type properties. @@ -1046,6 +1047,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __bool_constant<__is_destructible(_Tp)> { }; #else + /// @cond undocumented + // In N3290 is_destructible does not say anything about function // types and abstract types, see LWG 2049. This implementation // describes function types as non-destructible and all complete diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index 246c9b1..8c3bb33 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -164,9 +164,9 @@ _GLIBCXX_END_NAMESPACE_VERSION } // extern "C++" -#if (__cplusplus >= 201103L) -#include <bits/exception_ptr.h> -#include <bits/nested_exception.h> +#if __cplusplus >= 201103L +# include <bits/exception_ptr.h> +# include <bits/nested_exception.h> #endif #endif diff --git a/libstdc++-v3/scripts/create_testsuite_files b/libstdc++-v3/scripts/create_testsuite_files index 174c24e..ae259c6 100755 --- a/libstdc++-v3/scripts/create_testsuite_files +++ b/libstdc++-v3/scripts/create_testsuite_files @@ -3,9 +3,7 @@ # Constructs lists of source files (full pathnames) to test. Two # files are constructed: testsuite_files, which is used to test with # the default dg-runtest command, and testsuite_files_interactive, -# which is used to test cases that require input to be entered. In -# addition, both lists are pruned of wchar_t tests if the toolchain -# under test does not support wchar_t functionality. +# which is used to test cases that require input to be entered. # # We mimic the mkcheck script in that the first time this is run, all # existing files are listed in "testsuite_files" in the output diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in index 4cd3e52..109f590 100644 --- a/libstdc++-v3/src/c++23/std.cc.in +++ b/libstdc++-v3/src/c++23/std.cc.in @@ -1840,7 +1840,10 @@ export namespace std export namespace std { using std::extents; - // FIXME layout_*, default_accessor and mdspan + using std::layout_left; + using std::layout_right; + using std::layout_stride; + // FIXME layout_left_padded, layout_right_padded, default_accessor and mdspan } #endif diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index f32205d..e94da9d 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -404,4 +404,8 @@ # endif #endif +// PR libstdc++/119496 +// _Temporary_buffer used to have a member with this name +#define requested_size 1 + #include <bits/stdc++.h> diff --git a/libstdc++-v3/testsuite/20_util/optional/range.cc b/libstdc++-v3/testsuite/20_util/optional/range.cc new file mode 100644 index 0000000..e77dc21 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/optional/range.cc @@ -0,0 +1,163 @@ +// { dg-do compile { target c++26 } } + +#include <concepts> +#include <format> +#include <iterator> +#include <optional> +#include <ranges> +#include <string_view> +#include <vector> + +#include <testsuite_hooks.h> + +template<typename O> +constexpr +void +test_range_concepts() +{ + static_assert(std::ranges::contiguous_range<O>); + static_assert(std::ranges::sized_range<O>); + static_assert(std::ranges::common_range<O>); + static_assert(!std::ranges::borrowed_range<O>); + + // an optional<const T> is not assignable, and therefore does not satisfy ranges::view + using T = typename O::value_type; + constexpr bool is_const_opt = std::is_const_v<T>; + static_assert(std::ranges::view<O> == !is_const_opt); + static_assert(std::ranges::viewable_range<O> == !is_const_opt); +} + +template<typename O> +constexpr +void +test_iterator_concepts() +{ + using T = typename O::value_type; + using iterator = typename O::iterator; + static_assert(std::contiguous_iterator<iterator>); + static_assert(std::is_same_v<typename std::iterator_traits<iterator>::value_type, std::remove_cv_t<T>>); + static_assert(std::is_same_v<std::iter_value_t<iterator>, std::remove_cv_t<T>>); + static_assert(std::is_same_v<typename std::iterator_traits<iterator>::reference, T&>); + static_assert(std::is_same_v<std::iter_reference_t<iterator>, T&>); + + using const_iterator = typename O::const_iterator; + static_assert(std::contiguous_iterator<const_iterator>); + static_assert(std::is_same_v<typename std::iterator_traits<const_iterator>::value_type, std::remove_cv_t<T>>); + static_assert(std::is_same_v<std::iter_value_t<const_iterator>, std::remove_cv_t<T>>); + static_assert(std::is_same_v<typename std::iterator_traits<const_iterator>::reference, const T&>); + static_assert(std::is_same_v<std::iter_reference_t<const_iterator>, const T&>); +} + +template<typename O> +constexpr +void +test_empty() +{ + O empty; + VERIFY(!empty); + VERIFY(empty.begin() == empty.end()); + VERIFY(std::as_const(empty).begin() == std::as_const(empty).end()); + VERIFY(std::ranges::empty(empty)); + VERIFY(std::ranges::empty(std::as_const(empty))); + VERIFY(std::ranges::empty(empty | std::views::as_const)); + VERIFY(std::ranges::size(empty) == 0); + VERIFY(std::ranges::size(std::as_const(empty)) == 0); + + size_t count = 0; + for (const auto& x : empty) + ++count; + VERIFY(count == 0); +} + +template<typename O, typename T> +constexpr +void +test_non_empty(const T& value) +{ + O non_empty = std::make_optional(value); + VERIFY(non_empty); + VERIFY(*non_empty == value); + VERIFY(non_empty.begin() != non_empty.end()); + VERIFY(non_empty.begin() < non_empty.end()); + VERIFY(std::as_const(non_empty).begin() != std::as_const(non_empty).end()); + VERIFY(std::as_const(non_empty).begin() < std::as_const(non_empty).end()); + VERIFY(!std::ranges::empty(non_empty)); + VERIFY(!std::ranges::empty(std::as_const(non_empty))); + VERIFY(!std::ranges::empty(non_empty | std::views::as_const)); + VERIFY(std::ranges::size(non_empty) == 1); + VERIFY(std::ranges::size(std::as_const(non_empty)) == 1); + + size_t count = 0; + for (const auto& x : non_empty) + ++count; + VERIFY(count == 1); + + if constexpr (!std::is_const_v<typename O::value_type>) { + for (auto& x : non_empty) + x = T{}; + VERIFY(non_empty); + VERIFY(*non_empty == T{}); + } +} + +template<typename T> +constexpr +void +test(const T& value) +{ + using O = std::optional<T>; + test_range_concepts<O>(); + test_iterator_concepts<O>(); + test_empty<O>(); + test_non_empty<O>(value); + static_assert(!std::formattable<O, char>); + static_assert(!std::formattable<O, wchar_t>); + static_assert(std::format_kind<O> == std::range_format::disabled); +} + +constexpr +void +range_chain_example() // from P3168 +{ + std::vector<int> v{2, 3, 4, 5, 6, 7, 8, 9, 1}; + auto test = [](int i) -> std::optional<int> { + switch(i) { + case 1: + case 3: + case 7: + case 9: + return i * 2; + default: + return {}; + } + }; + + auto result = v + | std::views::transform(test) + | std::views::filter([](auto x) { return bool(x); }) + | std::views::transform([](auto x){ return *x; }) + | std::ranges::to<std::vector>(); + + bool ok = result == std::vector<int>{6, 14, 18, 2}; + VERIFY(ok); +} + +constexpr +bool +all_tests() +{ + test(42); + int i = 42; + test(&i); + test(std::string_view("test")); + test(std::vector<int>{1, 2, 3, 4}); + test(std::optional<int>(42)); + test<const int>(42); + + range_chain_example(); + + return true; +} + +static_assert(all_tests()); + diff --git a/libstdc++-v3/testsuite/20_util/optional/version.cc b/libstdc++-v3/testsuite/20_util/optional/version.cc index 657a399..ba44aa5 100644 --- a/libstdc++-v3/testsuite/20_util/optional/version.cc +++ b/libstdc++-v3/testsuite/20_util/optional/version.cc @@ -21,8 +21,17 @@ #endif #endif +#if __cplusplus > 202302L +# ifndef __cpp_lib_optional_range_support +# error "Feature test macro for optional range support is missing in <version>" +# elif __cpp_lib_optional_range_support != 202406L +# error "Feature test macro for optional range support has wrong value for C++26 in <version>" +# endif +#endif + #undef __cpp_lib_optional #undef __cpp_lib_freestanding_optional +#undef __cpp_lib_optional_range_support #include <optional> #if __cplusplus >= 202302L @@ -32,3 +41,12 @@ # error "Feature test macro for freestanding std::optional has wrong value in <optional>" #endif #endif + +#if __cplusplus > 202302L +# ifndef __cpp_lib_optional_range_support +# error "Feature test macro for optional range support is missing in <optional>" +# endif +# if __cpp_lib_optional_range_support != 202406L +# error "Feature test macro for optional range support has wrong value for C++26 in <optional>" +# endif +#endif diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_n_neg.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_n_neg.cc new file mode 100644 index 0000000..12c0dc5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_n_neg.cc @@ -0,0 +1,59 @@ +// Copyright (C) 2017-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do compile { target c++17 } } + +#include <memory> + +// This has a trivial destructor, but should not be destructible! +struct DeletedDtor { + ~DeletedDtor() = delete; +}; + +void +test01() +{ + alignas(DeletedDtor) unsigned char buf[sizeof(DeletedDtor)]; + auto p = ::new (buf) DeletedDtor(); + std::destroy_n(p, 1); +} + +class PrivateDtor { + ~PrivateDtor() { } +}; + +void +test02() +{ + alignas(PrivateDtor) unsigned char buf[sizeof(PrivateDtor)]; + auto p = ::new (buf) PrivateDtor(); + std::destroy_n(p, 1); +} + +#if __cpp_constexpr_dynamic_alloc // >= C++20 +consteval bool +test03() +{ + DeletedDtor* p = nullptr; + std::destroy_n(p, 0); + return true; +} +static_assert(test03()); +#endif + +// { dg-error "deleted function .*DeletedDtor" "" { target *-*-* } 0 } +// { dg-error "PrivateDtor.* is private" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc index 5946a82..096f218 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc @@ -29,8 +29,7 @@ test01() { alignas(DeletedDtor) unsigned char buf[sizeof(DeletedDtor)]; auto p = ::new (buf) DeletedDtor(); - std::destroy(p, p + 1); // { dg-error "here" } - std::destroy_n(p, 1); // { dg-error "here" } + std::destroy(p, p + 1); } class PrivateDtor { @@ -42,8 +41,19 @@ test02() { alignas(PrivateDtor) unsigned char buf[sizeof(PrivateDtor)]; auto p = ::new (buf) PrivateDtor(); - std::destroy(p, p + 1); // { dg-error "here" } - std::destroy_n(p, 1); // { dg-error "here" } + std::destroy(p, p + 1); } -// { dg-error "value type is destructible" "" { target *-*-* } 0 } +#if __cpp_constexpr_dynamic_alloc // >= C++20 +consteval bool +test03() +{ + DeletedDtor* p = nullptr; + std::destroy(p, p); + return true; +} +static_assert(test03()); +#endif + +// { dg-error "deleted function .*DeletedDtor" "" { target *-*-* } 0 } +// { dg-error "PrivateDtor.* is private" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/120397.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/120397.cc new file mode 100644 index 0000000..7aa05d7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/120397.cc @@ -0,0 +1,19 @@ +// { dg-do compile { target c++17 } } + +#include <memory> + +// PR libstdc++/120397 +// std::uninitialized_value_construct cannot create arrays of non-trivially +// destructible types + +struct X { X() { } ~X() { } }; + +void def(X (*x)[1]) +{ + std::uninitialized_default_construct(x, x+1); +} + +void def_n(X (*x)[1]) +{ + std::uninitialized_default_construct_n(x, 1); +} diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/120397.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/120397.cc new file mode 100644 index 0000000..f4d9fce --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/120397.cc @@ -0,0 +1,19 @@ +// { dg-do compile { target c++17 } } + +#include <memory> + +// PR libstdc++/120397 +// std::uninitialized_value_construct cannot create arrays of non-trivially +// destructible types + +struct X { X() { } ~X() { } }; + +void val(X (*x)[1]) +{ + std::uninitialized_value_construct(x, x+1); +} + +void val_n(X (*x)[1]) +{ + std::uninitialized_value_construct_n(x, 1); +} diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc b/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc index eec300f..f45d3e5 100644 --- a/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc +++ b/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc @@ -15,7 +15,7 @@ template<typename Extents> if(exts.static_extent(i) == std::dynamic_extent) VERIFY(exts.extent(i) == 0); else - VERIFY(exts.extent(i) == Extents::static_extent(i)); + VERIFY(std::cmp_equal(exts.extent(i), Extents::static_extent(i))); } constexpr bool diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc new file mode 100644 index 0000000..7091153 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc @@ -0,0 +1,48 @@ +// { dg-do compile { target c++23 } } +#include<mdspan> + +#include <cstdint> + +constexpr size_t dyn = std::dynamic_extent; +static constexpr size_t n = std::numeric_limits<uint8_t>::max() / 2; + +template<typename Layout> + struct A + { + typename Layout::mapping<std::extents<uint8_t, n, 2>> m0; + typename Layout::mapping<std::extents<uint8_t, n, 2, dyn>> m1; + typename Layout::mapping<std::extents<uint8_t, n, 2, 0>> m2; + + using extents_type = std::extents<uint8_t, n, 4>; + typename Layout::mapping<extents_type> m3; // { dg-error "required from" } + }; + +template<size_t Count, typename Layout, typename OLayout> + bool + B() + { + using Extents = std::extents<uint8_t, dyn, dyn, Count>; + using OExtents = std::extents<uint16_t, n, 4, Count>; + + using Mapping = typename Layout::mapping<Extents>; + using OMapping = typename OLayout::mapping<OExtents>; + + Mapping m{OMapping{}}; + return true; + }; + +A<std::layout_left> a_left; // { dg-error "required from" } +A<std::layout_right> a_right; // { dg-error "required from" } +A<std::layout_stride> a_stride; // { dg-error "required from" } + +auto b1 = B<1, std::layout_left, std::layout_left>(); // { dg-error "required from" } +auto b2 = B<2, std::layout_left, std::layout_stride>(); // { dg-error "required from" } + +auto b3 = B<3, std::layout_right, std::layout_right>(); // { dg-error "required from" } +auto b4 = B<4, std::layout_right, std::layout_stride>(); // { dg-error "required from" } + +auto b5 = B<5, std::layout_stride, std::layout_right>(); // { dg-error "required from" } +auto b6 = B<6, std::layout_stride, std::layout_left>(); // { dg-error "required from" } +auto b7 = B<7, std::layout_stride, std::layout_stride>(); // { dg-error "required from" } + +// { dg-prune-output "must be representable as index_type" } diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/ctors.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/ctors.cc new file mode 100644 index 0000000..23c0a55 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/ctors.cc @@ -0,0 +1,436 @@ +// { dg-do run { target c++23 } } +#include <mdspan> + +#include <cstdint> +#include <testsuite_hooks.h> + +constexpr size_t dyn = std::dynamic_extent; + +template<typename Mapping, typename IndexType, size_t... Extents> + constexpr void + verify(std::extents<IndexType, Extents...> oexts) + { + auto m = Mapping(oexts); + VERIFY(m.extents() == oexts); + } + +template<typename Mapping, typename OMapping> + requires (requires { typename OMapping::layout_type; }) + constexpr void + verify(OMapping other) + { + constexpr auto rank = Mapping::extents_type::rank(); + auto m = Mapping(other); + VERIFY(m.extents() == other.extents()); + if constexpr (rank > 0) + for(size_t i = 0; i < rank; ++i) + VERIFY(std::cmp_equal(m.stride(i), other.stride(i))); + } + + +template<typename To, typename From> + constexpr void + verify_convertible(From from) + { + static_assert(std::is_convertible_v<From, To>); + verify<To>(from); + } + +template<typename To, typename From> + constexpr void + verify_nothrow_convertible(From from) + { + static_assert(std::is_nothrow_constructible_v<To, From>); + verify_convertible<To>(from); + } + +template<typename To, typename From> + constexpr void + verify_constructible(From from) + { + static_assert(!std::is_convertible_v<From, To>); + static_assert(std::is_constructible_v<To, From>); + verify<To>(from); + } + +template<typename To, typename From> + constexpr void + verify_nothrow_constructible(From from) + { + static_assert(std::is_nothrow_constructible_v<To, From>); + verify_constructible<To>(from); + } + +template<typename Mapping, typename OExtents> + constexpr void + assert_not_constructible() + { + static_assert(!std::is_constructible_v<Mapping, OExtents>); + } + +// ctor: mapping() +namespace default_ctor +{ + template<typename Layout, typename Extents> + constexpr void + test_default_ctor() + { + using Mapping = typename Layout::mapping<Extents>; + + Mapping m; + for(size_t i = 0; i < Extents::rank(); ++i) + if (Extents::static_extent(i) == std::dynamic_extent) + VERIFY(m.extents().extent(i) == 0); + else + VERIFY(m.extents().static_extent(i) == Extents::static_extent(i)); + } + + template<typename Layout> + constexpr bool + test_default_ctor_all() + { + test_default_ctor<Layout, std::extents<int, dyn>>(); + test_default_ctor<Layout, std::extents<int, 1, 2>>(); + test_default_ctor<Layout, std::extents<int, dyn, 2>>(); + test_default_ctor<Layout, std::extents<int, dyn, dyn>>(); + test_default_ctor<Layout, std::extents<int, dyn, 2, dyn>>(); + test_default_ctor<Layout, std::extents<int, dyn, dyn, dyn>>(); + return true; + } + + template<typename Layout> + constexpr void + test_all() + { + test_default_ctor_all<Layout>(); + static_assert(test_default_ctor_all<Layout>()); + } +} + +// ctor: mapping(const extents&) +namespace from_extents +{ + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_convertible(OExtents oexts) + { + using Mapping = typename Layout::mapping<Extents>; + ::verify_nothrow_convertible<Mapping>(oexts); + } + + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_constructible(OExtents oexts) + { + using Mapping = typename Layout::mapping<Extents>; + ::verify_nothrow_constructible<Mapping>(oexts); + } + + template<typename Layout, typename Extents, typename OExtents> + constexpr void + assert_not_constructible() + { + using Mapping = typename Layout::mapping<Extents>; + ::assert_not_constructible<Mapping, OExtents>(); + } + + template<typename Layout> + constexpr bool + test_ctor() + { + verify_nothrow_convertible<Layout, std::extents<int>>( + std::extents<int>{}); + + verify_nothrow_convertible<Layout, std::extents<int, 2>>( + std::extents<int, 2>{}); + + verify_nothrow_convertible<Layout, std::extents<int, dyn, 3>>( + std::extents<int, dyn, 3>{2}); + + verify_nothrow_constructible<Layout, std::extents<unsigned int>>( + std::extents<int>{}); + + verify_nothrow_constructible<Layout, std::extents<int, dyn>>( + std::extents<int, 2>{}); + + verify_nothrow_constructible<Layout, std::extents<int, dyn, 3>>( + std::extents<int, 2, 3>{}); + + assert_not_constructible<Layout, std::extents<int>, + std::extents<unsigned int>>(); + assert_not_constructible<Layout, std::extents<int, 2>, + std::extents<int, dyn>>(); + assert_not_constructible<Layout, std::extents<int, 2, 3>, + std::extents<int, dyn, 3>>(); + return true; + } + + template<typename Layout, typename Extents> + constexpr void + assert_deducible(Extents exts) + { + typename Layout::mapping m(exts); + static_assert(std::same_as<decltype(m), + typename Layout::mapping<Extents>>); + } + + template<typename Layout> + constexpr void + test_deducible() + { + assert_deducible<Layout>(std::extents<int>()); + assert_deducible<Layout>(std::extents<int, 1>()); + assert_deducible<Layout>(std::extents<int, 1, 2, dyn>(3)); + } + + template<typename Layout> + constexpr void + test_all() + { + test_ctor<Layout>(); + static_assert(test_ctor<Layout>()); + test_deducible<Layout>(); + } +} + +// ctor: mapping(mapping<OExtents>) +namespace from_same_layout +{ + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_convertible(OExtents exts) + { + using Mapping = typename Layout::mapping<Extents>; + using OMapping = typename Layout::mapping<OExtents>; + + ::verify_nothrow_convertible<Mapping>(OMapping(exts)); + } + + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_constructible(OExtents exts) + { + using Mapping = typename Layout::mapping<Extents>; + using OMapping = typename Layout::mapping<OExtents>; + + ::verify_nothrow_constructible<Mapping>(OMapping(exts)); + } + + template<typename Layout> + constexpr bool + test_ctor() + { + verify_nothrow_convertible<Layout, std::extents<unsigned int>>( + std::extents<int>{}); + + verify_nothrow_constructible<Layout, std::extents<int>>( + std::extents<unsigned int>{}); + + assert_not_constructible< + typename Layout::mapping<std::extents<int>>, + typename Layout::mapping<std::extents<int, 1>>>(); + + assert_not_constructible< + typename Layout::mapping<std::extents<int, 1>>, + typename Layout::mapping<std::extents<int>>>(); + + verify_nothrow_constructible<Layout, std::extents<int, 1>>( + std::extents<int, dyn>{1}); + + verify_nothrow_convertible<Layout, std::extents<int, dyn>>( + std::extents<int, 1>{}); + + assert_not_constructible< + typename Layout::mapping<std::extents<int, 1, 2>>, + typename Layout::mapping<std::extents<int, 1>>>(); + + verify_nothrow_constructible<Layout, std::extents<int, 1, 2>>( + std::extents<int, dyn, 2>{1}); + + verify_nothrow_convertible<Layout, std::extents<int, dyn, 2>>( + std::extents<int, 1, 2>{}); + return true; + } + + template<typename Layout> + constexpr void + test_all() + { + test_ctor<Layout>(); + static_assert(test_ctor<Layout>()); + } +} + +// ctor: mapping(layout_{right,left}::mapping<OExtents>) +namespace from_left_or_right +{ + template<typename SLayout, typename OLayout, typename SExtents, + typename OExtents> + constexpr void + verify_ctor(OExtents oexts) + { + using SMapping = typename SLayout::mapping<SExtents>; + using OMapping = typename OLayout::mapping<OExtents>; + + constexpr bool expected = std::is_convertible_v<OExtents, SExtents>; + if constexpr (expected) + verify_nothrow_convertible<SMapping>(OMapping(oexts)); + else + verify_nothrow_constructible<SMapping>(OMapping(oexts)); + } + + template<typename SLayout, typename OLayout> + constexpr bool + test_ctor() + { + assert_not_constructible< + typename SLayout::mapping<std::extents<int>>, + typename OLayout::mapping<std::extents<int, 1>>>(); + + verify_ctor<OLayout, SLayout, std::extents<int>>( + std::extents<unsigned int>{}); + + verify_ctor<OLayout, SLayout, std::extents<unsigned int>>( + std::extents<int>{}); + + assert_not_constructible< + typename SLayout::mapping<std::extents<int, 1>>, + typename OLayout::mapping<std::extents<int>>>(); + + verify_ctor<OLayout, SLayout, std::extents<int, 1>>( + std::extents<int, 1>{}); + + verify_ctor<OLayout, SLayout, std::extents<int, 1>>( + std::extents<unsigned int, 1>{}); + + verify_ctor<OLayout, SLayout, std::extents<unsigned int, 1>>( + std::extents<int, 1>{}); + + assert_not_constructible< + typename SLayout::mapping<std::extents<int, 1, 2>>, + typename OLayout::mapping<std::extents<int, 1, 2>>>(); + return true; + } + + template<typename SLayout, typename OLayout> + constexpr void + test_all() + { + test_ctor<SLayout, OLayout>(); + static_assert(test_ctor<SLayout, OLayout>()); + } +} + +// ctor: mapping(layout_stride::mapping<OExtents>) +namespace from_stride +{ + template<typename Mapping> + constexpr auto + strides(Mapping m) + { + constexpr auto rank = Mapping::extents_type::rank(); + std::array<typename Mapping::index_type, rank> s; + + if constexpr (rank > 0) + for(size_t i = 0; i < rank; ++i) + s[i] = m.stride(i); + return s; + } + + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_convertible(OExtents oexts) + { + using Mapping = typename Layout::mapping<Extents>; + using OMapping = std::layout_stride::mapping<OExtents>; + + constexpr auto other = OMapping(oexts, strides(Mapping(Extents(oexts)))); + ::verify_nothrow_convertible<Mapping>(other); + } + + template<typename Layout, typename Extents, typename OExtents> + constexpr void + verify_nothrow_constructible(OExtents oexts) + { + using Mapping = typename Layout::mapping<Extents>; + using OMapping = std::layout_stride::mapping<OExtents>; + + constexpr auto other = OMapping(oexts, strides(Mapping(Extents(oexts)))); + ::verify_nothrow_constructible<Mapping>(other); + } + + template<typename Layout> + constexpr bool + test_ctor() + { + assert_not_constructible< + typename Layout::mapping<std::extents<int>>, + std::layout_stride::mapping<std::extents<int, 1>>>(); + + assert_not_constructible< + typename Layout::mapping<std::extents<int, 1>>, + std::layout_stride::mapping<std::extents<int>>>(); + + assert_not_constructible< + typename Layout::mapping<std::extents<int, 2>>, + std::layout_stride::mapping<std::extents<int, 1>>>(); + + verify_nothrow_convertible<Layout, std::extents<int>>( + std::extents<int>{}); + + verify_nothrow_convertible<Layout, std::extents<unsigned int>>( + std::extents<int>{}); + + // Rank == 0 doesn't check IndexType for convertibility. + verify_nothrow_convertible<Layout, std::extents<int>>( + std::extents<unsigned int>{}); + + verify_nothrow_constructible<Layout, std::extents<int, 3>>( + std::extents<int, 3>{}); + + verify_nothrow_constructible<Layout, std::extents<unsigned int, 3>>( + std::extents<int, 3>{}); + + verify_nothrow_constructible<Layout, std::extents<int, 3>>( + std::extents<unsigned int, 3>{}); + + verify_nothrow_constructible<Layout, std::extents<int, 3, 5>>( + std::extents<int, 3, 5>{}); + + verify_nothrow_constructible<Layout, std::extents<unsigned int, 3, 5>>( + std::extents<int, 3, 5>{}); + + verify_nothrow_constructible<Layout, std::extents<int, 3, 5>>( + std::extents<unsigned int, 3, 5>{}); + return true; + } + + template<typename Layout> + constexpr void + test_all() + { + test_ctor<Layout>(); + static_assert(test_ctor<Layout>()); + } +} + +template<typename Layout> + constexpr void + test_all() + { + default_ctor::test_all<Layout>(); + from_extents::test_all<Layout>(); + from_same_layout::test_all<Layout>(); + from_stride::test_all<Layout>(); + } + +int +main() +{ + test_all<std::layout_left>(); + test_all<std::layout_right>(); + + from_left_or_right::test_all<std::layout_left, std::layout_right>(); + from_left_or_right::test_all<std::layout_right, std::layout_left>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/empty.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/empty.cc new file mode 100644 index 0000000..655b9b6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/empty.cc @@ -0,0 +1,131 @@ +// { dg-do run { target c++23 } } +#include <mdspan> + +#include <cstdint> +#include <algorithm> +#include <testsuite_hooks.h> + +constexpr size_t dyn = std::dynamic_extent; + +template<typename Mapping> + constexpr void + invoke_stride(Mapping m) + { + // Only checking for UB, e.g. signed overflow. + for(size_t i = 0; i < Mapping::extents_type::rank(); ++i) + m.stride(i); + } + +template<typename Mapping> + constexpr void + verify_required_span_size(Mapping m) + { VERIFY(m.required_span_size() == 0); } + +template<typename Mapping> + constexpr void + verify_all(Mapping m) + { + verify_required_span_size(m); + invoke_stride(m); + } + +template<typename Layout, typename Int> +constexpr void +test_static_overflow() +{ + constexpr Int n1 = std::numeric_limits<Int>::max(); + constexpr size_t n2 = std::dynamic_extent - 1; + constexpr size_t n = std::cmp_less(n1, n2) ? size_t(n1) : n2; + + verify_all(typename Layout::mapping<std::extents<Int, n, n, 0, n, n>>{}); + verify_all(typename Layout::mapping<std::extents<Int, 0, n, n, n>>{}); + verify_all(typename Layout::mapping<std::extents<Int, dyn, n, n, n>>{}); + verify_all(typename Layout::mapping<std::extents<Int, n, n, n, 0>>{}); + verify_all(typename Layout::mapping<std::extents<Int, n, n, n, dyn>>{}); +} + +template<typename Int, size_t N> +constexpr std::array<Int, N> +make_strides() +{ + std::array<Int, N> strides; + std::ranges::fill(strides, Int(1)); + return strides; +} + +template<typename Layout, typename Extents> +constexpr typename Layout::mapping<Extents> +make_mapping(Extents exts) +{ + using IndexType = typename Extents::index_type; + constexpr auto rank = Extents::rank(); + constexpr auto strides = make_strides<IndexType, rank>(); + + if constexpr (std::same_as<Layout, std::layout_stride>) + return typename Layout::mapping(exts, strides); + else + return typename Layout::mapping(exts); +} + +template<typename Layout, typename Int> +constexpr void +test_dynamic_overflow() +{ + constexpr Int n1 = std::numeric_limits<Int>::max(); + constexpr size_t n2 = std::dynamic_extent - 1; + constexpr Int n = std::cmp_less(n1, n2) ? n1 : Int(n2); + + verify_all(make_mapping<Layout>( + std::extents<Int, dyn, dyn, 0, dyn, dyn>{n, n, n, n})); + + verify_all(make_mapping<Layout>( + std::extents<Int, dyn, dyn, dyn, dyn, dyn>{n, n, 0, n, n})); + + verify_all(make_mapping<Layout>( + std::extents<Int, dyn, dyn, dyn, 0>{n, n, n})); + + verify_all(make_mapping<Layout>( + std::extents<Int, dyn, dyn, dyn, dyn>{n, n, n, 0})); + + verify_all(make_mapping<Layout>( + std::extents<Int, 0, dyn, dyn, dyn>{n, n, n})); + + verify_all(make_mapping<Layout>( + std::extents<Int, dyn, dyn, dyn, dyn>{0, n, n, n})); +} + +template<typename Layout, typename Int> +constexpr void +test_overflow() +{ + test_static_overflow<Layout, Int>(); + test_dynamic_overflow<Layout, Int>(); +} + +template<typename Layout> +constexpr bool +test_all() +{ + test_overflow<Layout, signed char>(); + test_overflow<Layout, short int>(); + test_overflow<Layout, int>(); + test_overflow<Layout, long int>(); + test_overflow<Layout, long long int>(); + + test_overflow<Layout, unsigned char>(); + test_overflow<Layout, unsigned short int>(); + test_overflow<Layout, unsigned int>(); + test_overflow<Layout, unsigned long int>(); + test_overflow<Layout, unsigned long long int>(); + test_overflow<Layout, size_t>(); + return true; +} + +int +main() +{ + static_assert(test_all<std::layout_left>()); + static_assert(test_all<std::layout_right>()); + static_assert(test_all<std::layout_stride>()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/mapping.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/mapping.cc new file mode 100644 index 0000000..963c804 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/mapping.cc @@ -0,0 +1,568 @@ +// { dg-do run { target c++23 } } +#include <mdspan> + +#include <cstdint> +#include <testsuite_hooks.h> + +constexpr size_t dyn = std::dynamic_extent; + +template<typename Layout, typename Extents> + constexpr bool + test_mapping_properties() + { + using M = typename Layout::mapping<Extents>; + static_assert(std::__mdspan::__is_extents<typename M::extents_type>); + static_assert(std::__mdspan::__mapping_alike<M>); + static_assert(std::copyable<M>); + static_assert(std::is_nothrow_move_constructible_v<M>); + static_assert(std::is_nothrow_move_assignable_v<M>); + static_assert(std::is_nothrow_swappable_v<M>); + static_assert(std::is_same_v<typename M::extents_type, Extents>); + static_assert(std::is_same_v<typename M::index_type, + typename M::extents_type::index_type>); + static_assert(std::is_same_v<typename M::size_type, + typename M::extents_type::size_type>); + static_assert(std::is_same_v<typename M::rank_type, + typename M::extents_type::rank_type>); + static_assert(std::is_same_v<typename M::layout_type, Layout>); + + static_assert(std::is_trivially_copyable_v<M>); + static_assert(std::regular<M>); + + static_assert(M::is_always_unique() && M::is_unique()); + static_assert(M::is_always_strided() && M::is_strided()); + if constexpr (!std::is_same_v<Layout, std::layout_stride>) + static_assert(M::is_always_exhaustive() && M::is_exhaustive()); + return true; + } + +template<typename Layout> + constexpr bool + test_mapping_properties_all() + { + test_mapping_properties<Layout, std::extents<int>>(); + test_mapping_properties<Layout, std::extents<int, 1>>(); + test_mapping_properties<Layout, std::extents<int, dyn>>(); + test_mapping_properties<Layout, std::extents<int, dyn, dyn>>(); + return true; + } + +// Check operator()(Indices...) +template<typename Mapping, size_t N> + constexpr typename Mapping::index_type + linear_index(const Mapping& mapping, + const std::array<typename Mapping::index_type, N>& indices) + { + typename Mapping::index_type ret = 0; + for(size_t r = 0; r < indices.size(); ++r) + ret += indices[r] * mapping.stride(r); + return ret; + } + +template<typename Mapping, typename... Indices> + constexpr void + test_linear_index(const Mapping& m, Indices... i) + { + using index_type = typename Mapping::index_type; + index_type expected = linear_index(m, std::array{index_type(i)...}); + VERIFY(m(i...) == expected); + VERIFY(m(uint8_t(i)...) == expected); + } + +template<typename Layout> + constexpr void + test_linear_index_0d() + { + constexpr typename Layout::mapping<std::extents<int>> m; + VERIFY(m() == 0); + } + +template<typename Layout> + constexpr void + test_linear_index_1d() + { + typename Layout::mapping<std::extents<int, 5>> m; + test_linear_index(m, 0); + test_linear_index(m, 1); + test_linear_index(m, 4); + } + +template<typename Layout> + constexpr void + test_linear_index_2d() + { + typename Layout::mapping<std::extents<int, 3, 256>> m; + test_linear_index(m, 0, 0); + test_linear_index(m, 1, 0); + test_linear_index(m, 0, 1); + test_linear_index(m, 1, 1); + test_linear_index(m, 2, 4); + } + +template<typename Layout> + struct MappingFactory + { + template<typename Extents> + static constexpr typename Layout::mapping<Extents> + create(Extents exts) + { return exts; } + }; + +template<> + struct MappingFactory<std::layout_stride> + { + template<typename Extents> + static constexpr std::layout_stride::mapping<Extents> + create(Extents exts) + { + if constexpr (Extents::rank() == 0) + { + auto strides = std::array<size_t, 0>{}; + return std::layout_stride::mapping(exts, strides); + } + else if constexpr (Extents::rank() == 1) + { + auto strides = std::array<size_t, 1>{2}; + return std::layout_stride::mapping(exts, strides); + } + else if constexpr (Extents::rank() == 2) + { + size_t m = exts.extent(1); + auto strides = std::array<size_t, 2>{3*m, 2}; + return std::layout_stride::mapping(exts, strides); + } + else if constexpr (Extents::rank() == 3) + { + size_t n = exts.extent(0); + size_t m = exts.extent(1); + auto strides = std::array<size_t, 3>{3*m, 2, 11*m*n}; + return std::layout_stride::mapping(exts, strides); + } + } + }; + +template<typename Layout> + constexpr void + test_linear_index_3d() + { + auto m = MappingFactory<Layout>::create(std::extents(3, 5, 7)); + test_linear_index(m, 0, 0, 0); + test_linear_index(m, 1, 0, 0); + test_linear_index(m, 0, 1, 0); + test_linear_index(m, 0, 0, 1); + test_linear_index(m, 1, 1, 0); + test_linear_index(m, 2, 4, 6); + } + +struct IntLikeA +{ + operator int() + { return 0; } +}; + +struct IntLikeB +{ + operator int() noexcept + { return 0; } +}; + +struct NotIntLike +{ }; + +template<typename Layout> + constexpr void + test_has_linear_index_0d() + { + using Mapping = typename Layout::mapping<std::extents<int>>; + static_assert(std::invocable<Mapping>); + static_assert(!std::invocable<Mapping, int>); + static_assert(!std::invocable<Mapping, IntLikeA>); + static_assert(!std::invocable<Mapping, IntLikeB>); + static_assert(!std::invocable<Mapping, NotIntLike>); + } + +template<typename Layout> + constexpr void + test_has_linear_index_1d() + { + using Mapping = typename Layout::mapping<std::extents<int, 3>>; + static_assert(std::invocable<Mapping, int>); + static_assert(!std::invocable<Mapping>); + static_assert(!std::invocable<Mapping, IntLikeA>); + static_assert(std::invocable<Mapping, IntLikeB>); + static_assert(!std::invocable<Mapping, NotIntLike>); + static_assert(std::invocable<Mapping, double>); + } + +template<typename Layout> + constexpr void + test_has_linear_index_2d() + { + using Mapping = typename Layout::mapping<std::extents<int, 3, 5>>; + static_assert(std::invocable<Mapping, int, int>); + static_assert(!std::invocable<Mapping, int>); + static_assert(!std::invocable<Mapping, IntLikeA, int>); + static_assert(std::invocable<Mapping, IntLikeB, int>); + static_assert(!std::invocable<Mapping, NotIntLike, int>); + static_assert(std::invocable<Mapping, double, double>); + } + +template<typename Layout> + constexpr bool + test_linear_index_all() + { + test_linear_index_0d<Layout>(); + test_linear_index_1d<Layout>(); + test_linear_index_2d<Layout>(); + test_linear_index_3d<Layout>(); + test_has_linear_index_0d<Layout>(); + test_has_linear_index_1d<Layout>(); + test_has_linear_index_2d<Layout>(); + return true; + } + +template<typename Mapping> + constexpr typename Mapping::index_type + linear_index_end(Mapping m) + { + using index_type = typename Mapping::index_type; + constexpr size_t rank = Mapping::extents_type::rank(); + + auto impl = [m]<index_type... Counts>( + std::integer_sequence<index_type, Counts...>) -> index_type + { + auto exts = m.extents(); + if(((exts.extent(Counts) == 0) || ...)) + return 0; + return m((exts.extent(Counts) - 1)...) + 1; + }; + + return impl(std::make_integer_sequence<index_type, rank>()); + } + +// Check required_span_size +template<typename Mapping> + constexpr void + test_required_span_size(Mapping m) + { VERIFY(m.required_span_size() == linear_index_end(m)); } + +template<typename Layout> + constexpr void + test_required_span_size_0d() + { + typename Layout::mapping<std::extents<int>> m; + test_required_span_size(m); + } + +template<typename Layout> + constexpr void + test_required_span_size_1d() + { + auto m = MappingFactory<Layout>::create(std::extents(3)); + test_required_span_size(m); + } + +template<typename Layout> + constexpr void + test_required_span_size_2d() + { + auto m = MappingFactory<Layout>::create(std::extents(3, 5)); + test_required_span_size(m); + } + +template<typename Layout> + constexpr void + test_required_span_size_3d() + { + auto m = MappingFactory<Layout>::create(std::extents(3, 5, 7)); + test_required_span_size(m); + } + +template<typename Layout> + constexpr void + test_required_span_size_zero_1d() + { + auto m = MappingFactory<Layout>::create(std::extents(3, 0)); + test_required_span_size(m); + } + +template<typename Layout> + constexpr void + test_required_span_size_zero_3d() + { + auto m = MappingFactory<Layout>::create(std::extents(3, 0, 7)); + test_required_span_size(m); + } + +template<typename Layout> + constexpr bool + test_required_span_size_all() + { + test_required_span_size_0d<Layout>(); + test_required_span_size_1d<Layout>(); + test_required_span_size_2d<Layout>(); + test_required_span_size_3d<Layout>(); + test_required_span_size_zero_1d<Layout>(); + test_required_span_size_zero_3d<Layout>(); + return true; + } + +// Check stride +template<typename Layout> + constexpr void + test_stride_1d() + { + std::layout_left::mapping<std::extents<int, 3>> m; + VERIFY(m.stride(0) == 1); + } + +template<> + constexpr void + test_stride_1d<std::layout_stride>() + { + std::array<int, 1> strides{13}; + std::layout_stride::mapping m(std::extents<int, 3>{}, strides); + VERIFY(m.stride(0) == strides[0]); + VERIFY(m.strides() == strides); + } + +template<typename Layout> + constexpr void + test_stride_2d(); + +template<> + constexpr void + test_stride_2d<std::layout_left>() + { + std::layout_left::mapping<std::extents<int, 3, 5>> m; + VERIFY(m.stride(0) == 1); + VERIFY(m.stride(1) == 3); + } + +template<> + constexpr void + test_stride_2d<std::layout_right>() + { + std::layout_right::mapping<std::extents<int, 3, 5>> m; + VERIFY(m.stride(0) == 5); + VERIFY(m.stride(1) == 1); + } + +template<> + constexpr void + test_stride_2d<std::layout_stride>() + { + std::array<int, 2> strides{13, 2}; + std::layout_stride::mapping m(std::extents<int, 3, 5>{}, strides); + VERIFY(m.stride(0) == strides[0]); + VERIFY(m.stride(1) == strides[1]); + VERIFY(m.strides() == strides); + } + +template<typename Layout> + constexpr void + test_stride_3d(); + +template<> + constexpr void + test_stride_3d<std::layout_left>() + { + std::layout_left::mapping m(std::dextents<int, 3>(3, 5, 7)); + VERIFY(m.stride(0) == 1); + VERIFY(m.stride(1) == 3); + VERIFY(m.stride(2) == 3*5); + } + +template<> + constexpr void + test_stride_3d<std::layout_right>() + { + std::layout_right::mapping m(std::dextents<int, 3>(3, 5, 7)); + VERIFY(m.stride(0) == 5*7); + VERIFY(m.stride(1) == 7); + VERIFY(m.stride(2) == 1); + } + +template<> + constexpr void + test_stride_3d<std::layout_stride>() + { + std::dextents<int, 3> exts(3, 5, 7); + std::array<int, 3> strides{11, 2, 41}; + std::layout_stride::mapping<std::dextents<int, 3>> m(exts, strides); + VERIFY(m.stride(0) == strides[0]); + VERIFY(m.stride(1) == strides[1]); + VERIFY(m.stride(2) == strides[2]); + VERIFY(m.strides() == strides); + } + +template<typename Layout> + constexpr bool + test_stride_all() + { + test_stride_1d<Layout>(); + test_stride_2d<Layout>(); + test_stride_3d<Layout>(); + return true; + } + +template<typename Mapping> + concept has_stride = requires (Mapping m) + { + { m.stride(0) } -> std::same_as<typename Mapping::index_type>; + }; + +template<typename Layout> + constexpr void + test_has_stride_0d() + { + using Mapping = typename Layout::mapping<std::extents<int>>; + constexpr bool expected = std::is_same_v<Layout, std::layout_stride>; + static_assert(has_stride<Mapping> == expected); + } + +template<typename Layout> + constexpr void + test_has_stride_1d() + { static_assert(has_stride<typename Layout::mapping<std::extents<int, 1>>>); } + +template<typename Layout> + constexpr void + test_has_stride_2d() + { + using Extents = std::extents<int, 1, 2>; + static_assert(has_stride<typename Layout::mapping<Extents>>); + } + +// Check operator== +template<typename Layout> + constexpr void + test_eq() + { + typename Layout::mapping<std::extents<int, 1, 2>> m1; + typename Layout::mapping<std::extents<int, 2, 2>> m2; + typename Layout::mapping<std::dextents<int, 2>> m3(m1); + + VERIFY(m1 == m1); + VERIFY(m1 != m2); + VERIFY(m1 == m3); + VERIFY(m2 != m3); + } + +template<typename Layout> + constexpr void + test_eq_zero() + { + typename Layout::mapping<std::extents<int, 0, 2>> m1; + typename Layout::mapping<std::extents<int, 0, 2>> m2; + typename Layout::mapping<std::extents<int, 2, 0>> m3; + + VERIFY(m1 == m2); + VERIFY(m1 != m3); + } + +template<typename M1, typename M2> + concept has_op_eq = requires (M1 m1, M2 m2) + { + { m1 == m2 } -> std::same_as<bool>; + { m2 == m1 } -> std::same_as<bool>; + { m1 != m2 } -> std::same_as<bool>; + { m2 != m1 } -> std::same_as<bool>; + }; + +template<typename SLayout, typename OLayout, bool Expected> + constexpr void + test_has_op_eq() + { + static_assert(has_op_eq< + typename SLayout::mapping<std::extents<int>>, + typename OLayout::mapping<std::extents<int>>> == Expected); + + static_assert(!has_op_eq< + typename SLayout::mapping<std::extents<int>>, + typename OLayout::mapping<std::extents<int, 1>>>); + + static_assert(has_op_eq< + typename SLayout::mapping<std::extents<int, 1>>, + typename OLayout::mapping<std::extents<int, 1>>> == Expected); + + static_assert(has_op_eq< + typename SLayout::mapping<std::extents<int, 1>>, + typename OLayout::mapping<std::extents<int, 2>>> == Expected); + + static_assert(!has_op_eq< + typename SLayout::mapping<std::extents<int, 1>>, + typename OLayout::mapping<std::extents<int, 1, 2>>>); + + static_assert(has_op_eq< + typename SLayout::mapping<std::extents<int, 1, 2>>, + typename OLayout::mapping<std::extents<int, 1, 2>>> == Expected); + + static_assert(has_op_eq< + typename SLayout::mapping<std::extents<int, 1, 2>>, + typename OLayout::mapping<std::extents<int, 2, 2>>> == Expected); + + static_assert(!has_op_eq< + typename SLayout::mapping<std::extents<int, 1, 2>>, + typename OLayout::mapping<std::extents<int, 1, 2, 3>>>); + } + +constexpr void +test_has_op_eq_peculiar() +{ + static_assert(has_op_eq< + std::layout_right::mapping<std::extents<int>>, + std::layout_left::mapping<std::extents<unsigned int>>>); + + static_assert(has_op_eq< + std::layout_right::mapping<std::extents<int, 1>>, + std::layout_left::mapping<std::extents<int, dyn>>>); + + static_assert(!has_op_eq< + std::layout_right::mapping<std::extents<int, 1, 2>>, + std::layout_left::mapping<std::extents<int, dyn, 2>>>); +} + +template<typename Layout> + constexpr bool + test_mapping_all() + { + test_linear_index_all<Layout>(); + test_required_span_size_all<Layout>(); + test_stride_all<Layout>(); + + test_eq<Layout>(); + test_eq_zero<Layout>(); + return true; + } + +template<typename Layout> + constexpr void + test_all() + { + static_assert(std::is_trivially_default_constructible_v<Layout>); + static_assert(std::is_trivially_copyable_v<Layout>); + static_assert(test_mapping_properties_all<Layout>()); + + test_mapping_all<Layout>(); + static_assert(test_mapping_all<Layout>()); + + test_has_stride_0d<Layout>(); + test_has_stride_1d<Layout>(); + test_has_stride_2d<Layout>(); + test_has_op_eq<Layout, Layout, true>(); + } + +int +main() +{ + test_all<std::layout_left>(); + test_all<std::layout_right>(); + test_all<std::layout_stride>(); + + test_has_op_eq<std::layout_right, std::layout_left, false>(); + test_has_op_eq<std::layout_right, std::layout_stride, true>(); + test_has_op_eq<std::layout_left, std::layout_stride, true>(); + test_has_op_eq_peculiar(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/stride.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/stride.cc new file mode 100644 index 0000000..c8af5c6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/stride.cc @@ -0,0 +1,526 @@ +// { dg-do run { target c++23 } } +#include <mdspan> + +#include <testsuite_hooks.h> + +constexpr size_t dyn = std::dynamic_extent; + +template<typename MappingStride> + constexpr void + test_ctor_default_stride() + { + using Extents = typename MappingStride::extents_type; + MappingStride actual; + typename std::layout_right::mapping<Extents> expected; + + constexpr auto rank = MappingStride::extents_type::rank(); + if constexpr (rank > 0) + for(size_t i = 0; i < rank; ++i) + VERIFY(actual.stride(i) == expected.stride(i)); + } + +constexpr bool +test_ctor_default_stride_all() +{ + test_ctor_default_stride< + std::layout_stride::mapping<std::extents<int, 3>>>(); + + test_ctor_default_stride< + std::layout_stride::mapping<std::extents<int, 3, 5, 7>>>(); + + test_ctor_default_stride< + std::layout_stride::mapping<std::dextents<int, 3>>>(); + + test_ctor_default_stride< + std::layout_stride::mapping<std::extents<int, 0, 5, 7>>>(); + + test_ctor_default_stride< + std::layout_stride::mapping<std::extents<int, 3, dyn, dyn>>>(); + + test_ctor_default_stride< + std::layout_stride::mapping<std::extents<int, dyn, dyn, 3>>>(); + return true; +} + +struct IntLikeA +{ + operator int() + { return 0; } +}; + +struct IntLikeB +{ + operator int() noexcept + { return 0; } +}; + +struct NotIntLike +{ }; + +template<typename E, typename E_arg, typename T, size_t N, bool Expected> +constexpr void +test_stride_constructible() +{ + static_assert(std::is_nothrow_constructible_v< + std::layout_stride::mapping<E>, E_arg, std::span<T, N>> == Expected); + static_assert(std::is_nothrow_constructible_v< + std::layout_stride::mapping<E>, E_arg, std::array<T, N>> == Expected); + static_assert(!std::is_constructible_v<std::layout_stride::mapping<E>, + E_arg>); +} + +constexpr void +test_stride_constructible_all() +{ + using E0 = std::extents<int>; + using E1 = std::extents<int, 2>; + using E2 = std::extents<int, dyn>; + + test_stride_constructible<E0, E0, int, 0, true>(); + test_stride_constructible<E0, E0, IntLikeA, 0, false>(); + test_stride_constructible<E0, E0, IntLikeB, 0, true>(); + test_stride_constructible<E0, E0, NotIntLike, 0, false>(); + test_stride_constructible<E1, E1, int, 1, true>(); + test_stride_constructible<E2, E1, int, 1, true>(); + test_stride_constructible<E1, E1, int, 2, false>(); + test_stride_constructible<E1, E0, int, 1, false>(); +} + +template<typename Extents, typename Shape> + constexpr void + test_ctor_shape_strides(Extents exts, Shape strides) + { + using M = std::layout_stride::mapping<Extents>; + M m(exts, strides); + + if constexpr (Extents::rank() > 0) + for(size_t i = 0; i < exts.rank(); ++i) + { + VERIFY(m.stride(i) == strides[i]); + VERIFY(m.extents().extent(i) == exts.extent(i)); + } + } + +constexpr bool +test_ctor_shape_stride_all() +{ + test_ctor_shape_strides(std::extents<int>{}, std::array<int, 0>{}); + test_ctor_shape_strides(std::extents<int, 2>{}, std::array<int, 1>{3}); + test_ctor_shape_strides(std::extents<int, 2, 4, 6>{}, + std::array<int, 3>{20, 5, 45}); + return true; +} + +template<typename Extents, std::array<bool, 2> Strided, + std::array<bool, 2> Unique, std::array<bool, 2> Exhautive, + typename Extents::index_type Offset = 0> + struct MappingLike + { + using extents_type = Extents; + using index_type = typename Extents::index_type; + + constexpr + MappingLike(extents_type extents, + std::array<index_type, Extents::rank()> strides) + : _extents(extents), _strides(strides) + { } + + static constexpr bool + is_always_strided() requires (Strided[0]) + { return Strided[1]; } + + static constexpr bool + is_always_unique() requires (Unique[0]) + { return Unique[1]; } + + static constexpr bool + is_always_exhaustive() requires (Exhautive[0]) + { return Exhautive[1]; } + + constexpr Extents + extents() const { return _extents; } + + constexpr index_type + stride(size_t i) const { return _strides[i]; } + + template<typename... Indices> + constexpr index_type + operator()(Indices... indices) const + { + if (empty()) + VERIFY(false); + + std::array<index_type, Extents::rank()> ind_arr{indices...}; + index_type ret = Offset; + for(size_t i = 0; i < Extents::rank(); ++i) + ret += ind_arr[i]*_strides[i]; + return ret; + } + + private: + constexpr bool + empty() const + { + for (size_t i = 0; i < extents_type::rank(); ++i) + if (_extents.extent(i) == 0) + return true; + return false; + } + + Extents _extents; + std::array<index_type, Extents::rank()> _strides; + }; + + +template<size_t Rank> +struct ExtentLike +{ + using index_type = int; + + static constexpr size_t + rank() { return Rank; } +}; + + +template<typename E1> +constexpr void +test_mapping_like_constructible() +{ + using M = std::layout_stride::mapping<E1>; + using E2 = std::dextents<typename E1::index_type, E1::rank()>; + using E3 = std::dextents<typename E1::index_type, E1::rank() + 1>; + using E4 = ExtentLike<E1::rank()>; + + constexpr auto TT = std::array{true, true}; + constexpr auto FT = std::array{false, true}; + constexpr auto TF = std::array{true, false}; + + static_assert(std::is_constructible_v<M, MappingLike<E1, TT, TT, TT>>); + static_assert(std::is_constructible_v<M, MappingLike<E2, TT, TT, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E3, TT, TT, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E1, FT, TT, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E1, TF, TT, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E1, TT, FT, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E1, TT, TF, TT>>); + static_assert(!std::is_constructible_v<M, MappingLike<E1, TT, TT, FT>>); + static_assert(std::is_constructible_v<M, MappingLike<E1, TT, TT, TF>>); + static_assert(!std::is_constructible_v<M, MappingLike<E4, TT, TT, TF>>); + static_assert(!std::is_constructible_v<M, MappingLike<E4, TT, TT, TT>>); +} + +constexpr void +test_mapping_like_constructible_all() +{ + test_mapping_like_constructible<std::extents<int>>(); + test_mapping_like_constructible<std::extents<int, 2>>(); + test_mapping_like_constructible<std::extents<int, 2, 3>>(); +} + +template<typename E1, typename E2> +constexpr void +test_mapping_like_convertible() +{ + using M1 = std::layout_stride::mapping<E1>; + using M2 = std::layout_stride::mapping<E2>; + constexpr auto TT = std::array{true, true}; + + static_assert(!std::is_convertible_v<MappingLike<E1, TT, TT, TT>, M1>); + static_assert(!std::is_convertible_v<MappingLike<E2, TT, TT, TT>, M1>); + static_assert(!std::is_convertible_v<MappingLike<E1, TT, TT, TT>, M2>); + + static_assert(std::is_convertible_v<std::layout_stride::mapping<E2>, M1>); + static_assert(std::is_convertible_v<std::layout_left::mapping<E2>, M1>); + static_assert(std::is_convertible_v<std::layout_right::mapping<E2>, M1>); + + static_assert(!std::is_convertible_v<std::layout_stride::mapping<E1>, M2>); + static_assert(!std::is_convertible_v<std::layout_left::mapping<E1>, M2>); + static_assert(!std::is_convertible_v<std::layout_right::mapping<E1>, M2>); +} + +constexpr void +test_mapping_like_convertible_all() +{ + test_mapping_like_convertible<std::extents<unsigned int>, + std::extents<int>>(); + test_mapping_like_convertible<std::extents<unsigned int, 2>, + std::extents<int, 2>>(); + test_mapping_like_convertible<std::extents<int, dyn, 3>, + std::extents<int, 2, 3>>(); +} + +template<typename Extents> +constexpr void +test_ctor_stride_like(Extents exts, std::array<int, Extents::rank()> strides) +{ + auto other_right = std::layout_right::mapping(exts); + auto other_left = std::layout_left::mapping(exts); + auto other_stride = std::layout_stride::mapping(exts, strides); + + VERIFY(std::layout_stride::mapping<Extents>(other_right) == other_right); + VERIFY(std::layout_stride::mapping<Extents>(other_left) == other_left); + VERIFY(std::layout_stride::mapping<Extents>(other_stride) == other_stride); +} + +constexpr void +test_ctor_stride_like_all() +{ + using E1 = std::extents<int>; + auto s1 = std::array<int, 0>{}; + test_ctor_stride_like(E1{}, s1); + + using E2 = std::extents<int, 3>; + auto s2 = std::array<int, 1>{2}; + test_ctor_stride_like(E2{}, s2); + + using E3 = std::extents<int, 3, 5, 7>; + auto s3 = std::array<int, 3>{5, 1, 15}; + test_ctor_stride_like(E3{}, s3); +} + +constexpr bool +test_ctor_strides_all() +{ + test_ctor_default_stride_all(); + test_ctor_shape_stride_all(); + test_ctor_stride_like_all(); + return true; +} + +// Check is_exhaustive. +template<typename Extents, typename Strides> + constexpr void + test_is_exhaustive(Extents extents, Strides strides, bool expected) + { + std::layout_stride::mapping<Extents> m(extents, strides); + VERIFY(m.is_exhaustive() == expected); + + bool always_exhaustive = extents.rank() == 0 || m.required_span_size() == 0; + VERIFY(m.is_always_exhaustive() == always_exhaustive); + } + +constexpr void +test_is_exhaustive_zero_1d() +{ + std::extents<int, 0> extents; + test_is_exhaustive(extents, std::array{1}, true); + test_is_exhaustive(extents, std::array{2}, true); +} + +constexpr void +test_is_exhaustive_zero_3d() +{ + std::extents<int, 3, 0, 7> extents; + + test_is_exhaustive(extents, std::array{1, 1, 1}, true); + test_is_exhaustive(extents, std::array{1, 2*21, 2*3}, true); + test_is_exhaustive(extents, std::array{7, 2*21, 1}, true); + test_is_exhaustive(extents, std::array{1, 21, 3}, true); + test_is_exhaustive(extents, std::array{7, 21, 1}, true); +} + +constexpr void +test_is_exhaustive_0d() +{ + std::extents<int> extents; + test_is_exhaustive(extents, std::array<int, 0>{}, true); +} + +constexpr void +test_is_exhaustive_1d() +{ + std::extents<int, 3> extents; + test_is_exhaustive(extents, std::array{1}, true); + test_is_exhaustive(extents, std::array{3}, false); +} + + +constexpr void +test_is_exhaustive_3d() +{ + std::extents<int, 3, dyn, 7> extents(5); + + test_is_exhaustive(extents, std::array{1, 3, 3*5}, true); + test_is_exhaustive(extents, std::array{5*7, 1, 5}, true); + test_is_exhaustive(extents, std::array{7, 3*7, 1}, true); + + test_is_exhaustive(extents, std::array{1, 3, 2*3*5}, false); + test_is_exhaustive(extents, std::array{2*5*7, 1, 2*5}, false); + test_is_exhaustive(extents, std::array{2*7, 2*3*7, 2}, false); +} + +constexpr void +test_is_exhaustive_ones() +{ + std::extents<int, 1, 1, 3, 1> extents; + test_is_exhaustive(extents, std::array{1, 1, 1, 1}, true); + test_is_exhaustive(extents, std::array{1, 1, 1, 3}, true); + test_is_exhaustive(extents, std::array{3, 3, 1, 3}, true); + test_is_exhaustive(extents, std::array{3, 1, 1, 3}, true); +} + +constexpr bool +test_is_exhaustive_all() +{ + test_is_exhaustive_zero_1d(); + test_is_exhaustive_zero_3d(); + test_is_exhaustive_ones(); + test_is_exhaustive_0d(); + test_is_exhaustive_1d(); + test_is_exhaustive_3d(); + return true; +} + +template<typename Extents, int Offset> + using OffsetMapping = MappingLike<Extents, {true, true}, {true, true}, + {true, false}, Offset>; + +template<typename Extents> + constexpr void + test_eq(Extents exts, + std::array<typename Extents::index_type, Extents::rank()> left_strides, + std::array<typename Extents::index_type, Extents::rank()> right_strides, + std::array<typename Extents::index_type, Extents::rank()> padded_strides) + { + using DExtents = std::dextents<int, Extents::rank()>; + + std::layout_left::mapping<Extents> ml; + std::layout_right::mapping<DExtents> mr(exts); + + std::layout_stride::mapping<Extents> msd; + std::layout_stride::mapping<Extents> msl(exts, left_strides); + std::layout_stride::mapping<Extents> msr(exts, right_strides); + std::layout_stride::mapping<Extents> msp(exts, padded_strides); + + OffsetMapping<Extents, 0> mor{exts, right_strides}; + OffsetMapping<Extents, 0> mol{exts, left_strides}; + OffsetMapping<Extents, 0> mop{exts, padded_strides}; + OffsetMapping<Extents, 1> moo{exts, right_strides}; + + VERIFY(msd == mr); + VERIFY(msd == mor); + VERIFY(msd != msp); + VERIFY(msd != mop); + + VERIFY(msl == ml); + VERIFY(msl == mol); + VERIFY(msd != msp); + VERIFY(msl != mop); + + VERIFY(msp == mop); + VERIFY(msp != ml); + VERIFY(msp != mr); + + VERIFY(msd != moo); + } + +constexpr void +test_eq_0d() +{ + using Extents = std::extents<int>; + Extents exts; + std::layout_left::mapping<Extents> ml; + std::layout_right::mapping<Extents> mr; + std::layout_stride::mapping<Extents> ms; + OffsetMapping<Extents, 0> mor{exts, {}}; + OffsetMapping<Extents, 1> moo{exts, {}}; + + VERIFY(ms == ml); + VERIFY(ms == mr); + VERIFY(ms == mor); + VERIFY(ms != moo); +} + +constexpr void +test_eq_1d() +{ + using Extents = std::extents<int, 2>; + auto exhaustive_strides = std::array{1}; + auto padded_strides = std::array{2}; + + test_eq(Extents{}, exhaustive_strides, exhaustive_strides, padded_strides); +} + +constexpr void +test_eq_2d() +{ + using Extents = std::extents<int, 1, 2>; + auto left_strides = std::array{1, 1}; + auto right_strides = std::array{2, 1}; + auto padded_strides = std::array{2, 8}; + + test_eq(Extents{}, left_strides, right_strides, padded_strides); +} + +constexpr void +test_eq_zero() +{ + using Extents = std::extents<int, 0, 2>; + using Mapping = std::layout_stride::mapping<Extents>; + + Extents exts; + std::array<int, 2> sl{1, 5}; + std::array<int, 2> sr{5, 1}; + + Mapping m1(exts, sl); + Mapping m2(exts, sl); + Mapping m3(exts, sr); + OffsetMapping<Extents, 0> m4(exts, sl); + + VERIFY(m1 == m2); + VERIFY(m1 != m3); + VERIFY(m1 == m4); + +} + +constexpr bool +test_eq_all() +{ + test_eq_0d(); + test_eq_1d(); + test_eq_2d(); + test_eq_zero(); + return true; +} + +template<typename M1, typename M2> + concept has_op_eq = requires (M1 m1, M2 m2) + { + { m1 == m2 } -> std::same_as<bool>; + { m2 == m1 } -> std::same_as<bool>; + { m1 != m2 } -> std::same_as<bool>; + { m2 != m1 } -> std::same_as<bool>; + }; + +constexpr void +test_has_op_eq() +{ + using E1 = std::extents<int>; + using E2 = std::extents<int, 2>; + using E3 = std::extents<int, 1, 2>; + constexpr auto FT = std::array{false, true}; + + static_assert(!has_op_eq< + std::layout_stride::mapping<E1>, MappingLike<E1, FT, FT, FT>>); + + static_assert(!has_op_eq< + std::layout_stride::mapping<E2>, MappingLike<E2, FT, FT, FT>>); + + static_assert(!has_op_eq< + std::layout_stride::mapping<E3>, MappingLike<E3, FT, FT, FT>>); +} + +int +main() +{ + test_ctor_strides_all(); + static_assert(test_ctor_strides_all()); + test_mapping_like_convertible_all(); + test_mapping_like_constructible_all(); + test_stride_constructible_all(); + test_is_exhaustive_all(); + static_assert(test_is_exhaustive_all()); + test_eq_all(); + static_assert(test_eq_all()); + test_has_op_eq(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/format.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/format.cc index eb24b66..cecc535 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/format.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/format.cc @@ -21,7 +21,7 @@ is_format_string_for(const char* str, Args&&... args) } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) void test_format_string() @@ -34,11 +34,11 @@ test_format_string() VERIFY( !is_format_string_for("{:{}}", v[0], 1.0f) ); } -template<typename _CharT> +template<typename CharT> void test_output() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; size_t size = 0; std::vector<bool> v{true, false}; diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc index 61b99d3..e6689f7 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc @@ -43,11 +43,8 @@ test02() std::vector<PrivateDtor> v; } -// { dg-error "value type is destructible" "" { target *-*-* } 0 } +// { dg-error "deleted function .*DeletedDtor" "" { target *-*-* } 0 } +// { dg-error "PrivateDtor.* is private" "" { target *-*-* } 0 } // In Debug Mode the "required from here" errors come from <debug/vector> // { dg-error "required from here" "" { target *-*-* } 182 } - -// Needed because of PR c++/92193 -// { dg-prune-output "deleted function" } -// { dg-prune-output "private within this context" } diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc index 0807d15..2bd15bc 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc @@ -42,8 +42,5 @@ test02() std::vector<PrivateDtor> v; // { dg-error "here" } } -// { dg-error "value type is destructible" "" { target *-*-* } 0 } - -// Needed because of PR c++/92193 -// { dg-prune-output "deleted function" } -// { dg-prune-output "private within this context" } +// { dg-error "deleted function .*DeletedDtor" "" { target *-*-* } 0 } +// { dg-error "PrivateDtor.* is private" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/string_view.cc index 27f65aa..f25b538 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/string_view.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/string_view.cc @@ -151,20 +151,26 @@ void test03() alloc_type a{1}; { istringstream_with_alloc<alloc_type> istr(cstr, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( istr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{istr.str()} == cstr ); VERIFY( istr.get() == cstr.s[0] ); } { istringstream_with_alloc<alloc_type> istr(cstr, std::ios::in, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( istr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{istr.str()} == cstr ); VERIFY( istr.get() == cstr.s[0] ); VERIFY( istr.rdbuf()->sputc('X') != 'X' ); } { istringstream_with_alloc<alloc_type> istr(cstr, std::ios::out, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( istr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{istr.str()} == cstr ); VERIFY( istr.get() == cstr.s[0] ); VERIFY( istr.rdbuf()->sputc('X') == 'X' ); diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/string_view.cc index 731e97e..6279c19 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/string_view.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/string_view.cc @@ -149,21 +149,27 @@ void test03() alloc_type a{1}; { ostringstream_with_alloc<alloc_type> ostrstr(cstr, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( ostrstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{ostrstr.str()} == cstr ); VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); VERIFY( ostrstr.put('X').good() ); } { ostringstream_with_alloc<alloc_type> ostrstr(cstr, std::ios::in, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( ostrstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{ostrstr.str()} == cstr ); VERIFY( ostrstr.rdbuf()->sgetc() == cstr.s[0]); VERIFY( ostrstr.put('X').good() ); } { ostringstream_with_alloc<alloc_type> ostrstr(cstr, std::ios::out, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( ostrstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{ostrstr.str()} == cstr ); VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/string_view.cc index 7843269..14278b3 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/string_view.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/string_view.cc @@ -161,20 +161,26 @@ void test03() alloc_type a{1}; { stringbuf_with_alloc<alloc_type> sbuf(cstr, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( sbuf.get_allocator() == a ); +#endif VERIFY( string_view{sbuf.str()} == cstr ); VERIFY( sbuf.sgetc() == cstr.s[0] ); } { stringbuf_with_alloc<alloc_type> sbuf(cstr, std::ios::in, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( sbuf.get_allocator() == a ); +#endif VERIFY( string_view{sbuf.str()} == cstr ); VERIFY( sbuf.sgetc() == cstr.s[0] ); VERIFY( sbuf.sputc('X') == stringbuf::traits_type::eof() ); } { stringbuf_with_alloc<alloc_type> sbuf(cstr, std::ios::out, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( sbuf.get_allocator() == a ); +#endif VERIFY( string_view{sbuf.str()} == cstr ); VERIFY( sbuf.sputc('X') == 'X' ); VERIFY( sbuf.sgetc() == stringbuf::traits_type::eof() ); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/string_view.cc index 7208523..1c9ecea 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/string_view.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/string_view.cc @@ -160,20 +160,26 @@ void test03() alloc_type a{1}; { stringstream_with_alloc<alloc_type> strstr(cstr, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( strstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{strstr.str()} == cstr ); VERIFY( strstr.get() == cstr.s[0] ); } { stringstream_with_alloc<alloc_type> strstr(cstr, std::ios::in, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( strstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{strstr.str()} == cstr ); VERIFY( strstr.get() == cstr.s[0] ); VERIFY( strstr.put('X').rdstate() == strstr.badbit ); } { stringstream_with_alloc<alloc_type> strstr(cstr, std::ios::out, a); +#if _GLIBCXX_USE_CXX11_ABI VERIFY( strstr.rdbuf()->get_allocator() == a ); +#endif VERIFY( string_view{strstr.str()} == cstr ); VERIFY( strstr.put('X').good() ); VERIFY( strstr.get() == stringstream::traits_type::eof()); diff --git a/libstdc++-v3/testsuite/experimental/net/buffer/arithmetic.cc b/libstdc++-v3/testsuite/experimental/net/buffer/arithmetic.cc index 04b3c93..483d01f 100644 --- a/libstdc++-v3/testsuite/experimental/net/buffer/arithmetic.cc +++ b/libstdc++-v3/testsuite/experimental/net/buffer/arithmetic.cc @@ -26,7 +26,6 @@ using std::experimental::net::const_buffer; void test01() { - bool test __attribute__((unused)) = false; char c[4]; mutable_buffer mb; @@ -64,7 +63,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; char c[4]; const_buffer cb; diff --git a/libstdc++-v3/testsuite/experimental/net/buffer/const.cc b/libstdc++-v3/testsuite/experimental/net/buffer/const.cc index c6adae6..4310c28 100644 --- a/libstdc++-v3/testsuite/experimental/net/buffer/const.cc +++ b/libstdc++-v3/testsuite/experimental/net/buffer/const.cc @@ -50,7 +50,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; char c[4]; const_buffer b; diff --git a/libstdc++-v3/testsuite/experimental/net/buffer/mutable.cc b/libstdc++-v3/testsuite/experimental/net/buffer/mutable.cc index 9f0d7d4..06a848c 100644 --- a/libstdc++-v3/testsuite/experimental/net/buffer/mutable.cc +++ b/libstdc++-v3/testsuite/experimental/net/buffer/mutable.cc @@ -47,7 +47,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; char c[4]; mutable_buffer b; diff --git a/libstdc++-v3/testsuite/experimental/net/buffer/size.cc b/libstdc++-v3/testsuite/experimental/net/buffer/size.cc index 4592a19..7d5f339 100644 --- a/libstdc++-v3/testsuite/experimental/net/buffer/size.cc +++ b/libstdc++-v3/testsuite/experimental/net/buffer/size.cc @@ -26,7 +26,6 @@ using std::experimental::net::mutable_buffer; void test01() { - bool test __attribute__((unused)) = false; char c[4]; mutable_buffer mb; @@ -44,7 +43,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; char c[32]; std::vector<mutable_buffer> mv{ {c, 0}, {c, 32}, {c, 16}, {c, 3}, {c, 0} }; diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/cons.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/cons.cc index 6da7528..e394ec8 100644 --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/cons.cc +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/cons.cc @@ -27,8 +27,6 @@ using std::experimental::net::io_context; void test01() { - bool test __attribute__((unused)) = false; - io_context ctx1, ctx2; system_timer timer1(ctx1); @@ -54,8 +52,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; - io_context ctx1, ctx2; auto t1 = system_timer::clock_type::now(); auto t2 = t1 + system_timer::duration(10); @@ -83,8 +79,6 @@ test02() void test03() { - bool test __attribute__((unused)) = false; - io_context ctx1, ctx2; auto now = system_timer::clock_type::now(); auto d1 = system_timer::duration(10); diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc index d384a67..ef458bd 100644 --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc @@ -28,8 +28,6 @@ using std::experimental::net::io_context; void test01() { - bool test __attribute__((unused)) = false; - std::error_code ec; io_context ctx; diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc index 82c05c0..ff0b800 100644 --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc @@ -29,8 +29,6 @@ using std::error_code; void test01() { - bool test __attribute__((unused)) = false; - io_context ctx; error_code ec; bool complete = false; @@ -57,8 +55,6 @@ test01() void test02() { - bool test __attribute__((unused)) = false; - io_context ctx; error_code ec1, ec2; diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc index 7ff005b..6e8e36b 100644 --- a/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc +++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc @@ -96,7 +96,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_airy_ai<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc index 0afefdd..6fcad83 100644 --- a/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc +++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc @@ -96,7 +96,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_airy_bi<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/ext/special_functions/conf_hyperg/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/conf_hyperg/check_value.cc index 1227361..a050f62 100644 --- a/libstdc++-v3/testsuite/ext/special_functions/conf_hyperg/check_value.cc +++ b/libstdc++-v3/testsuite/ext/special_functions/conf_hyperg/check_value.cc @@ -3820,7 +3820,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_conf_hyperg<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/ext/special_functions/hyperg/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/hyperg/check_value.cc index 8e0c57f..b658684 100644 --- a/libstdc++-v3/testsuite/ext/special_functions/hyperg/check_value.cc +++ b/libstdc++-v3/testsuite/ext/special_functions/hyperg/check_value.cc @@ -12293,7 +12293,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_hyperg<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/01_assoc_laguerre/check_value.cc b/libstdc++-v3/testsuite/special_functions/01_assoc_laguerre/check_value.cc index 4e40f0f..90d7d36 100644 --- a/libstdc++-v3/testsuite/special_functions/01_assoc_laguerre/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/01_assoc_laguerre/check_value.cc @@ -2217,7 +2217,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_assoc_laguerre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/check_value.cc b/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/check_value.cc index b54e59e..54ae51d 100644 --- a/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/check_value.cc @@ -1985,7 +1985,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_assoc_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/pr86655.cc b/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/pr86655.cc index 9d6507a..cbd7c51 100644 --- a/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/pr86655.cc +++ b/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/pr86655.cc @@ -37,7 +37,6 @@ template<typename _Tp> void test_m_gt_l() { - bool test __attribute__((unused)) = true; for (auto l : {0u, 1u, 2u, 5u}) for (auto m : {l + 1u, l + 2u}) for (auto i : {-2, -1, 0, 1, 2}) diff --git a/libstdc++-v3/testsuite/special_functions/03_beta/check_value.cc b/libstdc++-v3/testsuite/special_functions/03_beta/check_value.cc index 24f5033..e5e85a5 100644 --- a/libstdc++-v3/testsuite/special_functions/03_beta/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/03_beta/check_value.cc @@ -261,7 +261,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_beta<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/04_comp_ellint_1/check_value.cc b/libstdc++-v3/testsuite/special_functions/04_comp_ellint_1/check_value.cc index efa7d5a..c109410 100644 --- a/libstdc++-v3/testsuite/special_functions/04_comp_ellint_1/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/04_comp_ellint_1/check_value.cc @@ -73,7 +73,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_1<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/05_comp_ellint_2/check_value.cc b/libstdc++-v3/testsuite/special_functions/05_comp_ellint_2/check_value.cc index 8c77daf..6a5d14d 100644 --- a/libstdc++-v3/testsuite/special_functions/05_comp_ellint_2/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/05_comp_ellint_2/check_value.cc @@ -73,7 +73,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_2<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/06_comp_ellint_3/check_value.cc b/libstdc++-v3/testsuite/special_functions/06_comp_ellint_3/check_value.cc index 8a74415..df544b5 100644 --- a/libstdc++-v3/testsuite/special_functions/06_comp_ellint_3/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/06_comp_ellint_3/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_3<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/07_cyl_bessel_i/check_value.cc b/libstdc++-v3/testsuite/special_functions/07_cyl_bessel_i/check_value.cc index ab182c1..a379bed 100644 --- a/libstdc++-v3/testsuite/special_functions/07_cyl_bessel_i/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/07_cyl_bessel_i/check_value.cc @@ -702,7 +702,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_i<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/08_cyl_bessel_j/check_value.cc b/libstdc++-v3/testsuite/special_functions/08_cyl_bessel_j/check_value.cc index a99e1e7..e09ae3d 100644 --- a/libstdc++-v3/testsuite/special_functions/08_cyl_bessel_j/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/08_cyl_bessel_j/check_value.cc @@ -735,7 +735,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_j<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/09_cyl_bessel_k/check_value.cc b/libstdc++-v3/testsuite/special_functions/09_cyl_bessel_k/check_value.cc index 5e6804e..ce5abcc 100644 --- a/libstdc++-v3/testsuite/special_functions/09_cyl_bessel_k/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/09_cyl_bessel_k/check_value.cc @@ -746,7 +746,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_k<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/10_cyl_neumann/check_value.cc b/libstdc++-v3/testsuite/special_functions/10_cyl_neumann/check_value.cc index 30c8a34..d934377 100644 --- a/libstdc++-v3/testsuite/special_functions/10_cyl_neumann/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/10_cyl_neumann/check_value.cc @@ -779,7 +779,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_neumann<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/11_ellint_1/check_value.cc b/libstdc++-v3/testsuite/special_functions/11_ellint_1/check_value.cc index c8bad36..2d6a3c5 100644 --- a/libstdc++-v3/testsuite/special_functions/11_ellint_1/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/11_ellint_1/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_1<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/12_ellint_2/check_value.cc b/libstdc++-v3/testsuite/special_functions/12_ellint_2/check_value.cc index fc971e6..0bbd7bb 100644 --- a/libstdc++-v3/testsuite/special_functions/12_ellint_2/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/12_ellint_2/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_2<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/13_ellint_3/check_value.cc b/libstdc++-v3/testsuite/special_functions/13_ellint_3/check_value.cc index f46d8a5..bb1b4c1 100644 --- a/libstdc++-v3/testsuite/special_functions/13_ellint_3/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/13_ellint_3/check_value.cc @@ -6121,7 +6121,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_3<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/14_expint/check_value.cc b/libstdc++-v3/testsuite/special_functions/14_expint/check_value.cc index 6bf060a..92e9714 100644 --- a/libstdc++-v3/testsuite/special_functions/14_expint/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/14_expint/check_value.cc @@ -168,7 +168,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_expint<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/15_hermite/check_value.cc b/libstdc++-v3/testsuite/special_functions/15_hermite/check_value.cc index a16073a..419fcb0 100644 --- a/libstdc++-v3/testsuite/special_functions/15_hermite/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/15_hermite/check_value.cc @@ -1904,7 +1904,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_hermite<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/16_laguerre/check_value.cc b/libstdc++-v3/testsuite/special_functions/16_laguerre/check_value.cc index 89b9c94..03c6496 100644 --- a/libstdc++-v3/testsuite/special_functions/16_laguerre/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/16_laguerre/check_value.cc @@ -305,7 +305,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_laguerre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/17_legendre/check_value.cc b/libstdc++-v3/testsuite/special_functions/17_legendre/check_value.cc index b2c0077..7bfb98c 100644 --- a/libstdc++-v3/testsuite/special_functions/17_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/17_legendre/check_value.cc @@ -305,7 +305,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/18_riemann_zeta/check_value.cc b/libstdc++-v3/testsuite/special_functions/18_riemann_zeta/check_value.cc index 1967bf7..c8589ff 100644 --- a/libstdc++-v3/testsuite/special_functions/18_riemann_zeta/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/18_riemann_zeta/check_value.cc @@ -273,7 +273,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_riemann_zeta<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/19_sph_bessel/check_value.cc b/libstdc++-v3/testsuite/special_functions/19_sph_bessel/check_value.cc index 8116ac4..658a13b 100644 --- a/libstdc++-v3/testsuite/special_functions/19_sph_bessel/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/19_sph_bessel/check_value.cc @@ -504,7 +504,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_bessel<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/20_sph_legendre/check_value.cc b/libstdc++-v3/testsuite/special_functions/20_sph_legendre/check_value.cc index df417e6..5783ca9 100644 --- a/libstdc++-v3/testsuite/special_functions/20_sph_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/20_sph_legendre/check_value.cc @@ -1985,7 +1985,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/special_functions/20_sph_legendre/pr86655.cc b/libstdc++-v3/testsuite/special_functions/20_sph_legendre/pr86655.cc index e397371..80809ee 100644 --- a/libstdc++-v3/testsuite/special_functions/20_sph_legendre/pr86655.cc +++ b/libstdc++-v3/testsuite/special_functions/20_sph_legendre/pr86655.cc @@ -37,7 +37,6 @@ template<typename _Tp> void test_m_gt_l() { - bool test __attribute__((unused)) = true; for (auto l : {0u, 1u, 2u, 5u}) for (auto m : {l + 1u, l + 2u}) for (auto i : {-2, -1, 0, 1, 2}) diff --git a/libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc b/libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc index 372ca39..c9873b6 100644 --- a/libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc +++ b/libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc @@ -554,7 +554,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_neumann<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/std/format/debug.cc b/libstdc++-v3/testsuite/std/format/debug.cc index 965b4df..43e930c 100644 --- a/libstdc++-v3/testsuite/std/format/debug.cc +++ b/libstdc++-v3/testsuite/std/format/debug.cc @@ -26,13 +26,13 @@ fdebug(std::wstring_view t) #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) -template<typename _CharT> +template<typename CharT> void test_basic_escapes() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto tab = WIDEN("\t"); res = fdebug(tab); @@ -71,11 +71,11 @@ test_basic_escapes() VERIFY( res == WIDEN(R"('\'')") ); } -template<typename _CharT> +template<typename CharT> void test_ascii_escapes() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto in = WIDEN("\x10 abcde\x7f\t0123"); res = fdebug(in); @@ -88,11 +88,11 @@ test_ascii_escapes() VERIFY( res == WIDEN(R"('a')") ); } -template<typename _CharT> +template<typename CharT> void test_extended_ascii() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto in = WIDEN("Åëÿ"); res = fdebug(in); @@ -100,7 +100,7 @@ test_extended_ascii() static constexpr bool __test_characters #if UNICODE_ENC - = sizeof(_CharT) >= 2; + = sizeof(CharT) >= 2; #else // ISO8859-1 = true; #endif // UNICODE_ENC @@ -116,12 +116,12 @@ test_extended_ascii() } } -template<typename _CharT> +template<typename CharT> void test_unicode_escapes() { #if UNICODE_ENC - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto in = WIDEN( "\u008a" // Cc, Control, Line Tabulation Set, @@ -143,7 +143,7 @@ test_unicode_escapes() res = fdebug(in); VERIFY( res == out ); - if constexpr (sizeof(_CharT) >= 2) + if constexpr (sizeof(CharT) >= 2) { res = fdebug(in[0]); VERIFY( res == WIDEN(R"('\u{8a}')") ); @@ -157,7 +157,7 @@ test_unicode_escapes() VERIFY( res == WIDEN(R"('\u{2029}')") ); } - if constexpr (sizeof(_CharT) >= 4) + if constexpr (sizeof(CharT) >= 4) { res = fdebug(in[5]); VERIFY( res == WIDEN("'\U0001f984'") ); @@ -165,25 +165,25 @@ test_unicode_escapes() #endif // UNICODE_ENC } -template<typename _CharT> +template<typename CharT> void test_grapheme_extend() { #if UNICODE_ENC - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto vin = WIDEN("o\u0302\u0323"); res = fdebug(vin); VERIFY( res == WIDEN("\"o\u0302\u0323\"") ); - std::basic_string_view<_CharT> in = WIDEN("\t\u0302\u0323"); + std::basic_string_view<CharT> in = WIDEN("\t\u0302\u0323"); res = fdebug(in); VERIFY( res == WIDEN(R"("\t\u{302}\u{323}")") ); res = fdebug(in.substr(1)); VERIFY( res == WIDEN(R"("\u{302}\u{323}")") ); - if constexpr (sizeof(_CharT) >= 2) + if constexpr (sizeof(CharT) >= 2) { res = fdebug(in[1]); VERIFY( res == WIDEN(R"('\u{302}')") ); @@ -191,13 +191,13 @@ test_grapheme_extend() #endif // UNICODE_ENC } -template<typename _CharT> +template<typename CharT> void test_replacement_char() { #if UNICODE_ENC - std::basic_string<_CharT> repl = WIDEN("\uFFFD"); - std::basic_string<_CharT> res = fdebug(repl); + std::basic_string<CharT> repl = WIDEN("\uFFFD"); + std::basic_string<CharT> res = fdebug(repl); VERIFY( res == WIDEN("\"\uFFFD\"") ); repl = WIDEN("\uFFFD\uFFFD"); @@ -268,13 +268,13 @@ test_ill_formed_utf32() #endif // UNICODE_ENC } -template<typename _CharT> +template<typename CharT> void test_fill() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; - std::basic_string_view<_CharT> in = WIDEN("a\t\x10\u00ad"); + std::basic_string_view<CharT> in = WIDEN("a\t\x10\u00ad"); res = std::format(WIDEN("{:10?}"), in.substr(0, 1)); VERIFY( res == WIDEN(R"("a" )") ); @@ -299,11 +299,11 @@ test_fill() VERIFY( res == WIDEN(R"(="\u{ad}"=)") ); // width is 2 - std::basic_string_view<_CharT> in2 = WIDEN("\u1100"); + std::basic_string_view<CharT> in2 = WIDEN("\u1100"); res = std::format(WIDEN("{:*^10?}"), in2); VERIFY( res == WIDEN("***\"\u1100\"***") ); - if constexpr (sizeof(_CharT) >= 2) + if constexpr (sizeof(CharT) >= 2) { res = std::format(WIDEN("{:=^10?}"), in[3]); VERIFY( res == WIDEN(R"(='\u{ad}'=)") ); @@ -314,14 +314,14 @@ test_fill() #endif // UNICODE_ENC } -template<typename _CharT> +template<typename CharT> void test_prec() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; // with ? escpaed presentation is copied to ouput, same as source - std::basic_string_view<_CharT> in = WIDEN("a\t\x10\u00ad"); + std::basic_string_view<CharT> in = WIDEN("a\t\x10\u00ad"); res = std::format(WIDEN("{:.2?}"), in.substr(0, 1)); VERIFY( res == WIDEN(R"("a)") ); @@ -335,7 +335,7 @@ test_prec() res = std::format(WIDEN("{:.10?}"), in.substr(3)); VERIFY( res == WIDEN(R"("\u{ad}")") ); - std::basic_string_view<_CharT> in2 = WIDEN("\u1100"); + std::basic_string_view<CharT> in2 = WIDEN("\u1100"); res = std::format(WIDEN("{:.3?}"), in2); VERIFY( res == WIDEN("\"\u1100") ); #endif // UNICODE_ENC @@ -759,38 +759,38 @@ private: std::formatter<T, CharT> under; }; -template<typename _CharT, typename StrT> +template<typename CharT, typename StrT> void test_formatter_str() { - _CharT buf[]{ 'a', 'b', 'c', 0 }; + CharT buf[]{ 'a', 'b', 'c', 0 }; DebugWrapper<StrT> in{ buf }; - std::basic_string<_CharT> res = std::format(WIDEN("{:?}"), in ); + std::basic_string<CharT> res = std::format(WIDEN("{:?}"), in ); VERIFY( res == WIDEN(R"("abc")") ); } -template<typename _CharT> +template<typename CharT> void test_formatter_arr() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; - DebugWrapper<_CharT[3]> in3{ 'a', 'b', 'c' }; + DebugWrapper<CharT[3]> in3{ 'a', 'b', 'c' }; res = std::format(WIDEN("{:?}"), in3 ); VERIFY( res == WIDEN(R"("abc")") ); // We print all characters, including null-terminator - DebugWrapper<_CharT[4]> in4{ 'a', 'b', 'c', 0 }; + DebugWrapper<CharT[4]> in4{ 'a', 'b', 'c', 0 }; res = std::format(WIDEN("{:?}"), in4 ); VERIFY( res == WIDEN(R"("abc\u{0}")") ); } -template<typename _CharT, typename SrcT> +template<typename CharT, typename SrcT> void test_formatter_char() { DebugWrapper<SrcT> in{ 'a' }; - std::basic_string<_CharT> res = std::format(WIDEN("{:?}"), in); + std::basic_string<CharT> res = std::format(WIDEN("{:?}"), in); VERIFY( res == WIDEN(R"('a')") ); } diff --git a/libstdc++-v3/testsuite/std/format/formatter/120625.cc b/libstdc++-v3/testsuite/std/format/formatter/120625.cc new file mode 100644 index 0000000..6b03af9 --- /dev/null +++ b/libstdc++-v3/testsuite/std/format/formatter/120625.cc @@ -0,0 +1,19 @@ +// { dg-do compile { target c++20 } } + +// Bug libstdc++/120625 +// std::formatter<__disabled> specializations cause errors in user code + +#include <format> + +enum X { }; + +// A concept that cannot be used with incomplete types: +template<typename T> +concept is_X = !std::is_empty_v<T> && std::is_same_v<X, T>; + +// A valid program-defined specialization: +template<typename T, typename C> requires is_X<T> +struct std::formatter<T, C> : std::formatter<int, C> { }; + +// Instantiate the program-defined formatter specialization: +auto s = sizeof(std::formatter<X, char>); diff --git a/libstdc++-v3/testsuite/std/format/ranges/adaptors.cc b/libstdc++-v3/testsuite/std/format/ranges/adaptors.cc index daa73aa..a4e2dfb 100644 --- a/libstdc++-v3/testsuite/std/format/ranges/adaptors.cc +++ b/libstdc++-v3/testsuite/std/format/ranges/adaptors.cc @@ -19,7 +19,7 @@ is_format_string_for(const char* str, Args&&... args) } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) template<template<typename Tp> class Adaptor> void @@ -66,13 +66,13 @@ template<typename T> constexpr auto std::format_kind<NotFormattableCont<T>> = std::range_format::disabled; -template<typename _CharT, +template<typename CharT, template<typename Tp, typename Cont = std::vector<Tp>> class Adaptor> void test_output() { const std::vector<int> v{3, 2, 1}; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; Adaptor<int, std::vector<int>> q(std::from_range, v); res = std::format(WIDEN("{}"), q); @@ -88,9 +88,9 @@ test_output() VERIFY( res == WIDEN("==[0x03, 0x02, 0x01]===") ); // Sequence output is always used - Adaptor<_CharT, std::basic_string<_CharT>> qs( + Adaptor<CharT, std::basic_string<CharT>> qs( std::from_range, - std::basic_string_view<_CharT>(WIDEN("321"))); + std::basic_string_view<CharT>(WIDEN("321"))); res = std::format(WIDEN("{}"), qs); VERIFY( res == WIDEN("['3', '2', '1']") ); @@ -114,13 +114,13 @@ test_output() res = std::format(WIDEN("{}"), mq); VERIFY( res == WIDEN("[3, 2, 1]") ); - static_assert(!std::formattable<const Adaptor<MutFormat>, _CharT>); + static_assert(!std::formattable<const Adaptor<MutFormat>, CharT>); - static_assert(!std::formattable<Adaptor<NoFormat>, _CharT>); - static_assert(!std::formattable<const Adaptor<NoFormat>, _CharT>); + static_assert(!std::formattable<Adaptor<NoFormat>, CharT>); + static_assert(!std::formattable<const Adaptor<NoFormat>, CharT>); // Formatter check if container is formattable, not container elements. - static_assert(!std::formattable<Adaptor<int, NotFormattableCont<int>>, _CharT>); + static_assert(!std::formattable<Adaptor<int, NotFormattableCont<int>>, CharT>); } template<template<typename Tp, typename Cont = std::vector<Tp>> class Adaptor> @@ -135,12 +135,12 @@ test_adaptor() static_assert(!std::formattable<Adaptor<int>, char32_t>); } -template<typename _CharT> +template<typename CharT> void test_compare() { const std::vector<int> v{3, 2, 1}; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; std::priority_queue<int, std::vector<int>, std::greater<>> q( std::from_range, v); diff --git a/libstdc++-v3/testsuite/std/format/ranges/formatter.cc b/libstdc++-v3/testsuite/std/format/ranges/formatter.cc index 00ce9f6..d3e0897 100644 --- a/libstdc++-v3/testsuite/std/format/ranges/formatter.cc +++ b/libstdc++-v3/testsuite/std/format/ranges/formatter.cc @@ -6,7 +6,7 @@ #include <vector> #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) template<typename T, template<typename, typename> class Formatter = std::range_formatter> @@ -22,7 +22,6 @@ struct std::formatter<MyVector<T, Formatter>, CharT> { constexpr formatter() noexcept { - using _CharT = CharT; _formatter.set_brackets(WIDEN("<"), WIDEN(">")); _formatter.set_separator(WIDEN("; ")); } @@ -41,12 +40,12 @@ private: Formatter<T, CharT> _formatter; }; -template<typename _CharT, template<typename, typename> class Formatter> +template<typename CharT, template<typename, typename> class Formatter> void test_default() { MyVector<int, Formatter> vec{1, 2, 3}; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{}"), vec); VERIFY( res == WIDEN("<1; 2; 3>") ); @@ -93,13 +92,13 @@ test_default() VERIFY( res == WIDEN("< +1 ; +2 ; +3 >") ); } -template<typename _CharT, template<typename, typename> class Formatter> +template<typename CharT, template<typename, typename> class Formatter> void test_override() { - MyVector<_CharT, Formatter> vc{'a', 'b', 'c', 'd'}; + MyVector<CharT, Formatter> vc{'a', 'b', 'c', 'd'}; MyVector<std::pair<int, int>, Formatter> vp{{1, 11}, {2, 21}}; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:s}"), vc); VERIFY( res == WIDEN("abcd") ); diff --git a/libstdc++-v3/testsuite/std/format/ranges/map.cc b/libstdc++-v3/testsuite/std/format/ranges/map.cc index 1838480..5e1b98f 100644 --- a/libstdc++-v3/testsuite/std/format/ranges/map.cc +++ b/libstdc++-v3/testsuite/std/format/ranges/map.cc @@ -57,7 +57,7 @@ bool is_range_formatter_spec_for(CharT const* spec, Rg&& rg) } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) void test_format_string() @@ -83,10 +83,10 @@ test_format_string() VERIFY( !is_format_string_for("{:{}m}", std::vector<std::pair<int, int>>(), 1.0f) ); } -template<typename _CharT, typename Range> +template<typename CharT, typename Range> void test_output(bool mapIsDefault) { - using Sv = std::basic_string_view<_CharT>; + using Sv = std::basic_string_view<CharT>; using Pt = std::ranges::range_value_t<Range>; using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pt>>; using St = std::remove_cvref_t<std::tuple_element_t<1, Pt>>; @@ -94,7 +94,7 @@ void test_output(bool mapIsDefault) return Range(s.data(), s.data() + s.size()); }; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; size_t size = 0; Ft f1[]{1, 2, 3}; diff --git a/libstdc++-v3/testsuite/std/format/ranges/sequence.cc b/libstdc++-v3/testsuite/std/format/ranges/sequence.cc index 3224286..7fb65f9 100644 --- a/libstdc++-v3/testsuite/std/format/ranges/sequence.cc +++ b/libstdc++-v3/testsuite/std/format/ranges/sequence.cc @@ -76,12 +76,12 @@ test_format_string() } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) -template<typename _CharT, typename Range, typename Storage> +template<typename CharT, typename Range, typename Storage> void test_output() { - using Sv = std::basic_string_view<_CharT>; + using Sv = std::basic_string_view<CharT>; using T = std::ranges::range_value_t<Range>; auto makeRange = [](Storage& s) -> Range { if constexpr (std::is_same_v<std::remove_cvref_t<Range>, Storage>) @@ -91,7 +91,7 @@ void test_output() std::ranges::data(s) + std::ranges::size(s)); }; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; size_t size = 0; Storage v1{1, 2, 3}; diff --git a/libstdc++-v3/testsuite/std/format/ranges/string.cc b/libstdc++-v3/testsuite/std/format/ranges/string.cc index cebdd53..99e5eaf 100644 --- a/libstdc++-v3/testsuite/std/format/ranges/string.cc +++ b/libstdc++-v3/testsuite/std/format/ranges/string.cc @@ -48,7 +48,7 @@ bool is_range_formatter_spec_for(CharT const* spec, Rg&& rg) } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) void test_format_string() @@ -81,14 +81,14 @@ test_format_string() template<typename Range> void test_output() { - using _CharT = std::ranges::range_value_t<Range>; - auto makeRange = [](std::basic_string<_CharT>& s) { + using CharT = std::ranges::range_value_t<Range>; + auto makeRange = [](std::basic_string<CharT>& s) { return Range(s.data(), s.data() + s.size()); }; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; size_t size = 0; - std::basic_string<_CharT> s1 = WIDEN("abcd"); + std::basic_string<CharT> s1 = WIDEN("abcd"); res = std::format(WIDEN("{}"), makeRange(s1)); VERIFY( res == WIDEN("['a', 'b', 'c', 'd']") ); @@ -122,7 +122,7 @@ void test_output() res = std::format(WIDEN("{:=^8s}"), makeRange(s1)); VERIFY( res == WIDEN("==abcd==") ); - std::basic_string<_CharT> s2(512, static_cast<_CharT>('a')); + std::basic_string<CharT> s2(512, static_cast<CharT>('a')); res = std::format(WIDEN("{:=^8s}"), makeRange(s2)); VERIFY( res == s2 ); diff --git a/libstdc++-v3/testsuite/std/format/tuple.cc b/libstdc++-v3/testsuite/std/format/tuple.cc index ff0359b..ba6dae8 100644 --- a/libstdc++-v3/testsuite/std/format/tuple.cc +++ b/libstdc++-v3/testsuite/std/format/tuple.cc @@ -39,7 +39,7 @@ is_format_string_for(const wchar_t* str, Args&&... args) } #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) void test_format_string() @@ -62,13 +62,13 @@ test_format_string() VERIFY( !is_format_string_for("{:{}}", std::tuple<>(), 1.0f) ); } -template<typename _CharT> +template<typename CharT> void test_multi() { - using Sv = std::basic_string_view<_CharT>; - using Str = std::basic_string<_CharT>; + using Sv = std::basic_string_view<CharT>; + using Str = std::basic_string<CharT>; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; std::size_t size = 0; std::tuple<int, Str, float> t1(1, WIDEN("test"), 2.1); @@ -122,10 +122,10 @@ void test_multi() } -template<typename _CharT, typename Tuple> +template<typename CharT, typename Tuple> void test_empty() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; Tuple e1; res = std::format(WIDEN("{}"), e1); @@ -141,13 +141,13 @@ void test_empty() VERIFY( res == WIDEN(R"(^^^^())") ); } -template<typename _CharT, typename Pair> +template<typename CharT, typename Pair> void test_pair() { using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pair>>; using St = std::remove_cvref_t<std::tuple_element_t<1, Pair>>; - std::basic_string<_CharT> res; + std::basic_string<CharT> res; Ft f1 = 1; St s1 = WIDEN("abc"); @@ -187,7 +187,6 @@ struct std::formatter<MyPair<Pair>, CharT> { constexpr formatter() noexcept { - using _CharT = CharT; _formatter.set_brackets(WIDEN("<"), WIDEN(">")); _formatter.set_separator(WIDEN("; ")); } @@ -206,11 +205,11 @@ private: std::formatter<Pair, CharT> _formatter; }; -template<typename _CharT, template<typename, typename> class PairT> +template<typename CharT, template<typename, typename> class PairT> void test_custom() { - std::basic_string<_CharT> res; - MyPair<PairT<int, const _CharT*>> c1(1, WIDEN("abc")); + std::basic_string<CharT> res; + MyPair<PairT<int, const CharT*>> c1(1, WIDEN("abc")); res = std::format(WIDEN("{}"), c1); VERIFY( res == WIDEN(R"(<1; "abc">)") ); diff --git a/libstdc++-v3/testsuite/std/time/format/empty_spec.cc b/libstdc++-v3/testsuite/std/time/format/empty_spec.cc index 99cbd74..5f7b868 100644 --- a/libstdc++-v3/testsuite/std/time/format/empty_spec.cc +++ b/libstdc++-v3/testsuite/std/time/format/empty_spec.cc @@ -10,7 +10,7 @@ using namespace std::chrono; #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) template<typename CharT, typename T> void @@ -34,15 +34,15 @@ test_no_empty_spec() } } -template<typename T, typename _CharT> -void verify(const T& t, std::basic_string_view<_CharT> str) +template<typename T, typename CharT> +void verify(const T& t, std::basic_string_view<CharT> str) { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{}"), t); VERIFY( res == str ); - std::basic_stringstream<_CharT> os; + std::basic_stringstream<CharT> os; os << t; res = std::move(os).str(); VERIFY( res == str ); @@ -52,11 +52,11 @@ template<typename T, typename CharT> void verify(const T& t, const CharT* str) { verify(t, std::basic_string_view<CharT>(str)); } -template<typename _CharT> +template<typename CharT> void test_padding() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:5}"), day(2)); VERIFY( res == WIDEN("02 ") ); @@ -114,9 +114,9 @@ struct Rep friend auto operator<=>(Rep, Rep) = default; - template<typename _CharT> - friend std::basic_ostream<_CharT>& - operator<<(std::basic_ostream<_CharT>& os, const Rep& t) + template<typename CharT> + friend std::basic_ostream<CharT>& + operator<<(std::basic_ostream<CharT>& os, const Rep& t) { return os << t.val << WIDEN("[via <<]"); } long val; @@ -140,27 +140,27 @@ struct std::numeric_limits<Rep<Ret>> : std::numeric_limits<long> { }; -template<typename Ret, typename _CharT> -struct std::formatter<Rep<Ret>, _CharT> - : std::formatter<long, _CharT> +template<typename Ret, typename CharT> +struct std::formatter<Rep<Ret>, CharT> + : std::formatter<long, CharT> { template<typename Out> - typename std::basic_format_context<Out, _CharT>::iterator - format(const Rep<Ret>& t, std::basic_format_context<Out, _CharT>& ctx) const + typename std::basic_format_context<Out, CharT>::iterator + format(const Rep<Ret>& t, std::basic_format_context<Out, CharT>& ctx) const { - constexpr std::basic_string_view<_CharT> suffix = WIDEN("[via format]"); - auto out = std::formatter<long, _CharT>::format(t.val, ctx); + constexpr std::basic_string_view<CharT> suffix = WIDEN("[via format]"); + auto out = std::formatter<long, CharT>::format(t.val, ctx); return std::ranges::copy(suffix, out).out; } }; using deciseconds = duration<seconds::rep, std::deci>; -template<typename _CharT> +template<typename CharT> void test_duration() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const milliseconds di(40); verify( di, WIDEN("40ms") ); @@ -170,6 +170,13 @@ test_duration() verify( -di, WIDEN("-40ms") ); res = std::format(WIDEN("{:>6}"), -di); VERIFY( res == WIDEN(" -40ms") ); +} + +template<typename CharT> +void +test_duration_fp() +{ + std::basic_string<CharT> res; const duration<double> df(11.22); verify( df, WIDEN("11.22s") ); @@ -179,13 +186,17 @@ test_duration() verify( -df, WIDEN("-11.22s") ); res = std::format(WIDEN("{:=^12}"), -df); VERIFY( res == WIDEN("==-11.22s===") ); + + // precision accepted but ignored + res = std::format(WIDEN("{:.6}"), df); + VERIFY( res == WIDEN("11.22s") ); } -template<typename _CharT> +template<typename CharT> void test_duration_cust() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const duration<char, std::ratio<1, 10>> charRep(123); verify( charRep, WIDEN("123ds") ); @@ -242,7 +253,7 @@ hms(const duration<Rep, Period>& d) return hh_mm_ss<Dur>(duration_cast<Dur>(d)); } -template<typename _CharT> +template<typename CharT> void test_hh_mm_ss() { @@ -292,7 +303,45 @@ test_hh_mm_ss() WIDEN("-14322:24:54.111222333") ); } -template<typename _CharT> +template<typename CharT> +void +test_hh_mm_ss_fp() +{ + duration<double> dt = 22h + 24min + 54s + 111222333ns; + // period controls number of subseconds + verify( hms<nanoseconds>(dt), + WIDEN("22:24:54.111222333") ); + verify( hms<microseconds>(dt), + WIDEN("22:24:54.111222") ); + verify( hms<milliseconds>(dt), + WIDEN("22:24:54.111") ); + verify( hms<deciseconds>(dt), + WIDEN("22:24:54.1") ); + verify( hms<seconds>(dt), + WIDEN("22:24:54") ); + verify( hms<nanoseconds>(-dt), + WIDEN("-22:24:54.111222333") ); + verify( hms<microseconds>(-dt), + WIDEN("-22:24:54.111222") ); + verify( hms<milliseconds>(-dt), + WIDEN("-22:24:54.111") ); + verify( hms<deciseconds>(-dt), + WIDEN("-22:24:54.1") ); + verify( hms<seconds>(-dt), + WIDEN("-22:24:54") ); + + // but hour and minutes are preserved + verify( hms<minutes>(dt), + WIDEN("22:24:54") ); + verify( hms<hours>(dt), + WIDEN("22:24:54") ); + verify( hms<minutes>(-dt), + WIDEN("-22:24:54") ); + verify( hms<hours>(-dt), + WIDEN("-22:24:54") ); +} + +template<typename CharT> void test_hh_mm_ss_cust() { @@ -339,13 +388,15 @@ void test_durations() { test_duration<CharT>(); + test_duration_fp<CharT>(); test_duration_cust<CharT>(); test_hh_mm_ss<CharT>(); + test_hh_mm_ss_fp<CharT>(); test_hh_mm_ss_cust<CharT>(); } -template<typename _CharT> +template<typename CharT> void test_day() { @@ -357,7 +408,7 @@ test_day() verify( day(255), WIDEN("255 is not a valid day") ); } -template<typename _CharT> +template<typename CharT> void test_month() { @@ -371,7 +422,7 @@ test_month() verify( month(255), WIDEN("255 is not a valid month") ); } -template<typename _CharT> +template<typename CharT> void test_year() { @@ -386,7 +437,7 @@ test_year() verify( year(32767), WIDEN( "32767") ); } -template<typename _CharT> +template<typename CharT> void test_weekday() { @@ -400,7 +451,7 @@ test_weekday() verify( weekday(255), WIDEN("255 is not a valid weekday") ); } -template<typename _CharT> +template<typename CharT> void test_weekday_indexed() { @@ -415,7 +466,7 @@ test_weekday_indexed() verify( weekday(32)[7], WIDEN("32 is not a valid weekday[7 is not a valid index]") ); } -template<typename _CharT> +template<typename CharT> void test_weekday_last() { @@ -423,7 +474,7 @@ test_weekday_last() verify( weekday(9)[last], WIDEN("9 is not a valid weekday[last]") ); } -template<typename _CharT> +template<typename CharT> void test_month_day() { @@ -433,7 +484,7 @@ test_month_day() verify( month(13)/32, WIDEN("13 is not a valid month/32 is not a valid day") ); } -template<typename _CharT> +template<typename CharT> void test_month_day_last() { @@ -441,7 +492,7 @@ test_month_day_last() verify( month(14)/last, WIDEN("14 is not a valid month/last") ); } -template<typename _CharT> +template<typename CharT> void test_month_weekday() { @@ -457,7 +508,7 @@ test_month_weekday() WIDEN("13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") ); } -template<typename _CharT> +template<typename CharT> void test_month_weekday_last() { @@ -471,7 +522,7 @@ test_month_weekday_last() WIDEN("13 is not a valid month/10 is not a valid weekday[last]") ); } -template<typename _CharT> +template<typename CharT> void test_year_month() { @@ -485,7 +536,7 @@ test_year_month() WIDEN("-32768 is not a valid year/0 is not a valid month") ); } -template<typename _CharT> +template<typename CharT> void test_year_month_day() { @@ -505,7 +556,7 @@ test_year_month_day() WIDEN("-32768-14-55 is not a valid date") ); } -template<typename _CharT> +template<typename CharT> void test_year_month_last() { @@ -519,7 +570,7 @@ test_year_month_last() WIDEN("-32768 is not a valid year/0 is not a valid month/last") ); } -template<typename _CharT> +template<typename CharT> void test_year_month_weekday() { @@ -535,7 +586,7 @@ test_year_month_weekday() WIDEN("-32768 is not a valid year/13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") ); } -template<typename _CharT> +template<typename CharT> void test_year_month_weekday_last() { @@ -593,14 +644,14 @@ wall_cast(const local_time<Dur2>& tp) using decadays = duration<days::rep, std::ratio_multiply<std::deca, days::period>>; using kilodays = duration<days::rep, std::ratio_multiply<std::kilo, days::period>>; -template<typename _CharT, typename Clock> +template<typename CharT, typename Clock> void test_time_point(bool daysAsTime) { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns; - auto strip_time = [daysAsTime](std::basic_string_view<_CharT> sv) + auto strip_time = [daysAsTime](std::basic_string_view<CharT> sv) { return daysAsTime ? sv : sv.substr(0, 10); }; verify( wall_cast<Clock, nanoseconds>(lt), @@ -623,11 +674,11 @@ test_time_point(bool daysAsTime) strip_time(WIDEN("2022-01-08 00:00:00")) ); } -template<typename _CharT> +template<typename CharT> void test_leap_second() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; const auto st = sys_days(2012y/June/30) + 23h + 59min + 59s + 111222333ns; auto tp = clock_cast<utc_clock>(st); @@ -649,7 +700,7 @@ auto make_zoned(const sys_time<Dur2>& st, const time_zone* tz) { return zoned_time<Dur>(tz, floor<Dur>(st)); } -template<typename _CharT> +template<typename CharT> void test_zoned_time() { @@ -683,11 +734,11 @@ auto local_fmt(const local_time<Dur2>& lt, std::string* zone) { return local_time_format(floor<Dur>(lt), zone); } -template<typename _CharT> +template<typename CharT> void test_local_time_format() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; std::string abbrev = "Zone"; const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns; @@ -733,7 +784,7 @@ test_time_points() } #if _GLIBCXX_USE_CXX11_ABI || !_GLIBCXX_USE_DUAL_ABI -template<typename _CharT> +template<typename CharT> void test_sys_info() { @@ -745,13 +796,13 @@ test_sys_info() 15min, "Zone" }; - const std::basic_string_view<_CharT> txt + const std::basic_string_view<CharT> txt = WIDEN("[2024-03-22 02:00:00,2025-04-11 23:15:10,02:13:04,15min,Zone]"); verify( si, txt ); - std::basic_string<_CharT> res; - std::basic_string_view<_CharT> sv; + std::basic_string<CharT> res; + std::basic_string_view<CharT> sv; sv = res = std::format(WIDEN("{:65}"), si); VERIFY( sv.ends_with(WIDEN(" ")) ); @@ -766,11 +817,11 @@ test_sys_info() VERIFY( sv == txt ); } -template<typename _CharT> +template<typename CharT> void test_local_info() { - using String = std::basic_string<_CharT>; - using StringView = std::basic_string_view<_CharT>; + using String = std::basic_string<CharT>; + using StringView = std::basic_string_view<CharT>; const sys_info s1 { diff --git a/libstdc++-v3/testsuite/std/time/format/pr117214.cc b/libstdc++-v3/testsuite/std/time/format/pr117214.cc index 87c703d..79109c3 100644 --- a/libstdc++-v3/testsuite/std/time/format/pr117214.cc +++ b/libstdc++-v3/testsuite/std/time/format/pr117214.cc @@ -7,10 +7,14 @@ #include <chrono> #include <locale> +#include <span> #include <testsuite_hooks.h> + +template<typename ChronoType> void -test_c() +test_locale_formats(const ChronoType& t, + std::span<const char* const> test_specifiers) { const char *test_locales[] = { "aa_DJ.UTF-8", @@ -19,15 +23,44 @@ test_c() "az_IR.UTF-8", "my_MM.UTF-8", }; - std::chrono::sys_seconds t{std::chrono::seconds{1}}; + auto format_args = std::make_format_args(t); for (auto locale_name : test_locales) { - auto s = std::format(std::locale(locale_name), "{:L%c}", t); - VERIFY( !s.empty() ); + std::locale loc(locale_name); + for (auto specifier : test_specifiers) + { + auto s = std::vformat(loc, specifier, format_args); + VERIFY( !s.empty() ); + } } } +void +test_locale_formats() +{ + using namespace std::chrono; + + const char* test_specifiers[] = { + "{:L%x}", "{:L%Ex}", + "{:L%c}", "{:L%Ec}", + "{:L%X}", "{:L%EX}", + "{:L%r}", + }; + auto date_time_specifiers = std::span(test_specifiers); + auto date_specifiers = date_time_specifiers.subspan(0, 2); + auto time_specifiers = date_time_specifiers.subspan(4); + + auto ymd = 2020y/November/12d; + test_locale_formats(ymd, date_specifiers); + + auto tod = 25h + 10min + 12s; + test_locale_formats(tod, time_specifiers); + + auto tp = sys_days(ymd) + tod; + test_locale_formats(tp, date_time_specifiers); +} + #include <stdlib.h> #include <time.h> @@ -93,7 +126,7 @@ test_c_local() int main() { - test_c(); + test_locale_formats(); test_c_zoned(); test_c_local(); } diff --git a/libstdc++-v3/testsuite/std/time/format/pr120114.cc b/libstdc++-v3/testsuite/std/time/format/pr120114.cc index c630bb3..cdde468 100644 --- a/libstdc++-v3/testsuite/std/time/format/pr120114.cc +++ b/libstdc++-v3/testsuite/std/time/format/pr120114.cc @@ -7,13 +7,13 @@ #include <testsuite_hooks.h> #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) -template<typename _CharT> +template<typename CharT> void test_from_format_string() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; using namespace std::chrono_literals; auto date = 2025y/std::chrono::May/05d; @@ -27,24 +27,24 @@ test_from_format_string() VERIFY( res == WIDEN("====2025-05-05\U0001f921====") ); } -template<typename _CharT> +template<typename CharT> void test_formatted_value() { // Custom time_put facet which returns Ideographic Telegraph Symbol // for given month for Om. - struct TimePut : std::time_put<_CharT> + struct TimePut : std::time_put<CharT> { - using iter_type = std::time_put<_CharT>::iter_type; - using char_type = std::time_put<_CharT>::char_type; + using iter_type = std::time_put<CharT>::iter_type; + using char_type = std::time_put<CharT>::char_type; iter_type do_put(iter_type out, std::ios_base& io, char_type fill, const tm* t, char format, char modifier) const override { if (format != 'm' && modifier != 'm') - return std::time_put<_CharT>::do_put(out, io, fill, t, format, modifier); - std::basic_string_view<_CharT> str; + return std::time_put<CharT>::do_put(out, io, fill, t, format, modifier); + std::basic_string_view<CharT> str; switch (t->tm_mon) { case 0: @@ -89,7 +89,7 @@ test_formatted_value() }; const std::locale loc(std::locale::classic(), new TimePut); - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(loc, WIDEN("{:<1L%Om}"), std::chrono::January); VERIFY( res == WIDEN("\u32C0") ); diff --git a/libstdc++-v3/testsuite/std/time/format/pr120481.cc b/libstdc++-v3/testsuite/std/time/format/pr120481.cc index 5878c5b..a748acb 100644 --- a/libstdc++-v3/testsuite/std/time/format/pr120481.cc +++ b/libstdc++-v3/testsuite/std/time/format/pr120481.cc @@ -7,15 +7,15 @@ #include <testsuite_hooks.h> #define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) -#define WIDEN(S) WIDEN_(_CharT, S) +#define WIDEN(S) WIDEN_(CharT, S) using namespace std::chrono; -template<typename _CharT> +template<typename CharT> void test_year() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%Y}"), year(0)); VERIFY( res == WIDEN("0000") ); @@ -77,11 +77,11 @@ test_year() VERIFY( res == WIDEN("01") ); } -template<typename _CharT> +template<typename CharT> void test_month() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%m}"), month(5)); VERIFY( res == WIDEN("05") ); @@ -93,11 +93,11 @@ test_month() VERIFY( res == WIDEN("254") ); } -template<typename _CharT> +template<typename CharT> void test_day() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%d}"), day(3)); VERIFY( res == WIDEN("03") ); @@ -118,11 +118,11 @@ test_day() VERIFY( res == WIDEN("214") ); } -template<typename _CharT> +template<typename CharT> void test_date() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%F}"), year(-22)/month(10)/day(20)); VERIFY( res == WIDEN("-0022-10-20") ); @@ -145,11 +145,11 @@ test_date() VERIFY( res == WIDEN("220/100/00") ); } -template<typename _CharT> +template<typename CharT> void test_weekday() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%w}"), weekday(0)); VERIFY( res == WIDEN("0") ); @@ -187,11 +187,11 @@ test_weekday() VERIFY( res == WIDEN("202") ); } -template<typename _CharT> +template<typename CharT> void test_hour() { - std::basic_string<_CharT> res; + std::basic_string<CharT> res; res = std::format(WIDEN("{:%H}"), 0h + 5min + 6s); VERIFY( res == WIDEN("00") ); diff --git a/libstdc++-v3/testsuite/std/time/format/precision.cc b/libstdc++-v3/testsuite/std/time/format/precision.cc new file mode 100644 index 0000000..ccb2c77 --- /dev/null +++ b/libstdc++-v3/testsuite/std/time/format/precision.cc @@ -0,0 +1,107 @@ +// { dg-do run { target c++20 } } + +#include <chrono> +#include <ranges> +#include <testsuite_hooks.h> + +using namespace std::chrono; + +#define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) +#define WIDEN(S) WIDEN_(CharT, S) + +template<typename CharT> +void +test_empty() +{ + std::basic_string<CharT> res; + + const duration<double> d(33.111222); + res = std::format(WIDEN("{:.3}"), d); + VERIFY( res == WIDEN("33.1112s") ); + res = std::format(WIDEN("{:.6}"), d); + VERIFY( res == WIDEN("33.1112s") ); + res = std::format(WIDEN("{:.9}"), d); + VERIFY( res == WIDEN("33.1112s") ); + + // Uses ostream operator<< + const duration<double, std::nano> nd = d; + res = std::format(WIDEN("{:.3}"), nd); + VERIFY( res == WIDEN("3.31112e+10ns") ); + res = std::format(WIDEN("{:.6}"), nd); + VERIFY( res == WIDEN("3.31112e+10ns") ); + res = std::format(WIDEN("{:.9}"), nd); + VERIFY( res == WIDEN("3.31112e+10ns") ); +} + +template<typename CharT> +void +test_Q() +{ + std::basic_string<CharT> res; + + const duration<double> d(7.111222); + res = std::format(WIDEN("{:.3%Q}"), d); + VERIFY( res == WIDEN("7.111222") ); + res = std::format(WIDEN("{:.6%Q}"), d); + VERIFY( res == WIDEN("7.111222") ); + res = std::format(WIDEN("{:.9%Q}"), d); + VERIFY( res == WIDEN("7.111222") ); + + const duration<double, std::nano> nd = d; + res = std::format(WIDEN("{:.3%Q}"), nd); + VERIFY( res == WIDEN("7111222000") ); + res = std::format(WIDEN("{:.6%Q}"), nd); + VERIFY( res == WIDEN("7111222000") ); + res = std::format(WIDEN("{:.9%Q}"), nd); + VERIFY( res == WIDEN("7111222000") ); +} + +template<typename CharT> +void +test_S() +{ + std::basic_string<CharT> res; + + // Precision is ignored, but period affects output + const duration<double> d(5.111222); + res = std::format(WIDEN("{:.3%S}"), d); + VERIFY( res == WIDEN("05") ); + res = std::format(WIDEN("{:.6%S}"), d); + VERIFY( res == WIDEN("05") ); + res = std::format(WIDEN("{:.9%S}"), d); + VERIFY( res == WIDEN("05") ); + + const duration<double, std::milli> md = d; + res = std::format(WIDEN("{:.3%S}"), md); + VERIFY( res == WIDEN("05.111") ); + res = std::format(WIDEN("{:.6%S}"), md); + VERIFY( res == WIDEN("05.111") ); + res = std::format(WIDEN("{:.9%S}"), md); + VERIFY( res == WIDEN("05.111") ); + + const duration<double, std::nano> nd = d; + res = std::format(WIDEN("{:.3%S}"), nd); + VERIFY( res == WIDEN("05.111222000") ); + res = std::format(WIDEN("{:.6%S}"), nd); + VERIFY( res == WIDEN("05.111222000") ); + res = std::format(WIDEN("{:.9%S}"), nd); + VERIFY( res == WIDEN("05.111222000") ); +} + +template<typename CharT> +void +test_all() +{ + test_empty<CharT>(); + test_Q<CharT>(); + test_S<CharT>(); +} + +int main() +{ + test_all<char>(); + +#ifdef _GLIBCXX_USE_WCHAR_T + test_all<wchar_t>(); +#endif // _GLIBCXX_USE_WCHAR_T +} diff --git a/libstdc++-v3/testsuite/std/time/format/whitespace.cc b/libstdc++-v3/testsuite/std/time/format/whitespace.cc new file mode 100644 index 0000000..debda08 --- /dev/null +++ b/libstdc++-v3/testsuite/std/time/format/whitespace.cc @@ -0,0 +1,56 @@ +// { dg-do run { target c++20 } } + +#include <chrono> +#include <testsuite_hooks.h> + +using namespace std::chrono; + +#define WIDEN_(C, S) ::std::__format::_Widen<C>(S, L##S) +#define WIDEN(S) WIDEN_(_CharT, S) + +template<typename _CharT, typename ChronoType> +void +test(const ChronoType& ct) +{ + std::basic_string<_CharT> res; + + res = std::format(WIDEN("{:%% %t %n more text}"), ct); + VERIFY( res == WIDEN("% \t \n more text") ); + + res = std::format(WIDEN("{:7%% %t %n}"), ct); + VERIFY( res == WIDEN("% \t \n ") ); + + res = std::format(WIDEN("{:>6%% %t %n}"), ct); + VERIFY( res == WIDEN(" % \t \n") ); + + res = std::format(WIDEN("{:+>7%% %t %n}"), ct); + VERIFY( res == WIDEN("++% \t \n") ); + + res = std::format(WIDEN("{:=^7%% %t %n}"), ct); + VERIFY( res == WIDEN("=% \t \n=") ); +} + +template<typename CharT> +void +test_all() +{ + test<CharT>(20s); + test<CharT>(10d); + test<CharT>(Monday); + test<CharT>(2020y/January/8); + test<CharT>(local_days(2020y/January/8)); + test<CharT>(sys_days(2020y/January/8) + 13h + 10min + 5s); +#if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI + test<CharT>(sys_info()); + test<CharT>(local_info()); +#endif +} + +int main() +{ + test_all<char>(); + +#ifdef _GLIBCXX_USE_WCHAR_T + test_all<wchar_t>(); +#endif // _GLIBCXX_USE_WCHAR_T +} diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_value.cc index 1ae8371..77e7648 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_value.cc @@ -2217,7 +2217,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_assoc_laguerre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_value.cc index 023f09d..a30700b 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_value.cc @@ -1985,7 +1985,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_assoc_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc index 7f7e3a4..ec99b60 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc @@ -36,7 +36,6 @@ template<typename _Tp> void test_m_gt_l() { - bool test __attribute__((unused)) = true; unsigned int larr[4] = {0u, 1u, 2u, 5u}; for (unsigned int l = 0; l < 4; ++l) for (unsigned int m = larr[l] + 1u; m <= larr[l] + 2u; ++m) diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_value.cc index f61438d..2dcdcbc 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_value.cc @@ -261,7 +261,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_beta<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_value.cc index 76240db..7faffe8 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_value.cc @@ -73,7 +73,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_1<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_value.cc index b46a140..60adcb1 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_value.cc @@ -73,7 +73,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_2<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc index aba5284..34f5956 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_comp_ellint_3<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_value.cc index 5b10ea4..1cd2733 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_value.cc @@ -3819,7 +3819,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_conf_hyperg<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc index cb4b3960..02df6ba 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc @@ -702,7 +702,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_i<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc index 689880d..f3b7fa6 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc @@ -735,7 +735,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_j<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc index a408c3f..10b8092 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_value.cc @@ -746,7 +746,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_bessel_k<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc index 868d278..c365bb5 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc @@ -779,7 +779,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_cyl_neumann<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_value.cc index 2ca367f..acb217d 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_1<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_value.cc index d9e0f7f..7bb33b5 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_value.cc @@ -459,7 +459,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_2<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc index 2da68ab..df624a0 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc @@ -6121,7 +6121,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_ellint_3<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_value_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_value_neg.cc index 33d95c9..64f7685 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_value_neg.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_value_neg.cc @@ -168,7 +168,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_expint<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc index 8afbcdd..0676f62 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_value.cc @@ -1904,7 +1904,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_hermite<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc index c77dc3d..b83994e 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc @@ -12292,7 +12292,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_hyperg<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_value.cc index 60d6af0..2fee8e4 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_value.cc @@ -305,7 +305,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_laguerre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_value.cc index 19f096d..325ae0d 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_value.cc @@ -305,7 +305,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc index 658faa7..cbbccdf 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc @@ -273,7 +273,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_riemann_zeta<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc index 5863f9a..f2ef94b 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc @@ -504,7 +504,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_bessel<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_value.cc index 910485f..1e178a6 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_value.cc @@ -1985,7 +1985,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_legendre<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/pr86655.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/pr86655.cc index 11c9935..87f63ce 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/pr86655.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/pr86655.cc @@ -36,7 +36,6 @@ template<typename _Tp> void test_m_gt_l() { - bool test __attribute__((unused)) = true; unsigned int larr[4] = {0u, 1u, 2u, 5u}; for (unsigned int l = 0; l < 4; ++l) for (unsigned int m = larr[l] + 1u; m <= larr[l] + 2u; ++m) diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc index 8134e7f..64cfce9 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc @@ -554,7 +554,6 @@ template<typename Ret, unsigned int Num> void test(const testcase_sph_neumann<Ret> (&data)[Num], Ret toler) { - bool test __attribute__((unused)) = true; const Ret eps = std::numeric_limits<Ret>::epsilon(); Ret max_abs_diff = -Ret(1); Ret max_abs_frac = -Ret(1); |