aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
AgeCommit message (Collapse)AuthorFilesLines
2025-06-23libgdiagnostics: sarif-replay: add extra sinks via -fdiagnostics-add-output= ↵David Malcolm2-0/+51
[PR116792,PR116163] This patch refactors the support for -fdiagnostics-add-output=SCHEME from GCC's options parsing so that it is also available to sarif-replay and to other clients of libgdiagnostics. With this users of sarif-replay and other such tools can generate HTML or SARIF as well as text output, using the same -fdiagnostics-add-output=SCHEME as GCC. As a test, the patch adds support for this option to the dg-lint script below "contrib". For example dg-lint can now generate text, html, and sarif output via: LD_LIBRARY_PATH=../build/gcc/ \ ./contrib/dg-lint/dg-lint \ contrib/dg-lint/test-*.c \ -fdiagnostics-add-output=experimental-html:file=dg-lint-tests.html \ -fdiagnostics-add-output=sarif:file=dg-lint-tests.sarif where the HTML output from dg-lint can be seen here: https://dmalcolm.fedorapeople.org/gcc/2025-06-20/dg-lint-tests.html the sarif output here: https://dmalcolm.fedorapeople.org/gcc/2025-06-23/dg-lint-tests.sarif and a screenshot of VS Code viewing the sarif output is here: https://dmalcolm.fedorapeople.org/gcc/2025-06-23/vscode-viewing-dg-lint-sarif-output.png As well as allowing sarif-replay to generate HTML, this patch allows sarif-replay to also generate SARIF. Ideally this would faithfully round-trip all the data, but it's not perfect (which I'm tracking as PR sarif-replay/120792). contrib/ChangeLog: PR other/116792 PR testsuite/116163 PR sarif-replay/120792 * dg-lint/dg-lint: Add -fdiagnostics-add-output. * dg-lint/libgdiagnostics.py: Add diagnostic_manager_add_sink_from_spec. (Manager.add_sink_from_spec): New. gcc/ChangeLog: PR other/116792 PR testsuite/116163 PR sarif-replay/120792 * Makefile.in (OBJS-libcommon): Add diagnostic-output-spec.o. * diagnostic-format-html.cc (html_builder::html_builder): Ensure title is non-empty. * diagnostic-output-spec.cc: New file, taken from material in opts-diagnostic.cc. * diagnostic-output-spec.h: New file. * diagnostic.cc (diagnostic_context::set_main_input_filename): New. * diagnostic.h (diagnostic_context::set_main_input_filename): New decl. * doc/libgdiagnostics/topics/compatibility.rst (LIBGDIAGNOSTICS_ABI_2): New. * doc/libgdiagnostics/topics/diagnostic-manager.rst (diagnostic_manager_add_sink_from_spec): New. (diagnostic_manager_set_analysis_target): New. * libgdiagnostics++.h (manager::add_sink_from_spec): New. (manager::set_analysis_target): New. * libgdiagnostics.cc: Include "diagnostic-output-spec.h". (struct spec_context): New. (diagnostic_manager_add_sink_from_spec): New. (diagnostic_manager_set_analysis_target): New. * libgdiagnostics.h (LIBDIAGNOSTICS_HAVE_diagnostic_manager_add_sink_from_spec): New define. (diagnostic_manager_add_sink_from_spec): New decl. (LIBDIAGNOSTICS_HAVE_diagnostic_manager_set_analysis_target): New define. (diagnostic_manager_set_analysis_target): New decl. * libgdiagnostics.map (LIBGDIAGNOSTICS_ABI_2): New. * libsarifreplay.cc (sarif_replayer::handle_artifact_obj): Looks for "analysisTarget" in roles and call set_analysis_target using the artifact if found. * opts-diagnostic.cc: Refactor, moving material to diagnostic-output-spec.cc. (struct opt_spec_context): New. (handle_OPT_fdiagnostics_add_output_): Use opt_spec_context. (handle_OPT_fdiagnostics_set_output_): Likewise. * sarif-replay.cc: Define INCLUDE_STRING. (struct options): Add m_extra_output_specs. (usage_msg): Add -fdiagnostics-add-output=SCHEME. (str_starts_with): New. (parse_options): Add -fdiagnostics-add-output=SCHEME. (main): Likewise. * selftest-run-tests.cc (selftest::run_tests): Call diagnostic_output_spec_cc_tests rather than opts_diagnostic_cc_tests. * selftest.h (selftest::diagnostic_output_spec_cc_tests): Replace... (selftest::opts_diagnostic_cc_tests): ...this. gcc/testsuite/ChangeLog: PR other/116792 PR testsuite/116163 PR sarif-replay/120792 * sarif-replay.dg/2.1.0-valid/signal-1-check-html.py: New test script. * sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: Add html and sarif generation to options. Invoke the new script to verify that HTML and SARIF is generated. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-06-23diagnostics: add state diagrams to analyzer experimental-html output [PR116792]David Malcolm2-0/+77
This patch adds various support for debugging diagnostic paths and events, intended initially for myself to help with debugging -fanalyzer. It adds the optional ability for a diagnostic_event to supply a description of the predicted state of the program at that point along the diagnostic_path. To isolate the diagnostic subsystem from the analyzer, this representation is currently an xml::document with custom elements. The XML representation is similar to the analyzer's internal state but can be easier to read - for example, rather than storing the contents of memory via byte offsets, it uses fields for structs and element indexes for arrays, recursively. These states are handled by the HTML and SARIF diagnostic sinks. The SARIF sink simply embeds the XML as a string in a property bag of the threadFlowLocation object (SARIF v2.1.0 section 3.38). For HTML output, the "experimental-html" sink gains a new "show-state-diagrams=yes" option i.e.: -fdiagnostics-add-output=experimental-html:show-state-diagrams=yes which converts the state XML into SVG diagrams visualizing the state of memory at each event, inspired by the "ddd" debugger. These can be seen by pressing 'j' and 'k' to single-step forward and backward through events, making it *much* easier to debug -fanalyzer. An example of output can be seen here: https://dmalcolm.fedorapeople.org/gcc/2025-06-23/state-diagram-1.c.html showing an issue in a singly-linked list; there are various other examples in the parent directory. Generating the SVG diagrams requires an invocation of "dot" per event, so it noticeable slows down diagnostic emission, hence the opt-in command-line flag. However, I'm already finding bugs in -fanalyzer with this that I hadn't seen before. Given that the UI is rather clunky and there is lots of room for improvement to the visualizations, for now this feature is marked as being for GCC developers, not end-users. The patch also adds a dot::ast_node class hierarachy to make it easy to create GraphViz dot files with the correct escaping, and adds a C++ wrapper around pex adding some syntactic sugar for invoking subprocesses. gcc/ChangeLog: PR other/116792 * Makefile.in (ANALYZER_OBJS): Add analyzer/ana-state-to-diagnostic-state.o. (OBJS): Move graphviz.o to... (OBJS-libcommon): ...here. Add diagnostic-state-to-dot.o and pex.o. * diagnostic-format-html.cc: Include "diagnostic-state.h" and "graphviz.h". (html_generation_options::html_generation_options): Initialize the new flags. (HTML_SCRIPT): Add function "get_any_state_diagram". Use it when changing current focus id to update the visibility of the pertinent diagram, if any. (print_pre_source): New. (html_builder::maybe_make_state_diagram): New. (html_path_label_writer::html_path_label_writer): Add "path" param. Initialize m_path and m_curr_event_id. (html_path_label_writer::begin_label): Store current event id. (html_path_label_writer::end_label): Attempt to make a state diagram and add it if successful. (html_path_label_writer::get_element_id): New. (html_path_label_writer::m_path): New field. (html_path_label_writer::m_curr_event_id): New field. (html_builder::make_element_for_diagnostic): Pass path to label writer. * diagnostic-format-html.h (html_generation_options::m_show_state_diagrams): New field. (html_generation_options::m_show_state_diagram_xml): New field. (html_generation_options::m_show_state_diagram_dot_src): New field. * diagnostic-format-sarif.cc: Include "xml.h". (populate_thread_flow_location_object): If requested, attempt to generate xml state and add it to the proeprty bag as "gcc/diagnostic_event/xml_state" in xml source form. (sarif_generation_options::sarif_generation_options): Initialize m_xml_state. * diagnostic-format-sarif.h (sarif_generation_options::m_xml_state): New field. * diagnostic-path.cc: Define INCLUDE_MAP. Include "xml.h". (diagnostic_event::maybe_make_xml_state): New. * diagnostic-path.h (class xml::document): New forward decl. (diagnostic_event::maybe_make_xml_state): New vfunc decl. * diagnostic-state-to-dot.cc: New file. * diagnostic-state.h: New file. * digraph.cc: Define INCLUDE_STRING and INCLUDE_VECTOR. * doc/analyzer.texi: Document state diagrams in html output. (__analyzer_dump_dot): New. (__analyzer_dump_xml): New. * doc/invoke.texi (sarif): Add "xml-state" key. (experimental-html): Add keys "show-state-diagrams", "show-state-diagrams-dot-src" and "show-state-diagrams-xml". * graphviz.cc: Define INCLUDE_MAP, INCLUDE_STRING, and INCLUDE_VECTOR. Include "xml.h", "xml-printer.h", "pex.h" and "selftest.h". (graphviz_out::graphviz_out): Extract... (dot::writer::writer): ...this. (graphviz_out::write_indent): Convert to... (dot::writer::write_indent): ...this. (graphviz_out::print): Use get_pp. (graphviz_out::println): Likewise. (graphviz_out::begin_tr): Likewise. (graphviz_out::end_tr): Likewise. (graphviz_out::begin_td): Likewise. (graphviz_out::end_td): Likewise. (graphviz_out::begin_trtd): Likewise. (graphviz_out::end_tdtr): Likewise. (dot::ast_node::dump): New. (dot::id::id): New. (dot::id::print): New. (dot::id::is_identifier_p): New. (dot::kv_pair::print): New. (dot::attr_list::print): New. (dot::stmt_list::print): New. (dot::stmt_list::add_edge): New. (dot::stmt_list::add_attr): New. (dot::graph::print): New. (dot::stmt_with_attr_list::set_label): New. (dot::node_stmt::print): New. (dot::attr_stmt::print): New. (dot::kv_stmt::print): New. (dot::node_id::print): New. (dot::port::print): New. (dot::edge_stmt::print): New. (dot::subgraph::print): New. (dot::make_svg_document_buffer_from_graph): New. (dot::make_svg_from_graph): New. (selftest:test_ids): New. (selftest:test_trivial_graph): New. (selftest:test_layout_example): New. (selftest:graphviz_cc_tests): New. * graphviz.h (xml::node): New forward decl. (class graphviz_out): Split out into... (class dot::writer): ...this new class (struct dot::ast_node): New. (struct dot::id): New. (struct dot::kv_pair): New. (struct dot::attr_list): New. (struct dot::stmt_list): New. (struct dot::graph): New. (struct dot::stmt): New. (struct dot::stmt_with_attr_list): New. (struct dot::node_stmt): New. (struct dot::attr_stmt): New. (struct dot::kv_stmt): New. (enum class dot::compass_pt): New. (struct dot::port): New. (struct dot::node_id): New. (struct dot::edge_stmt): New. (struct dot::subgraph): New. (dot::make_svg_from_graph): New. * opts-diagnostic.cc (sarif_scheme_handler::make_sink): Add "xml-state" flag. (html_scheme_handler::make_sink): Add flags "show-state-diagrams", "show-state-diagram-dot-src", and "show-state-diagram-xml". * pex.cc: New file. * pex.h: New file. * selftest-run-tests.cc (selftest::run_tests): Call graphviz_cc_tests. * selftest.h (selftest::graphviz_cc_tests): New decl. * xml.cc (xml::node_with_children::add_comment): New. (xml::node_with_children::find_child_element): New. (xml::element::get_attr): New. (xml::comment::write_as_xml): New. (selftest::test_printer): Add coverage of find_child_element and get_attr. (selftest::test_comment): New. (selftest::xml_cc_tests): Call test_comment. * xml.h: New forward decls. (xml::node::dyn_cast_text): Use nullptr. (xml::node::dyn_cast_element): New vfunc. (xml::node_with_children::add_comment): New decl. (xml::node_with_children::find_child_element): New decl. (xml::element::dyn_cast_element): New vfunc impl. (xml::element::get_attr): New decl. (struct xml::comment): New xml::node subclass. gcc/analyzer/ChangeLog: PR other/116792 * ana-state-to-diagnostic-state.cc: New file. * ana-state-to-diagnostic-state.h: New file. * checker-event.cc: Include "xml.h". (checker_event::checker_event): Initialize m_path. (checker_event::prepare_for_emission): Store the path pointer into m_path. (checker_event::maybe_make_xml_state): New. (function_entry_event::function_entry_event): Add "state" param and use it to initialize m_state. (superedge_event::get_program_state): New. (call_event::get_program_state): New. (warning_event::get_program_state): New. * checker-event.h (checker_event::get_program_state): New vfunc. (checker_event::maybe_make_xml_state): New decl. (checker_event::m_path): New field. (statement_event::get_program_state): New vfunc impl. (function_entry_event::function_entry_event): Add "state" param. (function_entry_event::get_program_state): New vfunc impl. (function_entry_event::m_state): New field. (state_change_event::get_program_state): New vfunc impl. (superedge_event::get_program_state): New vfunc decl. (warning_event::warning_event): Add "program_state_" param and copy it. (warning_event::get_program_state): New vfunc decl. (warning_event::m_program_state): New field. * checker-path.h (checker_path::checker_path): Add ext_state param. (checker_path::get_ext_state): New accessor. (checker_path::m_ext_state): New field. * common.h: Define INCLUDE_MAP and INCLUDE_STRING. * diagnostic-manager.cc (saved_diagnostic::operator==): Don't deduplicate dump_path_diagnostic instances. (diagnostic_manager::emit_saved_diagnostic): Pass ext_state to checker_path ctor. * engine.cc: (impl_region_model_context::on_state_leak): Pass old and new state to state_machine::on_leak. (exploded_node::on_stmt_pre): Implement __analyzer_dump_xml and __analyzer_dump_dot. * exploded-graph.h (impl_region_model_context::get_state): New. * infinite-recursion.cc (recursive_function_entry_event::recursive_function_entry_event): Add "dst_state" param and pass to function_entry_event ctor. (infinite_recursion_diagnostic::add_function_entry_event): Pass state to event ctor. * kf-analyzer.cc: Include "analyzer/program-state.h" (dump_path_diagnostic::dump_path_diagnostic): Add "state" param. (dump_path_diagnostic::get_final_state): New. (dump_path_diagnostic::m_state): New field. (kf_analyzer_dump_path::impl_call_pre): Pass state to warning. * pending-diagnostic.cc (pending_diagnostic::add_function_entry_event): Pass state to function_entry_event. (pending_diagnostic::add_final_event): Likewise to warning_event. * pending-diagnostic.h (pending_diagnostic::get_final_state): New vfunc decl. * program-state.cc: Include "diagnostic-state.h", "graphviz.h" and "analyzer/ana-state-to-diagnostic-state.h". (program_state::dump_dot): New. * program-state.h: Include "text-art/tree-widget.h" and "analyzer/store.h". (class xml::document): New forward decl. (make_xml): New. (dump_xml_to_pp): New. (dump_xml_to_file): New. (dump_xml): New. (dump_dot): New. * record-layout.cc (record_layout::record_layout): Make param const_tree. * record-layout.h (item::item): Likewise. (item::m_field): Likewise. (record_layout::record_layout): Likewise. (record_layout::begin): New. (record_layout::end): New. * region-model.cc (exposure_through_uninit_copy::complain_about_fully_uninit_item): Use const_tree. (exposure_through_uninit_copy::complain_about_partially_uninit_item): Likewise. * region-model.h (region_model_context::get_state): New vfunc. (noop_region_model_context::get_state): New. (region_model_context_decorator::get_state): New. * sm-fd.cc (fd_leak::fd_leak): Add "final_state" param and capture it if present. (fd_leak::get_final_state): New. (fd_leak::m_final_state): New. (fd_state_machine::on_open): Pass nullptr for new "final_state" param. (fd_state_machine::on_creat): Likewise. (fd_state_machine::on_socket): Likewise. (fd_state_machine::on_accept): Likewise. (fd_state_machine::on_leak): Add state params and pass new state as final state to fd_leak ctor. * sm-file.cc: Include "analyzer/program-state.h". (file_leak::file_leak): Add "final_state" param and capture it if present. (file_leak::get_final_state): New. (file_leak::m_final_state): New. (fileptr_state_machine::on_leak): Add state params and pass new state as final state to fd_leak ctor. * sm-malloc.cc: Include "analyzer/ana-state-to-diagnostic-state.h". (malloc_leak::malloc_leak): Add "final_state" param and use it. (malloc_leak::get_final_state): New vfunc impl. (malloc_leak::m_final_state): New field. (malloc_state_machine::on_leak): Add state params; capture final state. (malloc_state_machine::add_state_to_xml): New. * sm.cc (state_machine::on_leak): Add "old_state" and "new_state" params. Use nullptr. (state_machine::add_state_to_xml): New. (state_machine::add_global_state_to_xml): New. * sm.h (class xml_state): New forward decl. (state_machine::on_leak): Add state params. (state_machine::add_state_to_xml): New vfunc decl. (state_machine::add_global_state_to_xml): New vfunc decl. * store.h (bit_range::operator<): New. * varargs.cc (va_list_leak::va_list_leak): Add final_state param and capture it if non-null. (va_list_leak::get_final_state): New. (va_list_leak::m_final_state): New. (va_list_state_machine::on_leak): Add state params and pass final state to va_list_leak ctor. gcc/testsuite/ChangeLog: PR other/116792 * g++.dg/analyzer/state-diagram.C: New test. * gcc.dg/analyzer/analyzer-decls.h (__analyzer_dump_dot): New decl. (__analyzer_dump_xml): New decl. * gcc.dg/analyzer/state-diagram-1-sarif.py: New test script. * gcc.dg/analyzer/state-diagram-1.c: New test. * gcc.dg/analyzer/state-diagram-2.c: New test. * gcc.dg/analyzer/state-diagram-3.c: New test. * gcc.dg/analyzer/state-diagram-4.c: New test. * gcc.dg/analyzer/state-diagram-5-html.py: New test script. * gcc.dg/analyzer/state-diagram-5-sarif.py: New test script. * gcc.dg/analyzer/state-diagram-5.c: New test. * gcc.dg/plugin/analyzer_cpython_plugin.cc: Define INCLUDE_STRING. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * lib/htmltest.py (ns): Add SVG namespace. * lib/sarif.py (get_result_by_index): New. (get_xml_state): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-06-23tree-optimization/120729 - limit compile time in ↵Richard Biener1-0/+3
uninit_analysis::prune_phi_opnds The testcase in this PR shows, on the GCC 14 branch, that in some degenerate cases we can spend exponential time pruning always initialized paths through a web of PHIs. The following adds --param uninit-max-prune-work, defaulted to 100000, to limit that to effectively O(1). PR tree-optimization/120729 * gimple-predicate-analysis.h (uninit_analysis::prune_phi_opnds): Add argument of work budget remaining. * gimple-predicate-analysis.cc (uninit_analysis::prune_phi_opnds): Likewise. Maintain and honor it throughout the recursion. * params.opt (uninit-max-prune-work): New. * doc/invoke.texi (uninit-max-prune-work): Document.
2025-06-19install.texi: Note that Texinfo < v7.1 may throw incorrect warnings.Georg-Johann Lay1-0/+3
PR other/115893 gcc/ * doc/install.texi (Prerequisites): Note that Texinfo older than v7.1 may throw incorrect build warnings, cf. https://lists.nongnu.org/archive/html/help-texinfo/2023-11/msg00004.html
2025-06-18doc: allow gcov.texi to be processed by makeinfo 4.13Jan Beulich1-1/+1
As per documentation, even 4.7 ought to suffice. At least 4.13 objects to there being a blank between @anchor and the opening curly brace. gcc/ * doc/gcov.texi: Drop blank after @anchor.
2025-06-18doc: allow extend.texi to be processed by makeinfo 4.13Jan Beulich1-2/+2
PR middle-end/120544 As per documentation, even 4.7 ought to suffice. At least 4.13 objects to there being nothing ahead of the first comma in @xref{}. gcc/ * doc/extend.texi: Fill first argument of @xref{}.
2025-06-16c++: add -Wsfinae-incompleteJason Merrill1-1/+15
We already error about a type or function definition causing a concept check to change value, but it would be useful to diagnose this for other SFINAE contexts as well; the memoization problem also affects templates. So -Wsfinae-incomplete remembers if we've failed a requirement for a complete type/deduced return type in a non-tf_error context, and later warns if the type/function becomes complete. This warning is enabled by default; I think the signal-to-noise ratio is high enough to warrant that, and it catches things that are likely to make the program "ill-formed, no diagnostic required". friend87.C is an interesting case; this could be considered a false positive because it is using friend injection to define the auto function to implement a compile-time counter. I think this is sufficiently pathological that it's fine to expect people who want to play this sort of game to suppress the warning. The data for this warning uses GTY((cache)) to persist through GC, but allow entries to be discarded if the key is not otherwise marked. I don't think it's desirable to export/import this information in modules, it makes sense for it to be local to a single TU. -Wsfinae-incomplete=2 adds a warning at the point of failure, which is primarily intended to help with debugging warnings from the default mode. gcc/ChangeLog: * doc/invoke.texi: Document -Wsfinae-incomplete. gcc/c-family/ChangeLog: * c.opt: Add -Wsfinae-incomplete. * c.opt.urls: Regenerate. gcc/cp/ChangeLog: * constraint.cc (failed_completions_map): New. (note_failed_type_completion): Rename from note_failed_type_completion_for_satisfaction. Add -Wsfinae-incomplete handling. (failed_completion_location): New. * class.cc (finish_struct_1): Add -Wsfinae-incomplete warning. * decl.cc (require_deduced_type): Adjust. (finish_function): Add -Wsfinae-incomplete warning. * typeck.cc (complete_type_or_maybe_complain): Adjust. (cxx_sizeof_or_alignof_type): Call note_failed_type_completion. * pt.cc (dependent_template_arg_p): No longer static. * cp-tree.h: Adjust. libstdc++-v3/ChangeLog: * testsuite/20_util/is_complete_or_unbounded/memoization.cc * testsuite/20_util/is_complete_or_unbounded/memoization_neg.cc: Expect -Wsfinae-incomplete. gcc/testsuite/ChangeLog: * g++.dg/template/friend87.C * g++.dg/cpp2a/concepts-complete1.C * g++.dg/cpp2a/concepts-complete2.C * g++.dg/cpp2a/concepts-complete3.C * g++.dg/cpp2a/concepts-complete4.C: Expect -Wsfinae-incomplete.
2025-06-10gcn: Add experimental MI300 (gfx942) supportTobias Burnus2-8/+19
As gfx942 and gfx950 belong to gfx9-4-generic, the latter two are also added. Note that there are no specific optimizations for MI300, yet. For none of the mentioned devices, any multilib is build by default; use '--with-multilib-list=' when configuring GCC to build them alongside. gfx942 was added in LLVM (and its mc assembler, used by GCC) in version 18, generic support in LLVM 19 and gfx950 in LLVM 20. gcc/ChangeLog: * 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. libgomp/ChangeLog: * testsuite/libgomp.c/declare-variant-4.h (gfx942): New variant function. * testsuite/libgomp.c/declare-variant-4-gfx942.c: New test.
2025-06-10RISC-V: Regen riscv-ext.texi [NFC]Kito Cheng1-1/+1
Regenerates the `riscv-ext.texi` file in the GCC documentation. gcc/ChangeLog: * doc/riscv-ext.texi: Regen.
2025-06-09AArch64 docs: add itemx for outline-atomics docsTamar Christina1-0/+1
The documentation for outline atomics is missing the entry for -mno-outline-atomics which this patch adds. gcc/ChangeLog: * doc/extend.texi (outline-atomics): Document the inverse -mno flag.
2025-06-09middle-end: Add new parameter to scale scalar loop costing in vectorizerTamar Christina1-0/+4
This patch adds a new param vect-scalar-cost-multiplier to scale the scalar costing during vectorization. If the cost is set high enough and when using the dynamic cost model it has the effect of effectively disabling the costing vs scalar and assumes all vectorization to be profitable. This is similar to using the unlimited cost model, but unlike unlimited it does not fully disable the vector cost model. That means that we still perform comparisons between vector modes. And it means it also still does costing for alias analysis. As an example, the following: void foo (char *restrict a, int *restrict b, int *restrict c, int *restrict d, int stride) { if (stride <= 1) return; for (int i = 0; i < 3; i++) { int res = c[i]; int t = b[i * stride]; if (a[i] != 0) res = t * d[i]; c[i] = res; } } compiled with -O3 -march=armv8-a+sve -fvect-cost-model=dynamic fails to vectorize as it assumes scalar would be faster, and with -fvect-cost-model=unlimited it picks a vector type that's so big that the large sequence generated is working on mostly inactive lanes: ... and p3.b, p3/z, p4.b, p4.b whilelo p0.s, wzr, w7 ld1w z23.s, p3/z, [x3, #3, mul vl] ld1w z28.s, p0/z, [x5, z31.s, sxtw 2] add x0, x5, x0 punpklo p6.h, p6.b ld1w z27.s, p4/z, [x0, z31.s, sxtw 2] and p6.b, p6/z, p0.b, p0.b punpklo p4.h, p7.b ld1w z24.s, p6/z, [x3, #2, mul vl] and p4.b, p4/z, p2.b, p2.b uqdecw w6 ld1w z26.s, p4/z, [x3] whilelo p1.s, wzr, w6 mul z27.s, p5/m, z27.s, z23.s ld1w z29.s, p1/z, [x4, z31.s, sxtw 2] punpkhi p7.h, p7.b mul z24.s, p5/m, z24.s, z28.s and p7.b, p7/z, p1.b, p1.b mul z26.s, p5/m, z26.s, z30.s ld1w z25.s, p7/z, [x3, #1, mul vl] st1w z27.s, p3, [x2, #3, mul vl] mul z25.s, p5/m, z25.s, z29.s st1w z24.s, p6, [x2, #2, mul vl] st1w z25.s, p7, [x2, #1, mul vl] st1w z26.s, p4, [x2] ... With -fvect-cost-model=dynamic --param vect-scalar-cost-multiplier=200 you get more reasonable code: foo: cmp w4, 1 ble .L1 ptrue p7.s, vl3 index z0.s, #0, w4 ld1b z29.s, p7/z, [x0] ld1w z30.s, p7/z, [x1, z0.s, sxtw 2] ptrue p6.b, all cmpne p7.b, p7/z, z29.b, #0 ld1w z31.s, p7/z, [x3] mul z31.s, p6/m, z31.s, z30.s st1w z31.s, p7, [x2] .L1: ret This model has been useful internally for performance exploration and cost-model validation. It allows us to force realistic vectorization overriding the cost model to be able to tell whether it's correct wrt to profitability. gcc/ChangeLog: * params.opt (vect-scalar-cost-multiplier): New. * tree-vect-loop.cc (vect_estimate_min_profitable_iters): Use it. * doc/invoke.texi (vect-scalar-cost-multiplier): Document it. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/cost_model_16.c: New test.
2025-06-06Fix index of some warnings [PR120572]Andrew Pinski1-2/+2
The problem here is opindex should not include the `-` part of the option. But Wmusttail-local-addr and Wno-maybe-musttail-local-addr currently do. This deletes them. Pushed as obvious after building the html. PR tree-optimization/120572 gcc/ChangeLog: * doc/invoke.texi (Wmusttail-local-addr, Wno-maybe-musttail-local-addr): Fix opindex. * common.opt.urls: Regenerate. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-06-06RISC-V: Support -mcpu for XiangShan Kunminghu cpu.Jiawei1-2/+2
This patch adds support for the XiangShan Kunminghu CPU in GCC, allowing the use of the `-mcpu=xiangshan-kunminghu` option. XiangShan-KunMingHu is the third-generation open-source high-performance RISC-V processor.[1] You can find the corresponding ISA extension from the XiangShan Github repository.[2] The latest news of KunMingHu can be found in the XiangShan Biweekly.[3] [1] https://github.com/OpenXiangShan/XiangShan-User-Guide/releases. [2] https://github.com/OpenXiangShan/XiangShan/blob/master/src/main/scala/xiangshan/Parameters.scala [3] https://docs.xiangshan.cc/zh-cn/latest/blog A dedicated scheduling model for KunMingHu's hybrid pipeline will be proposed in a subsequent PR. gcc/ChangeLog: * config/riscv/riscv-cores.def (RISCV_TUNE): New cpu tune. (RISCV_CORE): New cpu. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/mcpu-xiangshan-kunminghu.c: New test. Co-Authored-By: Jiawei Chen <jiawei@iscas.ac.cn> Co-Authored-By: Yangyu Chen <cyy@cyyself.name> Co-Authored-By: Tang Haojin <tanghaojin@outlook.com>
2025-06-05doc: update links to c99status.htmlMarek Polacek2-4/+4
gcc/ChangeLog: * doc/invoke.texi: Update a link to c99status.html. * doc/standards.texi: Likewise.
2025-06-05RISC-V: Support Ssu64xl extension.Jiawei1-0/+4
Support the Ssu64xl extension, which requires UXLEN to be 64. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-ssu64xl.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Sstvecd extension.Jiawei1-0/+4
Support the Sstvecd extension, which allows Supervisor Trap Vector Base Address register (stvec) to support Direct mode. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-sstvecd.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Sstvala extension.Jiawei1-0/+4
Support the Sstvala extension, which provides all needed values in Supervisor Trap Value register (stval). gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-sstvala.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Sscounterenw extension.Jiawei1-0/+4
Support the Sscounterenw extension, which allows writeable enables for any supported counter. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-sscounterenw.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Ssccptr extension.Jiawei1-0/+4
Support the Ssccptr extension, which allows the main memory to support page table reads. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-ssccptr.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Smrnmi extension.Jiawei1-0/+4
Support the Smrnmi extension, which provides new CSRs for Machine mode Non-Maskable Interrupts. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-smrnmi.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05RISC-V: Support Sm/scsrind extensions.Jiawei1-0/+8
Support the Sm/scsrind extensions, which provide indirect access to machine-level CSRs. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension definition. * config/riscv/riscv-ext.opt: New extension mask. * doc/riscv-ext.texi: Document the new extension. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-smcsrind.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-05gcn: Update --with-arch= for newer archsTobias Burnus1-3/+7
Replace hard-coded list of supported devices by directly checking config/gcn/gcn-devices.def. gcc/ChangeLog: * config.gcc (--with-{arch,tune}): Use .def file to validate gcn processor names. * doc/install.texi (amdgcn*-*-*): Update list of devices supported by --with-arch/--with-tune.
2025-06-04[PATCH v2] RISC-V: Add svbare extension.Dongyan Chen1-0/+4
This patch support svbare extension, which is an extension in RVA23 profile. To enable GCC to recognize and process svbare extension correctly at compile time. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension defs. * config/riscv/riscv-ext.opt: Ditto. * doc/riscv-ext.texi: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-60.c: New test.
2025-06-04RISC-V: Add Shlcofideleg extension.Jiawei1-0/+4
This patch add the RISC-V Shlcofideleg extension. It supports delegating LCOFI interrupts(the count-overflow interrupts) to VS-mode.[1] [1] https://riscv.github.io/riscv-isa-manual/snapshot/privileged gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension defs. * config/riscv/riscv-ext.opt: Ditto. * doc/riscv-ext.texi: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-shlocofideleg.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
2025-06-02[PATCH] RISC-V: Add smcntrpmf extension.Dongyan Chen1-0/+4
This patch support smcntrpmf extension[1]. To enable GCC to recognize and process smcntrpmf extension correctly at compile time. [1]https://github.com/riscvarchive/riscv-smcntrpmf gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension defs. * config/riscv/riscv-ext.opt: Ditto. * doc/riscv-ext.texi: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-59.c: New test.
2025-06-02or1k: Support long jump offsets with -mcmodel=largeStafford Horne1-3/+4
The -mcmodel=large option was originally added to handle generation of large binaries with large PLTs. However, when compiling the Linux kernel with allyesconfig the output binary is so large that the jump instruction 26-bit immediate is not large enough to store the jump offset to some symbols when linking. Example error: relocation truncated to fit: R_OR1K_INSN_REL_26 against symbol `do_fpe_trap' defined in .text section in arch/openrisc/kernel/traps.o We fix this by forcing jump offsets to registers when -mcmodel=large. Note, to get the Linux kernel allyesconfig config to work with OpenRISC, this patch is needed along with some other patches to the Linux hand coded assembly bits. gcc/ChangeLog: * config/or1k/predicates.md (call_insn_operand): Add condition to not allow symbol_ref operands with TARGET_CMODEL_LARGE. * config/or1k/or1k.opt: Document new -mcmodel=large implications. * doc/invoke.texi: Likewise. gcc/testsuite/ChangeLog: * gcc.target/or1k/call-1.c: New test. * gcc.target/or1k/got-1.c: New test.
2025-06-02testsuite: Add tls_link effective targetChristophe Lyon1-0/+3
Some tests have 'dg-do link' but currently require 'tls' which is a compile-only check. In some configurations of arm-none-eabi, the 'tls' effective-target can be successful although these tests fail to link with undefined reference to `__aeabi_read_tp' This patch as a new tls_link effective target which makes sure we can build an executable. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_tls_link): New. * g++.dg/tls/pr102496-1.C: Require tls_link. * g++.dg/tls/pr77285-1.C: Likewise. gcc/ChangeLog: * doc/sourcebuild.texi (tls_link): Add documentation.
2025-05-31PR modula2/120389 Assigning wrong type to an array causes an ICEGaius Mulley1-0/+3
This patch provides follow on fixes for undetected type violations which can occur then Lvalues are generated during assignment. For example array accesses and with statements. The type checker M2Check.mod has been overhauled and cleaned up. gcc/ChangeLog: PR modula2/120389 * doc/gm2.texi (-fm2-strict-type-reason): Document new flag. gcc/m2/ChangeLog: PR modula2/120389 * gm2-compiler/M2Check.def (AssignmentTypeCompatible): Add new parameter enableReason. * gm2-compiler/M2Check.mod (EquivalenceProcedure): New type. (falseReason2): New procedure function. (falseReason1): Ditto. (falseReason0): Ditto. (checkTypeEquivalence): Rewrite. (checkUnboundedArray): Ditto. (checkUnbounded): Ditto. (checkArrayTypeEquivalence): Ditto. (checkCharStringTypeEquivalence): Ditto. (buildError4): Add false reason. (buildError2): Ditto. (IsTyped): Use GetDType. (IsTypeEquivalence): New procedure function. (checkVarTypeEquivalence): Ditto. (checkVarEquivalence ): Rewrite. (checkConstMeta): Ditto. (checkEnumField): New procedure function. (checkEnumFieldEquivalence): Ditto. (checkSubrangeTypeEquivalence): Rewrite. (checkSystemEquivalence): Ditto. (checkTypeKindViolation): Ditto. (doCheckPair): Ditto. (InitEquivalenceArray): New procedure. (addEquivalence): Ditto. (checkProcType): Rewrite. (deconstruct): Deallocate reason string. (AssignmentTypeCompatible): Initialize reason and reasonEnable fields. (ParameterTypeCompatible): Ditto. (doExpressionTypeCompatible): Ditto. * gm2-compiler/M2GenGCC.mod (CodeIndrX) Rewrite. (CheckBinaryExpressionTypes): Rewrite and simplify now that the type checker is more robust. (CheckElementSetTypes): Ditto. (CodeXIndr): Add new range assignment type check. * gm2-compiler/M2MetaError.def: Correct comments. * gm2-compiler/M2Options.def (SetStrictTypeAssignment): New procedure. (SetStrictTypeReason): Ditto. * gm2-compiler/M2Options.mod: (SetStrictTypeAssignment): New procedure. (SetStrictTypeReason): Ditto. (StrictTypeReason): Initialize. (StrictTypeAssignment): Ditto. * gm2-compiler/M2Quads.mod (CheckBreak): Delete. (BreakQuad): New global variable. (BreakAtQuad): Delete. (gdbhook): New procedure. (BreakWhenQuadCreated): Ditto. (CheckBreak): Ditto. (Init): Call BreakWhenQuadCreated and gdbhook. (doBuildAssignment): Add type assignment range check. (CheckProcTypeAndProcedure): Only check if the procedure types differ. (doIndrX): Add type IndrX range check. (CheckReturnType): Add range return type check. * gm2-compiler/M2Range.def (InitTypesIndrXCheck): New procedure function. (InitTypesReturnTypeCheck): Ditto. * gm2-compiler/M2Range.mod (InitTypesIndrXCheck): New procedure function. (InitTypesReturnTypeCheck): Ditto. (HandlerExists): Add new clauses. (FoldAssignment): Pass extra FALSE parameter to AssignmentTypeCompatible. (FoldTypeReturnFunc): New procedure. (FoldTypeAssign): Ditto. (FoldTypeIndrX): Ditto. (CodeTypeAssign): Rewrite. (CodeTypeIndrX): New procedure. (CodeTypeReturnFunc): Ditto. (FoldTypeCheck): Add new case clauses. (CodeTypeCheck): Ditto. (FoldRangeCheckLower): Ditto. (IssueWarning): Ditto. * gm2-gcc/m2options.h (M2Options_SetStrictTypeAssignment): New function prototype. (M2Options_SetStrictTypeReason): Ditto. * gm2-lang.cc (gm2_langhook_handle_option): New case clause OPT_fm2_strict_type_reason. * lang.opt (-fm2-strict-type-reason): New option. gcc/testsuite/ChangeLog: PR modula2/120389 * gm2/pim/fail/testcharint.mod: New test. * gm2/pim/fail/testindrx.mod: New test. * gm2/pim/pass/testxindr.mod: New test. * gm2/pim/pass/testxindr2.mod: New test. * gm2/pim/pass/testxindr3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-30c: Update description of C library facilities provided by GCC for C23Joseph Myers3-22/+39
The documentation of which standard C library facilities (headers) are provided by GCC, as being those required of freestanding implementations, is reasonably accurate for C99 and before (if you ignore the provision of <tgmath.h> for non-GNU targets). It's less accurate for C11, since we provide <stdatomic.h> although that's not required for freestanding implementations. And it's very inaccurate for C23, which specifies that freestanding implementations also provide most of <string.h>, memalignment from <stdlib.h>, and, when supporting Annex F, also <fenv.h>, <math.h> and the strto* floating-point numeric conversion functions from <stdlib.h>. I don't think expanding the scope of the C library facilities GCC provides to include all those extra facilities specified by C23 for freestanding implementations is a good idea. (Indeed, GCC once used to install assert.h on some platforms, but stopped doing so a long time ago.) Rather, it seems better to document that in both the freestanding and the hosted cases, GCC is intended to provide the compiler part of a conforming implementation, to be combined with a corresponding library implementation, rather than providing all the required library facilities in either case. The rule about which headers GCC provides is then described in terms of headers not declaring functions with external linkage, which is much closer to existing practice, although still not perfect in all cases (<stdatomic.h>, although mainly providing type-generic operations, does declare a few non-type-generic functions that we provide in libatomic). A paragraph in trouble.texi that talks about freestanding implementations with -ansi -pedantic is not changed (given that the description in terms of freestanding implementations is sufficiently accurate for C90); if the -ansi there were changed to an option for a more recent standard, a corresponding change to that paragraph might be needed as well. Tested with "make info html pdf". * doc/standards.texi (C Language): Document library facilities provided in terms of headers not declaring functions with external linkage, not in terms of headers required of freestanding implementations. * doc/sourcebuild.texi (Subdirectories, Headers): Likewise. * doc/trouble.texi (Standard Libraries): Likewise.
2025-05-29RISC-V: Add minimal support of double trap extension 1.0Jerry Zhang Jian1-0/+8
Add support of double trap extension [1], enabling GCC to recognize the following extensions at compile time. New extensions: - ssdbltrp - smdbltrp [1] https://github.com/riscv/riscv-double-trap/releases/download/v1.0/riscv-double-trap.pdf gcc/ChangeLog: * config/riscv/riscv-ext.def: New extensions * config/riscv/riscv-ext.opt: Auto re-generated * doc/riscv-ext.texi: Auto re-generated gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-57.c: New test * gcc.target/riscv/arch-58.c: New test Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-05-28doc: Fix extend.texi menuHaochen Jiang1-0/+1
commit 517c9487f8fdc4e4e90252a9365e5823259dc783 Author: Alejandro Colomar <alx@kernel.org> Date: Thu May 22 01:15:36 2025 +0200 c: Add _Countof operator [PR117025] broke gcc build on RHEL 9 when building texi files (with bundled makeinfo 6.7): gcc/doc/extend.texi:6: node `C Extensions' lacks menu item for `_Countof' despite being its Up target The same fail will happen for makeinfo <= 6.7, while won't fail when makeinfo >= 6.8. Fixed by adding the missing menu entires. gcc/ChangeLog: * doc/extend.texi (C Extensions): Add missing menu items.
2025-05-27c: Add _Countof operator [PR117025]Alejandro Colomar1-0/+30
This operator is similar to sizeof but can only be applied to an array, and returns its number of elements. FUTURE DIRECTIONS: - We should make it work with array parameters to functions, and somehow magically return the number of elements of the array, regardless of it being really a pointer. Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3550.pdf> Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117025> Link: <https://inbox.sourceware.org/gcc/M8S4oQy--3-2@tutanota.com/T/> Link: <https://inbox.sourceware.org/gcc-patches/20240728141547.302478-1-alx@kernel.org/T/#t> Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3313.pdf> Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3325.pdf> Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3369.pdf> Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3469.htm> Link: <https://github.com/llvm/llvm-project/issues/102836> Link: <https://thephd.dev/the-big-array-size-survey-for-c> Link: <https://thephd.dev/the-big-array-size-survey-for-c-results> Link: <https://stackoverflow.com/questions/37538/#57537491> PR c/117025 gcc/ChangeLog: * doc/extend.texi: Document _Countof operator. gcc/c-family/ChangeLog: * c-common.h (enum rid): Add RID_COUNTOF. (c_countof_type): New function prototype. * c-common.def (COUNTOF_EXPR): New tree. * c-common.cc (c_common_reswords): Add RID_COUNTOF entry. (c_countof_type): New function. gcc/c/ChangeLog: * c-tree.h (in_countof): Add global variable declaration. (c_expr_countof_expr): Add function prototype. (c_expr_countof_type): Add function prototype. * c-decl.cc (start_struct, finish_struct): Add support for _Countof. (start_enum, finish_enum): Add support for _Countof. * c-parser.cc (c_parser_sizeof_expression): New macro. (c_parser_countof_expression): New macro. (c_parser_sizeof_or_countof_expression): Rename function and add support for _Countof. (c_parser_unary_expression): Add RID_COUNTOF entry. * c-typeck.cc (in_countof): Add global variable. (build_external_ref): Add support for _Countof. (record_maybe_used_decl): Add support for _Countof. (pop_maybe_used): Add support for _Countof. (is_top_array_vla): New function. (c_expr_countof_expr, c_expr_countof_type): New functions. gcc/testsuite/ChangeLog: * gcc.dg/countof-compile.c: New test. * gcc.dg/countof-vla.c: New test. * gcc.dg/countof-vmt.c: New test. * gcc.dg/countof-zero-compile.c: New test. * gcc.dg/countof-zero.c: New test. * gcc.dg/countof.c: New test. Suggested-by: Xavier Del Campo Romero <xavi.dcr@tutanota.com> Co-authored-by: Martin Uecker <uecker@tugraz.at> Acked-by: "James K. Lowden" <jklowden@schemamania.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-05-27diagnostics: rework experimental-html output [PR116792]David Malcolm1-2/+9
This patch reworks the HTML output from the the option -fdiagnostics-add-output=experimental-html so that for source quoting and path printing, rather than simply adding the textual output inside <pre> elements, it breaks up the output into HTML tags reflecting the structure of the output, using CSS, SVG and a little javascript to help the user navigate the diagnostics and the events within any paths. This uses ideas from the patch I posted in: https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558603.html but reworks the above patch so that: * rather than printing source to a pretty_printer, the HTML is created by building a DOM tree in memory, using a new xml::printer class. This should be less error-prone than the pretty_printer approach, since it ought to solve escaping issues. Instead of a text vs html boolean, the code is generalized via templates with to_text vs to_html sinks. This templatization applies both to path-printing and diagnostic-show-locus.cc. * the HTML output can have multiple diagnostics and multiple paths rather than just a single path. The javascript keyboard controls now cycle through all diagnostics and all events within them An example of the output can be seen at: https://dmalcolm.fedorapeople.org/gcc/2025-05-27/malloc-1.c.html where the keys "j" and "k" cycle through diagnostics and events within them. gcc/ChangeLog: PR other/116792 * diagnostic-format-html.cc: Define INCLUDE_STRING. Include "xml.h", "xml-printer.h", and "json.h". (html_generation_options::html_generation_options): New. (namespace xml): Move decls to xml.h and convert from using label_text to std::string. (xml::text::write_as_xml): Reimplement indentation so it is done by this node, rather than the parent. (xml::node_with_children::add_text): Convert from label_text to std::string. Consolidate runs of text into a single node. (xml::document::write_as_xml): Reimplement indentation. (xml::element::write_as_xml): Reimplement indentation so it is done by this node, rather than the parent. Convert from label_text to std::string. Update attribute-printing to new representation to preserve insertion order. (xml::element::set_attr): Convert from label_text to std::string. Record insertion order. (xml::raw::write_as_xml): New. (xml::printer::printer): New. (xml::printer::push_tag): New. (xml::printer::push_tag_with_class): New. (xml::printer::pop_tag): New. (xml::printer::set_attr): New. (xml::printer::add_text): New. (xml::printer::add_raw): New. (xml::printer::push_element): New. (xml::printer::append): New. (xml::printer::get_insertion_point): New. (html_builder::add_focus_id): New. (html_builder::m_html_gen_opts): New field. (html_builder::m_head_element): New field. (html_builder::m_next_diag_id): New field. (html_builder::m_ui_focus_ids): New field. (make_div): Convert from label_text to std::string. (make_span): Likewise. (HTML_STYLE): New. (HTML_SCRIPT): New. (html_builder::html_builder): Fix indentation. Add "html_gen_opts" param. Initialize new fields. Reimplement using xml::printer. Optionally add style and script tags. (class html_path_label_writer): New. (html_builder::make_element_for_diagnostic): Convert from label_text to std::string. Set "id" on "gcc-diagnostic" and "gcc-message" <div> elements; add the latter to the focus ids. Use diagnostic_context::maybe_show_locus_as_html rather than html_builder::make_element_for_source. Use print_path_as_html rather than html_builder::make_element_for_path. (html_builder::make_element_for_source): Drop. (html_builder::make_element_for_path): Drop. (html_builder::make_element_for_patch): Convert from label_text to std::string. (html_builder::make_metadata_element): Likewise. Use xml::printer. (html_builder::make_element_for_metadata): Convert from label_text to std::string. (html_builder::emit_diagram): Expand comment. (html_builder::flush_to_file): Write out initializer for "focus_ids" into javascript. (html_output_format::html_output_format): Add param "html_gen_opts" and use it to initialize m_builder. (html_file_output_format::html_file_output_format): Likewise, to initialize base class. (make_html_sink): Likewise, to pass to ctor. (selftest::test_html_diagnostic_context::test_html_diagnostic_context): Set up html_generation_options. (selftest::html_buffered_output_format::html_buffered_output_format): Add html_gen_opts param. (selftest::test_simple_log): Add id attributes to expected text for "gcc-diagnostic" and "gcc-message" elements. Update whitespace for indentation fixes. (selftest::test_metadata): Update whitespace for indentation fixes. (selftest::test_printer): New selftest. (selftest::test_attribute_ordering): New selftest. (selftest::diagnostic_format_html_cc_tests): Call the new selftests. * diagnostic-format-html.h (struct html_generation_options): New. (make_html_sink): Add "html_gen_opts" param. (print_path_as_html): New decl. * diagnostic-path-output.cc: Define INCLUDE_MAP. Add includes of "diagnostic-format-html.h", "xml.h", and "xml-printer.h". (path_print_policy::path_print_policy): Add ctor. (path_print_policy::get_diagram_theme): Fix whitespace. (struct stack_frame): New. (begin_html_stack_frame): New function. (end_html_stack_frame): New function. (emit_svg_arrow): New function. (event_range::print): Rename to... (event_range::print_as_text): ...this. Update call to diagnostic_start_span. (event_range::print_as_html): New, based on the above, but ported from pretty_printer to xml::printer. (thread_event_printer::print_swimlane_for_event_range): Rename to... (thread_event_printer::print_swimlane_for_event_range_as_text): ...this. Update for renaming of event_range::print to event_range::print_as_text. (thread_event_printer::print_swimlane_for_event_range_as_html): New. (print_path_summary_as_text): Update for "_as_text" renaming. (print_path_summary_as_html): New. (print_path_as_html): New. * diagnostic-show-locus.cc: Add defines of INCLUDE_MAP and INCLUDE_STRING. Add includes of "xml.h" and "xml-printer.h". (struct char_display_policy): Replace "m_print_cb" with "m_print_text_cb" and "m_print_html_cb". (struct to_text): New. (struct to_html): New. (get_printer): New. (default_diagnostic_start_span_fn<to_text>): New. (default_diagnostic_start_span_fn<to_html>): New. (class layout): Update "friend class layout_printer;" for template. (enum class margin_kind): New. (class layout_printer): Convert into a template. (layout_printer::m_pp): Replace field with... (layout_printer::m_sink): ...this. (layout_printer::m_colorizer): Drop field in favor of a pointer in the "to_text" sink. (default_print_decoded_ch): Convert into a template. (escape_as_bytes_print): Likewise. (escape_as_unicode_print): Likewise. (make_char_policy): Update to use both text and html callbacks. (layout_printer::print_gap_in_line_numbering): Replace with... (layout_printer<to_text>::print_gap_in_line_numbering): ...this (layout_printer<to_html>::print_gap_in_line_numbering): ...and this. (layout_printer::print_source_line): Convert to template, using m_sink. (layout_printer::print_leftmost_column): Likewise. (layout_printer::start_annotation_line): Likewise. (layout_printer<to_text>::end_line): New. (layout_printer<to_html>::end_line): New. (layout_printer::print_annotation_line): Convert to template, using m_sink. (class line_label): Add field m_original_range_idx. (layout_printer<to_text>::begin_label): New. (layout_printer<to_html>::begin_label): New. (layout_printer<to_text>::end_label): New. (layout_printer<to_html>::end_label): New. (layout_printer::print_any_labels): Convert to template, using m_sink. (layout_printer::print_leading_fixits): Likewise. (layout_printer::print_trailing_fixits): Likewise. (layout_printer::print_newline): Drop. (layout_printer::move_to_column): Convert to template, using m_sink. (layout_printer::show_ruler): Likewise. (layout_printer::print_line): Likewise. (layout_printer::print_any_right_to_left_edge_lines): Likewise. (layout_printer::layout_printer): Likewise. (diagnostic_context::maybe_show_locus_as_html): New. (diagnostic_source_print_policy::diagnostic_source_print_policy): Update for split of start_span_cb into text vs html variants. (diagnostic_source_print_policy::print): Update for use of templates; use to_text. (diagnostic_source_print_policy::print_as_html): New. (layout_printer::print): Convert to template, using m_sink. (selftest::make_element_for_locus): New. (selftest::make_raw_html_for_locus): New. (selftest::test_layout_x_offset_display_utf8): Update for use of templates. (selftest::test_layout_x_offset_display_tab): Likewise. (selftest::test_one_liner_caret_and_range): Add test coverage of HTML output. (selftest::test_one_liner_labels): Likewise. * diagnostic.cc (diagnostic_context::initialize): Update for split of start_span_cb into text vs html variants. (default_diagnostic_start_span_fn): Move to diagnostic-show-locus.cc, converting to template. * diagnostic.h (class xml::printer): New forward decl. (diagnostic_start_span_fn): Replace typedef with "using", converting to a template. (struct to_text): New forward decl. (struct to_html): New forward decl. (get_printer): New decl. (diagnostic_location_print_policy::print_text_span_start): New decl. (diagnostic_location_print_policy::print_html_span_start): New decl. (class html_label_writer): New. (diagnostic_source_print_policy::print_as_html): New decl. (diagnostic_source_print_policy::get_start_span_fn): Replace with... (diagnostic_source_print_policy::get_text_start_span_fn): ...this (diagnostic_source_print_policy::get_html_start_span_fn): ...and this (diagnostic_source_print_policy::m_start_span_cb): Replace with... (diagnostic_source_print_policy::m_text_start_span_cb): ...this (diagnostic_source_print_policy::m_html_start_span_cb): ...and this. (diagnostic_context::maybe_show_locus_as_html): New decl. (diagnostic_context::m_text_callbacks::m_start_span): Replace with... (diagnostic_context::m_text_callbacks::m_text_start_span): ...this (diagnostic_context::m_text_callbacks::m_html_start_span): ...and this. (diagnostic_start_span): Update for template change. (diagnostic_show_locus_as_html): New inline function. (default_diagnostic_start_span_fn): Convert to template. * doc/invoke.texi (experimental-html): Add "css" and "javascript" keys. * opts-diagnostic.cc (html_scheme_handler::make_sink): Likewise. * selftest-diagnostic.cc (selftest::test_diagnostic_context::start_span_cb): Update for template changes. * selftest-diagnostic.h (selftest::test_diagnostic_context::start_span_cb): Likewise. * xml-printer.h: New file. * xml.h: New file, based on material in diagnostic-format-html.cc, but using std::string rather than label_text. (xml::element::m_key_insertion_order): New field. (struct xml::raw): New. gcc/fortran/ChangeLog PR other/116792 * error.cc (gfc_diagnostic_start_span): Update for diagnostic.h changes. gcc/testsuite/ChangeLog: PR other/116792 * gcc.dg/html-output/missing-semicolon.c: Add ":javascript=no" to html output. * gcc.dg/html-output/missing-semicolon.py: Move repeated definitions into lib/htmltest.py. * gcc.dg/plugin/diagnostic_group_plugin.cc: Update for template changes. * gcc.dg/plugin/diagnostic-test-metadata-html.c: Add ":javascript=no" to html output. Add "-fdiagnostics-show-line-numbers". * gcc.dg/plugin/diagnostic-test-metadata-html.py: Move repeated definitions into lib/htmltest.py. Add checks of annotated source. * gcc.dg/plugin/diagnostic-test-paths-2.c: Add ":javascript=no" to html output. * gcc.dg/plugin/diagnostic-test-paths-2.py: Move repeated definitions into lib/htmltest.py. Add checks of execution path. * gcc.dg/plugin/diagnostic-test-paths-4.c: Add -fdiagnostics-add-output=experimental-html:javascript=no. Add invocation ot diagnostic-test-paths-4.py. * gcc.dg/plugin/diagnostic-test-paths-4.py: New test script. * gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c: Add -fdiagnostics-add-output=experimental-html:javascript=no. Add invocation of diagnostic-test-show-locus.py. * gcc.dg/plugin/diagnostic-test-show-locus.py: New test script. * lib/htmltest.py: New test support script. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-05-27doc: Fix typo in description of nonstring attributeJonathan Wakely1-1/+1
gcc/ChangeLog: * doc/extend.texi (Common Variable Attributes): Fix typo in description of nonstring.
2025-05-26c++: add -fdump-lang-tinstJason Merrill1-24/+48
This patch adds a dump with a trace of template instantiations, indented based on the depth of recursive instantiation. -lineno adds the location that triggered the instantiation, -details adds non-instantiation sbustitutions. The instantiate_pending_templates change is to avoid a bunch of entries for reopening tinst scopes that we then don't instantiate anything with; it also seems a bit cleaner this way. gcc/cp/ChangeLog: * cp-tree.h: Declare tinst_dump_id. * cp-objcp-common.cc (cp_register_dumps): Set it. * pt.cc (push_tinst_level_loc): Dump it. (reopen_tinst_level): Here too. (tinst_complete_p): New. (instantiate_pending_templates): Don't reopen_tinst_level for already-complete instantiations. gcc/ChangeLog: * doc/invoke.texi: Move C++ -fdump-lang to C++ section. Add -fdump-lang-tinst.
2025-05-23Add a bootstrap-native build configAndi Kleen1-0/+7
... that uses -march=native -mtune=native to build a compiler optimized for the host. config/ChangeLog: * bootstrap-native.mk: New file. gcc/ChangeLog: * doc/install.texi: Document bootstrap-native.
2025-05-23doc: Fix implement-c.texi menuRainer Orth1-0/+2
commit fbb7f1cb5d3c8b7604e8f966e04330570de3e3ca Author: Joseph Myers <josmyers@redhat.com> Date: Thu May 22 21:39:37 2025 +0000 c: Document C23 implementation-defined behavior broke bootstrap on Ubuntu 20.04 (which bundles makeinfo 6.7) and elsewhere with a local installation of makeinfo 6.6: gcc/doc/implement-c.texi:5: node `C Implementation' lacks menu item for `Constant expressions implementation' despite being its Up target gcc/doc/implement-c.texi:5: node `C Implementation' lacks menu item for `Types implementation' despite being its Up target Fixed by adding the missing menu entries. 2025-05-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc: * doc/implement-c.texi (C Implementation): Add missing menu items.
2025-05-23RISC-V: Support CPUs in -march.Robin Dapp1-1/+1
This patch allows an -march string like -march=sifive-p670 in order override a previous -march in a simple way. Suppose we have a Makefile that specifies -march=rv64gc by default. A user-specified -mcpu=sifive-p670 would be after the -march in the options string and thus only set -mtune=sifive-p670 (as -mcpu does not override a previously specified -march or -mtune). So if we wanted to override we would need to specify the full, lengthy -march=rv64gcv_... string instead of a simple -mcpu=... Therefore this patch always first tries to interpret -march= as CPU string. If it is a supported CPU we use its march properties and let it override previously specified options. Otherwise the behavior is as before. This enables the "last-specified option wins" behavior GCC normally employs. Note that -march does not imply -mtune like on x86 or other targets. So an -march=CPU won't override a previously specified -mtune=other-CPU. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse_base_ext): Adjust error message. (riscv_handle_option): Parse as CPU string first. (riscv_expand_arch): Ditto. * doc/invoke.texi: Document. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-56.c: New test.
2025-05-22c: Document C23 implementation-defined behaviorJoseph Myers1-71/+175
Add references to C23 subclauses to the documentation of implementation-defined behavior, and new entries for implementation-defined behavior new in C23; change some references in the text to e.g. "C99 and C11" to encompass C23 as well. Tested with "make info html pdf". * doc/implement-c.texi: Document C23 implementation-defined behavior. (Constant expressions implementation, Types implementation): New nodes.
2025-05-22doc: Document the 'q' constraint for LoongArchXi Ruoyao1-0/+3
The kernel developers have requested such a constraint to use csrxchg in inline assembly. gcc/ChangeLog: * doc/md.texi: Document the 'q' constraint for LoongArch.
2025-05-20[PATCH v2 1/2] The following changes enable P8700 processor for RISCV and ↵Umesh Kalappa1-7/+7
P8700 is a high-performance processor from MIPS by extending RISCV with custom instructions Add support for the p8700 design from MIPS. gcc/ * config/riscv/mips-p8700.md: New scheduler model. * config/riscv/riscv-cores.def (mips-p87000): New tuning model and core architecture. * config/riscv/riscv-opts.h (riscv_microarchitecture_type); Add mips-p8700. * config/riscv/riscv.cc (mips_p8700_tune_info): New uarch tuning parameters. * config/riscv/riscv.md (tune): Add mips_p8700. Include mips-p8700.md * doc/invoke.texi: Document tune/cpu options for the MIPS P8700. Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
2025-05-19RISC-V: Add new operand constraint: cRKito Cheng1-0/+3
This commit introduces a new operand constraint `cR` for the RISC-V architecture, which allows the use of an even-odd RVC general purpose register (x8-x15) in inline asm. Ref: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/102 gcc/ChangeLog: * config/riscv/constraints.md (cR): New constraint. * doc/md.texi (Machine Constraints::RISC-V): Document the new cR constraint. gcc/testsuite/ChangeLog: * gcc.target/riscv/constraint-cR-pair.c: New test case.
2025-05-19i386: Remove avx10.1-256/512 and evex512 optionsHaochen Jiang3-33/+3
As we mentioned in GCC 15, we will remove avx10.1-256/512 and evex512 in GCC 16. Also, the combination of AVX10 and AVX512 option behavior will also be simplified in GCC 16 since AVX10.1 now implied AVX512, making the behavior matching everyone else. gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_available_features): Remove feature set for AVX10_1_256. * common/config/i386/i386-common.cc (OPTION_MASK_ISA2_EVEX512_SET): Removed. (OPTION_MASK_ISA2_AVX10_1_256_SET): Removed. (OPTION_MASK_ISA_AVX10_1_SET): Imply all AVX512 features. (OPTION_MASK_ISA2_AVX10_1_SET): Ditto. (OPTION_MASK_ISA2_AVX2_UNSET): Remove AVX10_1_UNSET. (OPTION_MASK_ISA2_EVEX512_UNSET): Removed. (OPTION_MASK_ISA2_AVX10_1_UNSET): Remove AVX10_1_256. (OPTION_MASK_ISA2_AVX512F_UNSET): Unset AVX10_1. (ix86_handle_option): Remove special handling for AVX512/AVX10.1 options, evex512 and avx10_1_256. Modify ISA set for AVX10 options. * common/config/i386/i386-cpuinfo.h (enum feature_priority): Remove P_AVX10_1_256. (enum processor_features): Remove FEATURE_AVX10_1_256. * common/config/i386/i386-isas.h: Remove avx10.1-256/512. * config/i386/avx512bf16intrin.h: Rollback target push before evex512 is introduced. * config/i386/avx512bf16vlintrin.h: Ditto. * config/i386/avx512bitalgintrin.h: Ditto. * config/i386/avx512bitalgvlintrin.h: Ditto. * config/i386/avx512bwintrin.h: Ditto. * config/i386/avx512cdintrin.h: Ditto. * config/i386/avx512dqintrin.h: Ditto. * config/i386/avx512fintrin.h: Ditto. * config/i386/avx512fp16intrin.h: Ditto. * config/i386/avx512fp16vlintrin.h: Ditto. * config/i386/avx512ifmaintrin.h: Ditto. * config/i386/avx512ifmavlintrin.h: Ditto. * config/i386/avx512vbmi2intrin.h: Ditto. * config/i386/avx512vbmi2vlintrin.h: Ditto. * config/i386/avx512vbmiintrin.h: Ditto. * config/i386/avx512vbmivlintrin.h: Ditto. * config/i386/avx512vlbwintrin.h: Ditto. * config/i386/avx512vldqintrin.h: Ditto. * config/i386/avx512vlintrin.h: Ditto. * config/i386/avx512vnniintrin.h: Ditto. * config/i386/avx512vnnivlintrin.h: Ditto. * config/i386/avx512vp2intersectintrin.h: Ditto. * config/i386/avx512vp2intersectvlintrin.h: Ditto. * config/i386/avx512vpopcntdqintrin.h: Ditto. * config/i386/avx512vpopcntdqvlintrin.h: Ditto. * config/i386/gfniintrin.h: Ditto. * config/i386/vaesintrin.h: Ditto. * config/i386/vpclmulqdqintrin.h: Ditto. * config/i386/driver-i386.cc (check_avx512_features): Removed. (host_detect_local_cpu): Remove -march=native special handling. * config/i386/i386-builtins.cc (ix86_vectorize_builtin_gather): Remove TARGET_EVEX512. * config/i386/i386-c.cc (ix86_target_macros_internal): Remove EVEX512 and AVX10_1_256. * config/i386/i386-expand.cc (ix86_valid_mask_cmp_mode): Remove TARGET_EVEX512. (ix86_expand_int_sse_cmp): Ditto. (ix86_vector_duplicate_simode_const): Ditto. (ix86_expand_vector_init_duplicate): Ditto. (ix86_expand_vector_init_one_nonzero): Ditto. (ix86_emit_swsqrtsf): Ditto. (ix86_vectorize_vec_perm_const): Ditto. (ix86_expand_vecop_qihi2): Ditto. (ix86_expand_sse2_mulvxdi3): Ditto. (ix86_gen_bcst_mem): Ditto. * config/i386/i386-isa.def (EVEX512): Removed. (AVX10_1_256): Ditto. * config/i386/i386-options.cc (isa2_opts): Remove evex512 and avx10.1-256. (ix86_function_specific_save): Remove no_avx512_explicit and no_avx10_1_explicit. (ix86_function_specific_restore): Ditto. (ix86_valid_target_attribute_inner_p): Remove evex512 and avx10.1-256/512. (ix86_valid_target_attribute_tree): Remove special handling to rerun ix86_option_override_internal for AVX10.1-256. (ix86_option_override_internal): Remove warning handling. (ix86_simd_clone_adjust): Remove evex512. * config/i386/i386.cc (type_natural_mode): Remove TARGET_EVEX512. (ix86_return_in_memory): Ditto. (standard_sse_constant_p): Ditto. (standard_sse_constant_opcode): Ditto. (ix86_get_ssemov): Ditto. (ix86_legitimate_constant_p): Ditto. (ix86_vectorize_builtin_scatter): Ditto. (ix86_hard_regno_mode_ok): Ditto. (ix86_set_reg_reg_cost): Ditto. (ix86_rtx_costs): Ditto. (ix86_vector_mode_supported_p): Ditto. (ix86_preferred_simd_mode): Ditto. (ix86_autovectorize_vector_modes): Ditto. (ix86_get_mask_mode): Ditto. (ix86_simd_clone_compute_vecsize_and_simdlen): Ditto. (ix86_simd_clone_usable): Ditto. * config/i386/i386.h (BIGGEST_ALIGNMENT): Ditto. (MOVE_MAX): Ditto. (STORE_MAX_PIECES): Ditto. (PTA_SKYLAKE_AVX512): Remove PTA_EVEX512. (PTA_CANNONLAKE): Ditto. (PTA_ZNVER4): Ditto. (PTA_GRANITERAPIDS): Use PTA_AVX10_1. (PTA_DIAMONDRAPIDS): Use PTA_GRANITERAPIDS. * config/i386/i386.md: Remove TARGET_EVEX512, avx512f_512 and avx512bw_512. * config/i386/i386.opt: Remove ix86_no_avx512_explicit, ix86_no_avx10_1_explicit, mevex512, mavx10.1-256/512 and warning for mavx10.1. Modify option comment. * config/i386/i386.opt.urls: Remove evex512 and avx10.1-256/512. * config/i386/predicates.md: Remove TARGET_EVEX512. * config/i386/sse.md: Ditto. * doc/extend.texi: Remove avx10.1-256/512. Modify avx10.1 doc. * doc/invoke.texi: Remove avx10.1-256/512 and evex512. * doc/sourcebuild.texi: Remove avx10.1-256/512. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_1-1.c: Remove warning. * gcc.target/i386/avx10_1-2.c: Ditto. * gcc.target/i386/avx10_1-3.c: Ditto. * gcc.target/i386/avx10_1-4.c: Ditto. * gcc.target/i386/pr111068.c: Ditto. * gcc.target/i386/pr117946.c: Ditto. * gcc.target/i386/pr117240_avx512f.c: Remove -mevex512 and warning. * gcc.target/i386/avx10_1-11.c: Rename to ... * gcc.target/i386/avx10_1-5.c: ... this. Remove warning. * gcc.target/i386/avx10_1-12.c: Rename to ... * gcc.target/i386/avx10_1-6.c: ... this. Remove warning. * gcc.target/i386/avx10_1-26.c: Rename to ... * gcc.target/i386/avx10_1-7.c: ... this. Remove warning. The origin avx10_1-7.c is removed. * gcc.target/i386/avx10_1-10.c: Removed. * gcc.target/i386/avx10_1-13.c: Removed. * gcc.target/i386/avx10_1-14.c: Removed. * gcc.target/i386/avx10_1-15.c: Removed. * gcc.target/i386/avx10_1-16.c: Removed. * gcc.target/i386/avx10_1-17.c: Removed. * gcc.target/i386/avx10_1-18.c: Removed. * gcc.target/i386/avx10_1-19.c: Removed. * gcc.target/i386/avx10_1-20.c: Removed. * gcc.target/i386/avx10_1-21.c: Removed. * gcc.target/i386/avx10_1-22.c: Removed. * gcc.target/i386/avx10_1-23.c: Removed. * gcc.target/i386/avx10_1-8.c: Removed. * gcc.target/i386/avx10_1-9.c: Removed. * gcc.target/i386/noevex512-1.c: Removed. * gcc.target/i386/noevex512-2.c: Removed. * gcc.target/i386/noevex512-3.c: Removed. * gcc.target/i386/pr111889.c: Removed. * gcc.target/i386/pr111907.c: Removed.
2025-05-17[PATCH] gcc: add trigonometric pi-based functions as gcc builtinsYuao Ma1-6/+31
I committed the wrong version on Yuao's behalf. This followup adds the documentation changes -- Jeff. This patch adds trigonometric pi-based functions as gcc builtins: acospi, asinpi, atan2pi, atanpi, cospi, sinpi, and tanpi. Latest glibc already provides support for these functions, which we plan to leverage in future gfortran implementations. The patch includes two test cases to verify both correct code generation and function definition. If approved, I suggest committing this foundational change first. Constant folding for these builtins will be addressed in subsequent patches. Best regards, Yuao From 9a9683d250078ce1bc687797c26ca05a9e91b350 Mon Sep 17 00:00:00 2001 From: Yuao Ma <c8ef@outlook.com> Date: Wed, 14 May 2025 22:14:00 +0800 Subject: [PATCH] gcc: add trigonometric pi-based functions as gcc builtins Add trigonometric pi-based functions as GCC builtins: acospi, asinpi, atan2pi, atanpi, cospi, sinpi, and tanpi. Latest glibc already provides support for these functions, which we plan to leverage in future gfortran implementations. The patch includes two test cases to verify both correct code generation and function definition. If approved, I suggest committing this foundational change first. Constant folding for these builtins will be addressed in subsequent patches. gcc/ChangeLog: * doc/extend.texi: Mention new builtins.
2025-05-16Further simplify the stdlib inline foldingVille Voutilainen1-1/+2
gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold): Do the conversion unconditionally, even for same-type cases. gcc/ChangeLog: * doc/invoke.texi: Add to_underlying to -ffold-simple-inlines.
2025-05-14RISC-V: Add augmented hypervisor series extensions.Jiawei1-0/+28
The augmented hypervisor series extensions 'sha'[1] is a new profile-defined extension series that captures the full set of features that are mandated to be supported along with the 'H' extension. [1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23s64-profile Version log: Update implements, fix testcase format. gcc/ChangeLog: * config/riscv/riscv-ext.def: New extension defs. * config/riscv/riscv-ext.opt: Ditto. * doc/riscv-ext.texi: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-55.c: New test.
2025-05-13RISC-V: Generate extension table in documentation from riscv-ext.defKito Cheng2-494/+638
Automatically build the ISA extension reference table in invoke.texi from the unified riscv-ext.def metadata, ensuring documentation stays in sync with extension definitions and reducing manual maintenance. gcc/ChangeLog: * doc/invoke.texi: Replace hand‑written extension table with `@include riscv-ext.texi` to pull in auto‑generated entries. * doc/riscv-ext.texi: New generated definition file containing formatted documentation entries for each extension. * Makefile.in: Add riscv-ext.texi to the list of files to be processed by the Texinfo generator. * config/riscv/gen-riscv-ext-texi.cc: New. * config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
2025-05-12PR modula2/120188: documented example does not work assignvalue m2pluginGaius Mulley1-1/+1
This patch corrects the gm2 command line used in the documentation to invoke the m2-plugin. The patch also includes the documentation example in dejagnu test code with an expect script to check whether plugins were enabled. gcc/ChangeLog: PR modula2/120188 * doc/gm2.texi (Semantic checking): Add -fm2-plugin command line option. gcc/testsuite/ChangeLog: PR modula2/120188 * lib/gm2-dg.exp (gm2-dg-frontend-configure-check): New function. (gm2-dg-runtest): Add -O2 to the option_list. * gm2.dg/doc/examples/plugin/fail/assignvalue.mod: New test. * gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-12nvptx: Support '-march=sm_61'Thomas Schwinge1-0/+1
gcc/ * config/nvptx/nvptx-sm.def: Add '61'. * config/nvptx/nvptx-gen.h: Regenerate. * config/nvptx/nvptx-gen.opt: Likewise. * config/nvptx/nvptx.cc (first_ptx_version_supporting_sm): Adjust. * config/nvptx/nvptx.opt (-march-map=sm_61, -march-map=sm_62): Likewise. * config.gcc: Likewise. * doc/invoke.texi (Nvidia PTX Options): Document '-march=sm_61'. * config/nvptx/gen-multilib-matches-tests: Extend. gcc/testsuite/ * gcc.target/nvptx/march-map=sm_61.c: Adjust. * gcc.target/nvptx/march-map=sm_62.c: Likewise. * gcc.target/nvptx/march=sm_61.c: New. libgomp/ * testsuite/libgomp.c/declare-variant-3-sm61.c: New. * testsuite/libgomp.c/declare-variant-3.h: Adjust.
2025-05-12nvptx: Support '-mptx=5.0'Thomas Schwinge1-0/+1
gcc/ * config/nvptx/nvptx-opts.h (enum ptx_version): Add 'PTX_VERSION_5_0'. * config/nvptx/nvptx.cc (ptx_version_to_string) (ptx_version_to_number): Adjust. * config/nvptx/nvptx.h (TARGET_PTX_5_0): New. * config/nvptx/nvptx.opt (Enum(ptx_version)): Add 'EnumValue' '5.0' for 'PTX_VERSION_5_0'. * doc/invoke.texi (Nvidia PTX Options): Document '-mptx=5.0'. gcc/testsuite/ * gcc.target/nvptx/mptx=5.0.c: New.