aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog368
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog343
-rw-r--r--gcc/ada/atree.adb2
-rw-r--r--gcc/ada/comperr.adb16
-rw-r--r--gcc/ada/doc/gnat_rm/gnat_language_extensions.rst156
-rw-r--r--gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst29
-rw-r--r--gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst59
-rw-r--r--gcc/ada/einfo-utils.adb9
-rw-r--r--gcc/ada/einfo.ads2
-rw-r--r--gcc/ada/exp_util.adb28
-rw-r--r--gcc/ada/gcc-interface/decl.cc20
-rw-r--r--gcc/ada/gnat_rm.texi267
-rw-r--r--gcc/ada/gnat_ugn.texi114
-rw-r--r--gcc/ada/gnatcmd.adb2
-rw-r--r--gcc/ada/libgnat/s-secsta.adb9
-rw-r--r--gcc/ada/libgnat/s-secsta__cheri.adb9
-rw-r--r--gcc/ada/libgnat/s-valuef.adb37
-rw-r--r--gcc/ada/libgnat/s-valuer.adb23
-rw-r--r--gcc/ada/opt.ads25
-rw-r--r--gcc/ada/repinfo.adb297
-rw-r--r--gcc/ada/sem_ch12.adb499
-rw-r--r--gcc/ada/sem_ch3.adb104
-rw-r--r--gcc/ada/sem_ch8.ads5
-rw-r--r--gcc/ada/sem_util.adb12
-rw-r--r--gcc/ada/sem_util.ads6
-rw-r--r--gcc/ada/sem_warn.adb14
-rw-r--r--gcc/ada/sinfo.ads2
-rw-r--r--gcc/ada/switch-c.adb21
-rw-r--r--gcc/ada/switch.adb2
-rw-r--r--gcc/ada/treepr.adb2
-rw-r--r--gcc/ada/usage.adb12
-rw-r--r--gcc/ada/vast.adb519
-rw-r--r--gcc/attribs.cc27
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-pragma.cc4
-rw-r--r--gcc/c/ChangeLog31
-rw-r--r--gcc/c/c-decl.cc22
-rw-r--r--gcc/c/c-lang.h12
-rw-r--r--gcc/c/c-parser.cc8
-rw-r--r--gcc/c/c-typeck.cc114
-rw-r--r--gcc/cfgexpand.cc15
-rw-r--r--gcc/cgraph.cc189
-rw-r--r--gcc/cgraph.h20
-rw-r--r--gcc/cobol/ChangeLog9
-rw-r--r--gcc/config/aarch64/aarch64-sme.md2
-rw-r--r--gcc/config/aarch64/aarch64.cc34
-rw-r--r--gcc/config/aarch64/aarch64.md8
-rw-r--r--gcc/config/i386/i386-expand.cc44
-rw-r--r--gcc/config/i386/i386-features.cc34
-rw-r--r--gcc/config/i386/x86-tune-sched.cc9
-rw-r--r--gcc/config/mcore/mcore.cc4
-rw-r--r--gcc/config/or1k/or1k.cc3
-rw-r--r--gcc/config/riscv/autovec-opt.md35
-rw-r--r--gcc/config/riscv/riscv-v.cc2
-rw-r--r--gcc/config/riscv/riscv.cc76
-rw-r--r--gcc/config/riscv/vector-iterators.md4
-rw-r--r--gcc/config/rs6000/rs6000.cc35
-rw-r--r--gcc/cp/ChangeLog15
-rw-r--r--gcc/cp/cp-tree.h12
-rw-r--r--gcc/cp/decl.cc10
-rw-r--r--gcc/cp/lex.cc19
-rw-r--r--gcc/diagnostic-format-html.cc633
-rw-r--r--gcc/diagnostic-path-output.cc34
-rw-r--r--gcc/diagnostic-show-locus.cc38
-rw-r--r--gcc/expr.cc64
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/intrinsic.texi526
-rw-r--r--gcc/gcc.cc8
-rw-r--r--gcc/gimple-range-fold.cc8
-rw-r--r--gcc/gimple-ssa-warn-access.cc1
-rw-r--r--gcc/internal-fn.cc4
-rw-r--r--gcc/ipa-cp.cc53
-rw-r--r--gcc/ipa-inline-transform.cc5
-rw-r--r--gcc/m2/ChangeLog10
-rw-r--r--gcc/m2/gm2-libs/ARRAYOFCHAR.def3
-rw-r--r--gcc/m2/target-independent/m2/Builtins.texi9
-rw-r--r--gcc/m2/target-independent/m2/SYSTEM-iso.texi2
-rw-r--r--gcc/m2/target-independent/m2/SYSTEM-pim.texi2
-rw-r--r--gcc/m2/target-independent/m2/gm2-libs.texi376
-rw-r--r--gcc/objc/ChangeLog5
-rw-r--r--gcc/objc/objc-act.h2
-rw-r--r--gcc/objcp/ChangeLog5
-rw-r--r--gcc/objcp/objcp-decl.h2
-rw-r--r--gcc/po/ChangeLog4
-rw-r--r--gcc/po/es.po193
-rw-r--r--gcc/selftest-xml.h50
-rw-r--r--gcc/testsuite/ChangeLog254
-rw-r--r--gcc/testsuite/c-c++-common/pragma-optimize-1.c10
-rw-r--r--gcc/testsuite/g++.dg/opt/pr120629.C53
-rw-r--r--gcc/testsuite/g++.target/i386/vect-pragma-target-1.C6
-rw-r--r--gcc/testsuite/g++.target/i386/vect-pragma-target-2.C6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr120630.c29
-rw-r--r--gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py38
-rw-r--r--gcc/testsuite/gcc.dg/html-output/missing-semicolon.py68
-rw-r--r--gcc/testsuite/gcc.dg/old-style-prom-4.c25
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py38
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py11
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-4.py155
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus.py12
-rw-r--r--gcc/testsuite/gcc.dg/pr120303.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr120630.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr120638.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr117811.c5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr120434-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90693-3.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90693-4.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90693-5.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90693-6.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c194
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c7
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h74
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h406
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c15
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c3
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h93
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h196
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c17
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c19
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c2
-rw-r--r--gcc/testsuite/lib/htmltest.py7
-rw-r--r--gcc/tree-ssa-math-opts.cc1
-rw-r--r--gcc/xml-printer.h42
-rw-r--r--gcc/xml.cc87
-rw-r--r--gcc/xml.h1
180 files changed, 6416 insertions, 1814 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6dcf4f3..549505e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,371 @@
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/120638
+ * tree-ssa-math-opts.cc (pass_cse_reciprocals::execute): Call
+ reset_flow_sensitive_info on arg1.
+
+2025-06-12 Stafford Horne <shorne@gmail.com>
+
+ PR target/120587
+ * config/or1k/or1k.cc (or1k_can_change_mode_class): Allow
+ changing flags mode from BI to SI to allow for paradoxical
+ subregs.
+
+2025-06-12 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/120604
+ * config/i386/i386-expand.cc (ix86_expand_int_movcc): Make sure
+ we can represent the difference between two 64-bit DImode
+ immediate values in 64-bit HOST_WIDE_INT.
+
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120629
+ * cfgexpand.cc (expand_gimple_cond): If dest bb isn't BB_RTL,
+ has any PHI nodes and false_edge->dest_idx before redirection is
+ different from make_single_succ_edge result's dest_idx, swap the
+ latter with the former last pred edge and their dest_idx members.
+
+2025-06-12 Pan Li <pan2.li@intel.com>
+
+ * config/riscv/riscv-v.cc (expand_vx_binary_vec_dup_vec): Add new
+ case SMAX.
+ (expand_vx_binary_vec_vec_dup): Ditto.
+ * config/riscv/riscv.cc (riscv_rtx_costs): Ditto.
+ * config/riscv/vector-iterators.md: Add new op smax.
+
+2025-06-12 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/120624
+ * config/aarch64/aarch64.md (SME_STATE_REGNUM): Expand on comments.
+ * config/aarch64/aarch64-sme.md (aarch64_restore_za): Also set
+ SME_STATE_REGNUM
+
+2025-06-12 Alfie Richards <alfie.richards@arm.com>
+
+ * cgraph.cc (cgraph_node::record_function_versions): Refactor and
+ rename to...
+ (cgraph_node::add_function_version): new function.
+ * cgraph.h (cgraph_node::record_function_versions): Refactor and
+ rename to...
+ (cgraph_node::add_function_version): new function.
+ * config/aarch64/aarch64.cc (aarch64_get_function_versions_dispatcher):
+ Remove reordering.
+ * config/i386/i386-features.cc (ix86_get_function_versions_dispatcher):
+ Remove reordering.
+ * config/riscv/riscv.cc (riscv_get_function_versions_dispatcher):
+ Remove reordering.
+ * config/rs6000/rs6000.cc (rs6000_get_function_versions_dispatcher):
+ Remove reordering.
+
+2025-06-12 Alfie Richards <alfie.richards@arm.com>
+
+ * attribs.cc (is_function_default_version): Add target_version logic.
+
+2025-06-12 Hu, Lin1 <lin1.hu@intel.com>
+
+ * config/i386/x86-tune-sched.cc (ix86_issue_rate): Set 4 for SRF,
+ 6 for GRR, GNR, CWF, DMR, ARL, PTL.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/116792
+ * diagnostic-format-html.cc: Include "selftest-xml.h".
+ (html_builder::make_element_for_diagnostic): Move...
+ (class html_token_printer): ...from local to the function
+ to the global namespace.
+ (struct selftest::token_printer_test): New.
+ (selftest::test_token_printer): New.
+ (selftest::test_simple_log): Simplify using ASSERT_XML_PRINT_EQ.
+ (selftest::test_metadata): Likewise.
+ (selftest::diagnostic_format_html_cc_tests): Run the new test.
+ * selftest-xml.h: New file.
+ * xml.cc: Include "selftest-xml.h".
+ (selftest::assert_xml_print_eq): New.
+ (selftest::test_no_dtd): Simplify using ASSERT_XML_PRINT_EQ.
+ (selftest::test_printer): Likewise.
+ (selftest::test_attribute_ordering): Likewise.
+
+2025-06-11 Edwin Lu <ewlu@rivosinc.com>
+
+ * config/riscv/riscv.cc (struct riscv_tune_param): Add tune
+ param.
+ (riscv_sched_can_speculate_insn): Implement.
+ (TARGET_SCHED_CAN_SPECULATE_INSN): Ditto.
+
+2025-06-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/120604
+ * config/i386/i386-expand.cc (ix86_expand_int_movcc): Cast operands of
+ signed 64-bit HOST_WIDE_INT subtractions to (unsigned HOST_WIDE_INT).
+
+2025-06-11 Paul-Antoine Arras <parras@baylibre.com>
+
+ PR target/119100
+ * config/riscv/autovec-opt.md (*<optab>_vf_<mode>): Only handle vfmadd
+ and vfmsub.
+ (*vfnmsub_<mode>): New pattern.
+ (*vfnmadd_<mode>): New pattern.
+ * config/riscv/riscv.cc (get_vector_binary_rtx_cost): Add cost model for
+ NEG and VEC_DUPLICATE.
+
+2025-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * gimple-range-fold.cc: Include rtl.h.
+ (fold_using_range::range_of_range_op): Handle bb ending with
+ GIMPLE_COND during RTL expansion where there is only one succ
+ edge instead of two.
+
+2025-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ * internal-fn.cc (expand_POPCOUNT): Use
+ expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE) instead of
+ expand_normal (lhs).
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/116792
+ * diagnostic-format-html.cc: Include "diagnostic-path.h" and
+ "diagnostic-client-data-hooks.h".
+ (html_builder::m_logical_loc_mgr): New field.
+ (html_builder::m_cur_nesting_levels): New field.
+ (html_builder::m_last_logical_location): New field.
+ (html_builder::m_last_location): New field.
+ (html_builder::m_last_expanded_location): New field.
+ (HTML_STYLE): Add "white-space: pre;" to .source and .annotation.
+ Add "gcc-quoted-text" CSS class.
+ (html_builder::html_builder): Initialize the new fields. If CSS
+ is enabled, add CDN links to PatternFly 3 stylesheets.
+ (html_builder::add_stylesheet): New.
+ (html_builder::on_report_diagnostic): Add "alert" param to
+ make_element_for_diagnostic, setting it by default, but unsetting
+ it for nested diagnostics below the top level. Use
+ add_at_nesting_level for nested diagnostics.
+ (add_nesting_level_attr): New.
+ (html_builder::add_at_nesting_level): New.
+ (get_pf_class_for_alert_div): New.
+ (get_pf_class_for_alert_icon): New.
+ (get_label_for_logical_location_kind): New.
+ (add_labelled_value): New.
+ (html_builder::make_element_for_diagnostic): Add leading comment.
+ Add "alert" param. Drop class="gcc-diagnostic" from <div> tag,
+ instead adding the class for a PatternFly 3 alert if "alert" is
+ true, and adding a <span> with an alert icon, both according to
+ the diagnostic severity. Add a severity prefix to the message for
+ alerts. Add any metadata/option text as suffixes to the message.
+ Show any logical location. Show any physical location. Don't
+ show the locus if the last location is unchanged within the
+ diagnostic_group. Wrap any execution path element in a
+ <div id="execution-path"> and add a label to it. Wrap any
+ generated patch in a <div id="suggested-fix"> and add a label
+ to it.
+ (selftest::test_simple_log): Update expected HTML.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostic-path-output.cc: Use xml::printer::add_text_from_pp.
+ * diagnostic-show-locus.cc: Likewise.
+ * xml-printer.h (xml::printer::add_text_from_pp): New decl.
+ * xml.cc (xml::node_with_children::add_text_from_pp): New.
+ (xml::printer::add_text_from_pp): New.
+ * xml.h (xml::node_with_children::add_text_from_pp): New decl.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/120610
+ * diagnostic-format-html.cc (html_builder::html_builder): Update
+ for new param of xml::printer::pop_tag.
+ (html_path_label_writer::end_label): Likewise.
+ (html_builder::make_element_for_diagnostic::html_token_printer):
+ Give the instance its own xml::printer. Update for new param of
+ xml::printer::pop_tag.
+ (html_builder::make_element_for_diagnostic): Give the instance its
+ own xml::printer.
+ (html_builder::make_metadata_element): Update for new param of
+ xml::printer::pop_tag.
+ (html_builder::flush_to_file): Likewise.
+ * diagnostic-path-output.cc (begin_html_stack_frame): Likewise.
+ (begin_html_stack_frame): Likewise.
+ (end_html_stack_frame): Likewise.
+ (print_path_summary_as_html): Likewise.
+ * diagnostic-show-locus.cc
+ (struct to_text::auto_check_tag_nesting): New.
+ (struct to_html:: auto_check_tag_nesting): New.
+ (to_text::pop_html_tag): Change param to const char *.
+ (to_html::pop_html_tag): Likewise; rename param to
+ "expected_name".
+ (default_diagnostic_start_span_fn<to_html>): Update for new param
+ of xml::printer::pop_tag.
+ (layout_printer<to_html>::end_label): Likewise.
+ (layout_printer<Sink>::print_trailing_fixits): Add RAII sentinel
+ to check tag nesting for the HTML case. Delete stray popping
+ of "td" in the presence of fix-it hints.
+ (layout_printer<Sink>::print_line): Add RAII sentinel
+ to check tag nesting for the HTML case.
+ (diagnostic_source_print_policy::print_as_html): Likewise.
+ (layout_printer<Sink>::print): Likewise.
+ * xml-printer.h (xml::printer::printer): Add optional
+ "check_popped_tags" param.
+ (xml::printer::pop_tag): Add "expected_name" param.
+ (xml::printer::get_num_open_tags): New accessor.
+ (xml::printer::dump): New decl.
+ (xml::printer::m_check_popped_tags): New field.
+ (class xml::auto_check_tag_nesting): New.
+ (class xml::auto_print_element): Update for new param of pop_tag.
+ * xml.cc: Move pragma pop so that the pragma also covers
+ xml::printer's member functions, "dump" in particular.
+ (xml::printer::printer): Add param "check_popped_tags".
+ (xml::printer::pop_tag): Add param "expected_name" and use it to assert
+ that the popped tag is as expected. Assert that we have a tag to
+ pop.
+ (xml::printer::dump): New.
+ (selftest::test_printer): Update for new param of pop_tag.
+ (selftest::test_attribute_ordering): Likewise.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ * gimple-ssa-warn-access.cc
+ (pass_waccess::maybe_check_dealloc_call): Add missing
+ auto_diagnostic_group to nest the "returned from %qD"
+ note within the warning.
+
+2025-06-10 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.cc (cgraph_node::make_profile_local): New member function.
+ (cgraph_node::make_profile_global0): New member function.
+ (cgraph_node::apply_scale): Do not call adjust_for_ipa_scalling.
+ (cgraph_node::scale_profile_to): New member function.
+ * cgraph.h (cgraph_node::make_profile_local,
+ cgraph_node::make_profile_global0, cgraph_node::scale_profile_to):
+ Declare.
+ * ipa-cp.cc (lenient_count_portion_handling): Fix logic dropping count
+ to local.
+ (update_counts_for_self_gen_clones): Use scale_profile_to.
+ (update_profiling_info): Use make_profile_local, make_profile_global0
+ and scale_profile_to.
+ (update_specialized_profile): Likewise.
+ * ipa-inline-transform.cc (clone_inlined_nodes): Call
+ adjust_for_ipa_scalling.
+
+2025-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * expr.cc (expand_expr_real_2) <CASE_CONVERT>: If get_range_pos_neg
+ at -O2 for scalar integer extension suggests the most significant
+ bit of op0 is not set, try both unsigned and signed conversion and
+ choose the cheaper one. If both are the same cost, choose one
+ based on TYPE_UNSIGNED (TREE_TYPE (treeop0)).
+
+2025-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * config/i386/i386.md (*bsr_rex64_2): Rename to ...
+ (*bsr_rex64<u>_2): ... this. Use any_extend instead of sign_extend.
+ (*bsr_2): Rename to ...
+ (*bsr<u>_2): ... this. Use any_extend instead of sign_extend.
+ (bsr splitters after those): Use any_extend instead of sign_extend.
+
+2025-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * cfgrtl.h (update_bb_for_insn_chain): Declare.
+ * cfgrtl.cc (update_bb_for_insn_chain): No longer static.
+ * cfgexpand.h (expand_remove_edge): Declare.
+ * cfgexpand.cc: Include "gimple-range.h".
+ (head_end_for_bb): New variable.
+ (label_rtx_for_bb): Drop ATTRIBUTE_UNUSED from bb argument.
+ Use head_end_for_bb if possible for non-BB_RTL bbs.
+ (expand_remove_edge): New function.
+ (maybe_cleanup_end_of_block): Use it instead of remove_edge.
+ (expand_gimple_cond): Don't clear EDGE_TRUE_VALUE and
+ EDGE_FALSE_VALUE just yet. Use head_end_for_bb elts instead
+ of BB_END and update_bb_for_insn_chain instead of update_bb_for_insn.
+ (expand_gimple_tailcall): Use expand_remove_edge instead of
+ remove_edge. Use head_end_for_bb elts instead of BB_END and
+ update_bb_for_insn_chain instead of update_bb_for_insn.
+ (expand_gimple_basic_block): Don't change bb to BB_RTL here, instead
+ use head_end_for_bb elts instead of BB_HEAD and BB_END. Use
+ update_bb_for_insn_chain instead of update_bb_for_insn.
+ (pass_expand::execute): Enable ranger before expand_gimple_basic_block
+ calls and create head_end_for_bb vector. Disable ranger after
+ those calls, turn still non-BB_RTL blocks into BB_RTL and set their
+ BB_HEAD and BB_END from head_end_for_bb elts, and clear EDGE_TRUE_VALUE
+ and EDGE_FALSE_VALUE flags on edges. Release head_end_for_bb
+ vector.
+ * tree-outof-ssa.cc (expand_phi_nodes): Don't clear phi nodes here.
+ * tree.h (get_range_pos_neg): Add gimple * argument defaulted to NULL.
+ * tree.cc (get_range_pos_neg): Add stmt argument. Use
+ get_range_query (cfun) instead of get_global_range_query () and pass
+ stmt as third argument to range_of_expr.
+ * expr.cc (expand_expr_divmod): Pass currently_expanding_gimple_stmt
+ to get_range_pos_neg.
+ (expand_expr_real_1) <case SSA_NAME>: Change internal fn handling
+ to avoid temporarily overwriting gimple_call_lhs of ifn, instead
+ temporarily overwrite SSA_NAME_VAR of its lhs.
+ (maybe_optimize_pow2p_mod_cmp): Pass currently_expanding_gimple_stmt
+ to get_range_pos_neg.
+ (maybe_optimize_mod_cmp): Likewise.
+ * internal-fn.cc (get_min_precision): Likewise. Use
+ get_range_query (cfun) instead of get_global_range_query () and pass
+ currently_expanding_gimple_stmt as third argument to range_of_expr.
+ Pass g to get_range_pos_neg.
+ (expand_addsub_overflow): Pass currently_expanding_gimple_stmt
+ to get_range_pos_neg.
+ (expand_mul_overflow): Likewise.
+ (expand_arith_overflow): Pass stmt to get_range_pos_neg.
+ * gimple-range-edge.cc: Include rtl.h.
+ (gimple_outgoing_range_stmt_p): Return NULL for BB_RTL bbs.
+ (gimple_outgoing_range::calc_switch_range): If default_edge is NULL,
+ assert currently_expanding_to_rtl and return before trying to
+ set range on that edge.
+ * builtins.cc (expand_builtin_strnlen): Use get_range_query (cfun)
+ instead of get_global_range_query () and pass
+ currently_expanding_gimple_stmt as third argument to range_of_expr.
+ (determine_block_size): Likewise.
+ * gimple-range.cc (gimple_ranger::range_on_exit): Set s to NULL
+ instead of last_nondebug_stmt for BB_RTL bbs.
+ * stmt.cc: Include cfgexpand.h.
+ (expand_case): Use expand_remove_edge instead of remove_edge.
+
+2025-06-10 Andrew MacLeod <amacleod@redhat.com>
+
+ * value-range.cc (irange::set_range_from_bitmask): When the bitmask
+ result is a singleton, check if it is contained in the range.
+
+2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/gcn/gcn-devices.def: Add gfx942, gfx950 and gfx9-4-generic.
+ * config/gcn/gcn-opts.h (TARGET_CDNA3, TARGET_CDNA3_PLUS,
+ TARGET_GLC_NAME, TARGET_TARGET_SC_CACHE): Define.
+ (TARGET_ARCHITECTED_FLAT_SCRATCH): Use also for CDNA3.
+ * config/gcn/gcn.h (gcn_isa): Add ISA_CDNA3 to the enum.
+ * config/gcn/gcn.cc (print_operand): Update 'g' to use
+ TARGET_GLC_NAME; add 'G' to print TARGET_GLC_NAME unconditionally.
+ * config/gcn/gcn-valu.md (scatter, gather): Use TARGET_GLC_NAME.
+ * config/gcn/gcn.md: Use %G<num> instead of glc; use 'buffer_inv sc1'
+ for TARGET_TARGET_SC_CACHE.
+ * doc/invoke.texi (march): Add gfx942, gfx950 and gfx9-4-generic.
+ * doc/install.texi (amdgcn*-*-*): Add gfx942, gfx950 and gfx9-4-generic.
+ * config/gcn/gcn-tables.opt: Regenerate.
+
+2025-06-10 Jeff Law <jlaw@ventanamicro.com>
+
+ * config/riscv/riscv.md (lui-constraint<X:mode>and_to_or): Do not use
+ the RTL template for split code. Emit it directly taking care to avoid
+ emitting a constant load that needed synthesis. Fix formatting.
+
+2025-06-10 Kito Cheng <kito.cheng@sifive.com>
+
+ * doc/riscv-ext.texi: Regen.
+
+2025-06-10 Pan Li <pan2.li@intel.com>
+
+ * config/riscv/riscv-v.cc (expand_vx_binary_vec_vec_dup): Add new
+ case UMOD.
+ * config/riscv/riscv.cc (riscv_rtx_costs): Ditto.
+ * config/riscv/vector-iterators.md: Add new op umod.
+
2025-06-09 David Malcolm <dmalcolm@redhat.com>
* diagnostic-format-sarif.cc (maybe_get_sarif_kind): Update for
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 52988ae..c544224 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250610
+20250613
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3af5b5d..f51e899 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,346 @@
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Generate
+ a zero-initialization for the anonymous object of a small aggregate
+ allocated on the stack.
+ (inline_status_for_subprog): Minor tweak.
+
+2025-06-12 Tonu Naks <naks@adacore.com>
+
+ * comperr.adb: update support instructions
+ * switch.adb: update support instructions
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sinfo.ads: Fix RM reference.
+
+2025-06-12 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Apply_External_Initialization): Reuse local constant.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/gnat_language_extensions.rst
+ (Generalized Finalization): Document the actual implementation.
+ (No_Raise): Move to separate section.
+ * gnat_rm.texi: Regenerate.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * libgnat/s-valuer.adb (Scan_Raw_Real): Apply tweak.
+
+2025-06-12 Tonu Naks <naks@adacore.com>
+
+ * comperr.adb: replace report@ with support@
+ * gnatcmd.adb: replace report@ with support@
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Private_Type): Fix test.
+ (Build_Derived_Record_Type): Adjust error recovery paths.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * einfo.ads (Has_Homonym): Fix inaccuracy in description.
+ * sem_ch8.ads (Find_Direct_Name): Remove obsolete description.
+ * sem_ch12.adb (Analyze_Associations): Rename I_Node parameter
+ into N and adjust description.
+ (Analyze_Subprogram_Instantiation): Add missing description.
+ (Contains_Instance_Of): Fix description.
+ (Associations): Rename Generic_Actual_Rec into Actual_Rec and
+ Gen_Assocs_Rec into Match_Rec.
+ (Analyze_One_Association): Rename I_Node parameter into N.
+ (Check_Fixed_Point_Warning): Rename Gen_Assocs parameter into
+ Match.
+ (Body of Associations): Minor cleanups and tweaks.
+ (Analyze_Associations): Rename I_Node parameter into N and
+ adjust implementation.
+ (Analyze_One_Association): Likewise.
+ (Analyze_Package_Instantiation): Remove obsolete code and clean up.
+ (Check_Fixed_Point_Warning): Rename Gen_Assocs parameter into
+ Match and adjust implementation.
+ (Freeze_Package_Instance): Simplify condition.
+ (Get_Unit_Instantiation_Node): Add support for instantiations of
+ subprograms and stop the loop properly in case of errors.
+ * sem_util.ads (Add_Global_Declaration): Rename N parameter into
+ Decl and fix description.
+ * sem_util.adb (Add_Global_Declaration): Rename N parameter into
+ Decl and adjust implementation.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * libgnat/s-valuer.adb (Scan_Raw_Real): Add RM reference.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * libgnat/s-valuer.adb (Scan_Raw_Real): Remove subexpression. Improve
+ surrounding comments.
+
+2025-06-12 Bob Duff <duff@adacore.com>
+
+ * vast.adb: Check basic tree properties.
+ * atree.adb (Traverse_Field): Minor.
+ * treepr.adb (Destroy): Minor comment.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/s-valuer.adb (Round_Extra): Use multiplicative test.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * einfo-utils.adb (Set_Convention): Remove obsolete test.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Discriminants): Set Ekind earlier.
+ * sem_util.adb (Enter_Name): Adjust error processing.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/s-valuef.adb (Integer_To_Fixed): Enable overflow checks.
+ Deal specifically with Val = 2**(Int'Size - 1) if Minus is not set.
+ Exit the loop when V saturates to 0 in the case of (huge) negative
+ exponents.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * exp_util.adb (Insert_Actions): Refine test.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler
+ switches) <-O>: Fix long line.
+ * gnat_ugn.texi: Regenerate.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (List of
+ all switches): Add -gnatRh subswitch.
+ (Debugging Control): Document -gnatRh subswitch.
+ * opt.ads (List_Representation_Info_Holes): New boolean variable.
+ * repinfo.adb: Add with clause for GNAT.Heap_Sort_G.
+ (List_Common_Type_Info): Relax assertion.
+ (List_Object_Info): Replace assertion with additional test.
+ (List_Record_Layout): If -gnatRh is specified, make sure that the
+ components are ordered by increasing offsets. Output a comment
+ line giving the number of unused bits if there is a hole between
+ consecutive components. Streamline the control flow of the loop.
+ (List_Record_Info): Use the original record type giving the layout
+ of components, if any, to display the layout of the record.
+ * switch-c.adb (Scan_Front_End_Switches) <-gnatR>: Add support for
+ -gnatRh subswitch.
+ * usage.adb (Usage): Document -gnatRh subswitch.
+ * gnat_ugn.texi: Regenerate.
+
+2025-06-12 Johannes Kliemann <kliemann@adacore.com>
+
+ * libgnat/s-secsta.adb (SS_Allocate): Add comment about
+ conservative alignment padding calculation.
+ * libgnat/s-secsta__cheri.adb (SS_Allocate): Add comment about
+ conservative alignment padding calculation.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_warn.adb (Check_References): Rewrite expression
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Constrain_Index, Make_Index, Array_Type_Declaration,
+ Analyze_Number_Declaration): Remove uses of E_Void.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * usage.adb (Usage): Justify the documentation of common switches
+ like that of other switches. Rework that of the -O switch.
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler
+ switches) <-O>: Rework and document 'z' and 'g' operands.
+ * doc/gnat_ugn/gnat_and_program_execution.rst (Optimization Levels):
+ Rework and document -Oz and -Og switches.
+ * gnat_ugn.texi: Regenerate.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Constrain_Index): Avoid unused itypes.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Constrain_Index): Factorize return statement.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Numeric_Type): Remove duplicate call.
+
+2025-06-10 Piotr Trojanek <trojanek@adacore.com>
+
+ * gen_il-gen-gen_entities.adb (Formal_Object_Kind): Remove
+ Entry_Component field.
+
+2025-06-10 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_attr.adb (Resolve_Attribute): Remove redundant guard.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * inline.adb (Analyze_Inlined_Bodies): Minor comment tweak.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * inline.adb (Instantiate_Body): Do not call Add_Scope_To_Clean if
+ the main unit is generic.
+ (Instantiate_Bodies): Do not deal with generic main units here.
+ * sem_ch12.adb (Need_Subprogram_Instance_Body): Return false if the
+ main unit is generic.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (ADA_EXCLUDE_SRCS): Add the 128-bit support files.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Factorize code.
+
+2025-06-10 Bob Duff <duff@adacore.com>
+
+ * einfo.ads (Associated_Node_For_Itype): Document that
+ Parent field may be empty.
+ * vast.adb: Allow empty Parent in Itypes.
+
+2025-06-10 Gary Dismukes <dismukes@adacore.com>
+
+ * einfo.ads: Revise comment about Dynamic_Predicate flag to make it
+ more accurate.
+ * sem_case.adb (Check_Choices): Test "not Has_Static_Predicate_Aspect"
+ as additional guard for error about use of subtype with nonstatic
+ predicate as a case choice. Improve related error message.
+
+2025-06-10 Tonu Naks <naks@adacore.com>
+
+ * libgnat/s-valueu.adb: add explict raise
+ * libgnat/s-valueu.ads: update annotation
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch6.adb, sem_ch6.ads (Check_Discriminant_Conformance): Move to …
+ * sem_ch3.adb (Check_Discriminant_Conformance): … here.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Freeze_Static_Object): Do not issue any error message
+ for compiler-generated entities.
+
+2025-06-10 Bob Duff <duff@adacore.com>
+
+ * vast.adb: Implement two checks. Improve debugging
+ outputs.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Insert_Conditional_Object_Declaration): Deal with a
+ transient scope being created around the declaration.
+ * freeze.adb (Freeze_Entity): Do not call Freeze_Static_Object for
+ a renaming declaration.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/s-vafi32.ads: Fix head description.
+ * libgnat/s-vafi64.ads: Likewise.
+ * libgnat/s-vafi128.ads: Likewise.
+
+2025-06-10 Bob Duff <duff@adacore.com>
+
+ * vast.adb: Initial implementation.
+ * vast.ads: Rename procedure. Remove parameter; body should decide
+ what to do.
+ * lib.ads (ipu): Minor: Rewrite comment for brevity, and because
+ of an inconvenient misspelling.
+ (Num_Units): Not used; remove.
+ (Remove_Unit): Minor: Remove "Currently" (which was current a decade
+ ago from) comment.
+ * lib.adb (Num_Units): Not used; remove.
+ * debug_a.adb (Debug_A_Entry): Fix bug: Use Write_Name_For_Debug,
+ so this won't crash on the Error node.
+ * debug.adb: Document -gnatd_V and -gnatd_W compiler switches.
+ * exp_ch6.adb (Validate_Subprogram_Calls): Remove redundant check for
+ Serious_Errors_Detected. (We turn off code gen when errors are
+ detected.)
+ * frontend.adb: Move decisions into VAST body.
+ * namet.ads (Present): Remove unnecessary overriding; these are
+ inherited by the derived types.
+ * namet.adb (Present): Likewise.
+
+2025-06-10 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos
+ to Entity (Expr) rather than Expr.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Find_Type_Of_Object): Fix comment.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Analyze_Component_Declaration): Rename constant.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Constrain_Array): Simplify.
+ (Process_Subtype): Adjust.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find
+ the root type of an aggregate of a derived tagged type.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks.
+
+2025-06-10 Viljar Indus <indus@adacore.com>
+
+ * sem_prag.adb (Is_Configuration_Pragma): Check that nodes
+ preceding the pragma are pragma nodes or originally were
+ pragma nodes.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and
+ use its value to call Bad_Value on boundary values.
+ (Scan_Decimal): Adjust call to Integer_to_Decimal.
+ (Value_Decimal): Likewise.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.ads (Process_Subtype): New formal.
+ * sem_ch3.adb (Process_Subtype): Likewise.
+ (Analyze_Subtype_Declaration, Access_Type_Declaration): Use new
+ formal.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Fix recursive call.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * par-ch5.adb (P_Declare_Statement): Rename local variable.
+ (P_Begin_Statement): Likewise.
+
+2025-06-10 Piotr Trojanek <trojanek@adacore.com>
+
+ * einfo.ads (Overridden_Operation, Static_Initialization): Remove
+ comments about a reused entity field.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Tweak formatting.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Add assertion.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Factorize initialization of variable.
+
2025-06-09 Gary Dismukes <dismukes@adacore.com>
* sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index,
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 3fa55a7..17538de 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -2702,9 +2702,9 @@ package body Atree is
-- tail recursive step won't go past the end.
declare
- Cur_Field : Offset_Array_Index := Traversed_Offset_Array'First;
Offsets : Traversed_Offset_Array renames
Traversed_Fields (Nkind (Cur_Node));
+ Cur_Field : Offset_Array_Index := Traversed_Offset_Array'First;
begin
if Offsets (Traversed_Offset_Array'First) /= No_Field_Offset then
diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb
index 180ea94..602b13d 100644
--- a/gcc/ada/comperr.adb
+++ b/gcc/ada/comperr.adb
@@ -307,16 +307,16 @@ package body Comperr is
Write_Str
("| Please submit a bug report by email " &
- "to report@adacore.com.");
+ "to support@adacore.com.");
End_Line;
Write_Str
- ("| GAP members can alternatively use GNAT Tracker:");
+ ("| GAP members can alternatively use GNATtracker:");
End_Line;
Write_Str
- ("| https://www.adacore.com/login?mode=gap " &
- "section 'Create New Ticket'.");
+ ("| https://support.adacore.com/csm " &
+ "by using the button 'Create A New Case'.");
End_Line;
Write_Str
@@ -326,17 +326,17 @@ package body Comperr is
else
Write_Str
- ("| Please submit a bug report using GNAT Tracker:");
+ ("| Please submit a bug report using GNATtracker at");
End_Line;
Write_Str
- ("| https://www.adacore.com/login " &
- "section 'Create New Ticket'.");
+ ("| https://support.adacore.com/csm " &
+ "by using the button 'Create New Case'.");
End_Line;
Write_Str
("| Or submit a bug report by email " &
- "to report@adacore.com");
+ "to support@adacore.com");
End_Line;
Write_Str
diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
index 1713f56..0a08a83 100644
--- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
+++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
@@ -1469,97 +1469,60 @@ that the record type must be a root type, in other words not a derived type.
The aspect additionally makes it possible to specify relaxed semantics for
the finalization operations by means of the ``Relaxed_Finalization`` setting.
-
-Example:
+Here is the archetypal example:
.. code-block:: ada
- type Ctrl is record
- Id : Natural := 0;
+ type T is record
+ ...
end record
with Finalizable => (Initialize => Initialize,
Adjust => Adjust,
Finalize => Finalize,
Relaxed_Finalization => True);
- procedure Adjust (Obj : in out Ctrl);
- procedure Finalize (Obj : in out Ctrl);
- procedure Initialize (Obj : in out Ctrl);
-
-The three procedures have the same profile, taking a single ``in out T``
-parameter.
+ procedure Adjust (Obj : in out T);
+ procedure Finalize (Obj : in out T);
+ procedure Initialize (Obj : in out T);
-We follow the same dynamic semantics as controlled objects:
+The three procedures have the same profile, with a single ``in out`` parameter,
+and also have the same dynamic semantics as for controlled types:
- ``Initialize`` is called when an object of type ``T`` is declared without
- default expression.
+ initialization expression.
- ``Adjust`` is called after an object of type ``T`` is assigned a new value.
- ``Finalize`` is called when an object of type ``T`` goes out of scope (for
- stack-allocated objects) or is explicitly deallocated (for heap-allocated
- objects). It is also called when on the value being replaced in an
- assignment.
-
-However the following differences are enforced by default when compared to the
-current Ada controlled-objects finalization model:
-
-* No automatic finalization of heap allocated objects: ``Finalize`` is only
- called when an object is implicitly deallocated. As a consequence, no-runtime
- support is needed for the implicit case, and no header will be maintained for
- this in heap-allocated controlled objects.
-
- Heap-allocated objects allocated through a nested access type definition will
- hence **not** be deallocated either. The result is simply that memory will be
- leaked in those cases.
-
-* The ``Finalize`` procedure should have have the :ref:`No_Raise_Aspect` specified.
- If that's not the case, a compilation error will be raised.
-
-Additionally, two other configuration aspects are added,
-``Legacy_Heap_Finalization`` and ``Exceptions_In_Finalize``:
-
-* ``Legacy_Heap_Finalization``: Uses the legacy automatic finalization of
- heap-allocated objects
-
-* ``Exceptions_In_Finalize``: Allow users to have a finalizer that raises exceptions
- **NB!** note that using this aspect introduces execution time penalities.
-
-.. _No_Raise_Aspect:
-
-No_Raise aspect
-----------------
+ stack-allocated objects) or is deallocated (for heap-allocated objects).
+ It is also called when the value is replaced by an assignment.
-The ``No_Raise`` aspect can be applied to a subprogram to declare that this subprogram is not
-expected to raise any exceptions. Should an exception still occur during the execution of
-this subprogram, ``Program_Error`` is raised.
+However, when ``Relaxed_Finalization`` is either ``True`` or not explicitly
+specified, the following differences are implemented relative to the semantics
+of controlled types:
-New specification for ``Ada.Finalization.Controlled``
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* The compiler has permission to perform no automatic finalization of
+ heap-allocated objects: ``Finalize`` is only called when such an object
+ is explicitly deallocated, or when the designated object is assigned a new
+ value. As a consequence, no runtime support is needed for performing
+ implicit deallocation. In particular, no per-object header data is needed
+ for heap-allocated objects.
-``Ada.Finalization.Controlled`` is now specified as:
-
-.. code-block:: ada
-
- type Controlled is abstract tagged null record
- with Initialize => Initialize,
- Adjust => Adjust,
- Finalize => Finalize,
- Legacy_Heap_Finalization, Exceptions_In_Finalize;
-
- procedure Initialize (Self : in out Controlled) is abstract;
- procedure Adjust (Self : in out Controlled) is abstract;
- procedure Finalize (Self : in out Controlled) is abstract;
+ Heap-allocated objects allocated through a nested access type will therefore
+ **not** be deallocated either. The result is simply that memory will be leaked
+ in this case.
+* The ``Adjust`` and ``Finalize`` procedures are automatically considered as
+ having the :ref:`No_Raise_Aspect` specified for them. In particular, the
+ compiler has permission to enforce none of the guarantees specified by the
+ RM 7.6.1 (14/1) and subsequent subclauses.
-### Examples
-
-A simple example of a ref-counted type:
+Simple example of ref-counted type:
.. code-block:: ada
type T is record
- Value : Integer;
+ Value : Integer;
Ref_Count : Natural := 0;
end record;
@@ -1571,8 +1534,8 @@ A simple example of a ref-counted type:
type T_Ref is record
Value : T_Access;
end record
- with Adjust => Adjust,
- Finalize => Finalize;
+ with Finalizable => (Adjust => Adjust,
+ Finalize => Finalize);
procedure Adjust (Ref : in out T_Ref) is
begin
@@ -1584,8 +1547,7 @@ A simple example of a ref-counted type:
Def_Ref (Ref.Value);
end Finalize;
-
-A simple file handle that ensures resources are properly released:
+Simple file handle that ensures resources are properly released:
.. code-block:: ada
@@ -1595,51 +1557,47 @@ A simple file handle that ensures resources are properly released:
function Open (Path : String) return File;
procedure Close (F : in out File);
+
private
type File is limited record
Handle : ...;
end record
- with Finalize => Close;
-
-
-Finalized tagged types
-^^^^^^^^^^^^^^^^^^^^^^^
+ with Finalizable (Finalize => Close);
+ end P;
-Aspects are inherited by derived types and optionally overriden by those. The
-compiler-generated calls to the user-defined operations are then
-dispatching whenever it makes sense, i.e. the object in question is of
-class-wide type and the class includes at least one finalized tagged type.
+Finalizable tagged types
+^^^^^^^^^^^^^^^^^^^^^^^^
-However note that for simplicity, it is forbidden to change the value of any of
-those new aspects in derived types.
+The aspect is inherited by derived types and the primitives may be overridden
+by the derivation. The compiler-generated calls to these operations are then
+dispatching whenever it makes sense, i.e. when the object in question is of a
+class-wide type and the class includes at least one finalizable tagged type.
Composite types
^^^^^^^^^^^^^^^
-When a finalized type is used as a component of a composite type, the latter
-becomes finalized as well. The three primitives are derived automatically
-in order to call the primitives of their components.
-
-If that composite type was already user-finalized, then the compiler
-calls the primitives of the components so as to stay consistent with today's
-controlled types's behavior.
-
-So, ``Initialize`` and ``Adjust`` are called on components before they
-are called on the composite object, but ``Finalize`` is called on the composite
-object first.
+When a finalizable type is used as a component of a composite type, the latter
+becomes finalizable as well. The three primitives are derived automatically
+in order to call the primitives of their components. The dynamic semantics is
+the same as for controlled components of composite types.
Interoperability with controlled types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-As a consequence of the redefinition of the ``Controlled`` type as a base type
-with the new aspects defined, interoperability with controlled type naturally
-follows the definition of the above rules. In particular:
+Finalizable types are fully interoperable with controlled types, in particular
+it is possible for a finalizable type to have a controlled component and vice
+versa, but the stricter dynamic semantics, in other words that of controlled
+types, is applied in this case.
-* It is possible to have a new finalized type have a controlled type
- component
-* It is possible to have a controlled type have a finalized type
- component
+.. _No_Raise_Aspect:
+
+No_Raise aspect
+----------------
+The ``No_Raise`` aspect can be applied to a subprogram to declare that this
+subprogram is not expected to raise an exception. Should an exception still
+be raised during the execution of the subprogram, it is caught at the end of
+this execution and ``Program_Error`` is propagated to the caller.
Inference of Dependent Types in Generic Instantiations
------------------------------------------------------
diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
index 4f46fba..b99eba7 100644
--- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -2112,7 +2112,7 @@ Alphabetical List of All Switches
.. index:: -gnatR (gcc)
-:switch:`-gnatR[0|1|2|3|4][e][j][m][s]`
+:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]`
Output representation information for declared types, objects and
subprograms. Note that this switch is not allowed if a previous
:switch:`-gnatD` switch has been given, since these two switches
@@ -2259,15 +2259,16 @@ Alphabetical List of All Switches
======= ==================================================================
*n* Effect
------- ------------------------------------------------------------------
- *0* No optimization, the default setting if no :switch:`-O` appears
- *1* Normal optimization, the default if you specify :switch:`-O` without an
- operand. A good compromise between code quality and compilation
- time.
- *2* Extensive optimization, may improve execution time, possibly at
+ *0* No optimization, the default setting if no :switch:`-O` appears.
+ *1* Moderate optimization, same as :switch:`-O` without an operand.
+ A good compromise between code quality and compilation time.
+ *2* Extensive optimization, should improve execution time, possibly at
the cost of substantially increased compilation time.
- *3* Same as :switch:`-O2`, and also includes inline expansion for small
- subprograms in the same unit.
- *s* Optimize space usage
+ *3* Full optimization, may further improve execution time, possibly at
+ the cost of substantially larger generated code.
+ *s* Optimize for size (code and data) rather than speed.
+ *z* Optimize aggressively for size (code and data) rather than speed.
+ *g* Optimize for debugging experience rather than speed.
======= ==================================================================
See also :ref:`Optimization_Levels`.
@@ -6088,7 +6089,7 @@ Debugging Control
.. index:: -gnatR (gcc)
-:switch:`-gnatR[0|1|2|3|4][e][j][m][s]`
+:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]`
This switch controls output from the compiler of a listing showing
representation information for declared types, objects and subprograms.
For :switch:`-gnatR0`, no information is output (equivalent to omitting
@@ -6116,17 +6117,21 @@ Debugging Control
extended representation information for record sub-components of records
is included.
+ If the switch is followed by a ``h`` (e.g. :switch:`-gnatR3h`), then
+ the components of records are sorted by increasing offsets and holes
+ between consecutive components are flagged.
+
If the switch is followed by an ``m`` (e.g. :switch:`-gnatRm`), then
subprogram conventions and parameter passing mechanisms for all the
subprograms are included.
- If the switch is followed by a ``j`` (e.g., :switch:`-gnatRj`), then
+ If the switch is followed by a ``j`` (e.g. :switch:`-gnatRj`), then
the output is in the JSON data interchange format specified by the
ECMA-404 standard. The semantic description of this JSON output is
available in the specification of the Repinfo unit present in the
compiler sources.
- If the switch is followed by an ``s`` (e.g., :switch:`-gnatR3s`), then
+ If the switch is followed by an ``s`` (e.g. :switch:`-gnatR3s`), then
the output is to a file with the name :file:`file.rep` where ``file`` is
the name of the corresponding source file, except if ``j`` is also
specified, in which case the file name is :file:`file.json`.
diff --git a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
index 756bc74..4ecb3cf 100644
--- a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
+++ b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
@@ -1584,18 +1584,16 @@ Turning on optimization makes the compiler attempt to improve the
performance and/or code size at the expense of compilation time and
possibly the ability to debug the program.
-If you use multiple :switch:`-O` switches, with or without level
-numbers, the last such switch is the one that's used.
-
-You can use the
-:switch:`-O` switch (the permitted forms are :switch:`-O0`, :switch:`-O1`
-:switch:`-O2`, :switch:`-O3`, and :switch:`-Os`)
-to ``gcc`` to control the optimization level:
+You can pass the :switch:`-O` switch, with or without an operand
+(the permitted forms with an operand are :switch:`-O0`, :switch:`-O1`,
+:switch:`-O2`, :switch:`-O3`, :switch:`-Os`, :switch:`-Oz`, and
+:switch:`-Og`) to ``gcc`` to control the optimization level. If you
+pass multiple :switch:`-O` switches, with or without an operand,
+the last such switch is the one that's used:
* :switch:`-O0`
- No optimization (the default);
- generates unoptimized code but has
+ No optimization (the default); generates unoptimized code but has
the fastest compilation time. Debugging is easiest with this switch.
Note that many other compilers do substantial optimization even if
@@ -1606,32 +1604,45 @@ to ``gcc`` to control the optimization level:
mind when doing performance comparisons.
* :switch:`-O1`
- Moderate optimization; optimizes reasonably well but does not
- degrade compilation time significantly. You may not be able to see
- some variables in the debugger and changing the value of some
- variables in the debugger may not have the effect you desire.
+ Moderate optimization (same as :switch:`-O` without an operand);
+ optimizes reasonably well but does not degrade compilation time
+ significantly. You may not be able to see some variables in the
+ debugger, and changing the value of some variables in the debugger
+ may not have the effect you desire.
* :switch:`-O2`
- Full optimization;
- generates highly optimized code and has
- the slowest compilation time. You may see significant impacts on
+ Extensive optimization; generates highly optimized code but has
+ an increased compilation time. You may see significant impacts on
your ability to display and modify variables in the debugger.
* :switch:`-O3`
- Full optimization as in :switch:`-O2`;
- also uses more aggressive automatic inlining of subprograms within a unit
- (:ref:`Inlining_of_Subprograms`) and attempts to vectorize loops.
-
+ Full optimization; attempts more sophisticated transformations, in
+ particular on loops, possibly at the cost of larger generated code.
+ You may be hardly able to use the debugger at this optimization level.
* :switch:`-Os`
- Optimize space usage (code and data) of resulting program.
+ Optimize for size (code and data) of resulting binary rather than
+ speed; based on the :switch:`-O2` optimization level, but disables
+ some of its transformations that often increase code size, as well
+ as performs further optimizations designed to reduce code size.
+
+* :switch:`-Oz`
+ Optimize aggressively for size (code and data) of resulting binary
+ rather than speed; may increase the number of instructions executed
+ if these instructions require fewer bytes to be encoded.
+
+* :switch:`-Og`
+ Optimize for debugging experience rather than speed; based on the
+ :switch:`-O1` optimization level, but attempts to eliminate all the
+ negative effects of optimization on debugging.
+
Higher optimization levels perform more global transformations on the
program and apply more expensive analysis algorithms in order to generate
faster and more compact code. The price in compilation time, and the
-resulting improvement in execution time,
-both depend on the particular application and the hardware environment.
-You should experiment to find the best level for your application.
+resulting improvement in execution time, both depend on the particular
+application and the hardware environment. You should experiment to find
+the best level for your application.
Since the precise set of optimizations done at each level will vary from
release to release (and sometime from target to target), it is best to think
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
index 15f5b99..91d273c 100644
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -2639,14 +2639,7 @@ package body Einfo.Utils is
-- anonymous protected types, since protected types always have the
-- default convention.
- if Present (Etype (E))
- and then (Is_Object (E)
-
- -- Allow E_Void (happens for pragma Convention appearing
- -- in the middle of a record applying to a component)
-
- or else Ekind (E) = E_Void)
- then
+ if Present (Etype (E)) and then Is_Object (E) then
declare
Typ : constant Entity_Id := Etype (E);
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 495a193..d8958d6 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -1689,7 +1689,7 @@ package Einfo is
--
-- Has_Homonym
-- Defined in all entities. Set if an entity has a homonym in the same
--- scope. Used by the backend to generate unique names for all entities.
+-- scope. Used by Exp_Dbug to generate unique names for all entities.
-- Has_Implicit_Dereference
-- Defined in types and discriminants. Set if the type has an aspect
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 8ac1b90..45eb808 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -8228,19 +8228,31 @@ package body Exp_Util is
return;
end if;
- -- the expansion of Task and protected type declarations can
+ -- The expansion of task and protected type declarations can
-- create declarations for temporaries which, like other actions
- -- are inserted and analyzed before the current declaraation.
- -- However, the current scope is the synchronized type, and
- -- for unnesting it is critical that the proper scope for these
- -- generated entities be the enclosing one.
+ -- are inserted and analyzed before the current declaration.
+ -- However, in some cases, the current scope is the synchronized
+ -- type, and for unnesting it is critical that the proper scope
+ -- for these generated entities be the enclosing one.
when N_Task_Type_Declaration
| N_Protected_Type_Declaration =>
- Push_Scope (Scope (Current_Scope));
- Insert_List_Before_And_Analyze (P, Ins_Actions);
- Pop_Scope;
+ declare
+ Skip_Scope : constant Boolean :=
+ Ekind (Current_Scope) in Concurrent_Kind;
+ begin
+ if Skip_Scope then
+ Push_Scope (Scope (Current_Scope));
+ end if;
+
+ Insert_List_Before_And_Analyze (P, Ins_Actions);
+
+ if Skip_Scope then
+ Pop_Scope;
+ end if;
+ end;
+
return;
-- A special case, N_Raise_xxx_Error can act either as a statement
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 1694b4e..972607a 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -1228,6 +1228,24 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnu_expr = gnat_build_constructor (gnu_type, v);
}
+ /* If we are allocating the anonymous object of a small aggregate on
+ the stack, zero-initialize it so that the entire object is assigned
+ and the subsequent assignments need not preserve unknown bits, but
+ do it only when optimization is enabled for the sake of consistency
+ with the gimplifier which does the same for CONSTRUCTORs. */
+ else if (definition
+ && !imported_p
+ && !static_flag
+ && !gnu_expr
+ && TREE_CODE (gnu_type) == RECORD_TYPE
+ && TREE_CODE (gnu_object_size) == INTEGER_CST
+ && compare_tree_int (gnu_object_size, MAX_FIXED_MODE_SIZE) <= 0
+ && Present (Related_Expression (gnat_entity))
+ && Nkind (Original_Node (Related_Expression (gnat_entity)))
+ == N_Aggregate
+ && optimize)
+ gnu_expr = build_constructor (gnu_type, NULL);
+
/* Convert the expression to the type of the object if need be. */
if (gnu_expr && initial_value_needs_conversion (gnu_type, gnu_expr))
gnu_expr = convert (gnu_type, gnu_expr);
@@ -5251,7 +5269,7 @@ inline_status_for_subprog (Entity_Id subprog)
&& Is_Record_Type (Etype (First_Formal (subprog)))
&& (gnu_type = gnat_to_gnu_type (Etype (First_Formal (subprog))))
&& !TYPE_IS_BY_REFERENCE_P (gnu_type)
- && tree_fits_uhwi_p (TYPE_SIZE (gnu_type))
+ && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST
&& compare_tree_int (TYPE_SIZE (gnu_type), MAX_FIXED_MODE_SIZE) <= 0)
return is_prescribed;
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index f44260b..0ae1a24 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -942,10 +942,9 @@ Simpler Accessibility Model
* Subprogram parameters::
* Function results::
-No_Raise aspect
+Generalized Finalization
-* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled.
-* Finalized tagged types::
+* Finalizable tagged types::
* Composite types::
* Interoperability with controlled types::
@@ -30939,27 +30938,24 @@ that the record type must be a root type, in other words not a derived type.
The aspect additionally makes it possible to specify relaxed semantics for
the finalization operations by means of the @code{Relaxed_Finalization} setting.
-
-Example:
+Here is the archetypal example:
@example
-type Ctrl is record
- Id : Natural := 0;
+type T is record
+ ...
end record
with Finalizable => (Initialize => Initialize,
Adjust => Adjust,
Finalize => Finalize,
Relaxed_Finalization => True);
-procedure Adjust (Obj : in out Ctrl);
-procedure Finalize (Obj : in out Ctrl);
-procedure Initialize (Obj : in out Ctrl);
+procedure Adjust (Obj : in out T);
+procedure Finalize (Obj : in out T);
+procedure Initialize (Obj : in out T);
@end example
-The three procedures have the same profile, taking a single @code{in out T}
-parameter.
-
-We follow the same dynamic semantics as controlled objects:
+The three procedures have the same profile, with a single @code{in out} parameter,
+and also have the same dynamic semantics as for controlled types:
@quotation
@@ -30968,98 +30964,49 @@ We follow the same dynamic semantics as controlled objects:
@item
@code{Initialize} is called when an object of type @code{T} is declared without
-default expression.
+initialization expression.
@item
@code{Adjust} is called after an object of type @code{T} is assigned a new value.
@item
@code{Finalize} is called when an object of type @code{T} goes out of scope (for
-stack-allocated objects) or is explicitly deallocated (for heap-allocated
-objects). It is also called when on the value being replaced in an
-assignment.
+stack-allocated objects) or is deallocated (for heap-allocated objects).
+It is also called when the value is replaced by an assignment.
@end itemize
@end quotation
-However the following differences are enforced by default when compared to the
-current Ada controlled-objects finalization model:
+However, when @code{Relaxed_Finalization} is either @code{True} or not explicitly
+specified, the following differences are implemented relative to the semantics
+of controlled types:
@itemize *
@item
-No automatic finalization of heap allocated objects: @code{Finalize} is only
-called when an object is implicitly deallocated. As a consequence, no-runtime
-support is needed for the implicit case, and no header will be maintained for
-this in heap-allocated controlled objects.
+The compiler has permission to perform no automatic finalization of
+heap-allocated objects: @code{Finalize} is only called when such an object
+is explicitly deallocated, or when the designated object is assigned a new
+value. As a consequence, no runtime support is needed for performing
+implicit deallocation. In particular, no per-object header data is needed
+for heap-allocated objects.
-Heap-allocated objects allocated through a nested access type definition will
-hence `not' be deallocated either. The result is simply that memory will be
-leaked in those cases.
+Heap-allocated objects allocated through a nested access type will therefore
+`not' be deallocated either. The result is simply that memory will be leaked
+in this case.
@item
-The @code{Finalize} procedure should have have the @ref{466,,No_Raise aspect} specified.
-If that’s not the case, a compilation error will be raised.
+The @code{Adjust} and @code{Finalize} procedures are automatically considered as
+having the @ref{466,,No_Raise aspect} specified for them. In particular, the
+compiler has permission to enforce none of the guarantees specified by the
+RM 7.6.1 (14/1) and subsequent subclauses.
@end itemize
-Additionally, two other configuration aspects are added,
-@code{Legacy_Heap_Finalization} and @code{Exceptions_In_Finalize}:
-
-
-@itemize *
-
-@item
-@code{Legacy_Heap_Finalization}: Uses the legacy automatic finalization of
-heap-allocated objects
-
-@item
-@code{Exceptions_In_Finalize}: Allow users to have a finalizer that raises exceptions
-`NB!' note that using this aspect introduces execution time penalities.
-@end itemize
-
-@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions id3}@anchor{467}@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{466}
-@subsection No_Raise aspect
-
-
-The @code{No_Raise} aspect can be applied to a subprogram to declare that this subprogram is not
-expected to raise any exceptions. Should an exception still occur during the execution of
-this subprogram, @code{Program_Error} is raised.
-
-@menu
-* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled.
-* Finalized tagged types::
-* Composite types::
-* Interoperability with controlled types::
-
-@end menu
-
-@node New specification for Ada Finalization Controlled,Finalized tagged types,,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions new-specification-for-ada-finalization-controlled}@anchor{468}
-@subsubsection New specification for @code{Ada.Finalization.Controlled}
-
-
-@code{Ada.Finalization.Controlled} is now specified as:
-
-@example
-type Controlled is abstract tagged null record
- with Initialize => Initialize,
- Adjust => Adjust,
- Finalize => Finalize,
- Legacy_Heap_Finalization, Exceptions_In_Finalize;
-
- procedure Initialize (Self : in out Controlled) is abstract;
- procedure Adjust (Self : in out Controlled) is abstract;
- procedure Finalize (Self : in out Controlled) is abstract;
-@end example
-
-### Examples
-
-A simple example of a ref-counted type:
+Simple example of ref-counted type:
@example
type T is record
- Value : Integer;
+ Value : Integer;
Ref_Count : Natural := 0;
end record;
@@ -31071,8 +31018,8 @@ type T_Access is access all T;
type T_Ref is record
Value : T_Access;
end record
- with Adjust => Adjust,
- Finalize => Finalize;
+ with Finalizable => (Adjust => Adjust,
+ Finalize => Finalize);
procedure Adjust (Ref : in out T_Ref) is
begin
@@ -31085,7 +31032,7 @@ begin
end Finalize;
@end example
-A simple file handle that ensures resources are properly released:
+Simple file handle that ensures resources are properly released:
@example
package P is
@@ -31094,66 +31041,64 @@ package P is
function Open (Path : String) return File;
procedure Close (F : in out File);
+
private
type File is limited record
Handle : ...;
end record
- with Finalize => Close;
+ with Finalizable (Finalize => Close);
+end P;
@end example
-@node Finalized tagged types,Composite types,New specification for Ada Finalization Controlled,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions finalized-tagged-types}@anchor{469}
-@subsubsection Finalized tagged types
-
+@menu
+* Finalizable tagged types::
+* Composite types::
+* Interoperability with controlled types::
-Aspects are inherited by derived types and optionally overriden by those. The
-compiler-generated calls to the user-defined operations are then
-dispatching whenever it makes sense, i.e. the object in question is of
-class-wide type and the class includes at least one finalized tagged type.
+@end menu
-However note that for simplicity, it is forbidden to change the value of any of
-those new aspects in derived types.
+@node Finalizable tagged types,Composite types,,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions finalizable-tagged-types}@anchor{467}
+@subsubsection Finalizable tagged types
-@node Composite types,Interoperability with controlled types,Finalized tagged types,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{46a}
-@subsubsection Composite types
+The aspect is inherited by derived types and the primitives may be overridden
+by the derivation. The compiler-generated calls to these operations are then
+dispatching whenever it makes sense, i.e. when the object in question is of a
+class-wide type and the class includes at least one finalizable tagged type.
-When a finalized type is used as a component of a composite type, the latter
-becomes finalized as well. The three primitives are derived automatically
-in order to call the primitives of their components.
+@node Composite types,Interoperability with controlled types,Finalizable tagged types,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{468}
+@subsubsection Composite types
-If that composite type was already user-finalized, then the compiler
-calls the primitives of the components so as to stay consistent with today’s
-controlled types’s behavior.
-So, @code{Initialize} and @code{Adjust} are called on components before they
-are called on the composite object, but @code{Finalize} is called on the composite
-object first.
+When a finalizable type is used as a component of a composite type, the latter
+becomes finalizable as well. The three primitives are derived automatically
+in order to call the primitives of their components. The dynamic semantics is
+the same as for controlled components of composite types.
-@node Interoperability with controlled types,,Composite types,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{46b}
+@node Interoperability with controlled types,,Composite types,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{469}
@subsubsection Interoperability with controlled types
-As a consequence of the redefinition of the @code{Controlled} type as a base type
-with the new aspects defined, interoperability with controlled type naturally
-follows the definition of the above rules. In particular:
-
+Finalizable types are fully interoperable with controlled types, in particular
+it is possible for a finalizable type to have a controlled component and vice
+versa, but the stricter dynamic semantics, in other words that of controlled
+types, is applied in this case.
-@itemize *
+@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions
+@anchor{gnat_rm/gnat_language_extensions id3}@anchor{46a}@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{466}
+@subsection No_Raise aspect
-@item
-It is possible to have a new finalized type have a controlled type
-component
-@item
-It is possible to have a controlled type have a finalized type
-component
-@end itemize
+The @code{No_Raise} aspect can be applied to a subprogram to declare that this
+subprogram is not expected to raise an exception. Should an exception still
+be raised during the execution of the subprogram, it is caught at the end of
+this execution and @code{Program_Error} is propagated to the caller.
@node Inference of Dependent Types in Generic Instantiations,External_Initialization Aspect,No_Raise aspect,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{46c}
+@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{46b}
@subsection Inference of Dependent Types in Generic Instantiations
@@ -31230,7 +31175,7 @@ package Int_Array_Operations is new Array_Operations
@end example
@node External_Initialization Aspect,Finally construct,Inference of Dependent Types in Generic Instantiations,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{46d}
+@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{46c}
@subsection External_Initialization Aspect
@@ -31271,7 +31216,7 @@ The maximum size of loaded files is limited to 2@w{^31} bytes.
@end cartouche
@node Finally construct,,External_Initialization Aspect,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46e}
+@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46d}
@subsection Finally construct
@@ -31288,7 +31233,7 @@ This feature is similar to the one with the same name in other languages such as
@end menu
@node Syntax<2>,Legality Rules<2>,,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46f}
+@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46e}
@subsubsection Syntax
@@ -31303,7 +31248,7 @@ handled_sequence_of_statements ::=
@end example
@node Legality Rules<2>,Dynamic Semantics<2>,Syntax<2>,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id5}@anchor{470}
+@anchor{gnat_rm/gnat_language_extensions id5}@anchor{46f}
@subsubsection Legality Rules
@@ -31313,7 +31258,7 @@ to be transferred outside the finally part are forbidden.
Goto & exit where the target is outside of the finally’s @code{sequence_of_statements} are forbidden
@node Dynamic Semantics<2>,,Legality Rules<2>,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id6}@anchor{471}
+@anchor{gnat_rm/gnat_language_extensions id6}@anchor{470}
@subsubsection Dynamic Semantics
@@ -31328,7 +31273,7 @@ execution, that is the finally block must be executed in full even if the contai
aborted, or if the control is transferred out of the block.
@node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top
-@anchor{gnat_rm/security_hardening_features doc}@anchor{472}@anchor{gnat_rm/security_hardening_features id1}@anchor{473}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
+@anchor{gnat_rm/security_hardening_features doc}@anchor{471}@anchor{gnat_rm/security_hardening_features id1}@anchor{472}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
@chapter Security Hardening Features
@@ -31350,7 +31295,7 @@ change.
@end menu
@node Register Scrubbing,Stack Scrubbing,,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{474}
+@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{473}
@section Register Scrubbing
@@ -31386,7 +31331,7 @@ programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
@c Stack Scrubbing:
@node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{475}
+@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{474}
@section Stack Scrubbing
@@ -31530,7 +31475,7 @@ Bar_Callable_Ptr.
@c Hardened Conditionals:
@node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{476}
+@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{475}
@section Hardened Conditionals
@@ -31620,7 +31565,7 @@ be used with other programming languages supported by GCC.
@c Hardened Booleans:
@node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{477}
+@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{476}
@section Hardened Booleans
@@ -31681,7 +31626,7 @@ and more details on that attribute, see @cite{Using the GNU Compiler Collection
@c Control Flow Redundancy:
@node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{478}
+@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{477}
@section Control Flow Redundancy
@@ -31849,7 +31794,7 @@ see @cite{Using the GNU Compiler Collection (GCC)}. These options
can be used with other programming languages supported by GCC.
@node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top
-@anchor{gnat_rm/obsolescent_features doc}@anchor{479}@anchor{gnat_rm/obsolescent_features id1}@anchor{47a}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
+@anchor{gnat_rm/obsolescent_features doc}@anchor{478}@anchor{gnat_rm/obsolescent_features id1}@anchor{479}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
@chapter Obsolescent Features
@@ -31868,7 +31813,7 @@ compatibility purposes.
@end menu
@node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id2}@anchor{47b}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{47c}
+@anchor{gnat_rm/obsolescent_features id2}@anchor{47a}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{47b}
@section pragma No_Run_Time
@@ -31881,7 +31826,7 @@ preferred usage is to use an appropriately configured run-time that
includes just those features that are to be made accessible.
@node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id3}@anchor{47d}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47e}
+@anchor{gnat_rm/obsolescent_features id3}@anchor{47c}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47d}
@section pragma Ravenscar
@@ -31890,7 +31835,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma
is part of the new Ada 2005 standard.
@node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id4}@anchor{47f}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{480}
+@anchor{gnat_rm/obsolescent_features id4}@anchor{47e}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{47f}
@section pragma Restricted_Run_Time
@@ -31900,7 +31845,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for
this kind of implementation dependent addition.
@node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id5}@anchor{481}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{482}
+@anchor{gnat_rm/obsolescent_features id5}@anchor{480}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{481}
@section pragma Task_Info
@@ -31926,7 +31871,7 @@ in the spec of package System.Task_Info in the runtime
library.
@node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{483}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{484}
+@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{482}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{483}
@section package System.Task_Info (@code{s-tasinf.ads})
@@ -31936,7 +31881,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package
standard replacement for GNAT’s @code{Task_Info} functionality.
@node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
-@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{486}
+@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{484}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{485}
@chapter Compatibility and Porting Guide
@@ -31958,7 +31903,7 @@ applications developed in other Ada environments.
@end menu
@node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{488}
+@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{486}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{487}
@section Writing Portable Fixed-Point Declarations
@@ -32080,7 +32025,7 @@ If you follow this scheme you will be guaranteed that your fixed-point
types will be portable.
@node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{489}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{48a}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{488}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{489}
@section Compatibility with Ada 83
@@ -32108,7 +32053,7 @@ following subsections treat the most likely issues to be encountered.
@end menu
@node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{48b}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{48c}
+@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{48a}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{48b}
@subsection Legal Ada 83 programs that are illegal in Ada 95
@@ -32208,7 +32153,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration.
@end itemize
@node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{48d}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48e}
+@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{48c}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48d}
@subsection More deterministic semantics
@@ -32236,7 +32181,7 @@ which open select branches are executed.
@end itemize
@node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48f}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{490}
+@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48e}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{48f}
@subsection Changed semantics
@@ -32278,7 +32223,7 @@ covers only the restricted range.
@end itemize
@node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{491}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{492}
+@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{490}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{491}
@subsection Other language compatibility issues
@@ -32311,7 +32256,7 @@ include @code{pragma Interface} and the floating point type attributes
@end itemize
@node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{493}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{494}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{492}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{493}
@section Compatibility between Ada 95 and Ada 2005
@@ -32383,7 +32328,7 @@ can declare a function returning a value from an anonymous access type.
@end itemize
@node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{495}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{496}
+@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{494}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{495}
@section Implementation-dependent characteristics
@@ -32406,7 +32351,7 @@ transition from certain Ada 83 compilers.
@end menu
@node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{497}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{498}
+@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{496}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{497}
@subsection Implementation-defined pragmas
@@ -32428,7 +32373,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not
relevant in a GNAT context and hence are not otherwise implemented.
@node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{499}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{49a}
+@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{498}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{499}
@subsection Implementation-defined attributes
@@ -32442,7 +32387,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
@code{Type_Class}.
@node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{49b}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{49c}
+@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{49a}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{49b}
@subsection Libraries
@@ -32471,7 +32416,7 @@ be preferable to retrofit the application using modular types.
@end itemize
@node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{49d}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49e}
+@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{49c}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49d}
@subsection Elaboration order
@@ -32507,7 +32452,7 @@ pragmas either globally (as an effect of the `-gnatE' switch) or locally
@end itemize
@node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49f}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{4a0}
+@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49e}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{49f}
@subsection Target-specific aspects
@@ -32520,10 +32465,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus
Ada 2005 and Ada 2012) are sometimes
incompatible with typical Ada 83 compiler practices regarding implicit
packing, the meaning of the Size attribute, and the size of access values.
-GNAT’s approach to these issues is described in @ref{4a1,,Representation Clauses}.
+GNAT’s approach to these issues is described in @ref{4a0,,Representation Clauses}.
@node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{4a2}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{4a3}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{4a1}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{4a2}
@section Compatibility with Other Ada Systems
@@ -32566,7 +32511,7 @@ far beyond this minimal set, as described in the next section.
@end itemize
@node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a4}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{4a1}
+@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a3}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{4a0}
@section Representation Clauses
@@ -32659,7 +32604,7 @@ with thin pointers.
@end itemize
@node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a5}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a6}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a4}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a5}
@section Compatibility with HP Ada 83
@@ -32689,7 +32634,7 @@ extension of package System.
@end itemize
@node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
-@anchor{share/gnu_free_documentation_license doc}@anchor{4a7}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a8}
+@anchor{share/gnu_free_documentation_license doc}@anchor{4a6}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a7}
@chapter GNU Free Documentation License
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 0a3cdb5..639708b 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -9850,7 +9850,7 @@ Treat pragma Restrictions as Restriction_Warnings.
@table @asis
-@item @code{-gnatR[0|1|2|3|4][e][j][m][s]}
+@item @code{-gnatR[0|1|2|3|4][e][h][m][j][s]}
Output representation information for declared types, objects and
subprograms. Note that this switch is not allowed if a previous
@@ -10076,7 +10076,7 @@ Library (RTL) ALI files.
@code{n} controls the optimization level:
-@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
+@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@item
`n'
@@ -10091,7 +10091,7 @@ Effect
@tab
-No optimization, the default setting if no @code{-O} appears
+No optimization, the default setting if no @code{-O} appears.
@item
@@ -10099,9 +10099,8 @@ No optimization, the default setting if no @code{-O} appears
@tab
-Normal optimization, the default if you specify @code{-O} without an
-operand. A good compromise between code quality and compilation
-time.
+Moderate optimization, same as @code{-O} without an operand.
+A good compromise between code quality and compilation time.
@item
@@ -10109,7 +10108,7 @@ time.
@tab
-Extensive optimization, may improve execution time, possibly at
+Extensive optimization, should improve execution time, possibly at
the cost of substantially increased compilation time.
@item
@@ -10118,8 +10117,8 @@ the cost of substantially increased compilation time.
@tab
-Same as @code{-O2}, and also includes inline expansion for small
-subprograms in the same unit.
+Full optimization, may further improve execution time, possibly at
+the cost of substantially larger generated code.
@item
@@ -10127,7 +10126,23 @@ subprograms in the same unit.
@tab
-Optimize space usage
+Optimize for size (code and data) rather than speed.
+
+@item
+
+`z'
+
+@tab
+
+Optimize aggressively for size (code and data) rather than speed.
+
+@item
+
+`g'
+
+@tab
+
+Optimize for debugging experience rather than speed.
@end multitable
@@ -15270,7 +15285,7 @@ restriction warnings rather than restrictions.
@table @asis
-@item @code{-gnatR[0|1|2|3|4][e][j][m][s]}
+@item @code{-gnatR[0|1|2|3|4][e][h][m][j][s]}
This switch controls output from the compiler of a listing showing
representation information for declared types, objects and subprograms.
@@ -15299,17 +15314,21 @@ If the switch is followed by an @code{e} (e.g. @code{-gnatR2e}), then
extended representation information for record sub-components of records
is included.
+If the switch is followed by a @code{h} (e.g. @code{-gnatR3h}), then
+the components of records are sorted by increasing offsets and holes
+between consecutive components are flagged.
+
If the switch is followed by an @code{m} (e.g. @code{-gnatRm}), then
subprogram conventions and parameter passing mechanisms for all the
subprograms are included.
-If the switch is followed by a @code{j} (e.g., @code{-gnatRj}), then
+If the switch is followed by a @code{j} (e.g. @code{-gnatRj}), then
the output is in the JSON data interchange format specified by the
ECMA-404 standard. The semantic description of this JSON output is
available in the specification of the Repinfo unit present in the
compiler sources.
-If the switch is followed by an @code{s} (e.g., @code{-gnatR3s}), then
+If the switch is followed by an @code{s} (e.g. @code{-gnatR3s}), then
the output is to a file with the name @code{file.rep} where @code{file} is
the name of the corresponding source file, except if @code{j} is also
specified, in which case the file name is @code{file.json}.
@@ -20281,13 +20300,12 @@ Turning on optimization makes the compiler attempt to improve the
performance and/or code size at the expense of compilation time and
possibly the ability to debug the program.
-If you use multiple @code{-O} switches, with or without level
-numbers, the last such switch is the one that’s used.
-
-You can use the
-@code{-O} switch (the permitted forms are @code{-O0}, @code{-O1}
-@code{-O2}, @code{-O3}, and @code{-Os})
-to @code{gcc} to control the optimization level:
+You can pass the @code{-O} switch, with or without an operand
+(the permitted forms with an operand are @code{-O0}, @code{-O1},
+@code{-O2}, @code{-O3}, @code{-Os}, @code{-Oz}, and
+@code{-Og}) to @code{gcc} to control the optimization level. If you
+pass multiple @code{-O} switches, with or without an operand,
+the last such switch is the one that’s used:
@itemize *
@@ -20298,8 +20316,7 @@ to @code{gcc} to control the optimization level:
@item @code{-O0}
-No optimization (the default);
-generates unoptimized code but has
+No optimization (the default); generates unoptimized code but has
the fastest compilation time. Debugging is easiest with this switch.
Note that many other compilers do substantial optimization even if
@@ -20316,10 +20333,11 @@ mind when doing performance comparisons.
@item @code{-O1}
-Moderate optimization; optimizes reasonably well but does not
-degrade compilation time significantly. You may not be able to see
-some variables in the debugger and changing the value of some
-variables in the debugger may not have the effect you desire.
+Moderate optimization (same as @code{-O} without an operand);
+optimizes reasonably well but does not degrade compilation time
+significantly. You may not be able to see some variables in the
+debugger, and changing the value of some variables in the debugger
+may not have the effect you desire.
@end table
@item
@@ -20328,9 +20346,8 @@ variables in the debugger may not have the effect you desire.
@item @code{-O2}
-Full optimization;
-generates highly optimized code and has
-the slowest compilation time. You may see significant impacts on
+Extensive optimization; generates highly optimized code but has
+an increased compilation time. You may see significant impacts on
your ability to display and modify variables in the debugger.
@end table
@@ -20340,9 +20357,9 @@ your ability to display and modify variables in the debugger.
@item @code{-O3}
-Full optimization as in @code{-O2};
-also uses more aggressive automatic inlining of subprograms within a unit
-(@ref{104,,Inlining of Subprograms}) and attempts to vectorize loops.
+Full optimization; attempts more sophisticated transformations, in
+particular on loops, possibly at the cost of larger generated code.
+You may be hardly able to use the debugger at this optimization level.
@end table
@item
@@ -20351,16 +20368,41 @@ also uses more aggressive automatic inlining of subprograms within a unit
@item @code{-Os}
-Optimize space usage (code and data) of resulting program.
+Optimize for size (code and data) of resulting binary rather than
+speed; based on the @code{-O2} optimization level, but disables
+some of its transformations that often increase code size, as well
+as performs further optimizations designed to reduce code size.
+@end table
+
+@item
+
+@table @asis
+
+@item @code{-Oz}
+
+Optimize aggressively for size (code and data) of resulting binary
+rather than speed; may increase the number of instructions executed
+if these instructions require fewer bytes to be encoded.
+@end table
+
+@item
+
+@table @asis
+
+@item @code{-Og}
+
+Optimize for debugging experience rather than speed; based on the
+@code{-O1} optimization level, but attempts to eliminate all the
+negative effects of optimization on debugging.
@end table
@end itemize
Higher optimization levels perform more global transformations on the
program and apply more expensive analysis algorithms in order to generate
faster and more compact code. The price in compilation time, and the
-resulting improvement in execution time,
-both depend on the particular application and the hardware environment.
-You should experiment to find the best level for your application.
+resulting improvement in execution time, both depend on the particular
+application and the hardware environment. You should experiment to find
+the best level for your application.
Since the precise set of optimizations done at each level will vary from
release to release (and sometime from target to target), it is best to think
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 546dbca..5e3802e 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -368,7 +368,7 @@ begin
-- --help flag.
Set_Standard_Output;
Write_Eol;
- Write_Line ("Report bugs to report@adacore.com");
+ Write_Line ("Report bugs to support@adacore.com");
return;
end if;
diff --git a/gcc/ada/libgnat/s-secsta.adb b/gcc/ada/libgnat/s-secsta.adb
index 2749658..9d78b86 100644
--- a/gcc/ada/libgnat/s-secsta.adb
+++ b/gcc/ada/libgnat/s-secsta.adb
@@ -633,6 +633,15 @@ package body System.Secondary_Stack is
if Over_Aligning then
Padding := Alignment;
+
+ -- Typically the padding would be
+ -- Alignment - (Addr mod Alignment)
+ -- however Addr in this case is not known yet. It depends on the
+ -- type of the secondary stack (Dynamic/Static). The allocation
+ -- routine for the respective type of stack requires to know the
+ -- allocation size before the address is known. To ensure a
+ -- sufficient allocation size to fit the padding, the padding is
+ -- calculated conservatively.
end if;
-- Round the requested size (plus the needed padding in case of
diff --git a/gcc/ada/libgnat/s-secsta__cheri.adb b/gcc/ada/libgnat/s-secsta__cheri.adb
index a24b50e..9a65ed28 100644
--- a/gcc/ada/libgnat/s-secsta__cheri.adb
+++ b/gcc/ada/libgnat/s-secsta__cheri.adb
@@ -662,6 +662,15 @@ package body System.Secondary_Stack is
if Over_Aligning then
Over_Align_Padding := Alignment;
+
+ -- Typically the padding would be
+ -- Alignment - (Addr mod Alignment)
+ -- however Addr in this case is not known yet. It depends on the
+ -- type of the secondary stack (Dynamic/Static). The allocation
+ -- routine for the respective type of stack requires to know the
+ -- allocation size before the address is known. To ensure a
+ -- sufficient allocation size to fit the padding, the padding is
+ -- calculated conservatively.
end if;
-- It should not be possible to request an allocation of negative
diff --git a/gcc/ada/libgnat/s-valuef.adb b/gcc/ada/libgnat/s-valuef.adb
index 9930740..7baa3b3 100644
--- a/gcc/ada/libgnat/s-valuef.adb
+++ b/gcc/ada/libgnat/s-valuef.adb
@@ -156,6 +156,9 @@ package body System.Value_F is
pragma Assert (Num < 0 and then Den < 0);
-- Accept only negative numbers to allow -2**(Int'Size - 1)
+ pragma Unsuppress (Overflow_Check);
+ -- Use overflow check to catch bad values
+
function Safe_Expont
(Base : Int;
Exp : in out Natural;
@@ -224,38 +227,52 @@ package body System.Value_F is
B : constant Int := Int (Base);
- V : Uns := Val;
- E : Uns := Uns (Extra);
+ V : Uns := Val;
+ S : Integer := ScaleB;
+ E : Uns := Uns (Extra);
Y, Z, Q1, R1, Q2, R2 : Int;
begin
+ -- The implementation of Value_R uses fully symmetric arithmetics
+ -- but here we cannot handle 2**(Int'Size - 1) if Minus is not set.
+
+ if V = 2**(Int'Size - 1) and then not Minus then
+ E := V rem Uns (B);
+ V := V / Uns (B);
+ S := S + 1;
+ end if;
+
-- We will use a scaled divide operation for which we must control the
-- magnitude of operands so that an overflow exception is not unduly
-- raised during the computation. The only real concern is the exponent.
- -- If ScaleB is too negative, then drop trailing digits, but preserve
- -- the last dropped digit.
+ -- If S is too negative, then drop trailing digits, but preserve the
+ -- last dropped digit, until V saturates to 0.
- if ScaleB < 0 then
+ if S < 0 then
declare
- LS : Integer := -ScaleB;
+ LS : Integer := -S;
begin
Y := Den;
Z := Safe_Expont (B, LS, Num);
for J in 1 .. LS loop
+ if V = 0 then
+ E := 0;
+ exit;
+ end if;
E := V rem Uns (B);
V := V / Uns (B);
end loop;
end;
- -- If ScaleB is too positive, then scale V up, which may then overflow
+ -- If S is too positive, then scale V up, which may then overflow
- elsif ScaleB > 0 then
+ elsif S > 0 then
declare
- LS : Integer := ScaleB;
+ LS : Integer := S;
begin
Y := Safe_Expont (B, LS, Den);
@@ -271,7 +288,7 @@ package body System.Value_F is
end loop;
end;
- -- If ScaleB is zero, then proceed directly
+ -- If S is zero, then proceed directly
else
Y := Den;
diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb
index 6f557e9..cc1f778 100644
--- a/gcc/ada/libgnat/s-valuer.adb
+++ b/gcc/ada/libgnat/s-valuer.adb
@@ -135,7 +135,9 @@ package body System.Value_R is
B : constant Uns := Uns (Base);
begin
- if Digit >= Base / 2 then
+ -- Beware that Base may be odd
+
+ if 2 * Unsigned (Digit) >= Base then
-- If Extra is maximum, round Value
@@ -578,8 +580,8 @@ package body System.Value_R is
if Str (Index) in '0' .. '9' then
After_Point := False;
- -- If this is a digit it can indicates either the float decimal
- -- part or the base to use.
+ -- If this is a digit it can indicate either the integral part or the
+ -- base to use.
Scan_Integral_Digits
(Str, Index, Max, Base, False, Value, Scale, N,
@@ -602,7 +604,8 @@ package body System.Value_R is
Bad_Value (Str);
end if;
- -- Check if the first number encountered is a base
+ -- Check if the first number encountered is a base. ':' is allowed in
+ -- place of '#' in virtue of RM J.2 (3).
pragma Assert (Index >= Str'First);
@@ -611,7 +614,13 @@ package body System.Value_R is
then
Base_Char := Str (Index);
- if N = 1 and then Value (1) in 2 .. 16 then
+ -- Functionally, "(Parts = 1 or else N = 1)" in the condition of the
+ -- following if statement could replaced by the simpler "N = 1". The
+ -- reason we use a more complicated expression is to accommodate
+ -- machine-code-based coverage tools: the simple version makes it
+ -- impossible to fully cover generic instances of System.Value_R with
+ -- Parts = 1.
+ if (Parts = 1 or else N = 1) and then Value (1) in 2 .. 16 then
Base := Unsigned (Value (1));
else
Base_Violation := True;
@@ -630,10 +639,10 @@ package body System.Value_R is
end if;
end if;
- -- Scan the integral part if still necessary
+ -- Scan the integral part if there was a base and no point right after
if Base_Char /= ASCII.NUL and then not After_Point then
- if Index > Max or else As_Digit (Str (Index)) not in Valid_Digit then
+ if As_Digit (Str (Index)) not in Valid_Digit then
Bad_Value (Str);
end if;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index cbe4701..e595b08 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -943,6 +943,21 @@ package Opt is
-- WARNING: There is a matching C declaration of this variable in fe.h
+ List_Representation_Info_Extended : Boolean := False;
+ -- GNAT
+ -- Set true by -gnatRe switch. Causes extended information for record types
+ -- to be included in the representation output information.
+
+ List_Representation_Info_Holes : Boolean := False;
+ -- GNAT
+ -- Set true by -gnatRh switch. Causes information for holes between record
+ -- components to be included in the representation output information.
+
+ List_Representation_Info_Mechanisms : Boolean := False;
+ -- GNAT
+ -- Set true by -gnatRm switch. Causes information on mechanisms to be
+ -- included in the representation output information.
+
List_Representation_Info_To_File : Boolean := False;
-- GNAT
-- Set true by -gnatRs switch. Causes information from -gnatR[1-4]m to be
@@ -955,16 +970,6 @@ package Opt is
-- Set true by -gnatRj switch. Causes information from -gnatR[1-4]m to be
-- output in the JSON data interchange format.
- List_Representation_Info_Mechanisms : Boolean := False;
- -- GNAT
- -- Set true by -gnatRm switch. Causes information on mechanisms to be
- -- included in the representation output information.
-
- List_Representation_Info_Extended : Boolean := False;
- -- GNAT
- -- Set true by -gnatRe switch. Causes extended information for record types
- -- to be included in the representation output information.
-
List_Preprocessing_Symbols : Boolean := False;
-- GNAT, GNATPREP
-- Set to True if symbols for preprocessing a source are to be listed
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index a6dff7c..ddbb58e 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -30,6 +30,7 @@ with Debug; use Debug;
with Einfo; use Einfo;
with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
+with GNAT.Heap_Sort_G;
with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
@@ -413,9 +414,9 @@ package body Repinfo is
Write_Line (";");
end if;
- -- Alignment is not always set for task, protected, and class-wide
- -- types, or when doing semantic analysis only. Representation aspects
- -- are not computed for types in a generic unit.
+ -- Alignment is not always set for concurrent types, class-wide types,
+ -- cloned subtypes, or when doing semantic analysis only. Representation
+ -- aspects are not computed for types declared in a generic unit.
else
-- Add unknown alignment entry in JSON format to ensure the format is
@@ -426,11 +427,13 @@ package body Repinfo is
Write_Unknown_Val;
end if;
- pragma Assert
- (not Expander_Active or else
- Is_Concurrent_Type (Ent) or else
- Is_Class_Wide_Type (Ent) or else
- Sem_Util.In_Generic_Scope (Ent));
+ pragma Assert (not Expander_Active
+ or else Is_Concurrent_Type (Ent)
+ or else Is_Class_Wide_Type (Ent)
+ or else (Ekind (Ent) = E_Record_Subtype
+ and then Present (Cloned_Subtype (Ent))
+ and then Has_Delayed_Freeze (Cloned_Subtype (Ent)))
+ or else Sem_Util.In_Generic_Scope (Ent));
end if;
end List_Common_Type_Info;
@@ -856,8 +859,7 @@ package body Repinfo is
-- generic unit, or if the back end is not being run), don't try to
-- print them.
- pragma Assert (Known_Esize (Ent) = Known_Alignment (Ent));
- if not Known_Alignment (Ent) then
+ if not Known_Esize (Ent) or else not Known_Alignment (Ent) then
return;
end if;
@@ -882,6 +884,7 @@ package body Repinfo is
Write_Eol;
Write_Line ("}");
+
else
Write_Str ("for ");
List_Name (Ent);
@@ -1223,11 +1226,135 @@ package body Repinfo is
Starting_First_Bit : Uint := Uint_0;
Prefix : String := "")
is
- Comp : Entity_Id;
- First : Boolean := True;
+ function First_Comp_Or_Discr (Ent : Entity_Id) return Entity_Id;
+ -- Like First_Component_Or_Discriminant, but reorder the components
+ -- according to their bit offset if need be.
+
+ -------------------------
+ -- First_Comp_Or_Discr --
+ -------------------------
+
+ function First_Comp_Or_Discr (Ent : Entity_Id) return Entity_Id is
+
+ function Is_Placed_Before (C1, C2 : Entity_Id) return Boolean;
+ -- Return True if component C1 is placed before component C2
+
+ ----------------------
+ -- Is_Placed_Before --
+ ----------------------
+
+ function Is_Placed_Before (C1, C2 : Entity_Id) return Boolean is
+ begin
+ return Known_Static_Component_Bit_Offset (C1)
+ and then Known_Static_Component_Bit_Offset (C2)
+ and then
+ Component_Bit_Offset (C1) < Component_Bit_Offset (C2);
+ end Is_Placed_Before;
+
+ -- Local variables
+
+ Comp : Entity_Id;
+ N_Comp : Natural := 0;
+ Prev : Entity_Id;
+ Reorder : Boolean := False;
+
+ -- Start of processing for First_Comp_Or_Discr
+
+ begin
+ -- Reordering is needed only for -gnatRh
+
+ if not List_Representation_Info_Holes then
+ return First_Component_Or_Discriminant (Ent);
+ end if;
+
+ -- Count the number of components and whether reordering is needed
+
+ Comp := First_Component_Or_Discriminant (Ent);
+ Prev := Comp;
+
+ while Present (Comp) loop
+ N_Comp := N_Comp + 1;
+
+ if not Reorder then
+ Reorder := Is_Placed_Before (Comp, Prev);
+ end if;
+
+ Prev := Comp;
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+
+ -- Reorder the components, if need be, by directly reshuffling the
+ -- list of entities between First_Entity and Last_Entity, which is
+ -- safe because we are invoked after compilation is finished.
+
+ if Reorder then
+ declare
+ Comps : array (Natural range 0 .. N_Comp) of Entity_Id;
+ -- Support array for the heapsort
+
+ function Lt (Op1, Op2 : Natural) return Boolean is
+ (Is_Placed_Before (Comps (Op1), Comps (Op2)));
+ -- Compare function for the heapsort
+
+ procedure Move (From : Natural; To : Natural);
+ pragma Inline (Move);
+ -- Move procedure for the heapsort
+
+ ----------
+ -- Move --
+ ----------
+
+ procedure Move (From : Natural; To : Natural) is
+ begin
+ Comps (To) := Comps (From);
+ end Move;
+
+ package HS is new GNAT.Heap_Sort_G (Lt => Lt, Move => Move);
+ -- The heapsort for record components
+
+ begin
+ -- Pack the components into the array
+
+ N_Comp := 0;
+ Comp := First_Component_Or_Discriminant (Ent);
+
+ while Present (Comp) loop
+ N_Comp := N_Comp + 1;
+ Comps (N_Comp) := Comp;
+
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+
+ -- Sort the array
+
+ HS.Sort (N_Comp);
+
+ -- Unpack the component into the list of entities
+
+ Set_First_Entity (Ent, Comps (1));
+ Set_Prev_Entity (Comps (1), Empty);
+ for J in 1 .. N_Comp - 1 loop
+ Set_Next_Entity (Comps (J), Comps (J + 1));
+ Set_Prev_Entity (Comps (J + 1), Comps (J));
+ end loop;
+ Set_Next_Entity (Comps (N_Comp), Empty);
+ Set_Last_Entity (Ent, Comps (N_Comp));
+ end;
+ end if;
+
+ return First_Component_Or_Discriminant (Ent);
+ end First_Comp_Or_Discr;
+
+ -- Local variables
+
+ Bit_Offset : Uint := Uint_0;
+ Comp : Entity_Id;
+ First : Boolean := True;
+
+ -- Start of processing for List_Record_Layout
begin
- Comp := First_Component_Or_Discriminant (Ent);
+ Comp := First_Comp_Or_Discr (Ent);
while Present (Comp) loop
-- Skip a completely hidden discriminant or a discriminant in an
@@ -1237,69 +1364,98 @@ package body Repinfo is
and then (Is_Completely_Hidden (Comp)
or else Is_Unchecked_Union (Ent))
then
- goto Continue;
- end if;
+ null;
-- Skip _Parent component in extension (to avoid overlap)
- if Chars (Comp) = Name_uParent then
- goto Continue;
- end if;
+ elsif Chars (Comp) = Name_uParent then
+ null;
-- All other cases
- declare
- Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp));
- Npos : constant Uint := Normalized_Position (Comp);
- Fbit : constant Uint := Normalized_First_Bit (Comp);
- Spos : Uint;
- Sbit : Uint;
+ else
+ declare
+ C : constant Entity_Id :=
+ (if Known_Normalized_Position (Comp)
+ then Comp
+ else Original_Record_Component (Comp));
+ -- The Parent_Subtype in an extension is not back-annotated
+ -- but its layout is the same as that of the parent type.
- begin
- Get_Decoded_Name_String (Chars (Comp));
- Set_Casing (Unit_Casing);
+ Ctyp : constant Entity_Id := Underlying_Type (Etype (C));
- -- If extended information is requested, recurse fully into
- -- record components, i.e. skip the outer level.
+ begin
+ Get_Decoded_Name_String (Chars (C));
+ Set_Casing (Unit_Casing);
- if List_Representation_Info_Extended
- and then Is_Record_Type (Ctyp)
- and then Known_Static_Normalized_Position (Comp)
- and then Known_Static_Normalized_First_Bit (Comp)
- then
- Spos := Starting_Position + Npos;
- Sbit := Starting_First_Bit + Fbit;
+ -- If extended information is requested, recurse fully into
+ -- record components, i.e. skip the outer level.
- if Sbit >= SSU then
- Spos := Spos + 1;
- Sbit := Sbit - SSU;
- end if;
+ if List_Representation_Info_Extended
+ and then Is_Record_Type (Ctyp)
+ and then Known_Static_Normalized_Position (C)
+ and then Known_Static_Normalized_First_Bit (C)
+ then
+ declare
+ Npos : constant Uint := Normalized_Position (C);
+ Fbit : constant Uint := Normalized_First_Bit (C);
+ Pref : constant String :=
+ Prefix & Name_Buffer (1 .. Name_Len) & ".";
- List_Record_Layout (Ctyp,
- Spos, Sbit, Prefix & Name_Buffer (1 .. Name_Len) & ".");
+ Spos : Uint;
+ Sbit : Uint;
- goto Continue;
- end if;
+ begin
+ Spos := Starting_Position + Npos;
+ Sbit := Starting_First_Bit + Fbit;
+
+ if Sbit >= SSU then
+ Spos := Spos + 1;
+ Sbit := Sbit - SSU;
+ end if;
+
+ List_Record_Layout (Ctyp, Spos, Sbit, Pref);
+ end;
- if List_Representation_Info_To_JSON then
- if First then
- Write_Eol;
- First := False;
else
- Write_Line (",");
- end if;
- end if;
+ if List_Representation_Info_To_JSON then
+ if First then
+ Write_Eol;
+ First := False;
+ else
+ Write_Line (",");
+ end if;
+ end if;
- -- The Parent_Subtype in an extension is not back-annotated
+ -- If information about holes is requested, update the
+ -- current bit offset and report any (static) gap.
- List_Component_Layout (
- (if Known_Normalized_Position (Comp)
- then Comp
- else Original_Record_Component (Comp)),
- Starting_Position, Starting_First_Bit, Prefix);
- end;
+ if List_Representation_Info_Holes
+ and then Known_Static_Component_Bit_Offset (C)
+ then
+ declare
+ Gap : constant Uint :=
+ Component_Bit_Offset (C) - Bit_Offset;
+ begin
+ if Gap > Uint_0 then
+ Write_Str (" -- ");
+ UI_Write (Gap, Decimal);
+ Write_Line (" bits unused --");
+ end if;
+
+ if Known_Static_Esize (C) then
+ Bit_Offset :=
+ Component_Bit_Offset (C) + Esize (C);
+ end if;
+ end;
+ end if;
+
+ List_Component_Layout
+ (C, Starting_Position, Starting_First_Bit, Prefix);
+ end if;
+ end;
+ end if;
- <<Continue>>
Next_Component_Or_Discriminant (Comp);
end loop;
end List_Record_Layout;
@@ -1610,6 +1766,17 @@ package body Repinfo is
end loop;
end List_Structural_Record_Layout;
+ -- Use the original record type giving the layout of components
+ -- to avoid repeated reordering when -gnatRh is specified.
+
+ Rec : constant Entity_Id :=
+ (if Ekind (Ent) = E_Record_Subtype
+ and then Present (Cloned_Subtype (Ent))
+ then (if Is_Private_Type (Cloned_Subtype (Ent))
+ then Full_View (Cloned_Subtype (Ent))
+ else Cloned_Subtype (Ent))
+ else Ent);
+
-- Start of processing for List_Record_Info
begin
@@ -1624,7 +1791,7 @@ package body Repinfo is
-- First find out max line length and max starting position
-- length, for the purpose of lining things up nicely.
- Compute_Max_Length (Ent);
+ Compute_Max_Length (Rec);
-- Then do actual output based on those values
@@ -1636,21 +1803,21 @@ package body Repinfo is
-- declared in the extended main source unit for the time being,
-- because otherwise declarations might not be processed at all.
- if Is_Base_Type (Ent) then
+ if Is_Base_Type (Rec) then
begin
- List_Structural_Record_Layout (Ent, Ent);
+ List_Structural_Record_Layout (Rec, Rec);
exception
when Incomplete_Layout
| Not_In_Extended_Main
=>
- List_Record_Layout (Ent);
+ List_Record_Layout (Rec);
when others =>
raise Program_Error;
end;
else
- List_Record_Layout (Ent);
+ List_Record_Layout (Rec);
end if;
Write_Eol;
@@ -1660,7 +1827,7 @@ package body Repinfo is
List_Name (Ent);
Write_Line (" use record");
- List_Record_Layout (Ent);
+ List_Record_Layout (Rec);
Write_Line ("end record;");
end if;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 1d94780..062251f 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -479,18 +479,19 @@ package body Sem_Ch12 is
-- Create a new access type with the given designated type
function Analyze_Associations
- (I_Node : Node_Id;
+ (N : Node_Id;
Formals : List_Id;
F_Copy : List_Id) return List_Id;
-- At instantiation time, build the list of associations between formals
-- and actuals. Each association becomes a renaming declaration for the
- -- formal entity. F_Copy is the analyzed list of formals in the generic
- -- copy. It is used to apply legality checks to the actuals. I_Node is the
- -- instantiation node.
+ -- formal entity. N is the instantiation node. Formals is the list of
+ -- unanalyzed formals. F_Copy is the analyzed list of formals in the
+ -- generic copy.
procedure Analyze_Subprogram_Instantiation
(N : Node_Id;
K : Entity_Kind);
+ -- Analyze subprogram instantiation N, either a function or a procedure
procedure Build_Instance_Compilation_Unit_Nodes
(N : Node_Id;
@@ -609,12 +610,12 @@ package body Sem_Ch12 is
(Inner : Entity_Id;
Outer : Entity_Id;
N : Node_Id) return Boolean;
- -- Inner is instantiated within the generic Outer. Check whether Inner
- -- directly or indirectly contains an instance of Outer or of one of its
- -- parents, in the case of a subunit. Each generic unit holds a list of
- -- the entities instantiated within (at any depth). This procedure
- -- determines whether the set of such lists contains a cycle, i.e. an
- -- illegal circular instantiation.
+ -- Inner is being instantiated within Outer. If Outer is also a generic
+ -- unit, check whether Inner directly or indirectly contains an instance
+ -- of Outer or of one of its parents (case of subunit). Each generic unit
+ -- holds a list of the entities instantiated within (at any depth). This
+ -- procedure determines whether the set of such lists contains a cycle,
+ -- i.e. an illegal circular instantiation.
function Denotes_Formal_Package
(Pack : Entity_Id;
@@ -1009,8 +1010,8 @@ package body Sem_Ch12 is
procedure Set_Next_Assoc (E : Assoc_Ptr; Next : Assoc_Ptr);
function Next_Assoc (E : Assoc_Ptr) return Assoc_Ptr;
- function Get_Gen_Id (E : Assoc_Ptr) return Entity_Id;
- function Hash (F : Entity_Id) return HTable_Range;
+ function Get_Gen_Id (E : Assoc_Ptr) return Entity_Id;
+ function Hash (F : Entity_Id) return HTable_Range;
package Generic_Renamings_HTable is new GNAT.HTable.Static_HTable (
Header_Num => HTable_Range,
@@ -1158,19 +1159,29 @@ package body Sem_Ch12 is
-- kinds for N_Box_Subp_Default, N_Box_Actual, N_Null_Default, and
-- N_Exp_Func_Default.
- type Generic_Actual_Rec (Kind : Actual_Kind := None) is record
- -- Representation of one generic actual parameter
+ type Actual_Rec (Kind : Actual_Kind := None) is record
case Kind is
- when None | None_Use_Clause | Box_Subp_Default | Box_Actual |
- Null_Default | Dummy_Assoc =>
+ when None
+ | None_Use_Clause
+ | Box_Subp_Default
+ | Box_Actual
+ | Null_Default
+ | Dummy_Assoc
+ =>
null;
- when Name_Exp | Exp_Func_Default =>
+ when Name_Exp
+ | Exp_Func_Default
+ =>
Name_Exp : Node_Id;
end case;
end record;
+ -- Representation of one generic actual parameter
type Actual_Origin_Enum is
- (None, From_Explicit_Actual, From_Default, From_Inference,
+ (None,
+ From_Explicit_Actual,
+ From_Default,
+ From_Inference,
From_Others_Box);
-- Indication of where the Actual came from -- explicitly in the
-- instantiation, inferred from some other type, or defaulted.
@@ -1179,16 +1190,16 @@ package body Sem_Ch12 is
-- Reason an actual type corresponding to a formal type was (or could
-- be) inferred from the actual type corresponding to another formal
-- type.
- (Designated_Type, -- designated type from formal access
- Index_Type, -- index type from formal array
- Component_Type, -- component type from formal array
+ (Designated_Type, -- designated type from formal access
+ Index_Type, -- index type from formal array
+ Component_Type, -- component type from formal array
Discriminant_Type); -- discriminant type from formal discriminated
function Image (Reason : Inference_Reason) return String is
(case Reason is
- when Designated_Type => "designated type",
- when Index_Type => "index type",
- when Component_Type => "component type",
+ when Designated_Type => "designated type",
+ when Index_Type => "index type",
+ when Component_Type => "component type",
when Discriminant_Type => "discriminant type");
type Assoc_Index is new Pos;
@@ -1210,7 +1221,7 @@ package body Sem_Ch12 is
Explicit_Assoc : Opt_N_Generic_Association_Id;
-- Explicit association, if any, from the source or generated.
- Actual : Generic_Actual_Rec;
+ Actual : Actual_Rec;
-- Generic actual parameter corresponding to Un_Formal/An_Formal,
-- possibly from defaults or others/boxes.
@@ -1224,7 +1235,7 @@ package body Sem_Ch12 is
-- inferred.
Inferred_From : Assoc_Index;
- -- Index of a later Assoc_Rec in the same Gen_Assocs_Rec from which
+ -- Index of a later Assoc_Rec in the same Match_Rec from which
-- this one was inferred, or could be inferred.
-- Valid only if Info_Inferred_Actual is present.
@@ -1237,10 +1248,10 @@ package body Sem_Ch12 is
-- One element for each formal and (if legal) for each corresponding
-- actual.
- type Gen_Assocs_Rec (Num_Assocs : Assoc_Count) is record
- -- Representation of formal/actual matching. Num_Assocs
- -- is the number of formals and (if legal) the number
- -- of actuals.
+ type Match_Rec (Num_Assocs : Assoc_Count) is record
+ -- Representation of formal/actual matching. Num_Assocs is the
+ -- number of formals and (if legal) the number of actuals.
+
Gen_Unit : Entity_Id;
-- the generic unit being instantiated
Others_Present : Boolean;
@@ -1251,25 +1262,26 @@ package body Sem_Ch12 is
end record;
function Match_Assocs
- (I_Node : Node_Id; Formals : List_Id; F_Copy : List_Id)
- return Gen_Assocs_Rec;
- -- I_Node is the instantiation node. Formals is the list of unanalyzed
+ (N : Node_Id;
+ Formals : List_Id;
+ F_Copy : List_Id) return Match_Rec;
+ -- N is the instantiation node. Formals is the list of unanalyzed
-- formals. F_Copy is the analyzed list of formals in the generic copy.
- -- Return a Gen_Assocs_Rec with formals, explicit actuals, and default
+ -- Return a Match_Rec with formals, explicit actuals, and default
-- actuals filled in. Check legality rules related to formal/actual
-- matching.
procedure Note_Potential_Inference
- (I_Node : Node_Id; Gen_Assocs : Gen_Assocs_Rec);
+ (N : Node_Id;
+ Match : Match_Rec);
-- If -gnatd_I, print "info:" messages about type inference that could
-- have been done.
end Associations;
procedure Analyze_One_Association
- (I_Node : Node_Id; -- instantiation node
- Assoc : Associations.Assoc_Rec;
- -- Logical 'in out' parameters:
+ (N : Node_Id;
+ Assoc : Associations.Assoc_Rec;
Result_Renamings : List_Id;
Default_Actuals : List_Id;
Actuals_To_Freeze : Elist_Id);
@@ -1279,12 +1291,12 @@ package body Sem_Ch12 is
-- appended onto Actuals_To_Freeze.
procedure Check_Fixed_Point_Warning
- (Gen_Assocs : Associations.Gen_Assocs_Rec;
+ (Match : Associations.Match_Rec;
Renamings : List_Id);
-- Warn if any actual is a fixed-point type that has user-defined
-- arithmetic operators, but there is no corresponding formal in the
-- generic, in which case the predefined operators will be used. This
- -- merits a warning because of the special semantics of fixed point
+ -- deserves a warning because of the special semantics of fixed point
-- operators. However, do not warn if the formal is private, because there
-- can be no arithmetic operators in the generic so there no danger of
-- confusion.
@@ -1315,27 +1327,29 @@ package body Sem_Ch12 is
-- analyzed formals in cases where there are multiple ones
-- corresponding to a particular unanalyzed one.
- function Num_An_Formals (F_Copy : List_Id) return Assoc_Count;
+ function Num_An_Formals (F_Copy : List_Id) return Assoc_Count;
-- Number of analyzed formals that correspond directly to unanalyzed
-- formals. There are all sorts of other things in F_Copy, which
-- are not counted.
- procedure Check_Box (I_Node, Actual : Node_Id);
+ procedure Check_Box (N, Actual : Node_Id);
-- Check for errors in "others => <>" and "Name => <>"
- function Default (Un_Formal : Node_Id) return Generic_Actual_Rec;
+ function Default (Un_Formal : Node_Id) return Actual_Rec;
-- Return the default for a given formal, which can be a name,
-- expression, box, etc.
procedure Match_Positional
- (Src_Assoc : in out Node_Id; Assoc : in out Assoc_Rec);
+ (Src_Assoc : in out Node_Id;
+ Assoc : in out Assoc_Rec);
-- Called by Match_Assocs to match one positional parameter association.
-- If the current formal (in Assoc) is not a use clause, then there is a
-- match, and we set Assoc.Actual and move Src_Assoc to the next one.
procedure Match_Named
- (Src_Assoc : Node_Id; Assoc : in out Assoc_Rec;
- Found : in out Boolean);
+ (Src_Assoc : Node_Id;
+ Assoc : in out Assoc_Rec;
+ Found : in out Boolean);
-- Called by Match_Assocs to match one named parameter association.
-- If the current formal (in Assoc) is not a use clause, and the
-- selector name matches the formal name, then there is a match,
@@ -1343,48 +1357,50 @@ package body Sem_Ch12 is
-- the matched formal, and set Found to True.
procedure Inference_Msg
- (Gen_Unit : Entity_Id;
- Inferred_To, Inferred_From : Assoc_Rec;
- Was_Inferred : Boolean);
+ (Gen_Unit : Entity_Id;
+ Inferred_To : Assoc_Rec;
+ Inferred_From : Assoc_Rec;
+ Was_Inferred : Boolean);
-- If Was_Inferred is True, this prints out an "info:" message
-- showing the inference.
-- If Was_Inferred is False, the message says that it could have
-- been inferred.
function Find_Assoc
- (Gen_Assocs : Gen_Assocs_Rec; F : Entity_Id) return Assoc_Index;
- -- Return the index of F in Gen_Assocs.Assocs, which must be
- -- present.
+ (Match : Match_Rec;
+ F : Entity_Id) return Assoc_Index;
+ -- Return the index of F in Match.Assocs, which must be present
procedure Maybe_Infer_One
- (Gen_Assocs : in out Gen_Assocs_Rec;
- FF, AA : N_Entity_Id; Inferred_From : Assoc_Index;
- Reason : Inference_Reason);
+ (Match : in out Match_Rec;
+ FF, AA : N_Entity_Id;
+ Inferred_From : Assoc_Index;
+ Reason : Inference_Reason);
-- If it makes sense to infer that formal FF is associated with
-- actual AA, then do so.
procedure Infer_From_Access
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id);
-- Try to infer the designated type
procedure Infer_From_Array
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id);
-- Try to infer the index and component types
procedure Infer_From_Discriminated
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id);
-- Try to infer the types of discriminants
- procedure Infer_Actuals (Gen_Assocs : in out Gen_Assocs_Rec);
+ procedure Infer_Actuals (Match : in out Match_Rec);
-- Called by Match_Assocs after processing explicit and defaulted
-- parameters to infer any that are still missing.
@@ -1542,13 +1558,13 @@ package body Sem_Ch12 is
-- Check_Box --
---------------
- procedure Check_Box (I_Node, Actual : Node_Id) is
+ procedure Check_Box (N, Actual : Node_Id) is
begin
-- "... => <>" is allowed only in formal packages, not old-fashioned
-- instantiations.
- if Nkind (I_Node) /= N_Formal_Package_Declaration
- and then Comes_From_Source (I_Node)
+ if Nkind (N) /= N_Formal_Package_Declaration
+ and then Comes_From_Source (N)
then
if Actual in N_Others_Choice_Id then
Error_Msg_N
@@ -1573,9 +1589,9 @@ package body Sem_Ch12 is
-- Default --
-------------
- function Default (Un_Formal : Node_Id) return Generic_Actual_Rec is
+ function Default (Un_Formal : Node_Id) return Actual_Rec is
begin
- return Result : Generic_Actual_Rec do
+ return Result : Actual_Rec do
case Nkind (Un_Formal) is
when N_Formal_Object_Declaration =>
if Present (Default_Expression (Un_Formal)) then
@@ -1727,22 +1743,24 @@ package body Sem_Ch12 is
------------------
function Match_Assocs
- (I_Node : Node_Id; Formals : List_Id; F_Copy : List_Id)
- return Gen_Assocs_Rec
+ (N : Node_Id;
+ Formals : List_Id;
+ F_Copy : List_Id) return Match_Rec
is
- Src_Assocs : constant List_Id := Generic_Associations (I_Node);
- Gen_Unit : constant Entity_Id := Defining_Entity (Parent (F_Copy));
+ Src_Assocs : constant List_Id := Generic_Associations (N);
+ Gen_Unit : constant Entity_Id := Defining_Entity (Parent (F_Copy));
+
begin
pragma Assert
(Num_An_Formals (F_Copy) = Num_Formals (Formals)
or else Serious_Errors_Detected > 0);
- return Result : Gen_Assocs_Rec (Num_Assocs => Num_Formals (Formals))
+ return Result : Match_Rec (Num_Assocs => Num_Formals (Formals))
do
Result.Gen_Unit := Gen_Unit;
Result.Others_Present := False;
- -- Loop through the unanalyzed formals:
+ -- Loop through the unanalyzed formals
declare
procedure Set_Formal (F : Node_Id; Index : Assoc_Index);
@@ -1779,7 +1797,7 @@ package body Sem_Ch12 is
Iter (Formals);
end;
- -- Loop through the analyzed copy of the formals:
+ -- Loop through the analyzed copy of the formals
declare
procedure Set_An_Formal (F : Node_Id; Index : Assoc_Index);
@@ -1836,7 +1854,7 @@ package body Sem_Ch12 is
Iter (F_Copy);
end;
- -- Loop through actual source associations:
+ -- Loop through actual source associations
declare
Src_Assoc : Node_Id := First (Src_Assocs);
@@ -1864,7 +1882,7 @@ package body Sem_Ch12 is
-- Loop through named actuals and "others => <>":
while Present (Src_Assoc) loop
- Check_Box (I_Node, Src_Assoc);
+ Check_Box (N, Src_Assoc);
if Src_Assoc in N_Others_Choice_Id then
Result.Others_Present := True;
exit;
@@ -1942,8 +1960,8 @@ package body Sem_Ch12 is
end;
end loop;
- if Nkind (I_Node) /= N_Formal_Package_Declaration then
- Infer_Actuals (Gen_Assocs => Result);
+ if Nkind (N) /= N_Formal_Package_Declaration then
+ Infer_Actuals (Result);
end if;
-- Check for missing actuals
@@ -1969,9 +1987,10 @@ package body Sem_Ch12 is
-------------------
procedure Inference_Msg
- (Gen_Unit : Entity_Id;
- Inferred_To, Inferred_From : Assoc_Rec;
- Was_Inferred : Boolean)
+ (Gen_Unit : Entity_Id;
+ Inferred_To : Assoc_Rec;
+ Inferred_From : Assoc_Rec;
+ Was_Inferred : Boolean)
is
pragma Assert (Debug_Flag_Underscore_II); -- This is only for -gnatd_I
@@ -2009,7 +2028,8 @@ package body Sem_Ch12 is
------------------------------
procedure Note_Potential_Inference
- (I_Node : Node_Id; Gen_Assocs : Gen_Assocs_Rec)
+ (N : Node_Id;
+ Match : Match_Rec)
is
begin
if not Debug_Flag_Underscore_II or else Serious_Errors_Detected > 0
@@ -2017,20 +2037,21 @@ package body Sem_Ch12 is
return;
end if;
- for Index in Gen_Assocs.Assocs'Range loop
+ for Index in Match.Assocs'Range loop
declare
- Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Index);
+ Assoc : Assoc_Rec renames Match.Assocs (Index);
+
begin
if Assoc.Actual_Origin = From_Explicit_Actual
and then Present (Assoc.Info_Inferred_Actual)
- and then In_Extended_Main_Source_Unit (I_Node)
- and then not In_Internal_Unit (I_Node)
+ and then In_Extended_Main_Source_Unit (N)
+ and then not In_Internal_Unit (N)
then
Inference_Msg
- (Gen_Assocs.Gen_Unit,
- Inferred_To => Assoc,
- Inferred_From => Gen_Assocs.Assocs (Assoc.Inferred_From),
- Was_Inferred => False);
+ (Match.Gen_Unit,
+ Inferred_To => Assoc,
+ Inferred_From => Match.Assocs (Assoc.Inferred_From),
+ Was_Inferred => False);
end if;
end;
end loop;
@@ -2041,11 +2062,12 @@ package body Sem_Ch12 is
--------------
function Find_Assoc
- (Gen_Assocs : Gen_Assocs_Rec; F : Entity_Id) return Assoc_Index
+ (Match : Match_Rec;
+ F : Entity_Id) return Assoc_Index
is
begin
- for Index in Gen_Assocs.Assocs'Range loop
- if Defining_Entity (Gen_Assocs.Assocs (Index).An_Formal) = F then
+ for Index in Match.Assocs'Range loop
+ if Defining_Entity (Match.Assocs (Index).An_Formal) = F then
return Index;
end if;
end loop;
@@ -2058,13 +2080,14 @@ package body Sem_Ch12 is
---------------------
procedure Maybe_Infer_One
- (Gen_Assocs : in out Gen_Assocs_Rec;
- FF, AA : N_Entity_Id; Inferred_From : Assoc_Index;
- Reason : Inference_Reason)
+ (Match : in out Match_Rec;
+ FF, AA : N_Entity_Id;
+ Inferred_From : Assoc_Index;
+ Reason : Inference_Reason)
is
begin
if not (Is_Generic_Type (FF)
- and then Scope (FF) = Gen_Assocs.Gen_Unit)
+ and then Scope (FF) = Match.Gen_Unit)
then
return; -- no inference if not a formal type of this generic
end if;
@@ -2074,12 +2097,12 @@ package body Sem_Ch12 is
end if;
declare
- Index : constant Assoc_Index := Find_Assoc (Gen_Assocs, FF);
- Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Index);
+ Index : constant Assoc_Index := Find_Assoc (Match, FF);
+ Assoc : Assoc_Rec renames Match.Assocs (Index);
pragma Assert (Defining_Entity (Assoc.An_Formal) = FF);
From_Actual : constant Node_Id :=
- Gen_Assocs.Assocs (Inferred_From).Actual.Name_Exp;
+ Match.Assocs (Inferred_From).Actual.Name_Exp;
begin
Assoc.Info_Inferred_Actual := AA;
@@ -2097,23 +2120,23 @@ package body Sem_Ch12 is
if Debug_Flag_Underscore_II then
Inference_Msg
- (Gen_Assocs.Gen_Unit,
- Inferred_To => Assoc,
- Inferred_From => Gen_Assocs.Assocs (Assoc.Inferred_From),
- Was_Inferred => True);
+ (Match.Gen_Unit,
+ Inferred_To => Assoc,
+ Inferred_From => Match.Assocs (Assoc.Inferred_From),
+ Was_Inferred => True);
end if;
end if;
end;
end Maybe_Infer_One;
- -------------------
- -- Infer_Actuals --
- -------------------
+ -----------------------
+ -- Infer_From_Access --
+ -----------------------
procedure Infer_From_Access
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id)
is
begin
@@ -2124,7 +2147,7 @@ package body Sem_Ch12 is
AA : constant Entity_Id := Designated_Type (A_Full);
begin
Maybe_Infer_One
- (Gen_Assocs,
+ (Match,
FF,
AA,
Inferred_From => Index,
@@ -2133,10 +2156,14 @@ package body Sem_Ch12 is
end if;
end Infer_From_Access;
+ ----------------------
+ -- Infer_From_Array --
+ ----------------------
+
procedure Infer_From_Array
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id)
is
begin
@@ -2150,7 +2177,7 @@ package body Sem_Ch12 is
while Present (F_Index_Type) and then Present (A_Index_Type)
loop
Maybe_Infer_One
- (Gen_Assocs,
+ (Match,
Etype (F_Index_Type),
Etype (A_Index_Type),
Inferred_From => Index,
@@ -2168,7 +2195,7 @@ package body Sem_Ch12 is
Component_Type (A_Full);
begin
Maybe_Infer_One
- (Gen_Assocs,
+ (Match,
F_Comp_Type,
A_Comp_Type,
Inferred_From => Index,
@@ -2177,10 +2204,14 @@ package body Sem_Ch12 is
end if;
end Infer_From_Array;
+ ------------------------------
+ -- Infer_From_Discriminated --
+ ------------------------------
+
procedure Infer_From_Discriminated
- (Gen_Assocs : in out Gen_Assocs_Rec;
- Index : Assoc_Index;
- F : Node_Id;
+ (Match : in out Match_Rec;
+ Index : Assoc_Index;
+ F : Node_Id;
A_Full : Entity_Id)
is
begin
@@ -2196,7 +2227,7 @@ package body Sem_Ch12 is
begin
while Present (F_Discrim) loop
Maybe_Infer_One
- (Gen_Assocs,
+ (Match,
Etype (F_Discrim),
Etype (A_Discrim),
Inferred_From => Index,
@@ -2210,23 +2241,27 @@ package body Sem_Ch12 is
end if;
end Infer_From_Discriminated;
- procedure Infer_Actuals (Gen_Assocs : in out Gen_Assocs_Rec) is
- -- Note that we can infer FROM defaults, but we cannot infer TO a
- -- parameter that has a default. We can also infer from inferred
- -- types.
+ -------------------
+ -- Infer_Actuals --
+ -------------------
- -- We don't need to check that multiple inferences get the same
- -- answer; the second one will get a type mismatch or nonstatically
- -- matching error.
+ -- Note that we can infer FROM defaults, but we cannot infer TO a
+ -- parameter that has a default. We can also infer from inferred
+ -- types.
- -- This code needs to be robust, in the sense of tolerating illegal
- -- code, because we have not yet checked all legality rules. For
- -- example, if a formal type F has a discriminant whose type is
- -- another formal type, then we want to infer the type of the
- -- discriminant from the actual for F. That actual must have
- -- discriminants, but we have not checked that rule yet, so we
- -- need to tolerate an actual for F that has no discriminants.
+ -- We don't need to check that multiple inferences get the same
+ -- answer; the second one will get a type mismatch or nonstatically
+ -- matching error.
+ -- This code needs to be robust, in the sense of tolerating illegal
+ -- code, because we have not yet checked all legality rules. For
+ -- example, if a formal type F has a discriminant whose type is
+ -- another formal type, then we want to infer the type of the
+ -- discriminant from the actual for F. That actual must have
+ -- discriminants, but we have not checked that rule yet, so we
+ -- need to tolerate an actual for F that has no discriminants.
+
+ procedure Infer_Actuals (Match : in out Match_Rec) is
begin
-- For each parameter, check whether we can infer FROM that one TO
-- other ones.
@@ -2240,12 +2275,12 @@ package body Sem_Ch12 is
-- designated type. The reverse loop implies that we will see the
-- array type, then the access type, then the designated type.
- for Index in reverse Gen_Assocs.Assocs'Range loop -- NB: "reverse"
- if Gen_Assocs.Assocs (Index).Actual.Kind = Name_Exp then
+ for Index in reverse Match.Assocs'Range loop -- NB: "reverse"
+ if Match.Assocs (Index).Actual.Kind = Name_Exp then
declare
- F : constant Node_Id := Gen_Assocs.Assocs (Index).An_Formal;
+ F : constant Node_Id := Match.Assocs (Index).An_Formal;
A_E : constant Node_Id :=
- Gen_Assocs.Assocs (Index).Actual.Name_Exp;
+ Match.Assocs (Index).Actual.Name_Exp;
A_Full : Entity_Id := Empty;
begin
if Nkind (A_E) in N_Has_Entity then
@@ -2264,7 +2299,7 @@ package body Sem_Ch12 is
then
case Ekind (Defining_Entity (F)) is
when E_Access_Type | E_General_Access_Type =>
- Infer_From_Access (Gen_Assocs, Index, F, A_Full);
+ Infer_From_Access (Match, Index, F, A_Full);
when E_Access_Subtype
| E_Access_Attribute_Type
@@ -2274,7 +2309,7 @@ package body Sem_Ch12 is
raise Program_Error;
when E_Array_Type | E_Array_Subtype =>
- Infer_From_Array (Gen_Assocs, Index, F, A_Full);
+ Infer_From_Array (Match, Index, F, A_Full);
when E_String_Literal_Subtype =>
raise Program_Error;
@@ -2283,13 +2318,12 @@ package body Sem_Ch12 is
null;
end case;
- Infer_From_Discriminated (Gen_Assocs, Index, F, A_Full);
+ Infer_From_Discriminated (Match, Index, F, A_Full);
end if;
end;
end if;
end loop;
end Infer_Actuals;
-
end Associations;
---------------------------
@@ -2316,46 +2350,49 @@ package body Sem_Ch12 is
--------------------------
function Analyze_Associations
- (I_Node : Node_Id;
+ (N : Node_Id;
Formals : List_Id;
F_Copy : List_Id) return List_Id
is
use Associations;
- Result_Renamings : constant List_Id := New_List;
+ Actuals_To_Freeze : constant Elist_Id := New_Elmt_List;
+ Default_Actuals : constant List_Id := New_List;
+ Result_Renamings : constant List_Id := New_List;
-- To be returned. Includes "renamings" broadly interpreted
-- (e.g. subtypes are used for types).
- Actuals_To_Freeze : constant Elist_Id := New_Elmt_List;
- Default_Actuals : constant List_Id := New_List;
-
- Gen_Assocs : constant Gen_Assocs_Rec :=
- Match_Assocs (I_Node, Formals, F_Copy);
+ Match : constant Match_Rec := Match_Assocs (N, Formals, F_Copy);
begin
- for Matching_Actual_Index in Gen_Assocs.Assocs'Range loop
+ for Index in Match.Assocs'Range loop
declare
- Assoc : Assoc_Rec renames
- Gen_Assocs.Assocs (Matching_Actual_Index);
+ Assoc : Assoc_Rec renames Match.Assocs (Index);
+
begin
if Nkind (Assoc.Un_Formal) = N_Formal_Package_Declaration
and then Error_Posted (Assoc.An_Formal)
then
-- Restrict this to N_Formal_Package_Declaration,
-- because otherwise we miss errors.
+
Abandon_Instantiation (Instantiation_Node);
end if;
- if Nkind (Assoc.Un_Formal) in
- N_Use_Package_Clause | N_Use_Type_Clause
+ if Nkind (Assoc.Un_Formal) in N_Use_Package_Clause
+ | N_Use_Type_Clause
then
- -- Copy the use clause to where it belongs:
+ -- Copy the use clause to where it belongs
+
Append (New_Copy_Tree (Assoc.Un_Formal), Result_Renamings);
else
Analyze_One_Association
- (I_Node, Assoc,
- Result_Renamings, Default_Actuals, Actuals_To_Freeze);
+ (N,
+ Assoc,
+ Result_Renamings,
+ Default_Actuals,
+ Actuals_To_Freeze);
end if;
end;
end loop;
@@ -2366,9 +2403,10 @@ package body Sem_Ch12 is
declare
Elmt : Elmt_Id := First_Elmt (Actuals_To_Freeze);
+
begin
while Present (Elmt) loop
- Freeze_Before (I_Node, Node (Elmt));
+ Freeze_Before (N, Node (Elmt));
Next_Elmt (Elmt);
end loop;
end;
@@ -2388,17 +2426,17 @@ package body Sem_Ch12 is
Next (Default);
end loop;
- if No (Generic_Associations (I_Node)) then
- Set_Generic_Associations (I_Node, Default_Actuals);
+ if No (Generic_Associations (N)) then
+ Set_Generic_Associations (N, Default_Actuals);
else
- Append_List_To (Generic_Associations (I_Node), Default_Actuals);
+ Append_List_To (Generic_Associations (N), Default_Actuals);
end if;
end;
end if;
- Note_Potential_Inference (I_Node, Gen_Assocs);
+ Note_Potential_Inference (N, Match);
- Check_Fixed_Point_Warning (Gen_Assocs, Result_Renamings);
+ Check_Fixed_Point_Warning (Match, Result_Renamings);
return Result_Renamings;
end Analyze_Associations;
@@ -2408,9 +2446,8 @@ package body Sem_Ch12 is
-----------------------------
procedure Analyze_One_Association
- (I_Node : Node_Id;
- Assoc : Associations.Assoc_Rec;
- -- Logical 'in out' parameters:
+ (N : Node_Id;
+ Assoc : Associations.Assoc_Rec;
Result_Renamings : List_Id;
Default_Actuals : List_Id;
Actuals_To_Freeze : Elist_Id)
@@ -2482,11 +2519,11 @@ package body Sem_Ch12 is
if No (Match) and then not Inside_A_Generic then
Append_To (Default_Actuals,
- Make_Generic_Association (Sloc (I_Node),
+ Make_Generic_Association (Sloc (N),
Selector_Name =>
New_Occurrence_Of
(Defining_Identifier
- (Assoc.Un_Formal), Sloc (I_Node)),
+ (Assoc.Un_Formal), Sloc (N)),
Explicit_Generic_Actual_Parameter =>
New_Copy_Tree (Default_Expression (Assoc.Un_Formal))));
end if;
@@ -2607,7 +2644,7 @@ package body Sem_Ch12 is
-- unless this is a rewritten formal package, or the
-- formal is an Ada 2012 formal incomplete type.
- if Nkind (I_Node) = N_Formal_Package_Declaration
+ if Nkind (N) = N_Formal_Package_Declaration
or else
(Ada_Version >= Ada_2012
and then
@@ -2693,7 +2730,7 @@ package body Sem_Ch12 is
-- An instantiation is a freeze point for the actuals,
-- unless this is a rewritten formal package.
- if Nkind (I_Node) /= N_Formal_Package_Declaration
+ if Nkind (N) /= N_Formal_Package_Declaration
and then Nkind (Match) = N_Identifier
and then Is_Subprogram (Entity (Match))
@@ -2711,7 +2748,7 @@ package body Sem_Ch12 is
-- subprograms defined in Standard which are used
-- as generic actuals.
- and then In_Same_Code_Unit (Entity (Match), I_Node)
+ and then In_Same_Code_Unit (Entity (Match), N)
and then Has_Fully_Defined_Profile (Entity (Match))
then
-- Mark the subprogram as having a delayed freeze
@@ -2734,11 +2771,11 @@ package body Sem_Ch12 is
begin
Append_To (Default_Actuals,
- Make_Generic_Association (Sloc (I_Node),
+ Make_Generic_Association (Sloc (N),
Selector_Name =>
- New_Occurrence_Of (Subp, Sloc (I_Node)),
+ New_Occurrence_Of (Subp, Sloc (N)),
Explicit_Generic_Actual_Parameter =>
- New_Occurrence_Of (Subp, Sloc (I_Node))));
+ New_Occurrence_Of (Subp, Sloc (N))));
end;
end if;
@@ -2851,13 +2888,13 @@ package body Sem_Ch12 is
if not Expander_Active
or else not Has_Completion (Actual)
- or else not In_Same_Source_Unit (I_Node, Actual)
+ or else not In_Same_Source_Unit (N, Actual)
or else Is_Frozen (Actual)
or else
(Present (Renamed_Entity (Actual))
and then
not In_Same_Source_Unit
- (I_Node, (Renamed_Entity (Actual))))
+ (N, (Renamed_Entity (Actual))))
then
null;
@@ -2869,7 +2906,7 @@ package body Sem_Ch12 is
Needs_Freezing := True;
- P := Parent (I_Node);
+ P := Parent (N);
while Nkind (P) /= N_Compilation_Unit loop
if Nkind (P) = N_Handled_Sequence_Of_Statements
then
@@ -3586,7 +3623,7 @@ package body Sem_Ch12 is
Decls :=
Analyze_Associations
- (I_Node => Original_Node (N),
+ (N => Original_Node (N),
Formals => Generic_Formal_Declarations (Act_Tree),
F_Copy => Generic_Formal_Declarations (Gen_Decl));
@@ -3602,9 +3639,8 @@ package body Sem_Ch12 is
if No (Visible_Declarations (Specification (Pack_Decl))) then
Set_Visible_Declarations (Specification (Pack_Decl), Decls);
else
- Insert_List_Before
- (First (Visible_Declarations (Specification (Pack_Decl))),
- Decls);
+ Prepend_List_To
+ (Visible_Declarations (Specification (Pack_Decl)), Decls);
end if;
return Pack_Decl;
@@ -4860,11 +4896,10 @@ package body Sem_Ch12 is
-- Local declarations
- Gen_Id : constant Node_Id := Name (N);
- Inst_Id : constant Entity_Id := Defining_Entity (N);
- Is_Actual_Pack : constant Boolean := Is_Internal (Inst_Id);
- Loc : constant Source_Ptr := Sloc (N);
-
+ Gen_Id : constant Node_Id := Name (N);
+ Loc : constant Source_Ptr := Sloc (N);
+ Is_Abbrev : constant Boolean :=
+ Is_Abbreviated_Instance (Defining_Entity (N));
Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
Saved_ISMP : constant Boolean :=
@@ -4877,7 +4912,6 @@ package body Sem_Ch12 is
-- Save style check mode for restore on exit
Act_Decl : Node_Id;
- Act_Decl_Name : Node_Id;
Act_Decl_Id : Entity_Id;
Act_Spec : Node_Id;
Act_Tree : Node_Id;
@@ -4918,29 +4952,7 @@ package body Sem_Ch12 is
Instantiation_Node := N;
- -- Case of instantiation of a generic package
-
- if Nkind (N) = N_Package_Instantiation then
- Act_Decl_Id := New_Copy (Defining_Entity (N));
-
- if Nkind (Defining_Unit_Name (N)) = N_Defining_Program_Unit_Name then
- Act_Decl_Name :=
- Make_Defining_Program_Unit_Name (Loc,
- Name =>
- New_Copy_Tree (Name (Defining_Unit_Name (N))),
- Defining_Identifier => Act_Decl_Id);
- else
- Act_Decl_Name := Act_Decl_Id;
- end if;
-
- -- Case of instantiation of a formal package
-
- else
- Act_Decl_Id := Defining_Identifier (N);
- Act_Decl_Name := Act_Decl_Id;
- end if;
-
- Generate_Definition (Act_Decl_Id);
+ Act_Decl_Id := New_Copy (Defining_Entity (N));
Mutate_Ekind (Act_Decl_Id, E_Package);
Set_Is_Not_Self_Hidden (Act_Decl_Id);
@@ -4972,7 +4984,7 @@ package body Sem_Ch12 is
-- Except for an abbreviated instance created to check a formal package,
-- install the parent if this is a generic child unit.
- if not Is_Abbreviated_Instance (Inst_Id) then
+ if not Is_Abbrev then
Check_Generic_Child_Unit (Gen_Id, Parent_Installed);
end if;
@@ -5075,9 +5087,6 @@ package body Sem_Ch12 is
goto Leave;
else
- Mutate_Ekind (Inst_Id, E_Package);
- Set_Scope (Inst_Id, Current_Scope);
-
-- If the context of the instance is subject to SPARK_Mode "off" or
-- the annotation is altogether missing, set the global flag which
-- signals Analyze_Pragma to ignore all SPARK_Mode pragmas within
@@ -5115,22 +5124,38 @@ package body Sem_Ch12 is
-- If this is the instance created to validate an actual package,
-- only the formals matter, do not examine the package spec itself.
- if Is_Actual_Pack then
+ if Is_Abbrev then
Set_Visible_Declarations (Act_Spec, New_List);
Set_Private_Declarations (Act_Spec, New_List);
end if;
Renamings :=
Analyze_Associations
- (I_Node => N,
+ (N => N,
Formals => Generic_Formal_Declarations (Act_Tree),
F_Copy => Generic_Formal_Declarations (Gen_Decl));
Vis_Prims_List := Check_Hidden_Primitives (Renamings);
+ -- Set minimal decoration on the original entity
+
+ Mutate_Ekind (Defining_Entity (N), E_Package);
+ Set_Scope (Defining_Entity (N), Current_Scope);
+
Set_Instance_Env (Gen_Unit, Act_Decl_Id);
- Set_Defining_Unit_Name (Act_Spec, Act_Decl_Name);
Set_Is_Generic_Instance (Act_Decl_Id);
+ Generate_Definition (Act_Decl_Id);
+
+ if Nkind (Defining_Unit_Name (N)) = N_Defining_Program_Unit_Name then
+ Set_Defining_Unit_Name (Act_Spec,
+ Make_Defining_Program_Unit_Name (Loc,
+ Name =>
+ New_Copy_Tree (Name (Defining_Unit_Name (N))),
+ Defining_Identifier => Act_Decl_Id));
+ else
+ Set_Defining_Unit_Name (Act_Spec, Act_Decl_Id);
+ end if;
+
Set_Generic_Parent (Act_Spec, Gen_Unit);
-- References to the generic in its own declaration or its body are
@@ -5274,7 +5299,7 @@ package body Sem_Ch12 is
and then (not Is_Child_Unit (Gen_Unit)
or else not Is_Generic_Unit (Scope (Gen_Unit)))
and then Might_Inline_Subp (Gen_Unit)
- and then not Is_Actual_Pack
+ and then not Is_Abbrev
then
if not Back_End_Inlining
and then (Front_End_Inlining or else Has_Inline_Always)
@@ -5319,7 +5344,7 @@ package body Sem_Ch12 is
or else Enclosing_Body_Present
or else Present (Corresponding_Body (Gen_Decl)))
and then Needs_Body_Instantiated (Gen_Unit)
- and then not Is_Actual_Pack
+ and then not Is_Abbrev
and then not Inline_Now
and then (Operating_Mode = Generate_Code
or else (Operating_Mode = Check_Semantics
@@ -6455,7 +6480,7 @@ package body Sem_Ch12 is
Renamings :=
Analyze_Associations
- (I_Node => N,
+ (N => N,
Formals => Generic_Formal_Declarations (Act_Tree),
F_Copy => Generic_Formal_Declarations (Gen_Decl));
@@ -7563,14 +7588,15 @@ package body Sem_Ch12 is
-------------------------------
procedure Check_Fixed_Point_Warning
- (Gen_Assocs : Associations.Gen_Assocs_Rec;
+ (Match : Associations.Match_Rec;
Renamings : List_Id)
is
use Associations;
+
begin
- for Type_Index in Gen_Assocs.Assocs'Range loop
+ for Type_Index in Match.Assocs'Range loop
declare
- Assoc : Assoc_Rec renames Gen_Assocs.Assocs (Type_Index);
+ Assoc : Assoc_Rec renames Match.Assocs (Type_Index);
begin
if Nkind (Assoc.An_Formal) = N_Formal_Type_Declaration
and then Is_Fixed_Point_Type (Defining_Entity (Assoc.An_Formal))
@@ -7599,9 +7625,9 @@ package body Sem_Ch12 is
Op := Alias (Node (Elem));
for Op_Index in Type_Index + 1 ..
- Gen_Assocs.Assocs'Last
+ Match.Assocs'Last
loop
- Formal := Gen_Assocs.Assocs (Op_Index).Un_Formal;
+ Formal := Match.Assocs (Op_Index).Un_Formal;
if Nkind (Formal) =
N_Formal_Concrete_Subprogram_Declaration
@@ -10058,13 +10084,12 @@ package body Sem_Ch12 is
-- the freeze node for Inst must be inserted after that of
-- Parent_Inst. This relation is established by comparing
-- the Slocs of Parent_Inst freeze node and Inst.
- -- We examine the parents of the enclosing lists to handle
+ -- We examine the parents (of the enclosing lists) to handle
-- the case where the parent instance is in the visible part
-- of a package declaration, and the inner instance is in
-- the corresponding private part.
- if Parent (List_Containing (Freeze_Node (Par_Id)))
- = Parent (List_Containing (N))
+ if Parent (Freeze_Node (Par_Id)) = Parent (N)
and then Sloc (Freeze_Node (Par_Id)) <= Sloc (N)
then
Insert_Freeze_Node_For_Instance (N, F_Node);
@@ -10383,7 +10408,8 @@ package body Sem_Ch12 is
-- investigated, and would allow this function to be significantly
-- simplified. ???
- Inst := Package_Instantiation (A);
+ Inst :=
+ (if Ekind (A) = E_Package then Package_Instantiation (A) else Empty);
if Present (Inst) then
if Nkind (Inst) = N_Package_Instantiation then
@@ -10430,10 +10456,11 @@ package body Sem_Ch12 is
else
Inst := Next (Decl);
- while Nkind (Inst) not in N_Formal_Package_Declaration
- | N_Function_Instantiation
- | N_Package_Instantiation
- | N_Procedure_Instantiation
+ while Present (Inst)
+ and then Nkind (Inst) not in N_Formal_Package_Declaration
+ | N_Function_Instantiation
+ | N_Package_Instantiation
+ | N_Procedure_Instantiation
loop
Next (Inst);
end loop;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 75901bb..425d624 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3713,8 +3713,8 @@ package body Sem_Ch3 is
Set_Is_Static_Expression (E, True);
Set_Etype (E, Universal_Integer);
- Set_Etype (Id, Universal_Integer);
Mutate_Ekind (Id, E_Named_Integer);
+ Set_Etype (Id, Universal_Integer);
Set_Is_Frozen (Id, True);
Set_Debug_Info_Needed (Id);
@@ -3774,8 +3774,8 @@ package body Sem_Ch3 is
if Is_Integer_Type (T) then
Resolve (E, T);
- Set_Etype (Id, Universal_Integer);
Mutate_Ekind (Id, E_Named_Integer);
+ Set_Etype (Id, Universal_Integer);
elsif Is_Real_Type (T) then
@@ -3806,15 +3806,15 @@ package body Sem_Ch3 is
end if;
Resolve (E, T);
- Set_Etype (Id, Universal_Real);
Mutate_Ekind (Id, E_Named_Real);
+ Set_Etype (Id, Universal_Real);
else
Wrong_Type (E, Any_Numeric);
Resolve (E, T);
- Set_Etype (Id, T);
Mutate_Ekind (Id, E_Constant);
+ Set_Etype (Id, T);
Set_Never_Set_In_Source (Id, True);
Set_Is_True_Constant (Id, True);
return;
@@ -3963,7 +3963,7 @@ package body Sem_Ch3 is
Data_Path_String : constant String :=
Absolute_Dir
& System.OS_Lib.Directory_Separator
- & Stringt.To_String (Strval (Def));
+ & S;
begin
Data_Path := Name_Find (Data_Path_String);
@@ -6468,12 +6468,15 @@ package body Sem_Ch3 is
Priv : Entity_Id;
Related_Id : Entity_Id;
Has_FLB_Index : Boolean := False;
+ K : Entity_Kind;
begin
if Nkind (Def) = N_Constrained_Array_Definition then
Index := First (Discrete_Subtype_Definitions (Def));
+ K := E_Array_Subtype;
else
Index := First (Subtype_Marks (Def));
+ K := E_Array_Type;
end if;
-- Find proper names for the implicit types which may be public. In case
@@ -6652,7 +6655,7 @@ package body Sem_Ch3 is
-- them unique suffixes, because GNATprove require distinct types to
-- have different names.
- T := Create_Itype (E_Void, P, Related_Id, 'T', Suffix_Index => -1);
+ T := Create_Itype (K, P, Related_Id, 'T', Suffix_Index => -1);
end if;
-- Constrained array case
@@ -8133,9 +8136,6 @@ package body Sem_Ch3 is
Set_Non_Binary_Modulus
(Implicit_Base, Non_Binary_Modulus (Parent_Base));
- Set_Is_Known_Valid
- (Implicit_Base, Is_Known_Valid (Parent_Base));
-
elsif Is_Floating_Point_Type (Parent_Type) then
-- Digits of base type is always copied from the digits value of
@@ -8508,11 +8508,19 @@ package body Sem_Ch3 is
Analyze (Decl);
- pragma Assert (Has_Discriminants (Full_Der)
- and then not Has_Unknown_Discriminants (Full_Der));
+ pragma
+ Assert
+ ((Has_Discriminants (Full_Der)
+ and then not Has_Unknown_Discriminants (Full_Der))
+ or else Serious_Errors_Detected > 0);
Uninstall_Declarations (Par_Scope);
+ if Etype (Full_Der) = Any_Type then
+ pragma Assert (Serious_Errors_Detected > 0);
+ return;
+ end if;
+
-- Freeze the underlying record view, to prevent generation of
-- useless dispatching information, which is simply shared with
-- the real derived type.
@@ -9477,8 +9485,8 @@ package body Sem_Ch3 is
if Constraint_Present then
if not Has_Discriminants (Parent_Base)
or else
- (Has_Unknown_Discriminants (Parent_Base)
- and then Is_Private_Type (Parent_Base))
+ (Has_Unknown_Discriminants (Parent_Type)
+ and then Is_Private_Type (Parent_Type))
then
Error_Msg_N
("invalid constraint: type has no discriminant",
@@ -15218,17 +15226,24 @@ package body Sem_Ch3 is
R : Node_Id := Empty;
T : constant Entity_Id := Etype (Index);
Is_FLB_Index : Boolean := False;
+ Is_Range : constant Boolean :=
+ Nkind (S) = N_Range
+ or else (Nkind (S) = N_Attribute_Reference
+ and then Attribute_Name (S) = Name_Range);
+ Is_Indic : constant Boolean := Nkind (S) = N_Subtype_Indication;
+ K : constant Entity_Kind :=
+ (if Is_Modular_Integer_Type (T) then E_Modular_Integer_Subtype
+ elsif Is_Integer_Type (T) then E_Signed_Integer_Subtype
+ else E_Enumeration_Subtype);
begin
- Def_Id :=
- Create_Itype (E_Void, Related_Nod, Related_Id, Suffix, Suffix_Index);
- Set_Etype (Def_Id, Base_Type (T));
+ if Is_Range or else Is_Indic then
+ Def_Id :=
+ Create_Itype (K, Related_Nod, Related_Id, Suffix, Suffix_Index);
+ Set_Etype (Def_Id, Base_Type (T));
+ end if;
- if Nkind (S) = N_Range
- or else
- (Nkind (S) = N_Attribute_Reference
- and then Attribute_Name (S) = Name_Range)
- then
+ if Is_Range then
-- A Range attribute will be transformed into N_Range by Resolve
-- If a range has an Empty upper bound, then remember that for later
@@ -15263,7 +15278,7 @@ package body Sem_Ch3 is
end if;
end if;
- elsif Nkind (S) = N_Subtype_Indication then
+ elsif Is_Indic then
-- The parser has verified that this is a discrete indication
@@ -15318,27 +15333,19 @@ package body Sem_Ch3 is
S, Entity (S));
end if;
- return;
-
else
Error_Msg_N ("invalid index constraint", S);
Rewrite (S, New_Occurrence_Of (T, Sloc (S)));
- return;
end if;
+
+ return;
end if;
-- Complete construction of the Itype
- if Is_Modular_Integer_Type (T) then
- Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype);
-
- elsif Is_Integer_Type (T) then
- Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype);
-
- else
- Mutate_Ekind (Def_Id, E_Enumeration_Subtype);
+ if K = E_Enumeration_Subtype then
Set_Is_Character_Type (Def_Id, Is_Character_Type (T));
- Set_First_Literal (Def_Id, First_Literal (T));
+ Set_First_Literal (Def_Id, First_Literal (T));
end if;
Set_Size_Info (Def_Id, (T));
@@ -20603,17 +20610,17 @@ package body Sem_Ch3 is
if No (Def_Id) then
Def_Id :=
- Create_Itype (E_Void, Related_Nod, Related_Id, 'D', Suffix_Index);
+ Create_Itype
+ ((if Is_Signed_Integer_Type (T) then E_Signed_Integer_Subtype
+ elsif Is_Modular_Integer_Type (T) then E_Modular_Integer_Subtype
+ else E_Enumeration_Subtype),
+ Related_Nod,
+ Related_Id,
+ 'D',
+ Suffix_Index);
Set_Etype (Def_Id, Base_Type (T));
- if Is_Signed_Integer_Type (T) then
- Mutate_Ekind (Def_Id, E_Signed_Integer_Subtype);
-
- elsif Is_Modular_Integer_Type (T) then
- Mutate_Ekind (Def_Id, E_Modular_Integer_Subtype);
-
- else
- Mutate_Ekind (Def_Id, E_Enumeration_Subtype);
+ if Ekind (Def_Id) = E_Enumeration_Subtype then
Set_Is_Character_Type (Def_Id, Is_Character_Type (T));
Set_First_Literal (Def_Id, First_Literal (T));
end if;
@@ -21247,6 +21254,12 @@ package body Sem_Ch3 is
Discr := First (Discriminant_Specifications (N));
while Present (Discr) loop
+ if Ekind (Defining_Identifier (Discr)) = E_In_Parameter then
+ Reinit_Field_To_Zero
+ (Defining_Identifier (Discr), F_Discriminal_Link);
+ end if;
+
+ Mutate_Ekind (Defining_Identifier (Discr), E_Discriminant);
Enter_Name (Defining_Identifier (Discr));
-- For navigation purposes we add a reference to the discriminant
@@ -21522,11 +21535,6 @@ package body Sem_Ch3 is
while Present (Discr) loop
Id := Defining_Identifier (Discr);
- if Ekind (Id) = E_In_Parameter then
- Reinit_Field_To_Zero (Id, F_Discriminal_Link);
- end if;
-
- Mutate_Ekind (Id, E_Discriminant);
Set_Is_Not_Self_Hidden (Id);
Reinit_Component_Location (Id);
Reinit_Esize (Id);
diff --git a/gcc/ada/sem_ch8.ads b/gcc/ada/sem_ch8.ads
index 70fbcf2..f915f2c 100644
--- a/gcc/ada/sem_ch8.ads
+++ b/gcc/ada/sem_ch8.ads
@@ -100,11 +100,6 @@ package Sem_Ch8 is
-- entries in the current scope, and that will give all homonyms that are
-- declared before the point of call in the current scope. This is useful
-- for example in the processing for pragma Inline.
- --
- -- Flag Errors_OK should be set when error diagnostics are desired. Flag
- -- Marker_OK should be set when a N_Variable_Reference_Marker needs to be
- -- generated for a SPARK object in order to detect elaboration issues. Flag
- -- Reference_OK should be set when N must generate a cross reference.
procedure Find_Selected_Component (N : Node_Id);
-- Resolve various cases of selected components, recognize expanded names
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3c80d23..679d0ee 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -333,7 +333,7 @@ package body Sem_Util is
-- Add_Global_Declaration --
----------------------------
- procedure Add_Global_Declaration (N : Node_Id) is
+ procedure Add_Global_Declaration (Decl : Node_Id) is
Aux_Node : constant Node_Id := Aux_Decls_Node (Cunit (Current_Sem_Unit));
begin
@@ -341,8 +341,8 @@ package body Sem_Util is
Set_Declarations (Aux_Node, New_List);
end if;
- Append_To (Declarations (Aux_Node), N);
- Analyze (N);
+ Append_To (Declarations (Aux_Node), Decl);
+ Analyze (Decl);
end Add_Global_Declaration;
--------------------------------
@@ -8026,6 +8026,7 @@ package body Sem_Util is
-- but the error should be posted on it, not on the component.
elsif Ekind (E) = E_Discriminant
+ and then Is_Not_Self_Hidden (E)
and then Present (Scope (Def_Id))
and then Scope (Def_Id) /= Current_Scope
then
@@ -8051,7 +8052,10 @@ package body Sem_Util is
-- Avoid cascaded messages with duplicate components in
-- derived types.
- if Ekind (E) in E_Component | E_Discriminant then
+ if Ekind (E) = E_Component
+ or else (Ekind (E) = E_Discriminant
+ and then Is_Not_Self_Hidden (E))
+ then
return;
end if;
end if;
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 0e97806..8d5bda0 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -54,12 +54,12 @@ package Sem_Util is
-- Add A to the list of access types to process when expanding the
-- freeze node of E.
- procedure Add_Global_Declaration (N : Node_Id);
- -- These procedures adds a declaration N at the library level, to be
+ procedure Add_Global_Declaration (Decl : Node_Id);
+ -- This procedure adds a declaration Decl at the library level, to be
-- elaborated before any other code in the unit. It is used for example
-- for the entity that marks whether a unit has been elaborated. The
-- declaration is added to the Declarations list of the Aux_Decls_Node
- -- for the current unit. The declarations are added in the current scope,
+ -- for the current unit. The declared entity is added to current scope,
-- so the caller should push a new scope as required before the call.
function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 1bc97a8..74f9fe3 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -1712,17 +1712,11 @@ package body Sem_Warn is
and then Ekind (E1) /= E_Class_Wide_Type
- -- Objects other than parameters of task types are allowed to
- -- be non-referenced, since they start up tasks.
+ -- Objects that are not parameters and whose types have tasks
+ -- are allowed to be non-referenced since they start up tasks.
- and then ((Ekind (E1) /= E_Variable
- and then Ekind (E1) /= E_Constant
- and then Ekind (E1) /= E_Component)
-
- -- Check that E1T is not a task or a composite type
- -- with a task component.
-
- or else not Has_Task (E1T))
+ and then not (Ekind (E1) in E_Variable | E_Constant | E_Component
+ and then Has_Task (E1T))
-- For subunits, only place warnings on the main unit itself,
-- since parent units are not completely compiled.
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index a0c7314..9b5d3c2 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -8172,7 +8172,7 @@ package Sinfo is
-- An implicit label declaration is created for every occurrence of a
-- label on a statement or a label on a block or loop. It is chained
-- in the declarations of the innermost enclosing block as specified
- -- in RM section 5.1 (3).
+ -- in RM section 5.1 (12).
-- The Defining_Identifier is the actual identifier for the statement
-- identifier. Note that the occurrence of the label is a reference, NOT
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 1e54340..efad12c 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -1220,17 +1220,20 @@ package body Switch.C is
List_Representation_Info :=
Character'Pos (C) - Character'Pos ('0');
- when 's' =>
- List_Representation_Info_To_File := True;
+ when 'e' =>
+ List_Representation_Info_Extended := True;
- when 'j' =>
- List_Representation_Info_To_JSON := True;
+ when 'h' =>
+ List_Representation_Info_Holes := True;
when 'm' =>
List_Representation_Info_Mechanisms := True;
- when 'e' =>
- List_Representation_Info_Extended := True;
+ when 'j' =>
+ List_Representation_Info_To_JSON := True;
+
+ when 's' =>
+ List_Representation_Info_To_File := True;
when others =>
Bad_Switch ("-gnatR" & Switch_Chars (Ptr .. Max));
@@ -1245,6 +1248,12 @@ package body Switch.C is
Osint.Fail ("-gnatRe is incompatible with -gnatRj");
end if;
+ if List_Representation_Info_To_JSON
+ and then List_Representation_Info_Holes
+ then
+ Osint.Fail ("-gnatRh is incompatible with -gnatRj");
+ end if;
+
-- -gnats (syntax check only)
when 's' =>
diff --git a/gcc/ada/switch.adb b/gcc/ada/switch.adb
index b1abe1e..691abc0 100644
--- a/gcc/ada/switch.adb
+++ b/gcc/ada/switch.adb
@@ -93,7 +93,7 @@ package body Switch is
Set_Standard_Output;
Usage;
Write_Eol;
- Write_Line ("Report bugs to report@adacore.com");
+ Write_Line ("Report bugs to support@adacore.com");
Exit_Program (E_Success);
end if;
end Check_Version_And_Help_G;
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index b1a2c34..16e2bc8 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -87,7 +87,7 @@ package body Treepr is
procedure Destroy (Value : in out Nat) is null;
pragma Annotate (CodePeer, False_Positive, "unassigned parameter",
"in out parameter is required to instantiate generic");
- -- Dummy routine for destroing hashed values
+ -- Dummy routine for destroying hashed values
package Serial_Numbers is new Dynamic_Hash_Tables
(Key_Type => Int,
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index efa38b5..5b87bb5 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -92,17 +92,17 @@ begin
-- Common switches available everywhere
- Write_Switch_Char ("g ", "");
+ Write_Switch_Char ("g ", "");
Write_Line ("Generate debugging information");
- Write_Switch_Char ("Idir ", "");
+ Write_Switch_Char ("Idir ", "");
Write_Line ("Specify source files search path");
- Write_Switch_Char ("I- ", "");
+ Write_Switch_Char ("I- ", "");
Write_Line ("Do not look for sources in current directory");
- Write_Switch_Char ("O[0123] ", "");
- Write_Line ("Control the optimization level");
+ Write_Switch_Char ("O[?] ", "");
+ Write_Line ("Control the optimization level (?=0/1/2/3/s/z/g)");
Write_Eol;
@@ -402,7 +402,7 @@ begin
Write_Switch_Char ("R?");
Write_Line
- ("List rep info (?=0/1/2/3/4/e/m for none/types/all/sym/cg/ext/mech)");
+ ("List rep info (?=1/2/3/4/e/h/m for types/all/sym/cg/ext/holes/mech)");
Write_Switch_Char ("R?j");
Write_Line ("List rep info in the JSON data interchange format");
Write_Switch_Char ("R?s");
diff --git a/gcc/ada/vast.adb b/gcc/ada/vast.adb
index acb48b6..59470fd 100644
--- a/gcc/ada/vast.adb
+++ b/gcc/ada/vast.adb
@@ -29,58 +29,285 @@ pragma Assertion_Policy (Check);
-- we want to run VAST with a compiler built without checks. Anyway, it's
-- harmless, because VAST is not run by default.
-with Atree; use Atree;
+with Ada.Unchecked_Deallocation;
+
+with System.Case_Util;
+
+with Atree; use Atree;
with Debug;
-with Debug_A; use Debug_A;
-with Lib; use Lib;
-with Namet; use Namet;
-with Output; use Output;
-with Opt; use Opt;
-with Sinfo.Nodes; use Sinfo.Nodes;
with Einfo.Entities; use Einfo.Entities;
-with Types; use Types;
+with Lib; use Lib;
+with Namet; use Namet;
+with Nlists; use Nlists;
+with Opt; use Opt;
+with Output;
+with Sinfo.Nodes; use Sinfo.Nodes;
+with Sinput;
+with Table;
+with Types; use Types;
package body VAST is
+ -- ???Basic tree properties not yet checked:
+ -- - No dangling trees. Every node that is reachable at all is reachable
+ -- by some syntactic path.
+ -- - Basic properties of Nlists/Elists (next/prev pointers make sense,
+ -- for example).
+
Force_Enable_VAST : constant Boolean := False;
-- Normally, VAST is enabled by the the -gnatd_V switch.
-- To force it to be enabled independent of any switches,
- -- change the above to True.
- Print_Disabled_Failing_Checks : constant Boolean := True;
- -- False means disabled checks are silent; True means we print a message
- -- (but still don't raise VAST_Failure).
-
- type Check_Enum is (Check_Other, Check_Error_Nodes);
- Enabled_Checks : constant array (Check_Enum) of Boolean :=
- (Check_Other => True,
--- others => False);
- others => True);
- -- Passing checks are Check_Other, which should always be enabled.
+ -- set this to True.
+
+ type Check_Enum is
+ (Check_Other,
+ Check_Sloc,
+ Check_Analyzed,
+ Check_Error_Nodes,
+ Check_Sharing,
+ Check_Parent_Present,
+ Check_Parent_Correct);
+
+ type Check_Status is
+ -- Action in case of check failure:
+ (Disabled, -- Do nothing
+ Enabled, -- Print messages, and raise an exception
+ Print_And_Continue); -- Print a message
+
+ pragma Warnings (Off, "Status*could be declared constant");
+ Status : array (Check_Enum) of Check_Status :=
+ (Check_Other => Enabled,
+ Check_Sloc => Disabled,
+ Check_Analyzed => Disabled,
+ Check_Error_Nodes => Print_And_Continue,
+ Check_Sharing => Disabled,
+ Check_Parent_Present => Print_And_Continue,
+ Check_Parent_Correct => Disabled);
+-- others => Print_And_Continue);
+-- others => Enabled);
+-- others => Disabled);
+ -- Passing checks are Check_Other, which should always be Enabled.
-- Currently-failing checks are different enumerals in Check_Enum,
-- which can be disabled individually until we fix the bugs, or enabled
-- when debugging particular bugs. Pass a nondefault Check_Enum to
-- Assert in order to deal with bugs we have not yet fixed,
- -- and play around with the value of Enabled_Checks above
- -- for testing and debugging.
+ -- and play around with the value of Status above for
+ -- testing and debugging.
--
-- Note: Once a bug is fixed, and the check passes reliably, we may choose
-- to remove that check from Check_Enum and use Check_Other instead.
+ type Node_Stack_Index is new Pos;
+ subtype Node_Stack_Count is
+ Node_Stack_Index'Base range 0 .. Node_Stack_Index'Last;
+
+ package Node_Stack is new Table.Table
+ (Table_Component_Type => Node_Id,
+ Table_Index_Type => Node_Stack_Index'Base,
+ Table_Low_Bound => 1,
+ Table_Initial => 1,
+ Table_Increment => 100,
+ Table_Name => "Node_Stack");
+
procedure Assert
(Condition : Boolean;
Check : Check_Enum := Check_Other;
Detail : String := "");
- -- Check that the Condition is True, and raise an exception otherwise.
- -- Check enables/disables the checking, according to Enabled_Checks above,
- -- and is printed on failure. Detail is an additional error message,
- -- also printed on failure.
-
- function Do_Node (N : Node_Id) return Traverse_Result;
- procedure Traverse is new Traverse_Proc (Do_Node);
+ -- Check that the Condition is True. Status determines action on failure.
+
+ function To_Mixed (A : String) return String;
+ -- Copied from System.Case_Util; old versions of that package do not have
+ -- this function, so this is needed for bootstrapping.
+
+ function Image (Kind : Node_Kind) return String is (To_Mixed (Kind'Img));
+ function Image (Kind : Entity_Kind) return String is (To_Mixed (Kind'Img));
+
+ procedure Put (S : String);
+ procedure Put_Line (S : String);
+ procedure Put_Node (N : Node_Id);
+ procedure Put_Node_Stack;
+ -- Output routines; print only if -gnatd_W (VAST in verbose mode) is
+ -- enabled.
+
+ procedure Put_Indentation;
+ -- Print spaces to indicate nesting depth of Node_Stack
+
+ procedure Enter_Node (N : Node_Id);
+ procedure Leave_Node (N : Node_Id);
+ -- Called for each node while walking the tree.
+ -- Push/pop N to/from Node_Stack.
+ -- Print enter/leave debugging messages.
+ -- ???Possible improvements to messages:
+ -- Walk subtrees in a better order.
+ -- Print field names.
+ -- Don't print boring fields (such as N_Empty nodes).
+ -- Print more info (value of literals, "A.B.C" for expanded names, etc.).
+ -- Share some code with Treepr.
+
+ procedure Do_Tree (N : Node_Id);
-- Do VAST checking on a tree of nodes
+ function Has_Subtrees (N : Node_Id) return Boolean;
+ -- True if N has one or more syntactic fields
+
+ procedure Do_Subtrees (N : Node_Id);
+ -- Call Do_Tree on all the subtrees (i.e. syntactic fields) of N
+
+ procedure Do_List (L : List_Id);
+ -- Call Do_Tree on the list elements
+
procedure Do_Unit (U : Unit_Number_Type);
- -- Call Do_Node on the root node of a compilation unit
+ -- Call Do_Tree on the root node of a compilation unit
+
+ function Ancestor_Node (Count : Node_Stack_Count) return Node_Id;
+ -- Nth ancestor on the Node_Stack. Ancestor_Node(0) is the current node,
+ -- Ancestor_Node(1) is its parent, Ancestor_Node(2) is its grandparent,
+ -- and so on.
+
+ function Top_Node return Node_Id is (Ancestor_Node (0));
+
+ type Node_Set is array (Node_Id range <>) of Boolean;
+ pragma Pack (Node_Set);
+ type Node_Set_Ptr is access all Node_Set;
+ procedure Free is new Ada.Unchecked_Deallocation (Node_Set, Node_Set_Ptr);
+
+ Visited : Node_Set_Ptr;
+ -- Giant array of Booleans; Visited (N) is True if and only if we have
+ -- visited N in the tree walk. Used to detect incorrect sharing of subtrees
+ -- or (worse) cycles. We don't allocate the set on the stack, for fear of
+ -- Storage_Error.
+
+ function Get_Node_Field_Union is new
+ Atree.Atree_Private_Part.Get_32_Bit_Field (Union_Id) with Inline;
+
+ --------------
+ -- To_Mixed --
+ --------------
+
+ function To_Mixed (A : String) return String is
+ Result : String := A;
+ begin
+ System.Case_Util.To_Mixed (Result);
+ return Result;
+ end To_Mixed;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put (S : String) is
+ begin
+ if Debug.Debug_Flag_Underscore_WW then
+ Output.Write_Str (S);
+ end if;
+ end Put;
+
+ --------------
+ -- Put_Line --
+ --------------
+
+ procedure Put_Line (S : String) is
+ begin
+ if Debug.Debug_Flag_Underscore_WW then
+ Output.Write_Line (S);
+ end if;
+ end Put_Line;
+
+ --------------
+ -- Put_Node --
+ --------------
+
+ procedure Put_Node (N : Node_Id) is
+ begin
+ if Debug.Debug_Flag_Underscore_WW then
+ if Nkind (N) in N_Entity then
+ Put (Image (Ekind (N)));
+ else
+ Put (Image (Nkind (N)));
+ end if;
+
+ Put (N'Img & " ");
+ Sinput.Write_Location (Sloc (N));
+
+ if Comes_From_Source (N) then
+ Put (" (s)");
+ end if;
+
+ case Nkind (N) is
+ when N_Has_Chars =>
+ Put (" ");
+ Write_Name_For_Debug (Chars (N), Quote => """");
+ when others => null;
+ end case;
+
+ end if;
+ end Put_Node;
+
+ ---------------------
+ -- Put_Indentation --
+ ---------------------
+
+ procedure Put_Indentation is
+ begin
+ Put (String'(Natural (Node_Stack.First) ..
+ Natural (Node_Stack.Last) * 2 => ' '));
+ end Put_Indentation;
+
+ ----------------
+ -- Enter_Node --
+ ----------------
+
+ procedure Enter_Node (N : Node_Id) is
+ begin
+ Node_Stack.Append (N); -- push
+
+ if Has_Subtrees (N) then
+ Put ("-->");
+ else
+ -- If no subtrees, just print one line for enter/leave
+ Put (" ");
+ end if;
+ Put_Indentation;
+ Put_Node (N);
+ Put_Line ("");
+ end Enter_Node;
+
+ ----------------
+ -- Leave_Node --
+ ----------------
+
+ procedure Leave_Node (N : Node_Id) is
+ begin
+ if Has_Subtrees (N) then
+ Put ("<--");
+ Put_Indentation;
+ Put_Node (N);
+ Put_Line ("");
+ end if;
+
+ Node_Stack.Decrement_Last; -- pop
+ end Leave_Node;
+
+ --------------------
+ -- Put_Node_Stack --
+ --------------------
+
+ procedure Put_Node_Stack is
+ begin
+ for J in reverse Node_Stack.First .. Node_Stack.Last loop
+ Put_Node (Node_Stack.Table (J));
+ Put_Line ("");
+ end loop;
+ end Put_Node_Stack;
+
+ -------------------
+ -- Ancestor_Node --
+ -------------------
+
+ function Ancestor_Node (Count : Node_Stack_Count) return Node_Id is
+ begin
+ return Node_Stack.Table (Node_Stack.Last - Count);
+ end Ancestor_Node;
------------
-- Assert --
@@ -98,34 +325,70 @@ package body VAST is
declare
Part1 : constant String := "VAST fail";
Part2 : constant String :=
- (if Check = Check_Other then "" else ": " & Check'Img);
+ (if Check = Check_Other then ""
+ else ": " & To_Mixed (Check'Img));
Part3 : constant String :=
(if Detail = "" then "" else " -- " & Detail);
Message : constant String := Part1 & Part2 & Part3;
+ Save : constant Boolean := Debug.Debug_Flag_Underscore_WW;
begin
- if Enabled_Checks (Check) or else Print_Disabled_Failing_Checks
- then
- -- ???This Special_Output business is kind of ugly.
- -- We can do better.
- Cancel_Special_Output;
- Write_Line (Message);
- Set_Special_Output (Ignore_Output'Access);
- end if;
-
- if Enabled_Checks (Check) then
- raise VAST_Failure with Message;
- end if;
+ case Status (Check) is
+ when Disabled => null;
+ when Enabled | Print_And_Continue =>
+ Debug.Debug_Flag_Underscore_WW := True;
+ -- ???We should probably avoid changing the debug flag here
+ Put (Message & ": ");
+ Put_Node (Top_Node);
+ Put_Line ("");
+
+ if Status (Check) = Enabled then
+ Put_Node_Stack;
+ raise VAST_Failure with Message;
+ end if;
+
+ Debug.Debug_Flag_Underscore_WW := Save;
+ end case;
end;
end if;
end Assert;
-------------
- -- Do_Node --
+ -- Do_Tree --
-------------
- function Do_Node (N : Node_Id) return Traverse_Result is
+ procedure Do_Tree (N : Node_Id) is
begin
- Debug_A_Entry ("do ", N);
+ Enter_Node (N);
+
+ -- Skip the rest if empty. Check Sloc:
+
+ case Nkind (N) is
+ when N_Empty =>
+ Assert (No (Sloc (N)));
+ goto Done; -- -------------->
+ -- Don't do any further checks on Empty
+
+ -- ???Some nodes, including exception handlers, have no Sloc;
+ -- it's unclear why.
+
+ when N_Exception_Handler =>
+ Assert (if Comes_From_Source (N) then Present (Sloc (N)));
+ when others =>
+ Assert (Present (Sloc (N)), Check_Sloc);
+ end case;
+
+ -- All reachable nodes should have been analyzed by the time we get
+ -- here:
+
+ Assert (Analyzed (N), Check_Analyzed);
+
+ -- If we visit the same node more than once, then there are shared
+ -- nodes; the "tree" is not a tree:
+
+ Assert (not Visited (N), Check_Sharing);
+ Visited (N) := True;
+
+ -- Misc checks based on node/entity kind:
case Nkind (N) is
when N_Unused_At_Start | N_Unused_At_End =>
@@ -148,27 +411,105 @@ package body VAST is
-- Check that N has a Parent, except in certain cases:
- if Nkind (N) = N_Compilation_Unit then
- Assert (No (Parent (N)));
- -- The root of each unit should not have a parent
-
- elsif N in N_Entity_Id and then Is_Itype (N) then
- null; -- An Itype might or might not have a parent
+ case Nkind (N) is
+ when N_Empty =>
+ raise Program_Error; -- can't get here
- else
- if Nkind (N) = N_Error then
+ when N_Error =>
Assert (False, Check_Error_Nodes);
-- The error node has no parent, but we shouldn't even be seeing
- -- error nodes in VAST at all. See "when N_Error" above.
- else
- Assert (Present (Parent (N)), Detail => "missing parent");
+ -- error nodes in VAST at all. See earlier "when N_Error".
+
+ when N_Compilation_Unit =>
+ Assert (No (Parent (N)));
+ -- The parent of the root of each unit is empty.
+
+ when N_Entity =>
+ if not Is_Itype (N) then
+ -- An Itype might or might not have a parent
+
+ Assert
+ (Present (Parent (N)), Detail => "missing parent of entity");
+ Assert (Parent (N) = Ancestor_Node (1), Check_Parent_Correct);
+ end if;
+
+ when others =>
+ Assert (Present (Parent (N)), Check_Parent_Present);
-- All other nodes should have a parent
- end if;
- end if;
+ if Status (Check_Parent_Present) = Enabled then
+ Assert (Parent (N) = Ancestor_Node (1), Check_Parent_Correct);
+ end if;
+ end case;
- Debug_A_Exit ("do ", N, " (done)");
- return OK;
- end Do_Node;
+ Do_Subtrees (N);
+
+ <<Done>>
+ Leave_Node (N);
+ end Do_Tree;
+
+ -----------------
+ -- Has_Subtrees --
+ -----------------
+
+ function Has_Subtrees (N : Node_Id) return Boolean is
+ Offsets : Traversed_Offset_Array renames
+ Traversed_Fields (Nkind (N));
+ begin
+ -- True if sentinel comes first
+ return Offsets (Offsets'First) /= No_Field_Offset;
+ end Has_Subtrees;
+
+ -----------------
+ -- Do_Subtrees --
+ -----------------
+
+ procedure Do_Subtrees (N : Node_Id) is
+ -- ???Do we need tail recursion elimination here,
+ -- as in Atree.Traverse_Func?
+ Offsets : Traversed_Offset_Array renames
+ Traversed_Fields (Nkind (N));
+ begin
+ for Cur_Field in Offset_Array_Index loop
+ exit when Offsets (Cur_Field) = No_Field_Offset;
+
+ declare
+ F : constant Union_Id :=
+ Get_Node_Field_Union (N, Offsets (Cur_Field));
+ begin
+ if F in Node_Range then
+ Do_Tree (Node_Id (F));
+ elsif F in List_Range then
+ Do_List (List_Id (F));
+ else
+ raise Program_Error;
+ end if;
+ end;
+ end loop;
+ end Do_Subtrees;
+
+ -------------
+ -- Do_List --
+ -------------
+
+ procedure Do_List (L : List_Id) is
+ Elmt : Node_Id := First (L);
+ Len : constant String := List_Length (L)'Img;
+ begin
+ if Is_Non_Empty_List (L) then
+ Put ("-->");
+ Put_Indentation;
+ Put_Line ("list len=" & Len);
+
+ while Present (Elmt) loop
+ Do_Tree (Elmt);
+ Next (Elmt);
+ end loop;
+
+ Put ("<--");
+ Put_Indentation;
+ Put_Line ("list len=" & Len);
+ end if;
+ end Do_List;
-------------
-- Do_Unit --
@@ -183,8 +524,10 @@ package body VAST is
(if Is_Predefined_Unit (U) then " (predef)"
elsif Is_Internal_Unit (U) then " (gnat)"
else "");
+ Is_Main : constant String :=
+ (if U = Main_Unit then " (main unit)" else "");
Msg : constant String :=
- "VAST for unit" & U'Img & " " & U_Name_S & Predef;
+ "VAST for unit" & U'Img & " " & U_Name_S & Predef & Is_Main;
Is_Preprocessing_Dependency : constant Boolean :=
U_Name = No_Unit_Name;
@@ -194,24 +537,26 @@ package body VAST is
Root : constant Node_Id := Cunit (U);
begin
+ pragma Assert (Node_Stack.Last = 0);
Assert (No (Root) = Is_Preprocessing_Dependency);
-- All compilation units except these bogus ones should have a Cunit.
- Write_Line (Msg);
+ Put_Line (Msg);
if Is_Preprocessing_Dependency then
- Write_Line ("Skipping preprocessing dependency");
+ Put_Line ("Skipping preprocessing dependency");
return;
end if;
Assert (Present (Root));
- Traverse (Root);
- Write_Line (Msg & " (done)");
+ Do_Tree (Root);
+ Put_Line (Msg & " (done)");
+ pragma Assert (Node_Stack.Last = 0);
end Do_Unit;
- ----------------
- -- Check_Tree --
- ----------------
+ ----------
+ -- VAST --
+ ----------
procedure VAST is
pragma Assert (Expander_Active = (Operating_Mode = Generate_Code));
@@ -228,12 +573,10 @@ package body VAST is
end if;
-- If -gnatd_W (VAST in verbose mode) is enabled, then that should imply
- -- -gnatd_V (enable VAST). In addition, we use the Debug_A routines to
- -- print debugging information, so enable -gnatda.
+ -- -gnatd_V (enable VAST).
if Debug_Flag_Underscore_WW then
Debug_Flag_Underscore_VV := True;
- Debug_Flag_A := True;
end if;
-- Do nothing if VAST is disabled
@@ -244,22 +587,34 @@ package body VAST is
-- Turn off output unless verbose mode is enabled
- if not Debug_Flag_Underscore_WW then
- Set_Special_Output (Ignore_Output'Access);
- end if;
- Write_Line ("VAST");
+ Put_Line ("VAST");
-- Operating_Mode = Generate_Code implies there are no legality errors:
Assert (Serious_Errors_Detected = 0);
- Write_Line ("VAST checking" & Last_Unit'Img & " units");
- for U in Main_Unit .. Last_Unit loop
- Do_Unit (U);
- end loop;
+ Put_Line ("VAST checking" & Last_Unit'Img & " units");
+
+ declare
+ use Atree_Private_Part;
+ Last_Node : constant Node_Id := Node_Offsets.Last;
+ begin
+ pragma Assert (Visited = null);
+ Visited := new Node_Set'(Node_Id'First .. Last_Node => False);
+
+ for U in Main_Unit .. Last_Unit loop
+ -- Main_Unit is the one passed to the back end, but here we are
+ -- walking all the units.
+ Do_Unit (U);
+ end loop;
+
+ -- We shouldn't have allocated any new nodes during VAST:
+
+ pragma Assert (Node_Offsets.Last = Last_Node);
+ Free (Visited);
+ end;
- Write_Line ("VAST done.");
- Cancel_Special_Output;
+ Put_Line ("VAST done.");
end VAST;
end VAST;
diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index 56dd18c..f666783 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -1279,18 +1279,31 @@ make_dispatcher_decl (const tree decl)
return func_decl;
}
-/* Returns true if DECL is multi-versioned using the target attribute, and this
- is the default version. This function can only be used for targets that do
- not support the "target_version" attribute. */
+/* Returns true if DECL a multiversioned default.
+ With the target attribute semantics, returns true if the function is marked
+ as default with the target version.
+ With the target_version attribute semantics, returns true if the function
+ is either not annotated, or annotated as default. */
bool
is_function_default_version (const tree decl)
{
- if (TREE_CODE (decl) != FUNCTION_DECL
- || !DECL_FUNCTION_VERSIONED (decl))
+ tree attr;
+ if (TREE_CODE (decl) != FUNCTION_DECL)
return false;
- tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (decl));
- gcc_assert (attr);
+ if (TARGET_HAS_FMV_TARGET_ATTRIBUTE)
+ {
+ if (!DECL_FUNCTION_VERSIONED (decl))
+ return false;
+ attr = lookup_attribute ("target", DECL_ATTRIBUTES (decl));
+ gcc_assert (attr);
+ }
+ else
+ {
+ attr = lookup_attribute ("target_version", DECL_ATTRIBUTES (decl));
+ if (!attr)
+ return true;
+ }
attr = TREE_VALUE (TREE_VALUE (attr));
return (TREE_CODE (attr) == STRING_CST
&& strcmp (TREE_STRING_POINTER (attr), "default") == 0);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index cd96e82..3ffe3e0 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,11 @@
+2025-06-12 Gwenole Beauchesne <gb.devel@gmail.com>
+ Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR c++/41201
+ PR c++/48026
+ * c-pragma.cc (init_pragma): Use c_register_pragma_with_early_handler
+ instead of c_register_pragma for `#pragma GCC optimize`.
+
2025-06-03 Martin Uecker <uecker@tugraz.at>
PR c/120078
diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc
index 8b5cdcc..137b83bf 100644
--- a/gcc/c-family/c-pragma.cc
+++ b/gcc/c-family/c-pragma.cc
@@ -1847,7 +1847,9 @@ init_pragma (void)
c_register_pragma_with_early_handler ("GCC", "target",
handle_pragma_target,
handle_pragma_target);
- c_register_pragma ("GCC", "optimize", handle_pragma_optimize);
+ c_register_pragma_with_early_handler ("GCC", "optimize",
+ handle_pragma_optimize,
+ handle_pragma_optimize);
c_register_pragma_with_early_handler ("GCC", "push_options",
handle_pragma_push_options,
handle_pragma_push_options);
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 351eb4e..47f828f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,34 @@
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ * c-lang.h (union lang_type::maybe_objc_info): New type.
+ (struct lang_type): Use union maybe_objc_info info member
+ instead of tree objc_info.
+ * c-decl.cc (finish_struct): Allocate struct lang_type using
+ ggc_internal_cleared_alloc instead of ggc_cleared_alloc,
+ and use sizeof (struct lang_type) for ObjC and otherwise
+ offsetof (struct lang_type, info) as size.
+ (finish_enum): Likewise.
+
+2025-06-11 Martin Uecker <uecker@tugraz.at>
+
+ PR c/120510
+ * c-typeck.cc (composite_type_internal): Activate checking
+ assertions for all types and also inputs.
+ (comptypes_for_composite_check): New helper function.
+ (function_types_compatible_p): Add exception.
+
+2025-06-11 Martin Uecker <uecker@tugraz.at>
+
+ * c-typeck.cc (function_types_compatible_p): Remove unused
+ variables and return true/false instead of 1/0.
+ (type_lists_compatible_p): Return false instead of 0.
+
+2025-06-11 Martin Uecker <uecker@tugraz.at>
+
+ PR c/120303
+ * c-parser.cc (c_parser_generic_selection): Handle error
+ condition.
+
2025-06-09 Martin Uecker <uecker@tugraz.at>
PR c/120510
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index 2b0bd66..8bbd6eb 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -9790,12 +9790,17 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
len += list_length (x);
/* Use the same allocation policy here that make_node uses, to
- ensure that this lives as long as the rest of the struct decl.
- All decls in an inline function need to be saved. */
-
- space = ggc_cleared_alloc<struct lang_type> ();
- space2 = (sorted_fields_type *) ggc_internal_alloc
- (sizeof (struct sorted_fields_type) + len * sizeof (tree));
+ ensure that this lives as long as the rest of the struct decl.
+ All decls in an inline function need to be saved. */
+
+ space = ((struct lang_type *)
+ ggc_internal_cleared_alloc (c_dialect_objc ()
+ ? sizeof (struct lang_type)
+ : offsetof (struct lang_type,
+ info)));
+ space2 = ((sorted_fields_type *)
+ ggc_internal_alloc (sizeof (struct sorted_fields_type)
+ + len * sizeof (tree)));
len = 0;
space->s = space2;
@@ -10269,7 +10274,10 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* Record the min/max values so that we can warn about bit-field
enumerations that are too small for the values. */
- lt = ggc_cleared_alloc<struct lang_type> ();
+ lt = ((struct lang_type *)
+ ggc_internal_cleared_alloc (c_dialect_objc ()
+ ? sizeof (struct lang_type)
+ : offsetof (struct lang_type, info)));
lt->enum_min = minnode;
lt->enum_max = maxnode;
TYPE_LANG_SPECIFIC (enumtype) = lt;
diff --git a/gcc/c/c-lang.h b/gcc/c/c-lang.h
index 4b93d18..2e99b4d 100644
--- a/gcc/c/c-lang.h
+++ b/gcc/c/c-lang.h
@@ -35,10 +35,14 @@ struct GTY(()) lang_type {
/* In an ENUMERAL_TYPE, the min and max values. */
tree enum_min;
tree enum_max;
- /* In a RECORD_TYPE, information specific to Objective-C, such
- as a list of adopted protocols or a pointer to a corresponding
- @interface. See objc/objc-act.h for details. */
- tree objc_info;
+ union maybe_objc_info {
+ /* If not c_dialect_objc, this part is not even allocated. */
+ char GTY((tag ("0"))) non_objc;
+ /* In a RECORD_TYPE, information specific to Objective-C, such
+ as a list of adopted protocols or a pointer to a corresponding
+ @interface. See objc/objc-act.h for details. */
+ tree GTY((tag ("1"))) objc_info;
+ } GTY ((desc ("c_dialect_objc ()"))) info;
};
struct GTY(()) lang_decl {
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 85580c5..faa50a4 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -11146,8 +11146,14 @@ c_parser_generic_selection (c_parser *parser)
"ISO C does not support use of type name as %<_Generic%> "
"controlling operand before C2Y");
struct c_type_name *type = c_parser_type_name (parser);
- selector_type = groktypename (type, NULL, NULL);
+ if (type)
+ selector_type = groktypename (type, NULL, NULL);
c_inhibit_evaluation_warnings--;
+ if (!type)
+ {
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
+ return error_expr;
+ }
}
else
{
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 539d481..e24629b 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -136,6 +136,7 @@ static int lvalue_or_else (location_t, const_tree, enum lvalue_use);
static void record_maybe_used_decl (tree);
static bool comptypes_internal (const_tree, const_tree,
struct comptypes_data *data);
+static bool comptypes_check_for_composite (tree t1, tree t2);
/* Return true if EXP is a null pointer constant, false otherwise. */
@@ -1002,15 +1003,13 @@ composite_type_internal (tree t1, tree t2, struct composite_cache* cache)
tree
composite_type (tree t1, tree t2)
{
+ gcc_checking_assert (comptypes_check_for_composite (t1, t2));
+
struct composite_cache cache = { };
tree n = composite_type_internal (t1, t2, &cache);
- /* For function types there are some cases where qualifiers do
- not match. See PR120510. */
- if (FUNCTION_TYPE != TREE_CODE (n))
- {
- gcc_checking_assert (comptypes (n, t1));
- gcc_checking_assert (comptypes (n, t2));
- }
+
+ gcc_checking_assert (comptypes_check_for_composite (n, t1));
+ gcc_checking_assert (comptypes_check_for_composite (n, t2));
return n;
}
@@ -1454,16 +1453,39 @@ comptypes_verify (tree type1, tree type2)
}
struct comptypes_data {
+
+ /* output */
bool enum_and_int_p;
bool different_types_p;
bool warning_needed;
+
+ /* context */
bool anon_field;
bool pointedto;
+
+ /* configuration */
bool equiv;
+ bool ignore_promoting_args;
const struct tagged_tu_seen_cache* cache;
};
+
+/* Helper function for composite_type. This function ignores when the
+ function type of an old-style declaration is incompatible with a type
+ of a declaration with prototype because some are arguments are not
+ self-promoting. This is ignored only for function types but not
+ ignored in a nested context. */
+
+static bool
+comptypes_check_for_composite (tree t1, tree t2)
+{
+ struct comptypes_data data = { };
+ data.ignore_promoting_args = FUNCTION_TYPE == TREE_CODE (t1);
+ return comptypes_internal (t1, t2, &data);
+}
+
+
/* C implementation of compatible_types_for_indirection_note_p. */
bool
@@ -1593,6 +1615,10 @@ comptypes_equiv_p (tree type1, tree type2)
permitted in C11 typedef redeclarations, then this sets
'different_types_p' in DATA to true; it is never set to
false, but may or may not be set if the types are incompatible.
+ If two functions types are not compatible only because one is
+ an old-style definition that does not have self-promoting arguments,
+ then this can be ignored by setting 'ignore_promoting_args_p'.
+ For 'equiv' we can compute equivalency classes (see above).
This differs from comptypes, in that we don't free the seen
types. */
@@ -2016,14 +2042,8 @@ static bool
function_types_compatible_p (const_tree f1, const_tree f2,
struct comptypes_data *data)
{
- tree args1, args2;
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- int val = 1;
- int val1;
- tree ret1, ret2;
-
- ret1 = TREE_TYPE (f1);
- ret2 = TREE_TYPE (f2);
+ tree ret1 = TREE_TYPE (f1);
+ tree ret2 = TREE_TYPE (f2);
/* 'volatile' qualifiers on a function's return type used to mean
the function is noreturn. */
@@ -2035,12 +2055,17 @@ function_types_compatible_p (const_tree f1, const_tree f2,
if (TYPE_VOLATILE (ret2))
ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2),
TYPE_QUALS (ret2) & ~TYPE_QUAL_VOLATILE);
- val = comptypes_internal (ret1, ret2, data);
- if (val == 0)
- return 0;
- args1 = TYPE_ARG_TYPES (f1);
- args2 = TYPE_ARG_TYPES (f2);
+ bool ignore_pargs = data->ignore_promoting_args;
+ data->ignore_promoting_args = false;
+
+ if (!comptypes_internal (ret1, ret2, data))
+ return false;
+
+ data->ignore_promoting_args = ignore_pargs;
+
+ tree args1 = TYPE_ARG_TYPES (f1);
+ tree args2 = TYPE_ARG_TYPES (f2);
if ((args1 == NULL_TREE) != (args2 == NULL_TREE))
data->different_types_p = true;
@@ -2051,40 +2076,33 @@ function_types_compatible_p (const_tree f1, const_tree f2,
if (args1 == NULL_TREE)
{
if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2))
- return 0;
- if (!self_promoting_args_p (args2))
- return 0;
+ return false;
+ if (!(data->ignore_promoting_args || self_promoting_args_p (args2)))
+ return false;
+ data->ignore_promoting_args = false;
/* If one of these types comes from a non-prototype fn definition,
compare that with the other type's arglist.
If they don't match, ask for a warning (but no error). */
if (TYPE_ACTUAL_ARG_TYPES (f1)
- && type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1),
- data) != 1)
- {
- val = 1;
- data->warning_needed = true;
- }
- return val;
+ && !type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1), data))
+ data->warning_needed = true;
+ return true;
}
if (args2 == NULL_TREE)
{
if (TYPE_NO_NAMED_ARGS_STDARG_P (f1) != TYPE_NO_NAMED_ARGS_STDARG_P (f2))
- return 0;
- if (!self_promoting_args_p (args1))
- return 0;
+ return false;
+ if (!(data->ignore_promoting_args || self_promoting_args_p (args1)))
+ return false;
+ data->ignore_promoting_args = false;
if (TYPE_ACTUAL_ARG_TYPES (f2)
- && type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2),
- data) != 1)
- {
- val = 1;
- data->warning_needed = true;
- }
- return val;
+ && !type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2), data))
+ data->warning_needed = true;
+ return true;
}
/* Both types have argument lists: compare them and propagate results. */
- val1 = type_lists_compatible_p (args1, args2, data);
- return val1;
+ return type_lists_compatible_p (args1, args2, data);
}
/* Check two lists of types for compatibility, returning false for
@@ -2101,7 +2119,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
/* If one list is shorter than the other,
they fail to match. */
if (args1 == NULL_TREE || args2 == NULL_TREE)
- return 0;
+ return false;
tree a1 = TREE_VALUE (args1);
tree a2 = TREE_VALUE (args2);
tree mv1 = remove_qualifiers (a1);
@@ -2115,12 +2133,12 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
if (a1 == NULL_TREE)
{
if (c_type_promotes_to (a2) != a2)
- return 0;
+ return false;
}
else if (a2 == NULL_TREE)
{
if (c_type_promotes_to (a1) != a1)
- return 0;
+ return false;
}
/* If one of the lists has an error marker, ignore this arg. */
else if (TREE_CODE (a1) == ERROR_MARK
@@ -2147,7 +2165,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
break;
}
if (memb == NULL_TREE)
- return 0;
+ return false;
}
else if (TREE_CODE (a2) == UNION_TYPE
&& (TYPE_NAME (a2) == NULL_TREE
@@ -2165,10 +2183,10 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
break;
}
if (memb == NULL_TREE)
- return 0;
+ return false;
}
else
- return 0;
+ return false;
}
args1 = TREE_CHAIN (args1);
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 49b0b14..f288a54 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -3013,6 +3013,7 @@ expand_gimple_cond (basic_block bb, gcond *stmt)
new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb);
dest = false_edge->dest;
+ 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 ();
@@ -3021,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);
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 4a037a7..93353cb 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -179,26 +179,128 @@ cgraph_node::function_version (void)
return cgraph_fnver_htab->find (&key);
}
-/* Scale profile by NUM/DEN. Walk into inlined clones. */
+/* If profile is IPA, turn it into local one. */
+void
+cgraph_node::make_profile_local ()
+{
+ if (!count.ipa ().initialized_p ())
+ return;
+ if (!(count == profile_count::zero ()))
+ count = count.guessed_local ();
+ for (cgraph_edge *e = callees; e; e = e->next_callee)
+ {
+ if (!e->inline_failed)
+ e->callee->make_profile_local ();
+ if (!(e->count == profile_count::zero ()))
+ e->count = e->count.guessed_local ();
+ }
+ for (cgraph_edge *e = indirect_calls; e; e = e->next_callee)
+ if (!(e->count == profile_count::zero ()))
+ e->count = e->count.guessed_local ();
+}
+/* Turn profile to global0. Walk into inlined functions.
+ QUALITY must be GUESSED_GLOBAL0 or GUESSED_GLOBAL0_ADJUSTED */
void
-cgraph_node::apply_scale (profile_count num, profile_count den)
+cgraph_node::make_profile_global0 (profile_quality quality)
{
- struct cgraph_edge *e;
+ if (count == profile_count::zero ())
+ ;
+ else if (quality == GUESSED_GLOBAL0)
+ {
+ if (count.quality () == GUESSED_GLOBAL0)
+ return;
+ count = count.global0 ();
+ }
+ else if (quality == GUESSED_GLOBAL0_ADJUSTED)
+ {
+ if (count.quality () == GUESSED_GLOBAL0
+ || count.quality () == GUESSED_GLOBAL0_ADJUSTED)
+ return;
+ count = count.global0adjusted ();
+ }
+ else
+ gcc_unreachable ();
+ for (cgraph_edge *e = callees; e; e = e->next_callee)
+ {
+ if (!e->inline_failed)
+ e->callee->make_profile_global0 (quality);
+ if (e->count == profile_count::zero ())
+ ;
+ else if (quality == GUESSED_GLOBAL0)
+ e->count = e->count.global0 ();
+ else if (quality == GUESSED_GLOBAL0_ADJUSTED)
+ e->count = e->count.global0adjusted ();
+ else
+ gcc_unreachable ();
+ }
+ for (cgraph_edge *e = indirect_calls; e; e = e->next_callee)
+ if (e->count == profile_count::zero ())
+ ;
+ else if (quality == GUESSED_GLOBAL0)
+ e->count = e->count.global0 ();
+ else if (quality == GUESSED_GLOBAL0_ADJUSTED)
+ e->count = e->count.global0adjusted ();
+ else
+ gcc_unreachable ();
+}
- profile_count::adjust_for_ipa_scaling (&num, &den);
+/* Scale profile by NUM/DEN. Walk into inlined functions. */
- for (e = callees; e; e = e->next_callee)
+void
+cgraph_node::apply_scale (profile_count num, profile_count den)
+{
+ if (num == den)
+ return;
+
+ for (cgraph_edge *e = callees; e; e = e->next_callee)
{
if (!e->inline_failed)
e->callee->apply_scale (num, den);
e->count = e->count.apply_scale (num, den);
}
- for (e = indirect_calls; e; e = e->next_callee)
+ for (cgraph_edge *e = indirect_calls; e; e = e->next_callee)
e->count = e->count.apply_scale (num, den);
count = count.apply_scale (num, den);
}
+/* Scale profile to given IPA_COUNT.
+ IPA_COUNT should pass ipa_p () with a single exception.
+ It can be also GUESSED_LOCAL in case we want to
+ drop any IPA info about the profile. */
+
+void
+cgraph_node::scale_profile_to (profile_count ipa_count)
+{
+ /* If we do not know the adjustment, it is better to keep profile
+ as it is. */
+ if (!ipa_count.initialized_p ()
+ || ipa_count == count)
+ return;
+ /* ipa-cp converts value to guessed-local in case it believes
+ that we lost track of IPA profile. */
+ if (ipa_count.quality () == GUESSED_LOCAL)
+ {
+ make_profile_local ();
+ return;
+ }
+ if (ipa_count == profile_count::zero ())
+ {
+ make_profile_global0 (GUESSED_GLOBAL0);
+ return;
+ }
+ if (ipa_count == profile_count::adjusted_zero ())
+ {
+ make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED);
+ return;
+ }
+ gcc_assert (ipa_count.ipa () == ipa_count
+ && !inlined_to);
+ profile_count num = count.combine_with_ipa_count (ipa_count);
+ profile_count den = count;
+ profile_count::adjust_for_ipa_scaling (&num, &den);
+}
+
/* Insert a new cgraph_function_version_info node into cgraph_fnver_htab
corresponding to cgraph_node NODE. */
cgraph_function_version_info *
@@ -251,45 +353,60 @@ cgraph_node::delete_function_version_by_decl (tree decl)
decl_node->remove ();
}
-/* Record that DECL1 and DECL2 are semantically identical function
+/* Add decl to the structure of semantically identical function versions.
+ The node is inserted at the point maintaining the priority ordering on the
versions. */
void
-cgraph_node::record_function_versions (tree decl1, tree decl2)
+cgraph_node::add_function_version (cgraph_function_version_info *fn_v,
+ tree decl)
{
- cgraph_node *decl1_node = cgraph_node::get_create (decl1);
- cgraph_node *decl2_node = cgraph_node::get_create (decl2);
- cgraph_function_version_info *decl1_v = NULL;
- cgraph_function_version_info *decl2_v = NULL;
- cgraph_function_version_info *before;
- cgraph_function_version_info *after;
-
- gcc_assert (decl1_node != NULL && decl2_node != NULL);
- decl1_v = decl1_node->function_version ();
- decl2_v = decl2_node->function_version ();
+ cgraph_node *decl_node = cgraph_node::get_create (decl);
+ cgraph_function_version_info *decl_v = NULL;
- if (decl1_v != NULL && decl2_v != NULL)
- return;
+ gcc_assert (decl_node != NULL);
- if (decl1_v == NULL)
- decl1_v = decl1_node->insert_new_function_version ();
+ decl_v = decl_node->function_version ();
- if (decl2_v == NULL)
- decl2_v = decl2_node->insert_new_function_version ();
-
- /* Chain decl2_v and decl1_v. All semantically identical versions
- will be chained together. */
-
- before = decl1_v;
- after = decl2_v;
+ /* If the nodes are already linked, skip. */
+ if (decl_v != NULL && (decl_v->next || decl_v->prev))
+ return;
- while (before->next != NULL)
- before = before->next;
+ if (decl_v == NULL)
+ decl_v = decl_node->insert_new_function_version ();
+
+ gcc_assert (decl_v);
+ gcc_assert (fn_v);
+
+ /* Go to start of the FMV structure. */
+ while (fn_v->prev)
+ fn_v = fn_v->prev;
+
+ cgraph_function_version_info *insert_point_before = NULL;
+ cgraph_function_version_info *insert_point_after = fn_v;
+
+ /* Find the insertion point for the new version to maintain ordering.
+ The default node must always go at the beginning. */
+ if (!is_function_default_version (decl))
+ while (insert_point_after
+ && (targetm.compare_version_priority
+ (decl, insert_point_after->this_node->decl) > 0
+ || is_function_default_version
+ (insert_point_after->this_node->decl)
+ || lookup_attribute
+ ("target_clones",
+ DECL_ATTRIBUTES (insert_point_after->this_node->decl))))
+ {
+ insert_point_before = insert_point_after;
+ insert_point_after = insert_point_after->next;
+ }
- while (after->prev != NULL)
- after= after->prev;
+ decl_v->prev = insert_point_before;
+ decl_v->next= insert_point_after;
- before->next = after;
- after->prev = before;
+ if (insert_point_before)
+ insert_point_before->next = decl_v;
+ if (insert_point_after)
+ insert_point_after->prev = decl_v;
}
/* Initialize callgraph dump file. */
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ba9a8a2..deca564 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1256,9 +1256,21 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
it is not used in any other non-standard way. */
bool only_called_directly_p (void);
- /* Scale profile by NUM/DEN. Walk into inlined clones. */
+ /* Turn profile to global0. Walk into inlined functions. */
+ void make_profile_local ();
+
+ /* Turn profile to global0. Walk into inlined functions. */
+ void make_profile_global0 (profile_quality quality);
+
+ /* Scale profile by NUM/DEN. Walk into inlined funtion. */
void apply_scale (profile_count num, profile_count den);
+ /* Scale profile to given IPA_COUNT.
+ IPA_COUNT should pass ipa_p () with a single exception.
+ It can be also GUESSED_LOCAL in case we want to
+ drop any IPA info about the profile. */
+ void scale_profile_to (profile_count ipa_count);
+
/* Return true when function is only called directly or it has alias.
i.e. it is not externally visible, address was not taken and
it is not used in any other non-standard way. */
@@ -1327,9 +1339,9 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
return m_summary_id;
}
- /* Record that DECL1 and DECL2 are semantically identical function
- versions. */
- static void record_function_versions (tree decl1, tree decl2);
+ /* Adds DECL to the FN_V structure of semantically identical functions. */
+ static void add_function_version (cgraph_function_version_info *fn_v,
+ tree decl);
/* Remove the cgraph_function_version_info and cgraph_node for DECL. This
DECL is a duplicate declaration. */
diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog
index dff1523..4c1d1e9 100644
--- a/gcc/cobol/ChangeLog
+++ b/gcc/cobol/ChangeLog
@@ -1,3 +1,12 @@
+2025-06-10 James K. Lowden <jklowden@cobolworx.com>
+
+ * Make-lang.in: cobol.clean does not remove libgcobol files.
+ * cdf.y: Suppress 1 cppcheck false positive.
+ * cdfval.h (scanner_parsing): Partial via cppcheck for PR119324.
+ * gcobol.1: Fix groff errors.
+ * gcobolspec.cc (append_arg): Const parameter.
+ * parse_ante.h (intrinsic_call_2): Avoid NULL dereference.
+
2025-06-06 Robert Dubner <rdubner@symas.com>
James K. Lowden <jklowden@cobolworx.com>
diff --git a/gcc/config/aarch64/aarch64-sme.md b/gcc/config/aarch64/aarch64-sme.md
index c49affd..f7958c9 100644
--- a/gcc/config/aarch64/aarch64-sme.md
+++ b/gcc/config/aarch64/aarch64-sme.md
@@ -373,6 +373,8 @@
(reg:DI SME_STATE_REGNUM)
(reg:DI TPIDR2_SETUP_REGNUM)
(reg:DI ZA_SAVED_REGNUM)] UNSPEC_RESTORE_ZA))
+ (set (reg:DI SME_STATE_REGNUM)
+ (unspec:DI [(reg:DI SME_STATE_REGNUM)] UNSPEC_TPIDR2_RESTORE))
(clobber (reg:DI R0_REGNUM))
(clobber (reg:DI R14_REGNUM))
(clobber (reg:DI R15_REGNUM))
diff --git a/gcc/config/aarch64/aarch64.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/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 181e64a..4946f87 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -3609,7 +3609,11 @@ ix86_expand_int_movcc (rtx operands[])
negate_cc_compare_p = true;
}
- diff = ct - cf;
+ diff = (unsigned HOST_WIDE_INT) ct - cf;
+ /* Make sure we can represent the difference between the two values. */
+ if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct))
+ return false;
+
/* Sign bit compares are better done using shifts than we do by using
sbb. */
if (sign_bit_compare_p
@@ -3667,7 +3671,12 @@ ix86_expand_int_movcc (rtx operands[])
PUT_CODE (compare_op,
reverse_condition (GET_CODE (compare_op)));
}
- diff = ct - cf;
+
+ diff = (unsigned HOST_WIDE_INT) ct - cf;
+ /* Make sure we can represent the difference
+ between the two values. */
+ if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct))
+ return false;
if (reg_overlap_mentioned_p (out, compare_op))
tmp = gen_reg_rtx (mode);
@@ -3685,7 +3694,12 @@ ix86_expand_int_movcc (rtx operands[])
else
{
std::swap (ct, cf);
- diff = ct - cf;
+
+ diff = (unsigned HOST_WIDE_INT) ct - cf;
+ /* Make sure we can represent the difference
+ between the two values. */
+ if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct))
+ return false;
}
tmp = emit_store_flag (tmp, code, op0, op1, VOIDmode, 0, -1);
}
@@ -3752,9 +3766,15 @@ ix86_expand_int_movcc (rtx operands[])
tmp = expand_simple_unop (mode, NOT, tmp, copy_rtx (tmp), 1);
}
+ HOST_WIDE_INT ival = (unsigned HOST_WIDE_INT) cf - ct;
+ /* Make sure we can represent the difference
+ between the two values. */
+ if ((ival > 0) != ((ct < 0) != (cf < 0) ? ct < 0 : ct < cf))
+ return false;
+
tmp = expand_simple_binop (mode, AND,
copy_rtx (tmp),
- gen_int_mode (cf - ct, mode),
+ gen_int_mode (ival, mode),
copy_rtx (tmp), 1, OPTAB_DIRECT);
if (ct)
tmp = expand_simple_binop (mode, PLUS,
@@ -3791,7 +3811,13 @@ ix86_expand_int_movcc (rtx operands[])
if (new_code != UNKNOWN)
{
std::swap (ct, cf);
- diff = -diff;
+
+ diff = (unsigned HOST_WIDE_INT) ct - cf;
+ /* Make sure we can represent the difference
+ between the two values. */
+ if ((diff > 0) != ((cf < 0) != (ct < 0) ? cf < 0 : cf < ct))
+ return false;
+
code = new_code;
}
}
@@ -3994,8 +4020,14 @@ ix86_expand_int_movcc (rtx operands[])
copy_rtx (out), 1, OPTAB_DIRECT);
}
+ HOST_WIDE_INT ival = (unsigned HOST_WIDE_INT) cf - ct;
+ /* Make sure we can represent the difference
+ between the two values. */
+ if ((ival > 0) != ((ct < 0) != (cf < 0) ? ct < 0 : ct < cf))
+ return false;
+
out = expand_simple_binop (mode, AND, copy_rtx (out),
- gen_int_mode (cf - ct, mode),
+ gen_int_mode (ival, mode),
copy_rtx (out), 1, OPTAB_DIRECT);
if (ct)
out = expand_simple_binop (mode, PLUS, copy_rtx (out), GEN_INT (ct),
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index b1682c2..56ab7f2 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -4284,7 +4284,6 @@ ix86_get_function_versions_dispatcher (void *decl)
struct cgraph_node *node = NULL;
struct cgraph_node *default_node = NULL;
struct cgraph_function_version_info *node_v = NULL;
- struct cgraph_function_version_info *first_v = NULL;
tree dispatch_decl = NULL;
@@ -4301,37 +4300,16 @@ ix86_get_function_versions_dispatcher (void *decl)
if (node_v->dispatcher_resolver != NULL)
return node_v->dispatcher_resolver;
- /* Find the default version and make it the first node. */
- first_v = node_v;
- /* Go to the beginning of the chain. */
- while (first_v->prev != NULL)
- first_v = first_v->prev;
- default_version_info = first_v;
- while (default_version_info != NULL)
- {
- if (is_function_default_version
- (default_version_info->this_node->decl))
- break;
- default_version_info = default_version_info->next;
- }
+ /* The default node is always the beginning of the chain. */
+ default_version_info = node_v;
+ while (default_version_info->prev != NULL)
+ default_version_info = default_version_info->prev;
+ default_node = default_version_info->this_node;
/* If there is no default node, just return NULL. */
- if (default_version_info == NULL)
+ if (!is_function_default_version (default_node->decl))
return NULL;
- /* Make default info the first node. */
- if (first_v != default_version_info)
- {
- default_version_info->prev->next = default_version_info->next;
- if (default_version_info->next)
- default_version_info->next->prev = default_version_info->prev;
- first_v->prev = default_version_info;
- default_version_info->next = first_v;
- default_version_info->prev = NULL;
- }
-
- default_node = default_version_info->this_node;
-
#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)
if (targetm.has_ifunc_p ())
{
diff --git a/gcc/config/i386/x86-tune-sched.cc b/gcc/config/i386/x86-tune-sched.cc
index 15d3d91..61b1a26 100644
--- a/gcc/config/i386/x86-tune-sched.cc
+++ b/gcc/config/i386/x86-tune-sched.cc
@@ -80,6 +80,7 @@ ix86_issue_rate (void)
case PROCESSOR_ALDERLAKE:
case PROCESSOR_YONGFENG:
case PROCESSOR_SHIJIDADAO:
+ case PROCESSOR_SIERRAFOREST:
case PROCESSOR_GENERIC:
/* For znver5 decoder can handle 4 or 8 instructions per cycle,
op cache 12 instruction/cycle, dispatch 8 instructions
@@ -99,6 +100,14 @@ ix86_issue_rate (void)
return 5;
case PROCESSOR_SAPPHIRERAPIDS:
+ case PROCESSOR_GRANITERAPIDS:
+ case PROCESSOR_GRANITERAPIDS_D:
+ case PROCESSOR_DIAMONDRAPIDS:
+ case PROCESSOR_GRANDRIDGE:
+ case PROCESSOR_CLEARWATERFOREST:
+ case PROCESSOR_ARROWLAKE:
+ case PROCESSOR_ARROWLAKE_S:
+ case PROCESSOR_PANTHERLAKE:
return 6;
default:
diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc
index cd5f2c5..c4fc145 100644
--- a/gcc/config/mcore/mcore.cc
+++ b/gcc/config/mcore/mcore.cc
@@ -2984,9 +2984,7 @@ mcore_mark_dllimport (tree decl)
/* ??? At least I think that's why we do this. */
idp = get_identifier (newname);
- newrtl = gen_rtx_MEM (Pmode,
- gen_rtx_SYMBOL_REF (Pmode,
- IDENTIFIER_POINTER (idp)));
+ newrtl = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp));
XEXP (DECL_RTL (decl), 0) = newrtl;
}
diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc
index 62e2168..f1c92c6 100644
--- a/gcc/config/or1k/or1k.cc
+++ b/gcc/config/or1k/or1k.cc
@@ -1408,8 +1408,9 @@ static bool
or1k_can_change_mode_class (machine_mode from, machine_mode to,
reg_class_t rclass)
{
+ /* Allow cnoverting special flags to SI mode subregs. */
if (rclass == FLAG_REGS)
- return from == to;
+ return from == to || (from == BImode && to == SImode);
return true;
}
diff --git a/gcc/config/riscv/autovec-opt.md b/gcc/config/riscv/autovec-opt.md
index 4465eb2..e829313 100644
--- a/gcc/config/riscv/autovec-opt.md
+++ b/gcc/config/riscv/autovec-opt.md
@@ -1719,9 +1719,11 @@
;; Include
;; - vfmadd.vf
;; - vfmsub.vf
+;; - vfnmadd.vf
+;; - vfnmsub.vf
;; =============================================================================
-
+;; vfmadd.vf, vfmsub.vf
(define_insn_and_split "*<optab>_vf_<mode>"
[(set (match_operand:V_VLSF 0 "register_operand" "=vd")
(plus_minus:V_VLSF
@@ -1744,9 +1746,10 @@
[(set_attr "type" "vfmuladd")]
)
-(define_insn_and_split "*<optab>_vf_<mode>"
+;; vfnmsub.vf
+(define_insn_and_split "*vfnmsub_<mode>"
[(set (match_operand:V_VLSF 0 "register_operand" "=vd")
- (plus_minus:V_VLSF
+ (minus:V_VLSF
(match_operand:V_VLSF 3 "register_operand" " vr")
(mult:V_VLSF
(vec_duplicate:V_VLSF
@@ -1759,7 +1762,31 @@
{
rtx ops[] = {operands[0], operands[1], operands[2], operands[3],
operands[2]};
- riscv_vector::emit_vlmax_insn (code_for_pred_mul_scalar (<CODE>, <MODE>mode),
+ riscv_vector::emit_vlmax_insn (code_for_pred_mul_neg_scalar (PLUS, <MODE>mode),
+ riscv_vector::TERNARY_OP_FRM_DYN, ops);
+ DONE;
+ }
+ [(set_attr "type" "vfmuladd")]
+)
+
+;; vfnmadd.vf
+(define_insn_and_split "*vfnmadd_<mode>"
+ [(set (match_operand:V_VLSF 0 "register_operand" "=vd")
+ (minus:V_VLSF
+ (mult:V_VLSF
+ (neg:V_VLSF
+ (match_operand:V_VLSF 2 "register_operand" " 0"))
+ (vec_duplicate:V_VLSF
+ (match_operand:<VEL> 1 "register_operand" " f")))
+ (match_operand:V_VLSF 3 "register_operand" " vr")))]
+ "TARGET_VECTOR && can_create_pseudo_p ()"
+ "#"
+ "&& 1"
+ [(const_int 0)]
+ {
+ rtx ops[] = {operands[0], operands[1], operands[2], operands[3],
+ operands[2]};
+ riscv_vector::emit_vlmax_insn (code_for_pred_mul_neg_scalar (MINUS, <MODE>mode),
riscv_vector::TERNARY_OP_FRM_DYN, ops);
DONE;
}
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index 420baa5..ef69991 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -5537,6 +5537,7 @@ expand_vx_binary_vec_dup_vec (rtx op_0, rtx op_1, rtx op_2,
case IOR:
case XOR:
case MULT:
+ case SMAX:
icode = code_for_pred_scalar (code, mode);
break;
case MINUS:
@@ -5571,6 +5572,7 @@ expand_vx_binary_vec_vec_dup (rtx op_0, rtx op_1, rtx op_2,
case UDIV:
case MOD:
case UMOD:
+ case SMAX:
icode = code_for_pred_scalar (code, mode);
break;
default:
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index d5ab128..f6608bd 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -302,6 +302,7 @@ struct riscv_tune_param
bool vector_unaligned_access;
bool use_divmod_expansion;
bool overlap_op_by_pieces;
+ bool speculative_sched_vsetvl;
unsigned int fusible_ops;
const struct cpu_vector_cost *vec_costs;
const char *function_align;
@@ -464,6 +465,7 @@ static const struct riscv_tune_param rocket_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -486,6 +488,7 @@ static const struct riscv_tune_param sifive_7_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -508,6 +511,7 @@ static const struct riscv_tune_param sifive_p400_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_LUI_ADDI | RISCV_FUSE_AUIPC_ADDI, /* fusible_ops */
&generic_vector_cost, /* vector cost */
NULL, /* function_align */
@@ -530,6 +534,7 @@ static const struct riscv_tune_param sifive_p600_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_LUI_ADDI | RISCV_FUSE_AUIPC_ADDI, /* fusible_ops */
&generic_vector_cost, /* vector cost */
NULL, /* function_align */
@@ -552,6 +557,7 @@ static const struct riscv_tune_param thead_c906_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -574,6 +580,7 @@ static const struct riscv_tune_param xiangshan_nanhu_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_ZEXTW | RISCV_FUSE_ZEXTH, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -596,6 +603,7 @@ static const struct riscv_tune_param generic_ooo_tune_info = {
true, /* vector_unaligned_access */
false, /* use_divmod_expansion */
true, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
&generic_vector_cost, /* vector cost */
NULL, /* function_align */
@@ -618,6 +626,7 @@ static const struct riscv_tune_param tt_ascalon_d8_tune_info = {
true, /* vector_unaligned_access */
true, /* use_divmod_expansion */
true, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
&generic_vector_cost, /* vector cost */
NULL, /* function_align */
@@ -640,6 +649,7 @@ static const struct riscv_tune_param optimize_size_tune_info = {
false, /* vector_unaligned_access */
false, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -662,6 +672,7 @@ static const struct riscv_tune_param mips_p8700_tune_info = {
false, /* vector_unaligned_access */
true, /* use_divmod_expansion */
false, /* overlap_op_by_pieces */
+ false, /* speculative_sched_vsetvl */
RISCV_FUSE_NOTHING, /* fusible_ops */
NULL, /* vector cost */
NULL, /* function_align */
@@ -3911,6 +3922,8 @@ get_vector_binary_rtx_cost (rtx x, int scalar2vr_cost)
if (GET_CODE (op_0) == VEC_DUPLICATE
|| GET_CODE (op_1) == VEC_DUPLICATE)
return (scalar2vr_cost + 1) * COSTS_N_INSNS (1);
+ else if (GET_CODE (op_0) == NEG && GET_CODE (op_1) == VEC_DUPLICATE)
+ return (scalar2vr_cost + 1) * COSTS_N_INSNS (1);
else
return COSTS_N_INSNS (1);
}
@@ -3965,6 +3978,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case IOR:
case XOR:
case MULT:
+ case SMAX:
{
rtx op;
rtx op_0 = XEXP (x, 0);
@@ -10439,6 +10453,27 @@ riscv_sched_adjust_cost (rtx_insn *, int, rtx_insn *insn, int cost,
return new_cost;
}
+/* Implement TARGET_SCHED_CAN_SPECULATE_INSN hook. Return true if insn can
+ can be scheduled for speculative execution. Reject vsetvl instructions to
+ prevent the scheduler from hoisting them out of basic blocks without
+ checking for data dependencies PR117974. */
+static bool
+riscv_sched_can_speculate_insn (rtx_insn *insn)
+{
+ /* Gate speculative scheduling of vsetvl instructions behind tune param. */
+ if (tune_param->speculative_sched_vsetvl)
+ return true;
+
+ switch (get_attr_type (insn))
+ {
+ case TYPE_VSETVL:
+ case TYPE_VSETVL_PRE:
+ return false;
+ default:
+ return true;
+ }
+}
+
/* Auxiliary function to emit RISC-V ELF attribute. */
static void
riscv_emit_attribute ()
@@ -13919,7 +13954,6 @@ riscv_get_function_versions_dispatcher (void *decl)
struct cgraph_node *node = NULL;
struct cgraph_node *default_node = NULL;
struct cgraph_function_version_info *node_v = NULL;
- struct cgraph_function_version_info *first_v = NULL;
tree dispatch_decl = NULL;
@@ -13936,41 +13970,16 @@ riscv_get_function_versions_dispatcher (void *decl)
if (node_v->dispatcher_resolver != NULL)
return node_v->dispatcher_resolver;
- /* Find the default version and make it the first node. */
- first_v = node_v;
- /* Go to the beginning of the chain. */
- while (first_v->prev != NULL)
- first_v = first_v->prev;
- default_version_info = first_v;
-
- while (default_version_info != NULL)
- {
- struct riscv_feature_bits res;
- int priority; /* Unused. */
- parse_features_for_version (default_version_info->this_node->decl,
- res, priority);
- if (res.length == 0)
- break;
- default_version_info = default_version_info->next;
- }
+ /* The default node is always the beginning of the chain. */
+ default_version_info = node_v;
+ while (default_version_info->prev)
+ default_version_info = default_version_info->prev;
+ default_node = default_version_info->this_node;
/* If there is no default node, just return NULL. */
- if (default_version_info == NULL)
+ if (!is_function_default_version (default_node->decl))
return NULL;
- /* Make default info the first node. */
- if (first_v != default_version_info)
- {
- default_version_info->prev->next = default_version_info->next;
- if (default_version_info->next)
- default_version_info->next->prev = default_version_info->prev;
- first_v->prev = default_version_info;
- default_version_info->next = first_v;
- default_version_info->prev = NULL;
- }
-
- default_node = default_version_info->this_node;
-
if (targetm.has_ifunc_p ())
{
struct cgraph_function_version_info *it_v = NULL;
@@ -14743,6 +14752,9 @@ synthesize_and (rtx operands[3])
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST riscv_sched_adjust_cost
+#undef TARGET_SCHED_CAN_SPECULATE_INSN
+#define TARGET_SCHED_CAN_SPECULATE_INSN riscv_sched_can_speculate_insn
+
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL riscv_function_ok_for_sibcall
diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md
index 42fc04c..c9b836c 100644
--- a/gcc/config/riscv/vector-iterators.md
+++ b/gcc/config/riscv/vector-iterators.md
@@ -4042,11 +4042,11 @@
])
(define_code_iterator any_int_binop_no_shift_v_vdup [
- plus minus and ior xor mult div udiv mod umod
+ plus minus and ior xor mult div udiv mod umod smax
])
(define_code_iterator any_int_binop_no_shift_vdup_v [
- plus minus and ior xor mult
+ plus minus and ior xor mult smax
])
(define_code_iterator any_int_unop [neg not])
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 7375c36..7ee26e5 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -25312,7 +25312,6 @@ rs6000_get_function_versions_dispatcher (void *decl)
struct cgraph_node *node = NULL;
struct cgraph_node *default_node = NULL;
struct cgraph_function_version_info *node_v = NULL;
- struct cgraph_function_version_info *first_v = NULL;
tree dispatch_decl = NULL;
@@ -25332,38 +25331,16 @@ rs6000_get_function_versions_dispatcher (void *decl)
if (node_v->dispatcher_resolver != NULL)
return node_v->dispatcher_resolver;
- /* Find the default version and make it the first node. */
- first_v = node_v;
- /* Go to the beginning of the chain. */
- while (first_v->prev != NULL)
- first_v = first_v->prev;
-
- default_version_info = first_v;
- while (default_version_info != NULL)
- {
- const tree decl2 = default_version_info->this_node->decl;
- if (is_function_default_version (decl2))
- break;
- default_version_info = default_version_info->next;
- }
+ /* The default node is always the beginning of the chain. */
+ default_version_info = node_v;
+ while (default_version_info->prev)
+ default_version_info = default_version_info->prev;
+ default_node = default_version_info->this_node;
/* If there is no default node, just return NULL. */
- if (default_version_info == NULL)
+ if (!is_function_default_version (default_node->decl))
return NULL;
- /* Make default info the first node. */
- if (first_v != default_version_info)
- {
- default_version_info->prev->next = default_version_info->next;
- if (default_version_info->next)
- default_version_info->next->prev = default_version_info->prev;
- first_v->prev = default_version_info;
- default_version_info->next = first_v;
- default_version_info->prev = NULL;
- }
-
- default_node = default_version_info->this_node;
-
#ifndef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB
error_at (DECL_SOURCE_LOCATION (default_node->decl),
"%<target_clones%> attribute needs GLIBC (2.23 and newer) that "
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8ffde5c..842f74d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,18 @@
+2025-06-12 Alfie Richards <alfie.richards@arm.com>
+
+ * decl.cc (maybe_version_functions): Change record_function_versions
+ call to add_function_version.
+
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ * cp-tree.h (union lang_type::maybe_objc_info): New type.
+ (struct lang_type): Use union maybe_objc_info info member
+ instead of tree objc_info.
+ * lex.cc (copy_lang_type): Use sizeof (struct lang_type)
+ just for ObjC++ and otherwise offsetof (struct lang_type, info).
+ (maybe_add_lang_type_raw): Likewise.
+ (cxx_make_type): Formatting fix.
+
2025-06-09 Iain Sandoe <iain@sandoe.co.uk>
PR c++/120495
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3cf4a76..d663d6e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2514,12 +2514,16 @@ struct GTY(()) lang_type {
tree key_method;
tree decl_list;
tree befriending_classes;
- /* In a RECORD_TYPE, information specific to Objective-C++, such
- as a list of adopted protocols or a pointer to a corresponding
- @interface. See objc/objc-act.h for details. */
- tree objc_info;
/* FIXME reuse another field? */
tree lambda_expr;
+ union maybe_objc_info {
+ /* If not c_dialect_objc, this part is not even allocated. */
+ char GTY((tag ("0"))) non_objc;
+ /* In a RECORD_TYPE, information specific to Objective-C, such
+ as a list of adopted protocols or a pointer to a corresponding
+ @interface. See objc/objc-act.h for details. */
+ tree GTY((tag ("1"))) objc_info;
+ } GTY ((desc ("c_dialect_objc ()"))) info;
};
/* We used to have a variant type for lang_type. Keep the name of the
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 9a20ed6..4c8a205 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -1311,7 +1311,15 @@ maybe_version_functions (tree newdecl, tree olddecl, bool record)
}
if (record)
- cgraph_node::record_function_versions (olddecl, newdecl);
+ {
+ /* Add the new version to the function version structure. */
+ cgraph_node *fn_node = cgraph_node::get_create (olddecl);
+ cgraph_function_version_info *fn_v = fn_node->function_version ();
+ if (!fn_v)
+ fn_v = fn_node->insert_new_function_version ();
+
+ cgraph_node::add_function_version (fn_v, newdecl);
+ }
return true;
}
diff --git a/gcc/cp/lex.cc b/gcc/cp/lex.cc
index 12af81e..08a6348 100644
--- a/gcc/cp/lex.cc
+++ b/gcc/cp/lex.cc
@@ -1082,15 +1082,17 @@ copy_lang_type (tree node)
if (! TYPE_LANG_SPECIFIC (node))
return;
- auto *lt = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type));
+ size_t sz = (c_dialect_objc () ? sizeof (struct lang_type)
+ : offsetof (struct lang_type, info));
+ auto *lt = (struct lang_type *) ggc_internal_alloc (sz);
- memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type)));
+ memcpy (lt, TYPE_LANG_SPECIFIC (node), sz);
TYPE_LANG_SPECIFIC (node) = lt;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
+ tree_node_sizes[(int)lang_type] += sz;
}
}
@@ -1114,14 +1116,15 @@ maybe_add_lang_type_raw (tree t)
if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t)))
return false;
- auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc
- (sizeof (struct lang_type)));
+ size_t sz = (c_dialect_objc () ? sizeof (struct lang_type)
+ : offsetof (struct lang_type, info));
+ auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc (sz));
TYPE_LANG_SPECIFIC (t) = lt;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
+ tree_node_sizes[(int)lang_type] += sz;
}
return true;
@@ -1135,8 +1138,8 @@ cxx_make_type (enum tree_code code MEM_STAT_DECL)
if (maybe_add_lang_type_raw (t))
{
/* Set up some flags that give proper default behavior. */
- struct c_fileinfo *finfo =
- get_fileinfo (LOCATION_FILE (input_location));
+ struct c_fileinfo *finfo
+ = get_fileinfo (LOCATION_FILE (input_location));
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}
diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index ddf6ba0..45d0881 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-format-text.h"
#include "diagnostic-output-file.h"
#include "diagnostic-buffer.h"
+#include "diagnostic-path.h"
+#include "diagnostic-client-data-hooks.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "pretty-print-format-impl.h"
@@ -40,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "xml.h"
#include "xml-printer.h"
#include "json.h"
+#include "selftest-xml.h"
// struct html_generation_options
@@ -139,26 +142,45 @@ public:
}
private:
+ void
+ add_stylesheet (std::string url);
+
std::unique_ptr<xml::element>
make_element_for_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind);
+ diagnostic_t orig_diag_kind,
+ bool alert);
std::unique_ptr<xml::element>
make_metadata_element (label_text label,
label_text url);
+ void
+ add_at_nesting_level (size_t nesting_level,
+ std::unique_ptr<xml::element> child_diag_element);
+
+ void
+ push_nesting_level ();
+
+ void
+ pop_nesting_level ();
+
diagnostic_context &m_context;
pretty_printer *m_printer;
const line_maps *m_line_maps;
html_generation_options m_html_gen_opts;
+ const logical_location_manager *m_logical_loc_mgr;
std::unique_ptr<xml::document> m_document;
xml::element *m_head_element;
xml::element *m_title_element;
xml::element *m_diagnostics_element;
std::unique_ptr<xml::element> m_cur_diagnostic_element;
+ std::vector<xml::element *> m_cur_nesting_levels;
int m_next_diag_id; // for handing out unique IDs
json::array m_ui_focus_ids;
+ logical_location m_last_logical_location;
+ location_t m_last_location;
+ expanded_location m_last_expanded_location;
};
static std::unique_ptr<xml::element>
@@ -237,8 +259,10 @@ static const char * const HTML_STYLE
" .ruler { color: red;\n"
" white-space: pre; }\n"
" .source { color: blue;\n"
+ " background-color: white;\n"
" white-space: pre; }\n"
" .annotation { color: green;\n"
+ " background-color: white;\n"
" white-space: pre; }\n"
" .linenum-gap { text-align: center;\n"
" border-top: 1px solid black;\n"
@@ -269,6 +293,8 @@ static const char * const HTML_STYLE
" font-weight: bold; }\n"
" .highlight-b { color: #3f9c35;\n" // pf-green-400
" font-weight: bold; }\n"
+ " .gcc-quoted-text { font-weight: bold;\n"
+ " font-family: mono; }\n"
" </style>\n");
/* A little JavaScript for ease of navigation.
@@ -351,13 +377,19 @@ html_builder::html_builder (diagnostic_context &context,
m_printer (&pp),
m_line_maps (line_maps),
m_html_gen_opts (html_gen_opts),
+ m_logical_loc_mgr (nullptr),
m_head_element (nullptr),
m_title_element (nullptr),
m_diagnostics_element (nullptr),
- m_next_diag_id (0)
+ m_next_diag_id (0),
+ m_last_location (UNKNOWN_LOCATION),
+ m_last_expanded_location ({})
{
gcc_assert (m_line_maps);
+ if (auto client_data_hooks = context.get_client_data_hooks ())
+ m_logical_loc_mgr = client_data_hooks->get_logical_location_manager ();
+
m_document = std::make_unique<xml::document> ();
m_document->m_doctypedecl = std::make_unique<html_doctypedecl> ();
{
@@ -374,15 +406,20 @@ html_builder::html_builder (diagnostic_context &context,
xml::auto_print_element title (xp, "title", true);
m_title_element = xp.get_insertion_point ();
}
+
if (m_html_gen_opts.m_css)
- xp.add_raw (HTML_STYLE);
+ {
+ add_stylesheet ("https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.24.0/css/patternfly.min.css");
+ add_stylesheet ("https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.24.0/css/patternfly-additions.min.css");
+ xp.add_raw (HTML_STYLE);
+ }
if (m_html_gen_opts.m_javascript)
{
xp.push_tag ("script");
/* Escaping rules are different for HTML <script> elements,
so add the script "raw" for now. */
xp.add_raw (HTML_SCRIPT);
- xp.pop_tag (); // script
+ xp.pop_tag ("script");
}
}
@@ -408,6 +445,18 @@ html_builder::set_main_input_filename (const char *name)
}
}
+void
+html_builder::add_stylesheet (std::string url)
+{
+ gcc_assert (m_head_element);
+
+ xml::printer xp (*m_head_element);
+ xp.push_tag ("link", false);
+ xp.set_attr ("rel", "stylesheet");
+ xp.set_attr ("type", "text/css");
+ xp.set_attr ("href", std::move (url));
+}
+
/* Implementation of "on_report_diagnostic" for HTML output. */
void
@@ -425,8 +474,14 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic,
fnotice (stderr, "Internal compiler error:\n");
}
+ const int nesting_level = m_context.get_diagnostic_nesting_level ();
+ bool alert = true;
+ if (m_cur_diagnostic_element && nesting_level > 0)
+ alert = false;
+ if (!m_cur_diagnostic_element)
+ m_last_logical_location = logical_location ();
auto diag_element
- = make_element_for_diagnostic (diagnostic, orig_diag_kind);
+ = make_element_for_diagnostic (diagnostic, orig_diag_kind, alert);
if (buffer)
{
gcc_assert (!m_cur_diagnostic_element);
@@ -435,14 +490,79 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic,
else
{
if (m_cur_diagnostic_element)
- /* Nested diagnostic. */
- m_cur_diagnostic_element->add_child (std::move (diag_element));
+ {
+ /* Nested diagnostic. */
+ gcc_assert (nesting_level >= 0);
+ add_at_nesting_level (nesting_level, std::move (diag_element));
+ }
else
/* Top-level diagnostic. */
- m_cur_diagnostic_element = std::move (diag_element);
+ {
+ m_cur_diagnostic_element = std::move (diag_element);
+ m_cur_nesting_levels.clear ();
+ }
}
}
+// For ease of comparison with experimental-nesting-show-levels=yes
+
+static void
+add_nesting_level_attr (xml::element &element,
+ int nesting_level)
+{
+ element.set_attr ("nesting-level", std::to_string (nesting_level));
+}
+
+void
+html_builder::
+add_at_nesting_level (size_t nesting_level,
+ std::unique_ptr<xml::element> child_diag_element)
+{
+ gcc_assert (m_cur_diagnostic_element);
+ while (nesting_level > m_cur_nesting_levels.size ())
+ push_nesting_level ();
+ while (nesting_level < m_cur_nesting_levels.size ())
+ pop_nesting_level ();
+
+ if (nesting_level > 0)
+ {
+ gcc_assert (!m_cur_nesting_levels.empty ());
+ auto current_nesting_level = m_cur_nesting_levels.back ();
+ xml::printer xp (*current_nesting_level);
+ xp.push_tag ("li");
+ add_nesting_level_attr (*xp.get_insertion_point (),
+ m_cur_nesting_levels.size ());
+ xp.append (std::move (child_diag_element));
+ xp.pop_tag ("li");
+ }
+ else
+ m_cur_diagnostic_element->add_child (std::move (child_diag_element));
+}
+
+void
+html_builder::push_nesting_level ()
+{
+ gcc_assert (m_cur_diagnostic_element);
+ auto new_nesting_level = std::make_unique<xml::element> ("ul", false);
+ add_nesting_level_attr (*new_nesting_level,
+ m_cur_nesting_levels.size () + 1);
+ xml::element *current_nesting_level = nullptr;
+ if (!m_cur_nesting_levels.empty ())
+ current_nesting_level = m_cur_nesting_levels.back ();
+ m_cur_nesting_levels.push_back (new_nesting_level.get ());
+ if (current_nesting_level)
+ current_nesting_level->add_child (std::move (new_nesting_level));
+ else
+ m_cur_diagnostic_element->add_child (std::move (new_nesting_level));
+}
+
+void
+html_builder::pop_nesting_level ()
+{
+ gcc_assert (m_cur_diagnostic_element);
+ m_cur_nesting_levels.pop_back ();
+}
+
/* Custom subclass of html_label_writer.
Wrap labels within a <span> element, supplying them with event IDs.
Add the IDs to the list of focus IDs. */
@@ -472,7 +592,7 @@ public:
void end_label () final override
{
- m_xp.pop_tag (); // span
+ m_xp.pop_tag ("span"); // from begin_label
}
private:
@@ -482,81 +602,225 @@ private:
int m_next_event_idx;
};
-std::unique_ptr<xml::element>
-html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
- diagnostic_t orig_diag_kind)
+/* See https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts */
+static const char *
+get_pf_class_for_alert_div (diagnostic_t diag_kind)
{
- class html_token_printer : public token_printer
- {
- public:
- html_token_printer (xml::printer &xp)
- : m_xp (xp)
+ switch (diag_kind)
{
+ case DK_DEBUG:
+ case DK_NOTE:
+ return "alert alert-info";
+
+ case DK_ANACHRONISM:
+ case DK_WARNING:
+ return "alert alert-warning";
+
+ case DK_ERROR:
+ case DK_SORRY:
+ case DK_ICE:
+ case DK_ICE_NOBT:
+ case DK_FATAL:
+ return "alert alert-danger";
+
+ default:
+ gcc_unreachable ();
}
- void print_tokens (pretty_printer */*pp*/,
- const pp_token_list &tokens) final override
+}
+
+static const char *
+get_pf_class_for_alert_icon (diagnostic_t diag_kind)
+{
+ switch (diag_kind)
{
- /* Implement print_tokens by adding child elements to
- m_parent_element. */
- for (auto iter = tokens.m_first; iter; iter = iter->m_next)
- switch (iter->m_kind)
+ case DK_DEBUG:
+ case DK_NOTE:
+ return "pficon pficon-info";
+
+ case DK_ANACHRONISM:
+ case DK_WARNING:
+ return "pficon pficon-warning-triangle-o";
+
+ case DK_ERROR:
+ case DK_SORRY:
+ case DK_ICE:
+ case DK_ICE_NOBT:
+ case DK_FATAL:
+ return "pficon pficon-error-circle-o";
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+static const char *
+get_label_for_logical_location_kind (enum logical_location_kind kind)
+{
+ switch (kind)
+ {
+ default:
+ gcc_unreachable ();
+ case logical_location_kind::unknown:
+ return nullptr;
+
+ /* Kinds within executable code. */
+ case logical_location_kind::function:
+ return "Function";
+ case logical_location_kind::member:
+ return "Member";
+ case logical_location_kind::module_:
+ return "Module";
+ case logical_location_kind::namespace_:
+ return "Namespace";
+ case logical_location_kind::type:
+ return "Type";
+ case logical_location_kind::return_type:
+ return "Return type";
+ case logical_location_kind::parameter:
+ return "Parameter";
+ case logical_location_kind::variable:
+ return "Variable";
+
+ /* Kinds within XML or HTML documents. */
+ case logical_location_kind::element:
+ return "Element";
+ case logical_location_kind::attribute:
+ return "Attribute";
+ case logical_location_kind::text:
+ return "Text";
+ case logical_location_kind::comment:
+ return "Comment";
+ case logical_location_kind::processing_instruction:
+ return "Processing Instruction";
+ case logical_location_kind::dtd:
+ return "DTD";
+ case logical_location_kind::declaration:
+ return "Declaration";
+
+ /* Kinds within JSON documents. */
+ case logical_location_kind::object:
+ return "Object";
+ case logical_location_kind::array:
+ return "Array";
+ case logical_location_kind::property:
+ return "Property";
+ case logical_location_kind::value:
+ return "Value";
+ }
+}
+
+static void
+add_labelled_value (xml::printer &xp,
+ std::string id,
+ std::string label,
+ std::string value,
+ bool quote_value)
+{
+ xp.push_tag ("div", true);
+ xp.set_attr ("id", id);
+ xp.push_tag ("span");
+ xp.add_text (label);
+ xp.add_text (" ");
+ xp.pop_tag ("span");
+ xp.push_tag ("span");
+ if (quote_value)
+ xp.set_attr ("class", "gcc-quoted-text");
+ xp.add_text (std::move (value));
+ xp.pop_tag ("span");
+ xp.pop_tag ("div");
+}
+
+class html_token_printer : public token_printer
+{
+public:
+ html_token_printer (xml::element &parent_element)
+ /* Ideally pp_token_lists that reach a token_printer should be
+ "balanced", but for now they can have mismatching pp_tokens
+ e.g. a begin_color without an end_color (PR other/120610).
+ Give html_token_printer its own xml::printer as a firewall to
+ limit the scope of the mismatches in the HTML. */
+ : m_xp (parent_element,
+ /* Similarly we don't check that the popped tags match. */
+ false)
+ {
+ }
+ void print_tokens (pretty_printer */*pp*/,
+ const pp_token_list &tokens) final override
+ {
+ /* Implement print_tokens by adding child elements to
+ m_parent_element. */
+ for (auto iter = tokens.m_first; iter; iter = iter->m_next)
+ switch (iter->m_kind)
+ {
+ default:
+ gcc_unreachable ();
+
+ case pp_token::kind::text:
{
- default:
- gcc_unreachable ();
-
- case pp_token::kind::text:
- {
- pp_token_text *sub = as_a <pp_token_text *> (iter);
- /* The value might be in the obstack, so we may need to
- copy it. */
- m_xp.add_text (sub->m_value.get ());
+ pp_token_text *sub = as_a <pp_token_text *> (iter);
+ /* The value might be in the obstack, so we may need to
+ copy it. */
+ m_xp.add_text (sub->m_value.get ());
}
- break;
+ break;
- case pp_token::kind::begin_color:
- {
- pp_token_begin_color *sub = as_a <pp_token_begin_color *> (iter);
- gcc_assert (sub->m_value.get ());
- m_xp.push_tag_with_class ("span", sub->m_value.get ());
- }
- break;
+ case pp_token::kind::begin_color:
+ {
+ pp_token_begin_color *sub = as_a <pp_token_begin_color *> (iter);
+ gcc_assert (sub->m_value.get ());
+ m_xp.push_tag_with_class ("span", sub->m_value.get ());
+ }
+ break;
- case pp_token::kind::end_color:
- m_xp.pop_tag ();
- break;
+ case pp_token::kind::end_color:
+ m_xp.pop_tag ("span");
+ break;
- case pp_token::kind::begin_quote:
- {
- m_xp.add_text (open_quote);
- m_xp.push_tag_with_class ("span", "gcc-quoted-text");
- }
- break;
- case pp_token::kind::end_quote:
- {
- m_xp.pop_tag ();
- m_xp.add_text (close_quote);
- }
- break;
+ case pp_token::kind::begin_quote:
+ {
+ m_xp.add_text (open_quote);
+ m_xp.push_tag_with_class ("span", "gcc-quoted-text");
+ }
+ break;
+ case pp_token::kind::end_quote:
+ {
+ m_xp.pop_tag ("span");
+ m_xp.add_text (close_quote);
+ }
+ break;
- case pp_token::kind::begin_url:
- {
- pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter);
- m_xp.push_tag ("a", true);
- m_xp.set_attr ("href", sub->m_value.get ());
- }
- break;
- case pp_token::kind::end_url:
- m_xp.pop_tag ();
- break;
+ case pp_token::kind::begin_url:
+ {
+ pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter);
+ m_xp.push_tag ("a", true);
+ m_xp.set_attr ("href", sub->m_value.get ());
}
- }
+ break;
+ case pp_token::kind::end_url:
+ m_xp.pop_tag ("a");
+ break;
+ }
+ }
- private:
- xml::printer &m_xp;
- };
+private:
+ xml::printer m_xp;
+};
- auto diag_element = make_div ("gcc-diagnostic");
+/* Make a <div class="gcc-diagnostic"> for DIAGNOSTIC.
+ If ALERT is true, make it be a PatternFly alert (see
+ https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts) and
+ show severity text (e.g. "error: ").
+
+ If ALERT is false, don't show the severity text and don't show
+ the filename if it's the same as the previous diagnostic within the
+ diagnostic group. */
+
+std::unique_ptr<xml::element>
+html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
+ diagnostic_t orig_diag_kind,
+ bool alert)
+{
const int diag_idx = m_next_diag_id++;
std::string diag_id;
{
@@ -564,30 +828,75 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
pp_printf (&pp, "gcc-diag-%i", diag_idx);
diag_id = pp_formatted_text (&pp);
}
- diag_element->set_attr ("id", diag_id);
// TODO: might be nice to emulate the text output format, but colorize it
- auto message_span = make_span ("gcc-message");
- std::string message_span_id (diag_id + "-message");
- message_span->set_attr ("id", message_span_id);
- add_focus_id (message_span_id);
+ /* See https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts
+ which has this example:
+<div class="alert alert-danger">
+ <span class="pficon pficon-error-circle-o"></span>
+ <strong>Hey there is a problem!</strong> Yeah this is really messed up and you should <a href="#" class="alert-link">know about it</a>.
+</div>
+ */
+ auto diag_element = make_div ("gcc-diagnostic");
+ diag_element->set_attr ("id", diag_id);
+ if (alert)
+ diag_element->set_attr ("class",
+ get_pf_class_for_alert_div (diagnostic.kind));
+
+ xml::printer xp (*diag_element.get ());
+ const size_t depth_within_alert_div = 1;
+
+ gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
+
+ if (alert)
+ {
+ xp.push_tag_with_class ("span",
+ get_pf_class_for_alert_icon (diagnostic.kind),
+ true);
+ xp.add_text (" ");
+ xp.pop_tag ("span");
+ }
+
+ // The rest goes in the <div>...
+ gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
+
+ xp.push_tag_with_class ("div", "gcc-message", true);
+ std::string message_alert_id (diag_id + "-message");
+ xp.set_attr ("id", message_alert_id);
+ add_focus_id (message_alert_id);
+
+ const size_t depth_within_message_div = depth_within_alert_div + 1;
+ gcc_assert (xp.get_num_open_tags () == depth_within_message_div);
- xml::printer xp (*message_span.get ());
- html_token_printer tok_printer (xp);
+ // Severity e.g. "warning: "
+ bool show_severity = true;
+ if (!alert)
+ show_severity = false;
+ if (show_severity)
+ {
+ xp.push_tag ("strong");
+ xp.add_text (_(get_diagnostic_kind_text (diagnostic.kind)));
+ xp.pop_tag ("strong");
+ xp.add_text (" ");
+ }
+
+ // Add the message itself:
+ html_token_printer tok_printer (*xp.get_insertion_point ());
m_printer->set_token_printer (&tok_printer);
pp_output_formatted_text (m_printer, m_context.get_urlifier ());
m_printer->set_token_printer (nullptr);
pp_clear_output_area (m_printer);
- diag_element->add_child (std::move (message_span));
+ // Add any metadata as a suffix to the message
if (diagnostic.metadata)
{
- diag_element->add_text (" ");
- diag_element->add_child
- (make_element_for_metadata (*diagnostic.metadata));
+ xp.add_text (" ");
+ xp.append (make_element_for_metadata (*diagnostic.metadata));
}
+ // Add any option as a suffix to the message
+
label_text option_text = label_text::take
(m_context.make_option_name (diagnostic.option_id,
orig_diag_kind, diagnostic.kind));
@@ -596,7 +905,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
label_text option_url = label_text::take
(m_context.make_option_url (diagnostic.option_id));
- diag_element->add_text (" ");
+ xp.add_text (" ");
auto option_span = make_span ("gcc-option");
option_span->add_text ("[");
{
@@ -611,35 +920,110 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,
option_span->add_text (option_text.get ());
option_span->add_text ("]");
}
- diag_element->add_child (std::move (option_span));
+ xp.append (std::move (option_span));
+ }
+
+ gcc_assert (xp.get_num_open_tags () == depth_within_message_div);
+
+ xp.pop_tag ("div");
+
+ gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
+
+ /* Show any logical location. */
+ if (m_logical_loc_mgr)
+ if (auto client_data_hooks = m_context.get_client_data_hooks ())
+ if (auto logical_loc = client_data_hooks->get_current_logical_location ())
+ if (logical_loc != m_last_logical_location)
+ {
+ enum logical_location_kind kind
+ = m_logical_loc_mgr->get_kind (logical_loc);;
+ if (const char *label = get_label_for_logical_location_kind (kind))
+ if (const char *name_with_scope
+ = m_logical_loc_mgr->get_name_with_scope (logical_loc))
+ add_labelled_value (xp, "logical-location",
+ label, name_with_scope, true);
+ m_last_logical_location = logical_loc;
+ }
+
+ /* Show any physical location. */
+ const expanded_location s
+ = diagnostic_expand_location (&diagnostic);
+ if (s != m_last_expanded_location
+ || alert)
+ {
+ if (s.file
+ && (s.file != m_last_expanded_location.file
+ || alert))
+ add_labelled_value (xp, "file", "File", s.file, false);
+ if (s.line)
+ {
+ add_labelled_value (xp, "line", "Line", std::to_string (s.line), false);
+ diagnostic_column_policy column_policy (m_context);
+ int converted_column = column_policy.converted_column (s);
+ if (converted_column >= 0)
+ add_labelled_value (xp, "column", "Column",
+ std::to_string (converted_column),
+ false);
+ }
+ if (s.file)
+ m_last_expanded_location = s;
}
/* Source (and fix-it hints). */
{
- xml::printer xp (*diag_element);
- m_context.m_last_location = UNKNOWN_LOCATION;
+ // TODO: m_context.m_last_location should be moved into the sink
+ location_t saved = m_context.m_last_location;
+ m_context.m_last_location = m_last_location;
m_context.maybe_show_locus_as_html (*diagnostic.richloc,
m_context.m_source_printing,
diagnostic.kind,
xp,
nullptr,
nullptr);
+ m_context.m_last_location = saved;
+ m_last_location = m_context.m_last_location;
}
+ gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
+
/* Execution path. */
if (auto path = diagnostic.richloc->get_path ())
{
- xml::printer xp (*diag_element);
+ xp.push_tag ("div");
+ xp.set_attr ("id", "execution-path");
+
+ xp.push_tag ("label", true);
+ const int num_events = path->num_events ();
+ pretty_printer pp;
+ pp_printf_n (&pp, num_events,
+ "Execution path with %i event",
+ "Execution path with %i events",
+ num_events);
+ xp.add_text_from_pp (pp);
+ xp.pop_tag ("label");
+
std::string event_id_prefix (diag_id + "-event-");
html_path_label_writer event_label_writer (xp, *this,
event_id_prefix);
diagnostic_source_print_policy dspp (m_context);
print_path_as_html (xp, *path, m_context, &event_label_writer,
dspp);
+
+ xp.pop_tag ("div");
}
+ gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
+
if (auto patch_element = make_element_for_patch (diagnostic))
- diag_element->add_child (std::move (patch_element));
+ {
+ xp.push_tag ("div");
+ xp.set_attr ("id", "suggested-fix");
+ xp.push_tag ("label", true);
+ xp.add_text ("Suggested fix");
+ xp.pop_tag ("label");
+ xp.append (std::move (patch_element));
+ xp.pop_tag ("div");
+ }
return diag_element;
}
@@ -680,7 +1064,7 @@ html_builder::make_metadata_element (label_text label,
}
xp.add_text (label.get ());
if (url.get ())
- xp.pop_tag ();
+ xp.pop_tag ("a");
}
xp.add_text ("]");
return item;
@@ -755,7 +1139,7 @@ html_builder::flush_to_file (FILE *outf)
m_ui_focus_ids.print (&pp, true);
pp_string (&pp, ";\n");
xp.add_raw (pp_formatted_text (&pp));
- xp.pop_tag (); // script
+ xp.pop_tag ("script");
}
auto top = m_document.get ();
top->dump (outf);
@@ -946,6 +1330,53 @@ make_html_sink (diagnostic_context &context,
namespace selftest {
+/* Helper for writing tests of html_token_printer.
+ Printing to m_pp will appear as HTML within m_top_element, a <div>. */
+
+struct token_printer_test
+{
+ token_printer_test ()
+ : m_top_element ("div", true),
+ m_tok_printer (m_top_element)
+ {
+ m_pp.set_token_printer (&m_tok_printer);
+ }
+
+ xml::element m_top_element;
+ html_token_printer m_tok_printer;
+ pretty_printer m_pp;
+};
+
+static void
+test_token_printer ()
+{
+ {
+ token_printer_test t;
+ pp_printf (&t.m_pp, "hello world");
+ ASSERT_XML_PRINT_EQ
+ (t.m_top_element,
+ "<div>hello world</div>\n");
+ }
+
+ {
+ token_printer_test t;
+ pp_printf (&t.m_pp, "%qs: %qs", "foo", "bar");
+ ASSERT_XML_PRINT_EQ
+ (t.m_top_element,
+ "<div>"
+ "`"
+ "<span class=\"gcc-quoted-text\">"
+ "foo"
+ "</span>"
+ "&apos;: `"
+ "<span class=\"gcc-quoted-text\">"
+ "bar"
+ "</span>"
+ "&apos;"
+ "</div>\n");
+ }
+}
+
/* A subclass of html_output_format for writing selftests.
The XML output is cached internally, rather than written
out to a file. */
@@ -1011,10 +1442,8 @@ test_simple_log ()
const xml::document &doc = dc.get_document ();
- pretty_printer pp;
- doc.write_as_xml (&pp, 0, true);
- ASSERT_STREQ
- (pp_formatted_text (&pp),
+ ASSERT_XML_PRINT_EQ
+ (doc,
("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE html\n"
" PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
@@ -1025,8 +1454,9 @@ test_simple_log ()
" </head>\n"
" <body>\n"
" <div class=\"gcc-diagnostic-list\">\n"
- " <div class=\"gcc-diagnostic\" id=\"gcc-diag-0\">\n"
- " <span class=\"gcc-message\" id=\"gcc-diag-0-message\">this is a test: `<span class=\"gcc-quoted-text\">foo</span>&apos;</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>&apos;</div>\n"
" </div>\n"
" </div>\n"
" </body>\n"
@@ -1043,10 +1473,8 @@ test_metadata ()
diagnostic_metadata metadata;
metadata.add_cwe (415);
auto element = b.make_element_for_metadata (metadata);
- pretty_printer pp;
- element->write_as_xml (&pp, 0, true);
- ASSERT_STREQ
- (pp_formatted_text (&pp),
+ ASSERT_XML_PRINT_EQ
+ (*element,
"<span class=\"gcc-metadata\">"
"<span class=\"gcc-metadata-item\">"
"["
@@ -1064,10 +1492,8 @@ test_metadata ()
"http://example.com");
metadata.add_rule (rule);
auto element = b.make_element_for_metadata (metadata);
- pretty_printer pp;
- element->write_as_xml (&pp, 0, true);
- ASSERT_STREQ
- (pp_formatted_text (&pp),
+ ASSERT_XML_PRINT_EQ
+ (*element,
"<span class=\"gcc-metadata\">"
"<span class=\"gcc-metadata-item\">"
"["
@@ -1086,6 +1512,7 @@ void
diagnostic_format_html_cc_tests ()
{
auto_fix_quotes fix_quotes;
+ test_token_printer ();
test_simple_log ();
test_metadata ();
}
diff --git a/gcc/diagnostic-path-output.cc b/gcc/diagnostic-path-output.cc
index 4c17865..bae24bf 100644
--- a/gcc/diagnostic-path-output.cc
+++ b/gcc/diagnostic-path-output.cc
@@ -321,7 +321,7 @@ begin_html_stack_frame (xml::printer &xp,
{
xp.push_tag_with_class ("td", "interprocmargin", false);
xp.set_attr ("style", "padding-left: 100px");
- xp.pop_tag ();
+ xp.pop_tag ("td");
}
xp.push_tag_with_class ("td", "stack-frame", false);
label_text funcname
@@ -331,8 +331,8 @@ begin_html_stack_frame (xml::printer &xp,
xp.push_tag_with_class ("div", "frame-funcname", false);
xp.push_tag ("span", true);
xp.add_text (funcname.get ());
- xp.pop_tag (); // span
- xp.pop_tag (); // div
+ xp.pop_tag ("span");
+ xp.pop_tag ("div");
}
}
return std::make_unique<stack_frame> (std::move (parent),
@@ -350,9 +350,9 @@ end_html_stack_frame (xml::printer &xp,
auto parent = std::move (frame->m_parent);
if (frame->m_logical_loc)
{
- xp.pop_tag (); // td
- xp.pop_tag (); // tr
- xp.pop_tag (); // table
+ xp.pop_tag ("td");
+ xp.pop_tag ("tr");
+ xp.pop_tag ("table");
}
return parent;
}
@@ -689,7 +689,7 @@ struct event_range
iter_event.print_desc (pp);
if (event_label_writer)
event_label_writer->begin_label ();
- xp.add_text (pp_formatted_text (&pp));
+ xp.add_text_from_pp (pp);
if (event_label_writer)
event_label_writer->end_label ();
}
@@ -1230,7 +1230,7 @@ print_path_summary_as_html (const path_summary &ps,
{
xp.push_tag_with_class ("span", "funcname", true);
xp.add_text (funcname.get ());
- xp.pop_tag (); //span
+ xp.pop_tag ("span");
xp.add_text (": ");
}
}
@@ -1243,8 +1243,8 @@ print_path_summary_as_html (const path_summary &ps,
else
pp_printf (&pp, "events %i-%i",
range->m_start_idx + 1, range->m_end_idx + 1);
- xp.add_text (pp_formatted_text (&pp));
- xp.pop_tag (); // span
+ xp.add_text_from_pp (pp);
+ xp.pop_tag ("span");
}
if (show_depths)
{
@@ -1252,10 +1252,10 @@ print_path_summary_as_html (const path_summary &ps,
xp.push_tag_with_class ("span", "depth", true);
pretty_printer pp;
pp_printf (&pp, "(depth %i)", range->m_stack_depth);
- xp.add_text (pp_formatted_text (&pp));
- xp.pop_tag (); //span
+ xp.add_text_from_pp (pp);
+ xp.pop_tag ("span");
}
- xp.pop_tag (); // div
+ xp.pop_tag ("div");
/* Print a run of events. */
thread_event_printer &tep = thread_event_printers[swimlane_idx];
@@ -1267,16 +1267,16 @@ print_path_summary_as_html (const path_summary &ps,
range, &effect_info);
last_out_edge_column = effect_info.m_trailing_out_edge_column;
- xp.pop_tag (); // td
- xp.pop_tag (); // tr
- xp.pop_tag (); // table
+ xp.pop_tag ("td");
+ xp.pop_tag ("tr");
+ xp.pop_tag ("table");
}
/* Close outstanding frames. */
while (curr_frame)
curr_frame = end_html_stack_frame (xp, std::move (curr_frame));
- xp.pop_tag (); // div
+ xp.pop_tag ("div");
}
} /* end of anonymous namespace for path-printing code. */
diff --git a/gcc/diagnostic-show-locus.cc b/gcc/diagnostic-show-locus.cc
index 3654102..ffb72da 100644
--- a/gcc/diagnostic-show-locus.cc
+++ b/gcc/diagnostic-show-locus.cc
@@ -408,6 +408,12 @@ struct to_text
{
friend class layout_printer<to_text>;
+ // This is a RAII class for HTML, but is a no-op for text.
+ struct auto_check_tag_nesting
+ {
+ auto_check_tag_nesting (to_text &) {}
+ };
+
to_text (pretty_printer &pp,
colorizer &colorizer)
: m_pp (pp),
@@ -446,7 +452,7 @@ struct to_text
{
// no-op for text
}
- void pop_html_tag (std::string)
+ void pop_html_tag (const char *)
{
// no-op for text
}
@@ -538,6 +544,16 @@ struct to_html
{
friend class layout_printer<to_html>;
+ // RAII class for ensuring that the tags nested correctly
+ struct auto_check_tag_nesting : public xml::auto_check_tag_nesting
+ {
+ public:
+ auto_check_tag_nesting (to_html &sink)
+ : xml::auto_check_tag_nesting (sink.m_xp)
+ {
+ }
+ };
+
to_html (xml::printer &xp,
const rich_location *richloc,
html_label_writer *html_label_writer)
@@ -569,9 +585,9 @@ struct to_html
preserve_whitespace);
}
- void pop_html_tag (std::string /*name*/)
+ void pop_html_tag (const char *expected_name)
{
- m_xp.pop_tag ();
+ m_xp.pop_tag (expected_name);
}
void add_html_tag_with_class (std::string name,
@@ -598,7 +614,7 @@ struct to_html
{
pp_clear_output_area (&m_scratch_pp);
pp_unicode_character (&m_scratch_pp, ch);
- m_xp.add_text (pp_formatted_text (&m_scratch_pp));
+ m_xp.add_text_from_pp (m_scratch_pp);
}
void add_utf8_byte (char b)
@@ -728,7 +744,7 @@ default_diagnostic_start_span_fn<to_html> (const diagnostic_location_print_polic
false);
sink.m_xp.push_tag_with_class ("span", "location", true);
sink.m_xp.add_text (text.get ());
- sink.m_xp.pop_tag (); // span
+ sink.m_xp.pop_tag ("span");
}
namespace {
@@ -2719,7 +2735,7 @@ layout_printer<to_html>::end_label (int range_idx,
bool is_label_text)
{
if (m_sink.get_highlight_color_for_range_idx (range_idx))
- m_sink.m_xp.pop_tag ();
+ m_sink.m_xp.pop_tag ("span");
if (is_label_text && m_sink.m_html_label_writer)
m_sink.m_html_label_writer->end_label ();
@@ -3438,6 +3454,8 @@ template<typename Sink>
void
layout_printer<Sink>::print_trailing_fixits (linenum_type row)
{
+ typename Sink::auto_check_tag_nesting sentinel (m_sink);
+
/* Build a list of correction instances for the line,
potentially consolidating hints (for the sake of readability). */
line_corrections corrections (m_layout.m_file_cache, m_layout.m_char_policy,
@@ -3509,9 +3527,6 @@ layout_printer<Sink>::print_trailing_fixits (linenum_type row)
}
}
- if (!corrections.m_corrections.is_empty ())
- m_sink.pop_html_tag ("td");
-
/* Add a trailing newline, if necessary. */
move_to_column (&column, 1 + m_layout.m_x_offset_display, false);
}
@@ -3691,6 +3706,8 @@ template<typename Sink>
void
layout_printer<Sink>::print_line (linenum_type row)
{
+ typename Sink::auto_check_tag_nesting sentinel (m_sink);
+
char_span line
= m_layout.m_file_cache.get_source_line (m_layout.m_exploc.file, row);
if (!line)
@@ -3948,6 +3965,7 @@ diagnostic_source_print_policy::print_as_html (xml::printer &xp,
to_html sink (xp, &richloc, label_writer);
layout_printer<to_html> lp (sink, layout,
diagnostic_kind == DK_DIAGNOSTIC_PATH);
+ xml::auto_check_tag_nesting sentinel (xp);
lp.print (*this);
}
@@ -3955,6 +3973,8 @@ template <typename Sink>
void
layout_printer<Sink>::print (const diagnostic_source_print_policy &source_policy)
{
+ typename Sink::auto_check_tag_nesting sentinel (m_sink);
+
m_sink.push_html_tag_with_class ("table", "locus", false);
if (get_options ().show_ruler_p)
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 08a58fb..ac4fdfa 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -9879,14 +9879,68 @@ expand_expr_real_2 (const_sepops ops, rtx target, machine_mode tmode,
op0 = gen_rtx_fmt_e (TYPE_UNSIGNED (TREE_TYPE (treeop0))
? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
+ else if (SCALAR_INT_MODE_P (GET_MODE (op0))
+ && optimize >= 2
+ && SCALAR_INT_MODE_P (mode)
+ && (GET_MODE_SIZE (as_a <scalar_int_mode> (mode))
+ > GET_MODE_SIZE (as_a <scalar_int_mode> (GET_MODE (op0))))
+ && get_range_pos_neg (treeop0,
+ currently_expanding_gimple_stmt) == 1)
+ {
+ /* If argument is known to be positive when interpreted
+ as signed, we can expand it as both sign and zero
+ extension. Choose the cheaper sequence in that case. */
+ bool speed_p = optimize_insn_for_speed_p ();
+ rtx uns_ret = NULL_RTX, sgn_ret = NULL_RTX;
+ do_pending_stack_adjust ();
+ start_sequence ();
+ if (target == NULL_RTX)
+ uns_ret = convert_to_mode (mode, op0, 1);
+ else
+ convert_move (target, op0, 1);
+ rtx_insn *uns_insns = end_sequence ();
+ start_sequence ();
+ if (target == NULL_RTX)
+ sgn_ret = convert_to_mode (mode, op0, 0);
+ else
+ convert_move (target, op0, 0);
+ rtx_insn *sgn_insns = end_sequence ();
+ unsigned uns_cost = seq_cost (uns_insns, speed_p);
+ unsigned sgn_cost = seq_cost (sgn_insns, speed_p);
+ bool was_tie = false;
+
+ /* If costs are the same then use as tie breaker the other other
+ factor. */
+ if (uns_cost == sgn_cost)
+ {
+ uns_cost = seq_cost (uns_insns, !speed_p);
+ sgn_cost = seq_cost (sgn_insns, !speed_p);
+ was_tie = true;
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; positive extension:%s unsigned cost: %u; "
+ "signed cost: %u\n",
+ was_tie ? " (needed tie breaker)" : "",
+ uns_cost, sgn_cost);
+ if (uns_cost < sgn_cost
+ || (uns_cost == sgn_cost && TYPE_UNSIGNED (TREE_TYPE (treeop0))))
+ {
+ emit_insn (uns_insns);
+ sgn_ret = uns_ret;
+ }
+ else
+ emit_insn (sgn_insns);
+ if (target == NULL_RTX)
+ op0 = sgn_ret;
+ else
+ op0 = target;
+ }
else if (target == 0)
- op0 = convert_to_mode (mode, op0,
- TYPE_UNSIGNED (TREE_TYPE
- (treeop0)));
+ op0 = convert_to_mode (mode, op0, TYPE_UNSIGNED (TREE_TYPE (treeop0)));
else
{
- convert_move (target, op0,
- TYPE_UNSIGNED (TREE_TYPE (treeop0)));
+ convert_move (target, op0, TYPE_UNSIGNED (TREE_TYPE (treeop0)));
op0 = target;
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 857eb72..7a19e5e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2025-06-12 Yuao Ma <c8ef@outlook.com>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/113152
+ * intrinsic.texi: Document new half-revolution trigonometric
+ functions. Reorder doc for atand.
+
2025-06-06 Tobias Burnus <tburnus@baylibre.com>
Sandra Loosemore <sloosemore@baylibre.com>
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 48c2d60..5831995 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -24,15 +24,22 @@ Some basic guidelines for editing this document:
@tex
\gdef\acosd{\mathop{\rm acosd}\nolimits}
-\gdef\asind{\mathop{\rm asind}\nolimits}
-\gdef\atand{\mathop{\rm atand}\nolimits}
-\gdef\acos{\mathop{\rm acos}\nolimits}
-\gdef\asin{\mathop{\rm asin}\nolimits}
-\gdef\atan{\mathop{\rm atan}\nolimits}
\gdef\acosh{\mathop{\rm acosh}\nolimits}
+\gdef\acospi{\mathop{\rm acospi}\nolimits}
+\gdef\acos{\mathop{\rm acos}\nolimits}
+\gdef\asind{\mathop{\rm asind}\nolimits}
\gdef\asinh{\mathop{\rm asinh}\nolimits}
+\gdef\asinpi{\mathop{\rm asinpi}\nolimits}
+\gdef\asin{\mathop{\rm asin}\nolimits}
+\gdef\atan2pi{\mathop{\rm atan2pi}\nolimits}
+\gdef\atand{\mathop{\rm atand}\nolimits}
\gdef\atanh{\mathop{\rm atanh}\nolimits}
+\gdef\atanpi{\mathop{\rm atanpi}\nolimits}
+\gdef\atan{\mathop{\rm atan}\nolimits}
\gdef\cosd{\mathop{\rm cosd}\nolimits}
+\gdef\cospi{\mathop{\rm cospi}\nolimits}
+\gdef\sinpi{\mathop{\rm sinpi}\nolimits}
+\gdef\tanpi{\mathop{\rm tanpi}\nolimits}
@end tex
@@ -49,6 +56,7 @@ Some basic guidelines for editing this document:
* @code{ACOS}: ACOS, Arccosine function
* @code{ACOSD}: ACOSD, Arccosine function, degrees
* @code{ACOSH}: ACOSH, Inverse hyperbolic cosine function
+* @code{ACOSPI}: ACOSPI, Circular arc cosine function
* @code{ADJUSTL}: ADJUSTL, Left adjust a string
* @code{ADJUSTR}: ADJUSTR, Right adjust a string
* @code{AIMAG}: AIMAG, Imaginary part of complex number
@@ -62,12 +70,15 @@ Some basic guidelines for editing this document:
* @code{ASIN}: ASIN, Arcsine function
* @code{ASIND}: ASIND, Arcsine function, degrees
* @code{ASINH}: ASINH, Inverse hyperbolic sine function
+* @code{ASINPI}: ASINPI, Circular arc sine function
* @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
* @code{ATAN}: ATAN, Arctangent function
-* @code{ATAND}: ATAND, Arctangent function, degrees
* @code{ATAN2}: ATAN2, Arctangent function
* @code{ATAN2D}: ATAN2D, Arctangent function, degrees
+* @code{ATAN2PI}: ATAN2PI, Circular arc tangent function
+* @code{ATAND}: ATAND, Arctangent function, degrees
* @code{ATANH}: ATANH, Inverse hyperbolic tangent function
+* @code{ATANPI}: ATANPI, Circular arc tangent function
* @code{ATOMIC_ADD}: ATOMIC_ADD, Atomic ADD operation
* @code{ATOMIC_AND}: ATOMIC_AND, Atomic bitwise AND operation
* @code{ATOMIC_CAS}: ATOMIC_CAS, Atomic compare and swap
@@ -116,6 +127,7 @@ Some basic guidelines for editing this document:
* @code{COS}: COS, Cosine function
* @code{COSD}: COSD, Cosine function, degrees
* @code{COSH}: COSH, Hyperbolic cosine function
+* @code{COSPI}: COSPI, Circular cosine function
* @code{COTAN}: COTAN, Cotangent function
* @code{COTAND}: COTAND, Cotangent function, degrees
* @code{COUNT}: COUNT, Count occurrences of TRUE in an array
@@ -296,6 +308,7 @@ Some basic guidelines for editing this document:
* @code{SIN}: SIN, Sine function
* @code{SIND}: SIND, Sine function, degrees
* @code{SINH}: SINH, Hyperbolic sine function
+* @code{SINPI}: SINPI, Circular sine function
* @code{SIZE}: SIZE, Function to determine the size of an array
* @code{SIZEOF}: SIZEOF, Determine the size in bytes of an expression
* @code{SLEEP}: SLEEP, Sleep for the specified number of seconds
@@ -312,6 +325,7 @@ Some basic guidelines for editing this document:
* @code{TAN}: TAN, Tangent function
* @code{TAND}: TAND, Tangent function, degrees
* @code{TANH}: TANH, Hyperbolic tangent function
+* @code{TANPI}: TANPI, Circular tangent function
* @code{TEAM_NUMBER}: TEAM_NUMBER, Retrieve team id of given team
* @code{THIS_IMAGE}: THIS_IMAGE, Cosubscript index of this image
* @code{TIME}: TIME, Time function
@@ -754,6 +768,62 @@ Inverse function: @*
+@node ACOSPI
+@section @code{ACOSPI} --- Circular arc cosine function
+@fnindex ACOSPI
+@cindex trigonometric function, cosine, inverse
+
+@table @asis
+@item @emph{Description}:
+@code{ACOSPI(X)} computes @math{ \acos(x) / \pi}, which is a measure
+of an angle in half-revolutions.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = ACOSPI(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL} with @math{-1 \leq x \leq 1}.
+@end multitable
+
+@item @emph{Return value}:
+The return value has the same type and kind as @var{X}.
+It is expressed in half-revolutions and satisfies
+@math{ 0 \leq \acospi (x) \leq 1}.
+
+@item @emph{Example}:
+@smallexample
+program test_acospi
+ implicit none
+ real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8]
+ real, parameter :: a = acospi(x), b(3) = acospi(y)
+ call foo(x, y)
+contains
+ subroutine foo(u, v)
+ real, intent(in) :: u, v(:)
+ real :: f, g(size(v))
+ f = acospi(u)
+ g = acospi(v)
+ if (abs(a - f) > 8 * epsilon(f)) stop 1
+ if (any(abs(g - b) > 8 * epsilon(f))) stop 2
+ end subroutine foo
+end program test_acospi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ASINPI} @*
+@ref{ATAN2PI} @*
+@ref{ATANPI} @*
+@end table
+
+
+
@node ADJUSTL
@section @code{ADJUSTL} --- Left adjust a string
@fnindex ADJUSTL
@@ -1469,6 +1539,62 @@ Inverse function: @*
+@node ASINPI
+@section @code{ASINPI} --- Circular arc sine function
+@fnindex ASINPI
+@cindex trigonometric function, sine, inverse
+
+@table @asis
+@item @emph{Description}:
+@code{ASINPI(X)} computes @math{ \asin(x) / \pi}, which is a measure
+of an angle in half-revolutions.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = ASINPI(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL} with @math{-1 \leq x \leq 1}.
+@end multitable
+
+@item @emph{Return value}:
+The return value has the same type and kind as @var{X}.
+It is expressed in half-revolutions and satisfies
+@math{ -0.5 \leq \asinpi (x) \leq 0.5}.
+
+@item @emph{Example}:
+@smallexample
+program test_asinpi
+ implicit none
+ real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8]
+ real, parameter :: a = asinpi(x), b(3) = asinpi(y)
+ call foo(x, y)
+contains
+ subroutine foo(u, v)
+ real, intent(in) :: u, v(:)
+ real :: f, g(size(v))
+ f = asinpi(u)
+ g = asinpi(v)
+ if (abs(a - f) > 8 * epsilon(f)) stop 1
+ if (any(abs(g - b) > 8 * epsilon(f))) stop 2
+ end subroutine foo
+end program test_asinpi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ACOSPI} @*
+@ref{ATAN2PI} @*
+@ref{ATANPI} @*
+@end table
+
+
+
@node ASSOCIATED
@section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
@fnindex ASSOCIATED
@@ -1608,68 +1734,6 @@ Degrees function: @*
-@node ATAND
-@section @code{ATAND} --- Arctangent function, degrees
-@fnindex ATAND
-@fnindex DATAND
-@cindex trigonometric function, tangent, inverse, degrees
-@cindex tangent, inverse, degrees
-
-@table @asis
-@item @emph{Synopsis}:
-@multitable @columnfractions .80
-@item @code{RESULT = ATAND(X)}
-@item @code{RESULT = ATAND(Y, X)}
-@end multitable
-
-@item @emph{Description}:
-@code{ATAND(X)} computes the arctangent of @var{X} in degrees (inverse of
-@ref{TAND}).
-
-@item @emph{Class}:
-Elemental function
-
-@item @emph{Arguments}:
-@multitable @columnfractions .15 .70
-@item @var{X} @tab The type shall be @code{REAL}.
-@item @var{Y} @tab The type and kind type parameter shall be the same as @var{X}.
-@end multitable
-
-@item @emph{Return value}:
-The return value is of the same type and kind as @var{X}.
-If @var{Y} is present, the result is identical to @code{ATAN2D(Y, X)}.
-Otherwise, the result is in degrees and lies in the range
-@math{-90 \leq \atand(x) \leq 90}.
-
-@item @emph{Example}:
-@smallexample
-program test_atand
- real(8) :: x = 2.866_8
- real(4) :: x1 = 1.e0_4, y1 = 0.5e0_4
- x = atand(x)
- x1 = atand(y1, x1)
-end program test_atand
-@end smallexample
-
-@item @emph{Specific names}:
-@multitable @columnfractions .23 .23 .20 .30
-@headitem Name @tab Argument @tab Return type @tab Standard
-@item @code{ATAND(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 2023
-@item @code{DATAND(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
-@end multitable
-
-@item @emph{Standard}:
-Fortran 2023
-
-@item @emph{See also}:
-Inverse function: @*
-@ref{TAND} @*
-Radians function: @*
-@ref{ATAN}
-@end table
-
-
-
@node ATAN2
@section @code{ATAN2} --- Arctangent function
@fnindex ATAN2
@@ -1798,6 +1862,117 @@ Radians function: @*
@ref{ATAN2}
@end table
+
+
+@node ATAN2PI
+@section @code{ATAN2PI} --- Circular arc tangent function
+@fnindex ATAN2PI
+@cindex trigonometric function, tangent, inverse
+
+@table @asis
+@item @emph{Description}:
+@code{ATAN2PI(Y, X)} computes @math{ {\rm {atan2}}(y, x) / \pi},
+and provides a measure of an angle in half-revolutions within
+the proper quadrant.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = ATAN2PI(Y, X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{Y} @tab The type shall be @code{REAL}.
+@item @var{X} @tab The type and kind type parameter shall be the
+same as @var{Y}. If @var{Y} is zero, then @var{X} shall be nonzero.
+@end multitable
+
+@item @emph{Return value}:
+The return value has the same type and kind type parameter as @var{Y}
+and satisfies @math{-1 \leq {\rm {atan2}}(y, x) / \pi \leq 1}.
+
+@item @emph{Example}:
+@smallexample
+program test_atan2pi
+ real(kind=4) :: x = 1.e0_4, y = 0.5e0_4
+ x = atan2pi(y, x)
+end program test_atan2pi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ACOSPI} @*
+@ref{ASINPI} @*
+@ref{ATANPI} @*
+@end table
+
+
+
+@node ATAND
+@section @code{ATAND} --- Arctangent function, degrees
+@fnindex ATAND
+@fnindex DATAND
+@cindex trigonometric function, tangent, inverse, degrees
+@cindex tangent, inverse, degrees
+
+@table @asis
+@item @emph{Synopsis}:
+@multitable @columnfractions .80
+@item @code{RESULT = ATAND(X)}
+@item @code{RESULT = ATAND(Y, X)}
+@end multitable
+
+@item @emph{Description}:
+@code{ATAND(X)} computes the arctangent of @var{X} in degrees (inverse of
+@ref{TAND}).
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL}.
+@item @var{Y} @tab The type and kind type parameter shall be the same as @var{X}.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of the same type and kind as @var{X}.
+If @var{Y} is present, the result is identical to @code{ATAN2D(Y, X)}.
+Otherwise, the result is in degrees and lies in the range
+@math{-90 \leq \atand(x) \leq 90}.
+
+@item @emph{Example}:
+@smallexample
+program test_atand
+ real(8) :: x = 2.866_8
+ real(4) :: x1 = 1.e0_4, y1 = 0.5e0_4
+ x = atand(x)
+ x1 = atand(y1, x1)
+end program test_atand
+@end smallexample
+
+@item @emph{Specific names}:
+@multitable @columnfractions .23 .23 .20 .30
+@headitem Name @tab Argument @tab Return type @tab Standard
+@item @code{ATAND(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 2023
+@item @code{DATAND(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
+@end multitable
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{See also}:
+Inverse function: @*
+@ref{TAND} @*
+Radians function: @*
+@ref{ATAN}
+@end table
+
+
+
@node ATANH
@section @code{ATANH} --- Inverse hyperbolic tangent function
@fnindex ATANH
@@ -1851,6 +2026,70 @@ Inverse function: @*
+@node ATANPI
+@section @code{ATANPI} --- Circular arc tangent function
+@fnindex ATANPI
+@cindex trigonometric function, tangent, inverse
+
+@table @asis
+@item @emph{Description}:
+@code{ATANPI(X)} computes @math{ \atan(x) / \pi}.
+@code{ATANPI(Y, X)} computes @math{ {\rm atan2}(y, x) / \pi}.
+These provide a measure of an angle in half-revolutions.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@multitable @columnfractions .80
+@item @code{RESULT = ATANPI(X)}
+@item @code{RESULT = ATANPI(Y, X)}
+@end multitable
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{Y} @tab The type shall be @code{REAL}.
+@item @var{X} @tab If @var{Y} appears, @var{X} shall have the same type
+and kind as @var{Y}. If @var{Y} is zero, then @var{X} shall not be zero.
+If @var{Y} does not appear in a function reference, then @var{X} shall be
+@code{REAL}.
+@end multitable
+
+@item @emph{Return value}:
+The return value has the same type and kind as @var{X}.
+It is expressed in half-revolutions and satisfies
+@math{ -0.5 \leq \atanpi (x) \leq 0.5}.
+
+@item @emph{Example}:
+@smallexample
+program test_atanpi
+ implicit none
+ real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8]
+ real, parameter :: a = atanpi(x), b(3) = atanpi(y)
+ call foo(x, y)
+contains
+ subroutine foo(u, v)
+ real, intent(in) :: u, v(:)
+ real :: f, g(size(v))
+ f = atanpi(u)
+ g = atanpi(v)
+ if (abs(a - f) > 8 * epsilon(f)) stop 1
+ if (any(abs(g - b) > 8 * epsilon(f))) stop 2
+ end subroutine foo
+end program test_atanpi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ACOSPI} @*
+@ref{ASINPI} @*
+@ref{ATAN2PI} @*
+@end table
+
+
+
@node ATOMIC_ADD
@section @code{ATOMIC_ADD} --- Atomic ADD operation
@fnindex ATOMIC_ADD
@@ -4391,6 +4630,57 @@ Inverse function: @*
+@node COSPI
+@section @code{COSPI} --- Circular cosine function
+@fnindex COSPI
+@cindex trigonometric function, cosine
+@cindex cosine
+
+@table @asis
+@item @emph{Description}:
+@code{COSPI(X)} computes @math{\cos(\pi x)} without performing
+an explicit multiplication by @math{\pi}. This is achieved
+through argument reduction where @math{ x = n + r } with
+@math{n} an integer and @math{0 \leq r \le 1}.
+Due to the
+properties of floating-point arithmetic, the useful range
+for @var{X} is defined by
+@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = COSPI(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL}.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of the same type and kind as @var{X}.
+The result is in half-revolutions and satisfies
+@math{ -1 \leq \cospi (x) \leq 1}.
+
+@item @emph{Example}:
+@smallexample
+program test_cospi
+ real :: x = 0.0
+ x = cospi(x)
+end program test_cospi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ACOSPI} @*
+@ref{COS} @*
+@end table
+
+
+
@node COTAN
@section @code{COTAN} --- Cotangent function
@fnindex COTAN
@@ -13677,6 +13967,57 @@ a GNU extension
+@node SINPI
+@section @code{SINPI} --- Circular sine function
+@fnindex SINPI
+@cindex trigonometric function, sine
+@cindex sine
+
+@table @asis
+@item @emph{Description}:
+@code{SINPI(X)} computes @math{\sin(\pi x)} without performing
+an explicit multiplication by @math{\pi}. This is achieved
+through argument reduction where @math{ |x| = n + r } with
+@math{n} an integer and @math{0 \leq r \le 1}.
+Due to the
+properties of floating-point arithmetic, the useful range
+for @var{X} is defined by
+@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = SINPI(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL}.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of the same type and kind as @var{X}.
+The result is in half-revolutions and satisfies
+@math{ -1 \leq \sinpi (x) \leq 1}.
+
+@item @emph{Example}:
+@smallexample
+program test_sinpi
+ real :: x = 0.0
+ x = sinpi(x)
+end program test_sinpi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ASINPI} @*
+@ref{SIN} @*
+@end table
+
+
+
@node SIZE
@section @code{SIZE} --- Determine the size of an array
@fnindex SIZE
@@ -14574,6 +14915,55 @@ Fortran 2018 and later.
+@node TANPI
+@section @code{TANPI} --- Circular tangent function
+@fnindex TANPI
+@cindex trigonometric function, tangent
+@cindex tangent
+
+@table @asis
+@item @emph{Description}:
+@code{TANPI(X)} computes @math{\tan(\pi x)} without performing
+an explicit multiplication by @math{\pi}. This is achieved
+through argument reduction where @math{ |x| = n + r } with
+@math{n} an integer and @math{0 \leq r \le 1}.
+Due to the
+properties of floating-point arithmetic, the useful range
+for @var{X} is defined by
+@code{ABS(X) <= REAL(2,KIND(X))**DIGITS(X)}.
+
+@item @emph{Standard}:
+Fortran 2023
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = TANPI(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab The type shall be @code{REAL}.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of the same type and kind as @var{X}.
+
+@item @emph{Example}:
+@smallexample
+program test_tanpi
+ real :: x = 0.0
+ x = tanpi(x)
+end program test_tanpi
+@end smallexample
+
+@item @emph{See also}:
+@ref{ATANPI} @*
+@ref{TAN} @*
+@end table
+
+
+
@node THIS_IMAGE
@section @code{THIS_IMAGE} --- Function that returns the cosubscript index of this image
@fnindex THIS_IMAGE
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4e61de2..235fe80 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -8506,11 +8506,13 @@ driver::set_up_specs () const
spec_machine_suffix = just_machine_suffix;
#endif
+ const char *exec_prefix
+ = gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix;
/* We need to check standard_exec_prefix/spec_machine_suffix/specs
for any override of as, ld and libraries. */
- specs_file = (char *) alloca (strlen (standard_exec_prefix)
- + strlen (spec_machine_suffix) + sizeof ("specs"));
- strcpy (specs_file, standard_exec_prefix);
+ specs_file = (char *) alloca (
+ strlen (exec_prefix) + strlen (spec_machine_suffix) + sizeof ("specs"));
+ strcpy (specs_file, exec_prefix);
strcat (specs_file, spec_machine_suffix);
strcat (specs_file, "specs");
if (access (specs_file, R_OK) == 0)
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index aed5c7d..d18b37b 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "sreal.h"
#include "ipa-cp.h"
#include "ipa-prop.h"
+#include "rtl.h"
// Construct a fur_source, and set the m_query field.
fur_source::fur_source (range_query *q)
@@ -778,11 +779,14 @@ fold_using_range::range_of_range_op (vrange &r,
{
basic_block bb = gimple_bb (s);
edge e0 = EDGE_SUCC (bb, 0);
- edge e1 = EDGE_SUCC (bb, 1);
+ /* During RTL expansion one of the edges can be removed
+ if expansion proves the jump is unconditional. */
+ edge e1 = single_succ_p (bb) ? NULL : EDGE_SUCC (bb, 1);
+ gcc_checking_assert (e1 || currently_expanding_to_rtl);
if (!single_pred_p (e0->dest))
e0 = NULL;
- if (!single_pred_p (e1->dest))
+ if (e1 && !single_pred_p (e1->dest))
e1 = NULL;
src.register_outgoing_edges (as_a<gcond *> (s),
as_a <irange> (r), e0, e1);
diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index 305b6356..0f4aff6 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -3767,6 +3767,7 @@ pass_waccess::maybe_check_dealloc_call (gcall *call)
if (is_gimple_call (def_stmt))
{
+ auto_diagnostic_group d;
bool warned = false;
if (gimple_call_alloc_p (def_stmt))
{
diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
index a0a73fe..3f4ac93 100644
--- a/gcc/internal-fn.cc
+++ b/gcc/internal-fn.cc
@@ -5561,7 +5561,7 @@ expand_POPCOUNT (internal_fn fn, gcall *stmt)
expand_unary_optab_fn (fn, stmt, popcount_optab);
rtx_insn *popcount_insns = end_sequence ();
start_sequence ();
- rtx plhs = expand_normal (lhs);
+ rtx plhs = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
rtx pcmp = emit_store_flag (NULL_RTX, EQ, plhs, const1_rtx, lhsmode, 0, 0);
if (pcmp == NULL_RTX)
{
@@ -5603,7 +5603,7 @@ expand_POPCOUNT (internal_fn fn, gcall *stmt)
{
start_sequence ();
emit_insn (cmp_insns);
- plhs = expand_normal (lhs);
+ plhs = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
if (GET_MODE (cmp) != GET_MODE (plhs))
cmp = convert_to_mode (GET_MODE (plhs), cmp, 1);
/* For `<= 1`, we need to produce `2 - cmp` or `cmp ? 1 : 2` as that
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 92e234e..3bf0117 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -4528,7 +4528,7 @@ lenient_count_portion_handling (profile_count remainder, cgraph_node *orig_node)
if (remainder.ipa_p () && !remainder.ipa ().nonzero_p ()
&& orig_node->count.ipa_p () && orig_node->count.ipa ().nonzero_p ()
&& opt_for_fn (orig_node->decl, flag_profile_partial_training))
- remainder = remainder.guessed_local ();
+ remainder = orig_node->count.guessed_local ();
return remainder;
}
@@ -4669,7 +4669,7 @@ update_counts_for_self_gen_clones (cgraph_node *orig_node,
profile_count new_count
= (redist_sum / self_gen_clones.length () + other_edges_count[i]);
new_count = lenient_count_portion_handling (new_count, orig_node);
- n->apply_scale (new_count, n->count);
+ n->scale_profile_to (new_count);
for (cgraph_edge *cs = n->callees; cs; cs = cs->next_callee)
processed_edges.add (cs);
@@ -4769,16 +4769,12 @@ update_profiling_info (struct cgraph_node *orig_node,
bool orig_edges_processed = false;
if (new_sum > orig_node_count)
{
- /* TODO: Profile has alreay gone astray, keep what we have but lower it
- to global0 category. */
- remainder = orig_node->count.global0 ();
-
- for (cgraph_edge *cs = orig_node->callees; cs; cs = cs->next_callee)
- cs->count = cs->count.global0 ();
- for (cgraph_edge *cs = orig_node->indirect_calls;
- cs;
- cs = cs->next_callee)
- cs->count = cs->count.global0 ();
+ /* Profile has alreay gone astray, keep what we have but lower it
+ to global0adjusted or to local if we have partial training. */
+ if (opt_for_fn (orig_node->decl, flag_profile_partial_training))
+ orig_node->make_profile_local ();
+ else
+ orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED);
orig_edges_processed = true;
}
else if (stats.rec_count_sum.nonzero_p ())
@@ -4805,23 +4801,9 @@ update_profiling_info (struct cgraph_node *orig_node,
are still unmodified copies of ORIG_NODE's. Just clear
the latter and bail out. */
if (opt_for_fn (orig_node->decl, flag_profile_partial_training))
- orig_node->count = orig_node->count.guessed_local ();
+ orig_node->make_profile_local ();
else
- orig_node->count = orig_node->count.global0adjusted ();
- for (cgraph_edge *cs = orig_node->callees;
- cs;
- cs = cs->next_callee)
- if (opt_for_fn (orig_node->decl, flag_profile_partial_training))
- cs->count = orig_node->count.guessed_local ();
- else
- cs->count = orig_node->count.global0adjusted ();
- for (cgraph_edge *cs = orig_node->indirect_calls;
- cs;
- cs = cs->next_callee)
- if (opt_for_fn (orig_node->decl, flag_profile_partial_training))
- cs->count = orig_node->count.guessed_local ();
- else
- cs->count = orig_node->count.global0adjusted ();
+ orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED);
return;
}
}
@@ -4870,13 +4852,10 @@ update_profiling_info (struct cgraph_node *orig_node,
remainder = lenient_count_portion_handling (orig_node_count - new_sum,
orig_node);
- new_sum = orig_node_count.combine_with_ipa_count (new_sum);
- orig_node->count = remainder;
-
- new_node->apply_scale (new_sum, new_node->count);
+ new_node->scale_profile_to (new_sum);
if (!orig_edges_processed)
- orig_node->apply_scale (remainder, orig_node->count);
+ orig_node->scale_profile_to (remainder);
if (dump_file)
{
@@ -4906,13 +4885,11 @@ update_specialized_profile (struct cgraph_node *new_node,
|| !redirected_sum.nonzero_p ())
return;
- orig_node->apply_scale
+ orig_node->scale_profile_to
(lenient_count_portion_handling (orig_node->count.ipa () - redirected_sum,
- orig_node),
- orig_node->count);
+ orig_node));
- new_node->apply_scale (new_node->count.ipa () + redirected_sum,
- new_node->count);
+ new_node->scale_profile_to (new_node->count.ipa () + redirected_sum);
if (dump_file)
{
diff --git a/gcc/ipa-inline-transform.cc b/gcc/ipa-inline-transform.cc
index 3c6a845..07a1024 100644
--- a/gcc/ipa-inline-transform.cc
+++ b/gcc/ipa-inline-transform.cc
@@ -191,7 +191,10 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
}
duplicate = false;
e->callee->externally_visible = false;
- e->callee->apply_scale (e->count, e->callee->count);
+ profile_count num = e->count;
+ profile_count den = e->callee->count;
+ profile_count::adjust_for_ipa_scaling (&num, &den);
+ e->callee->apply_scale (num, den);
dump_callgraph_transformation (e->callee, inlining_into,
"inlining to");
diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog
index 57c995d..1037f5c 100644
--- a/gcc/m2/ChangeLog
+++ b/gcc/m2/ChangeLog
@@ -1,3 +1,13 @@
+2025-06-12 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/119650
+ * gm2-libs/ARRAYOFCHAR.def: Remove comment about non
+ existent read.
+ * target-independent/m2/Builtins.texi: Regenerate.
+ * target-independent/m2/SYSTEM-iso.texi: Ditto.
+ * target-independent/m2/SYSTEM-pim.texi: Ditto.
+ * target-independent/m2/gm2-libs.texi: Ditto.
+
2025-06-09 Gaius Mulley <gaiusmod2@gmail.com>
PR modula2/120606
diff --git a/gcc/m2/gm2-libs/ARRAYOFCHAR.def b/gcc/m2/gm2-libs/ARRAYOFCHAR.def
index 451eb56..7767a52 100644
--- a/gcc/m2/gm2-libs/ARRAYOFCHAR.def
+++ b/gcc/m2/gm2-libs/ARRAYOFCHAR.def
@@ -30,8 +30,7 @@ FROM FIO IMPORT File ;
(*
- Description: provides write and read procedures for
- ARRAY OF CHAR.
+ Description: provides write procedures for ARRAY OF CHAR.
*)
PROCEDURE Write (f: File; str: ARRAY OF CHAR) ;
diff --git a/gcc/m2/target-independent/m2/Builtins.texi b/gcc/m2/target-independent/m2/Builtins.texi
index 4ebad46..57daddd 100644
--- a/gcc/m2/target-independent/m2/Builtins.texi
+++ b/gcc/m2/target-independent/m2/Builtins.texi
@@ -348,6 +348,15 @@ PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
@findex strrchr
PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex clz
+PROCEDURE __BUILTIN__ clz (value: CARDINAL) : INTEGER ;
+@findex clzll
+PROCEDURE __BUILTIN__ clzll (value: LONGCARD) : INTEGER ;
+@findex ctz
+PROCEDURE __BUILTIN__ ctz (value: CARDINAL) : INTEGER ;
+@findex ctzll
+PROCEDURE __BUILTIN__ ctzll (value: LONGCARD) : INTEGER ;
+
(*
longjmp - this GCC builtin restricts the val to always 1.
*)
diff --git a/gcc/m2/target-independent/m2/SYSTEM-iso.texi b/gcc/m2/target-independent/m2/SYSTEM-iso.texi
index dbcc534..d195095 100644
--- a/gcc/m2/target-independent/m2/SYSTEM-iso.texi
+++ b/gcc/m2/target-independent/m2/SYSTEM-iso.texi
@@ -8,7 +8,7 @@ DEFINITION MODULE SYSTEM;
(* The constants and types define underlying properties of storage *)
EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
- LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
+ LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, COFF_T, (*
Target specific data types. *)
ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
SHIFT, CAST, TSIZE,
diff --git a/gcc/m2/target-independent/m2/SYSTEM-pim.texi b/gcc/m2/target-independent/m2/SYSTEM-pim.texi
index bd446bd..59abfbe 100644
--- a/gcc/m2/target-independent/m2/SYSTEM-pim.texi
+++ b/gcc/m2/target-independent/m2/SYSTEM-pim.texi
@@ -3,7 +3,7 @@
DEFINITION MODULE SYSTEM ;
EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
- ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+ ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, CARDINAL64, (*
Target specific data types. *)
ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
(* SIZE is also exported if -fpim2 is used. *)
diff --git a/gcc/m2/target-independent/m2/gm2-libs.texi b/gcc/m2/target-independent/m2/gm2-libs.texi
index e707396..b4d4ffb 100644
--- a/gcc/m2/target-independent/m2/gm2-libs.texi
+++ b/gcc/m2/target-independent/m2/gm2-libs.texi
@@ -35,17 +35,21 @@ type results in a number of equivalent modules that can either handle
These modules have been extensively tested and are used throughout
building the GNU Modula-2 compiler.
@menu
+* gm2-libs/ARRAYOFCHAR::ARRAYOFCHAR.def
* gm2-libs/ASCII::ASCII.def
* gm2-libs/Args::Args.def
* gm2-libs/Assertion::Assertion.def
* gm2-libs/Break::Break.def
* gm2-libs/Builtins::Builtins.def
+* gm2-libs/CFileSysOp::CFileSysOp.def
+* gm2-libs/CHAR::CHAR.def
* gm2-libs/COROUTINES::COROUTINES.def
* gm2-libs/CmdArgs::CmdArgs.def
* gm2-libs/Debug::Debug.def
* gm2-libs/DynamicStrings::DynamicStrings.def
* gm2-libs/Environment::Environment.def
* gm2-libs/FIO::FIO.def
+* gm2-libs/FileSysOp::FileSysOp.def
* gm2-libs/FormatStrings::FormatStrings.def
* gm2-libs/FpuIO::FpuIO.def
* gm2-libs/GetOpt::GetOpt.def
@@ -76,7 +80,9 @@ building the GNU Modula-2 compiler.
* gm2-libs/StrCase::StrCase.def
* gm2-libs/StrIO::StrIO.def
* gm2-libs/StrLib::StrLib.def
+* gm2-libs/String::String.def
* gm2-libs/StringConvert::StringConvert.def
+* gm2-libs/StringFileSysOp::StringFileSysOp.def
* gm2-libs/SysExceptions::SysExceptions.def
* gm2-libs/SysStorage::SysStorage.def
* gm2-libs/TimeString::TimeString.def
@@ -95,7 +101,30 @@ building the GNU Modula-2 compiler.
* gm2-libs/wrapc::wrapc.def
@end menu
-@node gm2-libs/ASCII, gm2-libs/Args, , Base libraries
+@node gm2-libs/ARRAYOFCHAR, gm2-libs/ASCII, , Base libraries
+@subsection gm2-libs/ARRAYOFCHAR
+
+@example
+DEFINITION MODULE ARRAYOFCHAR ;
+
+FROM FIO IMPORT File ;
+
+
+(*
+ Description: provides write procedures for ARRAY OF CHAR.
+*)
+
+@findex Write
+PROCEDURE Write (f: File; str: ARRAY OF CHAR) ;
+@findex WriteLn
+PROCEDURE WriteLn (f: File) ;
+
+
+END ARRAYOFCHAR.
+@end example
+@page
+
+@node gm2-libs/ASCII, gm2-libs/Args, gm2-libs/ARRAYOFCHAR, Base libraries
@subsection gm2-libs/ASCII
@example
@@ -232,7 +261,7 @@ END Break.
@end example
@page
-@node gm2-libs/Builtins, gm2-libs/COROUTINES, gm2-libs/Break, Base libraries
+@node gm2-libs/Builtins, gm2-libs/CFileSysOp, gm2-libs/Break, Base libraries
@subsection gm2-libs/Builtins
@example
@@ -584,6 +613,15 @@ PROCEDURE __BUILTIN__ strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
@findex strrchr
PROCEDURE __BUILTIN__ strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex clz
+PROCEDURE __BUILTIN__ clz (value: CARDINAL) : INTEGER ;
+@findex clzll
+PROCEDURE __BUILTIN__ clzll (value: LONGCARD) : INTEGER ;
+@findex ctz
+PROCEDURE __BUILTIN__ ctz (value: CARDINAL) : INTEGER ;
+@findex ctzll
+PROCEDURE __BUILTIN__ ctzll (value: LONGCARD) : INTEGER ;
+
(*
longjmp - this GCC builtin restricts the val to always 1.
*)
@@ -632,7 +670,100 @@ END Builtins.
@end example
@page
-@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/Builtins, Base libraries
+@node gm2-libs/CFileSysOp, gm2-libs/CHAR, gm2-libs/Builtins, Base libraries
+@subsection gm2-libs/CFileSysOp
+
+@example
+DEFINITION MODULE CFileSysOp ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+
+(*
+ Description: provides access to filesystem operations.
+ The implementation module is written in C
+ and the parameters behave as their C
+ counterparts.
+*)
+
+TYPE
+@findex AccessMode (type)
+ AccessMode = SET OF AccessStatus ;
+@findex AccessStatus (type)
+ AccessStatus = (F_OK, R_OK, W_OK, X_OK, A_FAIL) ;
+
+
+@findex Unlink
+PROCEDURE Unlink (filename: ADDRESS) : INTEGER ;
+
+
+(*
+ Access - test access to a path or file. The behavior is
+ the same as defined in access(2). Except that
+ on A_FAIL is only used during the return result
+ indicating the underlying C access has returned
+ -1 (and errno can be checked).
+*)
+
+@findex Access
+PROCEDURE Access (pathname: ADDRESS; mode: AccessMode) : AccessMode ;
+
+
+(* Return TRUE if the caller can see the existance of the file or
+ directory on the filesystem. *)
+
+(*
+ IsDir - return true if filename is a regular directory.
+*)
+
+@findex IsDir
+PROCEDURE IsDir (dirname: ADDRESS) : BOOLEAN ;
+
+
+(*
+ IsFile - return true if filename is a regular file.
+*)
+
+@findex IsFile
+PROCEDURE IsFile (filename: ADDRESS) : BOOLEAN ;
+
+
+(*
+ Exists - return true if pathname exists.
+*)
+
+@findex Exists
+PROCEDURE Exists (pathname: ADDRESS) : BOOLEAN ;
+
+
+END CFileSysOp.
+@end example
+@page
+
+@node gm2-libs/CHAR, gm2-libs/COROUTINES, gm2-libs/CFileSysOp, Base libraries
+@subsection gm2-libs/CHAR
+
+@example
+DEFINITION MODULE CHAR ;
+
+FROM FIO IMPORT File ;
+
+
+(*
+ Write a single character ch to file f.
+*)
+
+@findex Write
+PROCEDURE Write (f: File; ch: CHAR) ;
+@findex WriteLn
+PROCEDURE WriteLn (f: File) ;
+
+
+END CHAR.
+@end example
+@page
+
+@node gm2-libs/COROUTINES, gm2-libs/CmdArgs, gm2-libs/CHAR, Base libraries
@subsection gm2-libs/COROUTINES
@example
@@ -1179,7 +1310,7 @@ END Environment.
@end example
@page
-@node gm2-libs/FIO, gm2-libs/FormatStrings, gm2-libs/Environment, Base libraries
+@node gm2-libs/FIO, gm2-libs/FileSysOp, gm2-libs/Environment, Base libraries
@subsection gm2-libs/FIO
@example
@@ -1543,7 +1674,37 @@ END FIO.
@end example
@page
-@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FIO, Base libraries
+@node gm2-libs/FileSysOp, gm2-libs/FormatStrings, gm2-libs/FIO, Base libraries
+@subsection gm2-libs/FileSysOp
+
+@example
+DEFINITION MODULE FileSysOp ;
+
+FROM CFileSysOp IMPORT AccessMode ;
+
+
+(*
+ Description: provides access to filesystem operations using
+ Modula-2 base types.
+*)
+
+@findex Exists
+PROCEDURE Exists (filename: ARRAY OF CHAR) : BOOLEAN ;
+@findex IsDir
+PROCEDURE IsDir (dirname: ARRAY OF CHAR) : BOOLEAN ;
+@findex IsFile
+PROCEDURE IsFile (filename: ARRAY OF CHAR) : BOOLEAN ;
+@findex Unlink
+PROCEDURE Unlink (filename: ARRAY OF CHAR) : BOOLEAN ;
+@findex Access
+PROCEDURE Access (pathname: ARRAY OF CHAR; mode: AccessMode) : AccessMode ;
+
+
+END FileSysOp.
+@end example
+@page
+
+@node gm2-libs/FormatStrings, gm2-libs/FpuIO, gm2-libs/FileSysOp, Base libraries
@subsection gm2-libs/FormatStrings
@example
@@ -1986,6 +2147,15 @@ PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ;
PROCEDURE IsEmpty (i: Index) : BOOLEAN ;
+(*
+ FindIndice - returns the indice containing a.
+ It returns zero if a is not found in array i.
+*)
+
+@findex FindIndice
+PROCEDURE FindIndice (i: Index; a: ADDRESS) : CARDINAL ;
+
+
END Indexing.
@end example
@page
@@ -3303,7 +3473,7 @@ END SMathLib0.
DEFINITION MODULE SYSTEM ;
EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
- ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+ ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, CARDINAL64, (*
Target specific data types. *)
ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
(* SIZE is also exported if -fpim2 is used. *)
@@ -3872,7 +4042,7 @@ END StrIO.
@end example
@page
-@node gm2-libs/StrLib, gm2-libs/StringConvert, gm2-libs/StrIO, Base libraries
+@node gm2-libs/StrLib, gm2-libs/String, gm2-libs/StrIO, Base libraries
@subsection gm2-libs/StrLib
@example
@@ -3946,7 +4116,25 @@ END StrLib.
@end example
@page
-@node gm2-libs/StringConvert, gm2-libs/SysExceptions, gm2-libs/StrLib, Base libraries
+@node gm2-libs/String, gm2-libs/StringConvert, gm2-libs/StrLib, Base libraries
+@subsection gm2-libs/String
+
+@example
+DEFINITION MODULE String ;
+
+FROM DynamicStrings IMPORT String ;
+FROM FIO IMPORT File ;
+
+@findex Write
+PROCEDURE Write (f: File; str: String) ;
+@findex WriteLn
+PROCEDURE WriteLn (f: File) ;
+
+END String.
+@end example
+@page
+
+@node gm2-libs/StringConvert, gm2-libs/StringFileSysOp, gm2-libs/String, Base libraries
@subsection gm2-libs/StringConvert
@example
@@ -4290,7 +4478,33 @@ END StringConvert.
@end example
@page
-@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringConvert, Base libraries
+@node gm2-libs/StringFileSysOp, gm2-libs/SysExceptions, gm2-libs/StringConvert, Base libraries
+@subsection gm2-libs/StringFileSysOp
+
+@example
+DEFINITION MODULE StringFileSysOp ;
+
+FROM DynamicStrings IMPORT String ;
+FROM CFileSysOp IMPORT AccessMode ;
+
+
+@findex Exists
+PROCEDURE Exists (filename: String) : BOOLEAN ;
+@findex IsDir
+PROCEDURE IsDir (dirname: String) : BOOLEAN ;
+@findex IsFile
+PROCEDURE IsFile (filename: String) : BOOLEAN ;
+@findex Unlink
+PROCEDURE Unlink (filename: String) : BOOLEAN ;
+@findex Access
+PROCEDURE Access (pathname: String; mode: AccessMode) : AccessMode ;
+
+
+END StringFileSysOp.
+@end example
+@page
+
+@node gm2-libs/SysExceptions, gm2-libs/SysStorage, gm2-libs/StringFileSysOp, Base libraries
@subsection gm2-libs/SysExceptions
@example
@@ -4476,7 +4690,10 @@ EXPORT UNQUALIFIED alloca, memcpy,
index, rindex,
memcmp, memset, memmove,
strcat, strncat, strcpy, strncpy, strcmp, strncmp,
- strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr ;
+ strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr,
+
+ clz, clzll,
+ ctz, ctzll ;
@findex alloca
PROCEDURE alloca (i: CARDINAL) : ADDRESS ;
@@ -4732,6 +4949,16 @@ PROCEDURE strchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
@findex strrchr
PROCEDURE strrchr (s: ADDRESS; c: INTEGER) : ADDRESS ;
+@findex clz
+PROCEDURE clz (value: CARDINAL) : INTEGER ;
+@findex clzll
+PROCEDURE clzll (value: CARDINAL) : INTEGER ;
+@findex ctz
+PROCEDURE ctz (value: CARDINAL) : INTEGER ;
+@findex ctzll
+PROCEDURE ctzll (value: CARDINAL) : INTEGER ;
+
+
END cbuiltin.
@end example
@page
@@ -4893,7 +5120,7 @@ PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ;
@findex dtoa
PROCEDURE dtoa (d : REAL;
- mode : Mode;
+ mode : INTEGER;
ndigits : INTEGER;
VAR decpt: INTEGER;
VAR sign : BOOLEAN) : ADDRESS ;
@@ -4999,7 +5226,7 @@ PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ;
@findex ldtoa
PROCEDURE ldtoa (d : LONGREAL;
- mode : Mode;
+ mode : INTEGER;
ndigits : INTEGER;
VAR decpt: INTEGER;
VAR sign : BOOLEAN) : ADDRESS ;
@@ -5015,9 +5242,11 @@ END ldtoa.
@example
DEFINITION MODULE FOR "C" libc ;
-FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T ;
+FROM SYSTEM IMPORT ADDRESS, CSIZE_T, CSSIZE_T, COFF_T ;
EXPORT UNQUALIFIED time_t, timeb, tm, ptrToTM,
+ atof, atoi, atol, atoll,
+ strtod, strtof, strtold, strtol, strtoll, strtoul, strtoull,
write, read,
system, abort,
malloc, free,
@@ -5072,6 +5301,99 @@ TYPE
(*
+ double atof(const char *nptr)
+*)
+
+@findex atof
+PROCEDURE atof (nptr: ADDRESS) : REAL ;
+
+
+(*
+ int atoi(const char *nptr)
+*)
+
+@findex atoi
+PROCEDURE atoi (nptr: ADDRESS) : INTEGER ;
+
+
+(*
+ long atol(const char *nptr);
+*)
+
+@findex atol
+PROCEDURE atol (nptr: ADDRESS) : CSSIZE_T ;
+
+
+(*
+ long long atoll(const char *nptr);
+*)
+
+@findex atoll
+PROCEDURE atoll (nptr: ADDRESS) : LONGINT ;
+
+
+(*
+ double strtod(const char *restrict nptr, char **_Nullable restrict endptr)
+*)
+
+@findex strtod
+PROCEDURE strtod (nptr, endptr: ADDRESS) : REAL ;
+
+
+(*
+ float strtof(const char *restrict nptr, char **_Nullable restrict endptr)
+*)
+
+@findex strtof
+PROCEDURE strtof (nptr, endptr: ADDRESS) : SHORTREAL ;
+
+
+(*
+ long double strtold(const char *restrict nptr,
+ char **_Nullable restrict endptr)
+*)
+
+@findex strtold
+PROCEDURE strtold (nptr, endptr: ADDRESS) : LONGREAL ;
+
+
+(*
+ long strtol(const char *restrict nptr, char **_Nullable restrict endptr,
+ int base)
+*)
+
+@findex strtol
+PROCEDURE strtol (nptr, endptr: ADDRESS; base: INTEGER) : CSSIZE_T ;
+
+
+(*
+ long long strtoll(const char *restrict nptr,
+ char **_Nullable restrict endptr, int base)
+*)
+
+@findex strtoll
+PROCEDURE strtoll (nptr, endptr: ADDRESS; base: INTEGER) : LONGINT ;
+
+
+(*
+ unsigned long strtoul(const char *restrict nptr,
+ char **_Nullable restrict endptr, int base)
+*)
+
+@findex strtoul
+PROCEDURE strtoul (nptr, endptr: ADDRESS; base: INTEGER) : CSIZE_T ;
+
+
+(*
+ unsigned long long strtoull(const char *restrict nptr,
+ char **_Nullable restrict endptr, int base)
+*)
+
+@findex strtoull
+PROCEDURE strtoull (nptr, endptr: ADDRESS; base: INTEGER) : LONGCARD ;
+
+
+(*
ssize_t write (int d, void *buf, size_t nbytes)
*)
@@ -5222,7 +5544,7 @@ PROCEDURE close (d: INTEGER) : [ INTEGER ] ;
*)
@findex open
-PROCEDURE open (filename: ADDRESS; oflag: INTEGER; ...) : INTEGER ;
+PROCEDURE open (filename: ADDRESS; oflag: INTEGER; mode: INTEGER) : INTEGER ;
(*
@@ -5240,7 +5562,7 @@ PROCEDURE creat (filename: ADDRESS; mode: CARDINAL) : INTEGER;
*)
@findex lseek
-PROCEDURE lseek (fd: INTEGER; offset: CSSIZE_T; whence: INTEGER) : [ CSSIZE_T ] ;
+PROCEDURE lseek (fd: INTEGER; offset: COFF_T; whence: INTEGER) : [ COFF_T ] ;
(*
@@ -6720,7 +7042,7 @@ PROCEDURE BlockMoveBackward (dest, src: ADDRESS; n: CARDINAL) ;
(*
- BlockClear - fills, block..block+n-1, with zero's.
+ BlockClear - fills, block..block+n-1, with zeros.
*)
@findex BlockClear
@@ -7381,7 +7703,7 @@ PROCEDURE Doio (VAR f: File) ;
*)
@findex FileNameChar
-PROCEDURE FileNameChar (ch: CHAR) ;
+PROCEDURE FileNameChar (ch: CHAR) : CHAR ;
END FileSystem.
@@ -7512,7 +7834,7 @@ VAR
(*
OpenInput - reads a string from stdin as the filename for reading.
- If the filename ends with `.' then it appends the defext
+ If the filename ends with '.' then it appends the defext
extension. The global variable Done is set if all
was successful.
*)
@@ -7532,7 +7854,7 @@ PROCEDURE CloseInput ;
(*
OpenOutput - reads a string from stdin as the filename for writing.
- If the filename ends with `.' then it appends the defext
+ If the filename ends with '.' then it appends the defext
extension. The global variable Done is set if all
was successful.
*)
@@ -8424,7 +8746,7 @@ EXPORT QUALIFIED SEMAPHORE, DESCRIPTOR,
TYPE
@findex SEMAPHORE (type)
- SEMAPHORE ; (* defines Dijkstra's semaphores *)
+ SEMAPHORE ; (* defines Dijkstras semaphores *)
@findex DESCRIPTOR (type)
DESCRIPTOR ; (* handle onto a process *)
@@ -8483,7 +8805,7 @@ PROCEDURE InitSemaphore (v: CARDINAL; Name: ARRAY OF CHAR) : SEMAPHORE ;
(*
- Wait - performs dijkstra's P operation on a semaphore.
+ Wait - performs dijkstras P operation on a semaphore.
A process which calls this procedure will
wait until the value of the semaphore is > 0
and then it will decrement this value.
@@ -8494,7 +8816,7 @@ PROCEDURE Wait (s: SEMAPHORE) ;
(*
- Signal - performs dijkstra's V operation on a semaphore.
+ Signal - performs dijkstras V operation on a semaphore.
A process which calls the procedure will increment
the semaphores value.
*)
@@ -8621,7 +8943,7 @@ DEFINITION MODULE SYSTEM ;
FROM COROUTINES IMPORT PROTECTION ;
EXPORT QUALIFIED (* the following are built into the compiler: *)
- ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (*
+ ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, COFF_T, (*
Target specific data types. *)
ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE,
(* SIZE is exported depending upon -fpim2 and
@@ -13322,7 +13644,7 @@ DEFINITION MODULE SYSTEM;
(* The constants and types define underlying properties of storage *)
EXPORT QUALIFIED BITSPERLOC, LOCSPERWORD,
- LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, (*
+ LOC, BYTE, WORD, ADDRESS, CSIZE_T, CSSIZE_T, COFF_T, (*
Target specific data types. *)
ADDADR, SUBADR, DIFADR, MAKEADR, ADR, ROTATE,
SHIFT, CAST, TSIZE,
@@ -14878,12 +15200,16 @@ IMPORT IOChan ;
PROCEDURE SkipSpaces (cid: IOChan.ChanId) ;
-(* The following procedures do not read past line marks. *)
+(* CharAvailable returns TRUE if IOChan.ReadResult is notKnown or
+ allRight. *)
@findex CharAvailable
PROCEDURE CharAvailable (cid: IOChan.ChanId) : BOOLEAN ;
+(* EofOrEoln returns TRUE if IOChan.ReadResult is endOfLine or
+ endOfInput. *)
+
@findex EofOrEoln
PROCEDURE EofOrEoln (cid: IOChan.ChanId) : BOOLEAN ;
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index e6429a0..f615b07 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,8 @@
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ * objc-act.h (TYPE_OBJC_INFO): Define to info.objc_info
+ instead of objc_info.
+
2024-11-22 Andrew Pinski <quic_apinski@quicinc.com>
PR bootstrap/117737
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index 39c2989..c7f9259 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -228,7 +228,7 @@ enum objc_property_nullability {
/* The following three macros must be overridden (in objcp/objcp-decl.h)
for Objective-C++. */
-#define TYPE_OBJC_INFO(TYPE) TYPE_LANG_SPECIFIC (TYPE)->objc_info
+#define TYPE_OBJC_INFO(TYPE) TYPE_LANG_SPECIFIC (TYPE)->info.objc_info
#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type)
#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \
do { \
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index 90357fe..ab029d4 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,8 @@
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ * objcp-decl.h (TYPE_OBJC_INFO): Define to info.objc_info
+ instead of objc_info.
+
2024-11-22 Andrew Pinski <quic_apinski@quicinc.com>
PR bootstrap/117737
diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h
index 747fdae..2489620 100644
--- a/gcc/objcp/objcp-decl.h
+++ b/gcc/objcp/objcp-decl.h
@@ -60,7 +60,7 @@ extern tree objcp_end_compound_stmt (tree, int);
#define OBJC_SET_TYPE_NAME(type, name) (TYPE_IDENTIFIER (type) = (name))
#undef TYPE_OBJC_INFO
-#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
+#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->info.objc_info
#undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC
#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type)
#undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 1e5e07a..487defa 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,7 @@
+2025-06-12 Joseph Myers <josmyers@redhat.com>
+
+ * es.po: Update.
+
2025-05-15 Joseph Myers <josmyers@redhat.com>
* zh_CN.po: Update.
diff --git a/gcc/po/es.po b/gcc/po/es.po
index 6033f331..2959212 100644
--- a/gcc/po/es.po
+++ b/gcc/po/es.po
@@ -2,7 +2,7 @@
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Cristian Othón Martínez Vera <cfuga@cfuga.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020
+# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020, 2025
#
# Agradezco a Juan Cuquejo Mira por sus comentarios sobre esta traducción
#
@@ -40,10 +40,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gcc 10.1-b20200209\n"
+"Project-Id-Version: gcc 15.1.0\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-04-23 19:27+0000\n"
-"PO-Revision-Date: 2020-03-22 16:48+0100\n"
+"PO-Revision-Date: 2025-06-12 23:08+0200\n"
"Last-Translator: Antonio Ceballos Roa <aceballos@gmail.com>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
"Language: es\n"
@@ -15533,12 +15533,12 @@ msgstr "Activa las opciones comunes para generar información de análisis de pe
#: common.opt:2648
#, no-c-format
msgid "Register the profile information in the .gcov_info section instead of using a constructor/destructor."
-msgstr ""
+msgstr "Registra la información de análisis de perfil en la sección .gcov_info en lugar de utilizar un constructor/destructor."
#: common.opt:2652
#, no-c-format
msgid "Register the profile information in the specified section instead of using a constructor/destructor."
-msgstr ""
+msgstr "Registra la información de análisis de perfil en la sección especificada en lugar de utilizar un constructor/destructor."
#: common.opt:2656
#, no-c-format
@@ -18902,7 +18902,7 @@ msgstr ""
#: gcov-tool.cc:157 gcov-tool.cc:300
#, c-format
msgid "no profile files were merged\n"
-msgstr ""
+msgstr "no se han mezclado ficheros de perfil\n"
#: gcov-tool.cc:169
#, c-format
@@ -18925,26 +18925,22 @@ msgid " -w, --weight <w1,w2> Set weights (float point values)\
msgstr " -w, --weight <p1,p2> Establece los pesos (valores de coma flotante)\n"
#: gcov-tool.cc:188
-#, fuzzy, c-format
-#| msgid "Merge subcomand usage:"
+#, c-format
msgid "Merge subcommand usage:"
msgstr "Modo de empleo de la suborden de mezcla:"
#: gcov-tool.cc:240
-#, fuzzy, c-format
-#| msgid ""
-#| " -l, --long-file-names Use long output file names for included\n"
-#| " source files\n"
+#, c-format
msgid ""
" merge-stream [options] [<file>] Merge coverage stream file (or stdin)\n"
" and coverage file contents\n"
msgstr ""
-" -l, --long-file-names Usa nombres largos de ficheros para los\n"
-" ficheros fuentes incluidos\n"
+" merge-stream [options] [<fich>] Mezcla el fichero de flujo de cobertura\n"
+" (o stdin) y el contenido del fichero de\n"
+" cobertura\n"
#: gcov-tool.cc:258
-#, fuzzy, c-format
-#| msgid "Merge subcomand usage:"
+#, c-format
msgid "Merge-stream subcommand usage:"
msgstr "Modo de empleo de la suborden de mezcla:"
@@ -19014,8 +19010,7 @@ msgid " -t <float>, --hot_threshold <float> Set the threshold for hotness\n"
msgstr " -t <float>, --hot_threshold <float> Establece el umbral de calentura\n"
#: gcov-tool.cc:510
-#, fuzzy, c-format
-#| msgid "Overlap subcomand usage:"
+#, c-format
msgid "Overlap subcommand usage:"
msgstr "Modo de empleo de la suborden de solapamiento:"
@@ -19059,10 +19054,9 @@ msgstr ""
"%s.\n"
#: gcov-tool.cc:595
-#, fuzzy, c-format
-#| msgid "Copyright %s 2019 Free Software Foundation, Inc.\n"
+#, c-format
msgid "Copyright %s 2025 Free Software Foundation, Inc.\n"
-msgstr "Copyright %s 2019 Free Software Foundation, Inc.\n"
+msgstr "Copyright %s 2025 Free Software Foundation, Inc.\n"
#: gcov.cc:1096
#, c-format
@@ -19102,22 +19096,21 @@ msgstr ""
" en lugar de los porcentajes\n"
#: gcov.cc:1102
-#, fuzzy, c-format
-#| msgid ""
-#| " -c, --branch-counts Output counts of branches taken\n"
-#| " rather than percentages\n"
+#, c-format
msgid ""
" -g, --conditions Include modified condition/decision\n"
" coverage (masking MC/DC) in output\n"
msgstr ""
-" -c, --branch-counts Se muestra el número de ramificaciones\n"
-" en lugar de los porcentajes\n"
+" -g, --conditions Incluye la cobertura de condición/decisión\n"
+" modificada (enmascarando MC/DC) en la\n"
+" salida\n"
#: gcov.cc:1104
-#, fuzzy, c-format
-#| msgid " -p, --preserve-paths Preserve all pathname components\n"
+#, c-format
msgid " -e, --prime-paths Show prime path coverage summary\n"
-msgstr " -p, --preserve-paths Preserva todos los nombres de ruta de los componentes\n"
+msgstr ""
+" -e, --prime-paths Muestra el resumen de la cobertura de camino\n"
+" primario\n"
#: gcov.cc:1105
#, c-format
@@ -19127,6 +19120,10 @@ msgid ""
" TYPE is 'covered', 'uncovered', or 'both'\n"
" and defaults to 'uncovered'\n"
msgstr ""
+" --prime-paths-lines[=TIPO] Incluye los caminos en la salida\n"
+" modo de traza de línea - no afecta a json\n"
+" TIPO es 'covered', 'uncovered' o 'both'\n"
+" y el predefinido es 'uncovered'\n"
#: gcov.cc:1109
#, c-format
@@ -19136,6 +19133,10 @@ msgid ""
" TYPE is 'covered', 'uncovered', or 'both'\n"
" and defaults to 'uncovered'\n"
msgstr ""
+" --prime-paths-source[=TIPO] Incluye los caminos en la salida\n"
+" modo de traza de fuente - no afecta a json\n"
+" TIPO es 'covered', 'uncovered' o 'both'\n"
+" y el predefinido es 'uncovered'\n"
#: gcov.cc:1113
#, c-format
@@ -19145,7 +19146,7 @@ msgstr " -d, --display-progress Muestra información de progreso\n"
#: gcov.cc:1114
#, c-format
msgid " -D, --debug\t\t\t Display debugging dumps\n"
-msgstr ""
+msgstr " -D, --debug\t\t\t Muestra volcados de depuración\n"
#: gcov.cc:1115
#, c-format
@@ -19153,16 +19154,14 @@ msgid " -f, --function-summaries Output summaries for each function\n"
msgstr " -f, --function-summaries Muestra sumarios para cada función\n"
#: gcov.cc:1116
-#, fuzzy, c-format
-#| msgid " -f, --function Print function level info\n"
+#, c-format
msgid " --include Include functions matching this regex\n"
-msgstr " -f, --function Imprime información sobre el nivel de funciones\n"
+msgstr " --include Incluye funciones coincidentes con esta regex\n"
#: gcov.cc:1117
-#, fuzzy, c-format
-#| msgid " -h, --help Print this help, then exit\n"
+#, c-format
msgid " --exclude Exclude functions matching this regex\n"
-msgstr " -h, --help Muestra esta información, y finaliza\n"
+msgstr " --exclude Excluye funciones coincidentes con esta regex\n"
#: gcov.cc:1118
#, c-format
@@ -19170,18 +19169,18 @@ msgid " -h, --help Print this help, then exit\n"
msgstr " -h, --help Muestra esta información, y finaliza\n"
#: gcov.cc:1119
-#, fuzzy, c-format
-#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"
+#, c-format
msgid ""
" -j, --json-format Output JSON intermediate format\n"
" into .gcov.json.gz file\n"
-msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n"
+msgstr ""
+" -j, --json-format Envía el formato intermedio JSON\n"
+" al fichero .gcov.json.gz\n"
#: gcov.cc:1121
-#, fuzzy, c-format
-#| msgid " -j, --human-readable Output human readable numbers\n"
+#, c-format
msgid " -H, --human-readable Output human readable numbers\n"
-msgstr " -j, --human-readable Salida con números legibles para humanos\n"
+msgstr " -H, --human-readable Salida con números legibles para humanos\n"
#: gcov.cc:1122
#, c-format
@@ -19200,19 +19199,16 @@ msgstr ""
#: gcov.cc:1125
#, c-format
msgid " -m, --demangled-names Output demangled function names\n"
-msgstr " -m, --demangled-names Nombres de función mutilados de salida\n"
+msgstr " -m, --demangled-names Saca nombres de función desofuscados\n"
#: gcov.cc:1126
-#, fuzzy, c-format
-#| msgid ""
-#| " -l, --long-file-names Use long output file names for included\n"
-#| " source files\n"
+#, c-format
msgid ""
" -M, --filter-on-demangled Make --include/--exclude match on demangled\n"
" names. This does not imply -m\n"
msgstr ""
-" -l, --long-file-names Usa nombres largos de ficheros para los\n"
-" ficheros fuentes incluidos\n"
+" -M, --filter-on-demangled Aplica --include/--exclude a los nombres\n"
+" desofuscados. No implica -m\n"
#: gcov.cc:1128
#, c-format
@@ -19270,24 +19266,23 @@ msgid " -x, --hash-filenames Hash long pathnames\n"
msgstr " -x, --hash-filenames Nombres de ruta largos de Hash\n"
#: gcov.cc:1139
-#, fuzzy, c-format
-#| msgid "Options:\n"
+#, c-format
msgid ""
"\n"
"Obsolete options:\n"
-msgstr "Opciones:\n"
+msgstr ""
+"\n"
+"Opciones obsoletas:\n"
#: gcov.cc:1140
-#, fuzzy, c-format
-#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"
+#, c-format
msgid " -i, --json-format Replaced with -j, --json-format\n"
-msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n"
+msgstr " -i, --json-format Reemplazado por -j, --json-format\n"
#: gcov.cc:1141
-#, fuzzy, c-format
-#| msgid " -j, --human-readable Output human readable numbers\n"
+#, c-format
msgid " -j, --human-readable Replaced with -H, --human-readable\n"
-msgstr " -j, --human-readable Salida con números legibles para humanos\n"
+msgstr " -j, --human-readable Reemplazado por -H, --human-readable\n"
#: gcov.cc:1152
#, c-format
@@ -19295,20 +19290,19 @@ msgid "gcov %s%s\n"
msgstr "gcov %s%s\n"
#: gcov.cc:1153
-#, fuzzy, c-format
-#| msgid "collect2 version %s\n"
+#, c-format
msgid "JSON format version: %s\n"
-msgstr "collect2 versión %s\n"
+msgstr "versión del formato JSON: %s\n"
#: gcov.cc:1237
#, c-format
msgid "invalid argument '%s' for '--prime-paths-lines'. Valid arguments are: 'covered', 'uncovered', 'both'\n"
-msgstr ""
+msgstr "argumento no válido '%s' para --prime-paths-lines'. Argumentos válidos: 'covered', 'uncovered', 'both'\n"
#: gcov.cc:1258
#, c-format
msgid "invalid argument '%s' for '--prime-paths-source'. Valid arguments are: 'covered', 'uncovered', 'both'\n"
-msgstr ""
+msgstr "argumento no válido '%s' para --prime-paths-source'. Argumentos válidos: 'covered', 'uncovered', 'both'\n"
#: gcov.cc:1726
#, c-format
@@ -19376,10 +19370,9 @@ msgid "%s:already seen blocks for '%s'\n"
msgstr "%s:ya se vieron bloques para '%s'\n"
#: gcov.cc:2391
-#, fuzzy, c-format
-#| msgid "%s:already seen blocks for '%s'\n"
+#, c-format
msgid "%s:already seen conditions for '%s'\n"
-msgstr "%s:ya se vieron bloques para '%s'\n"
+msgstr "%s:condiciones ya vistas para '%s'\n"
#: gcov.cc:2449 gcov.cc:2589
#, c-format
@@ -19482,28 +19475,24 @@ msgid "No calls\n"
msgstr "No hay llamadas\n"
#: gcov.cc:3090 gcov.cc:3144
-#, fuzzy, c-format
-#| msgid "Lines executed:%s of %d\n"
+#, c-format
msgid "Condition outcomes covered:%s of %d\n"
-msgstr "Líneas ejecutadas:%s de %d\n"
+msgstr "Salidas de condiciones cubiertas:%s de %d\n"
#: gcov.cc:3095 gcov.cc:3149
-#, fuzzy, c-format
-#| msgid "bad condition code"
+#, c-format
msgid "No conditions\n"
-msgstr "código de condición erróneo"
+msgstr "No hay condiciones\n"
#: gcov.cc:3101 gcov.cc:3155
-#, fuzzy, c-format
-#| msgid "Branches executed:%s of %d\n"
+#, c-format
msgid "Prime paths covered:%s of %d\n"
-msgstr "Ramificaciones ejecutadas:%s de %d\n"
+msgstr "Caminos primarios cubiertos:%s de %d\n"
#: gcov.cc:3105 gcov.cc:3159
-#, fuzzy, c-format
-#| msgid "Display this information."
+#, c-format
msgid "No path information\n"
-msgstr "Muestra esta información."
+msgstr "No hay información de caminos\n"
#: gcov.cc:3379
#, c-format
@@ -19513,13 +19502,12 @@ msgstr "%s:no hay líneas para '%s'\n"
#: gcov.cc:3515
#, c-format
msgid "condition outcomes covered %d/%d\n"
-msgstr ""
+msgstr "salidas de condiciones cubiertas %d/%d\n"
#: gcov.cc:3528
-#, fuzzy, c-format
-#| msgid "unconditional %2d taken %s\n"
+#, c-format
msgid "condition %2u not covered (%s%s)\n"
-msgstr "el incondicional %2d tomado %s\n"
+msgstr "condición %2u no cubierta (%s%s)\n"
#: gcov.cc:3542
#, c-format
@@ -19537,10 +19525,9 @@ msgid "branch %2d taken %s%s"
msgstr "ramificación %2d tomada %s%s"
#: gcov.cc:3557
-#, fuzzy, c-format
-#| msgid "branch %2d never executed"
+#, c-format
msgid "branch %2d never executed%s"
-msgstr "la ramificacion %2d nunca se ejecuta"
+msgstr "la ramificacion %2d nunca se ejecuta%s"
#: gcov.cc:3562
#, c-format
@@ -19558,15 +19545,14 @@ msgid "unconditional %2d never executed\n"
msgstr "el incondicional %2d nunca se ejecuta\n"
#: gcov.cc:3729
-#, fuzzy, c-format
-#| msgid "parameter name omitted"
+#, c-format
msgid "path coverage omitted\n"
-msgstr "se omitió el nombre del parámetro"
+msgstr "cobertura de caminos omitida\n"
#: gcov.cc:3731
#, c-format
msgid "paths covered %u of %zu\n"
-msgstr ""
+msgstr "caminos cubiertos %u de %zu\n"
#: gcov.cc:3806
#, c-format
@@ -19612,16 +19598,14 @@ msgid "End of search list.\n"
msgstr "Fin de la lista de búsqueda.\n"
#: incpath.cc:408
-#, fuzzy, c-format
-#| msgid "#include <...> search starts here:\n"
+#, c-format
msgid "#embed <...> search starts here:\n"
-msgstr "la búsqueda de #include <...> inicia aquí:\n"
+msgstr "la búsqueda de #embed <...> comienza aquí:\n"
#: incpath.cc:411
-#, fuzzy, c-format
-#| msgid "End of search list.\n"
+#, c-format
msgid "End of #embed search list.\n"
-msgstr "Fin de la lista de búsqueda.\n"
+msgstr "Fin de la lista de búsqueda de #embed.\n"
#: input.cc:35
msgid "<built-in>"
@@ -27144,10 +27128,9 @@ msgid "wrong number of arguments to %%:dwarf-version-gt"
msgstr "número erróneo de argumentos para %%:debug-level-gt"
#: gcov-tool.cc:75
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "error in removing %s\n"
+#, gcc-internal-format, gfc-internal-format
msgid "error in removing %s"
-msgstr "error al quitar %s\n"
+msgstr "error al quitar %s"
#: gcov-tool.cc:106
#, gcc-internal-format, gfc-internal-format
@@ -27167,19 +27150,17 @@ msgstr "No se puede cambiar al directorio %s"
#: gcov-tool.cc:125
#, gcc-internal-format, gfc-internal-format
msgid "output file %s already exists in folder %s"
-msgstr ""
+msgstr "el fichero de salida %s ya existe en la carpeta %s"
#: gcov-tool.cc:217 gcov-tool.cc:285
-#, fuzzy, gcc-internal-format
-#| msgid "weights need to be non-negative\n"
+#, gcc-internal-format
msgid "weights need to be non-negative"
-msgstr "los pesos tienen que ser no negativos\n"
+msgstr "los pesos han de ser no negativos"
#: gcov-tool.cc:424
-#, fuzzy, gcc-internal-format
-#| msgid "scale needs to be non-negative\n"
+#, gcc-internal-format
msgid "scale needs to be non-negative"
-msgstr "la escala tiene que ser no negativa\n"
+msgstr "la escala ha de ser no negativa"
#: gcse.cc:4194
#, gcc-internal-format, gfc-internal-format
diff --git a/gcc/selftest-xml.h b/gcc/selftest-xml.h
new file mode 100644
index 0000000..fd5c0af
--- /dev/null
+++ b/gcc/selftest-xml.h
@@ -0,0 +1,50 @@
+/* Selftest support for XML.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_SELFTEST_XML_H
+#define GCC_SELFTEST_XML_H
+
+#include "xml.h"
+
+/* The selftest code should entirely disappear in a production
+ configuration, hence we guard all of it with #if CHECKING_P. */
+
+#if CHECKING_P
+
+namespace selftest {
+
+/* Assert that NODE written with indentation as xml source
+ equals EXPECTED_VALUE.
+ Use LOC for any failures. */
+
+void
+assert_xml_print_eq (const location &loc,
+ const xml::node &node,
+ const char *expected_value);
+#define ASSERT_XML_PRINT_EQ(XML_NODE, EXPECTED_VALUE) \
+ assert_xml_print_eq ((SELFTEST_LOCATION), \
+ (XML_NODE), \
+ (EXPECTED_VALUE))
+
+} // namespace selftest
+
+#endif /* #if CHECKING_P */
+
+#endif /* GCC_SELFTEST_XML_H */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8fbf5fe..80cc664 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,257 @@
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/120638
+ * gcc.dg/pr120638.c: New test.
+
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120630
+ * gcc.dg/pr120630.c: New test.
+ * gcc.c-torture/execute/pr120630.c: New test.
+
+2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120629
+ * g++.dg/opt/pr120629.C: New test.
+
+2025-06-12 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check
+ for vmax.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto.
+
+2025-06-12 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check
+ for vmax.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto.
+
+2025-06-12 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check
+ for max func 1 vmax.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c: New test.
+
+2025-06-12 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check
+ for max func 1 vmax.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test
+ helper macros.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
+ data for run test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c: New test.
+
+2025-06-12 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/120624
+ * gcc.target/aarch64/sme/za_state_7.c: New test.
+
+2025-06-12 Georg-Johann Lay <avr@gjlay.de>
+
+ PR middle-end/117811
+ PR testsuite/52641
+ * gcc.dg/torture/pr117811.c: Fix for int < 32 bit.
+
+2025-06-12 Gwenole Beauchesne <gb.devel@gmail.com>
+ Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR c++/41201
+ PR c++/48026
+ * c-c++-common/pragma-optimize-1.c: New test.
+ * g++.target/i386/vect-pragma-target-1.C: New test.
+ * g++.target/i386/vect-pragma-target-2.C: New test.
+ * gcc.target/i386/vect-pragma-target-1.c: New test.
+ * gcc.target/i386/vect-pragma-target-2.c: New test.
+
+2025-06-11 Martin Uecker <uecker@tugraz.at>
+
+ PR c/120510
+ * gcc.dg/old-style-prom-4.c: New test.
+
+2025-06-11 Edwin Lu <ewlu@rivosinc.com>
+
+ * gcc.target/riscv/rvv/vsetvl/pr117974.c: New test.
+
+2025-06-11 Paul-Antoine Arras <parras@baylibre.com>
+
+ PR target/119100
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfnmadd and
+ vfnmsub.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h: Add support for neg
+ variants. Fix sign for sub.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h: Add data for neg
+ variants. Fix data for sub.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h: Rename x to f.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c: Add neg
+ argument.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c: New test.
+
+2025-06-11 Martin Uecker <uecker@tugraz.at>
+
+ PR c/120303
+ * gcc.dg/pr120303.c: New test.
+
+2025-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/90693
+ * gcc.target/i386/pr90693-3.c: New test.
+ * gcc.target/i386/pr90693-4.c: New test.
+ * gcc.target/i386/pr90693-5.c: New test.
+ * gcc.target/i386/pr90693-6.c: New test.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/116792
+ * gcc.dg/html-output/missing-semicolon.py: Update for changes
+ to diagnostic elements.
+ * gcc.dg/format/diagnostic-ranges-html.py: Likewise.
+ * gcc.dg/plugin/diagnostic-test-metadata-html.py: Likewise. Drop
+ out-of-date comment.
+ * gcc.dg/plugin/diagnostic-test-paths-2.py: Likewise.
+ * gcc.dg/plugin/diagnostic-test-paths-4.py: Likewise. Drop
+ out-of-date comment.
+ * gcc.dg/plugin/diagnostic-test-show-locus.py: Likewise.
+ * lib/htmltest.py (get_diag_by_index): Update to use search by id.
+ (get_message_within_diag): Update to use search by class.
+
+2025-06-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/120610
+ * gcc.dg/format/diagnostic-ranges-html.py: Remove out-of-date
+ comment.
+
+2025-06-10 Vineet Gupta <vineetg@rivosinc.com>
+
+ * gcc.target/riscv/rvv/vtype-call-clobbered.c: Fix -mabi.
+
+2025-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * gcc.target/i386/pr120434-2.c: New test.
+
+2025-06-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120434
+ * gcc.target/i386/pr120434-1.c: New test.
+
+2025-06-10 Jeff Law <jlaw@ventanamicro.com>
+
+ * gcc.target/riscv/ventana-16122.c: New test.
+
+2025-06-10 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c: Add asm check
+ for vremu.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c: Ditto.
+
+2025-06-10 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check
+ for vremu.vx combine.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
+ data for run test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c: New test.
+
+2025-06-10 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Adjust the
+ asm check for vremu.
+ * gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto.
+
2025-06-09 Martin Uecker <uecker@tugraz.at>
PR c/120510
diff --git a/gcc/testsuite/c-c++-common/pragma-optimize-1.c b/gcc/testsuite/c-c++-common/pragma-optimize-1.c
new file mode 100644
index 0000000..1446e5a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pragma-optimize-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+/* PR c++/48026 */
+/* Make sure `#pragma GCC optimize` affects the pre-defined macros too */
+
+#pragma GCC optimize ("no-fast-math")
+#ifdef __FAST_MATH__
+# error Hey yo, What you doing on FAST_MATH??
+#endif
diff --git a/gcc/testsuite/g++.dg/opt/pr120629.C b/gcc/testsuite/g++.dg/opt/pr120629.C
new file mode 100644
index 0000000..70a9cdd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr120629.C
@@ -0,0 +1,53 @@
+// PR middle-end/120629
+// { dg-do run }
+// { dg-options "-O2 -fprofile-generate -fno-exceptions -fno-rtti" }
+// { dg-require-profiling "-fprofile-generate" }
+
+__attribute__((noipa, noreturn, cold)) void
+foo (const char *, int, const char *)
+{
+ __builtin_abort ();
+}
+
+struct S
+{
+ __attribute__((noipa)) void bar (void *);
+ static const int a = 8;
+ unsigned int b[a + 1];
+};
+
+__attribute__((noipa)) unsigned long
+baz (void *)
+{
+ static int x = 8;
+ return --x;
+}
+
+__attribute__((noipa)) void
+S::bar (void *x)
+{
+ unsigned int c;
+ int k = 0;
+
+ do
+ {
+ ((void) (!(k <= a) ? foo ("foo", 42, __FUNCTION__), 0 : 0));
+ c = b[k++] = baz (x);
+ }
+ while (c);
+ while (k <= a)
+ b[k++] = 0;
+}
+
+int
+main ()
+{
+ struct T { S a; unsigned int b; } s = {};
+ s.b = 0x1234;
+ s.a.bar (0);
+ for (int i = 0; i < 9; ++i)
+ if (s.a.b[i] != (i == 8 ? 0 : 7 - i))
+ __builtin_abort ();
+ if (s.b != 0x1234)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C b/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C
new file mode 100644
index 0000000..2f360cf
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/vect-pragma-target-1.C
@@ -0,0 +1,6 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */
+#include "../../gcc.target/i386/vect-pragma-target-1.c"
diff --git a/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C b/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C
new file mode 100644
index 0000000..b85bc93
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/vect-pragma-target-2.C
@@ -0,0 +1,6 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */
+#include "../../gcc.target/i386/vect-pragma-target-2.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120630.c b/gcc/testsuite/gcc.c-torture/execute/pr120630.c
new file mode 100644
index 0000000..46cfac9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr120630.c
@@ -0,0 +1,29 @@
+/* PR middle-end/120630 */
+
+__attribute__((noipa)) int
+foo (const char *x, ...)
+{
+ return *x;
+}
+
+int a, b, c;
+unsigned d = 1;
+
+int
+main ()
+{
+ if (a)
+ foo ("0");
+ int e = -1;
+ if (a < 1)
+ {
+ e = c;
+ if (c)
+ while (1)
+ ;
+ }
+ b = (~e + 0UL) / -1;
+ if (d > b)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py
index 91383d6..b0b59d9 100644
--- a/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py
+++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges-html.py
@@ -19,17 +19,20 @@ def test_message(html_tree):
diag = get_diag_by_index(html_tree, 0)
msg = get_message_within_diag(diag)
- assert_tag(msg[0], 'span')
- assert_class(msg[0], 'gcc-quoted-text')
- assert_highlighted_text(msg[0][0], 'highlight-a', '%i')
-
+ assert_tag(msg[0], 'strong')
+ assert msg[0].text == 'warning: '
+
assert_tag(msg[1], 'span')
assert_class(msg[1], 'gcc-quoted-text')
- assert_highlighted_text(msg[1][0], 'highlight-a', 'int')
+ assert_highlighted_text(msg[1][0], 'highlight-a', '%i')
assert_tag(msg[2], 'span')
assert_class(msg[2], 'gcc-quoted-text')
- assert_highlighted_text(msg[2][0], 'highlight-b', 'const char *')
+ assert_highlighted_text(msg[2][0], 'highlight-a', 'int')
+
+ assert_tag(msg[3], 'span')
+ assert_class(msg[3], 'gcc-quoted-text')
+ assert_highlighted_text(msg[3][0], 'highlight-b', 'const char *')
def test_annotations(html_tree):
"""
@@ -74,26 +77,3 @@ def test_annotations(html_tree):
assert_class(tds[1], 'annotation')
assert_highlighted_text(tds[1][0], 'highlight-a', 'int')
assert_highlighted_text(tds[1][1], 'highlight-b', 'const char *')
-
-# For reference, here's the generated HTML:
-"""
- <span class="gcc-message" id="gcc-diag-0-message">format &apos;<span class="gcc-quoted-text"><span class="high
-light-a">%i</span></span>&apos; expects argument of type &apos;<span class="gcc-quoted-text"><span class="highlight-a"
->int</span></span>&apos;, but argument 2 has type &apos;<span class="gcc-quoted-text"><span class="highlight-b">const
-char *</span></span>&apos;</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(&quot;hello <span class="highlight-a">%i</span>&quot;, <span class="highlight-b">msg</span>); /* { dg-warning &quot;format &apos;%i&apos; expects argument of type &apos;int&apos;, but argument 2 has type &apos;const char \\*&apos; &quot; } */</td></tr>
- <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">~^</spa
-n> <span class="highlight-b">~~~</span></td></tr>
- <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">|</spa
-n> <span class="highlight-b">|</span></td></tr>
- <tr><td class="left-margin"> </td><td class="annotation"> <span class="highlight-a">int</s
-pan> <span class="highlight-b">const char *</span></td></tr>
- <tr><td class="left-margin"> </td><td class="annotation"> %s</td></tr>
- </tbody>
- </table>
-"""
diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
index 880fcc0..3adaa52 100644
--- a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
+++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
@@ -37,22 +37,68 @@ def test_basics(html_tree):
diag = diag_list.find('xhtml:div', ns)
assert diag is not None
- assert diag.attrib['class'] == 'gcc-diagnostic'
+ assert diag.attrib['class'] == 'alert alert-danger'
+ assert diag.attrib['id'] == 'gcc-diag-0'
- message = diag.find('xhtml:span', ns)
+ icon = diag.find('xhtml:span', ns)
+ assert icon.attrib['class'] == 'pficon pficon-error-circle-o'
+
+ # The message line:
+ message = diag.find("./xhtml:div[@class='gcc-message']", ns)
assert message is not None
- assert message.attrib['class'] == 'gcc-message'
- assert message.text == "expected '"
- assert message[0].tag == make_tag('span')
- assert message[0].attrib['class'] == 'gcc-quoted-text'
- assert message[0].text == ';'
- assert message[0].tail == "' before '"
+ # <html:div xmlns:html="http://www.w3.org/1999/xhtml" class="gcc-message" id="gcc-diag-0-message"><html:strong>error: </html:strong> expected '<html:span class="gcc-quoted-text">;</html:span>' before '<html:span class="gcc-quoted-text">}</html:span>' token</html:div>
+ assert message[0].tag == make_tag('strong')
+ assert message[0].text == 'error: '
+ assert message[0].tail == " expected '"
assert message[1].tag == make_tag('span')
assert message[1].attrib['class'] == 'gcc-quoted-text'
- assert message[1].text == '}'
- assert message[1].tail == "' token"
+ assert message[1].text == ';'
+ assert message[1].tail == "' before '"
+ assert message[2].tag == make_tag('span')
+ assert message[2].attrib['class'] == 'gcc-quoted-text'
+ assert message[2].text == '}'
+ assert message[2].tail == "' token"
+
+ # Logical location
+ logical_loc = diag.find("./xhtml:div[@id='logical-location']", ns)
+ assert logical_loc is not None
+ assert len(logical_loc) == 2
+ assert logical_loc[0].tag == make_tag('span')
+ assert logical_loc[0].text == 'Function '
+ assert logical_loc[1].tag == make_tag('span')
+ assert logical_loc[1].text == 'missing_semicolon'
+ assert logical_loc[1].attrib['class'] == 'gcc-quoted-text'
+
+ # Physical location
+ file_ = diag.find("./xhtml:div[@id='file']", ns)
+ assert file_ is not None
+ assert len(file_) == 2
+ assert file_[0].tag == make_tag('span')
+ assert file_[0].text == 'File '
+ assert file_[1].tag == make_tag('span')
+ assert file_[1].text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c')
+
+ line = diag.find("./xhtml:div[@id='line']", ns)
+ assert line is not None
+ assert len(line) == 2
+ assert line[0].tag == make_tag('span')
+ assert line[0].text == 'Line '
+ assert line[1].tag == make_tag('span')
+ assert line[1].text == '8'
+
+ column = diag.find("./xhtml:div[@id='column']", ns)
+ assert column is not None
+ assert len(column) == 2
+ assert column[0].tag == make_tag('span')
+ assert column[0].text == 'Column '
+ assert column[1].tag == make_tag('span')
+ assert column[1].text == '12'
- pre = diag.find('xhtml:pre', ns)
+ # Suggested fix
+ fix = diag.find("./xhtml:div[@id='suggested-fix']", ns)
+ label = fix.find('xhtml:label', ns)
+ assert label.text == "Suggested fix"
+ pre = fix.find('xhtml:pre', ns)
assert pre is not None
assert pre.attrib['class'] == 'gcc-generated-patch'
assert pre.text.startswith('--- ')
diff --git a/gcc/testsuite/gcc.dg/old-style-prom-4.c b/gcc/testsuite/gcc.dg/old-style-prom-4.c
new file mode 100644
index 0000000..3632fa6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/old-style-prom-4.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu17" } */
+
+int g(float a, float b);
+int g(a, b)
+ float a;
+ float b;
+{
+}
+
+int f(float a, float (*b)()); /* { dg-error "prototype declaration" } */
+
+int f(a, b)
+ float a;
+ float (*b)(float); /* { dg-error "match prototype" } */
+{
+}
+
+int (*e(float a))(float (*b)());
+
+int (*e(a))(float (*b)(float)) /* { dg-error "conflicting types" } */
+ float a;
+{
+}
+
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py
index b4c75b2..67fb241 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py
@@ -21,10 +21,24 @@ def test_metadata(html_tree):
diag = diag_list.find('xhtml:div', ns)
assert diag is not None
- assert diag.attrib['class'] == 'gcc-diagnostic'
+ assert diag.attrib['class'] == 'alert alert-warning'
- spans = diag.findall('xhtml:span', ns)
- metadata = spans[1]
+ icon = diag.find('xhtml:span', ns)
+ assert icon.attrib['class'] == 'pficon pficon-warning-triangle-o'
+
+ message = diag.find("./xhtml:div[@class='gcc-message']", ns)
+ assert message.attrib['id'] == 'gcc-diag-0-message'
+
+ assert message[0].tag == make_tag('strong')
+ assert message[0].text == 'warning: '
+ assert message[0].tail == " never use '"
+
+ assert message[1].tag == make_tag('span')
+ assert message[1].attrib['class'] == 'gcc-quoted-text'
+ assert message[1].text == 'gets'
+ assert message[1].tail == "' "
+
+ metadata = message[2]
assert metadata.attrib['class'] == 'gcc-metadata'
assert metadata[0].tag == make_tag('span')
assert metadata[0].attrib['class'] == 'gcc-metadata-item'
@@ -57,21 +71,3 @@ def test_metadata(html_tree):
annotation_tr = rows[1]
assert_annotation_line(annotation_tr,
' ^~~~~~~~~~')
-
-# For reference, here's the generated HTML:
-"""
- <body>
- <div class="gcc-diagnostic-list">
- <div class="gcc-diagnostic">
- <span class="gcc-message">never use &apos;<span class="gcc-quoted-text">gets</span>&apos;</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/pr120630.c b/gcc/testsuite/gcc.dg/pr120630.c
new file mode 100644
index 0000000..14b0aaf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120630.c
@@ -0,0 +1,25 @@
+/* PR middle-end/120630 */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch" } */
+
+int a, c, d;
+
+void
+foo (int b)
+{
+ a = b;
+}
+
+int
+main ()
+{
+ while (d)
+ ;
+ for (c = 0; c > -3; c--)
+ {
+ long f = c;
+ foo (f >> 2);
+ }
+ if (a != -1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr120638.c b/gcc/testsuite/gcc.dg/pr120638.c
new file mode 100644
index 0000000..4a057a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120638.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/120638 */
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern float sqrtf (float x);
+
+__attribute__((noipa)) float
+foo (unsigned int s)
+{
+ return 0.5f / sqrtf (1.f + s);
+}
+
+__attribute__((noipa)) float
+bar (float s)
+{
+ if (s < 0.0 || s > 65535.0f)
+ __builtin_unreachable ();
+ return 0.5f / sqrtf (1.f + s);
+}
+
+int
+main ()
+{
+ if (__builtin_fabsf (foo (3) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (foo (15) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (foo (63) - 0.0625f) > 0.00390625f
+ || __builtin_fabsf (bar (3.0f) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (bar (15.0f) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (bar (63.0f) - 0.0625f) > 0.00390625f)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c
index 13d7e13..05e8622 100644
--- a/gcc/testsuite/gcc.dg/torture/pr117811.c
+++ b/gcc/testsuite/gcc.dg/torture/pr117811.c
@@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
int main ()
{
+#if __SIZEOF_INT__ >= 4
v4 vec = {0x1000000, 0x2000, 0x300, 0x40};
v4 vec2 = {0x100000, 0x200, 0x30, 0x4};
+#else
+ v4 vec = {0x4000, 0x2000, 0x300, 0x40};
+ v4 vec2 = {0x400, 0x200, 0x30, 0x4};
+#endif
do_shift (&vec, 4);
if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
__builtin_abort ();
diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c
new file mode 100644
index 0000000..38bc134
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c
@@ -0,0 +1,21 @@
+// { dg-options "-O -fno-optimize-sibling-calls -fomit-frame-pointer" }
+
+#include <arm_sme.h>
+
+void callee();
+
+__arm_new("za") __arm_locally_streaming int test()
+{
+ svbool_t all = svptrue_b8();
+ svint8_t expected = svindex_s8(1, 1);
+ svwrite_hor_za8_m(0, 0, all, expected);
+
+ callee();
+
+ svint8_t actual = svread_hor_za8_m(svdup_s8(0), all, 0, 0);
+ return svptest_any(all, svcmpne(all, expected, actual));
+}
+
+// { dg-final { scan-assembler {\tbl\t__arm_tpidr2_save\n} } }
+// { dg-final { scan-assembler {\tbl\t__arm_tpidr2_restore\n} } }
+// { dg-final { scan-assembler-times {\tsmstart\tza\n} 2 } }
diff --git a/gcc/testsuite/gcc.target/i386/pr120434-2.c b/gcc/testsuite/gcc.target/i386/pr120434-2.c
new file mode 100644
index 0000000..4381e3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr120434-2.c
@@ -0,0 +1,15 @@
+/* PR middle-end/120434 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -mtune=generic -masm=att" } */
+/* { dg-final { scan-assembler-not "\tmovslq\t%edi, %rdi" } } */
+/* { dg-final { scan-assembler "\tmovl\t%edi, %edi" } } */
+
+extern unsigned long long foo (unsigned long long x);
+
+unsigned long long
+bar (int x)
+{
+ if (x < 50)
+ return 0;
+ return foo (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr90693-3.c b/gcc/testsuite/gcc.target/i386/pr90693-3.c
new file mode 100644
index 0000000..601c83c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90693-3.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/90693 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mpopcnt" } */
+
+#include "pr90693.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr90693-4.c b/gcc/testsuite/gcc.target/i386/pr90693-4.c
new file mode 100644
index 0000000..b149159
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90693-4.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/90693 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mpopcnt" } */
+
+#include "pr90693-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr90693-5.c b/gcc/testsuite/gcc.target/i386/pr90693-5.c
new file mode 100644
index 0000000..0a6a637
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90693-5.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/90693 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabm" } */
+
+#include "pr90693.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr90693-6.c b/gcc/testsuite/gcc.target/i386/pr90693-6.c
new file mode 100644
index 0000000..4040b52
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90693-6.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/90693 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabm" } */
+
+#include "pr90693-2.c"
diff --git a/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c b/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c
new file mode 100644
index 0000000..f5e71e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-pragma-target-1.c
@@ -0,0 +1,194 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */
+#ifndef CHECK_DEFINES
+#define CHECK_DEFINES 0
+#endif
+
+#define N 1024
+
+/* Optimization flags and tree vectorizer shall be disabled at this point */
+#if CHECK_DEFINES && defined(__OPTIMIZE__)
+#error "__OPTIMIZE__ is defined (not compiled with -O0?)"
+#endif
+
+#pragma GCC push_options
+#pragma GCC optimize ("O2", "tree-vectorize")
+
+/* Optimization flags and tree vectorizer shall be enabled at this point */
+#if CHECK_DEFINES && !defined(__OPTIMIZE__)
+#error "__OPTIMIZE__ is not defined"
+#endif
+
+#pragma GCC push_options
+#pragma GCC target ("sse4.2")
+#ifdef __cplusplus
+namespace {
+#endif
+
+/* Target flags up to including SSE4.2 shall be enabled at this point */
+#if CHECK_DEFINES && !defined(__SSE3__)
+#error "Target flag (SSE3) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSSE3__)
+#error "Target flag (SSSE3) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSE4_1__)
+#error "Target flag (SSE4.1) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSE4_2__)
+#error "Target flag (SSE4.2) is not defined"
+#endif
+
+void
+__attribute__((__noinline__, __used__))
+vec_saxpy_i32(int y[N], const int a[N], const int x[N])
+{
+ int i;
+ for (i = 0; i < N; i++)
+ y[i] += a[i] * x[i];
+}
+
+#ifdef __cplusplus
+}
+#endif
+#pragma GCC pop_options
+
+/* Target flags up to including SSE4.2 shall be disabled at this point */
+#if CHECK_DEFINES && defined(__SSE3__)
+#error "Target flag (SSE3) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSSE3__)
+#error "Target flag (SSSE3) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSE4_1__)
+#error "Target flag (SSE4.1) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSE4_2__)
+#error "Target flag (SSE4.2) is still defined"
+#endif
+
+#pragma GCC push_options
+#pragma GCC target ("avx2", "fma")
+#ifdef __cplusplus
+struct A {
+#endif
+
+/* Target flags up to including AVX2+FMA shall be enabled at this point */
+#if CHECK_DEFINES && !defined(__SSE3__)
+#error "Target flag (SSE3) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSSE3__)
+#error "Target flag (SSSE3) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSE4_1__)
+#error "Target flag (SSE4.1) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__SSE4_2__)
+#error "Target flag (SSE4.2) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__AVX__)
+#error "Target flag (AVX) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__AVX2__)
+#error "Target flag (AVX2) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__FMA__)
+#error "Target flag (FMA) is not defined"
+#endif
+
+void
+__attribute__((__noinline__, __used__))
+vec_saxpy_f32(float y[N], const float a[N], const float x[N])
+{
+ int i;
+ for (i = 0; i < N; i++)
+ y[i] += a[i] * x[i];
+}
+
+#ifdef __cplusplus
+};
+#endif
+#pragma GCC pop_options
+
+/* Target flags up to including AVX2+FMA shall be disabled at this point */
+#if CHECK_DEFINES && defined(__SSE3__)
+#error "Target flag (SSE3) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSSE3__)
+#error "Target flag (SSSE3) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSE4_1__)
+#error "Target flag (SSE4.1) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__SSE4_2__)
+#error "Target flag (SSE4.2) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__AVX__)
+#error "Target flag (AVX) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__AVX2__)
+#error "Target flag (AVX2) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__FMA__)
+#error "Target flag (FMA) is still defined"
+#endif
+
+#pragma GCC push_options
+#pragma GCC target ("arch=x86-64-v4")
+#ifdef __cplusplus
+namespace avx512 {
+struct A {
+#endif
+
+/* Essential AVX512 target flags shall be enabled at this point */
+#if CHECK_DEFINES && !defined(__AVX512F__)
+#error "Target flag (AVX512F) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__AVX512VL__)
+#error "Target flag (AVX512VL) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__AVX512DQ__)
+#error "Target flag (AVX512DQ) is not defined"
+#endif
+#if CHECK_DEFINES && !defined(__AVX512BW__)
+#error "Target flag (AVX512BW) is not defined"
+#endif
+
+void
+__attribute__((__noinline__, __used__))
+vec_saxpy_i16(short y[N], const short a[N], const short x[N])
+{
+ int i;
+ for (i = 0; i < N; i++)
+ y[i] += a[i] * x[i];
+}
+
+#ifdef __cplusplus
+};
+}
+#endif
+#pragma GCC pop_options
+
+/* Essential AVX512 target flags shall be disabled at this point */
+#if CHECK_DEFINES && defined(__AVX512F__)
+#error "Target flag (AVX512F) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__AVX512VL__)
+#error "Target flag (AVX512VL) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__AVX512DQ__)
+#error "Target flag (AVX512DQ) is still defined"
+#endif
+#if CHECK_DEFINES && defined(__AVX512BW__)
+#error "Target flag (AVX512BW) is still defined"
+#endif
+
+#pragma GCC pop_options
+
+/* Optimization flags and tree vectorizer shall be disabled at this point */
+#if CHECK_DEFINES && defined(__OPTIMIZE__)
+#error "__OPTIMIZE__ is still defined"
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c b/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c
new file mode 100644
index 0000000..3496804
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-pragma-target-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler-times "paddd.+xmm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vfmadd132ps.+ymm\[0-9]+" 1 } } */
+/* { dg-final { scan-assembler-times "vpaddw.+zmm\[0-9]+" 1 } } */
+#define CHECK_DEFINES 1
+#include "vect-pragma-target-1.c"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c
index 821e5c5..09f4b71 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(_Float16, +, add)
-DEF_VF_MULOP_CASE_0(_Float16, -, sub)
+DEF_VF_MULOP_CASE_0 (_Float16, +, +, add)
+DEF_VF_MULOP_CASE_0 (_Float16, -, +, sub)
+DEF_VF_MULOP_CASE_0 (_Float16, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (_Float16, -, -, nsub)
/* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */
/* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c
index 49b4287..b21ae49 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(float, +, add)
-DEF_VF_MULOP_CASE_0(float, -, sub)
+DEF_VF_MULOP_CASE_0 (float, +, +, add)
+DEF_VF_MULOP_CASE_0 (float, -, +, sub)
+DEF_VF_MULOP_CASE_0 (float, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (float, -, -, nsub)
/* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */
/* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c
index 2bb5d89..56a44dd 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(double, +, add)
-DEF_VF_MULOP_CASE_0(double, -, sub)
+DEF_VF_MULOP_CASE_0 (double, +, +, add)
+DEF_VF_MULOP_CASE_0 (double, -, +, sub)
+DEF_VF_MULOP_CASE_0 (double, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (double, -, -, nsub)
/* { dg-final { scan-assembler-times {vfmadd.vf} 1 } } */
/* { dg-final { scan-assembler-times {vfmsub.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmadd.vf} 1 } } */
+/* { dg-final { scan-assembler-times {vfnmsub.vf} 1 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c
index cbb43ca..22180cb 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(_Float16, +, add)
-DEF_VF_MULOP_CASE_0(_Float16, -, sub)
+DEF_VF_MULOP_CASE_0 (_Float16, +, +, add)
+DEF_VF_MULOP_CASE_0 (_Float16, -, +, sub)
+DEF_VF_MULOP_CASE_0 (_Float16, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (_Float16, -, -, nsub)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c
index 66ff9b8..318c281 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(float, +, add)
-DEF_VF_MULOP_CASE_0(float, -, sub)
+DEF_VF_MULOP_CASE_0 (float, +, +, add)
+DEF_VF_MULOP_CASE_0 (float, -, +, sub)
+DEF_VF_MULOP_CASE_0 (float, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (float, -, -, nsub)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c
index 66ff9b8..318c281 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_0(float, +, add)
-DEF_VF_MULOP_CASE_0(float, -, sub)
+DEF_VF_MULOP_CASE_0 (float, +, +, add)
+DEF_VF_MULOP_CASE_0 (float, -, +, sub)
+DEF_VF_MULOP_CASE_0 (float, +, -, nadd)
+DEF_VF_MULOP_CASE_0 (float, -, -, nsub)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c
index 45980f4..382f7ef5 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(_Float16, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(_Float16, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler {vfmadd.vf} } } */
/* { dg-final { scan-assembler {vfmsub.vf} } } */
+/* { dg-final { scan-assembler {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c
index c853620..db2cd2e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(float, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(float, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler {vfmadd.vf} } } */
/* { dg-final { scan-assembler {vfmsub.vf} } } */
+/* { dg-final { scan-assembler {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c
index d38ae8b..423b4db 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(double, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(double, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler {vfmadd.vf} } } */
/* { dg-final { scan-assembler {vfmsub.vf} } } */
+/* { dg-final { scan-assembler {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c
index f1ca34e..1482ff0 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(_Float16, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(_Float16, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (_Float16, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c
index 6730d4b..d1368e7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(float, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(float, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (float, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c
index bcb6a6e..8e4bdd4 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c
@@ -3,8 +3,12 @@
#include "vf_mulop.h"
-DEF_VF_MULOP_CASE_1(double, +, add, VF_MULOP_BODY_X16)
-DEF_VF_MULOP_CASE_1(double, -, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, +, +, add, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, -, +, sub, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, +, -, nadd, VF_MULOP_BODY_X16)
+DEF_VF_MULOP_CASE_1 (double, -, -, nsub, VF_MULOP_BODY_X16)
/* { dg-final { scan-assembler-not {vfmadd.vf} } } */
/* { dg-final { scan-assembler-not {vfmsub.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmadd.vf} } } */
+/* { dg-final { scan-assembler-not {vfnmsub.vf} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h
index 5253978..433a16e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h
@@ -3,59 +3,63 @@
#include <stdint.h>
-#define DEF_VF_MULOP_CASE_0(T, OP, NAME) \
- void test_vf_mulop_##NAME##_##T##_case_0(T *restrict out, T *restrict in, \
- T x, unsigned n) { \
+#define DEF_VF_MULOP_CASE_0(T, OP, NEG, NAME) \
+ void test_vf_mulop_##NAME##_##T##_case_0 (T *restrict out, T *restrict in, \
+ T f, unsigned n) \
+ { \
for (unsigned i = 0; i < n; i++) \
- out[i] = in[i] OP out[i] * x; \
+ out[i] = NEG (f * out[i] OP in[i]); \
}
-#define DEF_VF_MULOP_CASE_0_WRAP(T, OP, NAME) DEF_VF_MULOP_CASE_0(T, OP, NAME)
+#define DEF_VF_MULOP_CASE_0_WRAP(T, OP, NEG, NAME) \
+ DEF_VF_MULOP_CASE_0 (T, OP, NEG, NAME)
#define RUN_VF_MULOP_CASE_0(T, NAME, out, in, x, n) \
test_vf_mulop_##NAME##_##T##_case_0(out, in, x, n)
#define RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n) \
RUN_VF_MULOP_CASE_0(T, NAME, out, in, x, n)
-#define VF_MULOP_BODY(op) \
- out[k + 0] = in[k + 0] op tmp * out[k + 0]; \
- out[k + 1] = in[k + 1] op tmp * out[k + 1]; \
+#define VF_MULOP_BODY(op, neg) \
+ out[k + 0] = neg (tmp * out[k + 0] op in[k + 0]); \
+ out[k + 1] = neg (tmp * out[k + 1] op in[k + 1]); \
k += 2;
-#define VF_MULOP_BODY_X4(op) \
- VF_MULOP_BODY(op) \
- VF_MULOP_BODY(op)
+#define VF_MULOP_BODY_X4(op, neg) \
+ VF_MULOP_BODY (op, neg) \
+ VF_MULOP_BODY (op, neg)
-#define VF_MULOP_BODY_X8(op) \
- VF_MULOP_BODY_X4(op) \
- VF_MULOP_BODY_X4(op)
+#define VF_MULOP_BODY_X8(op, neg) \
+ VF_MULOP_BODY_X4 (op, neg) \
+ VF_MULOP_BODY_X4 (op, neg)
-#define VF_MULOP_BODY_X16(op) \
- VF_MULOP_BODY_X8(op) \
- VF_MULOP_BODY_X8(op)
+#define VF_MULOP_BODY_X16(op, neg) \
+ VF_MULOP_BODY_X8 (op, neg) \
+ VF_MULOP_BODY_X8 (op, neg)
-#define VF_MULOP_BODY_X32(op) \
- VF_MULOP_BODY_X16(op) \
- VF_MULOP_BODY_X16(op)
+#define VF_MULOP_BODY_X32(op, neg) \
+ VF_MULOP_BODY_X16 (op, neg) \
+ VF_MULOP_BODY_X16 (op, neg)
-#define VF_MULOP_BODY_X64(op) \
- VF_MULOP_BODY_X32(op) \
- VF_MULOP_BODY_X32(op)
+#define VF_MULOP_BODY_X64(op, neg) \
+ VF_MULOP_BODY_X32 (op, neg) \
+ VF_MULOP_BODY_X32 (op, neg)
-#define VF_MULOP_BODY_X128(op) \
- VF_MULOP_BODY_X64(op) \
- VF_MULOP_BODY_X64(op)
+#define VF_MULOP_BODY_X128(op, neg) \
+ VF_MULOP_BODY_X64 (op, neg) \
+ VF_MULOP_BODY_X64 (op, neg)
-#define DEF_VF_MULOP_CASE_1(T, OP, NAME, BODY) \
- void test_vf_mulop_##NAME##_##T##_case_1(T *restrict out, T *restrict in, \
- T x, unsigned n) { \
+#define DEF_VF_MULOP_CASE_1(T, OP, NEG, NAME, BODY) \
+ void test_vf_mulop_##NAME##_##T##_case_1 (T *restrict out, T *restrict in, \
+ T x, unsigned n) \
+ { \
unsigned k = 0; \
T tmp = x + 3; \
\
- while (k < n) { \
- tmp = tmp * 0x3f; \
- BODY(OP) \
- } \
+ while (k < n) \
+ { \
+ tmp = tmp * 0x3f; \
+ BODY (OP, NEG) \
+ } \
}
-#define DEF_VF_MULOP_CASE_1_WRAP(T, OP, NAME, BODY) \
- DEF_VF_MULOP_CASE_1(T, OP, NAME, BODY)
+#define DEF_VF_MULOP_CASE_1_WRAP(T, OP, NEG, NAME, BODY) \
+ DEF_VF_MULOP_CASE_1 (T, OP, NEG, NAME, BODY)
#endif
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h
index c16c1a9..ffa3d28 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h
@@ -211,6 +211,408 @@ double TEST_MULOP_DATA(double, add)[][4][N] =
_Float16 TEST_MULOP_DATA(_Float16, sub)[][4][N] =
{
{
+ { 5.94f16 },
+ {
+ -20.1f16, -20.1f16, -20.1f16, -20.1f16,
+ -13.1f16, -13.1f16, -13.1f16, -13.1f16,
+ -8.92f16, -8.92f16, -8.92f16, -8.92f16,
+ -43.1f16, -43.1f16, -43.1f16, -43.1f16,
+ },
+ {
+ 7.44f16, 7.44f16, 7.44f16, 7.44f16,
+ 5.9f16, 5.9f16, 5.9f16, 5.9f16,
+ 6.81f16, 6.81f16, 6.81f16, 6.81f16,
+ 9.03f16, 9.03f16, 9.03f16, 9.03f16,
+ },
+ {
+ 64.2f16, 64.2f16, 64.2f16, 64.2f16,
+ 48.1f16, 48.1f16, 48.1f16, 48.1f16,
+ 49.4f16, 49.4f16, 49.4f16, 49.4f16,
+ 96.7f16, 96.7f16, 96.7f16, 96.7f16,
+ }
+ },
+ {
+ { 0.0475f16 },
+ {
+ -0.0965f16, -0.0965f16, -0.0965f16, -0.0965f16,
+ -0.23f16, -0.23f16, -0.23f16, -0.23f16,
+ -0.267f16, -0.267f16, -0.267f16, -0.267f16,
+ -0.455f16, -0.455f16, -0.455f16, -0.455f16,
+ },
+ {
+ 0.0748f16, 0.0748f16, 0.0748f16, 0.0748f16,
+ 0.0372f16, 0.0372f16, 0.0372f16, 0.0372f16,
+ 0.0183f16, 0.0183f16, 0.0183f16, 0.0183f16,
+ 0.0411f16, 0.0411f16, 0.0411f16, 0.0411f16,
+ },
+ {
+ 0.1f16, 0.1f16, 0.1f16, 0.1f16,
+ 0.232f16, 0.232f16, 0.232f16, 0.232f16,
+ 0.268f16, 0.268f16, 0.268f16, 0.268f16,
+ 0.457f16, 0.457f16, 0.457f16, 0.457f16,
+ }
+ },
+ {
+ { 2.46e+01f16 },
+ {
+ -1.46e+02f16, -1.46e+02f16, -1.46e+02f16, -1.46e+02f16,
+ 3.66e+02f16, 3.66e+02f16, 3.66e+02f16, 3.66e+02f16,
+ 3.47e+02f16, 3.47e+02f16, 3.47e+02f16, 3.47e+02f16,
+ 6.24e+02f16, 6.24e+02f16, 6.24e+02f16, 6.24e+02f16,
+ },
+ {
+ 6.17e+00f16, 6.17e+00f16, 6.17e+00f16, 6.17e+00f16,
+ 2.46e+01f16, 2.46e+01f16, 2.46e+01f16, 2.46e+01f16,
+ 1.99e+01f16, 1.99e+01f16, 1.99e+01f16, 1.99e+01f16,
+ 3.29e+01f16, 3.29e+01f16, 3.29e+01f16, 3.29e+01f16,
+ },
+ {
+ 2.97e+02f16, 2.97e+02f16, 2.97e+02f16, 2.97e+02f16,
+ 2.39e+02f16, 2.39e+02f16, 2.39e+02f16, 2.39e+02f16,
+ 1.42e+02f16, 1.42e+02f16, 1.42e+02f16, 1.42e+02f16,
+ 1.85e+02f16, 1.85e+02f16, 1.85e+02f16, 1.85e+02f16,
+ }
+ },
+};
+
+float TEST_MULOP_DATA(float, sub)[][4][N] =
+{
+ {
+ { 5.96f },
+ {
+ 7.74f, 7.74f, 7.74f, 7.74f,
+ -57.f, -57.f, -57.f, -57.f,
+ 32.7f, 32.7f, 32.7f, 32.7f,
+ 2.44f, 2.44f, 2.44f, 2.44f,
+ },
+ {
+ 7.37f, 7.37f, 7.37f, 7.37f,
+ 5.6f, 5.6f, 5.6f, 5.6f,
+ 9.07f, 9.07f, 9.07f, 9.07f,
+ 2.87f, 2.87f, 2.87f, 2.87f,
+ },
+ {
+ 36.2f, 36.2f, 36.2f, 36.2f,
+ 90.4f, 90.4f, 90.4f, 90.4f,
+ 21.3f, 21.3f, 21.3f, 21.3f,
+ 14.6f, 14.6f, 14.6f, 14.6f,
+ }
+ },
+ {
+ { 3.00e-02f },
+ {
+ -2.83e-01f, -2.83e-01f, -2.83e-01f, -2.83e-01f,
+ -5.37e-01f, -5.37e-01f, -5.37e-01f, -5.37e-01f,
+ -7.87e-01f, -7.87e-01f, -7.87e-01f, -7.87e-01f,
+ -3.65e-01f, -3.65e-01f, -3.65e-01f, -3.65e-01f,
+ },
+ {
+ 8.84e-02f, 8.84e-02f, 8.84e-02f, 8.84e-02f,
+ 9.27e-02f, 9.27e-02f, 9.27e-02f, 9.27e-02f,
+ 6.51e-02f, 6.51e-02f, 6.51e-02f, 6.51e-02f,
+ 5.67e-02f, 5.67e-02f, 5.67e-02f, 5.67e-02f,
+ },
+ {
+ 2.86e-01f, 2.86e-01f, 2.86e-01f, 2.86e-01f,
+ 5.40e-01f, 5.40e-01f, 5.40e-01f, 5.40e-01f,
+ 7.89e-01f, 7.89e-01f, 7.89e-01f, 7.89e-01f,
+ 3.67e-01f, 3.67e-01f, 3.67e-01f, 3.67e-01f,
+ }
+ },
+ {
+ { 9.04e+01f },
+ {
+ 2.76e+03f, 2.76e+03f, 2.76e+03f, 2.76e+03f,
+ 1.05e+03f, 1.05e+03f, 1.05e+03f, 1.05e+03f,
+ 5.17e+03f, 5.17e+03f, 5.17e+03f, 5.17e+03f,
+ 3.91e+03f, 3.91e+03f, 3.91e+03f, 3.91e+03f,
+ },
+ {
+ 3.99e+01f, 3.99e+01f, 3.99e+01f, 3.99e+01f,
+ 1.38e+01f, 1.38e+01f, 1.38e+01f, 1.38e+01f,
+ 6.36e+01f, 6.36e+01f, 6.36e+01f, 6.36e+01f,
+ 4.77e+01f, 4.77e+01f, 4.77e+01f, 4.77e+01f,
+ },
+ {
+ 8.39e+02f, 8.39e+02f, 8.39e+02f, 8.39e+02f,
+ 1.97e+02f, 1.97e+02f, 1.97e+02f, 1.97e+02f,
+ 5.77e+02f, 5.77e+02f, 5.77e+02f, 5.77e+02f,
+ 4.02e+02f, 4.02e+02f, 4.02e+02f, 4.02e+02f,
+ }
+ },
+};
+
+double TEST_MULOP_DATA(double, sub)[][4][N] =
+{
+ {
+ { 1.69e+01 },
+ {
+ 8.58e+02, 8.58e+02, 8.58e+02, 8.58e+02,
+ 2.87e+02, 2.87e+02, 2.87e+02, 2.87e+02,
+ 4.35e+02, 4.35e+02, 4.35e+02, 4.35e+02,
+ -6.35e+01, -6.35e+01, -6.35e+01, -6.35e+01,
+ },
+ {
+ 8.02e+01, 8.02e+01, 8.02e+01, 8.02e+01,
+ 7.51e+01, 7.51e+01, 7.51e+01, 7.51e+01,
+ 5.85e+01, 5.85e+01, 5.85e+01, 5.85e+01,
+ 1.65e+01, 1.65e+01, 1.65e+01, 1.65e+01,
+ },
+ {
+ 4.95e+02, 4.95e+02, 4.95e+02, 4.95e+02,
+ 9.80e+02, 9.80e+02, 9.80e+02, 9.80e+02,
+ 5.51e+02, 5.51e+02, 5.51e+02, 5.51e+02,
+ 3.42e+02, 3.42e+02, 3.42e+02, 3.42e+02,
+ }
+ },
+ {
+ { 8.86e-10 },
+ {
+ -8.82e-09, -8.82e-09, -8.82e-09, -8.82e-09,
+ -3.09e-09, -3.09e-09, -3.09e-09, -3.09e-09,
+ -4.87e-09, -4.87e-09, -4.87e-09, -4.87e-09,
+ -5.70e-09, -5.70e-09, -5.70e-09, -5.70e-09,
+ },
+ {
+ 9.72e-10, 9.72e-10, 9.72e-10, 9.72e-10,
+ 5.78e-10, 5.78e-10, 5.78e-10, 5.78e-10,
+ 1.10e-10, 1.10e-10, 1.10e-10, 1.10e-10,
+ 4.62e-10, 4.62e-10, 4.62e-10, 4.62e-10,
+ },
+ {
+ 8.82e-09, 8.82e-09, 8.82e-09, 8.82e-09,
+ 3.09e-09, 3.09e-09, 3.09e-09, 3.09e-09,
+ 4.87e-09, 4.87e-09, 4.87e-09, 4.87e-09,
+ 5.70e-09, 5.70e-09, 5.70e-09, 5.70e-09,
+ }
+ },
+ {
+ { 1.09e-20 },
+ {
+ -5.46e-19, -5.46e-19, -5.46e-19, -5.46e-19,
+ -2.28e-19, -2.28e-19, -2.28e-19, -2.28e-19,
+ -4.77e-19, -4.77e-19, -4.77e-19, -4.77e-19,
+ -1.76e-19, -1.76e-19, -1.76e-19, -1.76e-19,
+ },
+ {
+ 5.52e-20, 5.52e-20, 5.52e-20, 5.52e-20,
+ 2.20e-20, 2.20e-20, 2.20e-20, 2.20e-20,
+ 2.97e-20, 2.97e-20, 2.97e-20, 2.97e-20,
+ 3.23e-20, 3.23e-20, 3.23e-20, 3.23e-20,
+ },
+ {
+ 5.46e-19, 5.46e-19, 5.46e-19, 5.46e-19,
+ 2.28e-19, 2.28e-19, 2.28e-19, 2.28e-19,
+ 4.77e-19, 4.77e-19, 4.77e-19, 4.77e-19,
+ 1.76e-19, 1.76e-19, 1.76e-19, 1.76e-19,
+ }
+ },
+};
+
+_Float16 TEST_MULOP_DATA(_Float16, nadd)[][4][N] =
+{
+ {
+ { 1.09f16 },
+ {
+ -60.7f16, -60.7f16, -60.7f16, -60.7f16,
+ -25.2f16, -25.2f16, -25.2f16, -25.2f16,
+ -50.9f16, -50.9f16, -50.9f16, -50.9f16,
+ -21.1f16, -21.1f16, -21.1f16, -21.1f16,
+ },
+ {
+ 5.52f16, 5.52f16, 5.52f16, 5.52f16,
+ 2.2f16, 2.2f16, 2.2f16, 2.2f16,
+ 2.97f16, 2.97f16, 2.97f16, 2.97f16,
+ 3.23f16, 3.23f16, 3.23f16, 3.23f16,
+ },
+ {
+ 54.6f16, 54.6f16, 54.6f16, 54.6f16,
+ 22.8f16, 22.8f16, 22.8f16, 22.8f16,
+ 47.7f16, 47.7f16, 47.7f16, 47.7f16,
+ 17.6f16, 17.6f16, 17.6f16, 17.6f16,
+ }
+ },
+ {
+ { 0.794f16 },
+ {
+ -6.8f16, -6.8f16, -6.8f16, -6.8f16,
+ -6.1f16, -6.1f16, -6.1f16, -6.1f16,
+ -3.02f16, -3.02f16, -3.02f16, -3.02f16,
+ -3.15f16, -3.15f16, -3.15f16, -3.15f16,
+ },
+ {
+ 0.119f16, 0.119f16, 0.119f16, 0.119f16,
+ 0.774f16, 0.774f16, 0.774f16, 0.774f16,
+ 0.302f16, 0.302f16, 0.302f16, 0.302f16,
+ 0.784f16, 0.784f16, 0.784f16, 0.784f16,
+ },
+ {
+ 6.7f16, 6.7f16, 6.7f16, 6.7f16,
+ 5.49f16, 5.49f16, 5.49f16, 5.49f16,
+ 2.78f16, 2.78f16, 2.78f16, 2.78f16,
+ 2.52f16, 2.52f16, 2.52f16, 2.52f16,
+ }
+ },
+ {
+ { -2.62f16 },
+ {
+ 48.6f16, 48.6f16, 48.6f16, 48.6f16,
+ 28.1f16, 28.1f16, 28.1f16, 28.1f16,
+ -2.93f16, -2.93f16, -2.93f16, -2.93f16,
+ 80.6f16, 80.6f16, 80.6f16, 80.6f16,
+ },
+ {
+ -1.18f16, -1.18f16, -1.18f16, -1.18f16,
+ -7.52f16, -7.52f16, -7.52f16, -7.52f16,
+ -5.37f16, -5.37f16, -5.37f16, -5.37f16,
+ -5.39f16, -5.39f16, -5.39f16, -5.39f16,
+ },
+ {
+ -51.7f16, -51.7f16, -51.7f16, -51.7f16,
+ -47.8f16, -47.8f16, -47.8f16, -47.8f16,
+ -11.2f16, -11.2f16, -11.2f16, -11.2f16,
+ -94.8f16, -94.8f16, -94.8f16, -94.8f16,
+ }
+ },
+};
+
+float TEST_MULOP_DATA(float, nadd)[][4][N] =
+{
+ {
+ { 1.19f },
+ {
+ -21.4f, -21.4f, -21.4f, -21.4f,
+ -9.12f, -9.12f, -9.12f, -9.12f,
+ -51.1f, -51.1f, -51.1f, -51.1f,
+ -48.8f, -48.8f, -48.8f, -48.8f,
+ },
+ {
+ 3.83f, 3.83f, 3.83f, 3.83f,
+ 2.9f, 2.9f, 2.9f, 2.9f,
+ 4.63f, 4.63f, 4.63f, 4.63f,
+ 0.65f, 0.65f, 0.65f, 0.65f,
+ },
+ {
+ 16.8f, 16.8f, 16.8f, 16.8f,
+ 5.66f, 5.66f, 5.66f, 5.66f,
+ 45.5f, 45.5f, 45.5f, 45.5f,
+ 48.1f, 48.1f, 48.1f, 48.1f,
+ }
+ },
+ {
+ { 1.60e+01f },
+ {
+ -2.69e+02f, -2.69e+02f, -2.69e+02f, -2.69e+02f,
+ -5.05e+02f, -5.05e+02f, -5.05e+02f, -5.05e+02f,
+ -2.92e+02f, -2.92e+02f, -2.92e+02f, -2.92e+02f,
+ -3.91e+02f, -3.91e+02f, -3.91e+02f, -3.91e+02f,
+ },
+ {
+ 6.28e+00f, 6.28e+00f, 6.28e+00f, 6.28e+00f,
+ 1.94e+01f, 1.94e+01f, 1.94e+01f, 1.94e+01f,
+ 1.02e+01f, 1.02e+01f, 1.02e+01f, 1.02e+01f,
+ 1.60e+01f, 1.60e+01f, 1.60e+01f, 1.60e+01f,
+ },
+ {
+ 1.68e+02f, 1.68e+02f, 1.68e+02f, 1.68e+02f,
+ 1.95e+02f, 1.95e+02f, 1.95e+02f, 1.95e+02f,
+ 1.30e+02f, 1.30e+02f, 1.30e+02f, 1.30e+02f,
+ 1.35e+02f, 1.35e+02f, 1.35e+02f, 1.35e+02f,
+ }
+ },
+ {
+ { -5.63e+01f },
+ {
+ -3.59e+03f, -3.59e+03f, -3.59e+03f, -3.59e+03f,
+ -2.25e+02f, -2.25e+02f, -2.25e+02f, -2.25e+02f,
+ -4.85e+03f, -4.85e+03f, -4.85e+03f, -4.85e+03f,
+ -1.59e+03f, -1.59e+03f, -1.59e+03f, -1.59e+03f,
+ },
+ {
+ -7.96e+01f, -7.96e+01f, -7.96e+01f, -7.96e+01f,
+ -1.07e+01f, -1.07e+01f, -1.07e+01f, -1.07e+01f,
+ -9.62e+01f, -9.62e+01f, -9.62e+01f, -9.62e+01f,
+ -3.86e+01f, -3.86e+01f, -3.86e+01f, -3.86e+01f,
+ },
+ {
+ -8.83e+02f, -8.83e+02f, -8.83e+02f, -8.83e+02f,
+ -3.79e+02f, -3.79e+02f, -3.79e+02f, -3.79e+02f,
+ -5.62e+02f, -5.62e+02f, -5.62e+02f, -5.62e+02f,
+ -5.85e+02f, -5.85e+02f, -5.85e+02f, -5.85e+02f,
+ }
+ },
+};
+
+double TEST_MULOP_DATA(double, nadd)[][4][N] =
+{
+ {
+ { 8.64e+20 },
+ {
+ -2.89e+41, -2.89e+41, -2.89e+41, -2.89e+41,
+ -6.50e+41, -6.50e+41, -6.50e+41, -6.50e+41,
+ -8.11e+41, -8.11e+41, -8.11e+41, -8.11e+41,
+ -4.44e+41, -4.44e+41, -4.44e+41, -4.44e+41,
+ },
+ {
+ 2.61e+20, 2.61e+20, 2.61e+20, 2.61e+20,
+ 4.25e+20, 4.25e+20, 4.25e+20, 4.25e+20,
+ 5.77e+20, 5.77e+20, 5.77e+20, 5.77e+20,
+ 3.74e+20, 3.74e+20, 3.74e+20, 3.74e+20,
+ },
+ {
+ 6.38e+40, 6.38e+40, 6.38e+40, 6.38e+40,
+ 2.83e+41, 2.83e+41, 2.83e+41, 2.83e+41,
+ 3.13e+41, 3.13e+41, 3.13e+41, 3.13e+41,
+ 1.21e+41, 1.21e+41, 1.21e+41, 1.21e+41,
+ }
+ },
+ {
+ { -3.01e+40 },
+ {
+ -7.27e+81, -7.27e+81, -7.27e+81, -7.27e+81,
+ -4.10e+81, -4.10e+81, -4.10e+81, -4.10e+81,
+ -7.82e+81, -7.82e+81, -7.82e+81, -7.82e+81,
+ -1.54e+81, -1.54e+81, -1.54e+81, -1.54e+81,
+ },
+ {
+ -5.71e+40, -5.71e+40, -5.71e+40, -5.71e+40,
+ -1.41e+40, -1.41e+40, -1.41e+40, -1.41e+40,
+ -3.01e+40, -3.01e+40, -3.01e+40, -3.01e+40,
+ -2.47e+40, -2.47e+40, -2.47e+40, -2.47e+40,
+ },
+ {
+ 5.55e+81, 5.55e+81, 5.55e+81, 5.55e+81,
+ 3.67e+81, 3.67e+81, 3.67e+81, 3.67e+81,
+ 6.92e+81, 6.92e+81, 6.92e+81, 6.92e+81,
+ 7.96e+80, 7.96e+80, 7.96e+80, 7.96e+80,
+ }
+ },
+ {
+ { 3.65e-20 },
+ {
+ -4.11e-39, -4.11e-39, -4.11e-39, -4.11e-39,
+ -8.48e-39, -8.48e-39, -8.48e-39, -8.48e-39,
+ -8.93e-39, -8.93e-39, -8.93e-39, -8.93e-39,
+ -2.74e-39, -2.74e-39, -2.74e-39, -2.74e-39,
+ },
+ {
+ 5.78e-20, 5.78e-20, 5.78e-20, 5.78e-20,
+ 1.61e-20, 1.61e-20, 1.61e-20, 1.61e-20,
+ 6.91e-20, 6.91e-20, 6.91e-20, 6.91e-20,
+ 6.18e-20, 6.18e-20, 6.18e-20, 6.18e-20,
+ },
+ {
+ 2.00e-39, 2.00e-39, 2.00e-39, 2.00e-39,
+ 7.89e-39, 7.89e-39, 7.89e-39, 7.89e-39,
+ 6.41e-39, 6.41e-39, 6.41e-39, 6.41e-39,
+ 4.87e-40, 4.87e-40, 4.87e-40, 4.87e-40,
+ }
+ },
+};
+
+_Float16 TEST_MULOP_DATA(_Float16, nsub)[][4][N] =
+{
+ {
{ 0.676f16 },
{
1.39f16, 1.39f16, 1.39f16, 1.39f16,
@@ -275,7 +677,7 @@ _Float16 TEST_MULOP_DATA(_Float16, sub)[][4][N] =
},
};
-float TEST_MULOP_DATA(float, sub)[][4][N] =
+float TEST_MULOP_DATA(float, nsub)[][4][N] =
{
{
{8.51f },
@@ -342,7 +744,7 @@ float TEST_MULOP_DATA(float, sub)[][4][N] =
},
};
-double TEST_MULOP_DATA(double, sub)[][4][N] =
+double TEST_MULOP_DATA(double, nsub)[][4][N] =
{
{
{ 80.54 },
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h
index bc6f483d..579f841 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h
@@ -13,12 +13,12 @@ main ()
for (i = 0; i < sizeof (TEST_DATA) / sizeof (TEST_DATA[0]); i++)
{
- T x = TEST_DATA[i][0][0];
+ T f = TEST_DATA[i][0][0];
T *in = TEST_DATA[i][1];
T *out = TEST_DATA[i][2];
T *expect = TEST_DATA[i][3];
- TEST_RUN (T, NAME, out, in, x, N);
+ TEST_RUN (T, NAME, out, in, f, N);
for (k = 0; k < N; k++)
{
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c
index 1bcf9e0..9ec5303 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c
@@ -7,7 +7,7 @@
#define T _Float16
#define NAME add
-DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c
index 199b9ad..222efec 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c
@@ -7,7 +7,7 @@
#define T float
#define NAME add
-DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c
index 3857f58..300d520 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c
@@ -7,7 +7,7 @@
#define T double
#define NAME add
-DEF_VF_MULOP_CASE_0_WRAP(T, +, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, +, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c
index 671c7d8..d11d446 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c
@@ -7,7 +7,7 @@
#define T _Float16
#define NAME sub
-DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c
index f896963..500e1b2 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c
@@ -7,7 +7,7 @@
#define T float
#define NAME sub
-DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c
index b42ab1e..a2c3294 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c
@@ -7,7 +7,7 @@
#define T double
#define NAME sub
-DEF_VF_MULOP_CASE_0_WRAP(T, -, NAME)
+DEF_VF_MULOP_CASE_0_WRAP (T, -, +, NAME)
#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c
new file mode 100644
index 0000000..a45e1f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T _Float16
+#define NAME nadd
+
+DEF_VF_MULOP_CASE_0_WRAP(T, +, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c
new file mode 100644
index 0000000..b8a7bc4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f32.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T float
+#define NAME nadd
+
+DEF_VF_MULOP_CASE_0_WRAP (T, +, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c
new file mode 100644
index 0000000..32664e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f64.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T double
+#define NAME nadd
+
+DEF_VF_MULOP_CASE_0_WRAP (T, +, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c
new file mode 100644
index 0000000..a1b0034
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T _Float16
+#define NAME nsub
+
+DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c
new file mode 100644
index 0000000..6450573
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f32.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T float
+#define NAME nsub
+
+DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c
new file mode 100644
index 0000000..eb3ca1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f64.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "--param=fpr2vr-cost=0" } */
+
+#include "vf_mulop.h"
+#include "vf_mulop_data.h"
+
+#define T double
+#define NAME nsub
+
+DEF_VF_MULOP_CASE_0_WRAP (T, -, -, NAME)
+
+#define TEST_DATA TEST_MULOP_DATA_WRAP(T, NAME)
+#define TEST_RUN(T, NAME, out, in, x, n) RUN_VF_MULOP_CASE_0_WRAP(T, NAME, out, in, x, n)
+
+#include "vf_mulop_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c
index 893d910..b070efd 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-times {vadd.vx} 1 } } */
/* { dg-final { scan-assembler-times {vsub.vx} 1 } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-times {vmul.vx} 1 } } */
/* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */
/* { dg-final { scan-assembler-times {vrem.vx} 1 } } */
+/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c
index 26170de..3b51ca7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-times {vadd.vx} 1 } } */
/* { dg-final { scan-assembler-times {vsub.vx} 1 } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-times {vmul.vx} 1 } } */
/* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */
/* { dg-final { scan-assembler-times {vrem.vx} 1 } } */
+/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c
index 04d1fcb..b5ee457 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-times {vadd.vx} 1 } } */
/* { dg-final { scan-assembler-times {vsub.vx} 1 } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-times {vmul.vx} 1 } } */
/* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */
/* { dg-final { scan-assembler-times {vrem.vx} 1 } } */
+/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c
index 89d37af..7b0c89b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-times {vadd.vx} 1 } } */
/* { dg-final { scan-assembler-times {vsub.vx} 1 } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-times {vmul.vx} 1 } } */
/* { dg-final { scan-assembler-times {vdiv.vx} 1 } } */
/* { dg-final { scan-assembler-times {vrem.vx} 1 } } */
+/* { dg-final { scan-assembler-times {vmax.vx} 2 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c
index b9f8bd9..eaa4959 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c
index d2be881..5523256 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c
index d1b85ee..9eb1025 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c
index 30a3928..9a97112 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c
index 5210c0d..5e0fe41 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c
index 5b0db08..2b842de 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c
index 8d528d8..9f981a5 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c
index 85e79ac..a1d7cf4 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_0_WRAP(T, ^, xor)
DEF_VX_BINARY_CASE_0_WRAP(T, *, mul)
DEF_VX_BINARY_CASE_0_WRAP(T, /, div)
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max)
+DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_0_WRAP(T, %, rem)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c
index b35e4b7..5d684e6 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X16)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X16)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c
index fb01a6a..6c086d2 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c
index d9341d6..0abae20 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c
index 02fdece..d2955b8 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c
index a9ea082..c42c58e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c
index aaf37c5..a6d1ad0 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c
index 4f80dab..ea9c526 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c
index 85ef4f1..d1212ea 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c
index 3ac5041..30e38f7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c
index 32ce58a..f0b6bcd 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X4)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X4)
/* { dg-final { scan-assembler {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X4)
/* { dg-final { scan-assembler {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c
index 722282a..ef168ac 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler-not {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler-not {vdiv.vx} } } */
/* { dg-final { scan-assembler-not {vrem.vx} } } */
+/* { dg-final { scan-assembler-not {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c
index 27dffc7..9977ff3 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c
@@ -14,6 +14,8 @@ DEF_VX_BINARY_CASE_1_WRAP(T, ^, xor, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, *, mul, VX_BINARY_BODY_X16)
DEF_VX_BINARY_CASE_1_WRAP(T, /, div, VX_BINARY_BODY_X8)
DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_0_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
+DEF_VX_BINARY_CASE_3_WRAP(T, MAX_FUNC_1_WARP(T), max, VX_BINARY_FUNC_BODY_X8)
/* { dg-final { scan-assembler-not {vadd.vx} } } */
/* { dg-final { scan-assembler {vsub.vx} } } */
@@ -24,3 +26,4 @@ DEF_VX_BINARY_CASE_1_WRAP(T, %, rem, VX_BINARY_BODY_X8)
/* { dg-final { scan-assembler-not {vmul.vx} } } */
/* { dg-final { scan-assembler {vdiv.vx} } } */
/* { dg-final { scan-assembler {vrem.vx} } } */
+/* { dg-final { scan-assembler {vmax.vx} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h
index 66e238c..51e901d 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h
@@ -127,4 +127,97 @@ test_vx_binary_reverse_##NAME##_##T##_case_1 (T * restrict out, \
#define DEF_VX_BINARY_REVERSE_CASE_1_WRAP(T, OP, NAME, BODY) \
DEF_VX_BINARY_REVERSE_CASE_1(T, OP, NAME, BODY)
+#define DEF_MAX_0(T) \
+static inline T \
+test_##T##_max_0 (T a, T b) \
+{ \
+ return a > b ? a : b; \
+}
+
+#define DEF_MAX_1(T) \
+static inline T \
+test_##T##_max_1 (T a, T b) \
+{ \
+ return a >= b ? a : b; \
+}
+
+DEF_MAX_0(int8_t)
+DEF_MAX_0(int16_t)
+DEF_MAX_0(int32_t)
+DEF_MAX_0(int64_t)
+
+DEF_MAX_1(int8_t)
+DEF_MAX_1(int16_t)
+DEF_MAX_1(int32_t)
+DEF_MAX_1(int64_t)
+
+#define MAX_FUNC_0(T) test_##T##_max_0
+#define MAX_FUNC_0_WARP(T) MAX_FUNC_0(T)
+
+#define MAX_FUNC_1(T) test_##T##_max_1
+#define MAX_FUNC_1_WARP(T) MAX_FUNC_1(T)
+
+#define DEF_VX_BINARY_CASE_2(T, FUNC, NAME) \
+void \
+test_vx_binary_##NAME##_##FUNC##_##T##_case_2 (T * restrict out, \
+ T * restrict in, \
+ T x, unsigned n) \
+{ \
+ for (unsigned i = 0; i < n; i++) \
+ out[i] = FUNC (in[i], x); \
+}
+#define DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME) \
+ DEF_VX_BINARY_CASE_2(T, FUNC, NAME)
+#define RUN_VX_BINARY_CASE_2(T, NAME, FUNC, out, in, x, n) \
+ test_vx_binary_##NAME##_##FUNC##_##T##_case_2(out, in, x, n)
+#define RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2(T, NAME, FUNC, out, in, x, n)
+
+#define DEF_VX_BINARY_CASE_3(T, FUNC, NAME, BODY) \
+void \
+test_vx_binary_##NAME##_##FUNC##_##T##_case_3 (T * restrict out, \
+ T * restrict in, \
+ T x, unsigned n) \
+{ \
+ unsigned k = 0; \
+ T tmp = x + 3; \
+ \
+ while (k < n) \
+ { \
+ tmp = tmp ^ 0x82; \
+ BODY(FUNC) \
+ } \
+}
+#define DEF_VX_BINARY_CASE_3_WRAP(T, FUNC, NAME, BODY) \
+ DEF_VX_BINARY_CASE_3(T, FUNC, NAME, BODY)
+
+#define VX_BINARY_FUNC_BODY(func) \
+ out[k + 0] = func (in[k + 0], tmp); \
+ out[k + 1] = func (in[k + 1], tmp); \
+ k += 2;
+
+#define VX_BINARY_FUNC_BODY_X4(op) \
+ VX_BINARY_FUNC_BODY(op) \
+ VX_BINARY_FUNC_BODY(op)
+
+#define VX_BINARY_FUNC_BODY_X8(op) \
+ VX_BINARY_FUNC_BODY_X4(op) \
+ VX_BINARY_FUNC_BODY_X4(op)
+
+#define VX_BINARY_FUNC_BODY_X16(op) \
+ VX_BINARY_FUNC_BODY_X8(op) \
+ VX_BINARY_FUNC_BODY_X8(op)
+
+#define VX_BINARY_FUNC_BODY_X32(op) \
+ VX_BINARY_FUNC_BODY_X16(op) \
+ VX_BINARY_FUNC_BODY_X16(op)
+
+#define VX_BINARY_FUNC_BODY_X64(op) \
+ VX_BINARY_FUNC_BODY_X32(op) \
+ VX_BINARY_FUNC_BODY_X32(op)
+
+#define VX_BINARY_FUNC_BODY_X128(op) \
+ VX_BINARY_FUNC_BODY_X64(op) \
+ VX_BINARY_FUNC_BODY_X64(op)
+
#endif
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h
index ce183ca..9cef042 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h
@@ -3338,4 +3338,200 @@ uint64_t TEST_BINARY_DATA(uint64_t, rem)[][3][N] =
},
};
+int8_t TEST_BINARY_DATA(int8_t, max)[][3][N] =
+{
+ {
+ { 0 },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ -1, -1, -1, -1,
+ -2, -2, -2, -2,
+ },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ },
+ },
+ {
+ { 127 },
+ {
+ 127, 127, 127, 127,
+ -1, -1, -1, -1,
+ -128, -128, -128, -128,
+ -2, -2, -2, -2,
+ },
+ {
+ 127, 127, 127, 127,
+ 127, 127, 127, 127,
+ 127, 127, 127, 127,
+ 127, 127, 127, 127,
+ },
+ },
+ {
+ { -128 },
+ {
+ -128, -128, -128, -128,
+ 1, 1, 1, 1,
+ 127, 127, 127, 127,
+ 2, 2, 2, 2,
+ },
+ {
+ -128, -128, -128, -128,
+ 1, 1, 1, 1,
+ 127, 127, 127, 127,
+ 2, 2, 2, 2,
+ },
+ },
+};
+
+int16_t TEST_BINARY_DATA(int16_t, max)[][3][N] =
+{
+ {
+ { 0 },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ -1, -1, -1, -1,
+ -2, -2, -2, -2,
+ },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ },
+ },
+ {
+ { 32767 },
+ {
+ 32767, 32767, 32767, 32767,
+ -1, -1, -1, -1,
+ -32768, -32768, -32768, -32768,
+ -2, -2, -2, -2,
+ },
+ {
+ 32767, 32767, 32767, 32767,
+ 32767, 32767, 32767, 32767,
+ 32767, 32767, 32767, 32767,
+ 32767, 32767, 32767, 32767,
+ },
+ },
+ {
+ { -32768 },
+ {
+ -32768, -32768, -32768, -32768,
+ 1, 1, 1, 1,
+ 32767, 32767, 32767, 32767,
+ 2, 2, 2, 2,
+ },
+ {
+ -32768, -32768, -32768, -32768,
+ 1, 1, 1, 1,
+ 32767, 32767, 32767, 32767,
+ 2, 2, 2, 2,
+ },
+ },
+};
+
+int32_t TEST_BINARY_DATA(int32_t, max)[][3][N] =
+{
+ {
+ { 0 },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ -1, -1, -1, -1,
+ -2, -2, -2, -2,
+ },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ },
+ },
+ {
+ { 2147483647 },
+ {
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ -1, -1, -1, -1,
+ -2147483648, -2147483648, -2147483648, -2147483648,
+ -2, -2, -2, -2,
+ },
+ {
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ },
+ },
+ {
+ { -2147483648 },
+ {
+ -2147483648, -2147483648, -2147483648, -2147483648,
+ 1, 1, 1, 1,
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ 2, 2, 2, 2,
+ },
+ {
+ -2147483648, -2147483648, -2147483648, -2147483648,
+ 1, 1, 1, 1,
+ 2147483647, 2147483647, 2147483647, 2147483647,
+ 2, 2, 2, 2,
+ },
+ },
+};
+
+int64_t TEST_BINARY_DATA(int64_t, max)[][3][N] =
+{
+ {
+ { 0 },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ -1, -1, -1, -1,
+ -2, -2, -2, -2,
+ },
+ {
+ 2, 2, 2, 2,
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ },
+ },
+ {
+ { 9223372036854775807ll },
+ {
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ -1, -1, -1, -1,
+ -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull,
+ -2, -2, -2, -2,
+ },
+ {
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ },
+ },
+ {
+ { -9223372036854775808ull },
+ {
+ -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull,
+ 1, 1, 1, 1,
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ 2, 2, 2, 2,
+ },
+ {
+ -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull,
+ 1, 1, 1, 1,
+ 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll,
+ 2, 2, 2, 2,
+ },
+ },
+};
+
#endif
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c
new file mode 100644
index 0000000..d36495c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int16_t
+#define NAME max
+#define FUNC MAX_FUNC_0_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c
new file mode 100644
index 0000000..acd8aeb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int32_t
+#define NAME max
+#define FUNC MAX_FUNC_0_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c
new file mode 100644
index 0000000..5ecc206
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int64_t
+#define NAME max
+#define FUNC MAX_FUNC_0_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c
new file mode 100644
index 0000000..5ac63e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int8_t
+#define NAME max
+#define FUNC MAX_FUNC_0_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c
new file mode 100644
index 0000000..77445b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int16_t
+#define NAME max
+#define FUNC MAX_FUNC_1_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c
new file mode 100644
index 0000000..fc4fb55
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int32_t
+#define NAME max
+#define FUNC MAX_FUNC_1_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c
new file mode 100644
index 0000000..1afa12e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int64_t
+#define NAME max
+#define FUNC MAX_FUNC_1_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c
new file mode 100644
index 0000000..9c1222b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
+
+#include "vx_binary.h"
+#include "vx_binary_data.h"
+
+#define T int8_t
+#define NAME max
+#define FUNC MAX_FUNC_1_WARP(T)
+#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
+
+DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, max)
+
+#define TEST_RUN(T, NAME, out, in, x, n) \
+ RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
+
+#include "vx_binary_run.h"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c
new file mode 100644
index 0000000..bf99240
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr117974.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvl256b -mabi=lp64d -mrvv-vector-bits=zvl -Ofast" } */
+
+float g(float q[], int N){
+ float dqnorm = 0.0;
+
+ #pragma GCC unroll 4
+
+ for (int i=0; i < N; i++) {
+ dqnorm = dqnorm + q[i] * q[i];
+ }
+ return dqnorm;
+}
+
+/* need slightly different test for when -funroll-loops is enabled to keep
+ test output stable. Otherwise test may be flakey. */
+/* { dg-final { scan-assembler-times {beq\s+[a-x0-9]+,zero,.L12\s+vsetvli} 3 { target { no-opts "-funroll-loops" } } } } */
+/* { dg-final { scan-assembler-times {beq\s+[a-x0-9]+,[a-x0-9]+,.L12\s+vsetvli} 3 { target { any-opts "-funroll-loops" } } } } */
+
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c
index be9f312..78c8a4a 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/vtype-call-clobbered.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv -mabi=lp64 -O2" } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O2" } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
#include "riscv_vector.h"
diff --git a/gcc/testsuite/lib/htmltest.py b/gcc/testsuite/lib/htmltest.py
index 8e42a8c..49ed4b0 100644
--- a/gcc/testsuite/lib/htmltest.py
+++ b/gcc/testsuite/lib/htmltest.py
@@ -83,14 +83,11 @@ def get_diag_by_index(html_tree, index):
assert diag_list is not None
assert_class(diag_list, 'gcc-diagnostic-list')
- diags = diag_list.findall('xhtml:div', ns)
- diag = diags[index]
- assert_class(diag, 'gcc-diagnostic')
+ diag = diag_list.find(f"xhtml:div[@id='gcc-diag-{index}']", ns)
return diag
def get_message_within_diag(diag_element):
- msg = diag_element.find('xhtml:span', ns)
- assert_class(msg, 'gcc-message')
+ msg = diag_element.find("xhtml:div[@class='gcc-message']", ns)
return msg
def get_locus_within_diag(diag_element):
diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
index 7e819f3..4cfcc42 100644
--- a/gcc/tree-ssa-math-opts.cc
+++ b/gcc/tree-ssa-math-opts.cc
@@ -1053,6 +1053,7 @@ pass_cse_reciprocals::execute (function *fun)
continue;
gimple_replace_ssa_lhs (call, arg1);
+ reset_flow_sensitive_info (arg1);
if (gimple_call_internal_p (call) != (ifn != IFN_LAST))
{
auto_vec<tree, 4> args;
diff --git a/gcc/xml-printer.h b/gcc/xml-printer.h
index b90390c..428da0a 100644
--- a/gcc/xml-printer.h
+++ b/gcc/xml-printer.h
@@ -32,18 +32,19 @@ class node;
class printer
{
public:
- printer (element &insertion_point);
+ printer (element &insertion_point, bool check_popped_tags = true);
void push_tag (std::string name,
bool preserve_whitespace = false);
void push_tag_with_class (std::string name,
std::string class_,
bool preserve_whitespace = false);
- void pop_tag ();
+ void pop_tag (const char *expected_name);
void set_attr (const char *name, std::string value);
void add_text (std::string text);
+ void add_text_from_pp (pretty_printer &pp);
void add_raw (std::string text);
@@ -53,9 +54,38 @@ public:
element *get_insertion_point () const;
+ size_t get_num_open_tags () const { return m_open_tags.size (); }
+
+ void DEBUG_FUNCTION dump () const;
+
private:
// borrowed ptrs:
std::vector<element *> m_open_tags;
+ bool m_check_popped_tags;
+};
+
+/* RAII class for ensuring that the tags nested correctly.
+ Verify that within an instance's lifetime that any pushes
+ to the printer's insertion point have been popped by the end. */
+
+class auto_check_tag_nesting
+{
+public:
+ auto_check_tag_nesting (const printer &xp)
+ : m_xp (xp),
+ m_initial_insertion_element (xp.get_insertion_point ())
+ {
+ }
+ ~auto_check_tag_nesting ()
+ {
+ /* Verify that we didn't pop too many tags within the printer,
+ or leave any tags open. */
+ gcc_assert (m_initial_insertion_element == m_xp.get_insertion_point ());
+ }
+
+private:
+ const printer &m_xp;
+ const element *m_initial_insertion_element;
};
// RAII for push/pop element on xml::printer
@@ -66,17 +96,19 @@ public:
auto_print_element (printer &printer,
std::string name,
bool preserve_whitespace = false)
- : m_printer (printer)
+ : m_printer (printer),
+ m_name (std::move (name))
{
- m_printer.push_tag (name, preserve_whitespace);
+ m_printer.push_tag (m_name, preserve_whitespace);
}
~auto_print_element ()
{
- m_printer.pop_tag ();
+ m_printer.pop_tag (m_name.c_str ());
}
private:
printer &m_printer;
+ std::string m_name;
};
} // namespace xml
diff --git a/gcc/xml.cc b/gcc/xml.cc
index 6c95288..a23298b 100644
--- a/gcc/xml.cc
+++ b/gcc/xml.cc
@@ -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"
diff --git a/gcc/xml.h b/gcc/xml.h
index 3c5813a..952cfa4 100644
--- a/gcc/xml.h
+++ b/gcc/xml.h
@@ -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;
};