diff options
436 files changed, 16631 insertions, 5148 deletions
@@ -1,3 +1,12 @@ +2025-06-09 Kugan Vivekanandarajah <kvivekananda@nvidia.com> + + * configure.ac: Special case cpu_type for x86_64. + * configure: Regenerate. + +2025-06-09 Peter Bergner <bergner@tenstorrent.com> + + * MAINTAINERS: Update my email address and add myself to DCO. + 2025-05-28 Kugan Vivekanandarajah <kvivekananda@nvidia.com> * Makefile.def: Fix typo in cpu_type diff --git a/MAINTAINERS b/MAINTAINERS index e473c01..6f66374 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -308,7 +308,7 @@ loop optimizer Zdenek Dvorak <ook@ucw.cz> LTO Richard Biener <rguenther@suse.de> LTO plugin Cary Coutant <ccoutant@gmail.com> Plugin Le-Chun Wu <lcwu@google.com> -register allocation Peter Bergner <bergner@linux.ibm.com> +register allocation Peter Bergner <bergner@tenstorrent.com> register allocation Kenneth Zadeck <zadeck@naturalbridge.com> register allocation Seongbae Park <seongbae.park@gmail.com> riscv port Robin Dapp <rdapp.gcc@gmail.com> @@ -358,7 +358,7 @@ Serge Belyshev - <belyshev@depni.sinp.msu.ru> Jon Beniston jbeniston <jon@beniston.com> Andrew Bennett - <andrew.bennett@imgtec.com> Andrew Benson abensonca <abensonca@gmail.com> -Peter Bergner bergner <bergner@linux.ibm.com> +Peter Bergner bergner <bergner@tenstorrent.com> Daniel Berlin dberlin <dberlin@dberlin.org> Pat Bernardi - <bernardi@adacore.com> Jan Beulich - <jbeulich@suse.com> @@ -934,6 +934,7 @@ information. Soumya AR <soumyaa@nvidia.com> +Peter Bergner <bergner@tenstorrent.com> Dhruv Chawla <dhruvc@nvidia.com> Juergen Christ <jchrist@linux.ibm.com> Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> @@ -3397,6 +3397,10 @@ case "${target}" in esac cpu_type=`echo ${host} | sed 's/-.*$//'` +# Special case cpu_type for x86_64 as it shares AUTO_PROFILE from i386. +if test "${cpu_type}" = "x86_64" ; then + cpu_type="i386" +fi # Disable libssp for some systems. diff --git a/configure.ac b/configure.ac index 33c130f..5fa101f 100644 --- a/configure.ac +++ b/configure.ac @@ -622,6 +622,10 @@ case "${target}" in esac cpu_type=`echo ${host} | sed 's/-.*$//'` +# Special case cpu_type for x86_64 as it shares AUTO_PROFILE from i386. +if test "${cpu_type}" = "x86_64" ; then + cpu_type="i386" +fi AC_SUBST(cpu_type) # Disable libssp for some systems. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4580804..4031426 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,528 @@ +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 + conversion of enum logical_location_kind to enum class. + * diagnostic.cc (logical_location_manager::function_p): Likewise. + * libgdiagnostics.cc (html-output/missing-semicolon.py::get_kind): + Likewise. + * logical-location.h (enum logical_location_kind): Convert to... + (enum class logical_location_kind): ...this. + * selftest-logical-location.cc + (test_logical_location_manager::item_from_funcname): Update for + conversion of enum logical_location_kind to enum class. + * tree-logical-location.cc + (tree_logical_location_manager::get_kind): Likewise. + +2025-06-09 Jan Hubicka <hubicka@ucw.cz> + + * cgraph.cc (cgraph_node::apply_scale): New member function. + * cgraph.h (struct cgraph_node): declare. + * ipa-cp.cc (update_counts_for_self_gen_clones): + Use cgraph_node::apply_scale. + (update_profiling_info): Do not overwrite local + profile when dropping to 0 global profile. + (update_specialized_profile): Likewise. + * ipa-inline-transform.cc (update_noncloned_counts): Remove. + (can_remove_node_now_p_1): Fix formating. + (clone_inlined_nodes): Use cgraph_node::apply_scale. + * profile-count.cc (profile_count::dump): Do not ICE + when count is not compatible with entry block count. + * tree-cfg.cc (gimple_verify_flow_info): Check + compatibility of count and entry block count. + +2025-06-09 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * diagnostic-format-html.cc (html_builder::m_title_element): New + field. + (html_builder::html_builder): Initialize it. Don't add + placeholder text. + (html_builder::set_main_input_filename): New. + (html_output_format::set_main_input_filename): New. + (test_html_diagnostic_context::test_html_diagnostic_context): Call + set_main_input_filename on the new sink. + (seldtest::test_simple_log): Update expected <title> text. + * diagnostic-format-json.cc (diagnostic_output_format_init_json): + Return a reference to the new sink. + (diagnostic_output_format_init_json_stderr): Likewise. + (diagnostic_output_format_init_json_file): Likewise. + * diagnostic-format-sarif.cc (sarif_builder::sarif_builder): Drop + "main_input_filename_" param, and move adding an artifact for it + with diagnostic_artifact_role::analysis_target to... + (sarif_builder::set_main_input_filename): ...this new function. + (sarif_output_format::set_main_input_filename): New. + (sarif_output_format::sarif_output_format): Drop + "main_input_filename_" param. + (sarif_stream_output_format::sarif_stream_output_format): + Likewise. + (sarif_file_output_format::sarif_file_output_format): Likewise. + (diagnostic_output_format_init_sarif): Return a reference to *FMT. + (diagnostic_output_format_init_sarif_stderr): Return a refererence + to the new sink. Drop "main_input_filename_" param. + (diagnostic_output_format_init_sarif_file): Likewise. + (diagnostic_output_format_init_sarif_stream): Likewise. + (make_sarif_sink): Drop "main_input_filename_" param. + (selftest::test_sarif_diagnostic_context::test_sarif_diagnostic_context): + Likewise. Call set_main_input_filename on the new format. + (selftest::test_sarif_diagnostic_context::buffered_output_format::buffered_output_format): + Drop "main_input_filename_" param. + (selftest::test_make_location_object): Likewise. + * diagnostic-format-sarif.h + (diagnostic_output_format_init_sarif_stderr): Return a refererence + to the new sink. Drop "main_input_filename_" param. + (diagnostic_output_format_init_sarif_file): Likewise. + (diagnostic_output_format_init_sarif_stream): Likewise. + (make_sarif_sink): Drop "main_input_filename_" param. + * diagnostic-format.h + (diagnostic_output_format::set_main_input_filename): New vfunc. + (diagnostic_output_format_init_json_stderr): Return a refererence + to the new sink. + (diagnostic_output_format_init_json_file): Likewise. + * diagnostic.cc (diagnostic_output_format_init): Likewise. Call + set_main_input_filename on the new sink. + * libgdiagnostics.cc (sarif_sink::sarif_sink): Update for above + changes. + * opts-diagnostic.cc (sarif_scheme_handler::make_sink): Likewise. + (handle_OPT_fdiagnostics_add_output_): Likewise. + (handle_OPT_fdiagnostics_set_output_): Likewise. + +2025-06-09 Jeff Law <jlaw@ventanamicro.com> + + * config/riscv/riscv.cc (riscv_noce_conversion_profitable_p): Relax + condition for adjustments due to copies from promoted SUBREGs. + +2025-06-09 Tamar Christina <tamar.christina@arm.com> + + * doc/extend.texi (outline-atomics): Document the inverse -mno flag. + +2025-06-09 Tamar Christina <tamar.christina@arm.com> + + * params.opt (vect-scalar-cost-multiplier): New. + * tree-vect-loop.cc (vect_estimate_min_profitable_iters): Use it. + * doc/invoke.texi (vect-scalar-cost-multiplier): Document it. + +2025-06-09 liuhongt <hongtao.liu@intel.com> + + PR target/103750 + * config/i386/i386.cc (ix86_rtx_costs): Adjust rtx_cost for + maskload. + * config/i386/sse.md (*<avx512>_load<mode>mask_and15): New + define_insn_and_split. + (*<avx512>_load<mode>mask_and3): Ditto. + +2025-06-09 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-v.cc (expand_vx_binary_vec_vec_dup): Add new + case MOD. + * config/riscv/riscv.cc (riscv_rtx_costs): Ditto. + * config/riscv/vector-iterators.md: Add new op mod. + +2025-06-08 Kugan Vivekanandarajah <kvivekananda@nvidia.com> + + * auto-profile.cc (function_instance::merge): Fix typo. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + PR target/120203 + * config/riscv/riscv.cc (CFUN_IN_CALL): New macro. + (struct mode_switching_info): Add new field. + (riscv_frm_adjust_mode_after_call): Remove. + (riscv_frm_mode_needed): Track call_insn. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + PR target/119164 + * config/riscv/riscv.cc (riscv_emit_frm_mode_set): check + STATIC_FRM_P for transition to DYN. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + * config/riscv/riscv.cc (riscv_frm_emit_after_bb_end): Delete. + (riscv_frm_mode_needed): Remove call riscv_frm_emit_after_bb_end. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + * config/riscv/riscv.cc (riscv_dynamic_frm_mode_p): Remove. + (riscv_mode_confluence): Ditto. + (TARGET_MODE_CONFLUENCE): Ditto. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + * emit-rtl.cc (next_nonnote_nondebug_insn): Update comments. + +2025-06-08 Andrew Pinski <quic_apinski@quicinc.com> + + * tree-ssa-phiopt.cc (cond_if_else_store_replacement): Move + definitin of else_vdef to right before the usage. Reformat + slightly. + +2025-06-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/120533 + * tree-ssa-phiopt.cc (cond_if_else_store_replacement_limited): New function. + (pass_phiopt::execute): Call cond_if_else_store_replacement_limited + for diamand case. + +2025-06-08 Andrew Pinski <quic_apinski@quicinc.com> + + * tree-ssa-phiopt.cc (single_trailing_store_in_bb): Add vphi argument. + Check for single use of the vdef of the store instead of a loop + and check vdef's single use statement is the same as vphi. + (cond_if_else_store_replacement): Update call to single_trailing_store_in_bb. + +2025-06-08 Andrew Pinski <quic_apinski@quicinc.com> + + * tree-ssa-phiopt.cc (cond_if_else_store_replacement): Use get_virtual_phi + instead of inlining it. + +2025-06-08 Co-authored-by: Jeff Law <jlaw@ventanamicro.com> + + * config/riscv/riscv.cc (riscv_expand_conditional_move): Use + riscv_extend_comparands to extend sub-word comparison arguments. + +2025-06-08 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> + + * config/xtensa/xtensa.cc (printx, print_operand): + Add two instruction operand format codes 'U' and 'V', + whose represent scale factors of 0 to 15th positive/negative + power of two. + * config/xtensa/xtensa.md (c_enum "unspec"): + Add UNSPEC_CEIL and UNSPEC_FLOOR. + (int_iterator ANY_ROUND, int_attr m_round): + New integer iterator and its attribute. + (fix<s_fix>_truncsfsi2, *fix<s_fix>_truncsfsi2_2x, + *fix<s_fix>_truncsfsi2_scaled, float<s_float>sisf2, + *float<s_float>sisf2_scaled): + Use output templates with the operand formats added above, + instead of individual output statements. + (l<m_round>sfsi2, *l<m_round>sfsi2_2x, *l<m_round>sfsi2_scaled): + New insn patterns. + 2025-06-07 Jeff Law <jlaw@ventanamicro.com> * config/riscv/riscv.cc (riscv_expand_conditional_move): Use diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 800deb1..b1bf7be 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250608 +20250612 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f45c81a..f51e899 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,602 @@ +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, + set Etype of the newly created itype's Scalar_Range from the index's Etype. + * sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is + a fixed-lower-bound type, then check again the Etype of its Scalar_Range. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * sem_prag.adb (Analyze_Pragma): Fix conditions for legality checks on + formal type declarations. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array + type, then set the flags on the base type. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Process_Subtype): Clarify code. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.ads (Process_Subtype): Add formal. + * sem_ch3.adb (Process_Subtype): Use new formal. + (Analyze_Subtype_Declaration, Array_Type_Declaration, + Build_Derived_Access_Type): Pass new actual. + * sem_ch4.adb (Find_Type_Of_Object): Likewise. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch6.adb (Set_Formal_Mode): Extend profile. Move parts of the + body… + (Process_Formals): … here. Move call to Set_Formal_Mode earlier. Call + Set_Is_Not_Self_Hidden in second traversal. + +2025-06-09 Gary Dismukes <dismukes@adacore.com> + + * exp_aggr.adb (Expand_Container_Aggregate): Use the Base_Type of the + subtype provided by the context as the subtype of the temporary object + initialized by the aggregate. + +2025-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * par-ch4.adb (P_Function_Name): Delete body. + (P_Qualified_Simple_Name_Resync): Do not raise Error_Resync on an + operator symbol followed by something else than a dot. + * par-ch6.adb (P_Subprogram): Do not call P_Function_Name. + * par.adb (P_Function_Name): Delete declaration. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem.adb (Analyze): Adapt to new Ekinds. + * sem_ch3.adb (Analyze_Component_Declaration): Set Ekind early. + (Is_Visible_Component, Record_Type_Definition): Adjust. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem.adb (Analyze): Fix comment. + +2025-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * par-ch4.adb (P_Name): Remove obsolete references in comments. + (P_Qualified_Simple_Name): Call P_Qualified_Simple_Name_Resync. + (P_Qualified_Simple_Name_Resync): Adjust a couple of comments. + +2025-06-09 Gary Dismukes <dismukes@adacore.com> + + * exp_util.adb (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): Replace + test of Covers with test of Is_Controlling_Formal. Add handling for + 'Result actuals. Remove Actual_Type and its uses. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Is_Name_Reference): Remove check for selector_name of a + selected_component; reuse existing code for indexed components and + slices. + (Statically_Names_Object): Remove dead code. + +2025-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * einfo.ads (Overlays_Constant): Define in constants and variables. + * gen_il-gen-gen_entities.adb (Entity_Kind): Move Overlays_Constant + semantic flag to... + (Constant_Or_Variable_Kind): ...here. + * sem_util.adb (Note_Possible_Modification): Add guard. + +2025-06-09 Bob Duff <duff@adacore.com> + + * exp_ch6.adb: (Make_Build_In_Place_Call_In_Object_Declaration): + Deal with renamings transformed into object declarations. + * sem_ch8.adb (Analyze_Object_Renaming): + Reinstate transformation of a renaming into + an object declaration. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Analyze_Object_Declaration): Call Mutate_Ekind earlier. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Analyze_Object_Declaration): Tweak error handling. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * par-ch13.adb (Get_Aspect_Specifications): Save and restore flag while + parsing aspect Abstract_State. + * par-ch2.adb (P_Pragma): Same while parsing pragma Abstract_State. + * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Specialize error message + for contract Abstract_State and extended aggregate. + * par.adb (Inside_Abstract_State): Add new context flag. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch10.adb (Analyze_Compilation_Unit): Check for generic bodies. + * exp_disp.adb (Build_Dispatch_Tables): Likewise. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Find_Overlaid_Entity): Don't call Etype on empty Ent; + tune style; move computation of Overl_Typ out of the loop. + +2025-06-09 Javier Miranda <miranda@adacore.com> + + * doc/gnat_rm/implementation_defined_pragmas.rst: Adding + documentation. + * doc/gnat_ugn/the_gnat_compilation_model.rst: ditto. + * gnat_rm.texi: Regenerate. + * gnat_ugn.texi: Regenerate. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_attr.adb (Analyze_Attribute): Remove test. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_util.adb (Enter_Name): Remove special handling. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_util.adb (Enter_Name): Remove comment. + +2025-06-09 Bob Duff <duff@adacore.com> + + * exp_ch6.adb: Remove a couple of "???" suggesting something that + we will likely never do. + (Make_Build_In_Place_Call_In_Object_Declaration): + When a constraint check is needed, do the check. + Do it at the call site for now. + The check is still missing in the untagged case, + because the caller allocates in that case. + * sem_ch8.adb (Analyze_Object_Renaming): + Remove obsolete transformation of a renaming into + an object declaration. Given that we also (sometimes) tranform + object declarations into renamings, this transformation was + adding complexity; the new code in + Make_Build_In_Place_Call_In_Object_Declaration above + would need to explicitly avoid the run-time check in the case of + renamings, because renamings are supposed to ignore the nominal + subtype. Anyway, it is no longer needed. + * exp_ch3.adb (Expand_N_Object_Declaration): Rewrite comment; + it IS clear how to do it, but we haven't done it right yet. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * atree.ads (Copy_Node): Fix comment. + +2025-06-09 Piotr Trojanek <trojanek@adacore.com> + + * exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute + Valid, use signedness from the validated view, not from its base type. + +2025-06-09 Marc Poulhiès <poulhies@adacore.com> + + * sem_util.adb (Find_Overlaid_Entity): Add extra parameter to + extract the type being overlaid. + (Note_Possible_Modification): Adjust call to Find_Overlaid_Entity. + (Ultimate_Overlaid_Entity): Likewise. + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Likewise. + * sem_util.ads (Find_Overlaid_Entity): Add extra parameter to + extract the type being overlaid. + * freeze.adb (Check_Address_Clause): Likewise. + +2025-06-09 Gary Dismukes <dismukes@adacore.com> + + * contracts.adb (Inherit_Condition): Remove Assoc_List and its uses + along with function Check_Condition, since mapping of formals will + effectively be done in Build_Class_Wide_Expression (by Replace_Entity). + * exp_util.adb (Replace_Entity): Only rewrite entity references in + function calls that qualify according to the result of calling the + new function Call_To_Parent_Dispatching_Op_Must_Be_Mapped. + (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): New function that + determines whether a function call to a primitive of Par_Subp + associated tagged type needs to be mapped (according to whether + it has any actuals that reference controlling formals of the + primitive). + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch3.adb (Analyze_Object_Declaration): Remove comment. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_util.ads (Current_Entity_In_Scope): Add example in comment. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * atree.ads (Rewrite, Replace): Clarify comments. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * atree.ads (Rewrite): Remove comment. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * atree.adb (Rewrite): Improve readability. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_util.adb (Kill_Current_Values): Tweak condition. + +2025-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch4.adb (Insert_Conditional_Object_Declaration): Remove Decl + formal parameter, add Typ and Const formal parameters. + (Expand_N_Case_Expression): Fix pasto in comment. Adjust call to + Insert_Conditional_Object_Declaration and tidy up surrounding code. + (Expand_N_If_Expression): Adjust couple of calls to + Insert_Conditional_Object_Declaration. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch8.adb (Find_Selected_Component): Fix error path. + +2025-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * libgnat/s-dourea.adb (Is_Infinity): Rename to... + (Is_Infinity_Or_NaN): ...this. + ("*"): Adjust accordingly. + ("/"): Likewise. + (Sqr): Likewise. + * libgnat/s-dorepr.adb (Two_Prod): Likewise. + (Two_Sqr): Likewise. + * libgnat/s-dorepr__fma.adb (Two_Prod): Likewise. + +2025-06-09 Daniel King <dmking@adacore.com> + + * libgnat/i-cheri.ads + (Set_Bounds, Set_Exact_Bounds): Remove wrong intrinsic binding. + * libgnat/i-cheri.adb + (Set_Bounds, Set_Exact_Bounds): New subprogram bodies. + +2025-06-09 Ronan Desplanques <desplanques@adacore.com> + + * sem_ch8.adb (Find_Selected_Component): Add mention. + 2025-06-06 Piotr Trojanek <trojanek@adacore.com> * urealp.adb (UR_Negate): Capture array element in a local constant. diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index bd36c31..c2a4e1f 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -3242,8 +3242,92 @@ ADA_EXCLUDE_SRCS =\ i-vxwoio.adb i-vxwoio.ads i-vxwork.ads \ s-linux.ads s-vxwext.adb s-vxwext.ads s-win32.ads s-winext.ads \ s-stchop.ads s-stchop.adb \ - s-strcom.adb s-strcom.ads s-thread.ads \ + s-strcom.ads s-strcom.adb \ + s-thread.ads \ s-qnx.ads \ + s-arit128.ads s-arit128.adb \ + s-casi128.ads s-casi128.adb \ + s-caun128.ads s-caun128.adb \ + s-exnllli.ads \ + s-expllli.ads \ + s-explllu.ads \ + s-fode128.ads \ + s-fofi128.ads \ + s-imde128.ads \ + s-imfi128.ads \ + s-imglllb.ads \ + s-imgllli.ads \ + s-imglllu.ads \ + s-imglllw.ads \ + s-pack65.ads s-pack65.adb \ + s-pack66.ads s-pack66.adb \ + s-pack67.ads s-pack67.adb \ + s-pack68.ads s-pack68.adb \ + s-pack69.ads s-pack69.adb \ + s-pack70.ads s-pack70.adb \ + s-pack71.ads s-pack71.adb \ + s-pack72.ads s-pack72.adb \ + s-pack73.ads s-pack73.adb \ + s-pack74.ads s-pack74.adb \ + s-pack75.ads s-pack75.adb \ + s-pack76.ads s-pack76.adb \ + s-pack77.ads s-pack77.adb \ + s-pack78.ads s-pack78.adb \ + s-pack79.ads s-pack79.adb \ + s-pack80.ads s-pack80.adb \ + s-pack81.ads s-pack81.adb \ + s-pack82.ads s-pack82.adb \ + s-pack83.ads s-pack83.adb \ + s-pack84.ads s-pack84.adb \ + s-pack85.ads s-pack85.adb \ + s-pack86.ads s-pack86.adb \ + s-pack87.ads s-pack87.adb \ + s-pack88.ads s-pack88.adb \ + s-pack89.ads s-pack89.adb \ + s-pack90.ads s-pack90.adb \ + s-pack91.ads s-pack91.adb \ + s-pack92.ads s-pack92.adb \ + s-pack93.ads s-pack93.adb \ + s-pack94.ads s-pack94.adb \ + s-pack95.ads s-pack95.adb \ + s-pack96.ads s-pack96.adb \ + s-pack97.ads s-pack97.adb \ + s-pack98.ads s-pack98.adb \ + s-pack99.ads s-pack99.adb \ + s-pack100.ads s-pack100.adb \ + s-pack101.ads s-pack101.adb \ + s-pack102.ads s-pack102.adb \ + s-pack103.ads s-pack103.adb \ + s-pack104.ads s-pack104.adb \ + s-pack105.ads s-pack105.adb \ + s-pack106.ads s-pack106.adb \ + s-pack107.ads s-pack107.adb \ + s-pack108.ads s-pack108.adb \ + s-pack109.ads s-pack109.adb \ + s-pack110.ads s-pack110.adb \ + s-pack111.ads s-pack111.adb \ + s-pack112.ads s-pack112.adb \ + s-pack113.ads s-pack113.adb \ + s-pack114.ads s-pack114.adb \ + s-pack115.ads s-pack115.adb \ + s-pack116.ads s-pack116.adb \ + s-pack117.ads s-pack117.adb \ + s-pack118.ads s-pack118.adb \ + s-pack119.ads s-pack119.adb \ + s-pack120.ads s-pack120.adb \ + s-pack121.ads s-pack121.adb \ + s-pack122.ads s-pack122.adb \ + s-pack123.ads s-pack123.adb \ + s-pack124.ads s-pack124.adb \ + s-pack125.ads s-pack125.adb \ + s-pack126.ads s-pack126.adb \ + s-pack127.ads s-pack127.adb \ + s-vade128.ads \ + s-vafi128.ads \ + s-valllli.ads \ + s-vallllu.ads \ + s-widllli.ads \ + s-widlllu.ads # ADA_EXCLUDE_SRCS without the sources used by the target ADA_EXCLUDE_FILES=$(filter-out \ diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 8a69a0c..17538de 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -2271,10 +2271,10 @@ package body Atree is -- Copy substitute node into place, preserving old fields as required Copy_Node (Source => New_Node, Destination => Old_Node); - Set_Error_Posted (Old_Node, Old_Error_Posted); Set_Check_Actuals (Old_Node, Old_CA); Set_Is_Ignored_Ghost_Node (Old_Node, Old_Is_IGN); + Set_Error_Posted (Old_Node, Old_Error_Posted); if Nkind (New_Node) in N_Subexpr then Set_Paren_Count (Old_Node, Old_Paren_Count); @@ -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/atree.ads b/gcc/ada/atree.ads index c8cc2bc..615d040 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -285,15 +285,11 @@ package Atree is procedure Copy_Node (Source, Destination : Node_Or_Entity_Id); -- Copy the entire contents of the source node to the destination node. - -- The contents of the source node is not affected. If the source node - -- has an extension, then the destination must have an extension also. - -- The parent pointer of the destination and its list link, if any, are - -- not affected by the copy. Note that parent pointers of descendants - -- are not adjusted, so the descendants of the destination node after - -- the Copy_Node is completed have dubious parent pointers. Note that - -- this routine does NOT copy aspect specifications, the Has_Aspects - -- flag in the returned node will always be False. The caller must deal - -- with copying aspect specifications where this is required. + -- The contents of the source node is not affected. The parent pointer of + -- the destination and its list link, if any, are not affected by the copy. + -- Note that parent pointers of descendants are not adjusted, so the + -- descendants of the destination node after the Copy_Node is completed + -- have dubious parent pointers. function New_Copy (Source : Node_Id) return Node_Id; -- This function allocates a new node, and then initializes it by copying @@ -536,16 +532,13 @@ package Atree is procedure Rewrite (Old_Node, New_Node : Node_Id); -- This is used when a complete subtree is to be replaced. Old_Node is the -- root of the old subtree to be replaced, and New_Node is the root of the - -- newly constructed replacement subtree. The actual mechanism is to swap - -- the contents of these two nodes fixing up the parent pointers of the - -- replaced node (we do not attempt to preserve parent pointers for the - -- original node). - -- ??? The above explanation is incorrect, instead Copy_Node is called. + -- newly constructed replacement subtree. -- -- Note: New_Node may not contain references to Old_Node, for example as - -- descendants, since the rewrite would make such references invalid. If - -- New_Node does need to reference Old_Node, then these references should - -- be to a relocated copy of Old_Node (see Relocate_Node procedure). + -- descendants, since the rewrite would turn them into cyclic + -- self-references. If New_Node does need to reference Old_Node, then these + -- references should be to a relocated copy of Old_Node (see Relocate_Node + -- procedure). -- -- Note: The Original_Node function applied to Old_Node (which has now -- been replaced by the contents of New_Node), can be used to obtain the @@ -559,10 +552,8 @@ package Atree is -- original contents of the Old_Node, but rather the New_Node value. -- Replace also preserves the setting of Comes_From_Source. -- - -- Note that New_Node must not contain references to Old_Node, for example - -- as descendants, since the rewrite would make such references invalid. If - -- New_Node does need to reference Old_Node, then these references should - -- be to a relocated copy of Old_Node (see Relocate_Node procedure). + -- The note in the documentation of Rewrite about the risk of creating + -- cyclic references also applies here. -- -- Replace is used in certain circumstances where it is desirable to -- suppress any history of the rewriting operation. Notably, it is used 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/contracts.adb b/gcc/ada/contracts.adb index 810458a..70e9487 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -4399,10 +4399,10 @@ package body Contracts is Seen : Subprogram_List (Subps'Range) := (others => Empty); function Inherit_Condition - (Par_Subp : Entity_Id; - Subp : Entity_Id) return Node_Id; - -- Inherit the class-wide condition from Par_Subp to Subp and adjust - -- all the references to formals in the inherited condition. + (Par_Subp : Entity_Id) return Node_Id; + -- Inherit the class-wide condition from Par_Subp. Simply makes + -- a copy of the condition in preparation for later mapping of + -- referenced formals and functions by Build_Class_Wide_Expression. procedure Merge_Conditions (From : Node_Id; Into : Node_Id); -- Merge two class-wide preconditions or postconditions (the former @@ -4417,92 +4417,11 @@ package body Contracts is ----------------------- function Inherit_Condition - (Par_Subp : Entity_Id; - Subp : Entity_Id) return Node_Id - is - function Check_Condition (Expr : Node_Id) return Boolean; - -- Used in assertion to check that Expr has no reference to the - -- formals of Par_Subp. - - --------------------- - -- Check_Condition -- - --------------------- - - function Check_Condition (Expr : Node_Id) return Boolean is - Par_Formal_Id : Entity_Id; - - function Check_Entity (N : Node_Id) return Traverse_Result; - -- Check occurrence of Par_Formal_Id - - ------------------ - -- Check_Entity -- - ------------------ - - function Check_Entity (N : Node_Id) return Traverse_Result is - begin - if Nkind (N) = N_Identifier - and then Present (Entity (N)) - and then Entity (N) = Par_Formal_Id - then - return Abandon; - end if; - - return OK; - end Check_Entity; - - function Check_Expression is new Traverse_Func (Check_Entity); - - -- Start of processing for Check_Condition - - begin - Par_Formal_Id := First_Formal (Par_Subp); - - while Present (Par_Formal_Id) loop - if Check_Expression (Expr) = Abandon then - return False; - end if; - - Next_Formal (Par_Formal_Id); - end loop; - - return True; - end Check_Condition; - - -- Local variables - - Assoc_List : constant Elist_Id := New_Elmt_List; - Par_Formal_Id : Entity_Id := First_Formal (Par_Subp); - Subp_Formal_Id : Entity_Id := First_Formal (Subp); - New_Condition : Node_Id; - + (Par_Subp : Entity_Id) return Node_Id is begin - while Present (Par_Formal_Id) loop - Append_Elmt (Par_Formal_Id, Assoc_List); - Append_Elmt (Subp_Formal_Id, Assoc_List); - - Next_Formal (Par_Formal_Id); - Next_Formal (Subp_Formal_Id); - end loop; - - -- Check that Parent field of all the nodes have their correct - -- decoration; required because otherwise mapped nodes with - -- wrong Parent field are left unmodified in the copied tree - -- and cause reporting wrong errors at later stages. - - pragma Assert - (Check_Parents (Class_Condition (Kind, Par_Subp), Assoc_List)); - - New_Condition := + return New_Copy_Tree - (Source => Class_Condition (Kind, Par_Subp), - Map => Assoc_List); - - -- Ensure that the inherited condition has no reference to the - -- formals of the parent subprogram. - - pragma Assert (Check_Condition (New_Condition)); - - return New_Condition; + (Source => Class_Condition (Kind, Par_Subp)); end Inherit_Condition; ---------------------- @@ -4616,9 +4535,7 @@ package body Contracts is Par_Prim := Subp_Id; Par_Iface_Prims := Covered_Interface_Primitives (Par_Prim); - Cond := Inherit_Condition - (Subp => Spec_Id, - Par_Subp => Subp_Id); + Cond := Inherit_Condition (Par_Subp => Subp_Id); if Present (Class_Cond) then Merge_Conditions (Cond, Class_Cond); @@ -4662,9 +4579,7 @@ package body Contracts is then Seen (Index) := Subp_Id; - Cond := Inherit_Condition - (Subp => Spec_Id, - Par_Subp => Subp_Id); + Cond := Inherit_Condition (Par_Subp => Subp_Id); Check_Class_Condition (Cond => Cond, diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 3a39ec8..f250d74 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -186,8 +186,8 @@ package body Debug is -- d_S -- d_T Output trace information on invocation path recording -- d_U Disable prepending messages with "error:". - -- d_V Enable verifications on the expanded tree - -- d_W + -- d_V Enable VAST (verifications on the expanded tree) + -- d_W Enable VAST in verbose mode -- d_X Disable assertions to check matching of extra formals -- d_Y -- d_Z @@ -1065,8 +1065,11 @@ package body Debug is -- d_U Disable prepending 'error:' to error messages. This used to be the -- default and can be seen as the opposite of -gnatU. - -- d_V Enable verification of the expanded code before calling the backend - -- and generate error messages on each inconsistency found. + -- d_V Enable VAST (Verifier for the Ada Semantic Tree). This does + -- verification of the expanded code before calling the backend. + + -- d_W Same as d_V, but also prints lots of tracing/debugging output + -- as it walks the tree. -- d_X Disable assertions to check matching of extra formals; switch added -- temporarily to disable these checks until this work is complete if diff --git a/gcc/ada/debug_a.adb b/gcc/ada/debug_a.adb index d36ae69..8d68fc8 100644 --- a/gcc/ada/debug_a.adb +++ b/gcc/ada/debug_a.adb @@ -83,11 +83,8 @@ package body Debug_A is case Nkind (N) is when N_Has_Chars => - Write_Str (" """); - if Present (Chars (N)) then - Write_Str (Get_Name_String (Chars (N))); - end if; - Write_Str (""""); + Write_Str (" "); + Write_Name_For_Debug (Chars (N)); when others => null; end case; 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_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index cae8c16..02013f1 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -123,6 +123,11 @@ and generics may name types with unknown discriminants without using the ``(<>)`` notation. In addition, some but not all of the additional restrictions of Ada 83 are enforced. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + Ada 83 mode is intended for two purposes. Firstly, it allows existing Ada 83 code to be compiled and adapted to GNAT with less effort. Secondly, it aids in keeping code backwards compatible with Ada 83. @@ -149,6 +154,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 95 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + Pragma Ada_05 ============= @@ -166,6 +176,11 @@ This pragma is useful when writing a reusable component that itself uses Ada 2005 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form (which is not a configuration pragma) is used for managing the transition from Ada 95 to Ada 2005 in the run-time library. If an entity is marked @@ -209,6 +224,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2012 features, but which is intended to be usable from Ada 83, Ada 95, or Ada 2005 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2005 to Ada 2012 in the run-time library. If an entity is marked @@ -252,6 +272,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2022 features, but which is intended to be usable from Ada 83, Ada 95, Ada 2005 or Ada 2012 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2012 to Ada 2022 in the run-time library. If an entity is marked 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/doc/gnat_ugn/the_gnat_compilation_model.rst b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst index 64a3631..891886b 100644 --- a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst +++ b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst @@ -1477,6 +1477,10 @@ You can place configuration pragmas either appear at the start of a compilation unit or in a configuration pragma file that applies to all compilations performed in a given compilation environment. +Configuration pragmas placed before a library level package specification +are not propagated to the corresponding package body (see RM 10.1.5(8)); +they must be added explicitly to the package body. + GNAT includes the ``gnatchop`` utility to provide an automatic way to handle configuration pragmas that follows the semantics for compilations (that is, files with multiple units) described in the RM. 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 545c15d..d8958d6 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -463,11 +463,13 @@ package Einfo is -- For an access_to_protected_subprogram parameter it is the declaration -- of the corresponding formal parameter. --- --- Itypes have no explicit declaration, and therefore are not attached to --- the tree: their Parent field is always empty. The Associated_Node_For_ --- Itype is the only way to determine the construct that leads to the --- creation of a given itype entity. + +-- Itypes need not have an explicit declaration, in which case they are +-- not attached to the tree through the Parent field, which is empty. In +-- other cases, they have one and are attached to the tree through the +-- Parent field as usual. Associated_Node_For_Itype should be used to +-- determine the construct that leads to the creation of a given itype +-- entity. -- Associated_Storage_Pool [root type only] -- Defined in simple and general access type entities. References the @@ -1606,7 +1608,7 @@ package Einfo is -- Has_Dynamic_Predicate_Aspect -- Defined in all types and subtypes. Set if a Dynamic_Predicate aspect --- was explicitly applied to the type. Generally we treat predicates as +-- was applied to the type or subtype. Generally we treat predicates as -- static if possible, regardless of whether they are specified using -- Predicate, Static_Predicate, or Dynamic_Predicate. And if a predicate -- can be treated as static (i.e. its expression is predicate-static), @@ -1687,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 @@ -3927,17 +3929,12 @@ package Einfo is -- Points to the component in the base type. -- Overlays_Constant --- Defined in all entities. Set only for E_Constant or E_Variable for --- which there is an address clause that causes the entity to overlay --- a constant object. +-- Defined in constants and variables. Set if there is an address clause +-- that causes the entity to overlay a constant object. -- Overridden_Operation -- Defined in subprograms. For overriding operations, points to the --- user-defined parent subprogram that is being overridden. Note: this --- attribute uses the same field as Static_Initialization. The latter --- is only defined for internal initialization procedures, for which --- Overridden_Operation is irrelevant. Thus this attribute must not be --- set for init_procs. +-- user-defined parent subprogram that is being overridden. -- Package_Instantiation -- Defined in packages and generic packages. When defined, this field @@ -4491,9 +4488,7 @@ package Einfo is -- initialized statically. The value of this attribute is a positional -- aggregate whose components are compile-time static values. Used -- when available in object declarations to eliminate the call to the --- initialization procedure, and to minimize elaboration code. Note: --- This attribute uses the same field as Overridden_Operation, which is --- irrelevant in init_procs. +-- initialization procedure, and to minimize elaboration code. -- Static_Real_Or_String_Predicate -- Defined in real types/subtypes with static predicates (with the two @@ -4961,7 +4956,6 @@ package Einfo is -- Materialize_Entity -- Needs_Debug_Info -- Never_Set_In_Source - -- Overlays_Constant -- Referenced -- Referenced_As_LHS -- Referenced_As_Out_Parameter @@ -5288,7 +5282,7 @@ package Einfo is -- Interface_Name (constants only) -- Related_Type (constants only) -- Initialization_Statements - -- BIP_Initialization_Call + -- BIP_Initialization_Call (constants only) -- Finalization_Master_Node -- Last_Aggregate_Assignment -- Activation_Record_Component @@ -5318,6 +5312,7 @@ package Einfo is -- Is_Volatile_Full_Access -- Optimize_Alignment_Space (constants only) -- Optimize_Alignment_Time (constants only) + -- Overlays_Constant (constants only) -- SPARK_Pragma_Inherited (constants only) -- Stores_Attribute_Old_Prefix (constants only) -- Treat_As_Volatile @@ -6205,6 +6200,7 @@ package Einfo is -- OK_To_Rename -- Optimize_Alignment_Space -- Optimize_Alignment_Time + -- Overlays_Constant -- SPARK_Pragma_Inherited -- Suppress_Initialization -- Treat_As_Volatile diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 5450402..8aad721 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -7017,7 +7017,7 @@ package body Exp_Aggr is begin return UI_To_Int ((if Nkind (Expr) = N_Integer_Literal then Intval (Expr) - else Enumeration_Pos (Expr))); + else Enumeration_Pos (Entity (Expr)))); end To_Int; -- Local variables @@ -7503,10 +7503,19 @@ package body Exp_Aggr is Set_Assignment_OK (Lhs); Aggr_Code := Build_Container_Aggr_Code (N, Typ, Lhs, Init); + + -- Use the unconstrained base subtype of the subtype provided by + -- the context for declaring the temporary object (which may come + -- from a constrained assignment target), to ensure that the + -- aggregate can be successfully expanded and assigned to the + -- temporary without exceeding its capacity. (Later assignment + -- of the temporary to a target object may result in failing + -- a discriminant check.) + Prepend_To (Aggr_Code, Make_Object_Declaration (Loc, Defining_Identifier => Obj_Id, - Object_Definition => New_Occurrence_Of (Typ, Loc), + Object_Definition => New_Occurrence_Of (Base_Type (Typ), Loc), Expression => Init)); Insert_Actions (N, Aggr_Code); diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index f1f8424..3d1bff9 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -8183,9 +8183,8 @@ package body Exp_Attr is else declare Uns : constant Boolean := - Is_Unsigned_Type (Ptyp) - or else (Is_Private_Type (Ptyp) - and then Is_Unsigned_Type (PBtyp)); + Is_Unsigned_Type (Validated_View (Ptyp)); + Size : Uint; P : Node_Id := Pref; diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index d884e75..cf2238e 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -8741,8 +8741,9 @@ package body Exp_Ch3 is -- be illegal in some cases (such as converting access- -- to-unconstrained to access-to-constrained), but the -- the unchecked conversion will presumably fail to work - -- right in just such cases. It's not clear at all how to - -- handle this. + -- right in just such cases. In order to handle this + -- properly, in the Caller_Allocation case, the callee + -- needs to do the constraint check. Alloc_Stmt := Make_If_Statement (Loc, diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 01be3df..0cf5643 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -193,12 +193,12 @@ package body Exp_Ch4 is procedure Insert_Conditional_Object_Declaration (Obj_Id : Entity_Id; + Typ : Entity_Id; Expr : Node_Id; - Decl : Node_Id); - -- Expr is the dependent expression of a conditional expression and Decl - -- is the declaration of an object whose initialization expression is the - -- conditional expression. Insert in the actions of Expr the declaration - -- of Obj_Id modeled on Decl and with Expr as initialization expression. + Const : Boolean); + -- Expr is the dependent expression of a conditional expression. Insert in + -- the actions of Expr the declaration of Obj_Id with type Typ and Expr as + -- initialization expression. Const is True when Obj_Id is a constant. procedure Insert_Dereference_Action (N : Node_Id); -- N is an expression whose type is an access. When the type of the @@ -5313,7 +5313,7 @@ package body Exp_Ch4 is -- 'Unrestricted_Access. -- Generate: - -- type Ptr_Typ is not null access all [constant] Typ; + -- type Target_Typ is not null access all [constant] Typ; else Target_Typ := Make_Temporary (Loc, 'P'); @@ -5411,20 +5411,16 @@ package body Exp_Ch4 is elsif Optimize_Object_Decl then Obj := Make_Temporary (Loc, 'C', Alt_Expr); - Insert_Conditional_Object_Declaration (Obj, Alt_Expr, Par); - - Alt_Expr := - Make_Attribute_Reference (Alt_Loc, - Prefix => New_Occurrence_Of (Obj, Alt_Loc), - Attribute_Name => Name_Unrestricted_Access); - - LHS := New_Occurrence_Of (Target, Loc); - Set_Assignment_OK (LHS); + Insert_Conditional_Object_Declaration + (Obj, Typ, Alt_Expr, Const => Constant_Present (Par)); Stmts := New_List ( Make_Assignment_Statement (Alt_Loc, - Name => LHS, - Expression => Alt_Expr)); + Name => New_Occurrence_Of (Target, Loc), + Expression => + Make_Attribute_Reference (Alt_Loc, + Prefix => New_Occurrence_Of (Obj, Alt_Loc), + Attribute_Name => Name_Unrestricted_Access))); -- Take the unrestricted access of the expression value for non- -- scalar types. This approach avoids big copies and covers the @@ -6022,8 +6018,10 @@ package body Exp_Ch4 is Target : constant Entity_Id := Make_Temporary (Loc, 'C', N); begin - Insert_Conditional_Object_Declaration (Then_Obj, Thenx, Par); - Insert_Conditional_Object_Declaration (Else_Obj, Elsex, Par); + Insert_Conditional_Object_Declaration + (Then_Obj, Typ, Thenx, Const => Constant_Present (Par)); + Insert_Conditional_Object_Declaration + (Else_Obj, Typ, Elsex, Const => Constant_Present (Par)); -- Generate: -- type Ptr_Typ is not null access all [constant] Typ; @@ -13294,16 +13292,17 @@ package body Exp_Ch4 is procedure Insert_Conditional_Object_Declaration (Obj_Id : Entity_Id; + Typ : Entity_Id; Expr : Node_Id; - Decl : Node_Id) + Const : Boolean) is Loc : constant Source_Ptr := Sloc (Expr); Obj_Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Obj_Id, Aliased_Present => True, - Constant_Present => Constant_Present (Decl), - Object_Definition => New_Copy_Tree (Object_Definition (Decl)), + Constant_Present => Const, + Object_Definition => New_Occurrence_Of (Typ, Loc), Expression => Relocate_Node (Expr)); -- We make the object unconditionally aliased to avoid dangling bound -- issues when its nominal subtype is an unconstrained array type. @@ -13322,9 +13321,19 @@ package body Exp_Ch4 is Insert_Action (Expr, Obj_Decl); -- The object can never be local to an elaboration routine at library - -- level since we will take 'Unrestricted_Access of it. - - Set_Is_Statically_Allocated (Obj_Id, Is_Library_Level_Entity (Obj_Id)); + -- level since we will take 'Unrestricted_Access of it. Beware that + -- Is_Library_Level_Entity always returns False when called from within + -- a transient scope, but the associated block will not be materialized + -- when the transient scope is finally closed in the case of an object + -- declaration (see Exp.Ch7.Wrap_Transient_Declaration). + + if Scope (Obj_Id) = Current_Scope and then Scope_Is_Transient then + Set_Is_Statically_Allocated + (Obj_Id, Is_Library_Level_Entity (Scope (Obj_Id))); + else + Set_Is_Statically_Allocated + (Obj_Id, Is_Library_Level_Entity (Obj_Id)); + end if; -- If the object needs finalization, we need to insert its Master_Node -- manually because 1) the machinery in Exp_Ch7 will not pick it since diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index f85d977..2a246ad 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -158,7 +158,7 @@ package body Exp_Ch6 is Alloc_Form_Exp : Node_Id := Empty; Pool_Exp : Node_Id := Empty); -- Ada 2005 (AI-318-02): If the result type of a build-in-place call needs - -- them, add the actuals parameters BIP_Alloc_Form and BIP_Storage_Pool. + -- them, add the actual parameters BIP_Alloc_Form and BIP_Storage_Pool. -- If Alloc_Form_Exp is present, then pass it for the first parameter, -- otherwise pass a literal corresponding to the Alloc_Form parameter -- (which must not be Unspecified in that case). If Pool_Exp is present, @@ -442,9 +442,7 @@ package body Exp_Ch6 is return; end if; - -- Locate the implicit allocation form parameter in the called function. - -- Maybe it would be better for each implicit formal of a build-in-place - -- function to have a flag or a Uint attribute to identify it. ??? + -- Locate the implicit allocation form parameter in the called function Alloc_Form_Formal := Build_In_Place_Formal (Function_Id, BIP_Alloc_Form); @@ -928,9 +926,6 @@ package body Exp_Ch6 is Formal_Suffix : constant String := BIP_Formal_Suffix (Kind); begin - -- Maybe it would be better for each implicit formal of a build-in-place - -- function to have a flag or a Uint attribute to identify it. ??? - -- The return type in the function declaration may have been a limited -- view, and the extra formals for the function were not generated at -- that point. At the point of call the full view must be available and @@ -8821,6 +8816,25 @@ package body Exp_Ch6 is and then not Has_Foreign_Convention (Return_Applies_To (Scope (Obj_Def_Id))); + Constraint_Check_Needed : constant Boolean := + (Has_Discriminants (Obj_Typ) or else Is_Array_Type (Obj_Typ)) + and then Is_Tagged_Type (Obj_Typ) + and then Nkind (Original_Node (Obj_Decl)) /= + N_Object_Renaming_Declaration + and then Is_Constrained (Obj_Typ); + -- We are processing a call in the context of something like + -- "X : T := F (...);". This is True if we need to do a constraint + -- check, because T has constrained bounds or discriminants, + -- and F is returning an unconstrained subtype. + -- We are currently doing the check at the call site, + -- which is possible only in the callee-allocates case, + -- which is why we have Is_Tagged_Type above. + -- ???The check is missing in the untagged caller-allocates case. + -- ???The check for renaming declarations above is needed because + -- Sem_Ch8.Analyze_Object_Renaming sometimes changes a renaming + -- into an object declaration. We probably shouldn't do that, + -- but for now, we need this check. + -- Start of processing for Make_Build_In_Place_Call_In_Object_Declaration begin @@ -8863,15 +8877,16 @@ package body Exp_Ch6 is Subtype_Indication => New_Occurrence_Of (Designated_Type, Loc))); - -- The access type and its accompanying object must be inserted after - -- the object declaration in the constrained case, so that the function - -- call can be passed access to the object. In the indefinite case, or + -- The access type and its object must be inserted after the object + -- declaration in the caller-allocates case, so that the function call + -- can be passed access to the object. In the caller-allocates case, or -- if the object declaration is for a return object, the access type and -- object must be inserted before the object, since the object -- declaration is rewritten to be a renaming of a dereference of the -- access object. - if Definite and then not Is_OK_Return_Object then + if Definite and not Is_OK_Return_Object and not Constraint_Check_Needed + then Insert_Action_After (Obj_Decl, Ptr_Typ_Decl); else Insert_Action (Obj_Decl, Ptr_Typ_Decl); @@ -8952,7 +8967,7 @@ package body Exp_Ch6 is -- to the (specific) result type of the function is inserted to handle -- the case where the object is declared with a class-wide type. - elsif Definite then + elsif Definite and not Constraint_Check_Needed then Caller_Object := Unchecked_Convert_To (Result_Subt, New_Occurrence_Of (Obj_Def_Id, Loc)); @@ -9090,8 +9105,8 @@ package body Exp_Ch6 is -- itself the return expression of an enclosing BIP function, then mark -- the object as having no initialization. - if Definite and then not Is_OK_Return_Object then - + if Definite and not Is_OK_Return_Object and not Constraint_Check_Needed + then Set_Expression (Obj_Decl, Empty); Set_No_Initialization (Obj_Decl); @@ -9150,6 +9165,10 @@ package body Exp_Ch6 is Analyze (Obj_Decl); Replace_Renaming_Declaration_Id (Obj_Decl, Original_Node (Obj_Decl)); + + if Constraint_Check_Needed then + Apply_Constraint_Check (Call_Deref, Obj_Typ); + end if; end if; pragma Assert (Check_Number_Of_Actuals (Func_Call, Function_Id)); @@ -9919,15 +9938,15 @@ package body Exp_Ch6 is -- Start of processing for Validate_Subprogram_Calls begin - -- No action required if we are not generating code or compiling sources - -- that have errors. + -- No action if we are not generating code (including if we have + -- errors). - if Serious_Errors_Detected > 0 - or else Operating_Mode /= Generate_Code - then + if Operating_Mode /= Generate_Code then return; end if; + pragma Assert (Serious_Errors_Detected = 0); + Check_Calls (N); end Validate_Subprogram_Calls; diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 458b32c..080a2e1 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -413,7 +413,9 @@ package body Exp_Disp is if Nkind (D) = N_Package_Declaration then Build_Package_Dispatch_Tables (D); - elsif Nkind (D) = N_Package_Body then + elsif Nkind (D) = N_Package_Body + and then Ekind (Corresponding_Spec (D)) /= E_Generic_Package + then Build_Dispatch_Tables (Declarations (D)); elsif Nkind (D) = N_Package_Body_Stub diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 028ee01..45eb808 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -1523,7 +1523,123 @@ package body Exp_Util is New_E := Type_Map.Get (Entity (N)); if Present (New_E) then - Rewrite (N, New_Occurrence_Of (New_E, Sloc (N))); + declare + + Ctrl_Type : constant Entity_Id + := Find_Dispatching_Type (Par_Subp); + + function Call_To_Parent_Dispatching_Op_Must_Be_Mapped + (Call_Node : Node_Id) return Boolean; + -- If Call_Node is a call to a primitive function F of the + -- tagged type T associated with Par_Subp that either has + -- any actuals that are controlling formals of Par_Subp, + -- or else the call to F is an actual parameter of an + -- enclosing call to a primitive of T that has any actuals + -- that are controlling formals of Par_Subp (and recursively + -- up the tree of enclosing function calls), returns True; + -- otherwise returns False. Returning True implies that the + -- call to F must be mapped to a call that instead targets + -- the corresponding function F of the tagged type for which + -- Subp is a primitive function. + + -------------------------------------------------- + -- Call_To_Parent_Dispatching_Op_Must_Be_Mapped -- + -------------------------------------------------- + + function Call_To_Parent_Dispatching_Op_Must_Be_Mapped + (Call_Node : Node_Id) return Boolean + is + pragma Assert (Nkind (Call_Node) = N_Function_Call); + + Actual : Node_Id := First_Actual (Call_Node); + Actual_Or_Prefix : Node_Id; + + begin + if Is_Entity_Name (Name (Call_Node)) + and then Is_Dispatching_Operation + (Entity (Name (Call_Node))) + and then + Is_Ancestor + (Ctrl_Type, + Find_Dispatching_Type + (Entity (Name (Call_Node)))) + then + while Present (Actual) loop + + -- Account for 'Old and explicit dereferences, + -- picking up the prefix object in those cases. + + if (Nkind (Actual) = N_Attribute_Reference + and then Attribute_Name (Actual) = Name_Old) + or else Nkind (Actual) = N_Explicit_Dereference + then + Actual_Or_Prefix := Prefix (Actual); + else + Actual_Or_Prefix := Actual; + end if; + + -- If at least one actual is a controlling formal + -- parameter of a class-wide Pre/Post aspect's + -- subprogram, the rule in RM 6.1.1(7) applies, + -- and we want to map the call to target the + -- corresponding function of the derived type. + + if Nkind (Actual_Or_Prefix) + in N_Identifier + | N_Expanded_Name + | N_Operator_Symbol + + and then Is_Formal (Entity (Actual_Or_Prefix)) + + and then Is_Controlling_Formal + (Entity (Actual_Or_Prefix)) + then + return True; + + -- RM 6.1.1(7) also applies to Result attributes + -- of primitive functions with controlling results. + + elsif Is_Attribute_Result (Actual) + and then Has_Controlling_Result (Subp) + then + return True; + end if; + + Next_Actual (Actual); + end loop; + + if Nkind (Parent (Call_Node)) = N_Function_Call then + return + Call_To_Parent_Dispatching_Op_Must_Be_Mapped + (Parent (Call_Node)); + end if; + + return False; + + else + return False; + end if; + end Call_To_Parent_Dispatching_Op_Must_Be_Mapped; + + begin + -- If N's entity is in the map, then the entity is either + -- a formal of the parent subprogram that should necessarily + -- be mapped, or it's a function call's target entity that + -- that should be mapped if the call involves any actuals + -- that reference formals of the parent subprogram (or the + -- function call is part of an enclosing call that similarly + -- qualifies for mapping). Rewrite a node that references + -- any such qualified entity to a new node referencing the + -- corresponding entity associated with the derived type. + + if not Is_Subprogram (Entity (N)) + or else Nkind (Parent (N)) /= N_Function_Call + or else + Call_To_Parent_Dispatching_Op_Must_Be_Mapped (Parent (N)) + then + Rewrite (N, New_Occurrence_Of (New_E, Sloc (N))); + end if; + end; end if; -- Update type of function call node, which should be the same as @@ -8112,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/freeze.adb b/gcc/ada/freeze.adb index ec0fb16e..35f14d6 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -715,10 +715,11 @@ package body Freeze is then declare O_Ent : Entity_Id; + O_Typ : Entity_Id; Off : Boolean; begin - Find_Overlaid_Entity (Addr, O_Ent, Off); + Find_Overlaid_Entity (Addr, O_Ent, O_Typ, Off); if Ekind (O_Ent) = E_Constant and then Etype (O_Ent) = Typ @@ -6869,9 +6870,10 @@ package body Freeze is end if; end if; - -- Static objects require special handling + -- Statically allocated objects require special handling if (Ekind (E) = E_Constant or else Ekind (E) = E_Variable) + and then No (Renamed_Object (E)) and then Is_Statically_Allocated (E) then Freeze_Static_Object (E); @@ -10231,11 +10233,17 @@ package body Freeze is -- issue an error message saying that this object cannot be imported -- or exported. If it has an address clause it is an overlay in the -- current partition and the static requirement is not relevant. - -- Do not issue any error message when ignoring rep clauses. + -- Do not issue any error message when ignoring rep clauses or for + -- compiler-generated entities. if Ignore_Rep_Clauses then null; + elsif not Comes_From_Source (E) then + pragma + Assert (Nkind (Parent (Declaration_Node (E))) in N_Case_Statement + | N_If_Statement); + elsif Is_Imported (E) then if No (Address_Clause (E)) then Error_Msg_N diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb index 12cea9c..d537678 100644 --- a/gcc/ada/frontend.adb +++ b/gcc/ada/frontend.adb @@ -506,9 +506,7 @@ begin -- Verify the validity of the tree - if Debug_Flag_Underscore_VV then - VAST.Check_Tree (Cunit (Main_Unit)); - end if; + VAST.VAST; -- Validate all the subprogram calls; this work will be done by VAST; in -- the meantime it is done to check extra formals and it can be disabled 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/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index bfa634f..5c89597 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -215,7 +215,6 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (May_Inherit_Delayed_Rep_Aspects, Flag), Sm (Needs_Debug_Info, Flag), Sm (Never_Set_In_Source, Flag), - Sm (Overlays_Constant, Flag), Sm (Prev_Entity, Node_Id), Sm (Referenced, Flag), Sm (Referenced_As_LHS, Flag), @@ -353,6 +352,7 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Last_Aggregate_Assignment, Node_Id), Sm (Optimize_Alignment_Space, Flag), Sm (Optimize_Alignment_Time, Flag), + Sm (Overlays_Constant, Flag), Sm (Prival_Link, Node_Id), Sm (Related_Type, Node_Id), Sm (Return_Statement, Node_Id), @@ -426,9 +426,8 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Discriminant_Default_Value, Node_Id), Sm (Is_Activation_Record, Flag))); - Ab (Formal_Object_Kind, Object_Kind, - -- Generic formal objects are also objects - (Sm (Entry_Component, Node_Id))); + Ab (Formal_Object_Kind, Object_Kind); + -- Generic formal objects are also objects Cc (E_Generic_In_Out_Parameter, Formal_Object_Kind, -- A generic in out parameter, created by the use of a generic in out diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 4d98471..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:: @@ -1581,6 +1580,11 @@ and generics may name types with unknown discriminants without using the @code{(<>)} notation. In addition, some but not all of the additional restrictions of Ada 83 are enforced. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + Ada 83 mode is intended for two purposes. Firstly, it allows existing Ada 83 code to be compiled and adapted to GNAT with less effort. Secondly, it aids in keeping code backwards compatible with Ada 83. @@ -1608,6 +1612,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 95 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{21} @section Pragma Ada_05 @@ -1626,6 +1635,11 @@ This pragma is useful when writing a reusable component that itself uses Ada 2005 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form (which is not a configuration pragma) is used for managing the transition from Ada 95 to Ada 2005 in the run-time library. If an entity is marked @@ -1671,6 +1685,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2012 features, but which is intended to be usable from Ada 83, Ada 95, or Ada 2005 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2005 to Ada 2012 in the run-time library. If an entity is marked @@ -1716,6 +1735,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2022 features, but which is intended to be usable from Ada 83, Ada 95, Ada 2005 or Ada 2012 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2012 to Ada 2022 in the run-time library. If an entity is marked @@ -30914,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 @@ -30943,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. - -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. - -@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. -@end itemize - -Additionally, two other configuration aspects are added, -@code{Legacy_Heap_Finalization} and @code{Exceptions_In_Finalize}: +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. - -@itemize * +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 -@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. +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 -@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; @@ -31046,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 @@ -31060,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 @@ -31069,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 @@ -31205,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 @@ -31246,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 @@ -31263,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 @@ -31278,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 @@ -31288,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 @@ -31303,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 @@ -31325,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 @@ -31361,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 @@ -31505,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 @@ -31595,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 @@ -31656,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 @@ -31824,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 @@ -31843,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 @@ -31856,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 @@ -31865,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 @@ -31875,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 @@ -31901,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}) @@ -31911,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 @@ -31933,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 @@ -32055,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 @@ -32083,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 @@ -32183,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 @@ -32211,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 @@ -32253,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 @@ -32286,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 @@ -32358,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 @@ -32381,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 @@ -32403,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 @@ -32417,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 @@ -32446,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 @@ -32482,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 @@ -32495,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 @@ -32541,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 @@ -32634,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 @@ -32664,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 ca1d7bc..639708b 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -2911,6 +2911,10 @@ You can place configuration pragmas either appear at the start of a compilation unit or in a configuration pragma file that applies to all compilations performed in a given compilation environment. +Configuration pragmas placed before a library level package specification +are not propagated to the corresponding package body (see RM 10.1.5(8)); +they must be added explicitly to the package body. + GNAT includes the @code{gnatchop} utility to provide an automatic way to handle configuration pragmas that follows the semantics for compilations (that is, files with multiple units) described in the RM. @@ -9846,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 @@ -10072,7 +10076,7 @@ Library (RTL) ALI files. @code{n} controls the optimization level: -@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item `n' @@ -10087,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 @@ -10095,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 @@ -10105,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 @@ -10114,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 @@ -10123,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 @@ -15266,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. @@ -15295,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}. @@ -20277,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 * @@ -20294,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 @@ -20312,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 @@ -20324,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 @@ -20336,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 @@ -20347,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 @@ -29833,8 +29879,8 @@ to permit their use in free software. @printindex ge -@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } @anchor{d2}@w{ } +@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } @c %**end of body @bye 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/inline.adb b/gcc/ada/inline.adb index abb49b5..72b9989 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1006,9 +1006,9 @@ package body Inline is end loop; -- The list of inlined subprograms is an overestimate, because it - -- includes inlined functions called from functions that are compiled - -- as part of an inlined package, but are not themselves called. An - -- accurate computation of just those subprograms that are needed + -- includes inlined subprograms called from subprograms that are + -- declared in an inlined package, but are not themselves called. + -- An accurate computation of just those subprograms that are needed -- requires that we perform a transitive closure over the call graph, -- starting from calls in the main compilation unit. @@ -4924,11 +4924,17 @@ package body Inline is and then Ekind (Info.Fin_Scop) = E_Package_Body then Set_In_Package_Body (Spec_Entity (Info.Fin_Scop), True); + Instantiate_Package_Body (Info); + Set_In_Package_Body (Spec_Entity (Info.Fin_Scop), False); + else + Instantiate_Package_Body (Info); end if; - Instantiate_Package_Body (Info); + -- No need to generate cleanups if the main unit is generic - if Present (Info.Fin_Scop) then + if Present (Info.Fin_Scop) + and then not Is_Generic_Unit (Main_Unit_Entity) + then Scop := Info.Fin_Scop; -- If the enclosing finalization scope is dynamic, the instance @@ -4941,12 +4947,6 @@ package body Inline is end if; Add_Scope_To_Clean (Scop); - - -- Reset the In_Package_Body flag if it was set above - - if Ekind (Info.Fin_Scop) = E_Package_Body then - Set_In_Package_Body (Spec_Entity (Info.Fin_Scop), False); - end if; end if; -- For subprogram instances, always instantiate the body @@ -4967,10 +4967,6 @@ package body Inline is Push_Scope (Standard_Standard); To_Clean := New_Elmt_List; - if Is_Generic_Unit (Cunit_Entity (Main_Unit)) then - Start_Generic; - end if; - -- A body instantiation may generate additional instantiations, so -- the following loop must scan to the end of a possibly expanding -- set (that's why we cannot simply use a FOR loop here). We must @@ -5009,16 +5005,10 @@ package body Inline is Pending_Instantiations.Init; end if; - -- We can now complete the cleanup actions of scopes that contain - -- pending instantiations (skipped for generic units, since we - -- never need any cleanups in generic units). + -- Expand the cleanup actions of scopes that contain instantiations - if Expander_Active - and then not Is_Generic_Unit (Main_Unit_Entity) - then + if Expander_Active then Cleanup_Scopes; - elsif Is_Generic_Unit (Cunit_Entity (Main_Unit)) then - End_Generic; end if; Pop_Scope; diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb index 2c6a682..a727f48 100644 --- a/gcc/ada/lib.adb +++ b/gcc/ada/lib.adb @@ -1129,15 +1129,6 @@ package body Lib is Units.Locked := True; end Lock; - --------------- - -- Num_Units -- - --------------- - - function Num_Units return Nat is - begin - return Int (Units.Last) - Int (Main_Unit) + 1; - end Num_Units; - ----------------- -- Remove_Unit -- ----------------- diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads index c22db30..a085aa7 100644 --- a/gcc/ada/lib.ads +++ b/gcc/ada/lib.ads @@ -633,10 +633,8 @@ package Lib is -- Same as above, but for Source_Ptr function ipu (N : Node_Or_Entity_Id) return Boolean; - -- Same as In_Predefined_Unit, but renamed so it can assist debugging. - -- Otherwise, there is a disambiguous name conflict in the two versions of - -- In_Predefined_Unit which makes it inconvient to set as a breakpoint - -- condition. + -- Same as In_Predefined_Unit, but renamed to this unambiguous name for use + -- in the debugger. function In_Predefined_Unit (N : Node_Or_Entity_Id) return Boolean; -- Returns True if the given node or entity appears within the source text @@ -720,12 +718,9 @@ package Lib is procedure Lock; -- Lock internal tables before calling back end - function Num_Units return Nat; - -- Number of units currently in unit table - procedure Remove_Unit (U : Unit_Number_Type); - -- Remove unit U from unit table. Currently this is effective only if U is - -- the last unit currently stored in the unit table. + -- Remove unit U from unit table. U must be the last unit currently stored + -- in the unit table. procedure Replace_Linker_Option_String (S : String_Id; diff --git a/gcc/ada/libgnarl/s-stusta.adb b/gcc/ada/libgnarl/s-stusta.adb index 5aca435..c9848a0 100644 --- a/gcc/ada/libgnarl/s-stusta.adb +++ b/gcc/ada/libgnarl/s-stusta.adb @@ -32,6 +32,7 @@ -- This is why this package is part of GNARL: with System.Tasking.Debug; +with System.Tasking.Stages; with System.Task_Primitives.Operations; with System.IO; @@ -103,7 +104,9 @@ package body System.Stack_Usage.Tasking is -- Calculate the task usage for a given task - Report_For_Task (Id); + if not System.Tasking.Stages.Terminated (Id) then + Report_For_Task (Id); + end if; end loop; end if; diff --git a/gcc/ada/libgnat/i-cheri.adb b/gcc/ada/libgnat/i-cheri.adb index 37e5c3d..1575705 100644 --- a/gcc/ada/libgnat/i-cheri.adb +++ b/gcc/ada/libgnat/i-cheri.adb @@ -31,6 +31,30 @@ package body Interfaces.CHERI is + ---------------- + -- Set_Bounds -- + ---------------- + + procedure Set_Bounds + (Cap : in out Capability; + Length : Bounds_Length) + is + begin + Cap := Capability_With_Bounds (Cap, Length); + end Set_Bounds; + + ---------------------- + -- Set_Exact_Bounds -- + ---------------------- + + procedure Set_Exact_Bounds + (Cap : in out Capability; + Length : Bounds_Length) + is + begin + Cap := Capability_With_Exact_Bounds (Cap, Length); + end Set_Exact_Bounds; + ---------------------------- -- Set_Address_And_Bounds -- ---------------------------- diff --git a/gcc/ada/libgnat/i-cheri.ads b/gcc/ada/libgnat/i-cheri.ads index ed26e55..4186b6d 100644 --- a/gcc/ada/libgnat/i-cheri.ads +++ b/gcc/ada/libgnat/i-cheri.ads @@ -273,8 +273,7 @@ is (Cap : in out Capability; Length : Bounds_Length) with - Import, Convention => Intrinsic, - External_Name => "__builtin_cheri_bounds_set"; + Inline; -- Narrow the bounds of a capability so that the lower bound is the -- current address and the upper bound is suitable for the Length. -- @@ -287,8 +286,7 @@ is (Cap : in out Capability; Length : Bounds_Length) with - Import, Convention => Intrinsic, - External_Name => "__builtin_cheri_bounds_set_exact"; + Inline; -- Narrow the bounds of a capability so that the lower bound is the -- current address and the upper bound is suitable for the Length. -- diff --git a/gcc/ada/libgnat/s-dorepr.adb b/gcc/ada/libgnat/s-dorepr.adb index ddc7c1d..1d9604a 100644 --- a/gcc/ada/libgnat/s-dorepr.adb +++ b/gcc/ada/libgnat/s-dorepr.adb @@ -134,7 +134,7 @@ package body Product is Ahi, Alo, Bhi, Blo, E : Num; begin - if Is_Infinity (P) or else Is_Zero (P) then + if Is_Infinity_Or_NaN (P) or else Is_Zero (P) then return (P, 0.0); else @@ -157,7 +157,7 @@ package body Product is Hi, Lo, E : Num; begin - if Is_Infinity (Q) or else Is_Zero (Q) then + if Is_Infinity_Or_NaN (Q) or else Is_Zero (Q) then return (Q, 0.0); else diff --git a/gcc/ada/libgnat/s-dorepr__fma.adb b/gcc/ada/libgnat/s-dorepr__fma.adb index 0d3dc53..45a9223 100644 --- a/gcc/ada/libgnat/s-dorepr__fma.adb +++ b/gcc/ada/libgnat/s-dorepr__fma.adb @@ -78,7 +78,7 @@ package body Product is E : Num; begin - if Is_Infinity (P) or else Is_Zero (P) then + if Is_Infinity_Or_NaN (P) or else Is_Zero (P) then return (P, 0.0); else diff --git a/gcc/ada/libgnat/s-dourea.adb b/gcc/ada/libgnat/s-dourea.adb index a37f2eb..68d4d9a 100644 --- a/gcc/ada/libgnat/s-dourea.adb +++ b/gcc/ada/libgnat/s-dourea.adb @@ -34,12 +34,12 @@ package body System.Double_Real is function Is_NaN (N : Num) return Boolean is (N /= N); -- Return True if N is a NaN - function Is_Infinity (N : Num) return Boolean is (Is_NaN (N - N)); - -- Return True if N is an infinity. Used to avoid propagating meaningless - -- errors when the result of a product is an infinity. + function Is_Infinity_Or_NaN (N : Num) return Boolean is (Is_NaN (N - N)); + -- Return True if N is either an infinity or NaN. Used to avoid propagating + -- meaningless errors when the result of a product is an infinity or NaN. function Is_Zero (N : Num) return Boolean is (N = -N); - -- Return True if N is a Zero. Used to preserve the sign when the result of + -- Return True if N is a zero. Used to preserve the sign when the result of -- a product is a zero. package Product is @@ -151,7 +151,7 @@ package body System.Double_Real is P : constant Double_T := Two_Prod (A.Hi, B); begin - if Is_Infinity (P.Hi) or else Is_Zero (P.Hi) then + if Is_Infinity_Or_NaN (P.Hi) or else Is_Zero (P.Hi) then return (P.Hi, 0.0); else return Quick_Two_Sum (P.Hi, P.Lo + A.Lo * B); @@ -162,7 +162,7 @@ package body System.Double_Real is P : constant Double_T := Two_Prod (A.Hi, B.Hi); begin - if Is_Infinity (P.Hi) or else Is_Zero (P.Hi) then + if Is_Infinity_Or_NaN (P.Hi) or else Is_Zero (P.Hi) then return (P.Hi, 0.0); else return Quick_Two_Sum (P.Hi, P.Lo + A.Hi * B.Lo + A.Lo * B.Hi); @@ -178,7 +178,7 @@ package body System.Double_Real is P, R : Double_T; begin - if Is_Infinity (B) or else Is_Zero (B) then + if Is_Infinity_Or_NaN (B) or else Is_Zero (B) then return (A.Hi / B, 0.0); end if; pragma Annotate (CodePeer, Intentional, "test always false", @@ -202,7 +202,7 @@ package body System.Double_Real is R, S : Double_T; begin - if Is_Infinity (B.Hi) or else Is_Zero (B.Hi) then + if Is_Infinity_Or_NaN (B.Hi) or else Is_Zero (B.Hi) then return (A.Hi / B.Hi, 0.0); end if; pragma Annotate (CodePeer, Intentional, "test always false", @@ -228,7 +228,7 @@ package body System.Double_Real is Q : constant Double_T := Two_Sqr (A.Hi); begin - if Is_Infinity (Q.Hi) or else Is_Zero (Q.Hi) then + if Is_Infinity_Or_NaN (Q.Hi) or else Is_Zero (Q.Hi) then return (Q.Hi, 0.0); else return Quick_Two_Sum (Q.Hi, Q.Lo + 2.0 * A.Hi * A.Lo + A.Lo * A.Lo); 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-vafi128.ads b/gcc/ada/libgnat/s-vafi128.ads index 7518c6c..d75857a 100644 --- a/gcc/ada/libgnat/s-vafi128.ads +++ b/gcc/ada/libgnat/s-vafi128.ads @@ -29,9 +29,9 @@ -- -- ------------------------------------------------------------------------------ --- This package contains routines for scanning values for ordinary fixed point --- types up to 128-bit small and mantissa, for use in Text_IO.Decimal_IO, and --- the Value attribute for such decimal types. +-- This package contains the routines for supporting the Value attribute for +-- ordinary fixed point types up to 128-bit small and mantissa, and also for +-- conversion operations required in Text_IO.Fixed_IO for such types. with Interfaces; with System.Arith_128; diff --git a/gcc/ada/libgnat/s-vafi32.ads b/gcc/ada/libgnat/s-vafi32.ads index e3ad5c2..7ed22c6 100644 --- a/gcc/ada/libgnat/s-vafi32.ads +++ b/gcc/ada/libgnat/s-vafi32.ads @@ -29,9 +29,9 @@ -- -- ------------------------------------------------------------------------------ --- This package contains routines for scanning values for decimal fixed point --- types up to 32-bit small and mantissa, for use in Text_IO.Decimal_IO, and --- the Value attribute for such decimal types. +-- This package contains the routines for supporting the Value attribute for +-- ordinary fixed point types up to 32-bit small and mantissa, and also for +-- conversion operations required in Text_IO.Fixed_IO for such types. with Interfaces; with System.Arith_32; diff --git a/gcc/ada/libgnat/s-vafi64.ads b/gcc/ada/libgnat/s-vafi64.ads index 4d86939..43197bb 100644 --- a/gcc/ada/libgnat/s-vafi64.ads +++ b/gcc/ada/libgnat/s-vafi64.ads @@ -29,9 +29,9 @@ -- -- ------------------------------------------------------------------------------ --- This package contains routines for scanning values for decimal fixed point --- types up to 64-bit small and mantissa, for use in Text_IO.Decimal_IO, and --- the Value attribute for such decimal types. +-- This package contains the routines for supporting the Value attribute for +-- ordinary fixed point types up to 64-bit small and mantissa, and also for +-- conversion operations required in Text_IO.Fixed_IO for such types. with Interfaces; with System.Arith_64; diff --git a/gcc/ada/libgnat/s-valued.adb b/gcc/ada/libgnat/s-valued.adb index dfef9a88..cc2cffc 100644 --- a/gcc/ada/libgnat/s-valued.adb +++ b/gcc/ada/libgnat/s-valued.adb @@ -39,13 +39,15 @@ package body System.Value_D is -- We need an unsigned type large enough to represent the mantissa package Impl is new Value_R (Uns, 1, 2**(Int'Size - 1), Round => False); - -- We do not use the Extra digit for decimal fixed-point types + -- We do not use the Extra digit for decimal fixed-point types, except to + -- effectively ensure that overflow is detected near the boundaries. function Integer_to_Decimal (Str : String; Val : Uns; Base : Unsigned; ScaleB : Integer; + Extra : Unsigned; Minus : Boolean; Scale : Integer) return Int; -- Convert the real value from integer to decimal representation @@ -59,6 +61,7 @@ package body System.Value_D is Val : Uns; Base : Unsigned; ScaleB : Integer; + Extra : Unsigned; Minus : Boolean; Scale : Integer) return Int is @@ -126,6 +129,10 @@ package body System.Value_D is end if; end Unsigned_To_Signed; + -- Local variables + + E : Uns := Uns (Extra); + begin -- If the base of the value is 10 or its scaling factor is zero, then -- add the scales (they are defined in the opposite sense) and apply @@ -143,9 +150,10 @@ package body System.Value_D is end loop; while S > 0 loop - if V <= Uns'Last / 10 then - V := V * 10; + if V <= (Uns'Last - E) / 10 then + V := V * 10 + E; S := S - 1; + E := 0; else Bad_Value (Str); end if; @@ -193,8 +201,9 @@ package body System.Value_D is Z := 10 ** Integer'Max (0, -Scale); for J in 1 .. LS loop - if V <= Uns'Last / Uns (B) then - V := V * Uns (B); + if V <= (Uns'Last - E) / Uns (B) then + V := V * Uns (B) + E; + E := 0; else Bad_Value (Str); end if; @@ -207,7 +216,7 @@ package body System.Value_D is raise Program_Error; end if; - -- Perform a scale divide operation with rounding to match 'Image + -- Perform a scaled divide operation with rounding to match 'Image Scaled_Divide (Unsigned_To_Signed (V), Y, Z, Q, R, Round => True); @@ -238,7 +247,8 @@ package body System.Value_D is begin Val := Impl.Scan_Raw_Real (Str, Ptr, Max, Base, Scl, Extra, Minus); - return Integer_to_Decimal (Str, Val (1), Base, Scl (1), Minus, Scale); + return + Integer_to_Decimal (Str, Val (1), Base, Scl (1), Extra, Minus, Scale); end Scan_Decimal; ------------------- @@ -255,7 +265,8 @@ package body System.Value_D is begin Val := Impl.Value_Raw_Real (Str, Base, Scl, Extra, Minus); - return Integer_to_Decimal (Str, Val (1), Base, Scl (1), Minus, Scale); + return + Integer_to_Decimal (Str, Val (1), Base, Scl (1), Extra, Minus, Scale); end Value_Decimal; end System.Value_D; 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/libgnat/s-valueu.adb b/gcc/ada/libgnat/s-valueu.adb index 72e73a8..a27e00f 100644 --- a/gcc/ada/libgnat/s-valueu.adb +++ b/gcc/ada/libgnat/s-valueu.adb @@ -73,6 +73,15 @@ package body System.Value_U is end if; P := Ptr.all; + + -- Exit when the initial string to parse is empty + + if Max < P then + raise Program_Error with + "Scan end Max=" & Max'Img & + " is smaller than scan end Ptr=" & P'Img; + end if; + Uval := Character'Pos (Str (P)) - Character'Pos ('0'); pragma Assert (Str (P) in '0' .. '9'); P := P + 1; diff --git a/gcc/ada/libgnat/s-valueu.ads b/gcc/ada/libgnat/s-valueu.ads index 0dc3399..488c342 100644 --- a/gcc/ada/libgnat/s-valueu.ads +++ b/gcc/ada/libgnat/s-valueu.ads @@ -102,11 +102,9 @@ package System.Value_U is -- This string results in a Constraint_Error with the pointer pointing -- past the second 2. -- - -- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a - -- special case of an all-blank string, and Ptr is unchanged, and hence - -- is greater than Max as required in this case. - -- ??? This is not the case. We will read Str (Ptr.all) without checking - -- and increase Ptr.all by one. + -- Note: If Max is less than Ptr, then Ptr is left unchanged and + -- Program_Error is raised to indicate that a valid integer cannot + -- be parsed. -- -- Note: this routine should not be called with Str'Last = Positive'Last. -- If this occurs Program_Error is raised with a message noting that this diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb index e27669e..b7d3abd 100644 --- a/gcc/ada/namet.adb +++ b/gcc/ada/namet.adb @@ -1297,29 +1297,11 @@ package body Namet is -- Present -- ------------- - function Present (Nam : File_Name_Type) return Boolean is - begin - return Nam /= No_File; - end Present; - - ------------- - -- Present -- - ------------- - function Present (Nam : Name_Id) return Boolean is begin return Nam /= No_Name; end Present; - ------------- - -- Present -- - ------------- - - function Present (Nam : Unit_Name_Type) return Boolean is - begin - return Nam /= No_Unit_Name; - end Present; - ------------------ -- Reinitialize -- ------------------ diff --git a/gcc/ada/namet.ads b/gcc/ada/namet.ads index 7182fb8..b05e4b5 100644 --- a/gcc/ada/namet.ads +++ b/gcc/ada/namet.ads @@ -504,10 +504,6 @@ package Namet is -- Constant used to indicate no file is present (this is used for example -- when a search for a file indicates that no file of the name exists). - function Present (Nam : File_Name_Type) return Boolean; - pragma Inline (Present); - -- Determine whether file name Nam exists - Error_File_Name : constant File_Name_Type := File_Name_Type (Error_Name); -- The special File_Name_Type value Error_File_Name is used to indicate -- a unit name where some previous processing has found an error. @@ -532,10 +528,6 @@ package Namet is No_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (No_Name); -- Constant used to indicate no file name present - function Present (Nam : Unit_Name_Type) return Boolean; - pragma Inline (Present); - -- Determine whether unit name Nam exists - Error_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (Error_Name); -- The special Unit_Name_Type value Error_Unit_Name is used to indicate -- a unit name where some previous processing has found an error. 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/par-ch13.adb b/gcc/ada/par-ch13.adb index f52136c..dbb894f 100644 --- a/gcc/ada/par-ch13.adb +++ b/gcc/ada/par-ch13.adb @@ -503,6 +503,8 @@ package body Ch13 is or else A_Id = Aspect_Refined_Depends then Inside_Depends := True; + elsif A_Id = Aspect_Abstract_State then + Inside_Abstract_State := True; end if; -- Note that we have seen an Import aspect specification. @@ -529,9 +531,10 @@ package body Ch13 is Set_Expression (Aspect, P_Expression); end if; - -- Unconditionally reset flag for Inside_Depends + -- Unconditionally reset flag for being inside aspects - Inside_Depends := False; + Inside_Depends := False; + Inside_Abstract_State := False; end if; -- Add the aspect to the resulting list only when it was properly diff --git a/gcc/ada/par-ch2.adb b/gcc/ada/par-ch2.adb index 20640d55..11c9a83 100644 --- a/gcc/ada/par-ch2.adb +++ b/gcc/ada/par-ch2.adb @@ -385,6 +385,8 @@ package body Ch2 is or else Chars (Ident_Node) = Name_Refined_Depends then Inside_Depends := True; + elsif Chars (Ident_Node) = Name_Abstract_State then + Inside_Abstract_State := True; end if; -- Scan arguments. We assume that arguments are present if there is @@ -441,11 +443,11 @@ package body Ch2 is Semicolon_Loc := Token_Ptr; - -- Cancel indication of being within a pragma or in particular a Depends - -- pragma. + -- Cancel indication of being within a pragma - Inside_Depends := False; - Inside_Pragma := False; + Inside_Depends := False; + Inside_Abstract_State := False; + Inside_Pragma := False; -- Now we have two tasks left, we need to scan out the semicolon -- following the pragma, and we have to call Par.Prag to process @@ -472,8 +474,9 @@ package body Ch2 is exception when Error_Resync => Resync_Past_Semicolon; - Inside_Depends := False; - Inside_Pragma := False; + Inside_Depends := False; + Inside_Abstract_State := False; + Inside_Pragma := False; return Error; end P_Pragma; diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 8267a0c..ebdc587 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -668,13 +668,13 @@ package body Ch4 is -- (discrete_range) - -- This is a slice. This case is handled in LP_State_Init + -- This is a slice -- (expression, expression, ..) -- This is interpreted as an indexed component, i.e. as a -- case of a name which can be extended in the normal manner. - -- This case is handled by LP_State_Name or LP_State_Expr. + -- This case is handled by LP_State_Expr. -- Note: if and case expressions (without an extra level of -- parentheses) are permitted in this context). @@ -935,129 +935,9 @@ package body Ch4 is -- Error recovery: cannot raise Error_Resync - function P_Function_Name return Node_Id is - Designator_Node : Node_Id; - Prefix_Node : Node_Id; - Selector_Node : Node_Id; - Dot_Sloc : Source_Ptr := No_Location; - - begin - -- Prefix_Node is set to the gathered prefix so far, Empty means that - -- no prefix has been scanned. This allows us to build up the result - -- in the required right recursive manner. - - Prefix_Node := Empty; - - -- Loop through prefixes - - loop - Designator_Node := Token_Node; - - if Token not in Token_Class_Desig then - return P_Identifier; -- let P_Identifier issue the error message - - else -- Token in Token_Class_Desig - Scan; -- past designator - exit when Token /= Tok_Dot; - end if; - - -- Here at a dot, with token just before it in Designator_Node - - if No (Prefix_Node) then - Prefix_Node := Designator_Node; - else - Selector_Node := New_Node (N_Selected_Component, Dot_Sloc); - Set_Prefix (Selector_Node, Prefix_Node); - Set_Selector_Name (Selector_Node, Designator_Node); - Prefix_Node := Selector_Node; - end if; - - Dot_Sloc := Token_Ptr; - Scan; -- past dot - end loop; - - -- Fall out of the loop having just scanned a designator - - if No (Prefix_Node) then - return Designator_Node; - else - Selector_Node := New_Node (N_Selected_Component, Dot_Sloc); - Set_Prefix (Selector_Node, Prefix_Node); - Set_Selector_Name (Selector_Node, Designator_Node); - return Selector_Node; - end if; - - exception - when Error_Resync => - return Error; - end P_Function_Name; - - -- This function parses a restricted form of Names which are either - -- identifiers, or identifiers preceded by a sequence of prefixes - -- that are direct names. - - -- Error recovery: cannot raise Error_Resync - function P_Qualified_Simple_Name return Node_Id is - Designator_Node : Node_Id; - Prefix_Node : Node_Id; - Selector_Node : Node_Id; - Dot_Sloc : Source_Ptr := No_Location; - begin - -- Prefix node is set to the gathered prefix so far, Empty means that - -- no prefix has been scanned. This allows us to build up the result - -- in the required right recursive manner. - - Prefix_Node := Empty; - - -- Loop through prefixes - - loop - Designator_Node := Token_Node; - - if Token = Tok_Identifier then - Scan; -- past identifier - exit when Token /= Tok_Dot; - - elsif Token not in Token_Class_Desig then - return P_Identifier; -- let P_Identifier issue the error message - - else - Scan; -- past designator - - if Token /= Tok_Dot then - Error_Msg_SP ("identifier expected"); - return Error; - end if; - end if; - - -- Here at a dot, with token just before it in Designator_Node - - if No (Prefix_Node) then - Prefix_Node := Designator_Node; - else - Selector_Node := New_Node (N_Selected_Component, Dot_Sloc); - Set_Prefix (Selector_Node, Prefix_Node); - Set_Selector_Name (Selector_Node, Designator_Node); - Prefix_Node := Selector_Node; - end if; - - Dot_Sloc := Token_Ptr; - Scan; -- past dot - end loop; - - -- Fall out of the loop having just scanned an identifier - - if No (Prefix_Node) then - return Designator_Node; - else - Selector_Node := New_Node (N_Selected_Component, Dot_Sloc); - Set_Prefix (Selector_Node, Prefix_Node); - Set_Selector_Name (Selector_Node, Designator_Node); - return Selector_Node; - end if; - + return P_Qualified_Simple_Name_Resync; exception when Error_Resync => return Error; @@ -1076,6 +956,10 @@ package body Ch4 is Dot_Sloc : Source_Ptr := No_Location; begin + -- Prefix_Node is set to the gathered prefix so far, Empty means that + -- no prefix has been scanned. This allows us to build up the result + -- in the required right recursive manner. + Prefix_Node := Empty; -- Loop through prefixes @@ -1083,21 +967,13 @@ package body Ch4 is loop Designator_Node := Token_Node; - if Token = Tok_Identifier then - Scan; -- past identifier - exit when Token /= Tok_Dot; - - elsif Token not in Token_Class_Desig then + if Token not in Token_Class_Desig then Discard_Junk_Node (P_Identifier); -- to issue the error message raise Error_Resync; else Scan; -- past designator - - if Token /= Tok_Dot then - Error_Msg_SP ("identifier expected"); - raise Error_Resync; - end if; + exit when Token /= Tok_Dot; end if; -- Here at a dot, with token just before it in Designator_Node @@ -1112,7 +988,7 @@ package body Ch4 is end if; Dot_Sloc := Token_Ptr; - Scan; -- past period + Scan; -- past dot end loop; -- Fall out of the loop having just scanned an identifier @@ -1607,8 +1483,13 @@ package body Ch4 is -- Improper use of WITH elsif Token = Tok_With then - Error_Msg_SC ("WITH must be preceded by single expression in " & - "extension aggregate"); + if Inside_Abstract_State then + Error_Msg_SC ("state name with options must be enclosed in " & + "parentheses"); + else + Error_Msg_SC ("WITH must be preceded by single expression in " & + "extension aggregate"); + end if; raise Error_Resync; -- Range attribute can only appear as part of a discrete choice list diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index a46fe44..34c1019 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -1899,11 +1899,11 @@ package body Ch5 is (Block_Name : Node_Id := Empty) return Node_Id is - Block_Node : Node_Id; + Block : Node_Id; Created_Name : Node_Id; begin - Block_Node := New_Node (N_Block_Statement, Token_Ptr); + Block := New_Node (N_Block_Statement, Token_Ptr); Push_Scope_Stack; Scopes (Scope.Last).Etyp := E_Name; @@ -1916,18 +1916,18 @@ package body Ch5 is if No (Block_Name) then Created_Name := - Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B')); + Make_Identifier (Sloc (Block), Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); - Set_Has_Created_Identifier (Block_Node, True); - Set_Identifier (Block_Node, Created_Name); + Set_Has_Created_Identifier (Block, True); + Set_Identifier (Block, Created_Name); Scopes (Scope.Last).Labl := Created_Name; else - Set_Identifier (Block_Node, Block_Name); + Set_Identifier (Block, Block_Name); end if; - Append_Elmt (Block_Node, Label_List); - Parse_Decls_Begin_End (Block_Node); - return Block_Node; + Append_Elmt (Block, Label_List); + Parse_Decls_Begin_End (Block); + return Block; end P_Declare_Statement; -- P_Begin_Statement @@ -1942,11 +1942,11 @@ package body Ch5 is (Block_Name : Node_Id := Empty) return Node_Id is - Block_Node : Node_Id; + Block : Node_Id; Created_Name : Node_Id; begin - Block_Node := New_Node (N_Block_Statement, Token_Ptr); + Block := New_Node (N_Block_Statement, Token_Ptr); Push_Scope_Stack; Scopes (Scope.Last).Etyp := E_Name; @@ -1957,24 +1957,24 @@ package body Ch5 is if No (Block_Name) then Created_Name := - Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B')); + Make_Identifier (Sloc (Block), Set_Loop_Block_Name ('B')); Set_Comes_From_Source (Created_Name, False); - Set_Has_Created_Identifier (Block_Node, True); - Set_Identifier (Block_Node, Created_Name); + Set_Has_Created_Identifier (Block, True); + Set_Identifier (Block, Created_Name); Scopes (Scope.Last).Labl := Created_Name; else - Set_Identifier (Block_Node, Block_Name); + Set_Identifier (Block, Block_Name); end if; - Append_Elmt (Block_Node, Label_List); + Append_Elmt (Block, Label_List); Scopes (Scope.Last).Ecol := Start_Column; Scopes (Scope.Last).Sloc := Token_Ptr; Scan; -- past BEGIN Set_Handled_Statement_Sequence - (Block_Node, P_Handled_Sequence_Of_Statements); - End_Statements (Handled_Statement_Sequence (Block_Node)); - return Block_Node; + (Block, P_Handled_Sequence_Of_Statements); + End_Statements (Handled_Statement_Sequence (Block)); + return Block; end P_Begin_Statement; ------------------------- diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 55591fd..0f7765b 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -362,12 +362,11 @@ package body Ch6 is if Func then Inst_Node := New_Node (N_Function_Instantiation, Fproc_Sloc); - Set_Name (Inst_Node, P_Function_Name); else Inst_Node := New_Node (N_Procedure_Instantiation, Fproc_Sloc); - Set_Name (Inst_Node, P_Qualified_Simple_Name); end if; + Set_Name (Inst_Node, P_Qualified_Simple_Name); Set_Defining_Unit_Name (Inst_Node, Name_Node); Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt); P_Aspect_Specifications (Inst_Node, Semicolon => True); diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb index 5d61fac..e11ec7e 100644 --- a/gcc/ada/par.adb +++ b/gcc/ada/par.adb @@ -80,6 +80,11 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is -- True within a delta aggregate (but only after the "delta" token has -- been scanned). Used to distinguish syntax errors from syntactically -- correct "deep" delta aggregates (enabled via -gnatX0). + + Inside_Abstract_State : Boolean := False; + -- True within an Abstract_State contract. Used to distinguish syntax error + -- about extended aggregates and about a malformed contract. + Save_Style_Checks : Style_Check_Options; Save_Style_Check : Boolean; -- Variables for storing the original state of whether style checks should @@ -825,7 +830,6 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is function P_Aggregate return Node_Id; function P_Expression return Node_Id; function P_Expression_Or_Range_Attribute return Node_Id; - function P_Function_Name return Node_Id; function P_Name return Node_Id; function P_Qualified_Simple_Name return Node_Id; function P_Qualified_Simple_Name_Resync return Node_Id; 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.adb b/gcc/ada/sem.adb index 06df00e..449fd8a 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -765,12 +765,11 @@ package body Sem is E : constant Entity_Id := Defining_Entity_Or_Empty (N); begin if Present (E) then - if Ekind (E) = E_Void - and then Nkind (N) = N_Component_Declaration + if Nkind (N) = N_Component_Declaration and then Present (Scope (E)) and then Ekind (Scope (E)) = E_Record_Type then - null; -- Set it later, in Analyze_Component_Declaration + null; -- Set it later, in Record_Type_Definition elsif not Is_Not_Self_Hidden (E) then Set_Is_Not_Self_Hidden (E); end if; diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index bf4d684..4f5047f 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -5693,19 +5693,15 @@ package body Sem_Attr is when Attribute_Partition_ID => Check_E0; - if P_Type /= Any_Type then - if not Is_Library_Level_Entity (Entity (P)) then - Error_Attr_P - ("prefix of % attribute must be library-level entity"); + if not Is_Library_Level_Entity (Entity (P)) then + Error_Attr_P + ("prefix of % attribute must be library-level entity"); - -- The defining entity of prefix should not be declared inside a - -- Pure unit. RM E.1(8). Is_Pure was set during declaration. + -- The defining entity of prefix should not be declared inside a + -- Pure unit. RM E.1(8). Is_Pure was set during declaration. - elsif Is_Entity_Name (P) - and then Is_Pure (Entity (P)) - then - Error_Attr_P ("prefix of% attribute must not be declared pure"); - end if; + elsif Is_Entity_Name (P) and then Is_Pure (Entity (P)) then + Error_Attr_P ("prefix of% attribute must not be declared pure"); end if; Set_Etype (N, Universal_Integer); @@ -13018,7 +13014,6 @@ package body Sem_Attr is -- their Entity attribute to reference their discriminal. if Expander_Active - and then Present (Expressions (N)) and then Attr_Id /= Attribute_Make then declare diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 3399a41..c81b563 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -3684,13 +3684,15 @@ package body Sem_Case is -- Use of nonstatic predicate is an error if not Is_Discrete_Type (E) - or else not Has_Static_Predicate (E) + or else (not Has_Static_Predicate (E) + and then + not Has_Static_Predicate_Aspect (E)) or else Has_Dynamic_Predicate_Aspect (E) or else Has_Ghost_Predicate_Aspect (E) then Bad_Predicated_Subtype_Use - ("cannot use subtype& with non-static " - & "predicate as case alternative", + ("cannot use subtype& with nonstatic " + & "predicate as choice in case alternative", Choice, E, Suggest_Static => True); -- Static predicate case. The bounds are those of diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 25bba9b..45aabad 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -1225,9 +1225,15 @@ package body Sem_Ch10 is if Expander_Active and then Tagged_Type_Expansion then case Nkind (Unit_Node) is - when N_Package_Declaration | N_Package_Body => + when N_Package_Declaration => Build_Static_Dispatch_Tables (Unit_Node); + when N_Package_Body => + if Ekind (Corresponding_Spec (Unit_Node)) /= E_Generic_Package + then + Build_Static_Dispatch_Tables (Unit_Node); + end if; + when N_Package_Instantiation => Build_Static_Dispatch_Tables (Instance_Spec (Unit_Node)); diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 3a31a92..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 @@ -6032,6 +6057,10 @@ package body Sem_Ch12 is if (Is_In_Main_Unit (N) or else Is_Inlined_Or_Child_Of_Inlined (Subp)) + -- No need to instantiate bodies in generic units + + and then not Is_Generic_Unit (Cunit_Entity (Main_Unit)) + -- Must be generating code or analyzing code in GNATprove mode and then (Operating_Mode = Generate_Code @@ -6451,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)); @@ -7559,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)) @@ -7595,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 @@ -9341,9 +9371,6 @@ package body Sem_Ch12 is and then Nkind (Ancestor_Type (N)) in N_Entity then declare - Root_Typ : constant Entity_Id := - Root_Type (Ancestor_Type (N)); - Typ : Entity_Id := Ancestor_Type (N); begin @@ -9352,7 +9379,7 @@ package body Sem_Ch12 is Switch_View (Typ); end if; - exit when Typ = Root_Typ; + exit when Etype (Typ) = Typ; Typ := Etype (Typ); end loop; @@ -10057,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); @@ -10382,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 @@ -10429,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; @@ -14129,6 +14157,16 @@ package body Sem_Ch12 is T2 := Etype (I2); end if; + -- In the case of a fixed-lower-bound subtype, we want to check + -- against the index type's range rather than the range of the + -- subtype (which will be seen as unconstrained, and whose bounds + -- won't generally match those of the formal unconstrained array + -- type's corresponding index type). + + if Is_Fixed_Lower_Bound_Index_Subtype (T2) then + T2 := Etype (Scalar_Range (T2)); + end if; + if not Subtypes_Match (Find_Actual_Type (Etype (I1), A_Gen_T), T2) then diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 76a8c0b..22575f9 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -6208,6 +6208,7 @@ package body Sem_Ch13 is declare Expr : constant Node_Id := Expression (N); O_Ent : Entity_Id; + O_Typ : Entity_Id; Off : Boolean; begin @@ -6220,7 +6221,7 @@ package body Sem_Ch13 is return; end if; - Find_Overlaid_Entity (N, O_Ent, Off); + Find_Overlaid_Entity (N, O_Ent, O_Typ, Off); if Present (O_Ent) then @@ -6273,10 +6274,10 @@ package body Sem_Ch13 is if (Is_Record_Type (Etype (U_Ent)) or else Is_Array_Type (Etype (U_Ent))) - and then (Is_Record_Type (Etype (O_Ent)) - or else Is_Array_Type (Etype (O_Ent))) + and then (Is_Record_Type (O_Typ) + or else Is_Array_Type (O_Typ)) and then Reverse_Storage_Order (Etype (U_Ent)) /= - Reverse_Storage_Order (Etype (O_Ent)) + Reverse_Storage_Order (O_Typ) then Error_Msg_N ("??overlay changes scalar storage order", Expr); diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 690d668..425d624 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -290,6 +290,15 @@ package body Sem_Ch3 is -- Check that the expression represented by E is suitable for use as a -- digits expression, i.e. it is of integer type, positive and static. + procedure Check_Discriminant_Conformance + (N : Node_Id; + Prev : Entity_Id; + Prev_Loc : Node_Id); + -- Check that the discriminants of a full type N fully conform to the + -- discriminants of the corresponding partial view Prev. Prev_Loc indicates + -- the source location of the partial view, which may be different than + -- Prev in the case of private types. + procedure Check_Initialization (T : Entity_Id; Exp : Node_Id); -- Validate the initialization of an object declaration. T is the required -- type, and Exp is the initialization expression. @@ -382,7 +391,7 @@ package body Sem_Ch3 is -- created in the procedure and attached to Related_Nod. procedure Constrain_Array - (Def_Id : in out Entity_Id; + (Def_Id : Entity_Id; SI : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id; @@ -1414,7 +1423,9 @@ package body Sem_Ch3 is end if; else - Setup_Access_Type (Desig_Typ => Process_Subtype (S, P, T, 'P')); + Setup_Access_Type + (Desig_Typ => + Process_Subtype (S, P, T, 'P', Incomplete_Type_OK => True)); end if; if not Error_Posted (T) then @@ -1951,7 +1962,7 @@ package body Sem_Ch3 is procedure Analyze_Component_Declaration (N : Node_Id) is Id : constant Entity_Id := Defining_Identifier (N); E : constant Node_Id := Expression (N); - Typ : constant Node_Id := + Ind : constant Node_Id := Subtype_Indication (Component_Definition (N)); T : Entity_Id; P : Entity_Id; @@ -2046,10 +2057,11 @@ package body Sem_Ch3 is -- Start of processing for Analyze_Component_Declaration begin + Mutate_Ekind (Id, E_Component); Generate_Definition (Id); Enter_Name (Id); - if Present (Typ) then + if Present (Ind) then T := Find_Type_Of_Object (Subtype_Indication (Component_Definition (N)), N); @@ -3701,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); @@ -3762,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 @@ -3794,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; @@ -3951,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); @@ -4364,6 +4376,12 @@ package body Sem_Ch3 is -- Start of processing for Analyze_Object_Declaration begin + if Constant_Present (N) then + Mutate_Ekind (Id, E_Constant); + else + Mutate_Ekind (Id, E_Variable); + end if; + -- There are three kinds of implicit types generated by an -- object declaration: @@ -4443,7 +4461,6 @@ package body Sem_Ch3 is T := Find_Type_Of_Object (Object_Definition (N), N); Set_Etype (Id, T); - Mutate_Ekind (Id, E_Variable); goto Leave; end if; @@ -4469,7 +4486,6 @@ package body Sem_Ch3 is if Error_Posted (Id) then Set_Etype (Id, T); - Mutate_Ekind (Id, E_Variable); goto Leave; end if; end if; @@ -4552,7 +4568,6 @@ package body Sem_Ch3 is Error_Msg_N ("\declaration requires an initialization expression", N); - Set_Constant_Present (N, False); -- In Ada 83, deferred constant must be of private type @@ -4659,9 +4674,7 @@ package body Sem_Ch3 is Set_Has_Completion (Id); end if; - -- Set type and resolve (type may be overridden later on). Note: - -- Ekind (Id) must still be E_Void at this point so that incorrect - -- early usage within E is properly diagnosed. + -- Set type and resolve (type may be overridden later on) Set_Etype (Id, T); @@ -4761,7 +4774,6 @@ package body Sem_Ch3 is and then In_Subrange_Of (Etype (Entity (E)), T) then Set_Is_Known_Valid (Id); - Mutate_Ekind (Id, E_Constant); Set_Actual_Subtype (Id, Etype (Entity (E))); end if; @@ -5010,12 +5022,6 @@ package body Sem_Ch3 is -- for discriminants and are thus not indefinite. elsif Is_Unchecked_Union (T) then - if Constant_Present (N) or else Nkind (E) = N_Function_Call then - Mutate_Ekind (Id, E_Constant); - else - Mutate_Ekind (Id, E_Variable); - end if; - -- If the expression is an aggregate it contains the required -- discriminant values but it has not been resolved yet, so do -- it now, and treat it as the initial expression of an object @@ -5076,10 +5082,8 @@ package body Sem_Ch3 is -- "X : Integer := X;". if Constant_Present (N) then - Mutate_Ekind (Id, E_Constant); Set_Is_True_Constant (Id); else - Mutate_Ekind (Id, E_Variable); if Present (E) then Set_Has_Initial_Value (Id); end if; @@ -5221,12 +5225,9 @@ package body Sem_Ch3 is end if; if Constant_Present (N) then - Mutate_Ekind (Id, E_Constant); Set_Is_True_Constant (Id); else - Mutate_Ekind (Id, E_Variable); - -- A variable is set as shared passive if it appears in a shared -- passive package, and is at the outer level. This is not done for -- entities generated during expansion, because those are always @@ -5779,7 +5780,15 @@ package body Sem_Ch3 is Enter_Name (Id); end if; - T := Process_Subtype (Subtype_Indication (N), N, Id, 'P'); + T := + Process_Subtype + (Subtype_Indication (N), + N, + Id, + 'P', + Excludes_Null => Null_Exclusion_Present (N), + Incomplete_Type_OK => + Ada_Version >= Ada_2005 or else Is_Itype (Id)); -- Class-wide equivalent types of records with unknown discriminants -- involve the generation of an itype which serves as the private view @@ -6459,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 @@ -6596,7 +6608,13 @@ package body Sem_Ch3 is -- Process subtype indication if one is present if Present (Component_Typ) then - Element_Type := Process_Subtype (Component_Typ, P, Related_Id, 'C'); + Element_Type := + Process_Subtype + (Component_Typ, + P, + Related_Id, + 'C', + Excludes_Null => Null_Exclusion_Present (Component_Def)); Set_Etype (Component_Typ, Element_Type); -- Ada 2005 (AI-230): Access Definition case @@ -6637,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 @@ -7212,7 +7230,11 @@ package body Sem_Ch3 is Set_Directly_Designated_Type (Derived_Type, Designated_Type (Parent_Type)); - Subt := Process_Subtype (S, N); + Subt := + Process_Subtype + (S, + N, + Excludes_Null => Null_Exclusion_Present (Type_Definition (N))); if Nkind (S) /= N_Subtype_Indication and then Subt /= Base_Type (Subt) @@ -8114,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 @@ -8489,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. @@ -9458,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", @@ -12668,6 +12695,249 @@ package body Sem_Ch3 is end Check_Digits_Expression; + ------------------------------------ + -- Check_Discriminant_Conformance -- + ------------------------------------ + + procedure Check_Discriminant_Conformance + (N : Node_Id; + Prev : Entity_Id; + Prev_Loc : Node_Id) + is + Old_Discr : Entity_Id := First_Discriminant (Prev); + New_Discr : Node_Id := First (Discriminant_Specifications (N)); + New_Discr_Id : Entity_Id; + New_Discr_Type : Entity_Id; + + procedure Conformance_Error (Msg : String; N : Node_Id); + -- Post error message for conformance error on given node. Two messages + -- are output. The first points to the previous declaration with a + -- general "no conformance" message. The second is the detailed reason, + -- supplied as Msg. The parameter N provide information for a possible + -- & insertion in the message. + + ----------------------- + -- Conformance_Error -- + ----------------------- + + procedure Conformance_Error (Msg : String; N : Node_Id) is + begin + Error_Msg_Sloc := Sloc (Prev_Loc); + Error_Msg_N -- CODEFIX + ("not fully conformant with declaration#!", N); + Error_Msg_NE (Msg, N, N); + end Conformance_Error; + + -- Start of processing for Check_Discriminant_Conformance + + begin + while Present (Old_Discr) and then Present (New_Discr) loop + New_Discr_Id := Defining_Identifier (New_Discr); + + -- The subtype mark of the discriminant on the full type has not + -- been analyzed so we do it here. For an access discriminant a new + -- type is created. + + if Nkind (Discriminant_Type (New_Discr)) = N_Access_Definition then + New_Discr_Type := + Access_Definition (N, Discriminant_Type (New_Discr)); + + else + Find_Type (Discriminant_Type (New_Discr)); + New_Discr_Type := Etype (Discriminant_Type (New_Discr)); + + -- Ada 2005: if the discriminant definition carries a null + -- exclusion, create an itype to check properly for consistency + -- with partial declaration. + + if Is_Access_Type (New_Discr_Type) + and then Null_Exclusion_Present (New_Discr) + then + New_Discr_Type := + Create_Null_Excluding_Itype + (T => New_Discr_Type, + Related_Nod => New_Discr, + Scope_Id => Current_Scope); + end if; + end if; + + if not Conforming_Types + (Etype (Old_Discr), New_Discr_Type, Fully_Conformant) + then + Conformance_Error ("type of & does not match!", New_Discr_Id); + return; + else + -- Treat the new discriminant as an occurrence of the old one, + -- for navigation purposes, and fill in some semantic + -- information, for completeness. + + Generate_Reference (Old_Discr, New_Discr_Id, 'r'); + Set_Etype (New_Discr_Id, Etype (Old_Discr)); + Set_Scope (New_Discr_Id, Scope (Old_Discr)); + end if; + + -- Names must match + + if Chars (Old_Discr) /= Chars (Defining_Identifier (New_Discr)) then + Conformance_Error ("name & does not match!", New_Discr_Id); + return; + end if; + + -- Default expressions must match + + declare + NewD : constant Boolean := + Present (Expression (New_Discr)); + OldD : constant Boolean := + Present (Expression (Parent (Old_Discr))); + + function Has_Tagged_Limited_Partial_View + (Typ : Entity_Id) return Boolean; + -- Returns True iff Typ has a tagged limited partial view. + + function Is_Derived_From_Immutably_Limited_Type + (Typ : Entity_Id) return Boolean; + -- Returns True iff Typ is a derived type (tagged or not) + -- whose ancestor type is immutably limited. The unusual + -- ("unusual" is one word for it) thing about this function + -- is that it handles the case where the ancestor name's Entity + -- attribute has not been set yet. + + ------------------------------------- + -- Has_Tagged_Limited_Partial_View -- + ------------------------------------- + + function Has_Tagged_Limited_Partial_View + (Typ : Entity_Id) return Boolean + is + Priv : constant Entity_Id := Incomplete_Or_Partial_View (Typ); + begin + return Present (Priv) + and then not Is_Incomplete_Type (Priv) + and then Is_Tagged_Type (Priv) + and then Limited_Present (Parent (Priv)); + end Has_Tagged_Limited_Partial_View; + + -------------------------------------------- + -- Is_Derived_From_Immutably_Limited_Type -- + -------------------------------------------- + + function Is_Derived_From_Immutably_Limited_Type + (Typ : Entity_Id) return Boolean + is + Type_Def : constant Node_Id := Type_Definition (Parent (Typ)); + Parent_Name : Node_Id; + begin + if Nkind (Type_Def) /= N_Derived_Type_Definition then + return False; + end if; + Parent_Name := Subtype_Indication (Type_Def); + if Nkind (Parent_Name) = N_Subtype_Indication then + Parent_Name := Subtype_Mark (Parent_Name); + end if; + if Parent_Name not in N_Has_Entity_Id + or else No (Entity (Parent_Name)) + then + Find_Type (Parent_Name); + end if; + return Is_Immutably_Limited_Type (Entity (Parent_Name)); + end Is_Derived_From_Immutably_Limited_Type; + + begin + if NewD or OldD then + + -- The old default value has been analyzed and expanded, + -- because the current full declaration will have frozen + -- everything before. The new default values have not been + -- expanded, so expand now to check conformance. + + if NewD then + Preanalyze_And_Resolve_Spec_Expression + (Expression (New_Discr), New_Discr_Type); + end if; + + if not (NewD and OldD) + or else not Fully_Conformant_Expressions + (Expression (Parent (Old_Discr)), + Expression (New_Discr)) + + then + Conformance_Error + ("default expression for & does not match!", + New_Discr_Id); + return; + end if; + + if NewD + and then Ada_Version >= Ada_2005 + and then Nkind (Discriminant_Type (New_Discr)) = + N_Access_Definition + and then not Is_Immutably_Limited_Type + (Defining_Identifier (N)) + + -- Check for a case that would be awkward to handle in + -- Is_Immutably_Limited_Type (because sem_aux can't + -- "with" sem_util). + + and then not Has_Tagged_Limited_Partial_View + (Defining_Identifier (N)) + + -- Check for another case that would be awkward to handle + -- in Is_Immutably_Limited_Type + + and then not Is_Derived_From_Immutably_Limited_Type + (Defining_Identifier (N)) + then + Error_Msg_N + ("(Ada 2005) default value for access discriminant " + & "requires immutably limited type", + Expression (New_Discr)); + return; + end if; + end if; + end; + + -- In Ada 83 case, grouping must match: (A,B : X) /= (A : X; B : X) + + if Ada_Version = Ada_83 then + declare + Old_Disc : constant Node_Id := Declaration_Node (Old_Discr); + + begin + -- Grouping (use of comma in param lists) must be the same + -- This is where we catch a misconformance like: + + -- A, B : Integer + -- A : Integer; B : Integer + + -- which are represented identically in the tree except + -- for the setting of the flags More_Ids and Prev_Ids. + + if More_Ids (Old_Disc) /= More_Ids (New_Discr) + or else Prev_Ids (Old_Disc) /= Prev_Ids (New_Discr) + then + Conformance_Error + ("grouping of & does not match!", New_Discr_Id); + return; + end if; + end; + end if; + + Next_Discriminant (Old_Discr); + Next (New_Discr); + end loop; + + if Present (Old_Discr) then + Conformance_Error ("too few discriminants!", Defining_Identifier (N)); + return; + + elsif Present (New_Discr) then + Conformance_Error + ("too many discriminants!", Defining_Identifier (New_Discr)); + return; + end if; + end Check_Discriminant_Conformance; + -------------------------- -- Check_Initialization -- -------------------------- @@ -13970,7 +14240,7 @@ package body Sem_Ch3 is --------------------- procedure Constrain_Array - (Def_Id : in out Entity_Id; + (Def_Id : Entity_Id; SI : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id; @@ -14070,14 +14340,7 @@ package body Sem_Ch3 is end if; end if; - if No (Def_Id) then - Def_Id := - Create_Itype (E_Array_Subtype, Related_Nod, Related_Id, Suffix); - Set_Parent (Def_Id, Related_Nod); - - else - Mutate_Ekind (Def_Id, E_Array_Subtype); - end if; + Mutate_Ekind (Def_Id, E_Array_Subtype); Set_Size_Info (Def_Id, (T)); Set_First_Rep_Item (Def_Id, First_Rep_Item (T)); @@ -14963,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 @@ -15008,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 @@ -15063,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)); @@ -15093,7 +15355,8 @@ package body Sem_Ch3 is -- If this is a range for a fixed-lower-bound subtype, then set the -- index itype's low bound to the FLB and the index itype's upper bound -- to the high bound of the parent array type's index subtype. Also, - -- mark the itype as an FLB index subtype. + -- set the Etype of the new scalar range and mark the itype as an FLB + -- index subtype. if Nkind (S) = N_Range and then Is_FLB_Index then Set_Scalar_Range @@ -15101,6 +15364,7 @@ package body Sem_Ch3 is Make_Range (Sloc (S), Low_Bound => Low_Bound (S), High_Bound => Type_High_Bound (T))); + Set_Etype (Scalar_Range (Def_Id), Etype (Index)); Set_Is_Fixed_Lower_Bound_Index_Subtype (Def_Id); else @@ -18833,10 +19097,15 @@ package body Sem_Ch3 is or else Nkind (P) /= N_Object_Declaration or else Is_Library_Level_Entity (Defining_Identifier (P))); - -- Otherwise, the object definition is just a subtype_mark + -- Otherwise, either the object definition is just a subtype_mark or we + -- are analyzing a component declaration. else - T := Process_Subtype (Obj_Def, Related_Nod); + T := + Process_Subtype + (Obj_Def, + Related_Nod, + Excludes_Null => Null_Exclusion_Present (Parent (Obj_Def))); end if; return T; @@ -19844,7 +20113,9 @@ package body Sem_Ch3 is -- Start of processing for Is_Visible_Component begin - if Ekind (C) in E_Component | E_Discriminant then + if Ekind (C) in E_Component | E_Discriminant + and then Is_Not_Self_Hidden (C) + then Original_Comp := Original_Record_Component (C); end if; @@ -20339,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; @@ -20983,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 @@ -21258,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); @@ -22509,10 +22781,12 @@ package body Sem_Ch3 is --------------------- function Process_Subtype - (S : Node_Id; - Related_Nod : Node_Id; - Related_Id : Entity_Id := Empty; - Suffix : Character := ' ') return Entity_Id + (S : Node_Id; + Related_Nod : Node_Id; + Related_Id : Entity_Id := Empty; + Suffix : Character := ' '; + Excludes_Null : Boolean := False; + Incomplete_Type_OK : Boolean := False) return Entity_Id is procedure Check_Incomplete (T : Node_Id); -- Called to verify that an incomplete type is not used prematurely @@ -22526,13 +22800,7 @@ package body Sem_Ch3 is -- Ada 2005 (AI-412): Incomplete subtypes are legal if Ekind (Root_Type (Entity (T))) = E_Incomplete_Type - and then - not (Ada_Version >= Ada_2005 - and then - (Nkind (Parent (T)) = N_Subtype_Declaration - or else (Nkind (Parent (T)) = N_Subtype_Indication - and then Nkind (Parent (Parent (T))) = - N_Subtype_Declaration))) + and then not Incomplete_Type_OK then Error_Msg_N ("invalid use of type before its full declaration", T); end if; @@ -22540,126 +22808,91 @@ package body Sem_Ch3 is -- Local variables - P : Node_Id; + P : constant Node_Id := Parent (S); + Mark : Node_Id; Def_Id : Entity_Id; Error_Node : Node_Id; Full_View_Id : Entity_Id; Subtype_Mark_Id : Entity_Id; - May_Have_Null_Exclusion : Boolean; - -- Start of processing for Process_Subtype begin - -- Case of no constraints present - - if Nkind (S) /= N_Subtype_Indication then - Find_Type (S); - - -- No way to proceed if the subtype indication is malformed. This - -- will happen for example when the subtype indication in an object - -- declaration is missing altogether and the expression is analyzed - -- as if it were that indication. - - if not Is_Entity_Name (S) then - return Any_Type; - end if; + if Nkind (S) = N_Subtype_Indication then + Mark := Subtype_Mark (S); + else + Mark := S; + end if; - Check_Incomplete (S); - P := Parent (S); + Find_Type (Mark); - -- The following mirroring of assertion in Null_Exclusion_Present is - -- ugly, can't we have a range, a static predicate or even a flag??? + -- No way to proceed if the subtype indication is malformed. This will + -- happen for example when the subtype indication in an object + -- declaration is missing altogether and the expression is analyzed as + -- if it were that indication. - May_Have_Null_Exclusion := - Present (P) - and then - Nkind (P) in N_Access_Definition - | N_Access_Function_Definition - | N_Access_Procedure_Definition - | N_Access_To_Object_Definition - | N_Allocator - | N_Component_Definition - | N_Derived_Type_Definition - | N_Discriminant_Specification - | N_Formal_Object_Declaration - | N_Function_Specification - | N_Object_Declaration - | N_Object_Renaming_Declaration - | N_Parameter_Specification - | N_Subtype_Declaration; - - -- Ada 2005 (AI-231): Static check + if not Is_Entity_Name (Mark) then + return Any_Type; + end if; - if Ada_Version >= Ada_2005 - and then May_Have_Null_Exclusion - and then Null_Exclusion_Present (P) - and then Nkind (P) /= N_Access_To_Object_Definition - and then not Is_Access_Type (Entity (S)) - then - Error_Msg_N ("`NOT NULL` only allowed for an access type", S); - end if; + Check_Incomplete (Mark); - -- Create an Itype that is a duplicate of Entity (S) but with the - -- null-exclusion attribute. + -- Case of no constraints present - if May_Have_Null_Exclusion - and then Is_Access_Type (Entity (S)) - and then Null_Exclusion_Present (P) + if Nkind (S) /= N_Subtype_Indication then + if Excludes_Null then + -- Create an Itype that is a duplicate of Entity (S) but with the + -- null-exclusion attribute. + if Is_Access_Type (Entity (S)) then + if Can_Never_Be_Null (Entity (S)) then + case Nkind (Related_Nod) is + when N_Full_Type_Declaration => + if Nkind (Type_Definition (Related_Nod)) + in N_Array_Type_Definition + then + Error_Node := + Subtype_Indication + (Component_Definition + (Type_Definition (Related_Nod))); + else + Error_Node := + Subtype_Indication + (Type_Definition (Related_Nod)); + end if; - -- No need to check the case of an access to object definition. - -- It is correct to define double not-null pointers. + when N_Subtype_Declaration => + Error_Node := Subtype_Indication (Related_Nod); - -- Example: - -- type Not_Null_Int_Ptr is not null access Integer; - -- type Acc is not null access Not_Null_Int_Ptr; + when N_Object_Declaration => + Error_Node := Object_Definition (Related_Nod); - and then Nkind (P) /= N_Access_To_Object_Definition - then - if Can_Never_Be_Null (Entity (S)) then - case Nkind (Related_Nod) is - when N_Full_Type_Declaration => - if Nkind (Type_Definition (Related_Nod)) - in N_Array_Type_Definition - then + when N_Component_Declaration => Error_Node := Subtype_Indication - (Component_Definition - (Type_Definition (Related_Nod))); - else - Error_Node := - Subtype_Indication (Type_Definition (Related_Nod)); - end if; - - when N_Subtype_Declaration => - Error_Node := Subtype_Indication (Related_Nod); + (Component_Definition (Related_Nod)); - when N_Object_Declaration => - Error_Node := Object_Definition (Related_Nod); + when N_Allocator => + Error_Node := Expression (Related_Nod); - when N_Component_Declaration => - Error_Node := - Subtype_Indication (Component_Definition (Related_Nod)); + when others => + pragma Assert (False); + Error_Node := Related_Nod; + end case; - when N_Allocator => - Error_Node := Expression (Related_Nod); - - when others => - pragma Assert (False); - Error_Node := Related_Nod; - end case; + Error_Msg_NE + ("`NOT NULL` not allowed (& already excludes null)", + Error_Node, + Entity (S)); + end if; - Error_Msg_NE - ("`NOT NULL` not allowed (& already excludes null)", - Error_Node, - Entity (S)); + Set_Etype + (S, + Create_Null_Excluding_Itype + (T => Entity (S), Related_Nod => P)); + Set_Entity (S, Etype (S)); + elsif Ada_Version >= Ada_2005 then + Error_Msg_N ("`NOT NULL` only allowed for an access type", S); end if; - - Set_Etype (S, - Create_Null_Excluding_Itype - (T => Entity (S), - Related_Nod => P)); - Set_Entity (S, Etype (S)); end if; return Entity (S); @@ -22668,18 +22901,7 @@ package body Sem_Ch3 is -- node (this node is created only if constraints are present). else - Find_Type (Subtype_Mark (S)); - - if Nkind (Parent (S)) /= N_Access_To_Object_Definition - and then not - (Nkind (Parent (S)) = N_Subtype_Declaration - and then Is_Itype (Defining_Identifier (Parent (S)))) - then - Check_Incomplete (Subtype_Mark (S)); - end if; - - P := Parent (S); - Subtype_Mark_Id := Entity (Subtype_Mark (S)); + Subtype_Mark_Id := Entity (Mark); -- Explicit subtype declaration case @@ -22699,8 +22921,7 @@ package body Sem_Ch3 is -- has not yet been called to create Def_Id. else - if Is_Array_Type (Subtype_Mark_Id) - or else Is_Concurrent_Type (Subtype_Mark_Id) + if Is_Concurrent_Type (Subtype_Mark_Id) or else Is_Access_Type (Subtype_Mark_Id) then Def_Id := Empty; @@ -22733,7 +22954,14 @@ package body Sem_Ch3 is -- Make recursive call, having got rid of the bogus constraint - return Process_Subtype (S, Related_Nod, Related_Id, Suffix); + return + Process_Subtype + (S, + Related_Nod, + Related_Id, + Suffix, + Excludes_Null, + Incomplete_Type_OK); end if; -- Remaining processing depends on type. Select on Base_Type kind to @@ -22753,6 +22981,8 @@ package body Sem_Ch3 is Error_Msg_N ("constraint on class-wide type ignored??", Constraint (S)); + else + pragma Assert (False); end if; if Nkind (P) = N_Subtype_Declaration then @@ -22881,8 +23111,8 @@ package body Sem_Ch3 is -- Size, Alignment, Representation aspects and Convention are always -- inherited from the base type. - Set_Size_Info (Def_Id, (Subtype_Mark_Id)); - Set_Rep_Info (Def_Id, (Subtype_Mark_Id)); + Set_Size_Info (Def_Id, Subtype_Mark_Id); + Set_Rep_Info (Def_Id, Subtype_Mark_Id); Set_Convention (Def_Id, Convention (Subtype_Mark_Id)); -- The anonymous subtype created for the subtype indication @@ -23134,10 +23364,8 @@ package body Sem_Ch3 is Component := First_Entity (Current_Scope); while Present (Component) loop - if Ekind (Component) = E_Void - and then not Is_Itype (Component) + if Ekind (Component) = E_Component and then not Is_Itype (Component) then - Mutate_Ekind (Component, E_Component); Reinit_Component_Location (Component); Set_Is_Not_Self_Hidden (Component); end if; diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads index 00a6fa77..a97393d 100644 --- a/gcc/ada/sem_ch3.ads +++ b/gcc/ada/sem_ch3.ads @@ -301,10 +301,12 @@ package Sem_Ch3 is -- in this case the bounds are captured if necessary using this name. function Process_Subtype - (S : Node_Id; - Related_Nod : Node_Id; - Related_Id : Entity_Id := Empty; - Suffix : Character := ' ') return Entity_Id; + (S : Node_Id; + Related_Nod : Node_Id; + Related_Id : Entity_Id := Empty; + Suffix : Character := ' '; + Excludes_Null : Boolean := False; + Incomplete_Type_OK : Boolean := False) return Entity_Id; -- Process a subtype indication S and return corresponding entity. -- Related_Nod is the node where the potential generated implicit types -- will be inserted. The Related_Id and Suffix parameters are used to diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 9a1784f..ec48edd 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -728,7 +728,8 @@ package body Sem_Ch4 is end; end if; - Type_Id := Process_Subtype (E, N); + Type_Id := + Process_Subtype (E, N, Excludes_Null => Null_Exclusion_Present (N)); Acc_Type := Create_Itype (E_Allocator_Type, N); Set_Etype (Acc_Type, Acc_Type); Set_Directly_Designated_Type (Acc_Type, Type_Id); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 91321710..0ecc6d8 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -225,7 +225,10 @@ package body Sem_Ch6 is -- Create the declaration for an inequality operator that is implicitly -- created by a user-defined equality operator that yields a boolean. - procedure Set_Formal_Mode (Formal_Id : Entity_Id); + procedure Set_Formal_Mode + (Formal_Id : Entity_Id; + Spec : N_Parameter_Specification_Id; + Subp_Id : Entity_Id); -- Set proper Ekind to reflect formal mode (in, out, in out), and set -- miscellaneous other attributes. @@ -6463,249 +6466,6 @@ package body Sem_Ch6 is end if; end Check_Delayed_Subprogram; - ------------------------------------ - -- Check_Discriminant_Conformance -- - ------------------------------------ - - procedure Check_Discriminant_Conformance - (N : Node_Id; - Prev : Entity_Id; - Prev_Loc : Node_Id) - is - Old_Discr : Entity_Id := First_Discriminant (Prev); - New_Discr : Node_Id := First (Discriminant_Specifications (N)); - New_Discr_Id : Entity_Id; - New_Discr_Type : Entity_Id; - - procedure Conformance_Error (Msg : String; N : Node_Id); - -- Post error message for conformance error on given node. Two messages - -- are output. The first points to the previous declaration with a - -- general "no conformance" message. The second is the detailed reason, - -- supplied as Msg. The parameter N provide information for a possible - -- & insertion in the message. - - ----------------------- - -- Conformance_Error -- - ----------------------- - - procedure Conformance_Error (Msg : String; N : Node_Id) is - begin - Error_Msg_Sloc := Sloc (Prev_Loc); - Error_Msg_N -- CODEFIX - ("not fully conformant with declaration#!", N); - Error_Msg_NE (Msg, N, N); - end Conformance_Error; - - -- Start of processing for Check_Discriminant_Conformance - - begin - while Present (Old_Discr) and then Present (New_Discr) loop - New_Discr_Id := Defining_Identifier (New_Discr); - - -- The subtype mark of the discriminant on the full type has not - -- been analyzed so we do it here. For an access discriminant a new - -- type is created. - - if Nkind (Discriminant_Type (New_Discr)) = N_Access_Definition then - New_Discr_Type := - Access_Definition (N, Discriminant_Type (New_Discr)); - - else - Find_Type (Discriminant_Type (New_Discr)); - New_Discr_Type := Etype (Discriminant_Type (New_Discr)); - - -- Ada 2005: if the discriminant definition carries a null - -- exclusion, create an itype to check properly for consistency - -- with partial declaration. - - if Is_Access_Type (New_Discr_Type) - and then Null_Exclusion_Present (New_Discr) - then - New_Discr_Type := - Create_Null_Excluding_Itype - (T => New_Discr_Type, - Related_Nod => New_Discr, - Scope_Id => Current_Scope); - end if; - end if; - - if not Conforming_Types - (Etype (Old_Discr), New_Discr_Type, Fully_Conformant) - then - Conformance_Error ("type of & does not match!", New_Discr_Id); - return; - else - -- Treat the new discriminant as an occurrence of the old one, - -- for navigation purposes, and fill in some semantic - -- information, for completeness. - - Generate_Reference (Old_Discr, New_Discr_Id, 'r'); - Set_Etype (New_Discr_Id, Etype (Old_Discr)); - Set_Scope (New_Discr_Id, Scope (Old_Discr)); - end if; - - -- Names must match - - if Chars (Old_Discr) /= Chars (Defining_Identifier (New_Discr)) then - Conformance_Error ("name & does not match!", New_Discr_Id); - return; - end if; - - -- Default expressions must match - - declare - NewD : constant Boolean := - Present (Expression (New_Discr)); - OldD : constant Boolean := - Present (Expression (Parent (Old_Discr))); - - function Has_Tagged_Limited_Partial_View - (Typ : Entity_Id) return Boolean; - -- Returns True iff Typ has a tagged limited partial view. - - function Is_Derived_From_Immutably_Limited_Type - (Typ : Entity_Id) return Boolean; - -- Returns True iff Typ is a derived type (tagged or not) - -- whose ancestor type is immutably limited. The unusual - -- ("unusual" is one word for it) thing about this function - -- is that it handles the case where the ancestor name's Entity - -- attribute has not been set yet. - - ------------------------------------- - -- Has_Tagged_Limited_Partial_View -- - ------------------------------------- - - function Has_Tagged_Limited_Partial_View - (Typ : Entity_Id) return Boolean - is - Priv : constant Entity_Id := Incomplete_Or_Partial_View (Typ); - begin - return Present (Priv) - and then not Is_Incomplete_Type (Priv) - and then Is_Tagged_Type (Priv) - and then Limited_Present (Parent (Priv)); - end Has_Tagged_Limited_Partial_View; - - -------------------------------------------- - -- Is_Derived_From_Immutably_Limited_Type -- - -------------------------------------------- - - function Is_Derived_From_Immutably_Limited_Type - (Typ : Entity_Id) return Boolean - is - Type_Def : constant Node_Id := Type_Definition (Parent (Typ)); - Parent_Name : Node_Id; - begin - if Nkind (Type_Def) /= N_Derived_Type_Definition then - return False; - end if; - Parent_Name := Subtype_Indication (Type_Def); - if Nkind (Parent_Name) = N_Subtype_Indication then - Parent_Name := Subtype_Mark (Parent_Name); - end if; - if Parent_Name not in N_Has_Entity_Id - or else No (Entity (Parent_Name)) - then - Find_Type (Parent_Name); - end if; - return Is_Immutably_Limited_Type (Entity (Parent_Name)); - end Is_Derived_From_Immutably_Limited_Type; - - begin - if NewD or OldD then - - -- The old default value has been analyzed and expanded, - -- because the current full declaration will have frozen - -- everything before. The new default values have not been - -- expanded, so expand now to check conformance. - - if NewD then - Preanalyze_And_Resolve_Spec_Expression - (Expression (New_Discr), New_Discr_Type); - end if; - - if not (NewD and OldD) - or else not Fully_Conformant_Expressions - (Expression (Parent (Old_Discr)), - Expression (New_Discr)) - - then - Conformance_Error - ("default expression for & does not match!", - New_Discr_Id); - return; - end if; - - if NewD - and then Ada_Version >= Ada_2005 - and then Nkind (Discriminant_Type (New_Discr)) = - N_Access_Definition - and then not Is_Immutably_Limited_Type - (Defining_Identifier (N)) - - -- Check for a case that would be awkward to handle in - -- Is_Immutably_Limited_Type (because sem_aux can't - -- "with" sem_util). - - and then not Has_Tagged_Limited_Partial_View - (Defining_Identifier (N)) - - -- Check for another case that would be awkward to handle - -- in Is_Immutably_Limited_Type - - and then not Is_Derived_From_Immutably_Limited_Type - (Defining_Identifier (N)) - then - Error_Msg_N - ("(Ada 2005) default value for access discriminant " - & "requires immutably limited type", - Expression (New_Discr)); - return; - end if; - end if; - end; - - -- In Ada 83 case, grouping must match: (A,B : X) /= (A : X; B : X) - - if Ada_Version = Ada_83 then - declare - Old_Disc : constant Node_Id := Declaration_Node (Old_Discr); - - begin - -- Grouping (use of comma in param lists) must be the same - -- This is where we catch a misconformance like: - - -- A, B : Integer - -- A : Integer; B : Integer - - -- which are represented identically in the tree except - -- for the setting of the flags More_Ids and Prev_Ids. - - if More_Ids (Old_Disc) /= More_Ids (New_Discr) - or else Prev_Ids (Old_Disc) /= Prev_Ids (New_Discr) - then - Conformance_Error - ("grouping of & does not match!", New_Discr_Id); - return; - end if; - end; - end if; - - Next_Discriminant (Old_Discr); - Next (New_Discr); - end loop; - - if Present (Old_Discr) then - Conformance_Error ("too few discriminants!", Defining_Identifier (N)); - return; - - elsif Present (New_Discr) then - Conformance_Error - ("too many discriminants!", Defining_Identifier (New_Discr)); - return; - end if; - end Check_Discriminant_Conformance; - ----------------------------------------- -- Check_Formal_Subprogram_Conformance -- ----------------------------------------- @@ -13066,13 +12826,10 @@ package body Sem_Ch6 is -- Start of processing for Process_Formals begin - -- In order to prevent premature use of the formals in the same formal - -- part, the Ekind is left undefined until all default expressions are - -- analyzed. The Ekind is established in a separate loop at the end. - Param_Spec := First (T); while Present (Param_Spec) loop Formal := Defining_Identifier (Param_Spec); + Set_Formal_Mode (Formal, Param_Spec, Current_Scope); Set_Never_Set_In_Source (Formal, True); Enter_Name (Formal); @@ -13390,12 +13147,48 @@ package body Sem_Ch6 is Analyze_Return_Type (Related_Nod); end if; - -- Now set the kind (mode) of each formal - Param_Spec := First (T); while Present (Param_Spec) loop Formal := Defining_Identifier (Param_Spec); - Set_Formal_Mode (Formal); + Set_Is_Not_Self_Hidden (Formal); + + -- Set Is_Known_Non_Null for access parameters since the language + -- guarantees that access parameters are always non-null. We also set + -- Can_Never_Be_Null, since there is no way to change the value. + + if Nkind (Parameter_Type (Param_Spec)) = N_Access_Definition then + + -- Ada 2005 (AI-231): In Ada 95, access parameters are always non- + -- null; In Ada 2005, only if then null_exclusion is explicit. + + if Ada_Version < Ada_2005 + or else Can_Never_Be_Null (Etype (Formal)) + then + Set_Is_Known_Non_Null (Formal); + Set_Can_Never_Be_Null (Formal); + end if; + + -- Ada 2005 (AI-231): Null-exclusion access subtype + + elsif Is_Access_Type (Etype (Formal)) + and then Can_Never_Be_Null (Etype (Formal)) + then + Set_Is_Known_Non_Null (Formal); + + -- We can also set Can_Never_Be_Null (thus preventing some junk + -- access checks) for the case of an IN parameter, which cannot + -- be changed, or for an IN OUT parameter, which can be changed + -- but not to a null value. But for an OUT parameter, the initial + -- value passed in can be null, so we can't set this flag in that + -- case. + + if Ekind (Formal) /= E_Out_Parameter then + Set_Can_Never_Be_Null (Formal); + end if; + end if; + + Set_Mechanism (Formal, Default_Mechanism); + Set_Formal_Validity (Formal); if Ekind (Formal) = E_In_Parameter then Default := Expression (Param_Spec); @@ -13666,23 +13459,23 @@ package body Sem_Ch6 is -- Set_Formal_Mode -- --------------------- - procedure Set_Formal_Mode (Formal_Id : Entity_Id) is - Spec : constant Node_Id := Parent (Formal_Id); - Id : constant Entity_Id := Scope (Formal_Id); - + procedure Set_Formal_Mode + (Formal_Id : Entity_Id; + Spec : N_Parameter_Specification_Id; + Subp_Id : Entity_Id) is begin -- Note: we set Is_Known_Valid for IN parameters and IN OUT parameters -- since we ensure that corresponding actuals are always valid at the -- point of the call. if Out_Present (Spec) then - if Is_Entry (Id) - or else Is_Subprogram_Or_Generic_Subprogram (Id) + if Is_Entry (Subp_Id) + or else Is_Subprogram_Or_Generic_Subprogram (Subp_Id) then - Set_Has_Out_Or_In_Out_Parameter (Id, True); + Set_Has_Out_Or_In_Out_Parameter (Subp_Id, True); end if; - if Ekind (Id) in E_Function | E_Generic_Function then + if Ekind (Subp_Id) in E_Function | E_Generic_Function then -- [IN] OUT parameters allowed for functions in Ada 2012 @@ -13719,45 +13512,6 @@ package body Sem_Ch6 is else Mutate_Ekind (Formal_Id, E_In_Parameter); end if; - - Set_Is_Not_Self_Hidden (Formal_Id); - - -- Set Is_Known_Non_Null for access parameters since the language - -- guarantees that access parameters are always non-null. We also set - -- Can_Never_Be_Null, since there is no way to change the value. - - if Nkind (Parameter_Type (Spec)) = N_Access_Definition then - - -- Ada 2005 (AI-231): In Ada 95, access parameters are always non- - -- null; In Ada 2005, only if then null_exclusion is explicit. - - if Ada_Version < Ada_2005 - or else Can_Never_Be_Null (Etype (Formal_Id)) - then - Set_Is_Known_Non_Null (Formal_Id); - Set_Can_Never_Be_Null (Formal_Id); - end if; - - -- Ada 2005 (AI-231): Null-exclusion access subtype - - elsif Is_Access_Type (Etype (Formal_Id)) - and then Can_Never_Be_Null (Etype (Formal_Id)) - then - Set_Is_Known_Non_Null (Formal_Id); - - -- We can also set Can_Never_Be_Null (thus preventing some junk - -- access checks) for the case of an IN parameter, which cannot - -- be changed, or for an IN OUT parameter, which can be changed but - -- not to a null value. But for an OUT parameter, the initial value - -- passed in can be null, so we can't set this flag in that case. - - if Ekind (Formal_Id) /= E_Out_Parameter then - Set_Can_Never_Be_Null (Formal_Id); - end if; - end if; - - Set_Mechanism (Formal_Id, Default_Mechanism); - Set_Formal_Validity (Formal_Id); end Set_Formal_Mode; ------------------------- diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads index bd4b730..1a78c27 100644 --- a/gcc/ada/sem_ch6.ads +++ b/gcc/ada/sem_ch6.ads @@ -68,15 +68,6 @@ package Sem_Ch6 is -- type in its profile depends on a private type without a full -- declaration, indicate that the subprogram or type is delayed. - procedure Check_Discriminant_Conformance - (N : Node_Id; - Prev : Entity_Id; - Prev_Loc : Node_Id); - -- Check that the discriminants of a full type N fully conform to the - -- discriminants of the corresponding partial view Prev. Prev_Loc indicates - -- the source location of the partial view, which may be different than - -- Prev in the case of private types. - procedure Check_Formal_Subprogram_Conformance (New_Id : Entity_Id; Old_Id : Entity_Id; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index fe93288..db892d0 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -8404,7 +8404,8 @@ package body Sem_Ch8 is if Is_Overloaded (P) then - -- The prefix must resolve to a unique enclosing construct + -- The prefix must resolve to a unique enclosing construct, per + -- the last sentence of RM 4.1.3 (13). declare Found : Boolean := False; @@ -8418,6 +8419,7 @@ package body Sem_Ch8 is if Found then Error_Msg_N ( "prefix must be unique enclosing scope", N); + Change_Selected_Component_To_Expanded_Name (N); Set_Entity (N, Any_Id); Set_Etype (N, Any_Type); return; 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_prag.adb b/gcc/ada/sem_prag.adb index 4090d0c..2fc3698 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -8087,10 +8087,26 @@ package body Sem_Prag is -- the test below also permits use in a configuration pragma file. function Is_Configuration_Pragma return Boolean is + function Is_Pragma_Node (Prg : Node_Id) return Boolean is + (Nkind (Prg) = N_Pragma + or else + (Present (Original_Node (Prg)) + and then Nkind (Original_Node (Prg)) = N_Pragma)); + -- Returns true whether the node is a pragma or was originally a + -- pragma. + -- + -- Note that some pragmas like Assertion_Policy are rewritten as + -- Null_Statment nodes but we still need to make sure here that the + -- original node was a pragma node. + + -- Local variables + Lis : List_Id; Par : constant Node_Id := Parent (N); Prg : Node_Id; + -- Start of processing for Is_Configuration_Pragma + begin -- Don't evaluate List_Containing (N) if Parent (N) could be -- an N_Aspect_Specification node. @@ -8119,7 +8135,7 @@ package body Sem_Prag is loop if Prg = N then return True; - elsif Nkind (Prg) /= N_Pragma then + elsif not Is_Pragma_Node (Prg) then return False; end if; @@ -14677,19 +14693,18 @@ package body Sem_Prag is D := Declaration_Node (E); - if (Nkind (D) = N_Full_Type_Declaration and then Is_Array_Type (E)) + if (Nkind (D) in N_Full_Type_Declaration + | N_Formal_Type_Declaration + and then Is_Array_Type (E)) or else (Nkind (D) = N_Object_Declaration and then Ekind (E) in E_Constant | E_Variable and then Nkind (Object_Definition (D)) = N_Constrained_Array_Definition) - or else - (Ada_Version >= Ada_2022 - and then Nkind (D) = N_Formal_Type_Declaration) then -- The flag is set on the base type, or on the object - if Nkind (D) = N_Full_Type_Declaration then + if Is_Array_Type (E) then E := Base_Type (E); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 0ce9e95..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; @@ -8082,20 +8086,7 @@ package body Sem_Util is -- If we fall through, declaration is OK, at least OK enough to continue - -- If Def_Id is a discriminant or a record component we are in the midst - -- of inheriting components in a derived record definition. Preserve - -- their Ekind and Etype. - - if Ekind (Def_Id) in E_Discriminant | E_Component then - null; - - -- If a type is already set, leave it alone (happens when a type - -- declaration is reanalyzed following a call to the optimizer). - - elsif Present (Etype (Def_Id)) then - null; - - else + if No (Etype (Def_Id)) then Set_Etype (Def_Id, Any_Type); -- avoid cascaded errors end if; @@ -8923,9 +8914,10 @@ package body Sem_Util is -------------------------- procedure Find_Overlaid_Entity - (N : Node_Id; - Ent : out Entity_Id; - Off : out Boolean) + (N : Node_Id; + Ent : out Entity_Id; + Ovrl_Typ : out Entity_Id; + Off : out Boolean) is pragma Assert (Nkind (N) = N_Attribute_Definition_Clause @@ -8947,8 +8939,9 @@ package body Sem_Util is -- In the second case, the expr is either Y'Address, or recursively a -- constant that eventually references Y'Address. - Ent := Empty; - Off := False; + Ent := Empty; + Ovrl_Typ := Empty; + Off := False; Expr := Expression (N); @@ -8978,6 +8971,8 @@ package body Sem_Util is end if; end loop; + Ovrl_Typ := Etype (Expr); + -- This loop checks the form of the prefix for an entity, using -- recursion to deal with intermediate components. @@ -8996,8 +8991,10 @@ package body Sem_Util is pragma Assert (not Expander_Active and then Is_Concurrent_Type (Scope (Ent))); - Ent := Empty; + Ent := Empty; + Ovrl_Typ := Empty; end if; + return; -- Check for components @@ -18382,6 +18379,7 @@ package body Sem_Util is case Nkind (N) is when N_Indexed_Component + | N_Selected_Component | N_Slice => return @@ -18393,13 +18391,6 @@ package body Sem_Util is when N_Attribute_Reference => return Attribute_Name (N) in Name_Input | Name_Old | Name_Result; - when N_Selected_Component => - return - Is_Name_Reference (Selector_Name (N)) - and then - (Is_Name_Reference (Prefix (N)) - or else Is_Access_Type (Etype (Prefix (N)))); - when N_Explicit_Dereference => return True; @@ -21907,7 +21898,7 @@ package body Sem_Util is Set_Last_Assignment (Ent, Empty); end if; - if Is_Object (Ent) then + if Is_Object (Ent) and then Ekind (Ent) not in Record_Field_Kind then if not Last_Assignment_Only then Kill_Checks (Ent); Set_Current_Value (Ent, Empty); @@ -25593,16 +25584,18 @@ package body Sem_Util is if Sure and then Modification_Comes_From_Source + and then Ekind (Ent) in E_Constant | E_Variable and then Overlays_Constant (Ent) and then Address_Clause_Overlay_Warnings then declare Addr : constant Node_Id := Address_Clause (Ent); O_Ent : Entity_Id; + O_Typ : Entity_Id; Off : Boolean; begin - Find_Overlaid_Entity (Addr, O_Ent, Off); + Find_Overlaid_Entity (Addr, O_Ent, O_Typ, Off); Error_Msg_Sloc := Sloc (Addr); Error_Msg_NE @@ -28522,12 +28515,6 @@ package body Sem_Util is return False; end if; - if Ekind (Entity (Selector_Name (N))) not in - E_Component | E_Discriminant - then - return False; - end if; - declare Comp : constant Entity_Id := Original_Record_Component (Entity (Selector_Name (N))); @@ -29050,9 +29037,10 @@ package body Sem_Util is ------------------------------ function Ultimate_Overlaid_Entity (E : Entity_Id) return Entity_Id is - Address : Node_Id; - Alias : Entity_Id := E; - Offset : Boolean; + Address : Node_Id; + Alias : Entity_Id := E; + Offset : Boolean; + Ovrl_Typ : Entity_Id; begin -- Currently this routine is only called for stand-alone objects that @@ -29064,7 +29052,7 @@ package body Sem_Util is loop Address := Address_Clause (Alias); if Present (Address) then - Find_Overlaid_Entity (Address, Alias, Offset); + Find_Overlaid_Entity (Address, Alias, Ovrl_Typ, Offset); if Present (Alias) then null; else diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 38e9676..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; @@ -619,7 +619,21 @@ package Sem_Util is -- Find whether there is a previous definition for name or identifier N in -- the current scope. Because declarations for a scope are not necessarily -- contiguous (e.g. for packages) the first entry on the visibility chain - -- for N is not necessarily in the current scope. + -- for N is not necessarily in the current scope. Take, for example: + -- + -- package P is + -- X : constant := 13; + -- + -- package Q is + -- X : constant := 67; + -- end Q; + -- + -- Y : constant := X; + -- end P; + -- + -- When the declaration of Y is analyzed, the first entry on the visibility + -- chain is the X equal to 67, but Current_Entity_In_Scope returns the X + -- equal to 13. function Current_Scope return Entity_Id; -- Get entity representing current scope @@ -884,14 +898,18 @@ package Sem_Util is -- loop are nested within the block. procedure Find_Overlaid_Entity - (N : Node_Id; - Ent : out Entity_Id; - Off : out Boolean); + (N : Node_Id; + Ent : out Entity_Id; + Ovrl_Typ : out Entity_Id; + Off : out Boolean); -- The node N should be an address representation clause. Determines if the -- target expression is the address of an entity with an optional offset. -- If so, set Ent to the entity and, if there is an offset, set Off to -- True, otherwise to False. If it is not possible to determine that the -- address is of this form, then set Ent to Empty. + -- Ovrl_Typ is set to the type being overlaid and can be different than the + -- type of Ent, for example when the address clause is applied to a record + -- component or to an element of an array. function Find_Parameter_Type (Param : Node_Id) return Entity_Id; -- Return the type of formal parameter Param as determined by its 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 302a89b..59470fd 100644 --- a/gcc/ada/vast.adb +++ b/gcc/ada/vast.adb @@ -23,18 +23,598 @@ -- -- ------------------------------------------------------------------------------ --- Dummy implementation +pragma Unsuppress (All_Checks); +pragma Assertion_Policy (Check); +-- Enable checking. This isn't really necessary, but it might come in handy if +-- we want to run VAST with a compiler built without checks. Anyway, it's +-- harmless, because VAST is not run by default. + +with Ada.Unchecked_Deallocation; + +with System.Case_Util; + +with Atree; use Atree; +with Debug; +with Einfo.Entities; use Einfo.Entities; +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, + -- 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 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. 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_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; + ---------------- - -- Check_Tree -- + -- Leave_Node -- ---------------- - procedure Check_Tree (GNAT_Root : Node_Id) is - pragma Unreferenced (GNAT_Root); + 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 -- + ------------ + + VAST_Failure : exception; + + procedure Assert + (Condition : Boolean; + Check : Check_Enum := Check_Other; + Detail : String := "") + is begin - null; - end Check_Tree; + if not Condition then + declare + Part1 : constant String := "VAST fail"; + Part2 : constant String := + (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 + 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_Tree -- + ------------- + + procedure Do_Tree (N : Node_Id) is + begin + 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 => + Assert (False); + + when N_Error => + -- VAST doesn't do anything when Serious_Errors_Detected > 0 (at + -- least for now), so we shouldn't encounter any N_Error nodes. + Assert (False, Check_Error_Nodes); + + when N_Entity => + case Ekind (N) is + when others => + null; -- more to be done here + end case; + + when others => + null; -- more to be done here + end case; + + -- Check that N has a Parent, except in certain cases: + + case Nkind (N) is + when N_Empty => + raise Program_Error; -- can't get here + + 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 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 + if Status (Check_Parent_Present) = Enabled then + Assert (Parent (N) = Ancestor_Node (1), Check_Parent_Correct); + end if; + end case; + + 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 -- + ------------- + + procedure Do_Unit (U : Unit_Number_Type) is + U_Name : constant Unit_Name_Type := Unit_Name (U); + U_Name_S : constant String := + (if U_Name = No_Unit_Name then "<No_Unit_Name>" + else Get_Name_String (U_Name)); + Predef : constant String := + (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 & Is_Main; + + Is_Preprocessing_Dependency : constant Boolean := + U_Name = No_Unit_Name; + -- True if this is a bogus unit added by Add_Preprocessing_Dependency. + -- ???Not sure what that's about, but these units have no name and + -- no associated tree, so we had better not try to walk those trees. + + 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. + + Put_Line (Msg); + + if Is_Preprocessing_Dependency then + Put_Line ("Skipping preprocessing dependency"); + return; + end if; + + Assert (Present (Root)); + Do_Tree (Root); + Put_Line (Msg & " (done)"); + pragma Assert (Node_Stack.Last = 0); + end Do_Unit; + + ---------- + -- VAST -- + ---------- + + procedure VAST is + pragma Assert (Expander_Active = (Operating_Mode = Generate_Code)); + -- ???So why do we need both Operating_Mode and Expander_Active? + use Debug; + begin + -- Do nothing if we're not calling the back end; the main point of VAST + -- is to protect against code-generation bugs. This includes the + -- case where legality errors were detected; the tree is known to be + -- malformed in some error cases. + + if Operating_Mode /= Generate_Code then + return; + end if; + + -- If -gnatd_W (VAST in verbose mode) is enabled, then that should imply + -- -gnatd_V (enable VAST). + + if Debug_Flag_Underscore_WW then + Debug_Flag_Underscore_VV := True; + end if; + + -- Do nothing if VAST is disabled + + if not (Debug_Flag_Underscore_VV or Force_Enable_VAST) then + return; + end if; + + -- Turn off output unless verbose mode is enabled + + Put_Line ("VAST"); + + -- Operating_Mode = Generate_Code implies there are no legality errors: + + Assert (Serious_Errors_Detected = 0); + + 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; + + Put_Line ("VAST done."); + end VAST; end VAST; diff --git a/gcc/ada/vast.ads b/gcc/ada/vast.ads index 031ea21..faecd9a 100644 --- a/gcc/ada/vast.ads +++ b/gcc/ada/vast.ads @@ -24,13 +24,10 @@ ------------------------------------------------------------------------------ -- This package is the entry point for VAST: Verifier for the Ada Semantic --- Tree. - -with Types; use Types; +-- Tree. It walks the expanded trees, and verifies their validity. package VAST is - procedure Check_Tree (GNAT_Root : Node_Id); - -- Check the validity of the given Root tree + procedure 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/builtins.cc b/gcc/builtins.cc index e818e81..3064bff 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -3529,7 +3529,8 @@ expand_builtin_strnlen (tree exp, rtx target, machine_mode target_mode) wide_int min, max; int_range_max r; - get_global_range_query ()->range_of_expr (r, bound); + get_range_query (cfun)->range_of_expr (r, bound, + currently_expanding_gimple_stmt); if (r.varying_p () || r.undefined_p ()) return NULL_RTX; min = r.lower_bound (); @@ -3604,7 +3605,8 @@ determine_block_size (tree len, rtx len_rtx, { int_range_max r; tree tmin, tmax; - get_global_range_query ()->range_of_expr (r, len); + gimple *cg = currently_expanding_gimple_stmt; + get_range_query (cfun)->range_of_expr (r, len, cg); range_type = get_legacy_range (r, tmin, tmax); if (range_type != VR_UNDEFINED) { 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 7f5b0b8..47f828f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,58 @@ +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 + * c-typeck.cc (remove_qualifiers): New function. + (composite_type_internal): Use it. + (comp_target_types): Use it. + (type_lists_compatible_p): Use it. + (find_anonymous_field_with_type): Use it. + (convert_to_anonymous_field): Use it. + (convert_for_assignment): Use it. + +2025-06-09 Martin Uecker <uecker@tugraz.at> + + PR c/120510 + * c-typeck.cc (composite_type_internal): Activate checking + assertion for arrays. + (common_pointer_type): Remove qualifiers also from arrays. + +2025-06-09 Martin Uecker <uecker@tugraz.at> + + PR c/120510 + * c-typeck.cc (composite_types_internal): Handle arrays + declared with atomic for function arguments. + 2025-06-03 Martin Uecker <uecker@tugraz.at> * c-typeck.cc (composite_type_internal,composite_type): Move 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 b59b5c8a..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. */ @@ -613,6 +614,17 @@ c_type_tag (const_tree t) return name; } +/* Remove qualifiers but not atomic. For arrays remove qualifiers + on the element type but also do not remove atomic. */ +static tree +remove_qualifiers (tree t) +{ + if (!t || t == error_mark_node) + return t; + return TYPE_ATOMIC (strip_array_types (t)) + ? c_build_qualified_type (TYPE_MAIN_VARIANT (t), TYPE_QUAL_ATOMIC) + : TYPE_MAIN_VARIANT (t); +} /* Return the composite type of two compatible types. @@ -910,15 +922,8 @@ composite_type_internal (tree t1, tree t2, struct composite_cache* cache) for (; p1 && p1 != void_list_node; p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n)) { - tree mv1 = TREE_VALUE (p1); - if (mv1 && mv1 != error_mark_node - && TREE_CODE (mv1) != ARRAY_TYPE) - mv1 = TYPE_MAIN_VARIANT (mv1); - - tree mv2 = TREE_VALUE (p2); - if (mv2 && mv2 != error_mark_node - && TREE_CODE (mv2) != ARRAY_TYPE) - mv2 = TYPE_MAIN_VARIANT (mv2); + tree mv1 = remove_qualifiers (TREE_VALUE (p1)); + tree mv2 = remove_qualifiers (TREE_VALUE (p2)); /* A null type means arg type is not specified. Take whatever the other function type has. */ @@ -998,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 and arrays there are some cases where qualifiers do - not match. See PR120510. */ - if (FUNCTION_TYPE != TREE_CODE (n) && ARRAY_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; } @@ -1020,9 +1023,6 @@ static tree common_pointer_type (tree t1, tree t2) { tree attributes; - tree pointed_to_1, mv1; - tree pointed_to_2, mv2; - tree target; unsigned target_quals; addr_space_t as1, as2, as_common; int quals1, quals2; @@ -1044,15 +1044,11 @@ common_pointer_type (tree t1, tree t2) attributes = targetm.merge_type_attributes (t1, t2); /* Find the composite type of the target types, and combine the - qualifiers of the two types' targets. Do not lose qualifiers on - array element types by taking the TYPE_MAIN_VARIANT. */ - mv1 = pointed_to_1 = TREE_TYPE (t1); - mv2 = pointed_to_2 = TREE_TYPE (t2); - if (TREE_CODE (mv1) != ARRAY_TYPE) - mv1 = TYPE_MAIN_VARIANT (pointed_to_1); - if (TREE_CODE (mv2) != ARRAY_TYPE) - mv2 = TYPE_MAIN_VARIANT (pointed_to_2); - target = composite_type (mv1, mv2); + qualifiers of the two types' targets. */ + tree pointed_to_1 = TREE_TYPE (t1); + tree pointed_to_2 = TREE_TYPE (t2); + tree target = composite_type (TYPE_MAIN_VARIANT (pointed_to_1), + TYPE_MAIN_VARIANT (pointed_to_2)); /* Strip array types to get correct qualifier for pointers to arrays */ quals1 = TYPE_QUALS_NO_ADDR_SPACE (strip_array_types (pointed_to_1)); @@ -1457,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 @@ -1596,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. */ @@ -1794,15 +1817,9 @@ comp_target_types (location_t location, tree ttl, tree ttr) val_ped = comptypes (mvl, mvr); /* Qualifiers on element types of array types that are - pointer targets are lost by taking their TYPE_MAIN_VARIANT. */ - - mvl = (TYPE_ATOMIC (strip_array_types (mvl)) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvl), TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mvl)); - - mvr = (TYPE_ATOMIC (strip_array_types (mvr)) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvr), TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mvr)); + pointer targets are also removed. */ + mvl = remove_qualifiers (mvl); + mvr = remove_qualifiers (mvr); enum_and_int_p = false; val = comptypes_check_enum_int (mvl, mvr, &enum_and_int_p); @@ -2025,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. */ @@ -2044,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; @@ -2060,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 @@ -2105,25 +2114,16 @@ type_lists_compatible_p (const_tree args1, const_tree args2, { while (1) { - tree a1, mv1, a2, mv2; if (args1 == NULL_TREE && args2 == NULL_TREE) return true; /* If one list is shorter than the other, they fail to match. */ if (args1 == NULL_TREE || args2 == NULL_TREE) - return 0; - mv1 = a1 = TREE_VALUE (args1); - mv2 = a2 = TREE_VALUE (args2); - if (mv1 && mv1 != error_mark_node && TREE_CODE (mv1) != ARRAY_TYPE) - mv1 = (TYPE_ATOMIC (mv1) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv1), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mv1)); - if (mv2 && mv2 != error_mark_node && TREE_CODE (mv2) != ARRAY_TYPE) - mv2 = (TYPE_ATOMIC (mv2) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv2), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mv2)); + return false; + tree a1 = TREE_VALUE (args1); + tree a2 = TREE_VALUE (args2); + tree mv1 = remove_qualifiers (a1); + tree mv2 = remove_qualifiers (a2); /* A null pointer instead of a type means there is supposed to be an argument but nothing is specified about what type it has. @@ -2133,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 @@ -2160,18 +2160,12 @@ type_lists_compatible_p (const_tree args1, const_tree args2, for (memb = TYPE_FIELDS (a1); memb; memb = DECL_CHAIN (memb)) { - tree mv3 = TREE_TYPE (memb); - if (mv3 && mv3 != error_mark_node - && TREE_CODE (mv3) != ARRAY_TYPE) - mv3 = (TYPE_ATOMIC (mv3) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mv3)); + tree mv3 = remove_qualifiers (TREE_TYPE (memb)); if (comptypes_internal (mv3, mv2, data)) break; } if (memb == NULL_TREE) - return 0; + return false; } else if (TREE_CODE (a2) == UNION_TYPE && (TYPE_NAME (a2) == NULL_TREE @@ -2184,21 +2178,15 @@ type_lists_compatible_p (const_tree args1, const_tree args2, for (memb = TYPE_FIELDS (a2); memb; memb = DECL_CHAIN (memb)) { - tree mv3 = TREE_TYPE (memb); - if (mv3 && mv3 != error_mark_node - && TREE_CODE (mv3) != ARRAY_TYPE) - mv3 = (TYPE_ATOMIC (mv3) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mv3)); + tree mv3 = remove_qualifiers (TREE_TYPE (memb)); if (comptypes_internal (mv3, mv1, data)) break; } if (memb == NULL_TREE) - return 0; + return false; } else - return 0; + return false; } args1 = TREE_CHAIN (args1); @@ -7482,10 +7470,7 @@ find_anonymous_field_with_type (tree struct_type, tree type) field != NULL_TREE; field = TREE_CHAIN (field)) { - tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field)) - ? c_build_qualified_type (TREE_TYPE (field), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (TREE_TYPE (field))); + tree fieldtype = remove_qualifiers (TREE_TYPE (field)); if (DECL_NAME (field) == NULL && comptypes (type, fieldtype)) { @@ -7523,10 +7508,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs) gcc_assert (RECORD_OR_UNION_TYPE_P (rhs_struct_type)); gcc_assert (POINTER_TYPE_P (type)); - lhs_main_type = (TYPE_ATOMIC (TREE_TYPE (type)) - ? c_build_qualified_type (TREE_TYPE (type), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (TREE_TYPE (type))); + lhs_main_type = remove_qualifiers (TREE_TYPE (type)); found_field = NULL_TREE; found_sub_field = false; @@ -7537,10 +7519,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs) if (DECL_NAME (field) != NULL_TREE || !RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))) continue; - tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field)) - ? c_build_qualified_type (TREE_TYPE (field), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (TREE_TYPE (field))); + tree fieldtype = remove_qualifiers (TREE_TYPE (field)); if (comptypes (lhs_main_type, fieldtype)) { if (found_field != NULL_TREE) @@ -8297,23 +8276,14 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, tree ttl = TREE_TYPE (type); tree ttr = TREE_TYPE (rhstype); - tree mvl = ttl; - tree mvr = ttr; bool is_opaque_pointer; bool target_cmp = false; /* Cache comp_target_types () result. */ addr_space_t asl; addr_space_t asr; - if (TREE_CODE (mvl) != ARRAY_TYPE) - mvl = (TYPE_ATOMIC (mvl) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvl), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mvl)); - if (TREE_CODE (mvr) != ARRAY_TYPE) - mvr = (TYPE_ATOMIC (mvr) - ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvr), - TYPE_QUAL_ATOMIC) - : TYPE_MAIN_VARIANT (mvr)); + tree mvl = remove_qualifiers (ttl); + tree mvr = remove_qualifiers (ttr); + /* Opaque pointers are treated like void pointers. */ is_opaque_pointer = vector_targets_convertible_p (ttl, ttr); diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 8919cc3..f288a54 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see #include "output.h" #include "builtins.h" #include "opts.h" +#include "gimple-range.h" /* Some systems use __main in a way incompatible with its use in gcc, in these cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to @@ -2771,6 +2772,10 @@ maybe_dump_rtl_for_gimple_stmt (gimple *stmt, rtx_insn *since) } } +/* Temporary storage for BB_HEAD and BB_END of bbs until they are converted + to BB_RTL. */ +static vec<std::pair <rtx_insn *, rtx_insn *>> head_end_for_bb; + /* Maps the blocks that do not contain tree labels to rtx labels. */ static hash_map<basic_block, rtx_code_label *> *lab_rtx_for_bb; @@ -2778,11 +2783,23 @@ static hash_map<basic_block, rtx_code_label *> *lab_rtx_for_bb; /* Returns the label_rtx expression for a label starting basic block BB. */ static rtx_code_label * -label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) +label_rtx_for_bb (basic_block bb) { if (bb->flags & BB_RTL) return block_label (bb); + if ((unsigned) bb->index < head_end_for_bb.length () + && head_end_for_bb[bb->index].first) + { + if (!LABEL_P (head_end_for_bb[bb->index].first)) + { + head_end_for_bb[bb->index].first + = emit_label_before (gen_label_rtx (), + head_end_for_bb[bb->index].first); + } + return as_a <rtx_code_label *> (head_end_for_bb[bb->index].first); + } + rtx_code_label **elt = lab_rtx_for_bb->get (bb); if (elt) return *elt; @@ -2801,6 +2818,19 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) } +/* Wrapper around remove_edge during expansion. */ + +void +expand_remove_edge (edge e) +{ + if (current_ir_type () != IR_GIMPLE + && (e->dest->flags & BB_RTL) == 0 + && !gimple_seq_empty_p (phi_nodes (e->dest))) + remove_phi_args (e); + remove_edge (e); +} + + /* A subroutine of expand_gimple_cond. Given E, a fallthrough edge of a basic block where we just expanded the conditional at the end, possibly clean up the CFG and instruction sequence. LAST is the @@ -2823,7 +2853,7 @@ maybe_cleanup_end_of_block (edge e, rtx_insn *last) if (BARRIER_P (get_last_insn ())) { rtx_insn *insn; - remove_edge (e); + expand_remove_edge (e); /* Now, we have a single successor block, if we have insns to insert on the remaining edge we potentially will insert it at the end of this block (if the dest block isn't feasible) @@ -2942,10 +2972,6 @@ expand_gimple_cond (basic_block bb, gcond *stmt) extract_true_false_edges_from_block (bb, &true_edge, &false_edge); set_curr_insn_location (gimple_location (stmt)); - /* These flags have no purpose in RTL land. */ - true_edge->flags &= ~EDGE_TRUE_VALUE; - false_edge->flags &= ~EDGE_FALSE_VALUE; - /* We can either have a pure conditional jump with one fallthru edge or two-way jump that needs to be decomposed into two basic blocks. */ if (false_edge->dest == bb->next_bb) @@ -2978,13 +3004,16 @@ expand_gimple_cond (basic_block bb, gcond *stmt) set_curr_insn_location (false_edge->goto_locus); emit_jump (label_rtx_for_bb (false_edge->dest)); - BB_END (bb) = last; - if (BARRIER_P (BB_END (bb))) - BB_END (bb) = PREV_INSN (BB_END (bb)); - update_bb_for_insn (bb); + head_end_for_bb[bb->index].second = last; + if (BARRIER_P (head_end_for_bb[bb->index].second)) + head_end_for_bb[bb->index].second + = PREV_INSN (head_end_for_bb[bb->index].second); + update_bb_for_insn_chain (head_end_for_bb[bb->index].first, + head_end_for_bb[bb->index].second, bb); new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb); dest = false_edge->dest; + unsigned int dest_idx = false_edge->dest_idx; redirect_edge_succ (false_edge, new_bb); false_edge->flags |= EDGE_FALLTHRU; new_bb->count = false_edge->count (); @@ -2993,7 +3022,19 @@ 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); + edge e = make_single_succ_edge (new_bb, dest, 0); + 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)); + } if (BARRIER_P (BB_END (new_bb))) BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); update_bb_for_insn (new_bb); @@ -4445,7 +4486,7 @@ expand_gimple_tailcall (basic_block bb, gcall *stmt, bool *can_fallthru) if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) e->dest->count -= e->count (); probability += e->probability; - remove_edge (e); + expand_remove_edge (e); } else ei_next (&ei); @@ -4473,8 +4514,9 @@ expand_gimple_tailcall (basic_block bb, gcall *stmt, bool *can_fallthru) e = make_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_ABNORMAL | EDGE_SIBCALL); e->probability = probability; - BB_END (bb) = last; - update_bb_for_insn (bb); + head_end_for_bb[bb->index].second = last; + update_bb_for_insn_chain (head_end_for_bb[bb->index].first, + head_end_for_bb[bb->index].second, bb); if (NEXT_INSN (last)) { @@ -6092,7 +6134,6 @@ static basic_block expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) { gimple_stmt_iterator gsi; - gimple_seq stmts; gimple *stmt = NULL; rtx_note *note = NULL; rtx_insn *last; @@ -6110,18 +6151,12 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) access the BB sequence directly. */ if (optimize) reorder_operands (bb); - stmts = bb_seq (bb); - bb->il.gimple.seq = NULL; - bb->il.gimple.phi_nodes = NULL; rtl_profile_for_bb (bb); - init_rtl_bb_info (bb); - bb->flags |= BB_RTL; /* Remove the RETURN_EXPR if we may fall though to the exit instead. */ - gsi = gsi_last (stmts); - if (!gsi_end_p (gsi) - && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN) + gsi = gsi_last_bb (bb); + if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN) { greturn *ret_stmt = as_a <greturn *> (gsi_stmt (gsi)); @@ -6136,7 +6171,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) } } - gsi = gsi_start (stmts); + gsi = gsi_start_bb (bb); if (!gsi_end_p (gsi)) { stmt = gsi_stmt (gsi); @@ -6145,6 +6180,8 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) } rtx_code_label **elt = lab_rtx_for_bb->get (bb); + if ((unsigned) bb->index >= head_end_for_bb.length ()) + head_end_for_bb.safe_grow_cleared (bb->index + 1); if (stmt || elt) { @@ -6160,16 +6197,18 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) if (elt) emit_label (*elt); - BB_HEAD (bb) = NEXT_INSN (last); - if (NOTE_P (BB_HEAD (bb))) - BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb)); - gcc_assert (LABEL_P (BB_HEAD (bb))); - note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb)); + head_end_for_bb[bb->index].first = NEXT_INSN (last); + if (NOTE_P (head_end_for_bb[bb->index].first)) + head_end_for_bb[bb->index].first + = NEXT_INSN (head_end_for_bb[bb->index].first); + gcc_assert (LABEL_P (head_end_for_bb[bb->index].first)); + note = emit_note_after (NOTE_INSN_BASIC_BLOCK, + head_end_for_bb[bb->index].first); maybe_dump_rtl_for_gimple_stmt (stmt, last); } else - BB_HEAD (bb) = note = emit_note (NOTE_INSN_BASIC_BLOCK); + head_end_for_bb[bb->index].first = note = emit_note (NOTE_INSN_BASIC_BLOCK); if (note) NOTE_BASIC_BLOCK (note) = bb; @@ -6485,9 +6524,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) last = PREV_INSN (PREV_INSN (last)); if (BARRIER_P (last)) last = PREV_INSN (last); - BB_END (bb) = last; + head_end_for_bb[bb->index].second = last; - update_bb_for_insn (bb); + update_bb_for_insn_chain (head_end_for_bb[bb->index].first, + head_end_for_bb[bb->index].second, bb); return bb; } @@ -7175,10 +7215,35 @@ pass_expand::execute (function *fun) >= param_max_debug_marker_count) cfun->debug_nonbind_markers = false; + enable_ranger (fun); lab_rtx_for_bb = new hash_map<basic_block, rtx_code_label *>; + head_end_for_bb.create (last_basic_block_for_fn (fun)); FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun), next_bb) bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX); + disable_ranger (fun); + FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR_FOR_FN (fun), + next_bb) + { + if ((bb->flags & BB_RTL) == 0) + { + bb->il.gimple.seq = NULL; + bb->il.gimple.phi_nodes = NULL; + init_rtl_bb_info (bb); + bb->flags |= BB_RTL; + BB_HEAD (bb) = head_end_for_bb[bb->index].first; + BB_END (bb) = head_end_for_bb[bb->index].second; + } + /* These flags have no purpose in RTL land. */ + if (EDGE_COUNT (bb->succs) == 2) + { + EDGE_SUCC (bb, 0)->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE); + EDGE_SUCC (bb, 1)->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE); + } + else if (single_succ_p (bb)) + single_succ_edge (bb)->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE); + } + head_end_for_bb.release (); if (MAY_HAVE_DEBUG_BIND_INSNS) expand_debug_locations (); diff --git a/gcc/cfgexpand.h b/gcc/cfgexpand.h index b738059..81ed273 100644 --- a/gcc/cfgexpand.h +++ b/gcc/cfgexpand.h @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see extern tree gimple_assign_rhs_to_tree (gimple *); extern HOST_WIDE_INT estimated_stack_frame_size (struct cgraph_node *); +extern void expand_remove_edge (edge); extern void set_parm_rtl (tree, rtx); diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc index 9add253..1b4f78a 100644 --- a/gcc/cfgrtl.cc +++ b/gcc/cfgrtl.cc @@ -538,7 +538,7 @@ emit_insn_at_entry (rtx insn) The insn chain range is inclusive (i.e. both BEGIN and END will be updated. */ -static void +void update_bb_for_insn_chain (rtx_insn *begin, rtx_insn *end, basic_block bb) { rtx_insn *insn; diff --git a/gcc/cfgrtl.h b/gcc/cfgrtl.h index cf12bbb..ab3bb96 100644 --- a/gcc/cfgrtl.h +++ b/gcc/cfgrtl.h @@ -28,6 +28,7 @@ extern basic_block create_basic_block_structure (rtx_insn *, rtx_insn *, extern void compute_bb_for_insn (void); extern void free_bb_for_insn (void); extern rtx_insn *entry_of_function (void); +extern void update_bb_for_insn_chain (rtx_insn *, rtx_insn *, basic_block); extern void update_bb_for_insn (basic_block); extern bool contains_no_active_insn_p (const_basic_block); extern bool forwarder_block_p (const_basic_block); diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 3f95ca1..93353cb 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -179,6 +179,128 @@ cgraph_node::function_version (void) return cgraph_fnver_htab->find (&key); } +/* 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::make_profile_global0 (profile_quality quality) +{ + 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 (); +} + +/* Scale profile by NUM/DEN. Walk into inlined functions. */ + +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 (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 * @@ -231,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; - - if (decl1_v == NULL) - decl1_v = decl1_node->insert_new_function_version (); + gcc_assert (decl_node != NULL); - if (decl2_v == NULL) - decl2_v = decl2_node->insert_new_function_version (); + decl_v = decl_node->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 8dbe36e..deca564 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1256,6 +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); + /* 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. */ @@ -1324,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/cobol/Make-lang.in b/gcc/cobol/Make-lang.in index 993e4c6..5f293e1 100644 --- a/gcc/cobol/Make-lang.in +++ b/gcc/cobol/Make-lang.in @@ -351,8 +351,7 @@ cobol.srcman: cobol.mostlyclean: cobol.clean: - rm -fr gcobol cobol1 cobol/* \ - ../*/libgcobol/* + rm -fr gcobol cobol1 cobol/* cobol.distclean: diff --git a/gcc/cobol/cdf.y b/gcc/cobol/cdf.y index 0440d02..e4d2fea 100644 --- a/gcc/cobol/cdf.y +++ b/gcc/cobol/cdf.y @@ -891,6 +891,7 @@ verify_integer( const YDFLTYPE& loc, const cdfval_base_t& val ) { return true; } +// cppcheck-suppress returnTempReference const cdfval_base_t& cdfval_base_t::operator()( const YDFLTYPE& loc ) { static cdfval_t zero(0); diff --git a/gcc/cobol/cdfval.h b/gcc/cobol/cdfval.h index 09c21ab..c4387b0 100644 --- a/gcc/cobol/cdfval.h +++ b/gcc/cobol/cdfval.h @@ -38,6 +38,14 @@ bool scanner_parsing(); +/* cdfval_base_t has no constructor because otherwise: + * cobol/cdf.h:172:7: note: ‘YDFSTYPE::YDFSTYPE()’ is implicitly deleted + * because the default definition would be ill-formed: + * 172 | union YDFSTYPE + * + * We use the derived type cdfval_t, which can be properly constructed and + * operated on, but tell Bison only about its POD base class. + */ struct YDFLTYPE; struct cdfval_base_t { bool off; diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1 index 0ce890e..6db5400 100644 --- a/gcc/cobol/gcobol.1 +++ b/gcc/cobol/gcobol.1 @@ -39,7 +39,7 @@ compiles \*[lang] source code to object code, and optionally produces an executable binary or shared object. As a GCC component, it accepts all options that affect code-generation and linking. Options specific to \*[lang] are listed below. -.Bl -tag -width \0\0debug +.Bl -tag -width "\0\0debug" .It Fl main Ar filename .Nm will generate a @@ -197,14 +197,12 @@ Otherwise, columns 1-6 are examined. If those characters are all digits or blanks, the file is assumed to be in .Em "fixed-form reference format", also with the indicator in column 7. - If not auto-detected as .Em "fixed-form reference format" or .Em "extended source format", the file is assumed to be in .Em "free-form reference format". - .Pp . .It Fl fcobol-exceptions Ar exception Op Ns , Ns Ar exception Ns ... @@ -1088,7 +1086,7 @@ the directive must appear before .Pp To test a feature-set variable, use .Dl >>IF Ar feature Li DEFINED -.. +. .Ss Copybooks .Nm supports the CDF @@ -1294,7 +1292,7 @@ stores and converts numbers. Converting the floating-point value to the numeric display value 0055110 is done by multiplying 55.109999...\& by 1,000 and then truncating the result to an integer. And it turns out that even -though 55.11 can’t be represented in floating-point as an exact value, +though 55.11 can't be represented in floating-point as an exact value, the product of the multiplication, 55110, is an exact value. .Pp In cases where it is important for conversions to have predictable @@ -1325,7 +1323,7 @@ specified for a calculation, then the intermediate result becomes a . .Ss A warning about binary floating point comparison The cardinal rule when doing comparisons involving floating-point -values: Never, ever, test for equality. It’s just not worth the hassle. +values: Never, ever, test for equality. It's just not worth the hassle. .Pp For example: .Bd -literal @@ -1361,7 +1359,7 @@ and you really test the code. And then avoid it anyway. .Pp Finally, it is observably the case that the .Nm -implementations of floating-point conversions and comparisons don’t +implementations of floating-point conversions and comparisons don't precisely match the behavior of other \*[lang] compilers. .Pp You have been warned. diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc index d1ffc97..70784d7 100644 --- a/gcc/cobol/gcobolspec.cc +++ b/gcc/cobol/gcobolspec.cc @@ -82,7 +82,7 @@ static bool need_libgcobol = true; // #define NOISY 1 static void -append_arg(const struct cl_decoded_option arg) +append_arg(const cl_decoded_option& arg) { #ifdef NOISY static int counter = 1; diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index f62a2f1..22ce612a 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -2612,7 +2612,7 @@ intrinsic_call_1( cbl_field_t *output, int token, static bool intrinsic_call_2( cbl_field_t *tgt, int token, cbl_refer_t *r1, cbl_refer_t *r2 ) { - std::vector<cbl_refer_t> args { *r1, *r2 }; + std::vector<cbl_refer_t> args { *r1, r2? *r2 : cbl_refer_t() }; size_t n = intrinsic_invalid_parameter(token, args); if( n < args.size() ) { error_msg(args[n].loc, "invalid parameter '%s'", args[n].field->name); 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.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/gcn/gcn-devices.def b/gcc/config/gcn/gcn-devices.def index af14203..426acf0 100644 --- a/gcc/config/gcn/gcn-devices.def +++ b/gcc/config/gcn/gcn-devices.def @@ -171,6 +171,28 @@ GCN_DEVICE(gfx90c, GFX90C, 0x32, ISA_GCN5, /* Generic Name */ GFX9_GENERIC ) +GCN_DEVICE(gfx942, GFX942, 0x4c, ISA_CDNA3, + /* XNACK default */ HSACO_ATTR_ANY, + /* SRAM_ECC default */ HSACO_ATTR_ANY, + /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED, + /* CU mode */ HSACO_ATTR_UNSUPPORTED, + /* Max ISA VGPRs */ 512, + /* Generic code obj version */ 0, /* non-generic */ + /* Architecture Family */ GFX9, + /* Generic Name */ NONE + ) + +GCN_DEVICE(gfx950, GFX950, 0x4f, ISA_CDNA3, + /* XNACK default */ HSACO_ATTR_ANY, + /* SRAM_ECC default */ HSACO_ATTR_ANY, + /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED, + /* CU mode */ HSACO_ATTR_UNSUPPORTED, + /* Max ISA VGPRs */ 512, + /* Generic code obj version */ 0, /* non-generic */ + /* Architecture Family */ GFX9, + /* Generic Name */ NONE + ) + GCN_DEVICE(gfx9-generic, GFX9_GENERIC, 0x051, ISA_GCN5, /* XNACK default */ HSACO_ATTR_ANY, /* SRAM_ECC default */ HSACO_ATTR_UNSUPPORTED, @@ -182,6 +204,17 @@ GCN_DEVICE(gfx9-generic, GFX9_GENERIC, 0x051, ISA_GCN5, /* Generic Name */ NONE ) +GCN_DEVICE(gfx9-4-generic, GFX9_4_GENERIC, 0x05f, ISA_CDNA3, + /* XNACK default */ HSACO_ATTR_ANY, + /* SRAM_ECC default */ HSACO_ATTR_UNSUPPORTED, + /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED, + /* CU mode */ HSACO_ATTR_UNSUPPORTED, + /* Max ISA VGPRs */ 256, + /* Generic code obj version */ 1, + /* Architecture Family */ GFX9, + /* Generic Name */ NONE + ) + /* GCN GFX10.3 (RDNA 2) */ GCN_DEVICE(gfx1030, GFX1030, 0x36, ISA_RDNA2, diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h index 88f562d..bcea14f 100644 --- a/gcc/config/gcn/gcn-opts.h +++ b/gcc/config/gcn/gcn-opts.h @@ -33,7 +33,8 @@ extern enum gcn_isa { ISA_RDNA2, ISA_RDNA3, ISA_CDNA1, - ISA_CDNA2 + ISA_CDNA2, + ISA_CDNA3 } gcn_isa; #define TARGET_GCN5 (gcn_isa == ISA_GCN5) @@ -41,6 +42,8 @@ extern enum gcn_isa { #define TARGET_CDNA1_PLUS (gcn_isa >= ISA_CDNA1) #define TARGET_CDNA2 (gcn_isa == ISA_CDNA2) #define TARGET_CDNA2_PLUS (gcn_isa >= ISA_CDNA2) +#define TARGET_CDNA3 (gcn_isa == ISA_CDNA3) +#define TARGET_CDNA3_PLUS (gcn_isa >= ISA_CDNA3) #define TARGET_RDNA2 (gcn_isa == ISA_RDNA2) #define TARGET_RDNA2_PLUS (gcn_isa >= ISA_RDNA2 && gcn_isa < ISA_CDNA1) #define TARGET_RDNA3 (gcn_isa == ISA_RDNA3) @@ -81,18 +84,22 @@ enum hsaco_attr_type #define TARGET_DPP8 TARGET_RDNA2_PLUS /* Device requires CDNA1-style manually inserted wait states for AVGPRs. */ #define TARGET_AVGPR_CDNA1_NOPS TARGET_CDNA1 +/* Whether to use the 'globally coherent' (glc) or the 'scope' (sc0, sc1) flag + for scalar memory operations. The string starts on purpose with a space. */ +#define TARGET_GLC_NAME (TARGET_CDNA3 ? " sc0" : " glc") /* The metadata on different devices need different granularity. */ #define TARGET_VGPR_GRANULARITY \ (TARGET_RDNA3 ? 12 \ : TARGET_RDNA2_PLUS || TARGET_CDNA2_PLUS ? 8 \ : 4) /* This mostly affects the metadata. */ -#define TARGET_ARCHITECTED_FLAT_SCRATCH TARGET_RDNA3 +#define TARGET_ARCHITECTED_FLAT_SCRATCH (TARGET_RDNA3 || TARGET_CDNA3) /* Device has Sub-DWord Addressing instrucions. */ #define TARGET_SDWA (!TARGET_RDNA3) /* Different devices uses different cache control instructions. */ -#define TARGET_WBINVL1_CACHE (!TARGET_RDNA2_PLUS) +#define TARGET_WBINVL1_CACHE (!TARGET_RDNA2_PLUS && !TARGET_CDNA3) #define TARGET_GLn_CACHE TARGET_RDNA2_PLUS +#define TARGET_TARGET_SC_CACHE TARGET_CDNA3 /* Some devices have TGSPLIT, which needs at least metadata. */ #define TARGET_TGSPLIT TARGET_CDNA2_PLUS diff --git a/gcc/config/gcn/gcn-tables.opt b/gcc/config/gcn/gcn-tables.opt index 96ce9bd..4a381b3 100644 --- a/gcc/config/gcn/gcn-tables.opt +++ b/gcc/config/gcn/gcn-tables.opt @@ -49,9 +49,18 @@ EnumValue Enum(gpu_type) String(gfx90c) Value(PROCESSOR_GFX90C) EnumValue +Enum(gpu_type) String(gfx942) Value(PROCESSOR_GFX942) + +EnumValue +Enum(gpu_type) String(gfx950) Value(PROCESSOR_GFX950) + +EnumValue Enum(gpu_type) String(gfx9-generic) Value(PROCESSOR_GFX9_GENERIC) EnumValue +Enum(gpu_type) String(gfx9-4-generic) Value(PROCESSOR_GFX9_4_GENERIC) + +EnumValue Enum(gpu_type) String(gfx1030) Value(PROCESSOR_GFX1030) EnumValue diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md index 977ad88..4b21302 100644 --- a/gcc/config/gcn/gcn-valu.md +++ b/gcc/config/gcn/gcn-valu.md @@ -1161,7 +1161,7 @@ && (((unsigned HOST_WIDE_INT)INTVAL(operands[2]) + 0x1000) < 0x2000))" { addr_space_t as = INTVAL (operands[3]); - const char *glc = INTVAL (operands[4]) ? " glc" : ""; + const char *glc = INTVAL (operands[4]) ? TARGET_GLC_NAME : ""; static char buf[200]; if (AS_FLAT_P (as)) @@ -1221,7 +1221,7 @@ && (((unsigned HOST_WIDE_INT)INTVAL(operands[3]) + 0x1000) < 0x2000))" { addr_space_t as = INTVAL (operands[4]); - const char *glc = INTVAL (operands[5]) ? " glc" : ""; + const char *glc = INTVAL (operands[5]) ? TARGET_GLC_NAME : ""; static char buf[200]; if (AS_GLOBAL_P (as)) @@ -1288,7 +1288,7 @@ && (((unsigned HOST_WIDE_INT)INTVAL(operands[1]) + 0x1000) < 0x2000))" { addr_space_t as = INTVAL (operands[3]); - const char *glc = INTVAL (operands[4]) ? " glc" : ""; + const char *glc = INTVAL (operands[4]) ? TARGET_GLC_NAME : ""; static char buf[200]; if (AS_FLAT_P (as)) @@ -1345,7 +1345,7 @@ && (((unsigned HOST_WIDE_INT)INTVAL(operands[2]) + 0x1000) < 0x2000))" { addr_space_t as = INTVAL (operands[4]); - const char *glc = INTVAL (operands[5]) ? " glc" : ""; + const char *glc = INTVAL (operands[5]) ? TARGET_GLC_NAME : ""; static char buf[200]; if (AS_GLOBAL_P (as)) diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index f982dbd..31a59dd6 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -7102,7 +7102,8 @@ print_operand_address (FILE *file, rtx mem) E - print conditional code for v_cmp (eq_u64/ne_u64...) A - print address in formatting suitable for given address space. O - print offset:n for data share operations. - g - print "glc", if appropriate for given MEM + G - print "glc" (or for gfx94x: sc0) unconditionally [+ indep. of regnum] + g - print "glc" (or for gfx94x: sc0), if appropriate for given MEM L - print low-part of a multi-reg value H - print second part of a multi-reg value (high-part of 2-reg value) J - print third part of a multi-reg value @@ -7718,10 +7719,13 @@ print_operand (FILE *file, rtx x, int code) else output_addr_const (file, x); return; + case 'G': + fputs (TARGET_GLC_NAME, file); + return; case 'g': gcc_assert (xcode == MEM); if (MEM_VOLATILE_P (x)) - fputs (" glc", file); + fputs (TARGET_GLC_NAME, file); return; default: output_operand_lossage ("invalid %%xn code"); diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h index 5198fbc..3d42de3 100644 --- a/gcc/config/gcn/gcn.h +++ b/gcc/config/gcn/gcn.h @@ -43,6 +43,8 @@ extern const struct gcn_device_def { builtin_define ("__CDNA1__"); \ else if (TARGET_CDNA2) \ builtin_define ("__CDNA2__"); \ + else if (TARGET_CDNA3) \ + builtin_define ("__CDNA3__"); \ else if (TARGET_RDNA2) \ builtin_define ("__RDNA2__"); \ else if (TARGET_RDNA3) \ diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md index e0fb735..1998931 100644 --- a/gcc/config/gcn/gcn.md +++ b/gcc/config/gcn/gcn.md @@ -206,7 +206,7 @@ ; vdata: vgpr0-255 ; srsrc: sgpr0-102 ; soffset: sgpr0-102 -; flags: offen, idxen, glc, lds, slc, tfe +; flags: offen, idxen, %G, lds, slc, tfe ; ; mtbuf - Typed memory buffer operation. Two words ; offset: 12-bit constant @@ -216,10 +216,10 @@ ; vdata: vgpr0-255 ; srsrc: sgpr0-102 ; soffset: sgpr0-102 -; flags: offen, idxen, glc, lds, slc, tfe +; flags: offen, idxen, %G, lds, slc, tfe ; ; flat - flat or global memory operations -; flags: glc, slc +; flags: %G, slc ; addr: vgpr0-255 ; data: vgpr0-255 ; vdst: vgpr0-255 @@ -1964,6 +1964,14 @@ [(set_attr "type" "mult") (set_attr "length" "8")]) +(define_insn "*memory_barrier" + [(set (match_operand:BLK 0) + (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))] + "TARGET_TARGET_SC_CACHE" + "buffer_inv sc1" + [(set_attr "type" "mubuf") + (set_attr "length" "4")]) + ; FIXME: These patterns have been disabled as they do not seem to work ; reliably - they can cause hangs or incorrect results. ; TODO: flush caches according to memory model @@ -1979,9 +1987,9 @@ (use (match_operand 3 "const_int_operand"))] "0 /* Disabled. */" "@ - s_atomic_<bare_mnemonic><X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0) - flat_atomic_<bare_mnemonic><X>\t%0, %1, %2 glc\;s_waitcnt\t0 - global_atomic_<bare_mnemonic><X>\t%0, %A1, %2%O1 glc\;s_waitcnt\tvmcnt(0)" + s_atomic_<bare_mnemonic><X>\t%0, %1, %2 %G2\;s_waitcnt\tlgkmcnt(0) + flat_atomic_<bare_mnemonic><X>\t%0, %1, %2 %G2\;s_waitcnt\t0 + global_atomic_<bare_mnemonic><X>\t%0, %A1, %2%O1 %G2\;s_waitcnt\tvmcnt(0)" [(set_attr "type" "smem,flat,flat") (set_attr "length" "12")]) @@ -2046,9 +2054,9 @@ UNSPECV_ATOMIC))] "" "@ - s_atomic_cmpswap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0) - flat_atomic_cmpswap<X>\t%0, %1, %2 glc\;s_waitcnt\t0 - global_atomic_cmpswap<X>\t%0, %A1, %2%O1 glc\;s_waitcnt\tvmcnt(0)" + s_atomic_cmpswap<X>\t%0, %1, %2 %G2\;s_waitcnt\tlgkmcnt(0) + flat_atomic_cmpswap<X>\t%0, %1, %2 %G2\;s_waitcnt\t0 + global_atomic_cmpswap<X>\t%0, %A1, %2%O1 %G2\;s_waitcnt\tvmcnt(0)" [(set_attr "type" "smem,flat,flat") (set_attr "length" "12") (set_attr "delayeduse" "*,yes,yes")]) @@ -2088,15 +2096,15 @@ switch (which_alternative) { case 0: - return "s_load%o0\t%0, %A1 glc\;s_waitcnt\tlgkmcnt(0)"; + return "s_load%o0\t%0, %A1 %G1\;s_waitcnt\tlgkmcnt(0)"; case 1: return (TARGET_RDNA2 /* Not GFX11. */ - ? "flat_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\t0" - : "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0"); + ? "flat_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\t0" + : "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0"); case 2: return (TARGET_RDNA2 /* Not GFX11. */ - ? "global_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\tvmcnt(0)" - : "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)"); + ? "global_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\tvmcnt(0)" + : "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)"); } break; case MEMMODEL_CONSUME: @@ -2105,25 +2113,31 @@ switch (which_alternative) { case 0: - return "s_load%o0\t%0, %A1 glc\;s_waitcnt\tlgkmcnt(0)\;" + return "s_load%o0\t%0, %A1 %G1\;s_waitcnt\tlgkmcnt(0)\;" "s_dcache_wb_vol"; case 1: return (TARGET_RDNA2 - ? "flat_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\t0\;" + ? "flat_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\t0\;" "buffer_gl1_inv\;buffer_gl0_inv" : TARGET_RDNA3 - ? "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;" + ? "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;" "buffer_gl1_inv\;buffer_gl0_inv" - : "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;" + : TARGET_TARGET_SC_CACHE + ? "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;" + "buffer_inv sc1" + : "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;" "buffer_wbinvl1_vol"); case 2: return (TARGET_RDNA2 - ? "global_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\tvmcnt(0)\;" + ? "global_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\tvmcnt(0)\;" "buffer_gl1_inv\;buffer_gl0_inv" : TARGET_RDNA3 - ? "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;" + ? "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;" "buffer_gl1_inv\;buffer_gl0_inv" - : "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;" + : TARGET_TARGET_SC_CACHE + ? "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;" + "buffer_inv sc1" + : "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;" "buffer_wbinvl1_vol"); } break; @@ -2133,25 +2147,31 @@ switch (which_alternative) { case 0: - return "s_dcache_wb_vol\;s_load%o0\t%0, %A1 glc\;" + return "s_dcache_wb_vol\;s_load%o0\t%0, %A1 %G1\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: return (TARGET_RDNA2 - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 glc dlc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 %G1 dlc\;" "s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_RDNA3 - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 %G1\;" "s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv" - : "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 glc\;" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;flat_load%o0\t%0, %A1%O1 %G1\;" + "s_waitcnt\t0\;buffer_inv sc1" + : "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 %G1\;" "s_waitcnt\t0\;buffer_wbinvl1_vol"); case 2: return (TARGET_RDNA2 - ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 glc dlc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 %G1 dlc\;" "s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_RDNA3 - ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv" - : "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 glc\;" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;global_load%o0\t%0, %A1%O1 %G1\;" + "s_waitcnt\tvmcnt(0)\;buffer_inv sc1" + : "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"); } break; @@ -2176,11 +2196,11 @@ switch (which_alternative) { case 0: - return "s_store%o1\t%1, %A0 glc\;s_waitcnt\tlgkmcnt(0)"; + return "s_store%o1\t%1, %A0 %G1\;s_waitcnt\tlgkmcnt(0)"; case 1: - return "flat_store%o1\t%A0, %1%O0 glc\;s_waitcnt\t0"; + return "flat_store%o1\t%A0, %1%O0 %G1\;s_waitcnt\t0"; case 2: - return "global_store%o1\t%A0, %1%O0 glc\;s_waitcnt\tvmcnt(0)"; + return "global_store%o1\t%A0, %1%O0 %G1\;s_waitcnt\tvmcnt(0)"; } break; case MEMMODEL_RELEASE: @@ -2188,18 +2208,22 @@ switch (which_alternative) { case 0: - return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc"; + return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 %G1"; case 1: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 %G1" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc" + ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 %G1" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;flat_store%o1\t%A0, %1%O0 %G1" : "error: cache architectire unspecified"); case 2: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc" + ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 %G1" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc" + ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 %G1" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;global_store%o1\t%A0, %1%O0 %G1" : "error: cache architecture unspecified"); } break; @@ -2209,23 +2233,29 @@ switch (which_alternative) { case 0: - return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc\;" + return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 %G1\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 %G1\;" "s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc\;" + ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 %G1\;" "s_waitcnt\t0\;buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;flat_store%o1\t%A0, %1%O0 %G1\;" + "s_waitcnt\t0\;buffer_inv sc1" : "error: cache architecture unspecified"); case 2: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc\;" + ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;global_store%o1\t%A0, %1%O0 %G1\;" + "s_waitcnt\tvmcnt(0)\;buffer_inv sc1" : "error: cache architecture unspecified"); } break; @@ -2252,11 +2282,11 @@ switch (which_alternative) { case 0: - return "s_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)"; + return "s_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\tlgkmcnt(0)"; case 1: - return "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0"; + return "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0"; case 2: - return "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + return "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)"; } break; @@ -2266,23 +2296,29 @@ switch (which_alternative) { case 0: - return "s_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)\;" + return "s_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\tlgkmcnt(0)\;" "s_dcache_wb_vol\;s_dcache_inv_vol"; case 1: return (TARGET_GLn_CACHE - ? "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0\;" + ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;" "buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE - ? "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0\;" + ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;" "buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;" + "buffer_inv sc1" : "error: cache architecture unspecified"); case 2: return (TARGET_GLn_CACHE - ? "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE - ? "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" + "s_waitcnt\tvmcnt(0)\;buffer_inv sc1" : "error: cache architecture unspecified"); } break; @@ -2291,24 +2327,31 @@ switch (which_alternative) { case 0: - return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 glc\;" + return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\tlgkmcnt(0)"; case 1: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\t0" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 glc\;" + ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" + "s_waitcnt\t0" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\t0" : "error: cache architecture unspecified"); case 2: return (TARGET_GLn_CACHE ? "buffer_gl1_inv\;buffer_gl0_inv\;" - "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)" : TARGET_WBINVL1_CACHE ? "buffer_wbinvl1_vol\;" - "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" + "s_waitcnt\tvmcnt(0)" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)" : "error: cache architecture unspecified"); } @@ -2319,25 +2362,32 @@ switch (which_alternative) { case 0: - return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 glc\;" + return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: return (TARGET_GLn_CACHE - ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 glc\;" + ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE - ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 glc\;" + ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" "s_waitcnt\t0\;buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;" + "s_waitcnt\t0\;buffer_inv sc1" : "error: cache architecture unspecified"); case 2: return (TARGET_GLn_CACHE ? "buffer_gl1_inv\;buffer_gl0_inv\;" - "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv" : TARGET_WBINVL1_CACHE ? "buffer_wbinvl1_vol\;" - "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol" + : TARGET_TARGET_SC_CACHE + ? "buffer_inv sc1\;" + "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;" + "s_waitcnt\tvmcnt(0)\;buffer_inv sc1" : "error: cache architecture unspecified"); } break; 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/i386.cc b/gcc/config/i386/i386.cc index d48654a..20ee360 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -22938,7 +22938,17 @@ ix86_rtx_costs (rtx x, machine_mode mode, int outer_code_i, int opno, } /* This is masked instruction, assume the same cost, as nonmasked variant. */ - else if (TARGET_AVX512F && register_operand (mask, GET_MODE (mask))) + else if (TARGET_AVX512F + && (register_operand (mask, GET_MODE (mask)) + /* Redunduant clean up of high bits for kmask with VL=2/4 + .i.e (vec_merge op0, op1, (and op3 15)). */ + || (GET_CODE (mask) == AND + && register_operand (XEXP (mask, 0), GET_MODE (mask)) + && CONST_INT_P (XEXP (mask, 1)) + && ((INTVAL (XEXP (mask, 1)) == 3 + && GET_MODE_NUNITS (mode) == 2) + || (INTVAL (XEXP (mask, 1)) == 15 + && GET_MODE_NUNITS (mode) == 4))))) { *total = rtx_cost (XEXP (x, 0), mode, outer_code, opno, speed) + rtx_cost (XEXP (x, 1), mode, outer_code, opno, speed); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 8eee447..99f3824 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -21512,11 +21512,12 @@ (set_attr "mode" "SI")]) ; As bsr is undefined behavior on zero and for other input -; values it is in range 0 to 63, we can optimize away sign-extends. -(define_insn_and_split "*bsr_rex64_2" +; values it is in range 0 to 63, we can optimize away sign-extends +; or zero-extends. +(define_insn_and_split "*bsr_rex64<u>_2" [(set (match_operand:DI 0 "register_operand") (xor:DI - (sign_extend:DI + (any_extend:DI (minus:SI (const_int 63) (subreg:SI (clz:DI (match_operand:DI 1 "nonimmediate_operand")) @@ -21538,9 +21539,9 @@ operands[3] = lowpart_subreg (SImode, operands[2], DImode); }) -(define_insn_and_split "*bsr_2" +(define_insn_and_split "*bsr<u>_2" [(set (match_operand:DI 0 "register_operand") - (sign_extend:DI + (any_extend:DI (xor:SI (minus:SI (const_int 31) @@ -21617,7 +21618,7 @@ (minus:DI (match_operand:DI 2 "const_int_operand") (xor:DI - (sign_extend:DI + (any_extend:DI (minus:SI (const_int 63) (subreg:SI (clz:DI (match_operand:DI 1 "nonimmediate_operand")) @@ -21647,7 +21648,7 @@ [(set (match_operand:DI 0 "register_operand") (minus:DI (match_operand:DI 2 "const_int_operand") - (sign_extend:DI + (any_extend:DI (xor:SI (minus:SI (const_int 31) (clz:SI (match_operand:SI 1 "nonimmediate_operand"))) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index c40b0fd..252ba07 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1589,6 +1589,44 @@ "&& 1" [(set (match_dup 0) (match_dup 1))]) +(define_insn_and_split "*<avx512>_load<mode>mask_and15" + [(set (match_operand:V48_AVX512VL_4 0 "register_operand" "=v") + (vec_merge:V48_AVX512VL_4 + (unspec:V48_AVX512VL_4 + [(match_operand:V48_AVX512VL_4 1 "memory_operand" "m")] + UNSPEC_MASKLOAD) + (match_operand:V48_AVX512VL_4 2 "nonimm_or_0_operand" "0C") + (and:QI + (match_operand:QI 3 "register_operand" "Yk") + (const_int 15))))] + "TARGET_AVX512F" + "#" + "&& 1" + [(set (match_dup 0) + (vec_merge:V48_AVX512VL_4 + (unspec:V48_AVX512VL_4 [(match_dup 1)] UNSPEC_MASKLOAD) + (match_dup 2) + (match_dup 3)))]) + +(define_insn_and_split "*<avx512>_load<mode>mask_and3" + [(set (match_operand:V8_AVX512VL_2 0 "register_operand" "=v") + (vec_merge:V8_AVX512VL_2 + (unspec:V8_AVX512VL_2 + [(match_operand:V8_AVX512VL_2 1 "memory_operand" "m")] + UNSPEC_MASKLOAD) + (match_operand:V8_AVX512VL_2 2 "nonimm_or_0_operand" "0C") + (and:QI + (match_operand:QI 3 "register_operand" "Yk") + (const_int 3))))] + "TARGET_AVX512F" + "#" + "&& 1" + [(set (match_dup 0) + (vec_merge:V8_AVX512VL_2 + (unspec:V8_AVX512VL_2 [(match_dup 1)] UNSPEC_MASKLOAD) + (match_dup 2) + (match_dup 3)))]) + (define_expand "<avx512>_load<mode>_mask" [(set (match_operand:VI12_AVX512VL 0 "register_operand") (vec_merge:VI12_AVX512VL 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/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 6a7eb71..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: @@ -5569,6 +5570,9 @@ expand_vx_binary_vec_vec_dup (rtx op_0, rtx op_1, rtx op_2, case MULT: case DIV: 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 3fd18c1..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); } @@ -3949,6 +3962,8 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN { case DIV: case UDIV: + case MOD: + case UMOD: *total = get_vector_binary_rtx_cost (op, scalar2vr_cost); break; default: @@ -3963,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); @@ -4608,16 +4624,14 @@ riscv_noce_conversion_profitable_p (rtx_insn *seq, rtx dest = SET_DEST (x); - /* Do something similar for the moves that are likely to + /* Do something similar for the moves that are likely to turn into NOP moves by the time the register allocator is - done. These are also side effects of how our sCC expanders - work. We'll want to check and update LAST_DEST here too. */ - if (last_dest - && REG_P (dest) + done. We don't require src to be something set in this + sequence, just a promoted SUBREG. */ + if (REG_P (dest) && GET_MODE (dest) == SImode && SUBREG_P (src) - && SUBREG_PROMOTED_VAR_P (src) - && REGNO (SUBREG_REG (src)) == REGNO (last_dest)) + && SUBREG_PROMOTED_VAR_P (src)) { riscv_if_info.original_cost += COSTS_N_INSNS (1); riscv_if_info.max_seq_cost += COSTS_N_INSNS (1); @@ -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/riscv.md b/gcc/config/riscv/riscv.md index 6d3c80a..3aed25c 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -884,7 +884,7 @@ ;; Where C1 is not a LUI operand, but ~C1 is a LUI operand (define_insn_and_split "*lui_constraint<X:mode>_and_to_or" - [(set (match_operand:X 0 "register_operand" "=r") + [(set (match_operand:X 0 "register_operand" "=r") (plus:X (and:X (match_operand:X 1 "register_operand" "r") (match_operand 2 "const_int_operand")) (match_operand 3 "const_int_operand"))) @@ -898,13 +898,21 @@ <= riscv_const_insns (operands[3], false)))" "#" "&& reload_completed" - [(set (match_dup 4) (match_dup 5)) - (set (match_dup 0) (ior:X (match_dup 1) (match_dup 4))) - (set (match_dup 4) (match_dup 6)) - (set (match_dup 0) (minus:X (match_dup 0) (match_dup 4)))] + [(const_int 0)] { operands[5] = GEN_INT (~INTVAL (operands[2])); operands[6] = GEN_INT ((~INTVAL (operands[2])) | (-INTVAL (operands[3]))); + + /* This is always a LUI operand, so it's safe to just emit. */ + emit_move_insn (operands[4], operands[5]); + + rtx x = gen_rtx_IOR (word_mode, operands[1], operands[4]); + emit_move_insn (operands[0], x); + + /* This may require multiple steps to synthesize. */ + riscv_emit_move (operands[4], operands[6]); + x = gen_rtx_MINUS (word_mode, operands[0], operands[4]); + emit_move_insn (operands[0], x); } [(set_attr "type" "arith")]) diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md index 36301b0..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 + 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 0078b6c..842f74d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,25 @@ +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 + PR c++/115605 + * pt.cc (lookup_template_class): Honour provided namespace contexts + when looking up class templates. + 2025-06-06 Jason Merrill <jason@redhat.com> PR c++/120555 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/cp/pt.cc b/gcc/cp/pt.cc index b5c877a..752b0ea 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -10052,15 +10052,20 @@ tsubst_entering_scope (tree t, tree args, tsubst_flags_t complain, tree in_decl) D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments. + If D1 is an identifier and CONTEXT is non-NULL, then the lookup is + carried out in CONTEXT. Currently, only namespaces are supported for + CONTEXT. + + If D1 is an identifier and CONTEXT is NULL, the lookup is performed + in the innermost non-namespace binding. + + Otherwise CONTEXT is ignored and no lookup is carried out. + IN_DECL, if non-NULL, is the template declaration we are trying to instantiate. Issue error and warning messages under control of COMPLAIN. - If the template class is really a local class in a template - function, then the FUNCTION_CONTEXT is the function in which it is - being instantiated. - ??? Note that this function is currently called *twice* for each template-id: the first time from the parser, while creating the incomplete type (finish_template_type), and the second type during the @@ -10079,20 +10084,23 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, spec_entry **slot; spec_entry *entry; - if (identifier_p (d1)) + if (identifier_p (d1) && context) + { + gcc_checking_assert (TREE_CODE (context) == NAMESPACE_DECL); + push_decl_namespace (context); + templ = lookup_name (d1, LOOK_where::NAMESPACE, LOOK_want::NORMAL); + pop_decl_namespace (); + } + else if (identifier_p (d1)) { tree value = innermost_non_namespace_value (d1); if (value && DECL_TEMPLATE_TEMPLATE_PARM_P (value)) templ = value; else - { - if (context) - push_decl_namespace (context); + { templ = lookup_name (d1); templ = maybe_get_template_decl_from_type_decl (templ); - if (context) - pop_decl_namespace (); - } + } } else if (TREE_CODE (d1) == TYPE_DECL && MAYBE_CLASS_TYPE_P (TREE_TYPE (d1))) { diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc index ea2dbbb..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 @@ -104,6 +107,9 @@ public: const line_maps *line_maps, const html_generation_options &html_gen_opts); + void + set_main_input_filename (const char *name); + void on_report_diagnostic (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, diagnostic_html_format_buffer *buffer); @@ -136,25 +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> @@ -233,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" @@ -265,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. @@ -347,12 +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> (); { @@ -367,17 +404,22 @@ html_builder::html_builder (diagnostic_context &context, m_head_element = xp.get_insertion_point (); { xml::auto_print_element title (xp, "title", true); - xp.add_text ("Title goes here"); + 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"); } } @@ -392,6 +434,29 @@ html_builder::html_builder (diagnostic_context &context, } } +void +html_builder::set_main_input_filename (const char *name) +{ + gcc_assert (m_title_element); + if (name) + { + m_title_element->m_children.clear (); + m_title_element->add_text (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 @@ -409,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); @@ -419,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. */ @@ -456,7 +592,7 @@ public: void end_label () final override { - m_xp.pop_tag (); // span + m_xp.pop_tag ("span"); // from begin_label } private: @@ -466,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 (); + } +} + +static const char * +get_pf_class_for_alert_icon (diagnostic_t diag_kind) +{ + switch (diag_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 (); } - void print_tokens (pretty_printer */*pp*/, - const pp_token_list &tokens) final override +} + +static const char * +get_label_for_logical_location_kind (enum logical_location_kind kind) +{ + switch (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) + 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; { @@ -548,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); + + // 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 (" "); + } - xml::printer xp (*message_span.get ()); - html_token_printer tok_printer (xp); + // 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)); @@ -580,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 ("["); { @@ -595,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; } @@ -664,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; @@ -739,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); @@ -765,6 +1165,12 @@ public: diagnostic_output_format::dump (out, indent); } + void + set_main_input_filename (const char *name) final override + { + m_builder.set_main_input_filename (name); + } + std::unique_ptr<diagnostic_per_format_buffer> make_per_format_buffer () final override { @@ -924,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. */ @@ -940,6 +1393,7 @@ public: line_table, html_gen_opts); sink->update_printer (); + sink->set_main_input_filename ("(main input filename)"); m_format = sink.get (); // borrowed set_output_format (std::move (sink)); @@ -988,22 +1442,21 @@ 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" " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" " <head>\n" - " <title>Title goes here</title>\n" + " <title>(main input filename)</title>\n" " </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" @@ -1020,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\">" "[" @@ -1041,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\">" "[" @@ -1063,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-format-json.cc b/gcc/diagnostic-format-json.cc index 205678d..fb54897 100644 --- a/gcc/diagnostic-format-json.cc +++ b/gcc/diagnostic-format-json.cc @@ -505,40 +505,47 @@ private: }; /* Populate CONTEXT in preparation for JSON output (either to stderr, or - to a file). */ + to a file) using FMT. Return a reference to *FMT. */ -static void +static diagnostic_output_format & diagnostic_output_format_init_json (diagnostic_context &context, std::unique_ptr<json_output_format> fmt) { + gcc_assert (fmt); + diagnostic_output_format &out = *fmt; + /* Don't colorize the text. */ pp_show_color (fmt->get_printer ()) = false; context.set_show_highlight_colors (false); context.set_output_format (std::move (fmt)); + + return out; } -/* Populate CONTEXT in preparation for JSON output to stderr. */ +/* Populate CONTEXT in preparation for JSON output to stderr. + Return a reference to the context's new sink. */ -void +diagnostic_output_format & diagnostic_output_format_init_json_stderr (diagnostic_context &context, bool formatted) { - diagnostic_output_format_init_json + return diagnostic_output_format_init_json (context, std::make_unique<json_stderr_output_format> (context, formatted)); } /* Populate CONTEXT in preparation for JSON output to a file named - BASE_FILE_NAME.gcc.json. */ + BASE_FILE_NAME.gcc.json. + Return a reference to the context's new sink. */ -void +diagnostic_output_format & diagnostic_output_format_init_json_file (diagnostic_context &context, bool formatted, const char *base_file_name) { - diagnostic_output_format_init_json + return diagnostic_output_format_init_json (context, std::make_unique<json_file_output_format> (context, formatted, diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc index 454eaae..853a833 100644 --- a/gcc/diagnostic-format-sarif.cc +++ b/gcc/diagnostic-format-sarif.cc @@ -751,7 +751,6 @@ public: sarif_builder (diagnostic_context &context, pretty_printer &printer, const line_maps *line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts); ~sarif_builder (); @@ -767,6 +766,9 @@ public: return m_logical_loc_mgr; } + void + set_main_input_filename (const char *name); + void on_report_diagnostic (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, diagnostic_sarif_format_buffer *buffer); @@ -1643,7 +1645,6 @@ sarif_thread_flow::add_location () sarif_builder::sarif_builder (diagnostic_context &context, pretty_printer &printer, const line_maps *line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts) : m_context (context), @@ -1672,17 +1673,6 @@ sarif_builder::sarif_builder (diagnostic_context &context, if (auto client_data_hooks = context.get_client_data_hooks ()) m_logical_loc_mgr = client_data_hooks->get_logical_location_manager (); - - /* Mark MAIN_INPUT_FILENAME_ as the artifact that the tool was - instructed to scan. - Only quote the contents if it gets referenced by physical locations, - since otherwise the "no diagnostics" case would quote the main input - file, and doing so noticeably bloated the output seen in analyzer - integration testing (build directory went from 20G -> 21G). */ - if (main_input_filename_) - get_or_create_artifact (main_input_filename_, - diagnostic_artifact_role::analysis_target, - false); } sarif_builder::~sarif_builder () @@ -1820,6 +1810,20 @@ sarif_builder::make_stack_from_backtrace () return stack; } +void +sarif_builder::set_main_input_filename (const char *name) +{ + /* Mark NAME as the artifact that the tool was instructed to scan. + Only quote the contents if it gets referenced by physical locations, + since otherwise the "no diagnostics" case would quote the main input + file, and doing so noticeably bloated the output seen in analyzer + integration testing (build directory went from 20G -> 21G). */ + if (name) + get_or_create_artifact (name, + diagnostic_artifact_role::analysis_target, + false); +} + /* Implementation of "on_report_diagnostic" for SARIF output. */ void @@ -2731,51 +2735,51 @@ maybe_get_sarif_kind (enum logical_location_kind kind) { default: gcc_unreachable (); - case LOGICAL_LOCATION_KIND_UNKNOWN: + case logical_location_kind::unknown: return nullptr; /* Kinds within executable code. */ - case LOGICAL_LOCATION_KIND_FUNCTION: + case logical_location_kind::function: return "function"; - case LOGICAL_LOCATION_KIND_MEMBER: + case logical_location_kind::member: return "member"; - case LOGICAL_LOCATION_KIND_MODULE: + case logical_location_kind::module_: return "module"; - case LOGICAL_LOCATION_KIND_NAMESPACE: + case logical_location_kind::namespace_: return "namespace"; - case LOGICAL_LOCATION_KIND_TYPE: + case logical_location_kind::type: return "type"; - case LOGICAL_LOCATION_KIND_RETURN_TYPE: + case logical_location_kind::return_type: return "returnType"; - case LOGICAL_LOCATION_KIND_PARAMETER: + case logical_location_kind::parameter: return "parameter"; - case LOGICAL_LOCATION_KIND_VARIABLE: + case logical_location_kind::variable: return "variable"; /* Kinds within XML or HTML documents. */ - case LOGICAL_LOCATION_KIND_ELEMENT: + case logical_location_kind::element: return "element"; - case LOGICAL_LOCATION_KIND_ATTRIBUTE: + case logical_location_kind::attribute: return "attribute"; - case LOGICAL_LOCATION_KIND_TEXT: + case logical_location_kind::text: return "text"; - case LOGICAL_LOCATION_KIND_COMMENT: + case logical_location_kind::comment: return "comment"; - case LOGICAL_LOCATION_KIND_PROCESSING_INSTRUCTION: + case logical_location_kind::processing_instruction: return "processingInstruction"; - case LOGICAL_LOCATION_KIND_DTD: + case logical_location_kind::dtd: return "dtd"; - case LOGICAL_LOCATION_KIND_DECLARATION: + case logical_location_kind::declaration: return "declaration"; /* Kinds within JSON documents. */ - case LOGICAL_LOCATION_KIND_OBJECT: + case logical_location_kind::object: return "object"; - case LOGICAL_LOCATION_KIND_ARRAY: + case logical_location_kind::array: return "array"; - case LOGICAL_LOCATION_KIND_PROPERTY: + case logical_location_kind::property: return "property"; - case LOGICAL_LOCATION_KIND_VALUE: + case logical_location_kind::value: return "value"; } } @@ -3657,6 +3661,12 @@ public: diagnostic_output_format::dump (out, indent); } + void + set_main_input_filename (const char *name) final override + { + m_builder.set_main_input_filename (name); + } + std::unique_ptr<diagnostic_per_format_buffer> make_per_format_buffer () final override { @@ -3722,11 +3732,10 @@ public: protected: sarif_output_format (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts) : diagnostic_output_format (context), - m_builder (context, *get_printer (), line_maps, main_input_filename_, + m_builder (context, *get_printer (), line_maps, std::move (serialization_format), sarif_gen_opts), m_buffer (nullptr) {} @@ -3740,11 +3749,10 @@ class sarif_stream_output_format : public sarif_output_format public: sarif_stream_output_format (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts, FILE *stream) - : sarif_output_format (context, line_maps, main_input_filename_, + : sarif_output_format (context, line_maps, std::move (serialization_format), sarif_gen_opts), m_stream (stream) { @@ -3766,11 +3774,10 @@ class sarif_file_output_format : public sarif_output_format public: sarif_file_output_format (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts, diagnostic_output_file output_file) - : sarif_output_format (context, line_maps, main_input_filename_, + : sarif_output_format (context, line_maps, std::move (serialization_format), sarif_gen_opts), m_output_file (std::move (output_file)) { @@ -3914,34 +3921,39 @@ sarif_builder::sarif_token_printer::print_tokens (pretty_printer *pp, } /* Populate CONTEXT in preparation for SARIF output (either to stderr, or - to a file). */ + to a file). + Return a reference to *FMT. */ -static void +static diagnostic_output_format & diagnostic_output_format_init_sarif (diagnostic_context &context, std::unique_ptr<sarif_output_format> fmt) { + gcc_assert (fmt); + diagnostic_output_format &out = *fmt; + fmt->update_printer (); context.set_output_format (std::move (fmt)); + + return out; } -/* Populate CONTEXT in preparation for SARIF output to stderr. */ +/* Populate CONTEXT in preparation for SARIF output to stderr. + Return a reference to the new sink. */ -void +diagnostic_output_format & diagnostic_output_format_init_sarif_stderr (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, bool formatted) { gcc_assert (line_maps); const sarif_generation_options sarif_gen_opts; auto serialization = std::make_unique<sarif_serialization_format_json> (formatted); - diagnostic_output_format_init_sarif + return diagnostic_output_format_init_sarif (context, std::make_unique<sarif_stream_output_format> (context, line_maps, - main_input_filename_, std::move (serialization), sarif_gen_opts, stderr)); @@ -4018,12 +4030,12 @@ diagnostic_output_format_open_sarif_file (diagnostic_context &context, } /* Populate CONTEXT in preparation for SARIF output to a file named - BASE_FILE_NAME.sarif. */ + BASE_FILE_NAME.sarif. + Return a reference to the new sink. */ -void +diagnostic_output_format & diagnostic_output_format_init_sarif_file (diagnostic_context &context, line_maps *line_maps, - const char *main_input_filename_, bool formatted, const char *base_file_name) { @@ -4038,22 +4050,21 @@ diagnostic_output_format_init_sarif_file (diagnostic_context &context, = std::make_unique<sarif_serialization_format_json> (formatted); const sarif_generation_options sarif_gen_opts; - diagnostic_output_format_init_sarif + return diagnostic_output_format_init_sarif (context, std::make_unique<sarif_file_output_format> (context, line_maps, - main_input_filename_, std::move (serialization), sarif_gen_opts, std::move (output_file))); } -/* Populate CONTEXT in preparation for SARIF output to STREAM. */ +/* Populate CONTEXT in preparation for SARIF output to STREAM. + Return a reference to the new sink. */ -void +diagnostic_output_format & diagnostic_output_format_init_sarif_stream (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, bool formatted, FILE *stream) { @@ -4061,11 +4072,10 @@ diagnostic_output_format_init_sarif_stream (diagnostic_context &context, const sarif_generation_options sarif_gen_opts; auto serialization = std::make_unique<sarif_serialization_format_json> (formatted); - diagnostic_output_format_init_sarif + return diagnostic_output_format_init_sarif (context, std::make_unique<sarif_stream_output_format> (context, line_maps, - main_input_filename_, std::move (serialization), sarif_gen_opts, stream)); @@ -4074,7 +4084,6 @@ diagnostic_output_format_init_sarif_stream (diagnostic_context &context, std::unique_ptr<diagnostic_output_format> make_sarif_sink (diagnostic_context &context, const line_maps &line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization, const sarif_generation_options &sarif_gen_opts, diagnostic_output_file output_file) @@ -4082,7 +4091,6 @@ make_sarif_sink (diagnostic_context &context, auto sink = std::make_unique<sarif_file_output_format> (context, &line_maps, - main_input_filename_, std::move (serialization), sarif_gen_opts, std::move (output_file)); @@ -4183,11 +4191,11 @@ public: { auto format = std::make_unique<buffered_output_format> (*this, line_table, - main_input_filename, true, sarif_gen_opts); m_format = format.get (); // borrowed diagnostic_output_format_init_sarif (*this, std::move (format)); + m_format->set_main_input_filename (main_input_filename); } std::unique_ptr<sarif_log> flush_to_object () @@ -4204,10 +4212,9 @@ private: public: buffered_output_format (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, bool formatted, const sarif_generation_options &sarif_gen_opts) - : sarif_output_format (context, line_maps, main_input_filename_, + : sarif_output_format (context, line_maps, std::make_unique<sarif_serialization_format_json> (formatted), sarif_gen_opts) @@ -4243,7 +4250,7 @@ test_make_location_object (const sarif_generation_options &sarif_gen_opts, test_diagnostic_context dc; pretty_printer pp; sarif_builder builder - (dc, pp, line_table, "MAIN_INPUT_FILENAME", + (dc, pp, line_table, std::make_unique<sarif_serialization_format_json> (true), sarif_gen_opts); diff --git a/gcc/diagnostic-format-sarif.h b/gcc/diagnostic-format-sarif.h index 4e6a525..763dc25 100644 --- a/gcc/diagnostic-format-sarif.h +++ b/gcc/diagnostic-format-sarif.h @@ -41,21 +41,18 @@ diagnostic_output_format_open_sarif_file (diagnostic_context &context, const char *base_file_name, enum sarif_serialization_kind serialization_kind); -extern void +extern diagnostic_output_format & diagnostic_output_format_init_sarif_stderr (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, bool formatted); -extern void +extern diagnostic_output_format & diagnostic_output_format_init_sarif_file (diagnostic_context &context, line_maps *line_maps, - const char *main_input_filename_, bool formatted, const char *base_file_name); -extern void +extern diagnostic_output_format & diagnostic_output_format_init_sarif_stream (diagnostic_context &context, const line_maps *line_maps, - const char *main_input_filename_, bool formatted, FILE *stream); @@ -109,7 +106,6 @@ struct sarif_generation_options extern std::unique_ptr<diagnostic_output_format> make_sarif_sink (diagnostic_context &context, const line_maps &line_maps, - const char *main_input_filename_, std::unique_ptr<sarif_serialization_format> serialization_format, const sarif_generation_options &sarif_gen_opts, diagnostic_output_file output_file); diff --git a/gcc/diagnostic-format.h b/gcc/diagnostic-format.h index f274a00..4de5842 100644 --- a/gcc/diagnostic-format.h +++ b/gcc/diagnostic-format.h @@ -36,6 +36,10 @@ public: virtual void dump (FILE *out, int indent) const; + /* Vfunc for notifying this format what the primary input file is, + e.g. for titles of HTML, for SARIF's artifact metadata. */ + virtual void set_main_input_filename (const char *) {} + /* Vfunc for making an appropriate diagnostic_per_format_buffer subclass for this format. */ virtual std::unique_ptr<diagnostic_per_format_buffer> @@ -95,10 +99,11 @@ diagnostic_output_format_init (diagnostic_context &, const char *base_file_name, enum diagnostics_output_format, bool json_formatting); -extern void + +extern diagnostic_output_format & diagnostic_output_format_init_json_stderr (diagnostic_context &context, bool formatted); -extern void +extern diagnostic_output_format & diagnostic_output_format_init_json_file (diagnostic_context &context, bool formatted, const char *base_file_name); 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/diagnostic.cc b/gcc/diagnostic.cc index 20582b1..ab52e34 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -1059,17 +1059,17 @@ logical_location_manager::function_p (key k) const { default: gcc_unreachable (); - case LOGICAL_LOCATION_KIND_UNKNOWN: - case LOGICAL_LOCATION_KIND_MODULE: - case LOGICAL_LOCATION_KIND_NAMESPACE: - case LOGICAL_LOCATION_KIND_TYPE: - case LOGICAL_LOCATION_KIND_RETURN_TYPE: - case LOGICAL_LOCATION_KIND_PARAMETER: - case LOGICAL_LOCATION_KIND_VARIABLE: + case logical_location_kind::unknown: + case logical_location_kind::module_: + case logical_location_kind::namespace_: + case logical_location_kind::type: + case logical_location_kind::return_type: + case logical_location_kind::parameter: + case logical_location_kind::variable: return false; - case LOGICAL_LOCATION_KIND_FUNCTION: - case LOGICAL_LOCATION_KIND_MEMBER: + case logical_location_kind::function: + case logical_location_kind::member: return true; } } @@ -1865,6 +1865,7 @@ diagnostic_output_format_init (diagnostic_context &context, enum diagnostics_output_format format, bool json_formatting) { + diagnostic_output_format *new_sink = nullptr; switch (format) { default: @@ -1874,31 +1875,31 @@ diagnostic_output_format_init (diagnostic_context &context, break; case DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR: - diagnostic_output_format_init_json_stderr (context, - json_formatting); + new_sink = &diagnostic_output_format_init_json_stderr (context, + json_formatting); break; case DIAGNOSTICS_OUTPUT_FORMAT_JSON_FILE: - diagnostic_output_format_init_json_file (context, - json_formatting, - base_file_name); + new_sink = &diagnostic_output_format_init_json_file (context, + json_formatting, + base_file_name); break; case DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR: - diagnostic_output_format_init_sarif_stderr (context, - line_table, - main_input_filename_, - json_formatting); + new_sink = &diagnostic_output_format_init_sarif_stderr (context, + line_table, + json_formatting); break; case DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE: - diagnostic_output_format_init_sarif_file (context, - line_table, - main_input_filename_, - json_formatting, - base_file_name); + new_sink = &diagnostic_output_format_init_sarif_file (context, + line_table, + json_formatting, + base_file_name); break; } + if (new_sink) + new_sink->set_main_input_filename (main_input_filename_); } /* Initialize this context's m_diagrams based on CHARSET. diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index fe22d34..e4f3cc2 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3879,6 +3879,7 @@ behavior and permissible arguments are the same as for the command-line option @cindex @code{outline-atomics} function attribute, AArch64 @item outline-atomics +@itemx no-outline-atomics Enable or disable calls to out-of-line helpers to implement atomic operations. This corresponds to the behavior of the command-line options @option{-moutline-atomics} and @option{-mno-outline-atomics}. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index fb921b3..34e35a2 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1343,11 +1343,11 @@ default set of libraries is selected based on the value of @item amdgcn*-*-* @var{list} is a comma separated list of ISA names (allowed values: @code{gfx900}, @code{gfx902}, @code{gfx904}, @code{gfx906}, @code{gfx908}, -@code{gfx909}, @code{gfx90a}, @code{gfx90c}, @code{gfx9-generic}, -@code{gfx1030}, @code{gfx1031}, @code{gfx1032}, @code{gfx1033}, -@code{gfx1034}, @code{gfx1035}, @code{gfx1036}, @code{gfx10-3-generic}, -@code{gfx1100}, @code{gfx1101}, @code{gfx1102}, @code{gfx1103}, -@code{gfx1150}, @code{gfx1151}, @code{gfx1152}, @code{gfx1153}, +@code{gfx909}, @code{gfx90a}, @code{gfx90c}, @code{gfx942}, @code{gfx950}, +@code{gfx9-generic}, @code{gfx9-4-generic}, @code{gfx1030}, @code{gfx1031}, +@code{gfx1032}, @code{gfx1033}, @code{gfx1034}, @code{gfx1035}, @code{gfx1036}, +@code{gfx10-3-generic}, @code{gfx1100}, @code{gfx1101}, @code{gfx1102}, +@code{gfx1103}, @code{gfx1150}, @code{gfx1151}, @code{gfx1152}, @code{gfx1153}, @code{gfx11-generic}). It ought not include the name of the default ISA, specified via @option{--with-arch}. If @var{list} is empty, then there will be no multilibs and only the default run-time library will be built. If @@ -4064,9 +4064,10 @@ By default, multilib support is built for @code{gfx900}, @code{gfx906}, requires LLVM 15 or newer. LLVM 13.0.1 or LLVM 14 can be used by specifying a @code{--with-multilib-list=} that does not list any GFX 11 device nor @code{gfx1036}. At least LLVM 16 is required for @code{gfx1150} and -@code{gfx1151}, LLVM 19 for the generic @code{gfx9-generic}, -@code{gfx10-3-generic}, and @code{gfx11-generic} targets and for -@code{gfx1152}, while LLVM 20 is required for @code{gfx1153}. +@code{gfx1151}, LLVM 18 for @code{gfx942}, LLVM 19 for the generic +@code{gfx9-generic}, @code{gfx9-4-generic}, @code{gfx10-3-generic}, and +@code{gfx11-generic} targets and for @code{gfx1152}, while LLVM 20 is required +for @code{gfx950} and @code{gfx1153}. The supported ISA architectures are listed in the GCC manual. The generic ISA targets @code{gfx9-generic}, @code{gfx10-3-generic}, and diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 189a52b..382cc9f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -17325,6 +17325,10 @@ this parameter. The default value of this parameter is 50. @item vect-induction-float Enable loop vectorization of floating point inductions. +@item vect-scalar-cost-multiplier +Apply the given multiplier % to scalar loop costing during vectorization. +Increasing the cost multiplier will make vector loops more profitable. + @item vrp-block-limit Maximum number of basic blocks before VRP switches to a lower memory algorithm. @@ -22669,10 +22673,20 @@ Compile for CDNA2 Instinct MI200 series devices (gfx90a). @item gfx90c Compile for GCN5 Vega 7 devices (gfx90c). +@item gfx942 +Compile for CDNA3 Instinct MI300 series devices (gfx942). (Experimental) + +@item gfx950 +Compile for the CDNA3 gfx950 devices. (Experimental) + @item gfx9-generic Compile generic code for Vega devices, executable on the following subset of GFX9 devices: gfx900, gfx902, gfx904, gfx906, gfx909 and gfx90c. (Experimental) +@item gfx9-4-generic +Compile generic code for CDNA3 devices, executable on the following subset of +GFX9 devices: gfx942 and gfx950. (Experimental) + @item gfx1030 Compile for RDNA2 gfx1030 devices (GFX10 series). diff --git a/gcc/doc/riscv-ext.texi b/gcc/doc/riscv-ext.texi index e69a2df..c3ed1bf 100644 --- a/gcc/doc/riscv-ext.texi +++ b/gcc/doc/riscv-ext.texi @@ -520,7 +520,7 @@ @item smrnmi @tab 1.0 -@tab Resumable Non-Maskable Interrupts +@tab Resumable non-maskable interrupts @item smstateen @tab 1.0 diff --git a/gcc/expr.cc b/gcc/expr.cc index b3b46a2..ac4fdfa 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -9681,8 +9681,8 @@ expand_expr_divmod (tree_code code, machine_mode mode, tree treeop0, || code == CEIL_MOD_EXPR || code == ROUND_MOD_EXPR); if (SCALAR_INT_MODE_P (mode) && optimize >= 2 - && get_range_pos_neg (treeop0) == 1 - && get_range_pos_neg (treeop1) == 1) + && get_range_pos_neg (treeop0, currently_expanding_gimple_stmt) == 1 + && get_range_pos_neg (treeop1, currently_expanding_gimple_stmt) == 1) { /* If both arguments are known to be positive when interpreted as signed, we can expand it as both signed and unsigned @@ -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; } @@ -11366,11 +11420,16 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, /* ??? internal call expansion doesn't follow the usual API of returning the destination RTX and being passed a desired target. */ + if (modifier == EXPAND_WRITE) + return DECL_RTL (SSA_NAME_VAR (exp)); rtx dest = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp))); tree tmplhs = make_tree (TREE_TYPE (exp), dest); - gimple_call_set_lhs (g, tmplhs); + tree var_or_id = SSA_NAME_VAR (exp); + if (!var_or_id) + var_or_id = SSA_NAME_IDENTIFIER (exp); + SET_SSA_NAME_VAR_OR_IDENTIFIER (exp, tmplhs); expand_internal_call (as_a <gcall *> (g)); - gimple_call_set_lhs (g, exp); + SET_SSA_NAME_VAR_OR_IDENTIFIER (exp, var_or_id); return dest; } @@ -13217,7 +13276,7 @@ maybe_optimize_pow2p_mod_cmp (enum tree_code code, tree *arg0, tree *arg1) || integer_zerop (*arg1) /* If c is known to be non-negative, modulo will be expanded as unsigned modulo. */ - || get_range_pos_neg (treeop0) == 1) + || get_range_pos_neg (treeop0, currently_expanding_gimple_stmt) == 1) return code; /* x % c == d where d < 0 && d <= -c should be always false. */ @@ -13349,7 +13408,8 @@ maybe_optimize_mod_cmp (enum tree_code code, tree *arg0, tree *arg1) /* If both operands are known to have the sign bit clear, handle even the signed modulo case as unsigned. treeop1 is always positive >= 2, checked above. */ - if (!TYPE_UNSIGNED (type) && get_range_pos_neg (treeop0) != 1) + if (!TYPE_UNSIGNED (type) + && get_range_pos_neg (treeop0, currently_expanding_gimple_stmt) != 1) sgn = SIGNED; if (!TYPE_UNSIGNED (type)) 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 diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc index 99be07e..05491e1 100644 --- a/gcc/gimple-range-edge.cc +++ b/gcc/gimple-range-edge.cc @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "gimple-range.h" #include "value-range-storage.h" +#include "rtl.h" // If there is a range control statement at the end of block BB, return it. // Otherwise return NULL. @@ -39,6 +40,8 @@ along with GCC; see the file COPYING3. If not see gimple * gimple_outgoing_range_stmt_p (basic_block bb) { + if (bb->flags & BB_RTL) + return NULL; gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); if (!gsi_end_p (gsi)) { @@ -190,6 +193,14 @@ gimple_outgoing_range::calc_switch_ranges (gswitch *sw) slot = m_range_allocator->clone (case_range); } + if (default_edge == NULL) + { + /* During expansion the default edge could have been removed + if the default is unreachable. */ + gcc_assert (currently_expanding_to_rtl); + return; + } + vrange_storage *&slot = m_edge_table->get_or_insert (default_edge, &existed); // This should be the first call into this switch. gcc_checking_assert (!existed); 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-range.cc b/gcc/gimple-range.cc index 6b7d4da..e91eeb4 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -200,7 +200,12 @@ gimple_ranger::range_on_exit (vrange &r, basic_block bb, tree name) // If this is not the definition block, get the range on the last stmt in // the block... if there is one. if (def_bb != bb) - s = last_nondebug_stmt (bb); + { + if (bb->flags & BB_RTL) + s = NULL; + else + s = last_nondebug_stmt (bb); + } // If there is no statement provided, get the range_on_entry for this block. if (s) range_of_expr (r, name, s); 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 6b04443..3f4ac93 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -926,7 +926,10 @@ get_min_precision (tree arg, signop sign) { if (TYPE_UNSIGNED (TREE_TYPE (arg))) sign = UNSIGNED; - else if (sign == UNSIGNED && get_range_pos_neg (arg) != 1) + else if (sign == UNSIGNED + && (get_range_pos_neg (arg, + currently_expanding_gimple_stmt) + != 1)) return prec + (orig_sign != sign); prec = TYPE_PRECISION (TREE_TYPE (arg)); } @@ -946,7 +949,8 @@ get_min_precision (tree arg, signop sign) if (TREE_CODE (arg) != SSA_NAME) return prec + (orig_sign != sign); int_range_max r; - while (!get_global_range_query ()->range_of_expr (r, arg) + gimple *cg = currently_expanding_gimple_stmt; + while (!get_range_query (cfun)->range_of_expr (r, arg, cg) || r.varying_p () || r.undefined_p ()) { @@ -963,7 +967,8 @@ get_min_precision (tree arg, signop sign) { if (TYPE_UNSIGNED (TREE_TYPE (arg))) sign = UNSIGNED; - else if (sign == UNSIGNED && get_range_pos_neg (arg) != 1) + else if (sign == UNSIGNED + && get_range_pos_neg (arg, g) != 1) return prec + (orig_sign != sign); prec = TYPE_PRECISION (TREE_TYPE (arg)); } @@ -1301,7 +1306,7 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, unsigned. */ res = expand_binop (mode, sub_optab, op0, op1, NULL_RTX, false, OPTAB_LIB_WIDEN); - int pos_neg = get_range_pos_neg (arg0); + int pos_neg = get_range_pos_neg (arg0, currently_expanding_gimple_stmt); if (pos_neg == 2) /* If ARG0 is known to be always negative, this is always overflow. */ emit_jump (do_error); @@ -1361,10 +1366,11 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, unsigned. */ res = expand_binop (mode, code == PLUS_EXPR ? add_optab : sub_optab, op0, op1, NULL_RTX, false, OPTAB_LIB_WIDEN); - int pos_neg = get_range_pos_neg (arg1); + int pos_neg = get_range_pos_neg (arg1, currently_expanding_gimple_stmt); if (code == PLUS_EXPR) { - int pos_neg0 = get_range_pos_neg (arg0); + int pos_neg0 = get_range_pos_neg (arg0, + currently_expanding_gimple_stmt); if (pos_neg0 != 3 && pos_neg == 3) { std::swap (op0, op1); @@ -1462,10 +1468,11 @@ expand_addsub_overflow (location_t loc, tree_code code, tree lhs, the second operand, as subtraction is not commutative) is always non-negative or always negative, we can do just one comparison and conditional jump. */ - int pos_neg = get_range_pos_neg (arg1); + int pos_neg = get_range_pos_neg (arg1, currently_expanding_gimple_stmt); if (code == PLUS_EXPR) { - int pos_neg0 = get_range_pos_neg (arg0); + int pos_neg0 = get_range_pos_neg (arg0, + currently_expanding_gimple_stmt); if (pos_neg0 != 3 && pos_neg == 3) { std::swap (op0, op1); @@ -1757,8 +1764,8 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1, uns1_p = true; } - int pos_neg0 = get_range_pos_neg (arg0); - int pos_neg1 = get_range_pos_neg (arg1); + int pos_neg0 = get_range_pos_neg (arg0, currently_expanding_gimple_stmt); + int pos_neg1 = get_range_pos_neg (arg1, currently_expanding_gimple_stmt); /* Unsigned types with smaller than mode precision, even if they have most significant bit set, are still zero-extended. */ if (uns0_p && TYPE_PRECISION (TREE_TYPE (arg0)) < GET_MODE_PRECISION (mode)) @@ -2763,9 +2770,9 @@ expand_arith_overflow (enum tree_code code, gimple *stmt) int prec1 = TYPE_PRECISION (TREE_TYPE (arg1)); int precres = TYPE_PRECISION (type); location_t loc = gimple_location (stmt); - if (!uns0_p && get_range_pos_neg (arg0) == 1) + if (!uns0_p && get_range_pos_neg (arg0, stmt) == 1) uns0_p = true; - if (!uns1_p && get_range_pos_neg (arg1) == 1) + if (!uns1_p && get_range_pos_neg (arg1, stmt) == 1) uns1_p = true; int pr = get_min_precision (arg0, uns0_p ? UNSIGNED : SIGNED); prec0 = MIN (prec0, pr); @@ -5554,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) { @@ -5596,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 73cf904..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; } @@ -4666,19 +4666,12 @@ update_counts_for_self_gen_clones (cgraph_node *orig_node, unsigned i = 0; for (cgraph_node *n : self_gen_clones) { - profile_count orig_count = n->count; 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->count = new_count; - profile_count::adjust_for_ipa_scaling (&new_count, &orig_count); + n->scale_profile_to (new_count); for (cgraph_edge *cs = n->callees; cs; cs = cs->next_callee) - { - cs->count = cs->count.apply_scale (new_count, orig_count); - processed_edges.add (cs); - } - for (cgraph_edge *cs = n->indirect_calls; cs; cs = cs->next_callee) - cs->count = cs->count.apply_scale (new_count, orig_count); + processed_edges.add (cs); i++; } @@ -4776,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 ()) @@ -4811,20 +4800,10 @@ update_profiling_info (struct cgraph_node *orig_node, /* The NEW_NODE count and counts of all its outgoing edges are still unmodified copies of ORIG_NODE's. Just clear the latter and bail out. */ - profile_count zero; if (opt_for_fn (orig_node->decl, flag_profile_partial_training)) - zero = profile_count::zero ().guessed_local (); + orig_node->make_profile_local (); else - zero = profile_count::adjusted_zero (); - orig_node->count = zero; - for (cgraph_edge *cs = orig_node->callees; - cs; - cs = cs->next_callee) - cs->count = zero; - for (cgraph_edge *cs = orig_node->indirect_calls; - cs; - cs = cs->next_callee) - cs->count = zero; + orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED); return; } } @@ -4873,27 +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); - new_node->count = new_sum; - orig_node->count = remainder; - - profile_count orig_new_node_count = orig_node_count; - profile_count::adjust_for_ipa_scaling (&new_sum, &orig_new_node_count); - for (cgraph_edge *cs = new_node->callees; cs; cs = cs->next_callee) - cs->count = cs->count.apply_scale (new_sum, orig_new_node_count); - for (cgraph_edge *cs = new_node->indirect_calls; cs; cs = cs->next_callee) - cs->count = cs->count.apply_scale (new_sum, orig_new_node_count); + new_node->scale_profile_to (new_sum); if (!orig_edges_processed) - { - profile_count::adjust_for_ipa_scaling (&remainder, &orig_node_count); - for (cgraph_edge *cs = orig_node->callees; cs; cs = cs->next_callee) - cs->count = cs->count.apply_scale (remainder, orig_node_count); - for (cgraph_edge *cs = orig_node->indirect_calls; - cs; - cs = cs->next_callee) - cs->count = cs->count.apply_scale (remainder, orig_node_count); - } + orig_node->scale_profile_to (remainder); if (dump_file) { @@ -4911,35 +4873,23 @@ update_specialized_profile (struct cgraph_node *new_node, struct cgraph_node *orig_node, profile_count redirected_sum) { - struct cgraph_edge *cs; - profile_count new_node_count, orig_node_count = orig_node->count.ipa (); - if (dump_file) { fprintf (dump_file, " the sum of counts of redirected edges is "); redirected_sum.dump (dump_file); fprintf (dump_file, "\n old ipa count of the original node is "); - orig_node_count.dump (dump_file); + orig_node->count.dump (dump_file); fprintf (dump_file, "\n"); } - if (!orig_node_count.nonzero_p ()) + if (!orig_node->count.ipa ().nonzero_p () + || !redirected_sum.nonzero_p ()) return; - new_node_count = new_node->count; - new_node->count += redirected_sum; - orig_node->count - = lenient_count_portion_handling (orig_node->count - redirected_sum, - orig_node); + orig_node->scale_profile_to + (lenient_count_portion_handling (orig_node->count.ipa () - redirected_sum, + orig_node)); - for (cs = new_node->callees; cs; cs = cs->next_callee) - cs->count += cs->count.apply_scale (redirected_sum, new_node_count); - - for (cs = orig_node->callees; cs; cs = cs->next_callee) - { - profile_count dec = cs->count.apply_scale (redirected_sum, - orig_node_count); - cs->count -= dec; - } + 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 46b8e5b..07a1024 100644 --- a/gcc/ipa-inline-transform.cc +++ b/gcc/ipa-inline-transform.cc @@ -58,27 +58,6 @@ along with GCC; see the file COPYING3. If not see int ncalls_inlined; int nfunctions_inlined; -/* Scale counts of NODE edges by NUM/DEN. */ - -static void -update_noncloned_counts (struct cgraph_node *node, - profile_count num, profile_count den) -{ - struct cgraph_edge *e; - - profile_count::adjust_for_ipa_scaling (&num, &den); - - for (e = node->callees; e; e = e->next_callee) - { - if (!e->inline_failed) - update_noncloned_counts (e->callee, num, den); - e->count = e->count.apply_scale (num, den); - } - for (e = node->indirect_calls; e; e = e->next_callee) - e->count = e->count.apply_scale (num, den); - node->count = node->count.apply_scale (num, den); -} - /* We removed or are going to remove the last call to NODE. Return true if we can and want proactively remove the NODE now. This is important to do, since we want inliner to know when offline @@ -93,7 +72,7 @@ can_remove_node_now_p_1 (struct cgraph_node *node, struct cgraph_edge *e) { cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring); if ((alias->callers && alias->callers != e) - || !can_remove_node_now_p_1 (alias, e)) + || !can_remove_node_now_p_1 (alias, e)) return false; } /* FIXME: When address is taken of DECL_EXTERNAL function we still @@ -212,7 +191,10 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, } duplicate = false; e->callee->externally_visible = false; - update_noncloned_counts (e->callee, 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/libgdiagnostics.cc b/gcc/libgdiagnostics.cc index 70b0f36..29f63eb 100644 --- a/gcc/libgdiagnostics.cc +++ b/gcc/libgdiagnostics.cc @@ -307,45 +307,45 @@ public: gcc_unreachable (); case DIAGNOSTIC_LOGICAL_LOCATION_KIND_FUNCTION: - return LOGICAL_LOCATION_KIND_FUNCTION; + return logical_location_kind::function; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_MEMBER: - return LOGICAL_LOCATION_KIND_MEMBER; + return logical_location_kind::member; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_MODULE: - return LOGICAL_LOCATION_KIND_MODULE; + return logical_location_kind::module_; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_NAMESPACE: - return LOGICAL_LOCATION_KIND_NAMESPACE; + return logical_location_kind::namespace_; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_TYPE: - return LOGICAL_LOCATION_KIND_TYPE; + return logical_location_kind::type; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_RETURN_TYPE: - return LOGICAL_LOCATION_KIND_RETURN_TYPE; + return logical_location_kind::return_type; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_PARAMETER: - return LOGICAL_LOCATION_KIND_PARAMETER; + return logical_location_kind::parameter; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_VARIABLE: - return LOGICAL_LOCATION_KIND_VARIABLE; + return logical_location_kind::variable; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_ELEMENT: - return LOGICAL_LOCATION_KIND_ELEMENT; + return logical_location_kind::element; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_ATTRIBUTE: - return LOGICAL_LOCATION_KIND_ATTRIBUTE; + return logical_location_kind::attribute; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_TEXT: - return LOGICAL_LOCATION_KIND_TEXT; + return logical_location_kind::text; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_COMMENT: - return LOGICAL_LOCATION_KIND_COMMENT; + return logical_location_kind::comment; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_PROCESSING_INSTRUCTION: - return LOGICAL_LOCATION_KIND_PROCESSING_INSTRUCTION; + return logical_location_kind::processing_instruction; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_DTD: - return LOGICAL_LOCATION_KIND_DTD; + return logical_location_kind::dtd; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_DECLARATION: - return LOGICAL_LOCATION_KIND_DECLARATION; + return logical_location_kind::declaration; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_OBJECT: - return LOGICAL_LOCATION_KIND_OBJECT; + return logical_location_kind::object; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_ARRAY: - return LOGICAL_LOCATION_KIND_ARRAY; + return logical_location_kind::array; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_PROPERTY: - return LOGICAL_LOCATION_KIND_PROPERTY; + return logical_location_kind::property; case DIAGNOSTIC_LOGICAL_LOCATION_KIND_VALUE: - return LOGICAL_LOCATION_KIND_VALUE; + return logical_location_kind::value; } } @@ -1191,10 +1191,10 @@ sarif_sink::sarif_sink (diagnostic_manager &mgr, auto serialization = std::make_unique<sarif_serialization_format_json> (true); auto inner_sink = make_sarif_sink (mgr.get_dc (), *mgr.get_line_table (), - main_input_file->get_name (), std::move (serialization), sarif_gen_opts, std::move (output_file)); + inner_sink->set_main_input_filename (main_input_file->get_name ()); mgr.get_dc ().add_sink (std::move (inner_sink)); } diff --git a/gcc/logical-location.h b/gcc/logical-location.h index dba9dc4..3522934 100644 --- a/gcc/logical-location.h +++ b/gcc/logical-location.h @@ -29,34 +29,34 @@ along with GCC; see the file COPYING3. If not see Roughly corresponds to logicalLocation's "kind" property in SARIF v2.1.0 (section 3.33.7). */ -enum logical_location_kind +enum class logical_location_kind { - LOGICAL_LOCATION_KIND_UNKNOWN, + unknown, /* Kinds within executable code. */ - LOGICAL_LOCATION_KIND_FUNCTION, - LOGICAL_LOCATION_KIND_MEMBER, - LOGICAL_LOCATION_KIND_MODULE, - LOGICAL_LOCATION_KIND_NAMESPACE, - LOGICAL_LOCATION_KIND_TYPE, - LOGICAL_LOCATION_KIND_RETURN_TYPE, - LOGICAL_LOCATION_KIND_PARAMETER, - LOGICAL_LOCATION_KIND_VARIABLE, + function, + member, + module_, + namespace_, + type, + return_type, + parameter, + variable, /* Kinds within XML or HTML documents. */ - LOGICAL_LOCATION_KIND_ELEMENT, - LOGICAL_LOCATION_KIND_ATTRIBUTE, - LOGICAL_LOCATION_KIND_TEXT, - LOGICAL_LOCATION_KIND_COMMENT, - LOGICAL_LOCATION_KIND_PROCESSING_INSTRUCTION, - LOGICAL_LOCATION_KIND_DTD, - LOGICAL_LOCATION_KIND_DECLARATION, + element, + attribute, + text, + comment, + processing_instruction, + dtd, + declaration, /* Kinds within JSON documents. */ - LOGICAL_LOCATION_KIND_OBJECT, - LOGICAL_LOCATION_KIND_ARRAY, - LOGICAL_LOCATION_KIND_PROPERTY, - LOGICAL_LOCATION_KIND_VALUE + object, + array, + property, + value }; /* We want to efficiently support passing around logical locations in the diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 94eb65f..1037f5c 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,19 @@ +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 + * gm2-compiler/M2Quads.mod (ForLoopLastIterator): Dereference + start and end expressions e1 and e2 respectively. + 2025-06-07 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/119650 diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index b5455d0..748ce24 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -4646,6 +4646,8 @@ BEGIN BySym) ; MetaErrorDecl (BySym, TRUE) ELSE + e1 := DereferenceLValue (e1tok, e1) ; + e2 := DereferenceLValue (e2tok, e2) ; GenQuadOTypetok (bytok, LastForIteratorOp, LastIterator, Make2Tuple (e1, e2), BySym, FALSE, FALSE, bytok, MakeVirtual2Tok (e1tok, e2tok), bytok) 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/opts-diagnostic.cc b/gcc/opts-diagnostic.cc index 3a1dc52..3629f17 100644 --- a/gcc/opts-diagnostic.cc +++ b/gcc/opts-diagnostic.cc @@ -531,7 +531,6 @@ sarif_scheme_handler::make_sink (const context &ctxt, auto sink = make_sarif_sink (ctxt.m_dc, *line_table, - ctxt.m_opts.x_main_input_filename, std::move (serialization_obj), sarif_gen_opts, std::move (output_file)); @@ -633,6 +632,7 @@ handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts, if (!sink) return; + sink->set_main_input_filename (opts.x_main_input_filename); dc.add_sink (std::move (sink)); } @@ -657,6 +657,7 @@ handle_OPT_fdiagnostics_set_output_ (const gcc_options &opts, if (!sink) return; + sink->set_main_input_filename (opts.x_main_input_filename); dc.set_output_format (std::move (sink)); } diff --git a/gcc/params.opt b/gcc/params.opt index 1f0abec..a67f900 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -1253,6 +1253,10 @@ The maximum factor which the loop vectorizer applies to the cost of statements i Common Joined UInteger Var(param_vect_induction_float) Init(1) IntegerRange(0, 1) Param Optimization Enable loop vectorization of floating point inductions. +-param=vect-scalar-cost-multiplier= +Common Joined UInteger Var(param_vect_scalar_cost_multiplier) Init(100) IntegerRange(0, 10000) Param Optimization +The scaling multiplier as a percentage to apply to all scalar loop costing when performing vectorization profitability analysis. The default value is 100. + -param=vrp-block-limit= Common Joined UInteger Var(param_vrp_block_limit) Init(150000) Optimization Param Maximum number of basic blocks before VRP switches to a fast model with less memory requirements. diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc index 22c109a..e857cdd 100644 --- a/gcc/profile-count.cc +++ b/gcc/profile-count.cc @@ -94,9 +94,16 @@ profile_count::dump (FILE *f, struct function *fun) const else if (fun && initialized_p () && fun->cfg && ENTRY_BLOCK_PTR_FOR_FN (fun)->count.initialized_p ()) - fprintf (f, "%" PRId64 " (%s, freq %.4f)", m_val, - profile_quality_display_names[m_quality], - to_sreal_scale (ENTRY_BLOCK_PTR_FOR_FN (fun)->count).to_double ()); + { + if (compatible_p (ENTRY_BLOCK_PTR_FOR_FN (fun)->count)) + fprintf (f, "%" PRId64 " (%s, freq %.4f)", m_val, + profile_quality_display_names[m_quality], + to_sreal_scale + (ENTRY_BLOCK_PTR_FOR_FN (fun)->count).to_double ()); + else + fprintf (f, "%" PRId64 " (%s, incompatible with entry block count)", + m_val, profile_quality_display_names[m_quality]); + } else fprintf (f, "%" PRId64 " (%s)", m_val, profile_quality_display_names[m_quality]); diff --git a/gcc/selftest-logical-location.cc b/gcc/selftest-logical-location.cc index 5f33b48..63b9fb4 100644 --- a/gcc/selftest-logical-location.cc +++ b/gcc/selftest-logical-location.cc @@ -90,7 +90,7 @@ test_logical_location_manager::item_from_funcname (const char *funcname) if (item **slot = m_name_to_item_map.get (funcname)) return *slot; - item *i = new item (LOGICAL_LOCATION_KIND_FUNCTION, funcname); + item *i = new item (logical_location_kind::function, funcname); m_name_to_item_map.put (funcname, i); return i; } 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/stmt.cc b/gcc/stmt.cc index fa0c5d4..a510f8f 100644 --- a/gcc/stmt.cc +++ b/gcc/stmt.cc @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "dumpfile.h" #include "builtins.h" +#include "cfgexpand.h" /* Functions and data structures for expanding case statements. */ @@ -1025,7 +1026,7 @@ expand_case (gswitch *stmt) && gimple_seq_unreachable_p (bb_seq (default_edge->dest))) { default_label = NULL; - remove_edge (default_edge); + expand_remove_edge (default_edge); default_edge = NULL; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6de86ef..b2a24d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,273 @@ +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 + * gcc.dg/pr120510.c + +2025-06-09 Iain Sandoe <iain@sandoe.co.uk> + + PR c++/120495 + PR c++/115605 + * g++.dg/coroutines/pr120495.C: New test. + * g++.dg/pr115605.C: New test. + +2025-06-09 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/120606 + * gm2/pim/pass/forarray.mod: New test. + +2025-06-09 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/119779 + * gm2.dg/doc/examples/run/pass/doc-examples-run-pass.exp: New test. + * gm2.dg/doc/examples/run/pass/exampleadd2.mod: New test. + +2025-06-09 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * gcc.dg/html-output/missing-semicolon.py: Update expected <title> + text. Drop out-of-date comment. + +2025-06-09 Alfie Richards <alfie.richards@arm.com> + + PR testsuite/120519 + * g++.target/powerpc/mvc-symbols1.C: Modify tests. + * g++.target/powerpc/mvc-symbols2.C: Ditto. + * g++.target/powerpc/mvc-symbols3.C: Ditto. + * g++.target/powerpc/mvc-symbols4.C: Ditto. + +2025-06-09 Tamar Christina <tamar.christina@arm.com> + + * gcc.target/aarch64/sve/cost_model_16.c: New test. + +2025-06-09 liuhongt <hongtao.liu@intel.com> + + * gcc.target/i386/avx512f-pr103750-3.c: New test. + +2025-06-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check + for vrem.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-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check + for vrem.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_data.h: Add test + data for run test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i8.c: New test. + +2025-06-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Adjust the + asm check for vrem. + * gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto. + +2025-06-08 Kugan Vivekanandarajah <kvivekananda@nvidia.com> + + * gcc.dg/tree-prof/clone-merge-1.c: Enable only for + -fauto-profile. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + PR target/120203 + * gcc.target/riscv/rvv/base/float-point-dynamic-frm-74.c: Expect + an additional FRRM. + +2025-06-08 Vineet Gupta <vineetg@rivosinc.com> + + PR target/119164 + * gcc.target/riscv/rvv/base/pr119164.c: New test. + +2025-06-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/120533 + * gcc.dg/tree-ssa/pr35286.c: Add -fno-ssa-phiopt. + * gcc.dg/tree-ssa/split-path-6.c: Likewise. + * gcc.dg/tree-ssa/split-path-7.c: Likewise. + * gcc.dg/tree-ssa/phiprop-2.c: Move the check for MIN_EXPR to phiopt1. + 2025-06-07 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/119650 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/pr120495.C b/gcc/testsuite/g++.dg/coroutines/pr120495.C new file mode 100644 index 0000000..f59c34a --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr120495.C @@ -0,0 +1,55 @@ +// { dg-additional-options "-fsyntax-only" } + +#include <coroutine> +#include <exception> + +struct fire_and_forget { +}; + +template <typename... Args> +struct std::coroutine_traits<fire_and_forget, Args...> +{ + struct promise_type + { + fire_and_forget get_return_object() const noexcept + { + return{}; + } + + void return_void() const noexcept + { + } + + suspend_never initial_suspend() const noexcept + { + return{}; + } + + suspend_never final_suspend() const noexcept + { + return{}; + } + + void unhandled_exception() const noexcept + { + std::terminate(); + } + }; +}; + +struct foo +{ + fire_and_forget bar() + { + co_await std::suspend_always{ }; + } + +private: + // The line below triggered the error. + using coroutine_handle = std::coroutine_handle<>; +}; + +int main() +{ + foo{}.bar(); +} 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++.dg/pr115605.C b/gcc/testsuite/g++.dg/pr115605.C new file mode 100644 index 0000000..9e34255 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr115605.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++20 } } + +#include <array> + +int foo() { + int const tuple_size = 5; + std::array<int, 3> array {1, 2, 3}; + auto [a, b, c] = array; + return c; +} 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/g++.target/powerpc/mvc-symbols1.C b/gcc/testsuite/g++.target/powerpc/mvc-symbols1.C index 9424382..ba5492a 100644 --- a/gcc/testsuite/g++.target/powerpc/mvc-symbols1.C +++ b/gcc/testsuite/g++.target/powerpc/mvc-symbols1.C @@ -28,20 +28,14 @@ int bar(int x) /* { dg-final { scan-assembler-times "\n_Z3foov\.cpu_power6:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3foov\.cpu_power6x:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\tbl _Z3foov\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl _Z3foov(\n|@)" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6x\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.default:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6x:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\tbl _Z3fooi\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl _Z3fooi(\n|@)" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6x\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/powerpc/mvc-symbols2.C b/gcc/testsuite/g++.target/powerpc/mvc-symbols2.C index edf5448..fe96dc4 100644 --- a/gcc/testsuite/g++.target/powerpc/mvc-symbols2.C +++ b/gcc/testsuite/g++.target/powerpc/mvc-symbols2.C @@ -20,9 +20,6 @@ int foo (int) /* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6x\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.default:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6:\n" 1 } } */ @@ -30,6 +27,3 @@ int foo (int) /* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6x\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/powerpc/mvc-symbols3.C b/gcc/testsuite/g++.target/powerpc/mvc-symbols3.C index ca79c7f..c44acaf 100644 --- a/gcc/testsuite/g++.target/powerpc/mvc-symbols3.C +++ b/gcc/testsuite/g++.target/powerpc/mvc-symbols3.C @@ -22,20 +22,14 @@ int bar(int x) /* { dg-final { scan-assembler-times "\n_Z3foov\.cpu_power6:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3foov\.cpu_power6x:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\tbl _Z3foov\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl _Z3foov(\n|@)" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.cpu_power6x\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.default:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6x:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\tbl _Z3fooi\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl _Z3fooi(\n|@)" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3foov\.default\n" 1 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\t\.quad\t_Z3fooi\.cpu_power6x\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/powerpc/mvc-symbols4.C b/gcc/testsuite/g++.target/powerpc/mvc-symbols4.C index ec111f5..fe558f9 100644 --- a/gcc/testsuite/g++.target/powerpc/mvc-symbols4.C +++ b/gcc/testsuite/g++.target/powerpc/mvc-symbols4.C @@ -14,9 +14,6 @@ int foo (int); /* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 0 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3foov\.default@ha\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3foov\.cpu_power6@ha\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3foov\.cpu_power6x@ha\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.default:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n_Z3fooi\.cpu_power6:\n" 0 } } */ @@ -24,6 +21,3 @@ int foo (int); /* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ /* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 0 } } */ /* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3fooi\.default@ha\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3fooi\.cpu_power6@ha\n" 0 } } */ -/* { dg-final { scan-assembler-times "\n\tlis \[\\d\]+,_Z3fooi\.cpu_power6x@ha\n" 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 02ff84c..3adaa52 100644 --- a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py +++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py @@ -26,7 +26,7 @@ def test_basics(html_tree): assert head is not None title = head.find('xhtml:title', ns) - assert title.text == 'Title goes here' + assert title.text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c') body = root.find('xhtml:body', ns) assert body is not None @@ -37,45 +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') - pre = diag.find('xhtml:pre', ns) + 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' + + # 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('--- ') - -# For reference, here's the generated HTML: -""" -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>Title goes here</title> - </head> - <body> - <div class="gcc-diagnostic-list"> - <div class="gcc-diagnostic"> - <span class="gcc-message">expected '<span class="gcc-quoted-text">;</span>' before '<span class="gcc-quoted-text">}</span>' token</span> - <pre class="gcc-generated-patch"> - [...snip...] - </pre> - </div> - </div> - </body> -</html> -""" 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/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/pr120510.c b/gcc/testsuite/gcc.dg/pr120510.c new file mode 100644 index 0000000..d99c329 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120510.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c23" } */ + +void f (int [_Atomic]); +void f (int [_Atomic]); +void f (int [_Atomic]); + 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/cost_model_16.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_16.c new file mode 100644 index 0000000..bfe49ef --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_16.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -march=armv8-a+sve --param vect-scalar-cost-multiplier=1000 -fdump-tree-vect-details" } */ + +void +foo (char *restrict a, int *restrict b, int *restrict c, + int *restrict d, int stride) +{ + if (stride <= 1) + return; + + for (int i = 0; i < 3; i++) + { + int res = c[i]; + int t = b[i * stride]; + if (a[i] != 0) + res = t * d[i]; + c[i] = res; + } +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr103750-3.c b/gcc/testsuite/gcc.target/i386/avx512f-pr103750-3.c new file mode 100644 index 0000000..9965e63 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr103750-3.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64-v4 -mprefer-vector-width=256 -Ofast" } */ +/* { dg-final { scan-assembler-not "kmov" } } */ + +void +foo (double* a, double* __restrict b, double* c, double* d, int n) +{ + for (int i = 0; i != n; i++) + { + double tmp = 0.0; + if (c[i] > d[i]) + tmp = b[i]; + a[i] = tmp; + } +} + +void +foo1 (double* a, double* __restrict b, double* c, double* d, int n) +{ + for (int i = 0; i != n; i++) + { + double tmp = 0.0; + if (c[i] > d[i]) + a[i] = b[i]; + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr120434-1.c b/gcc/testsuite/gcc.target/i386/pr120434-1.c new file mode 100644 index 0000000..889b6f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120434-1.c @@ -0,0 +1,28 @@ +/* PR middle-end/120434 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic -masm=att" } */ +/* { dg-final { scan-assembler-times "\tsar\[lq]\t" 2 } } */ +/* { dg-final { scan-assembler-times "\tshr\[lq]\t" 2 } } */ + +[[gnu::noipa]] int +foo (int x) +{ + return x / 200; +} + +[[gnu::noipa]] int +bar (int x) +{ + if (x < 0) + __builtin_unreachable (); + return x / 200; +} + +[[gnu::noipa]] int +baz (int x) +{ + if (x >= 0) + return x / 200; + else + return 24; +} 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/binop/vrem-rv32gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c index a87a6c7..10de7c2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c @@ -2,10 +2,10 @@ #include "vrem-template.h" -/* { dg-final { scan-assembler-times {\tvrem\.vv} 5 } } */ -/* { dg-final { scan-assembler-times {\tvrem\.vx} 3 } } */ -/* { dg-final { scan-assembler-times {\tvremu\.vv} 5 } } */ -/* { dg-final { scan-assembler-times {\tvremu\.vx} 3 } } */ +/* { dg-final { scan-assembler-times {\tvrem\.vv} 8 } } */ +/* { dg-final { scan-assembler-not {\tvrem\.vx} } } */ +/* { dg-final { scan-assembler-times {\tvremu\.vv} 8 } } */ +/* { dg-final { scan-assembler-not {\tvremu\.vx} } } */ /* { dg-final { scan-tree-dump-times "\.COND_LEN_MOD" 16 "optimized" } } */ /* { dg-final { scan-assembler-not {\tvmv1r\.v} } } */ /* { dg-final { scan-assembler-not {\tvmv2r\.v} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c index 9381695..cf187a2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c @@ -3,10 +3,10 @@ #include "vrem-template.h" -/* { dg-final { scan-assembler-times {\tvrem\.vv} 4 } } */ -/* { dg-final { scan-assembler-times {\tvrem\.vx} 4 } } */ -/* { dg-final { scan-assembler-times {\tvremu\.vv} 4 } } */ -/* { dg-final { scan-assembler-times {\tvremu\.vx} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrem\.vv} 8 } } */ +/* { dg-final { scan-assembler-not {\tvrem\.vx} } } */ +/* { dg-final { scan-assembler-times {\tvremu\.vv} 8 } } */ +/* { dg-final { scan-assembler-not {\tvremu\.vx} } } */ /* { dg-final { scan-tree-dump-times "\.COND_LEN_MOD" 16 "optimized" } } */ /* { dg-final { scan-assembler-not {\tvmv1r\.v} } } */ /* { dg-final { scan-assembler-not {\tvmv2r\.v} } } */ 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 d88e76b..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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 } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { 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 53189c2..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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 } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { 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 5059beb..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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 } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { 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 4bbe5a4..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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 } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c index 92fbf22..474fed2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c index f487b42..28c0524 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c index 761d25c..62c1ee9 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c index 0018bd2..657d240 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ /* { dg-final { scan-assembler-times {vsub.vx} 1 } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-times {vor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vxor.vx} 1 } } */ /* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */ +/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */ 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 0437db4..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 95ed403..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 f8912a0..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 3c8f915..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c index 554acac..ded783d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c index 0e74a3b..5eba85c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c index 8e831ce..563e439 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c index dad7562..3a78163 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.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 f49dae4..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 8f502a3..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 3277bf2..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 25ed2ad..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_0_WRAP(T, |, or) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c index 873fbf3..87c2b9f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c index cbf35e1..998e0d5 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c index 3ccf42b..9511cc2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c index 50825ef..d7524d7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_0_WRAP(T, &, and) DEF_VX_BINARY_CASE_0_WRAP(T, |, or) DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor) DEF_VX_BINARY_CASE_0_WRAP(T, /, div) +DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, /, div) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.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 1e409de..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 2f242c7..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 f027bd8..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 c4f55b0..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c index 58e4a1e..16ccaea 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c index 3d5f535..0e2ab8d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c index 0edb925..80eb8a4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c index 5a3c114..585628b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.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 d6b05bc..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X8) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 e1c043f..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 1beb914..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 0291517..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c index 2559935..8012783 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c index 594093f..c794b30 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c index a5be019..86fb19a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c index e0220ca..b783d87 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.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 c22c82d..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X8) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 dc35600..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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 cee1e3a..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { 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 74fd2fb..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 @@ -13,6 +13,9 @@ DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) 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} } } */ @@ -22,3 +25,5 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vxor.vx} } } */ /* { 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-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c index d6a3510..6080582 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X8) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c index 2886e3b..7963e3c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X4) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c index c9ece25..4edbb93 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler-not {vadd.vx} } } */ /* { dg-final { scan-assembler-not {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY) /* { dg-final { scan-assembler-not {vor.vx} } } */ /* { dg-final { scan-assembler-not {vxor.vx} } } */ /* { dg-final { scan-assembler-not {vdivu.vx} } } */ +/* { dg-final { scan-assembler-not {vremu.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c index 87a3ef8..055ef8c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c @@ -12,6 +12,7 @@ DEF_VX_BINARY_CASE_1_WRAP(T, &, and, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, |, or, VX_BINARY_BODY_X16) DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, 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) /* { dg-final { scan-assembler {vadd.vx} } } */ /* { dg-final { scan-assembler {vsub.vx} } } */ @@ -20,3 +21,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16) /* { dg-final { scan-assembler {vor.vx} } } */ /* { dg-final { scan-assembler {vxor.vx} } } */ /* { dg-final { scan-assembler {vdivu.vx} } } */ +/* { dg-final { scan-assembler {vremu.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 5130709..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 @@ -2946,4 +2946,592 @@ uint64_t TEST_BINARY_DATA(uint64_t, div)[][3][N] = }, }; +int8_t TEST_BINARY_DATA(int8_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + -1, -1, -1, -1, + 0, 0, 0, 0, + }, + }, + { + { 127 }, + { + 127, 127, 127, 127, + -1, -1, -1, -1, + -128, -128, -128, -128, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + }, + { + { -128 }, + { + -128, -128, -128, -128, + 1, 1, 1, 1, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + }, +}; + +int16_t TEST_BINARY_DATA(int16_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + -1, -1, -1, -1, + 0, 0, 0, 0, + }, + }, + { + { 32767 }, + { + 32767, 32767, 32767, 32767, + -1, -1, -1, -1, + -32768, -32768, -32768, -32768, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + }, + { + { -32768 }, + { + -32768, -32768, -32768, -32768, + 1, 1, 1, 1, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + }, +}; + +int32_t TEST_BINARY_DATA(int32_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + -1, -1, -1, -1, + 0, 0, 0, 0, + }, + }, + { + { 2147483647 }, + { + 2147483647, 2147483647, 2147483647, 2147483647, + -1, -1, -1, -1, + -2147483648, -2147483648, -2147483648, -2147483648, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + }, + { + { -2147483648 }, + { + -2147483648, -2147483648, -2147483648, -2147483648, + 1, 1, 1, 1, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + }, +}; + +int64_t TEST_BINARY_DATA(int64_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + -1, -1, -1, -1, + 0, 0, 0, 0, + }, + }, + { + { 9223372036854775807ll }, + { + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + -1, -1, -1, -1, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + -2, -2, -2, -2, + }, + { + 0, 0, 0, 0, + -1, -1, -1, -1, + -1, -1, -1, -1, + -2, -2, -2, -2, + }, + }, + { + { -9223372036854775808ull }, + { + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + 1, 1, 1, 1, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 2, 2, 2, 2, + }, + }, +}; + +uint8_t TEST_BINARY_DATA(uint8_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 8, 8, 8, 8, + 7, 7, 7, 7, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 0, 0, 0, 0, + 1, 1, 1, 1, + }, + }, + { + { 127 }, + { + 127, 127, 127, 127, + 1, 1, 1, 1, + 128, 128, 128, 128, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 1, 1, 1, 1, + 2, 2, 2, 2, + }, + }, + { + { 128 }, + { + 128, 128, 128, 128, + 255, 255, 255, 255, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 127, 127, 127, 127, + 127, 127, 127, 127, + 2, 2, 2, 2, + }, + }, +}; + +uint16_t TEST_BINARY_DATA(uint16_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 8, 8, 8, 8, + 7, 7, 7, 7, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 0, 0, 0, 0, + 1, 1, 1, 1, + }, + }, + { + { 32767 }, + { + 32767, 32767, 32767, 32767, + 1, 1, 1, 1, + 32768, 32768, 32768, 32768, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 1, 1, 1, 1, + 2, 2, 2, 2, + }, + }, + { + { 32768 }, + { + 32768, 32768, 32768, 32768, + 65535, 65535, 65535, 65535, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + 2, 2, 2, 2, + }, + }, +}; + +uint32_t TEST_BINARY_DATA(uint32_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 8, 8, 8, 8, + 7, 7, 7, 7, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 0, 0, 0, 0, + 1, 1, 1, 1, + }, + }, + { + { 2147483647 }, + { + 2147483647, 2147483647, 2147483647, 2147483647, + 1, 1, 1, 1, + 2147483648, 2147483648, 2147483648, 2147483648, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 1, 1, 1, 1, + 2, 2, 2, 2, + }, + }, + { + { 2147483648 }, + { + 2147483648, 2147483648, 2147483648, 2147483648, + 4294967295, 4294967295, 4294967295, 4294967295, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + 2, 2, 2, 2, + }, + }, +}; + +uint64_t TEST_BINARY_DATA(uint64_t, rem)[][3][N] = +{ + { + { 2 }, + { + 2, 2, 2, 2, + 1, 1, 1, 1, + 8, 8, 8, 8, + 7, 7, 7, 7, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 0, 0, 0, 0, + 1, 1, 1, 1, + }, + }, + { + { 9223372036854775807ull }, + { + 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, + 1, 1, 1, 1, + 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 1, 1, 1, 1, + 1, 1, 1, 1, + 2, 2, 2, 2, + }, + }, + { + { 9223372036854775808ull }, + { + 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, + 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, + 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, + 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, + 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, + 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, + 2, 2, 2, 2, + }, + }, +}; + +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/autovec/vx_vf/vx_vrem-run-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i16.c new file mode 100644 index 0000000..4320789 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i16.c @@ -0,0 +1,15 @@ +/* { 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 rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i32.c new file mode 100644 index 0000000..43a001b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i32.c @@ -0,0 +1,15 @@ +/* { 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 rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i64.c new file mode 100644 index 0000000..2e9b43a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i64.c @@ -0,0 +1,15 @@ +/* { 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 rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i8.c new file mode 100644 index 0000000..d4185c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i8.c @@ -0,0 +1,15 @@ +/* { 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 rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c new file mode 100644 index 0000000..46e74f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c @@ -0,0 +1,15 @@ +/* { 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 uint16_t +#define NAME rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c new file mode 100644 index 0000000..94e3613 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c @@ -0,0 +1,15 @@ +/* { 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 uint32_t +#define NAME rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c new file mode 100644 index 0000000..566a1a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c @@ -0,0 +1,15 @@ +/* { 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 uint64_t +#define NAME rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, out, in, x, n) + +#include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c new file mode 100644 index 0000000..1532079 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c @@ -0,0 +1,15 @@ +/* { 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 uint8_t +#define NAME rem + +DEF_VX_BINARY_CASE_0_WRAP(T, %, NAME) + +#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME) +#define TEST_RUN(T, NAME, out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(T, NAME, 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/gcc.target/riscv/ventana-16122.c b/gcc/testsuite/gcc.target/riscv/ventana-16122.c new file mode 100644 index 0000000..59e6467 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/ventana-16122.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { rv64 } } } */ + +extern void NG (void); +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +void f74(void) { + int16_t x309 = 0x7fff; + volatile int32_t x310 = 0x7fffffff; + int8_t x311 = 59; + int16_t x312 = -0x8000; + static volatile int32_t t74 = 614992577; + + t74 = (x309==((x310^x311)%x312)); + + if (t74 != 0) { NG(); } else { ; } + +} + diff --git a/gcc/testsuite/gm2.dg/doc/examples/run/pass/doc-examples-run-pass.exp b/gcc/testsuite/gm2.dg/doc/examples/run/pass/doc-examples-run-pass.exp new file mode 100644 index 0000000..6fb7d6e --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/run/pass/doc-examples-run-pass.exp @@ -0,0 +1,17 @@ +# Compile tests, no torture testing. +# +# These tests should all pass. + +# Load support procs. +load_lib gm2-dg.exp + +gm2_init_pim4 $srcdir/$subdir -masm=intel + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] "" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gm2.dg/doc/examples/run/pass/exampleadd2.mod b/gcc/testsuite/gm2.dg/doc/examples/run/pass/exampleadd2.mod new file mode 100644 index 0000000..8bab299 --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/run/pass/exampleadd2.mod @@ -0,0 +1,35 @@ +(* { dg-do assemble { target { x86_64-*-gnu* } } } *) +(* { dg-options "-masm=intel" } *) +(* { dg-do run { target x86_64-*-gnu* } } *) + +MODULE exampleadd2 ; + +FROM libc IMPORT printf, exit ; + + +PROCEDURE Example (foo, bar: LONGCARD) : CARDINAL ; +VAR + myout: LONGCARD ; +BEGIN + ASM VOLATILE ( + "mov rax, %[left]; add rax, %[right]; mov %[output], rax;" + : [output] "=rm" (myout) (* outputs *) + : [left] "rm" (foo), [right] "rm" (bar) (* inputs *) + : "rax") ; (* we trash *) + RETURN( myout ) +END Example ; + +VAR + a, b, c: CARDINAL ; +BEGIN + a := 1 ; + b := 2 ; + c := Example (a, b) ; + IF c = 3 + THEN + printf ("success result from function is %d\n", c) ; + ELSE + printf ("example failed to return 3, seen %d\n" , c) ; + exit (1) + END +END exampleadd2.
\ No newline at end of file diff --git a/gcc/testsuite/gm2/pim/pass/forarray.mod b/gcc/testsuite/gm2/pim/pass/forarray.mod new file mode 100644 index 0000000..e1b41e7 --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/forarray.mod @@ -0,0 +1,21 @@ +MODULE forarray ; + + +VAR + array: ARRAY [0..10] OF CARDINAL ; + + +PROCEDURE Init ; +VAR + i, n: CARDINAL ; +BEGIN + array[0] := 10 ; + n := 0 ; + FOR i := 1 TO array[n] DO + END +END Init ; + + +BEGIN + Init +END forarray. 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-cfg.cc b/gcc/tree-cfg.cc index b342b14..fad308e 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -5757,6 +5757,12 @@ gimple_verify_flow_info (void) error ("probability of edge from entry block not initialized"); err = true; } + if (!EXIT_BLOCK_PTR_FOR_FN (cfun) + ->count.compatible_p (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)) + { + error ("exit block count is not compoatible with entry block count"); + err = true; + } FOR_EACH_BB_FN (bb, cfun) @@ -5780,6 +5786,12 @@ gimple_verify_flow_info (void) err = true; } } + if (!bb->count.compatible_p (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)) + { + error ("count of bb %d is not compoatible with entry block count", + bb->index); + err = true; + } /* Skip labels on the start of basic block. */ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) diff --git a/gcc/tree-logical-location.cc b/gcc/tree-logical-location.cc index 1b2702f..1d0cc58 100644 --- a/gcc/tree-logical-location.cc +++ b/gcc/tree-logical-location.cc @@ -90,18 +90,18 @@ tree_logical_location_manager::get_kind (key k) const switch (TREE_CODE (node)) { default: - return LOGICAL_LOCATION_KIND_UNKNOWN; + return logical_location_kind::unknown; case FUNCTION_DECL: - return LOGICAL_LOCATION_KIND_FUNCTION; + return logical_location_kind::function; case PARM_DECL: - return LOGICAL_LOCATION_KIND_PARAMETER; + return logical_location_kind::parameter; case VAR_DECL: - return LOGICAL_LOCATION_KIND_VARIABLE; + return logical_location_kind::variable; case NAMESPACE_DECL: - return LOGICAL_LOCATION_KIND_NAMESPACE; + return logical_location_kind::namespace_; case RECORD_TYPE: - return LOGICAL_LOCATION_KIND_TYPE; + return logical_location_kind::type; } } diff --git a/gcc/tree-outof-ssa.cc b/gcc/tree-outof-ssa.cc index bdf474d..b71f320 100644 --- a/gcc/tree-outof-ssa.cc +++ b/gcc/tree-outof-ssa.cc @@ -1005,9 +1005,8 @@ get_undefined_value_partitions (var_map map) } /* Given the out-of-ssa info object SA (with prepared partitions) - eliminate all phi nodes in all basic blocks. Afterwards no - basic block will have phi nodes anymore and there are possibly - some RTL instructions inserted on edges. */ + eliminate all phi nodes in all basic blocks. Afterwards there + are possibly some RTL instructions inserted on edges. */ void expand_phi_nodes (struct ssaexpand *sa) @@ -1023,7 +1022,6 @@ expand_phi_nodes (struct ssaexpand *sa) edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) eliminate_phi (e, &g); - set_phi_nodes (bb, NULL); /* We can't redirect EH edges in RTL land, so we need to do this here. Redirection happens only when splitting is necessary, which it is only for critical edges, normally. For EH edges diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 8c5761d..9ac4d7e 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -4646,7 +4646,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, TODO: Consider assigning different costs to different scalar statements. */ - scalar_single_iter_cost = loop_vinfo->scalar_costs->total_cost (); + scalar_single_iter_cost = (loop_vinfo->scalar_costs->total_cost () + * param_vect_scalar_cost_multiplier) / 100; /* Add additional cost for the peeled instructions in prologue and epilogue loop. (For fully-masked loops there will be no peeling.) diff --git a/gcc/tree.cc b/gcc/tree.cc index 9759c6b..c8b8b3e 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -14613,10 +14613,11 @@ verify_type (const_tree t) /* Return 1 if ARG interpreted as signed in its precision is known to be always non-negative or 2 if ARG is known to be always negative, or 3 if - ARG may be non-negative or negative. */ + ARG may be non-negative or negative. STMT if specified is the statement + on which it is being tested. */ int -get_range_pos_neg (tree arg) +get_range_pos_neg (tree arg, gimple *stmt) { if (arg == error_mark_node) return 3; @@ -14649,7 +14650,7 @@ get_range_pos_neg (tree arg) if (TREE_CODE (arg) != SSA_NAME) return 3; int_range_max r; - while (!get_global_range_query ()->range_of_expr (r, arg) + while (!get_range_query (cfun)->range_of_expr (r, arg, stmt) || r.undefined_p () || r.varying_p ()) { gimple *g = SSA_NAME_DEF_STMT (arg); @@ -5900,7 +5900,7 @@ extern bool gimple_canonical_types_compatible_p (const_tree, const_tree, bool trust_type_canonical = true); extern bool type_with_interoperable_signedness (const_tree); extern bitmap get_nonnull_args (const_tree); -extern int get_range_pos_neg (tree); +extern int get_range_pos_neg (tree, gimple * = NULL); /* Return true for a valid pair of new and delete operators. */ extern bool valid_new_delete_pair_p (tree, tree, bool * = NULL); diff --git a/gcc/value-range.cc b/gcc/value-range.cc index ed3760f..e2d75f5 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -2268,7 +2268,11 @@ irange::set_range_from_bitmask () // If all the bits are known, this is a singleton. if (m_bitmask.mask () == 0) { - set (m_type, m_bitmask.value (), m_bitmask.value ()); + // Make sure the singleton is within the range. + if (contains_p (m_bitmask.value ())) + set (m_type, m_bitmask.value (), m_bitmask.value ()); + else + set_undefined (); return true; } 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 60aa949..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,24 +1094,11 @@ 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) -I_M4_DEPS=m4/iparm.m4 m4/mtype.m4 -I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4 -I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4 -I_M4_DEPS2=$(I_M4_DEPS) m4/ifunction_logical.m4 -I_M4_DEPS3=$(I_M4_DEPS) m4/iforeach-s.m4 -I_M4_DEPS4=$(I_M4_DEPS) m4/ifunction-s.m4 -I_M4_DEPS5=$(I_M4_DEPS) m4/iforeach-s2.m4 -I_M4_DEPS6=$(I_M4_DEPS) m4/ifunction-s2.m4 -I_M4_DEPS7=$(I_M4_DEPS) m4/ifindloc0.m4 -I_M4_DEPS8=$(I_M4_DEPS) m4/ifindloc1.m4 -I_M4_DEPS9=$(I_M4_DEPS) m4/ifindloc2.m4 - kinds.h: $(srcdir)/mk-kinds-h.sh $(SHELL) $(srcdir)/mk-kinds-h.sh '@LIBGOMP_CHECKED_INT_KINDS@' \ '@LIBGOMP_CHECKED_REAL_KINDS@' \ @@ -1271,172 +1131,10 @@ include/ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h $(MKDIR_P) include cp $(srcdir)/ISO_Fortran_binding.h $@ -## A 'normal' build shouldn't need to regenerate these -## so we only include them in maintainer mode - -if MAINTAINER_MODE -$(i_all_c): m4/all.m4 $(I_M4_DEPS2) - $(M4) -Dfile=$@ -I$(srcdir)/m4 all.m4 > $@ - -$(i_bessel_c): m4/bessel.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 bessel.m4 > $@ - -$(i_any_c): m4/any.m4 $(I_M4_DEPS2) - $(M4) -Dfile=$@ -I$(srcdir)/m4 any.m4 > $@ - -$(i_count_c): m4/count.m4 $(I_M4_DEPS2) - $(M4) -Dfile=$@ -I$(srcdir)/m4 count.m4 > $@ - -$(i_findloc0_c): m4/findloc0.m4 $(I_M4_DEPS7) - $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc0.m4 > $@ - -$(i_findloc0s_c): m4/findloc0s.m4 $(I_M4_DEPS7) - $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc0s.m4 > $@ - -$(i_findloc1_c): m4/findloc1.m4 $(I_M4_DEPS8) - $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc1.m4 > $@ - -$(i_findloc1s_c): m4/findloc1s.m4 $(I_M4_DEPS8) - $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc1s.m4 > $@ - -$(i_findloc2s_c): m4/findloc2s.m4 $(I_M4_DEPS9) - $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc2s.m4 > $@ - -$(i_iall_c): m4/iall.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 iall.m4 > $@ - -$(i_iany_c): m4/iany.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 iany.m4 > $@ - -$(i_iparity_c): m4/iparity.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 iparity.m4 > $@ - -$(i_maxloc0_c): m4/maxloc0.m4 $(I_M4_DEPS0) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc0.m4 > $@ - -$(i_maxloc0s_c) : m4/maxloc0s.m4 $(I_M4_DEPS3) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc0s.m4 > $@ - -$(i_maxloc1_c): m4/maxloc1.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc1.m4 > $@ - -$(i_maxloc1s_c): m4/maxloc1s.m4 $(I_M4_DEPS4) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc1s.m4 > $@ - -$(i_maxloc2s_c): m4/maxloc2s.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc2s.m4 > $@ - -$(i_maxval_c): m4/maxval.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval.m4 > $@ - -$(i_maxval0s_c): m4/maxval0s.m4 $(I_M4_DEPS5) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval0s.m4 > $@ - -$(i_maxval1s_c): m4/maxval1s.m4 $(I_M4_DEPS6) - $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval1s.m4 > $@ - -$(i_minloc0_c): m4/minloc0.m4 $(I_M4_DEPS0) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc0.m4 > $@ - -$(i_minloc0s_c) : m4/minloc0s.m4 $(I_M4_DEPS3) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc0s.m4 > $@ - -$(i_minloc1_c): m4/minloc1.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc1.m4 > $@ - -$(i_minloc1s_c): m4/minloc1s.m4 $(I_M4_DEPS4) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc1s.m4 > $@ - -$(i_minloc2s_c): m4/minloc2s.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc2s.m4 > $@ - -$(i_minval_c): m4/minval.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minval.m4 > $@ - -$(i_minval0s_c): m4/minval0s.m4 $(I_M4_DEPS5) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minval0s.m4 > $@ - -$(i_minval1s_c): m4/minval1s.m4 $(I_M4_DEPS6) - $(M4) -Dfile=$@ -I$(srcdir)/m4 minval1s.m4 > $@ - -$(i_product_c): m4/product.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 product.m4 > $@ - -$(i_sum_c): m4/sum.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 sum.m4 > $@ - -$(i_matmul_c): m4/matmul.m4 m4/matmul_internal.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 matmul.m4 > $@ - -$(i_matmulavx128_c): m4/matmulavx128.m4 m4/matmul_internal.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 matmulavx128.m4 > $@ - -$(i_matmull_c): m4/matmull.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 matmull.m4 > $@ - -$(i_norm2_c): m4/norm2.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 norm2.m4 > $@ - -$(i_parity_c): m4/parity.m4 $(I_M4_DEPS1) - $(M4) -Dfile=$@ -I$(srcdir)/m4 parity.m4 > $@ - -$(i_shape_c): m4/shape.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 shape.m4 > $@ - -$(i_reshape_c): m4/reshape.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 reshape.m4 > $@ - -$(i_eoshift1_c): m4/eoshift1.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift1.m4 > $@ - -$(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@ - -$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@ - -$(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@ - -$(i_cshift1a_c): m4/cshift1a.m4 $(I_M$_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1a.m4 > $@ - -$(in_pack_c): m4/in_pack.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 in_pack.m4 > $@ - -$(in_unpack_c): m4/in_unpack.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 in_unpack.m4 > $@ - -$(i_pow_c): m4/pow.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $@ - -$(i_powu_c): m4/powu.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 powu.m4 > $@ - -$(i_pack_c): m4/pack.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 pack.m4 > $@ - -$(i_unpack_c): m4/unpack.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 unpack.m4 > $@ - -$(i_spread_c): m4/spread.m4 $(I_M4_DEPS) - $(M4) -Dfile=$@ -I$(srcdir)/m4 spread.m4 > $@ - -$(gfor_built_specific_src): m4/specific.m4 m4/head.m4 - $(M4) -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $@ - -$(gfor_built_specific2_src): m4/specific2.m4 m4/head.m4 - $(M4) -Dfile=$@ -I$(srcdir)/m4 specific2.m4 > $@ - -$(gfor_misc_specifics): m4/misc_specifics.m4 m4/head.m4 - $(M4) -Dfile=$@ -I$(srcdir)/m4 misc_specifics.m4 > $@ -## end of maintainer mode only rules -endif - 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 c171b3d..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,35 +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) -I_M4_DEPS = m4/iparm.m4 m4/mtype.m4 -I_M4_DEPS0 = $(I_M4_DEPS) m4/iforeach.m4 -I_M4_DEPS1 = $(I_M4_DEPS) m4/ifunction.m4 -I_M4_DEPS2 = $(I_M4_DEPS) m4/ifunction_logical.m4 -I_M4_DEPS3 = $(I_M4_DEPS) m4/iforeach-s.m4 -I_M4_DEPS4 = $(I_M4_DEPS) m4/ifunction-s.m4 -I_M4_DEPS5 = $(I_M4_DEPS) m4/iforeach-s2.m4 -I_M4_DEPS6 = $(I_M4_DEPS) m4/ifunction-s2.m4 -I_M4_DEPS7 = $(I_M4_DEPS) m4/ifindloc0.m4 -I_M4_DEPS8 = $(I_M4_DEPS) m4/ifindloc1.m4 -I_M4_DEPS9 = $(I_M4_DEPS) m4/ifindloc2.m4 -EXTRA_DIST = $(m4_files) +EXTRA_DIST = m4 MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = @@ -2752,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) \ @@ -3034,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) \ @@ -3214,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) \ @@ -3426,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) @@ -5094,162 +4920,6 @@ include/ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h $(MKDIR_P) include cp $(srcdir)/ISO_Fortran_binding.h $@ -@MAINTAINER_MODE_TRUE@$(i_all_c): m4/all.m4 $(I_M4_DEPS2) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 all.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_bessel_c): m4/bessel.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 bessel.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_any_c): m4/any.m4 $(I_M4_DEPS2) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 any.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_count_c): m4/count.m4 $(I_M4_DEPS2) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 count.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_findloc0_c): m4/findloc0.m4 $(I_M4_DEPS7) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc0.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_findloc0s_c): m4/findloc0s.m4 $(I_M4_DEPS7) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc0s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_findloc1_c): m4/findloc1.m4 $(I_M4_DEPS8) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc1.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_findloc1s_c): m4/findloc1s.m4 $(I_M4_DEPS8) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc1s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_findloc2s_c): m4/findloc2s.m4 $(I_M4_DEPS9) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 findloc2s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_iall_c): m4/iall.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 iall.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_iany_c): m4/iany.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 iany.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_iparity_c): m4/iparity.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 iparity.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxloc0_c): m4/maxloc0.m4 $(I_M4_DEPS0) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc0.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxloc0s_c) : m4/maxloc0s.m4 $(I_M4_DEPS3) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc0s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxloc1_c): m4/maxloc1.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc1.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxloc1s_c): m4/maxloc1s.m4 $(I_M4_DEPS4) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc1s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxloc2s_c): m4/maxloc2s.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc2s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxval_c): m4/maxval.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxval0s_c): m4/maxval0s.m4 $(I_M4_DEPS5) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval0s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_maxval1s_c): m4/maxval1s.m4 $(I_M4_DEPS6) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval1s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minloc0_c): m4/minloc0.m4 $(I_M4_DEPS0) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc0.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minloc0s_c) : m4/minloc0s.m4 $(I_M4_DEPS3) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc0s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minloc1_c): m4/minloc1.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc1.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minloc1s_c): m4/minloc1s.m4 $(I_M4_DEPS4) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc1s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minloc2s_c): m4/minloc2s.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc2s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minval_c): m4/minval.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minval.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minval0s_c): m4/minval0s.m4 $(I_M4_DEPS5) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minval0s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_minval1s_c): m4/minval1s.m4 $(I_M4_DEPS6) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 minval1s.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_product_c): m4/product.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 product.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_sum_c): m4/sum.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 sum.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_matmul_c): m4/matmul.m4 m4/matmul_internal.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 matmul.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_matmulavx128_c): m4/matmulavx128.m4 m4/matmul_internal.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 matmulavx128.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_matmull_c): m4/matmull.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 matmull.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_norm2_c): m4/norm2.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 norm2.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_parity_c): m4/parity.m4 $(I_M4_DEPS1) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 parity.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_shape_c): m4/shape.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 shape.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_reshape_c): m4/reshape.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 reshape.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_eoshift1_c): m4/eoshift1.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift1.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_cshift1a_c): m4/cshift1a.m4 $(I_M$_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1a.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(in_pack_c): m4/in_pack.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 in_pack.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(in_unpack_c): m4/in_unpack.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 in_unpack.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_pow_c): m4/pow.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 pow.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_powu_c): m4/powu.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 powu.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_pack_c): m4/pack.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 pack.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_unpack_c): m4/unpack.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 unpack.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(i_spread_c): m4/spread.m4 $(I_M4_DEPS) -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 spread.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(gfor_built_specific_src): m4/specific.m4 m4/head.m4 -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 specific.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(gfor_built_specific2_src): m4/specific2.m4 m4/head.m4 -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 specific2.m4 > $@ - -@MAINTAINER_MODE_TRUE@$(gfor_misc_specifics): m4/misc_specifics.m4 m4/head.m4 -@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 misc_specifics.m4 > $@ - clean-local: -rm -rf include $(version_dep) diff --git a/libgfortran/regenerate.sh b/libgfortran/regenerate.sh new file mode 100755 index 0000000..a016034 --- /dev/null +++ b/libgfortran/regenerate.sh @@ -0,0 +1,1250 @@ +#!/bin/sh + +# Unless the user specified their desired m4 implementation through the +# M4 environment variable, find a GNU M4 in the PATH. + +if [ -z "$M4" ] ; then + for prog in gm4 gnum4 m4 ; do + if $prog --version 2>/dev/null | grep -q 'GNU M4' ; then + M4=${prog} + break + fi + done +fi + +if [ -z "$M4" ] ; then + echo "GNU M4 not found" + exit 1 +else + echo "Found GNU M4: ${M4}" +fi + +# Make sure we run in the correct directory + +if [ ! -e "./m4/pow.m4" ] ; then + echo "This script should be run in the libgfortran/ directory" + exit 1 +fi + + +i_all_c=" +generated/all_l1.c +generated/all_l2.c +generated/all_l4.c +generated/all_l8.c +generated/all_l16.c +" + +i_any_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/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/maxloc0_4_i1.c +generated/maxloc0_8_i1.c +generated/maxloc0_16_i1.c +generated/maxloc0_4_i2.c +generated/maxloc0_8_i2.c +generated/maxloc0_16_i2.c +generated/maxloc0_4_i4.c +generated/maxloc0_8_i4.c +generated/maxloc0_16_i4.c +generated/maxloc0_4_i8.c +generated/maxloc0_8_i8.c +generated/maxloc0_16_i8.c +generated/maxloc0_4_i16.c +generated/maxloc0_8_i16.c +generated/maxloc0_16_i16.c +generated/maxloc0_4_m1.c +generated/maxloc0_8_m1.c +generated/maxloc0_16_m1.c +generated/maxloc0_4_m2.c +generated/maxloc0_8_m2.c +generated/maxloc0_16_m2.c +generated/maxloc0_4_m4.c +generated/maxloc0_8_m4.c +generated/maxloc0_16_m4.c +generated/maxloc0_4_m8.c +generated/maxloc0_8_m8.c +generated/maxloc0_16_m8.c +generated/maxloc0_4_m16.c +generated/maxloc0_8_m16.c +generated/maxloc0_16_m16.c +generated/maxloc0_4_r4.c +generated/maxloc0_8_r4.c +generated/maxloc0_16_r4.c +generated/maxloc0_4_r8.c +generated/maxloc0_8_r8.c +generated/maxloc0_16_r8.c +generated/maxloc0_4_r10.c +generated/maxloc0_8_r10.c +generated/maxloc0_16_r10.c +generated/maxloc0_4_r16.c +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/maxloc1_4_i1.c +generated/maxloc1_8_i1.c +generated/maxloc1_16_i1.c +generated/maxloc1_4_i2.c +generated/maxloc1_8_i2.c +generated/maxloc1_16_i2.c +generated/maxloc1_4_i4.c +generated/maxloc1_8_i4.c +generated/maxloc1_16_i4.c +generated/maxloc1_4_i8.c +generated/maxloc1_8_i8.c +generated/maxloc1_16_i8.c +generated/maxloc1_4_i16.c +generated/maxloc1_8_i16.c +generated/maxloc1_16_i16.c +generated/maxloc1_4_m1.c +generated/maxloc1_8_m1.c +generated/maxloc1_16_m1.c +generated/maxloc1_4_m2.c +generated/maxloc1_8_m2.c +generated/maxloc1_16_m2.c +generated/maxloc1_4_m4.c +generated/maxloc1_8_m4.c +generated/maxloc1_16_m4.c +generated/maxloc1_4_m8.c +generated/maxloc1_8_m8.c +generated/maxloc1_16_m8.c +generated/maxloc1_4_m16.c +generated/maxloc1_8_m16.c +generated/maxloc1_16_m16.c +generated/maxloc1_4_r4.c +generated/maxloc1_8_r4.c +generated/maxloc1_16_r4.c +generated/maxloc1_4_r8.c +generated/maxloc1_8_r8.c +generated/maxloc1_16_r8.c +generated/maxloc1_4_r10.c +generated/maxloc1_8_r10.c +generated/maxloc1_16_r10.c +generated/maxloc1_4_r16.c +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/maxval_i1.c +generated/maxval_i2.c +generated/maxval_i4.c +generated/maxval_i8.c +generated/maxval_i16.c +generated/maxval_m1.c +generated/maxval_m2.c +generated/maxval_m4.c +generated/maxval_m8.c +generated/maxval_m16.c +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/minloc0_4_i1.c +generated/minloc0_8_i1.c +generated/minloc0_16_i1.c +generated/minloc0_4_i2.c +generated/minloc0_8_i2.c +generated/minloc0_16_i2.c +generated/minloc0_4_i4.c +generated/minloc0_8_i4.c +generated/minloc0_16_i4.c +generated/minloc0_4_i8.c +generated/minloc0_8_i8.c +generated/minloc0_16_i8.c +generated/minloc0_4_i16.c +generated/minloc0_8_i16.c +generated/minloc0_16_i16.c +generated/minloc0_4_m1.c +generated/minloc0_8_m1.c +generated/minloc0_16_m1.c +generated/minloc0_4_m2.c +generated/minloc0_8_m2.c +generated/minloc0_16_m2.c +generated/minloc0_4_m4.c +generated/minloc0_8_m4.c +generated/minloc0_16_m4.c +generated/minloc0_4_m8.c +generated/minloc0_8_m8.c +generated/minloc0_16_m8.c +generated/minloc0_4_m16.c +generated/minloc0_8_m16.c +generated/minloc0_16_m16.c +generated/minloc0_4_r4.c +generated/minloc0_8_r4.c +generated/minloc0_16_r4.c +generated/minloc0_4_r8.c +generated/minloc0_8_r8.c +generated/minloc0_16_r8.c +generated/minloc0_4_r10.c +generated/minloc0_8_r10.c +generated/minloc0_16_r10.c +generated/minloc0_4_r16.c +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/minloc1_4_i1.c +generated/minloc1_8_i1.c +generated/minloc1_16_i1.c +generated/minloc1_4_i2.c +generated/minloc1_8_i2.c +generated/minloc1_16_i2.c +generated/minloc1_4_i4.c +generated/minloc1_8_i4.c +generated/minloc1_16_i4.c +generated/minloc1_4_i8.c +generated/minloc1_8_i8.c +generated/minloc1_16_i8.c +generated/minloc1_4_i16.c +generated/minloc1_8_i16.c +generated/minloc1_16_i16.c +generated/minloc1_4_m1.c +generated/minloc1_8_m1.c +generated/minloc1_16_m1.c +generated/minloc1_4_m2.c +generated/minloc1_8_m2.c +generated/minloc1_16_m2.c +generated/minloc1_4_m4.c +generated/minloc1_8_m4.c +generated/minloc1_16_m4.c +generated/minloc1_4_m8.c +generated/minloc1_8_m8.c +generated/minloc1_16_m8.c +generated/minloc1_4_m16.c +generated/minloc1_8_m16.c +generated/minloc1_16_m16.c +generated/minloc1_4_r4.c +generated/minloc1_8_r4.c +generated/minloc1_16_r4.c +generated/minloc1_4_r8.c +generated/minloc1_8_r8.c +generated/minloc1_16_r8.c +generated/minloc1_4_r10.c +generated/minloc1_8_r10.c +generated/minloc1_16_r10.c +generated/minloc1_4_r16.c +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/minval_i1.c +generated/minval_i2.c +generated/minval_i4.c +generated/minval_i8.c +generated/minval_i16.c +generated/minval_m1.c +generated/minval_m2.c +generated/minval_m4.c +generated/minval_m8.c +generated/minval_m16.c +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/product_i1.c +generated/product_i2.c +generated/product_i4.c +generated/product_i8.c +generated/product_i16.c +generated/product_r4.c +generated/product_r8.c +generated/product_r10.c +generated/product_r16.c +generated/product_r17.c +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/shape_i1.c +generated/shape_i2.c +generated/shape_i4.c +generated/shape_i8.c +generated/shape_i16.c +" + +i_reshape_c=" +generated/reshape_i4.c +generated/reshape_i8.c +generated/reshape_i16.c +generated/reshape_r4.c +generated/reshape_r8.c +generated/reshape_r10.c +generated/reshape_r16.c +generated/reshape_r17.c +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/in_pack_i1.c +generated/in_pack_i2.c +generated/in_pack_i4.c +generated/in_pack_i8.c +generated/in_pack_i16.c +generated/in_pack_r4.c +generated/in_pack_r8.c +generated/in_pack_r10.c +generated/in_pack_r16.c +generated/in_pack_r17.c +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_unpack_i1.c +generated/in_unpack_i2.c +generated/in_unpack_i4.c +generated/in_unpack_i8.c +generated/in_unpack_i16.c +generated/in_unpack_r4.c +generated/in_unpack_r8.c +generated/in_unpack_r10.c +generated/in_unpack_r16.c +generated/in_unpack_r17.c +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/pow_i4_i4.c +generated/pow_i8_i4.c +generated/pow_i16_i4.c +generated/pow_r16_i4.c +generated/pow_r17_i4.c +generated/pow_c4_i4.c +generated/pow_c8_i4.c +generated/pow_c10_i4.c +generated/pow_c16_i4.c +generated/pow_c17_i4.c +generated/pow_i4_i8.c +generated/pow_i8_i8.c +generated/pow_i16_i8.c +generated/pow_r4_i8.c +generated/pow_r8_i8.c +generated/pow_r10_i8.c +generated/pow_r16_i8.c +generated/pow_r17_i8.c +generated/pow_c4_i8.c +generated/pow_c8_i8.c +generated/pow_c10_i8.c +generated/pow_c16_i8.c +generated/pow_c17_i8.c +generated/pow_i4_i16.c +generated/pow_i8_i16.c +generated/pow_i16_i16.c +generated/pow_r4_i16.c +generated/pow_r8_i16.c +generated/pow_r10_i16.c +generated/pow_r16_i16.c +generated/pow_r17_i16.c +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/pack_i1.c +generated/pack_i2.c +generated/pack_i4.c +generated/pack_i8.c +generated/pack_i16.c +generated/pack_r4.c +generated/pack_r8.c +generated/pack_r10.c +generated/pack_r16.c +generated/pack_r17.c +generated/pack_c4.c +generated/pack_c8.c +generated/pack_c10.c +generated/pack_c16.c +generated/pack_c17.c +" + +i_unpack_c=" +generated/unpack_i1.c +generated/unpack_i2.c +generated/unpack_i4.c +generated/unpack_i8.c +generated/unpack_i16.c +generated/unpack_r4.c +generated/unpack_r8.c +generated/unpack_r10.c +generated/unpack_r16.c +generated/unpack_r17.c +generated/unpack_c4.c +generated/unpack_c8.c +generated/unpack_c10.c +generated/unpack_c16.c +generated/unpack_c17.c +" + +i_spread_c=" +generated/spread_i1.c +generated/spread_i2.c +generated/spread_i4.c +generated/spread_i8.c +generated/spread_i16.c +generated/spread_r4.c +generated/spread_r8.c +generated/spread_r10.c +generated/spread_r16.c +generated/spread_r17.c +generated/spread_c4.c +generated/spread_c8.c +generated/spread_c10.c +generated/spread_c16.c +generated/spread_c17.c +" + +gfor_built_specific_src=" +generated/_abs_c4.F90 +generated/_abs_c8.F90 +generated/_abs_c10.F90 +generated/_abs_c16.F90 +generated/_abs_c17.F90 +generated/_abs_i4.F90 +generated/_abs_i8.F90 +generated/_abs_i16.F90 +generated/_abs_r4.F90 +generated/_abs_r8.F90 +generated/_abs_r10.F90 +generated/_abs_r16.F90 +generated/_abs_r17.F90 +generated/_aimag_c4.F90 +generated/_aimag_c8.F90 +generated/_aimag_c10.F90 +generated/_aimag_c16.F90 +generated/_aimag_c17.F90 +generated/_exp_r4.F90 +generated/_exp_r8.F90 +generated/_exp_r10.F90 +generated/_exp_r16.F90 +generated/_exp_r17.F90 +generated/_exp_c4.F90 +generated/_exp_c8.F90 +generated/_exp_c10.F90 +generated/_exp_c16.F90 +generated/_exp_c17.F90 +generated/_log_r4.F90 +generated/_log_r8.F90 +generated/_log_r10.F90 +generated/_log_r16.F90 +generated/_log_r17.F90 +generated/_log_c4.F90 +generated/_log_c8.F90 +generated/_log_c10.F90 +generated/_log_c16.F90 +generated/_log_c17.F90 +generated/_log10_r4.F90 +generated/_log10_r8.F90 +generated/_log10_r10.F90 +generated/_log10_r16.F90 +generated/_log10_r17.F90 +generated/_sqrt_r4.F90 +generated/_sqrt_r8.F90 +generated/_sqrt_r10.F90 +generated/_sqrt_r16.F90 +generated/_sqrt_r17.F90 +generated/_sqrt_c4.F90 +generated/_sqrt_c8.F90 +generated/_sqrt_c10.F90 +generated/_sqrt_c16.F90 +generated/_sqrt_c17.F90 +generated/_asin_r4.F90 +generated/_asin_r8.F90 +generated/_asin_r10.F90 +generated/_asin_r16.F90 +generated/_asin_r17.F90 +generated/_asinh_r4.F90 +generated/_asinh_r8.F90 +generated/_asinh_r10.F90 +generated/_asinh_r16.F90 +generated/_asinh_r17.F90 +generated/_acos_r4.F90 +generated/_acos_r8.F90 +generated/_acos_r10.F90 +generated/_acos_r16.F90 +generated/_acos_r17.F90 +generated/_acosh_r4.F90 +generated/_acosh_r8.F90 +generated/_acosh_r10.F90 +generated/_acosh_r16.F90 +generated/_acosh_r17.F90 +generated/_atan_r4.F90 +generated/_atan_r8.F90 +generated/_atan_r10.F90 +generated/_atan_r16.F90 +generated/_atan_r17.F90 +generated/_atanh_r4.F90 +generated/_atanh_r8.F90 +generated/_atanh_r10.F90 +generated/_atanh_r16.F90 +generated/_atanh_r17.F90 +generated/_sin_r4.F90 +generated/_sin_r8.F90 +generated/_sin_r10.F90 +generated/_sin_r16.F90 +generated/_sin_r17.F90 +generated/_sin_c4.F90 +generated/_sin_c8.F90 +generated/_sin_c10.F90 +generated/_sin_c16.F90 +generated/_sin_c17.F90 +generated/_cos_r4.F90 +generated/_cos_r8.F90 +generated/_cos_r10.F90 +generated/_cos_r16.F90 +generated/_cos_r17.F90 +generated/_cos_c4.F90 +generated/_cos_c8.F90 +generated/_cos_c10.F90 +generated/_cos_c16.F90 +generated/_cos_c17.F90 +generated/_tan_r4.F90 +generated/_tan_r8.F90 +generated/_tan_r10.F90 +generated/_tan_r16.F90 +generated/_tan_r17.F90 +generated/_sinh_r4.F90 +generated/_sinh_r8.F90 +generated/_sinh_r10.F90 +generated/_sinh_r16.F90 +generated/_sinh_r17.F90 +generated/_cosh_r4.F90 +generated/_cosh_r8.F90 +generated/_cosh_r10.F90 +generated/_cosh_r16.F90 +generated/_cosh_r17.F90 +generated/_tanh_r4.F90 +generated/_tanh_r8.F90 +generated/_tanh_r10.F90 +generated/_tanh_r16.F90 +generated/_tanh_r17.F90 +generated/_conjg_c4.F90 +generated/_conjg_c8.F90 +generated/_conjg_c10.F90 +generated/_conjg_c16.F90 +generated/_conjg_c17.F90 +generated/_aint_r4.F90 +generated/_aint_r8.F90 +generated/_aint_r10.F90 +generated/_aint_r16.F90 +generated/_aint_r17.F90 +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/_sign_i4.F90 +generated/_sign_i8.F90 +generated/_sign_i16.F90 +generated/_sign_r4.F90 +generated/_sign_r8.F90 +generated/_sign_r10.F90 +generated/_sign_r16.F90 +generated/_sign_r17.F90 +generated/_dim_i4.F90 +generated/_dim_i8.F90 +generated/_dim_i16.F90 +generated/_dim_r4.F90 +generated/_dim_r8.F90 +generated/_dim_r10.F90 +generated/_dim_r16.F90 +generated/_dim_r17.F90 +generated/_atan2_r4.F90 +generated/_atan2_r8.F90 +generated/_atan2_r10.F90 +generated/_atan2_r16.F90 +generated/_atan2_r17.F90 +generated/_mod_i4.F90 +generated/_mod_i8.F90 +generated/_mod_i16.F90 +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 +" + + +for f in ${i_all_c} ; do + ${M4} -Dfile=$f -I./m4 all.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_bessel_c} ; do + ${M4} -Dfile=$f -I./m4 bessel.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_any_c} ; do + ${M4} -Dfile=$f -I./m4 any.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_count_c} ; do + ${M4} -Dfile=$f -I./m4 count.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_findloc0_c} ; do + ${M4} -Dfile=$f -I./m4 findloc0.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_findloc0s_c} ; do + ${M4} -Dfile=$f -I./m4 findloc0s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_findloc1_c} ; do + ${M4} -Dfile=$f -I./m4 findloc1.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_findloc1s_c} ; do + ${M4} -Dfile=$f -I./m4 findloc1s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_findloc2s_c} ; do + ${M4} -Dfile=$f -I./m4 findloc2s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_iall_c} ; do + ${M4} -Dfile=$f -I./m4 iall.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_iany_c} ; do + ${M4} -Dfile=$f -I./m4 iany.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_iparity_c} ; do + ${M4} -Dfile=$f -I./m4 iparity.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxloc0_c} ; do + ${M4} -Dfile=$f -I./m4 maxloc0.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxloc0s_c} ; do + ${M4} -Dfile=$f -I./m4 maxloc0s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxloc1_c} ; do + ${M4} -Dfile=$f -I./m4 maxloc1.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxloc1s_c} ; do + ${M4} -Dfile=$f -I./m4 maxloc1s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxloc2s_c} ; do + ${M4} -Dfile=$f -I./m4 maxloc2s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxval_c} ; do + ${M4} -Dfile=$f -I./m4 maxval.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxval0s_c} ; do + ${M4} -Dfile=$f -I./m4 maxval0s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_maxval1s_c} ; do + ${M4} -Dfile=$f -I./m4 maxval1s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minloc0_c} ; do + ${M4} -Dfile=$f -I./m4 minloc0.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minloc0s_c} ; do + ${M4} -Dfile=$f -I./m4 minloc0s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minloc1_c} ; do + ${M4} -Dfile=$f -I./m4 minloc1.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minloc1s_c} ; do + ${M4} -Dfile=$f -I./m4 minloc1s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minloc2s_c} ; do + ${M4} -Dfile=$f -I./m4 minloc2s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minval_c} ; do + ${M4} -Dfile=$f -I./m4 minval.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minval0s_c} ; do + ${M4} -Dfile=$f -I./m4 minval0s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_minval1s_c} ; do + ${M4} -Dfile=$f -I./m4 minval1s.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_product_c} ; do + ${M4} -Dfile=$f -I./m4 product.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_sum_c} ; do + ${M4} -Dfile=$f -I./m4 sum.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_matmul_c} ; do + ${M4} -Dfile=$f -I./m4 matmul.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_matmulavx128_c} ; do + ${M4} -Dfile=$f -I./m4 matmulavx128.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_matmull_c} ; do + ${M4} -Dfile=$f -I./m4 matmull.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_norm2_c} ; do + ${M4} -Dfile=$f -I./m4 norm2.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_parity_c} ; do + ${M4} -Dfile=$f -I./m4 parity.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_shape_c} ; do + ${M4} -Dfile=$f -I./m4 shape.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_reshape_c} ; do + ${M4} -Dfile=$f -I./m4 reshape.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_eoshift1_c} ; do + ${M4} -Dfile=$f -I./m4 eoshift1.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_eoshift3_c} ; do + ${M4} -Dfile=$f -I./m4 eoshift3.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_cshift0_c} ; do + ${M4} -Dfile=$f -I./m4 cshift0.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_cshift1_c} ; do + ${M4} -Dfile=$f -I./m4 cshift1.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_cshift1a_c} ; do + ${M4} -Dfile=$f -I./m4 cshift1a.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${in_pack_c} ; do + ${M4} -Dfile=$f -I./m4 in_pack.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${in_unpack_c} ; do + ${M4} -Dfile=$f -I./m4 in_unpack.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_pow_c} ; do + ${M4} -Dfile=$f -I./m4 pow.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_powu_c} ; do + ${M4} -Dfile=$f -I./m4 powu.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_pack_c} ; do + ${M4} -Dfile=$f -I./m4 pack.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_unpack_c} ; do + ${M4} -Dfile=$f -I./m4 unpack.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${i_spread_c} ; do + ${M4} -Dfile=$f -I./m4 spread.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${gfor_built_specific_src} ; do + ${M4} -Dfile=$f -I./m4 specific.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${gfor_built_specific2_src} ; do + ${M4} -Dfile=$f -I./m4 specific2.m4 > $f.tmp + ../move-if-change $f.tmp $f +done + +for f in ${gfor_misc_specifics} ; do + ${M4} -Dfile=$f -I./m4 misc_specifics.m4 > $f.tmp + ../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/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c new file mode 100644 index 0000000..d1df550 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c @@ -0,0 +1,8 @@ +/* { dg-do link { target { offload_target_amdgcn } } } */ +/* { dg-additional-options -foffload=amdgcn-amdhsa } */ +/* { dg-additional-options -foffload=-march=gfx942 } */ +/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */ + +#include "declare-variant-4.h" + +/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx942 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h b/libgomp/testsuite/libgomp.c/declare-variant-4.h index 53788d2..2257f4c 100644 --- a/libgomp/testsuite/libgomp.c/declare-variant-4.h +++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h @@ -37,6 +37,13 @@ gfx90c (void) __attribute__ ((noipa)) int +gfx942 (void) +{ + return 0x942; +} + +__attribute__ ((noipa)) +int gfx1030 (void) { return 0x1030; @@ -68,6 +75,7 @@ gfx1103 (void) #pragma omp declare variant(gfx908) match(device = {isa("gfx908")}) #pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")}) #pragma omp declare variant(gfx90c) match(device = {isa("gfx90c")}) +#pragma omp declare variant(gfx942) match(device = {isa("gfx942")}) #pragma omp declare variant(gfx1030) match(device = {isa("gfx1030")}) #pragma omp declare variant(gfx1036) match(device = {isa("gfx1036")}) #pragma omp declare variant(gfx1100) match(device = {isa("gfx1100")}) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 473857b..9e0070d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,322 @@ +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 + * include/std/sstream: full implementation, really just + decls, requires clause and plumbing. + * include/bits/version.def, include/bits/version.h: + new preprocessor symbol + __cpp_lib_sstream_from_string_view. + * testsuite/27_io/basic_stringbuf/cons/char/string_view.cc: + New tests. + * testsuite/27_io/basic_istringstream/cons/char/string_view.cc: + New tests. + * testsuite/27_io/basic_ostringstream/cons/char/string_view.cc: + New tests. + * testsuite/27_io/basic_stringstream/cons/char/string_view.cc: + New tests. + * testsuite/27_io/basic_stringbuf/cons/wchar_t/string_view.cc: + New tests. + * testsuite/27_io/basic_istringstream/cons/wchar_t/string_view.cc: + New tests. + * testsuite/27_io/basic_ostringstream/cons/wchar_t/string_view.cc: + New tests. + * testsuite/27_io/basic_stringstream/cons/wchar_t/string_view.cc: + New tests. + +2025-06-08 John David Anglin <danglin@gcc.gnu.org> + + * config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update. + 2025-06-06 Jonathan Wakely <jwakely@redhat.com> * testsuite/30_threads/semaphore/1.cc: Check type properties and 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..247d40c 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 != '%') @@ -562,6 +676,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'); @@ -725,58 +843,17 @@ namespace __format __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; - } - } - } + __builtin_trap(); + else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>) + __builtin_trap(); + else if constexpr (chrono::__is_time_point_v<_Tp>) + __builtin_trap(); 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; - } + if constexpr (chrono::__is_duration_v<_Tp>) + if (__is_neg) [[unlikely]] + __os << _S_plus_minus[1]; + __os << __t; } auto __str = std::move(__os).str(); @@ -818,6 +895,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 +918,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 +949,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]; @@ -974,7 +1086,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 +1155,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 +1197,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); } @@ -1757,6 +1882,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 @@ -1851,7 +1990,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 +1999,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 +2015,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 +2024,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 +2042,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 +2051,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 +2067,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 +2076,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 +2094,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 +2103,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 +2121,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 +2130,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 +2148,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 +2160,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 +2178,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 +2190,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 +2208,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 +2220,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 +2238,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 +2250,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 +2268,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 +2280,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 +2298,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 +2307,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 +2323,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 +2332,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 +2350,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 +2359,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 +2377,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 +2386,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 +2404,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 +2413,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 @@ -2160,7 +2466,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 +2484,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 +2508,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 +2533,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 +2550,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 +2572,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 +2589,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 +2611,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 +2627,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 +2639,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 +2685,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 +2711,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 +2732,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); } }; @@ -2947,7 +3321,7 @@ namespace __detail // 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 + 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), diff --git a/libstdc++-v3/include/bits/max_size_type.h b/libstdc++-v3/include/bits/max_size_type.h index 5bec0b5..e602b1b 100644 --- a/libstdc++-v3/include/bits/max_size_type.h +++ b/libstdc++-v3/include/bits/max_size_type.h @@ -425,10 +425,11 @@ namespace ranges using __rep = unsigned long long; #endif static constexpr size_t _S_rep_bits = sizeof(__rep) * __CHAR_BIT__; - private: + __rep _M_val = 0; unsigned _M_msb:1 = 0; + private: constexpr explicit __max_size_type(__rep __val, int __msb) noexcept : _M_val(__val), _M_msb(__msb) @@ -752,7 +753,6 @@ namespace ranges { return !(__l < __r); } #endif - private: __max_size_type _M_rep = 0; friend class __max_size_type; 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_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index b1428db..bde787c 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -839,7 +839,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 +856,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 +873,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 +890,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 +955,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 +980,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 +1007,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 +1033,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 +1089,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 +1112,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 +1276,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 +1308,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 9ab22cc..7cf62e9 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -649,7 +649,7 @@ ftms = { }; values = { v = 1; - /* For when there's no gthread. */ + // For when there is no gthread. cxxmin = 17; hosted = yes; gthread = no; @@ -1995,6 +1995,15 @@ ftms = { }; }; +ftms = { + name = sstream_from_string_view; + values = { + v = 202306; + cxxmin = 26; + hosted = yes; + }; +}; + // Standard test specifications. stds[97] = ">= 199711L"; stds[03] = ">= 199711L"; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 371a7ba..9f4cf9a 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -2233,4 +2233,14 @@ #endif /* !defined(__cpp_lib_polymorphic) && defined(__glibcxx_want_polymorphic) */ #undef __glibcxx_want_polymorphic +#if !defined(__cpp_lib_sstream_from_string_view) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED +# define __glibcxx_sstream_from_string_view 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_sstream_from_string_view) +# define __cpp_lib_sstream_from_string_view 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_sstream_from_string_view) && defined(__glibcxx_want_sstream_from_string_view) */ +#undef __glibcxx_want_sstream_from_string_view + #undef __glibcxx_want_all diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index ec76ab0..04fb23e 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 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/sstream b/libstdc++-v3/include/std/sstream index ad0c16a..b1b4126 100644 --- a/libstdc++-v3/include/std/sstream +++ b/libstdc++-v3/include/std/sstream @@ -41,8 +41,16 @@ #include <istream> #include <ostream> + #include <bits/alloc_traits.h> // allocator_traits, __allocator_like +#define __glibcxx_want_sstream_from_string_view +#include <bits/version.h> + +#ifdef __cpp_lib_sstream_from_string_view +# include <string_view> +#endif + #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI # define _GLIBCXX_LVAL_REF_QUAL & # define _GLIBCXX_SSTREAM_ALWAYS_INLINE @@ -52,8 +60,6 @@ # define _GLIBCXX_SSTREAM_ALWAYS_INLINE [[__gnu__::__always_inline__]] #endif - - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -159,6 +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 explicit basic_stringbuf(const allocator_type& __a) : basic_stringbuf(ios_base::in | std::ios_base::out, __a) @@ -197,7 +204,36 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 | ios_base::out) : basic_stringbuf(__s, __mode, allocator_type{}) { } +#endif +#ifdef __cpp_lib_sstream_from_string_view + template<typename _Tp> + explicit + basic_stringbuf(const _Tp& __t, + ios_base::openmode __mode = ios_base::in | ios_base::out) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_stringbuf(__t, __mode, allocator_type{}) + { } + + template<typename _Tp> + basic_stringbuf(const _Tp& __t, const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_stringbuf(__t, ios_base::in | ios_base::out, __a) + { } + + template<typename _Tp> + basic_stringbuf(const _Tp& __t, ios_base::openmode __mode, + const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : _M_string(__t, __a) + { _M_stringbuf_init(__mode); } +#endif // C++26 + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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); } @@ -262,6 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L #if _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> _GLIBCXX_NODISCARD basic_string<_CharT, _Traits, _SAlloc> @@ -317,6 +354,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> requires (!is_same_v<_SAlloc, _Alloc>) void @@ -335,6 +373,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif +#ifdef __cpp_lib_sstream_from_string_view + template <typename _Tp> + void + str(const _Tp& __t) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + { + basic_string_view<_CharT, _Traits> __sv{__t}; + _M_string = __sv; + _M_stringbuf_init(_M_mode); + } +#endif // C++26 + protected: // Common initialization code goes here. void @@ -521,6 +572,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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. basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a, @@ -584,7 +637,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ basic_istringstream() : __istream_type(), _M_stringbuf(ios_base::in) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an empty string buffer. @@ -601,7 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 explicit basic_istringstream(ios_base::openmode __mode) : __istream_type(), _M_stringbuf(__mode | ios_base::in) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an existing string buffer. @@ -620,7 +673,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_istringstream(const __string_type& __str, ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief The destructor does nothing. @@ -637,9 +690,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_istringstream(basic_istringstream&& __rhs) : __istream_type(std::move(__rhs)), _M_stringbuf(std::move(__rhs._M_stringbuf)) - { __istream_type::set_rdbuf(&_M_stringbuf); } + { __istream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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)); } @@ -671,6 +725,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { } #endif // C++20 +#ifdef __cpp_lib_sstream_from_string_view + template <typename _Tp> + explicit + basic_istringstream(const _Tp& __t, + ios_base::openmode __mode = ios_base::in) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_istringstream(__t, __mode, allocator_type{}) + { } + + template <typename _Tp> + basic_istringstream(const _Tp& __t, const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_istringstream(__t, ios_base::in, __a) + { } + + template <typename _Tp> + basic_istringstream(const _Tp& __t, ios_base::openmode __mode, + const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : __istream_type(), _M_stringbuf(__t, __mode | ios_base::in, __a) + { this->init(std::__addressof(_M_stringbuf)); } +#endif // C++26 + // 27.8.3.2 Assign and swap: basic_istringstream& @@ -702,7 +782,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NODISCARD __stringbuf_type* rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + { return const_cast<__stringbuf_type*>(std::__addressof(_M_stringbuf)); } /** * @brief Copying out the string buffer. @@ -716,6 +796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L #if _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> _GLIBCXX_NODISCARD basic_string<_CharT, _Traits, _SAlloc> @@ -747,6 +828,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> requires (!is_same_v<_SAlloc, _Alloc>) void @@ -758,6 +840,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 str(__string_type&& __s) { _M_stringbuf.str(std::move(__s)); } #endif + +#ifdef __cpp_lib_sstream_from_string_view + template<typename _Tp> + void + str(const _Tp& __t) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + { _M_stringbuf.str(__t); } +#endif // C++26 }; @@ -812,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ basic_ostringstream() : __ostream_type(), _M_stringbuf(ios_base::out) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an empty string buffer. @@ -829,7 +920,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 explicit basic_ostringstream(ios_base::openmode __mode) : __ostream_type(), _M_stringbuf(__mode | ios_base::out) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an existing string buffer. @@ -848,7 +939,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_ostringstream(const __string_type& __str, ios_base::openmode __mode = ios_base::out) : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief The destructor does nothing. @@ -865,9 +956,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_ostringstream(basic_ostringstream&& __rhs) : __ostream_type(std::move(__rhs)), _M_stringbuf(std::move(__rhs._M_stringbuf)) - { __ostream_type::set_rdbuf(&_M_stringbuf); } + { __ostream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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)); } @@ -899,6 +991,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { } #endif // C++20 +#ifdef __cpp_lib_sstream_from_string_view + template <typename _Tp> + explicit + basic_ostringstream( + const _Tp& __t, ios_base::openmode __mode = ios_base::out) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_ostringstream(__t, __mode, allocator_type{}) + { } + + template <typename _Tp> + basic_ostringstream(const _Tp& __t, const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_ostringstream(__t, ios_base::out, __a) + { } + + template <typename _Tp> + basic_ostringstream(const _Tp& __t, ios_base::openmode __mode, + const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : __ostream_type(), _M_stringbuf(__t, __mode | ios_base::out, __a) + { this->init(std::__addressof(_M_stringbuf)); } +#endif // C++26 + // 27.8.3.2 Assign and swap: basic_ostringstream& @@ -930,7 +1048,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NODISCARD __stringbuf_type* rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + { return const_cast<__stringbuf_type*>(std::__addressof(_M_stringbuf)); } /** * @brief Copying out the string buffer. @@ -944,6 +1062,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L #if _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> _GLIBCXX_NODISCARD basic_string<_CharT, _Traits, _SAlloc> @@ -975,6 +1094,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> requires (!is_same_v<_SAlloc, _Alloc>) void @@ -986,6 +1106,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 str(__string_type&& __s) { _M_stringbuf.str(std::move(__s)); } #endif + +#ifdef __cpp_lib_sstream_from_string_view + template<typename _Tp> + void + str(const _Tp& __t) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + { _M_stringbuf.str(__t); } +#endif // C++26 }; @@ -1040,7 +1169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ basic_stringstream() : __iostream_type(), _M_stringbuf(ios_base::out | ios_base::in) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an empty string buffer. @@ -1055,7 +1184,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 explicit basic_stringstream(ios_base::openmode __m) : __iostream_type(), _M_stringbuf(__m) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief Starts with an existing string buffer. @@ -1072,7 +1201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_stringstream(const __string_type& __str, ios_base::openmode __m = ios_base::out | ios_base::in) : __iostream_type(), _M_stringbuf(__str, __m) - { this->init(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } /** * @brief The destructor does nothing. @@ -1089,12 +1218,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 basic_stringstream(basic_stringstream&& __rhs) : __iostream_type(std::move(__rhs)), _M_stringbuf(std::move(__rhs._M_stringbuf)) - { __iostream_type::set_rdbuf(&_M_stringbuf); } + { __iostream_type::set_rdbuf(std::__addressof(_M_stringbuf)); } #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // 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(&_M_stringbuf); } + { this->init(std::__addressof(_M_stringbuf)); } explicit basic_stringstream(__string_type&& __str, @@ -1125,6 +1255,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { } #endif // C++20 +#ifdef __cpp_lib_sstream_from_string_view + template <typename _Tp> + explicit + basic_stringstream(const _Tp& __t, + ios_base::openmode __mode = ios_base::in | ios_base::out) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_stringstream(__t, __mode, allocator_type{}) + { } + + template <typename _Tp> + basic_stringstream(const _Tp& __t, const allocator_type& __a) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + : basic_stringstream(__t, ios_base::in | ios_base::out, __a) + { } + + template <typename _Tp> + basic_stringstream(const _Tp& __t, ios_base::openmode __mode, + const allocator_type& __a) + requires (is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>) + : __iostream_type(), _M_stringbuf(__t, __mode, __a) + { this->init(std::__addressof(_M_stringbuf)); } +#endif // C++26 + // 27.8.3.2 Assign and swap: basic_stringstream& @@ -1156,7 +1311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NODISCARD __stringbuf_type* rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + { return const_cast<__stringbuf_type*>(std::__addressof(_M_stringbuf)); } /** * @brief Copying out the string buffer. @@ -1170,6 +1325,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L #if _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> _GLIBCXX_NODISCARD basic_string<_CharT, _Traits, _SAlloc> @@ -1201,6 +1357,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI #if __cpp_concepts + // P0407 Allocator-aware basic_streambuf template<__allocator_like _SAlloc> requires (!is_same_v<_SAlloc, _Alloc>) void @@ -1212,6 +1369,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 str(__string_type&& __s) { _M_stringbuf.str(std::move(__s)); } #endif + +#ifdef __cpp_lib_sstream_from_string_view + template<typename _Tp> + void + str(const _Tp& __t) + requires (is_convertible_v<const _Tp&, + basic_string_view<_CharT, _Traits>>) + { _M_stringbuf.str(__t); } +#endif // C++26 }; #if __cplusplus >= 201103L diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 2e69af1..b39ce71 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -2939,19 +2939,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #ifdef __cpp_lib_make_from_tuple // C++ >= 17 + template <typename _Tp, typename _Tuple, typename _Seq + = make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>> + constexpr bool __can_make_from_tuple = false; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3528. make_from_tuple can perform (the equivalent of) a C-style cast + template <typename _Tp, typename _Tuple, size_t... _Idx> + constexpr bool __can_make_from_tuple<_Tp, _Tuple, index_sequence<_Idx...>> + = is_constructible_v<_Tp, + decltype(std::get<_Idx>(std::declval<_Tuple>()))...>; + template <typename _Tp, typename _Tuple, size_t... _Idx> constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>) - { return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...); } + { + static_assert(__can_make_from_tuple<_Tp, _Tuple, index_sequence<_Idx...>>); + return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...); + } #if __cpp_lib_tuple_like // >= C++23 template <typename _Tp, __tuple_like _Tuple> #else template <typename _Tp, typename _Tuple> #endif - constexpr _Tp + constexpr auto make_from_tuple(_Tuple&& __t) noexcept(__unpack_std_tuple<is_nothrow_constructible, _Tp, _Tuple>) +#ifdef __cpp_concepts // >= C++20 + -> _Tp + requires __can_make_from_tuple<_Tp, _Tuple> +#else + -> __enable_if_t<__can_make_from_tuple<_Tp, _Tuple>, _Tp> +#endif { constexpr size_t __n = tuple_size_v<remove_reference_t<_Tuple>>; #if __has_builtin(__reference_constructs_from_temporary) 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/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/tuple/dr3528.cc b/libstdc++-v3/testsuite/20_util/tuple/dr3528.cc new file mode 100644 index 0000000..c20ff95 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/dr3528.cc @@ -0,0 +1,46 @@ +// { dg-do compile { target c++17 } } + +// LWG 3528. make_from_tuple can perform (the equivalent of) a C-style cast + +#include <tuple> +#include <array> +#include <utility> + +template<typename T, typename Tuple> +using make_t = decltype(std::make_from_tuple<T>(std::declval<Tuple>())); + +template<typename T, typename Tuple, typename = void> +constexpr bool can_make = false; +template<typename T, typename Tuple> +constexpr bool can_make<T, Tuple, std::void_t<make_t<T, Tuple>>> = true; + +static_assert( can_make<int, std::tuple<int>> ); +static_assert( can_make<int, std::tuple<int>&> ); +static_assert( can_make<int, const std::tuple<int>&> ); +static_assert( can_make<int, std::array<short, 1>> ); +static_assert( can_make<int, const std::array<short, 1>&&> ); +static_assert( can_make<std::tuple<int, int>, std::pair<unsigned, long>> ); +static_assert( can_make<std::pair<int, int>, std::array<int, 2>> ); +static_assert( can_make<const int*, std::tuple<int*>> ); +static_assert( can_make<void*, std::tuple<int*>> ); +static_assert( can_make<int, std::tuple<>> ); +static_assert( ! can_make<int, std::tuple<int, int>> ); +static_assert( ! can_make<int, std::pair<short, char>> ); +static_assert( ! can_make<int, std::pair<short, char>&> ); +static_assert( ! can_make<int, std::tuple<const char*>> ); +static_assert( ! can_make<int*, std::tuple<const int*>> ); +static_assert( ! can_make<int*, std::tuple<void*>> ); +static_assert( ! can_make<int, std::array<int, 2>> ); +static_assert( ! can_make<void, std::tuple<>> ); +static_assert( ! can_make<void, std::array<int, 1>> ); + +struct Two +{ + Two(const char*, int); +}; + +static_assert( can_make<Two, std::tuple<char*, unsigned>> ); +static_assert( ! can_make<Two, std::tuple<const char*, int, int>> ); +static_assert( can_make<Two, std::pair<const char*, long>> ); +static_assert( ! can_make<Two, std::pair<int*, long>> ); +static_assert( ! can_make<std::pair<int, int>, std::array<int, 3>> ); 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/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 new file mode 100644 index 0000000..f25b538 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/char/string_view.cc @@ -0,0 +1,201 @@ +// C++26 [istringstream.general] + +// { dg-do run { target c++26 } } + +#include <sstream> +#include <string> +#include <string_view> +#include <testsuite_allocator.h> +#include <testsuite_hooks.h> + +// Check C++26 P2495 istringstream ctors and members str(s) that accept a +// string_view, or anything convertible to a string_view, in place of a +// string object. Mostly just verify plumbing. + +#ifndef C +# define C char +# define L(a) a +#endif + +using string = std::basic_string<C>; +using string_view = std::basic_string_view<C>; +using istringstream = std::basic_istringstream<C>; + +struct convertible_to_string_view { + string s; + operator string_view() const { return s; } +}; + +const string str(L("This is a test string")); +convertible_to_string_view cstr{str}; // a copy +const convertible_to_string_view ccstr{str}; // another copy + +template <typename istringstream = std::basic_istringstream<C>> +void +test01() +{ + // Test C++26 constructor and str(s) taking a generalized string_view + + static_assert(! requires { istringstream(1); }, + "istringstream ctor should reject what cannot be converted to a string_view"); + static_assert(! requires { istringstream().str(1); }, + "istringstream::str(s) should reject what cannot be converted to a string_view"); + + static_assert(!std::is_convertible_v<string_view, istringstream>, + "istringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const string_view, istringstream>, + "istringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<convertible_to_string_view, istringstream>, + "istringstream(convertible_to_string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const convertible_to_string_view, istringstream>, + "istringstream(convertible_to_string_view, ios::openmode) is explicit"); + + { + istringstream istr(cstr); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + } + { + istringstream istr(ccstr); + VERIFY( istr.str() == ccstr.s ); + VERIFY( istr.get() == ccstr.s[0] ); + } + { + istringstream istr(cstr, std::ios_base::in); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') != 'X' ); + } + { + istringstream istr(cstr, std::ios_base::out); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') == 'X' ); + } +} + +void +test02() +{ + // Test various C++26 constructors taking string views + // and mix of other arguments + + auto const mode = std::ios_base::in | std::ios_base::out; + + { + // template <typename T> + // basic_istringstream(const T&, ios_base::openmode, const allocator_type&) + + istringstream::allocator_type a; + { + istringstream istr(cstr, mode, a); // ={} checks for non-explicit ctor + VERIFY( istr.str() == cstr.s ); + } + { + istringstream istr(cstr, std::ios::in, a); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') != 'X' ); + } + { + istringstream istr(cstr, std::ios::out, a); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') == 'X' ); + } + } + + { + // template <typename T> + // basic_istringstream(const T&, ios_base::openmode) + { + istringstream istr(cstr, mode); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') == 'X' ); + } + { + istringstream istr(cstr, std::ios::in); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') != 'X' ); + } + { + istringstream istr(cstr, std::ios::out); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') == 'X' ); + } + } + + { + // template <typename T> + // explicit + // basic_istringstream(const T&, ios_base::openmode = ios_base::in) + + istringstream istr(cstr); + VERIFY( istr.str() == cstr.s ); + VERIFY( istr.get() == cstr.s[0] ); + VERIFY( istr.rdbuf()->sputc('X') != 'X' ); + } +} + +using alloc_type = __gnu_test::uneq_allocator<C>; + +template<typename Alloc, typename CC = typename Alloc::value_type> + using istringstream_with_alloc + = std::basic_istringstream<CC, std::char_traits<CC>, Alloc>; + +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' ); + } +} + +void test04() +{ + { + istringstream istr; + istr.str( cstr ); + VERIFY( istr.str() == cstr.s ); + } + { + istringstream istr; + istr.str( ccstr ); + VERIFY( istr.str() == ccstr.s ); + } +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/string_view.cc new file mode 100644 index 0000000..62fb03c --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istringstream/cons/wchar_t/string_view.cc @@ -0,0 +1,6 @@ +// C++26 [istringstream.general] +// { dg-do run { target c++26 } } + +#define C wchar_t +#define L(a) L##a +#include "../char/string_view.cc" 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 new file mode 100644 index 0000000..6279c19 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/char/string_view.cc @@ -0,0 +1,200 @@ +// C++26 [ostringstream.general] + +// { dg-do run { target c++26 } } + +#include <sstream> +#include <string> +#include <string_view> +#include <testsuite_allocator.h> +#include <testsuite_hooks.h> + +// Check C++26 P2495 ostringstream ctors and members str(s) that accept a +// string_view, or anything convertible to a string_view, in place of a +// string object. Mostly just verify plumbing. + +#ifndef C +# define C char +# define L(a) a +#endif + +using string = std::basic_string<C>; +using string_view = std::basic_string_view<C>; +using ostringstream = std::basic_ostringstream<C>; + +struct convertible_to_string_view { + string s; + operator string_view() const { return s; } +}; + +const string str(L("This is a test string")); +convertible_to_string_view cstr{str}; // a copy +const convertible_to_string_view ccstr{str}; // another copy + +template <typename ostringstream = std::basic_ostringstream<C>> +void +test01() +{ + // Test C++26 constructor and str(s) taking a generalized string_view + + static_assert(! requires { ostringstream(1); }, + "ostringstream ctor should reject what cannot be converted to a string_view"); + static_assert(! requires { ostringstream().str(1); }, + "ostringstream::str(s) should reject what cannot be converted to a string_view"); + + static_assert(!std::is_convertible_v<string_view, ostringstream>, + "ostringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const string_view, ostringstream>, + "ostringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<convertible_to_string_view, ostringstream>, + "ostringstream(convertible_to_string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const convertible_to_string_view, ostringstream>, + "ostringstream(convertible_to_string_view, ios::openmode) is explicit"); + + { + ostringstream ostrstr(cstr); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + } + { + ostringstream ostrstr(ccstr); + VERIFY( ostrstr.str() == ccstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + } + { + ostringstream ostrstr(cstr, std::ios_base::in); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == cstr.s[0]); + VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); + } + { + ostringstream ostrstr(cstr, std::ios_base::out); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); + } +} + +void +test02() +{ + // Test plumbing of C++26 various constructors taking string views + + auto const mode = std::ios_base::in | std::ios_base::out; + + { + ostringstream::allocator_type a; + // template <typename T> + // basic_ostringstream(const T&, ios_base::openmode, const allocator_type&) + { + ostringstream ostrstr(cstr, mode, a); // ={} checks for non-explicit ctor + VERIFY( ostrstr.str() == cstr.s ); + } + { + ostringstream ostrstr(cstr, std::ios::in, a); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == cstr.s[0]); + VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); + } + { + ostringstream ostrstr(cstr, std::ios::out, a); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); + } + } + + { + // template <typename T> + // basic_ostringstream(const T&, ios_base::openmode) + { + ostringstream ostrstr(cstr, mode); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == cstr.s[0]); + VERIFY( ostrstr.put('Y').good() ); + } + { + ostringstream ostrstr(cstr, std::ios::in); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == cstr.s[0]); + VERIFY( ostrstr.put('X').good() ); + } + { + ostringstream ostrstr(cstr, std::ios::out); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + VERIFY( ostrstr.put('Y').rdstate() == ostrstr.goodbit ); + } + } + + { + // template <typename T> + // explicit + // basic_ostringstream(const T&, ios_base::openmode = ios_base::out) + + ostringstream ostrstr(cstr); + VERIFY( ostrstr.str() == cstr.s ); + VERIFY( ostrstr.rdbuf()->sgetc() == ostringstream::traits_type::eof() ); + VERIFY( ostrstr.put('Y').good() ); + } +} + +using alloc_type = __gnu_test::uneq_allocator<C>; + +template<typename Alloc, typename CC = typename Alloc::value_type> + using ostringstream_with_alloc + = std::basic_ostringstream<CC, std::char_traits<CC>, Alloc>; + +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 ); + } +} + +void test04() +{ + { + ostringstream ostrstr; + ostrstr.str(cstr); + VERIFY( ostrstr.str() == cstr.s ); + } + { + ostringstream ostrstr; + ostrstr.str(ccstr); + VERIFY( ostrstr.str() == ccstr.s ); + } +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/string_view.cc new file mode 100644 index 0000000..ee6ac8d --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/cons/wchar_t/string_view.cc @@ -0,0 +1,6 @@ +// C++26 [ostringstream.general] +// { dg-do run { target c++26 } } + +#define C wchar_t +#define L(a) L##a +#include "../char/string_view.cc" 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 new file mode 100644 index 0000000..14278b3 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/char/string_view.cc @@ -0,0 +1,211 @@ +// C++26 31.8.2.1 [stringbuf.general] + +// { dg-do run { target c++26 } } + +#include <sstream> +#include <string> +#include <string_view> +#include <testsuite_allocator.h> +#include <testsuite_hooks.h> + +// Check C++26 P2495 stringbuf ctors and members str(s) that accept a +// string_view, or anything convertible to a string_view, in place of a +// string object. + +#ifndef C +# define C char +# define L(a) a +#endif + +using string = std::basic_string<C>; +using string_view = std::basic_string_view<C>; +using stringbuf = std::basic_stringbuf<C>; + +struct convertible_to_string_view { + string s; + operator string_view() const { return s; } +}; + +const string str(L("This is a test string")); +convertible_to_string_view cstr{str}; // a copy +const convertible_to_string_view ccstr{str}; // another copy + +template <typename stringbuf = std::basic_stringbuf<C>> +void +test01() +{ + // Test C++26 constructor and str(s) taking a generalized string_view + + static_assert(! requires { stringbuf(1); }, + "stringbuf ctor should reject what cannot be converted to a string_view"); + static_assert(! requires { stringbuf().str(1); }, + "stringbuf::str(s) should reject what cannot be converted to a string_view"); + + static_assert(!std::is_convertible_v<string_view, stringbuf>, + "stringbuf(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const string_view, stringbuf>, + "stringbuf(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<convertible_to_string_view, stringbuf>, + "stringbuf(convertible_to_string_view, ios::openmode) is explicit"); + static_assert( + !std::is_convertible_v<const convertible_to_string_view, stringbuf>, + "stringbuf(convertible_to_string_view, ios::openmode) is explicit"); + + { + stringbuf sbuf(cstr); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sgetc() == cstr.s[0] ); + } + { + stringbuf sbuf(ccstr); + VERIFY( sbuf.str() == ccstr.s ); + VERIFY( sbuf.sgetc() == ccstr.s[0] ); + } + { + stringbuf sbuf(cstr, std::ios_base::in); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sgetc() == cstr.s[0] ); + VERIFY( sbuf.sputc('X') == stringbuf::traits_type::eof() ); + } + { + stringbuf sbuf(ccstr, std::ios_base::in); + VERIFY( sbuf.str() == ccstr.s ); + VERIFY( sbuf.sgetc() == ccstr.s[0] ); + VERIFY( sbuf.sputc('X') == stringbuf::traits_type::eof() ); + } + { + stringbuf sbuf(cstr, std::ios_base::out); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sputc('Y') == 'Y' ); + VERIFY( sbuf.sgetc() == stringbuf::traits_type::eof() ); + } + { + stringbuf sbuf(ccstr, std::ios_base::out); + VERIFY( sbuf.str() == ccstr.s ); + VERIFY( sbuf.sputc('Y') == 'Y' ); + VERIFY( sbuf.sgetc() == stringbuf::traits_type::eof() ); + } +} + +void +test02() +{ + // Test C++26 constructors taking string views using different allocators + + auto const mode = std::ios_base::in | std::ios_base::out; + + { + // template <typename T> + // basic_stringbuf(const T&, ios_base::openmode, const allocator_type&) + + stringbuf::allocator_type a; + { + stringbuf sbuf(cstr, mode, a); // ={} checks for non-explicit ctor + VERIFY( sbuf.str() == cstr.s ); + } + { + stringbuf sbuf(cstr, std::ios::in, a); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sgetc() == cstr.s[0] ); + VERIFY( sbuf.sputc('X') == stringbuf::traits_type::eof() ); + } + + { + stringbuf sbuf(cstr, std::ios::out, a); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sputc('X') == 'X' ); + VERIFY( sbuf.sgetc() == stringbuf::traits_type::eof() ); + } + } + + { + // template <typename T> + // basic_stringbuf(const T&, ios_base::openmode) + { + stringbuf sbuf(cstr, mode); + VERIFY( sbuf.str() == cstr.s ); + } + { + stringbuf sbuf(cstr, std::ios::in); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sgetc() == cstr.s[0] ); + VERIFY( sbuf.sputc('X') == stringbuf::traits_type::eof() ); + } + { + stringbuf sbuf(cstr, std::ios::out); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sputc('X') == 'X' ); + VERIFY( sbuf.sgetc() == stringbuf::traits_type::eof() ); + } + } + + { + // template <typename T> + // explicit + // basic_stringbuf(const T&, ios_base::openmode = ios_base::in|ios_base::out) + + stringbuf sbuf(cstr); + VERIFY( sbuf.str() == cstr.s ); + VERIFY( sbuf.sgetc() == cstr.s[0] ); + } +} + +using alloc_type = __gnu_test::uneq_allocator<C>; + +template<typename Alloc, typename CC = typename Alloc::value_type> + using stringbuf_with_alloc + = std::basic_stringbuf<CC, std::char_traits<CC>, Alloc>; + +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() ); + } +} + +void test04() +{ + { + stringbuf sbuf; + sbuf.str(cstr); + VERIFY( sbuf.str() == cstr.s ); + } + { + stringbuf sbuf; + sbuf.str(ccstr); + VERIFY( sbuf.str() == ccstr.s ); + } +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/string_view.cc new file mode 100644 index 0000000..c428491 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/cons/wchar_t/string_view.cc @@ -0,0 +1,6 @@ +// C++26 [stringbuf.general] +// { dg-do run { target c++26 } } + +#define C wchar_t +#define L(a) L##a +#include "../char/string_view.cc" 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 new file mode 100644 index 0000000..1c9ecea --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/char/string_view.cc @@ -0,0 +1,210 @@ +// C++26 31.8.2.1 [stringstream.general] + +// { dg-do run { target c++26 } } + +#include <sstream> +#include <string> +#include <string_view> +#include <testsuite_allocator.h> +#include <testsuite_hooks.h> + +// Check C++26 P2495 stringstream ctors and members str(s) that accept a +// string_view, or anything convertible to a string_view, in place of a +// string object. Mostly just verify plumbing. + +#ifndef C +# define C char +# define L(a) a +#endif + +using string = std::basic_string<C>; +using string_view = std::basic_string_view<C>; +using stringstream = std::basic_stringstream<C>; + +struct convertible_to_string_view { + string s; + operator string_view() const { return s; } +}; + +const string str(L("This is a test string")); +convertible_to_string_view cstr{str}; // a copy +const convertible_to_string_view ccstr{str}; // another copy + +template <typename stringstream = std::basic_stringstream<C>> +void +test01() +{ + // Test C++26 constructor and str(s) taking a generalized string_view + + static_assert(! requires { stringstream(1); }, + "stringstream ctor should reject what cannot be converted to a string_view"); + static_assert(! requires { stringstream().str(1); }, + "stringstream::str(s) should reject what cannot be converted to a string_view"); + + static_assert(!std::is_convertible_v<string_view, stringstream>, + "stringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const string_view, stringstream>, + "stringstream(string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<convertible_to_string_view, stringstream>, + "stringstream(convertible_to_string_view, ios::openmode) is explicit"); + static_assert(!std::is_convertible_v<const convertible_to_string_view, stringstream>, + "stringstream(convertible_to_string_view, ios::openmode) is explicit"); + + { + stringstream strstr(cstr); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + } + { + stringstream strstr(ccstr); + VERIFY( strstr.str() == ccstr.s ); + VERIFY( strstr.get() == ccstr.s[0] ); + } + { + stringstream strstr(cstr, std::ios_base::in); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + VERIFY( strstr.put('X').rdstate() == strstr.badbit ); + } + { + stringstream strstr(cstr, std::ios_base::out); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.put('Y').good() ); + VERIFY( strstr.get() == stringstream::traits_type::eof()); + } +} + +void +test02() +{ + // Test C++26 various constructors taking string views + + auto const mode = std::ios_base::in | std::ios_base::out; + + { + // template <typename T> + // basic_stringstream(const T&, ios_base::openmode, const allocator_type&) + + stringstream::allocator_type a; + { + stringstream strstr(cstr, mode, a); // ={} checks for non-explicit ctor + VERIFY( strstr.str() == cstr.s ); + } + { + stringstream strstr(cstr, std::ios::in, a); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + VERIFY( strstr.put('X').rdstate() == strstr.badbit ); + } + { + stringstream strstr(cstr, std::ios::out, a); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.put('X').good() ); + VERIFY( strstr.get() == stringstream::traits_type::eof()); + } + } + + { + // template <typename T> + // basic_stringstream(const T&, ios_base::openmode) + + { + stringstream strstr(cstr, mode); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + VERIFY( strstr.put('X').good() ); + } + { + stringstream strstr(cstr, std::ios::in); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + VERIFY( strstr.put('X').rdstate() == strstr.badbit ); + } + { + stringstream strstr(cstr, std::ios::out); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.put('X').good() ); + VERIFY( strstr.get() == stringstream::traits_type::eof()); + } + } + + { + // template <typename T> + // explicit + // basic_stringstream(const T&, ios_base::openmode = ios_base::in|ios_base::out) + + stringstream strstr(cstr); + VERIFY( strstr.str() == cstr.s ); + VERIFY( strstr.get() == cstr.s[0] ); + VERIFY( strstr.put('X').good() ); + } +} + +// A minimal allocator with no default constructor +template<typename T> + struct NoDefaultCons : __gnu_test::SimpleAllocator<T> + { + using __gnu_test::SimpleAllocator<T>::SimpleAllocator; + NoDefaultCons() = delete; + NoDefaultCons(int) { } + }; + +using alloc_type = __gnu_test::uneq_allocator<C>; + +template<typename Alloc, typename CC = typename Alloc::value_type> + using stringstream_with_alloc + = std::basic_stringstream<CC, std::char_traits<CC>, Alloc>; + +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()); + } +} + +void test04() +{ + { + stringstream strstr; + strstr.str( cstr ); + VERIFY( strstr.str() == cstr.s ); + } + { + stringstream strstr; + strstr.str( ccstr ); + VERIFY( strstr.str() == ccstr.s ); + } +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/string_view.cc b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/string_view.cc new file mode 100644 index 0000000..921c0fe --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_stringstream/cons/wchar_t/string_view.cc @@ -0,0 +1,6 @@ +// C++26 [stringstream.general] +// { dg-do run { target c++26 } } + +#define C wchar_t +#define L(a) L##a +#include "../char/string_view.cc" 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/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/ranges/iota/max_size_type.cc b/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc index 3e6f954..4739d9e 100644 --- a/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc +++ b/libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc @@ -400,6 +400,13 @@ static_assert(max_diff_t(max_size_t(1) << (numeric_limits<max_size_t>::digits-1)) == numeric_limits<max_diff_t>::min()); +// Verify that the types are structural types and can therefore be used +// as NTTP types. +template<max_size_t V> struct Su { static_assert(V*V == V+132); }; +template<max_diff_t V> struct Ss { static_assert(V*V == V+132); }; +template struct Su<12>; +template struct Ss<12>; + int main() { diff --git a/libstdc++-v3/testsuite/std/time/format/empty_spec.cc b/libstdc++-v3/testsuite/std/time/format/empty_spec.cc index 99cbd74..a94eee1 100644 --- a/libstdc++-v3/testsuite/std/time/format/empty_spec.cc +++ b/libstdc++-v3/testsuite/std/time/format/empty_spec.cc @@ -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,6 +186,10 @@ 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> @@ -294,6 +305,44 @@ test_hh_mm_ss() 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() { const duration<char, deciseconds::period> charRep(123); @@ -339,9 +388,11 @@ 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>(); } 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..5a9acbf --- /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/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); |