aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2025-07-25diagnostics: introduce diagnostics/source-printing.ccDavid Malcolm2-2/+2
Move diagnostic-show-locus.cc to diagnostics/source-printing.cc Move diagnostic-label-effects.h to diagnostics/source-printing-effects.h Move selftest-diagnostic-show-locus.h to diagnostics/selftest-source-printing.h No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS): Replace diagnostic-show-locus.o with diagnostics/source-printing.o. * diagnostic.h (class diagnostic_source_effect_info): Replace with... (class diagnotics::source_effect_info): ...this. * diagnostics/paths-output.cc: Likewise. Update for move of "diagnostic-label-effects.h" to "diagnostics/source-printing-effects.h". * diagnostics/sarif-sink.cc: Update for move of "selftest-diagnostic-show-locus.h" to "diagnostics/selftest-source-printing.h". * selftest-diagnostic-show-locus.h: Move to... * diagnostics/selftest-source-printing.h: ...here. * diagnostic-label-effects.h: Move to... * diagnostics/source-printing-effects.h: ...here, updating for above changes. * diagnostic-show-locus.cc: Move to... * diagnostics/source-printing.cc: ...here. * gcc-rich-location.h: Likewise. * selftest-run-tests.cc: Likewise. * selftest.h: Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show-template-tree-color-labels.C: Update for moves to "source-printing". * gcc.dg/plugin/diagnostic-test-show-locus.py: Likewise. libcpp/ChangeLog: * include/cpplib.h: Update for moves to "source-printing". * include/rich-location.h (class label_effects): Move to... (class diagnostics::label_effects): ...here. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move/rename output formats to diagnostics as "sinks"David Malcolm3-14/+13
Within gcc/ move diagnostic-buffer.h to diagnostics/buffering.h move diagnostic-format-html.cc to diagnostics/html-sink.cc move diagnostic-format-html.h to diagnostics/html-sink.h move diagnostic-format-sarif.cc to diagnostics/sarif-sink.cc move diagnostic-format-sarif.h to diagnostics/sarif-sink.h move diagnostic-format.h to diagnostics/sink.h move diagnostic-format-text.cc to diagnostics/text-sink.cc move diagnostic-format-text.h to diagnostics/text-sink.h renaming various types including: Old name: New name: diagnostic_output_format diagnostics::sink diagnostic_buffer diagnostics::buffer diagnostic_per_format_buffer diagnostics::per_sink_buffer diagnostic_text_output_format diagnostics::text_sink sarif_output_format diagnostics::sarif_sink diagnostic_sarif_format_buffer diagnostics::sarif_sink_buffer html_output_format diagnostics::html_sink diagnostic_html_format_buffer diagnostics::html_sink_buffer No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS): Replace diagnostic-format-html.o with diagnostics/html-sink.o, diagnostic-format-sarif.o with diagnostics/sarif-sink.o, and diagnostic-format-text.o with diagnostics/text-sink.o. * coretypes.h (class diagnostic_text_output_format): Replace with... (class diagnostics::text_sink): ...this. * diagnostic-global-context.cc: Update for move of diagnostics output formats into namespace "diagnostics", as "sinks". * diagnostic-macro-unwinding.cc: Likewise. * diagnostic-macro-unwinding.h: Likewise. * diagnostic-show-locus.cc: Likewise. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostic-buffer.h: Rename to... * diagnostics/buffering.h: ...this, updating for above changes. * diagnostics/client-data-hooks.h: Likewise. * diagnostics/digraphs.cc: Likewise. * diagnostic-format-html.cc: Rename to... * diagnostics/html-sink.cc: ...this, updating for above changes. * diagnostic-format-html.h: Rename to... * diagnostics/html-sink.h: ...this, updating for above changes. * diagnostics/lazy-paths.cc: Likewise. * diagnostics/metadata.h: Likewise. * diagnostics/output-spec.cc: Likewise. * diagnostics/output-spec.h: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/paths.h: Likewise. * diagnostic-format-sarif.cc: Rename to... * diagnostics/sarif-sink.cc: ...this, updating for above changes. * diagnostic-format-sarif.h: Rename to... * diagnostics/sarif-sink.h: ...this, updating for above changes. * diagnostic-format.h: Rename to... * diagnostics/sink.h: ...this, updating for above changes. * diagnostics/state-graphs-to-dot.cc: Likewise. * diagnostic-format-text.cc: Rename to... * diagnostics/text-sink.cc: ...this, updating for above changes. * diagnostic-format-text.h: Rename to... * diagnostics/text-sink.h: ...this, updating for above changes. * gcc.cc: Likewise. * langhooks-def.h: Likewise. * langhooks.cc: Likewise. * langhooks.h: Likewise. * libgdiagnostics.cc: Likewise. * opts-diagnostic.cc: Likewise. * opts.cc: Likewise. * selftest-diagnostic.cc: Likewise. * selftest-run-tests.cc: Likewise. * selftest.h: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/analyzer/ChangeLog: * ana-state-to-diagnostic-state.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". * bounds-checking.cc: Likewise. * call-details.cc: Likewise. * checker-event.cc: Likewise. * checker-event.h: Likewise. * diagnostic-manager.cc: Likewise. * diagnostic-manager.h: Likewise. * infinite-loop.cc: Likewise. * infinite-recursion.cc: Likewise. * pending-diagnostic.h: Likewise. * region-model.cc: Likewise. * sm-taint.cc: Likewise. gcc/c-family/ChangeLog: * c-opts.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". gcc/cp/ChangeLog: * cp-tree.h: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". * error.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". * gfortran.h: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". gcc/rust/ChangeLog: * resolve/rust-ice-finalizer.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". * resolve/rust-ice-finalizer.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. libcc1/ChangeLog: * context.cc: Update for move of diagnostics output formats into namespace "diagnostics" as "sinks". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: introduce namespace diagnostics::pathsDavid Malcolm4-15/+16
Move more diagnostic-specific code from gcc/ to gcc/diagnostics/ No functional change intended. contrib/ChangeLog: * filter-clang-warnings.py: Update for move of diagnostic-path-output.cc to diagnostics/paths-output.cc. gcc/ChangeLog: * Makefile.in (OBJS): Replace lazy-diagnostic-path.o with diagnostics/lazy-paths.o. (OBJS-libcommon): Replace diagnostic-path.o with diagnostics/paths.o, diagnostic-path-output.o with diagnostics/paths-output.o, and selftest-diagnostic-path.o with diagnostics/selftest-paths.o. (EXTRA_BACKEND_OBJS): Replace lazy-diagnostic-path.o with diagnostics/lazy-paths.o. * diagnostic-format-html.cc: Update #include for "diagnostic-path.h" moving to "diagnostics/paths.h", diagnostic_thread_id_t to diagnostics::paths::thread_id_t, diagnostic_event_id_t to diagnostics::paths::event_id_t, diagnostic_path to diagnostics::paths::path, and diagnostic_thread to diagnostics::paths::thread, and diagnostic_event to diagnostics::paths::event. * diagnostic-format-html.h: Likewise. * diagnostic-format-sarif.cc: Likewise. Update PROPERTY_PREFIX for threadFlowLocations from "gcc/diagnostic_event/" to "gcc/diagnostics/paths/event/". * diagnostic-format-text.cc: Likewise. * diagnostic-format-text.h: Likewise. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostic-event-id.h: Move to... * diagnostics/event-id.h: ...here, updating header guard. (diagnostics:paths:event_id_t): New typedef. (diagnostic_thread_id_t): Replace with... (diagnostics:paths:thread_id_t): New typedef. * lazy-diagnostic-path.cc: Move to... * diagnostics/lazy-paths.cc: ...here. Update for above changes, lazy_diagnostic_path becomes diagnostics::paths::lazy_path. (lazy_diagnostic_path_cc_tests): Rename to... (diagnostics_lazy_paths_cc_tests): ...this. * lazy-diagnostic-path.h: Move to... * diagnostics/lazy-paths.h: ...here, updating header guard. Update for above changes. * diagnostic-path-output.cc: Move to... * diagnostics/paths-output.cc: ...here. Update for above changes. (diagnostic_path_output_cc_tests): Rename to... (diagnostics_paths_output_cc_tests): ...this. * diagnostic-path.cc: Move to... * diagnostics/paths.cc: ...here. Update for above changes. * diagnostic-path.h: Move to... * diagnostics/paths.h: ...here, updating header guard. Update #include for moving "diagnostic-event-id.h" to "diagnostics/event-id.h". (class diagnostic_event): Convert to... (class diagnostics::paths::event): ...this. (class diagnostic_thread): Convert to... (class diagnostics::paths::thread): ...this. (class diagnostic_path): Convert to... (class diagnostics::paths::path): ...this. * diagnostic-show-locus.cc: Update for above changes. * doc/analyzer.texi: Likewise. * selftest-diagnostic-path.cc: Move to... * diagnostics/selftest-paths.cc: ...here. Update for above changes, and for "selftest-diagnostic-path.h" moving to "diagnostics/selftest-paths.h". * selftest-diagnostic-path.h: Move to... * diagnostics/selftest-paths.h: ...here, updating header guard. Update for above changes. * libgdiagnostics.cc: Update for above changes. * libsarifreplay.cc: Update property prefix for threadFlowLocations from "gcc/diagnostic_event/" to "gcc/diagnostics/paths/event/". * pretty-print-format-impl.h: Update for above changes. * pretty-print.cc: Likewise. * selftest-run-tests.cc (selftest::run_tests): Update for renaming of lazy_diagnostic_path_cc_tests to diagnostics_lazy_paths_cc_tests, and of diagnostic_path_output_cc_tests to diagnostics_paths_output_cc_tests. * selftest.h (lazy_diagnostic_path_cc_tests): Replace decl with... (diagnostics_lazy_paths_cc_tests): ...this. (diagnostic_path_output_cc_tests): Replace decl with... (diagnostics_paths_output_cc_tests): ...this. * simple-diagnostic-path.cc: Clarify that this relates to "tree" and thus shouldn't be in "diagnostics". Update for above changes. * simple-diagnostic-path.h: Likewise. gcc/analyzer/ChangeLog: * access-diagram.cc: Update for changes to diagnostic paths: "diagnostic-path.h" moving to "diagnostics/paths.h", "diagnostic-event-id.h" moving to "diagnostics/event-id.h", diagnostic_event_id_t to diagnostics::paths::event_id_t, diagnostic_path to diagnostics::paths::path, and diagnostic_event to diagnostics::paths::event. * access-diagram.h: Likewise. * analyzer.cc: Likewise. * bounds-checking.cc: Likewise. * call-info.cc: Likewise. * checker-event.cc: Likewise. * checker-event.h: Likewise. * checker-path.cc: Likewise. * checker-path.h: Likewise. * common.h: Likewise. * diagnostic-manager.cc: Likewise. * pending-diagnostic.cc: Likewise. * pending-diagnostic.h: Likewise. * program-point.cc: Likewise. * program-state.cc: Likewise. * region-model.cc: Likewise. * sm-fd.cc: Likewise. * sm-file.cc: Likewise. * sm-malloc.cc: Likewise. * sm-pattern-test.cc: Likewise. * sm-sensitive.cc: Likewise. * sm-signal.cc: Likewise. * sm-taint.cc: Likewise. * varargs.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.cc: Update #include for "diagnostic-path.h" moving to "diagnostics/paths.h", diagnostic_thread_id_t to diagnostics::paths::thread_id_t, diagnostic_event_id_t to diagnostics::paths::event_id_t, diagnostic_path to diagnostics::paths::path, and diagnostic_thread to diagnostics::paths::thread, and diagnostic_event to diagnostics::paths::event. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. * lib/sarif.py (get_state_graph): Update property prefix for threadFlowLocations from "gcc/diagnostic_event/" to "gcc/diagnostics/paths/event/". * gcc.dg/sarif-output/include-chain-2.h: Update comment. libcpp/ChangeLog: * include/rich-location.h: Replace diagnostic_path with diagnostics::paths::path. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move edit_context to namespace/dir "diagnostics"David Malcolm1-2/+2
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace edit-context.o with diagnostics/edit-context.o. * diagnostic-format-html.cc: Update #include for move of edit-context.h to diagnostics subdir. * diagnostic.cc: Likewise. Update for move of edit_context to diagnostics::edit_context. * diagnostic.h: Likewise. * edit-context.cc: Move to... * diagnostics/edit-context.cc: ...here. Update #include for move of edit-context.h to diagnostics subdir. Move all code within namespace diagnostics. * edit-context.h: Move to... * diagnostics/edit-context.h: ...here, updating header guard. Move all code within namespace diagnostics. * libgdiagnostics.cc: Update #include for move of edit-context.h to diagnostics subdir. Update for move of edit_context to diagnostics::edit_context. * toplev.cc: Update #include for move of edit-context.h to diagnostics subdir. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update #include for move of edit-context.h to diagnostics subdir. Update for move of edit_context to diagnostics::edit_context. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostic_diagram to diagnostics::diagramDavid Malcolm1-2/+2
No functional change intended. gcc/analyzer/ChangeLog: * bounds-checking.cc: Update #include for move of "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move of diagnostic_diagram to diagnostics::diagram. gcc/ChangeLog: * diagnostic-format-html.cc: Update for move of diagnostic_diagram to diagnostics::diagram. * diagnostic-format-sarif.cc: Update #include for move of "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move of diagnostic_diagram to diagnostics::diagram. * diagnostic-format-text.cc: Likewise. * diagnostic-format-text.h: Update for move of diagnostic_diagram to diagnostics::diagram. * diagnostic-format.h: Likewise. * diagnostic.cc: Update #include for move of "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move of diagnostic_diagram to diagnostics::diagram. * diagnostic.h: Update for move of diagnostic_diagram to diagnostics::diagram. * diagnostic-diagram.h: Move to... * diagnostics/diagram.h: ...here. (class diagnostic_diagram): Convert to... (class diagnostics::diagram): ...this. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_text_art.cc: Update #include for move of "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move of diagnostic_diagram to diagnostics::diagram. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostic_metadata to diagnostics::metadataDavid Malcolm6-15/+15
renamed: gcc/diagnostic-metadata.h -> gcc/diagnostics/metadata.h No functional change intended. gcc/analyzer/ChangeLog: * diagnostic-manager.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * kf.cc: Likewise. * pending-diagnostic.h: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". gcc/cobol/ChangeLog: * util.cc: Remove redundant #includes gcc/ChangeLog: * diagnostic-core.h: Update for move of diagnostic_metadata to diagnostics::metadata. * diagnostic-format-html.cc: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". * diagnostic-format-sarif.cc: Likewise. * diagnostic-format-text.cc: Likewise. * diagnostic-global-context.cc: Likewise. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostic-metadata.h: Move to... * diagnostics/metadata.h: ...here, updating header guard. (class diagnostic_metadata): Move to... (class diagnostics::metadata): ...here. Drop redundant "diagnostics::" qualifiers. * libgdiagnostics.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.h: Likewise. gcc/rust/ChangeLog: * rust-diagnostics.cc: Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h" * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Likewise. Also update for move of diagnostic_metadata to diagnostics::metadata. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: introduce a "gcc/diagnostics" subdirectoryDavid Malcolm1-1/+1
The "gcc" subdirectory of our source tree currently contains a total of almost 1000 .cc and .h files, enough to hit rate-limiting in some git web UIs, and obscuring the logical relationships between subsystems. In r16-2211-ga5d9debedd2f46 I started introducing a "namespace diagnostics" so it makes sense to move such code into a new "gcc/diagnostics" subdirectory. My intent is for the "diagnostics" namespace/directory to contain shared parts of the diagnostics code that are in libcommon, in particular which don't have knowledge of trees. This patch begins moving of the existing code within "namespace diagnostics" into a new "gcc/diagnostics" subdirectory. No functional change intended. renamed: gcc/diagnostic-digraphs.cc -> gcc/diagnostics/digraphs.cc renamed: gcc/diagnostic-digraphs.h -> gcc/diagnostics/digraphs.h renamed: gcc/diagnostic-state-to-dot.cc -> gcc/diagnostics/state-graphs-to-dot.cc renamed: gcc/diagnostic-state-graphs.cc -> gcc/diagnostics/state-graphs.cc renamed: gcc/diagnostic-state-graphs.h -> gcc/diagnostics/state-graphs.h contrib/ChangeLog: * gcc.doxy (INPUT): Add gcc/diagnostics subdir. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Rename diagnostic-digraphs.o to diagnostics/digraphs.o. Rename diagnostic-state-graphs.o to diagnostics/state-graphs.o. Rename diagnostic-state-to-dot.o to diagnostics/state-graphs-to-dot.o. (PLUGIN_HEADERS): Add $(srcdir)/diagnostics/*.h. (install-plugin:): Likewise. * configure: Regenerate. * configure.ac (gccdepdir): Add "diagnostics" to directories. * diagnostic-format-html.cc: Update #includes for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * diagnostic-format-sarif.cc: Likewise. * diagnostic-path.cc: Likewise for state-graphs.h * diagnostic-digraphs.cc: Move... * diagnostics/digraphs.cc: ...to here. Update #include for renaming of digraphs.h. (selftest::diagnostic_digraphs_cc_tests): Rename to... (selftest::diagnostics_digraphs_cc_tests): ...this. * diagnostic-digraphs.h: Move... * diagnostics/digraphs.h: ...to here, updating header guard. * diagnostic-state-to-dot.cc: Move... * diagnostics/state-graphs-to-dot.cc: ...to here. Update #include of state-graphs.h. * diagnostic-state-graphs.cc: Move... * diagnostics/state-graphs.cc: ...to here. Update #include of state-graphs.h. (selftest::diagnostic_state_graphs_cc_tests): Rename... (selftest::diagnostics_state_graphs_cc_tests): ...to this. * diagnostic-state-graphs.h: Move... * diagnostics/state-graphs.h: ...to here, updating header guard. * libgdiagnostics.cc: Update #includes for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * selftest-run-tests.cc (selftest::run_tests): Update for function renamings that reflect file renamings. * selftest.h (selftest::diagnostic_digraphs_cc_tests): Rename to... (selftest::diagnostics_digraphs_cc_tests): ...this. (selftest::diagnostic_state_graphs_cc_tests): Rename... (selftest::diagnostics_state_graphs_cc_tests): ...to this. gcc/analyzer/ChangeLog: * ana-state-to-diagnostic-state.cc: Update #include for move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * ana-state-to-diagnostic-state.h: Likewise. * checker-event.cc: Likewise. * checker-event.h: Update #include for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h". * program-state.cc: : Update #include for move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Update #include for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25c++: more name lookup for non-dep rewritten cmp opsPatrick Palka1-6/+10
As a follow-up to r16-2448-g7590c14b53a762, this patch attempts to teach build_min_non_dep_op_overload how to rebuild all rewritten comparison operators, not just != -> == ones, so that we don't incorrectly repeat the unqualified name lookup at instantiation time. Note that changes how we mangle such comparison ops, in a way that is overall more consistent with how we've been mangling non-rewritten operators, see PR c++/121239. gcc/cp/ChangeLog: * call.cc (build_new_op): If the selected candidate is rewritten, communicate the LOOKUP_REWRITTEN/REVERSED flags to the caller via the 'overload' out-parameter, and stop clearing '*overload' in that case. * tree.cc (build_min_non_dep_op_overload): Handle rebuilding all C++20 rewritten comparison operator expressions. gcc/testsuite/ChangeLog: * g++.dg/lookup/operator-8.C: Remove XFAILs and properly suppress all -Wunused-result warnings. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-25c++, coroutines: Handle allocation fail returns [PR121219].Iain Sandoe1-0/+149
The current implementation was returning the result of the g_r_o_o_a_f call independently of the return expressions for 'normal' cases. This prevents the NVRO that we need to guarantee copy elision for the ramp return values - when these are initialised from a temporary of the same type. The solution here reorders the code so that the regular return expression appears before the allocation-failed case. Ensure that the g_r_o and associated code appears in a distinct scope. These steps are to meet the constaints of NRV. PR c++/121219 gcc/cp/ChangeLog: * coroutines.cc (cp_coroutine_transform::build_ramp_function): Reorder the return expressions for the 'normal' and 'allocation failed' cases so that NRV constraints are met. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/pr121219.C: New test. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-07-25RISC-V: Remove user-level interruptsChristoph Müllner3-15/+1
There was once a RISC-V extension draft ("N"), which introduced user-level interrupts. However, it was never ratified and the specification draft has been removed from the RISC-V ISA manual in commit `b6cade07034` with the comment "it'll likely need to be redesigned". Support for a N extension never made it to GCC, but we support fuction attributes for user-level interrupt handlers that use the URET instruction. The "user" interrupt attribute was documented in the RISC-V C API, but has been removed in PR #106 in May 2025 (driven by LLVM devs/ maintainers and ack'ed by at least one GCC maintainer). Let's drop URET support from GCC as well. gcc/ChangeLog: * config/riscv/riscv.cc (enum riscv_privilege_levels): Remove USER_MODE. (riscv_handle_type_attribute): Remove "user" interrupts. (riscv_expand_epilogue): Likewise. (riscv_get_interrupt_type): Likewise. * config/riscv/riscv.md (riscv_uret): Remove URET pattern. * doc/extend.texi: Remove documentation of user interrupts. gcc/testsuite/ChangeLog: * gcc.target/riscv/interrupt-conflict-mode.c: Remove "user" interrupts. * gcc.target/riscv/xtheadint-push-pop.c: Likewise. * gcc.target/riscv/interrupt-umode.c: Removed. Reported-by: Sam Elliott <quic_aelliott@quicinc.com> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2025-07-25RISC-V: Add support for resumable non-maskable interrupt (RNMI) handlersChristoph Müllner1-0/+11
The Smrnmi extension introduces the nmret instruction to return from RNMI handlers. We already have basic Smrnmi support. This patch introduces support for the nmret instruction and the ability to set the function attribute `__attribute__ ((interrupt ("rnmi")))` to let the compiler generate RNMI handlers. The attribute name is proposed in a PR for the RISC C API and approved by LLVM maintainers: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/116 gcc/ChangeLog: * config/riscv/riscv.cc (enum riscv_privilege_levels): Add RNMI_MODE. (riscv_handle_type_attribute): Handle 'rnmi' interrupt attribute. (riscv_expand_epilogue): Generate nmret for RNMI handlers. (riscv_get_interrupt_type): Handle 'rnmi' interrupt attribute. * config/riscv/riscv.md (riscv_rnmi): Add nmret INSN. * doc/extend.texi: Add documentation for 'rnmi' interrupt attribute. gcc/testsuite/ChangeLog: * gcc.target/riscv/interrupt-rnmi.c: New test. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2025-07-25Daily bump.GCC Administrator1-0/+88
2025-07-25c++: Unwrap type traits defined in terms of builtins within diagnostics ↵Nathaniel Shead10-11/+442
[PR117294] Currently, concept failures of standard type traits just report 'expression X<T> evaluates to false'. However, many type traits are actually defined in terms of compiler builtins; we can do better here. For instance, 'is_constructible_v' could go on to explain why the type is not constructible, or 'is_invocable_v' could list potential candidates. Apart from concept diagnostics, this is also useful when using such traits in a 'static_assert' directly, so this patch also adjusts the diagnostics in that context. As a first step to supporting that we need to be able to map the standard type traits to the builtins that they use. Rather than adding another list that would need to be kept up-to-date whenever a builtin is added, this patch instead tries to detect any variable template defined directly in terms of a TRAIT_EXPR. This patch also adjusts 'diagnose_trait_expr' to provide more helpful diagnostics for these cases. Not all type traits have yet been updated, this patch just updates those that seem particularly valuable or straight-forward. The function also gets moved to cp/semantics.cc to be closer to 'trait_expr_value'. Various other parts of the compiler are also adjusted here to assist in making clear diagnostics, such as making more use of 'is_stub_object' to refer to a type directly rather than in terms of 'std::declval<T>()'. Additionally, since there are now more cases of nesting within a 'static_assert'ion I felt it was helpful for the experimental-nesting mode to nest here as well. PR c++/117294 PR c++/113854 gcc/cp/ChangeLog: * call.cc (implicit_conversion_error): Hide label when printing a stub object. (convert_like_internal): Likewise, and nest candidate diagnostics. * constexpr.cc (diagnose_failing_condition): Nest diagnostics, attempt to provide more helpful diagnostics for traits. * constraint.cc (satisfy_atom): Pass result before constant evaluation to diagnose_atomic_constraint. (diagnose_trait_expr): Adjust diagnostics for clarity and detail. (maybe_diagnose_standard_trait): New function. (diagnose_atomic_constraint): Attempt to provide more helpful diagnostics for more traits. * cp-tree.h (explain_not_noexcept): Declare new function. (is_trivially_xible): Add parameter. (is_nothrow_xible): Likewise. (is_xible): Likewise. (is_convertible): Likewise. (is_nothrow_convertible): Likewise. (diagnose_trait_expr): Declare new function. (maybe_diagnose_standard_trait): Declare new function. * error.cc (dump_type) <case TREE_VEC>: Handle trait types. * except.cc (explain_not_noexcept): New function. * method.cc (build_trait_object): Add complain parameter. (build_invoke): Propagate complain parameter. (assignable_expr): Add explain parameter to show diagnostics. (constructible_expr): Likewise. (destructible_expr): Likewise. (is_xible_helper): Replace trivial flag with explain flag, add diagnostics. (is_trivially_xible): New explain flag. (is_nothrow_xible): Likewise. (is_xible): Likewise. (is_convertible_helper): Add complain flag. (is_convertible): New explain flag. (is_nothrow_convertible): Likewise. * typeck.cc (cp_build_function_call_vec): Add handling for stub objects. (convert_arguments): Always return -1 on error. * typeck2.cc (cxx_readonly_error): Add handling for stub objects. libstdc++-v3/ChangeLog: * testsuite/20_util/any/misc/any_cast_neg.cc: Adjust diagnostics. * testsuite/20_util/expected/illformed_neg.cc: Likewise. * testsuite/20_util/optional/monadic/or_else_neg.cc: Likewise. * testsuite/23_containers/array/creation/3_neg.cc: Likewise. * testsuite/24_iterators/range_generators/lwg3900.cc: Likewise. * testsuite/29_atomics/atomic/requirements/types_neg.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc: Likewise. * testsuite/std/format/arguments/args_neg.cc: Likewise. * testsuite/std/format/string_neg.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-traits3.C: Adjust diagnostics. * g++.dg/cpp2a/concepts-traits4.C: New test. * g++.dg/diagnostic/static_assert5.C: New test. * g++.dg/ext/has_virtual_destructor2.C: New test. * g++.dg/ext/is_assignable2.C: New test. * g++.dg/ext/is_constructible9.C: New test. * g++.dg/ext/is_convertible7.C: New test. * g++.dg/ext/is_destructible3.C: New test. * g++.dg/ext/is_invocable6.C: New test. * g++.dg/ext/is_virtual_base_of_diagnostic2.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-24c++: lambda convop in C++23 [PR114632]Jason Merrill2-0/+24
The lambda conversion was ICEing for two C++23 features, static op() and explicit object parameters. The issue with the former seems like a more general issue: tsubst_function_decl recursing to substitute the parameters was affected by cp_unevaluated_operand from the decltype that refers to the declaration. Various places already make a point of clearing cp_unevaluated_operand ahead of PARM_DECL tsubsting; doing it here makes the PR101233 fix redundant. For explicit object lambdas, we want to implement CWG2561 and just not declare the conversion. PR c++/114632 PR c++/101233 gcc/cp/ChangeLog: * lambda.cc (maybe_add_lambda_conv_op): Not for xobj lambda. * pt.cc (tsubst_function_decl): Add cp_evaluated. (alias_ctad_tweaks): Revert PR101233 fix. gcc/testsuite/ChangeLog: * g++.dg/cpp23/explicit-obj-lambda18.C: New test. * g++.dg/cpp23/static-operator-call7.C: New test.
2025-07-24cobol: Honor the "-static" command-line option. [PR119231]Robert Dubner2-4/+2
gcc/cobol/ChangeLog: PR cobol/119231 * gcobolspec.cc: (lang_specific_driver): Pass OPT_static through. Handle -static and -static-libgcobol properly. gcc/testsuite/ChangeLog: * cobol.dg/group2/_-static__compilation.cob: Modify for -static warning. * cobol.dg/group2/_-static__compilation.out: Removed.
2025-07-24riscv: testsuite: Fix misalignment check.Robin Dapp1-1/+1
This fixes a thinko in the misalignment check. If we want to check for vector misalignment support we need to load 16-byte elements, not 8-byte elements that will never be misaligned. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Fix misalignment check.
2025-07-24aarch64: Relaxed SEL combiner patterns for unpacked SVE FP binary arithmeticSpencer Abson9-0/+469
Extend the binary op/UNSPEC_SEL combiner patterns from SVE_FULL_F/ SVE_FULL_F_B16B16 to SVE_F/SVE_F_B16B16, where the strictness value is SVE_RELAXED_GP. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (*cond_<optab><mode>_2_relaxed): Extend from SVE_FULL_F_B16B16 to SVE_F_B16B16. (*cond_<optab><mode>_3_relaxed): Likewise. (*cond_<optab><mode>_any_relaxed): Likwise. (*cond_<optab><mode>_any_const_relaxed): Extend from SVE_FULL_F to SVE_F. (*cond_add<mode>_2_const_relaxed): Likewise. (*cond_add<mode>_any_const_relaxed): Likewise. (*cond_sub<mode>_3_const_relaxed): Likewise. (*cond_sub<mode>_const_relaxed): Likewise. gcc/testsuite/ChangeLog: * g++.target/aarch64/sve/unpacked_cond_binary_bf16_1.C: New test. * gcc.target/aarch64/sve/unpacked_cond_builtin_fmax_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_builtin_fmin_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fadd_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fdiv_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fmaxnm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fminnm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fmul_1.c: Likewise.. * gcc.target/aarch64/sve/unpacked_cond_fsubr_1.c: Likewise.
2025-07-24aarch64: Add support for unpacked SVE FDIVSpencer Abson3-0/+66
This patch extends the unpredicated FP division expander to support partial FP modes. It extends the existing patterns used to implement UNSPEC_COND_FDIV and it's approximation as needed. gcc/ChangeLog: * config/aarch64/aarch64-sve.md: (@aarch64_sve_<optab><mode>): Extend from SVE_FULL_F to SVE_F, use aarch64_predicate_operand. (@aarch64_frecpe<mode>): Extend from SVE_FULL_F to SVE_F. (@aarch64_frecps<mode>): Likewise. (div<mode>3): Likewise, use aarch64_sve_fp_pred. * config/aarch64/iterators.md: Add warnings above SVE_FP_UNARY and SVE_FP_BINARY. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_fdiv_1.c: New test. * gcc.target/aarch64/sve/unpacked_fdiv_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fdiv_3.c: Likewise.
2025-07-24aarch64: Add support for unpacked SVE FP binary arithmeticSpencer Abson16-0/+514
This patch extends the expanders for unpredicated smax, smin, add, sub, mul, min, and max, so that they support partial SVE FP modes. The relevant insn and splitting patterns are also updated. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (<optab><mode>3): Extend from SVE_FULL_F to SVE_F, use aarch64_sve_fp_pred. (*post_ra_<sve_fp_op><mode>3): Extend from SVE_FULL_F to SVE_F. (@aarch64_pred_<optab><mode>): Extend from SVE_FULL_F to SVE_F, use aarch64_predicate_operand (ADD/SUB/MUL/MAX/MIN). (split for using unpredicated insns): Move SVE_RELAXED_GP into the pattern, rather than testing for it in the condition. * config/aarch64/aarch64-sve2.md (@aarch64_pred_<optab><mode>): Extend from VNx8BF_ONLY to SVE_BF. gcc/testsuite/ChangeLog: * g++.target/aarch64/sve/unpacked_binary_bf16_1.C: New test. * g++.target/aarch64/sve/unpacked_binary_bf16_2.C: Likewise. * gcc.target/aarch64/sve/unpacked_builtin_fmax_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_builtin_fmax_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_builtin_fmin_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_builtin_fmin_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fadd_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fadd_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmaxnm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmaxnm_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fminnm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fminnm_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmul_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fmul_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_fsubr_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_fsubr_2.c: Likewise.
2025-07-23testsuite: Fix gcc.target/powerpc/vsx-builtin-7.c test [PR119382]Jeevitha1-1/+9
The test vsx-builtin-7.c failed on powerpc64le-linux due to Identical Code Folding (ICF) merging the functions insert_di_0_v2 and insert_di_0. This behavior was introduced by commit r15-7961-gdc47161c1f32c3, which enhanced alias analysis in ao_compare::compare_ao_refs, enabling the compiler to identify and optimize structurally identical functions. As a result, the compiler replaced insert_di_0_v2 with a tail call to insert_di_0, altering the expected test behavior. This patch adds -fno-ipa-icf to the test's dg-options to disable ICF, avoiding function merging and ensuring the test executes correctly. 2025-06-24 Jeevitha Palanisamy <jeevitha@linux.ibm.com> gcc/testsuite/ PR testsuite/119382 * gcc.target/powerpc/vsx-builtin-7.c: Add '-fno-ipa-icf' to dg-options.
2025-07-24RISC-V: Add test case for vx combine polluting VXRMPan Li5-0/+120
Add asm check to make sure vx combine of vaaddu.vx will not pollute the vxrm. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-u16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-u32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-u64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-u8.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm.h: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-24c++/modules: Support re-streaming TU_LOCAL_ENTITYs [PR120412]Nathaniel Shead3-0/+32
When emitting a primary module interface, we must re-stream any TU-local entities that we saw in a partition. This patch adds the missing members from core_vals. As a drive-by fix, in some cases we might have a typedef referring to a TU-local entity; we need to handle that case as well. PR c++/120412 gcc/cp/ChangeLog: * module.cc (trees_out::core_vals): Write TU_LOCAL_ENTITY bits. (trees_in::core_vals): Read it. (trees_in::tree_node): Handle TU_LOCAL_ENTITY typedefs. gcc/testsuite/ChangeLog: * g++.dg/modules/internal-14_a.C: New test. * g++.dg/modules/internal-14_b.C: New test. * g++.dg/modules/internal-14_c.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-24Daily bump.GCC Administrator1-0/+128
2025-07-23aarch64: Relaxed SEL combiner patterns for unpacked SVE FP unary operationsSpencer Abson9-0/+316
Extend the unary op/UNSPEC_SEL combiner patterns from SVE_FULL_F to SVE_F, where the strictness value is SVE_RELAXED_GP. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (*cond_<optab><mode>_2_relaxed): Extend from SVE_FULL_F to SVE_F. (*cond_<optab><mode>_any_relaxed): Likewise. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_cond_fabs_1.c: New test. * gcc.target/aarch64/sve/unpacked_cond_fneg_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frinta_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frinta_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frinti_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frintm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frintp_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frintx_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_frintz_1.c: Likewise.
2025-07-23aarch64: Add support for unpacked SVE FP unary operationsSpencer Abson14-0/+334
This patch extends the expander for unpredicated round, nearbyint, floor, ceil, rint, and trunc, so that it can handle partial SVE FP modes. We move fabs and fneg to a separate expander, since they are not trapping instructions. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (<optab><mode>2): Replace use of aarch64_ptrue_reg with aarch64_sve_fp_pred. (@aarch64_pred_<optab><mode>): Extend from SVE_FULL_F to SVE_F, and use aarch64_predicate_operand. * config/aarch64/iterators.md: Split FABS/FNEG out of SVE_COND_FP_UNARY (into new SVE_COND_FP_UNARY_BITWISE). gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_fabs_1.c: New test. * gcc.target/aarch64/sve/unpacked_fneg_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frinta_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frinta_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_frinti_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frinti_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintm_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintm_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintp_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintp_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintx_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintx_2.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintz_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_frintz_2.c: Likewise.
2025-07-23aarch64: Relaxed SEL combiner patterns for unpacked SVE FP conversionsSpencer Abson3-0/+147
Add UNSPEC_SEL combiner patterns for unpacked FP conversions, where the strictness value is SVE_RELAXED_GP. gcc/ChangeLog: * config/aarch64/aarch64-sve.md (*cond_<optab>_nontrunc<SVE_PARTIAL_F:mode><SVE_HSDI:mode>_relaxed): New FCVT/SEL combiner pattern. (*cond_<optab>_trunc<VNx2DF_ONLY:mode><VNx2SI_ONLY:mode>_relaxed): New FCVTZ{S,U}/SEL combiner pattern. (*cond_<optab>_nonextend<SVE_HSDI:mode><SVE_PARTIAL_F:mode>_relaxed): New {S,U}CVTF/SEL combiner pattern. (*cond_<optab>_trunc<SVE_SDF:mode><SVE_PARTIAL_HSF:mode>): New FCVT/SEL combiner pattern. (*cond_<optab>_nontrunc<SVE_PARTIAL_HSF:mode><SVE_SDF:mode>_relaxed): New FCVTZ{S,U}/SEL combiner pattern. * config/aarch64/iterators.md: New mode iterator for VNx2SI. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/unpacked_cond_cvtf_1.c: New test. * gcc.target/aarch64/sve/unpacked_cond_fcvt_1.c: Likewise. * gcc.target/aarch64/sve/unpacked_cond_fcvtz_1.c: Likewise.
2025-07-23Fortran: fix passing of character length of function to procedure [PR121203]Harald Anlauf1-0/+34
PR fortran/121203 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): Obtain the character length of an assumed character length procedure from the typespec of the actual argument even if there is no explicit interface. gcc/testsuite/ChangeLog: * gfortran.dg/function_charlen_4.f90: New test.
2025-07-23RISC-V: Rework broadcast handling [PR121073].Robin Dapp7-13/+23
During the last weeks it became clear that our current broadcast handling needs an overhaul in order to improve maintainability. PR121073 showed that my intermediate fix wasn't enough and caused regressions. This patch now goes a first step towards untangling broadcast (vmv.v.x), "set first" (vmv.s.x), and zero-strided load (vlse). Also can_be_broadcast_p is rewritten and strided_broadcast_p is introduced to make the distinction clear directly in the predicates. Due to the pervasiveness of the patterns I needed to touch a lot of places and tried to clear up some things while at it. The patch therefore also introduces new helpers expand_broadcast for vmv.v.x that dispatches to regular as well as strided broadcast and expand_set_first that does the same thing for vmv.s.x. The non-strided fallbacks are now implemented as splitters of the strided variants. This makes it easier to see where and when things happen. The test cases I touched appeared wrong to me so this patch sets a new baseline for some of the scalar_move tests. There is still work to be done but IMHO that can be deferred: It would be clearer if the three broadcast-like variants differed not just in name but also in RTL pattern so matching is not as confusing. Right now vmv.v.x and vmv.s.x only differ in the mask and are interchangeable by just changing it from "all ones" to a "single one". As last time, I regtested on rv64 and rv32 with strided_broadcast turned on and off. Note there are regressions cond_fma_fnma-[78].c. Those are due to the patch exposing more fwprop/late-combine opportunities. For fma/fnma we don't yet have proper costing for vv/vx in place but I'll expect that to be addressed soon and figured we can live with those for the time being. PR target/121073 gcc/ChangeLog: * config/riscv/autovec-opt.md: Use new helpers. * config/riscv/autovec.md: Ditto. * config/riscv/predicates.md (strided_broadcast_mask_operand): New predicate. (strided_broadcast_operand): Ditto. (any_broadcast_operand): Ditto. * config/riscv/riscv-protos.h (expand_broadcast): Declare. (expand_set_first): Ditto. (expand_set_first_tu): Ditto. (strided_broadcast_p): Ditto. * config/riscv/riscv-string.cc (expand_vec_setmem): Use new helpers. * config/riscv/riscv-v.cc (expand_broadcast): New functionk. (expand_set_first): Ditto. (expand_set_first_tu): Ditto. (expand_const_vec_duplicate): Use new helpers. (expand_const_vector_duplicate_repeating): Ditto. (expand_const_vector_duplicate_default): Ditto. (sew64_scalar_helper): Ditto. (expand_vector_init_merge_repeating_sequence): Ditto. (expand_reduction): Ditto. (strided_broadcast_p): New function. (whole_reg_to_reg_move_p): Use new helpers. * config/riscv/riscv-vector-builtins-bases.cc: Use either broadcast or strided broadcast. * config/riscv/riscv-vector-builtins.cc (function_expander::use_ternop_insn): Ditto. (function_expander::use_widen_ternop_insn): Ditto. (function_expander::use_scalar_broadcast_insn): Ditto. * config/riscv/riscv-vector-builtins.h: Declare scalar broadcast. * config/riscv/vector.md (*pred_broadcast<mode>): Split into regular and strided broadcast. (*pred_broadcast<mode>_zvfh): Split. (pred_broadcast<mode>_zvfh): Ditto. (*pred_broadcast<mode>_zvfhmin): Ditto. (@pred_strided_broadcast<mode>): Ditto. (*pred_strided_broadcast<mode>): Ditto. (*pred_strided_broadcast<mode>_zvfhmin): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat-6.c: Adjust test expectation. * gcc.target/riscv/rvv/base/scalar_move-5.c: Ditto. * gcc.target/riscv/rvv/base/scalar_move-6.c: Ditto. * gcc.target/riscv/rvv/base/scalar_move-7.c: Ditto. * gcc.target/riscv/rvv/base/scalar_move-8.c: Ditto. * gcc.target/riscv/rvv/base/scalar_move-9.c: Ditto. * gcc.target/riscv/rvv/pr121073.c: New test.
2025-07-23RISC-V: testsuite: Fix vx_vf_*run-1-f16.c run tests.Robin Dapp11-10/+58
This patch fixes the vf_vfmacc-run-1-f16.c test failures on rv32 by adding zvfh requirements as well as options to the test and the target harness. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmacc-run-1-f16.c: Add zvfh requirements and options. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsac-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmacc-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmadd-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsac-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsub-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmacc-run-1-f16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmsac-run-1-f16.c: Ditto. * lib/target-supports.exp: Add zvfh options.
2025-07-23aarch64: Fix fma steering when rename fails [PR120119]Andrew Pinski1-0/+15
Regrename can fail in some case and `insn_rr[INSN_UID (insn)].op_info` will be null. The FMA steering code was not expecting the failure to happen. This started to happen after early RA was added but it has been a latent bug before that. Build and tested for aarch64-linux-gnu. PR target/120119 gcc/ChangeLog: * config/aarch64/cortex-a57-fma-steering.cc (func_fma_steering::analyze): Skip if renaming fails. gcc/testsuite/ChangeLog: * g++.dg/torture/pr120119-1.C: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-23c++: name lookup for non-dep rewritten != expr [PR121179]Patrick Palka1-1/+8
Here we're incorrectly rejecting the modules testcase (reduced from a std module example): $ cat 121179_a.C export module foo; enum class E { x }; bool operator==(E, int); export template<class T> void f() { E::x != 0; } $ cat 121179_b.C import foo; template void f<int>(); $ g++ -fmodules 121179_*.C In module foo, imported at 121179_b.C:1: 121179_a.C: In instantiation of ‘void f@foo() [with T = int]’: 121179_b.C:3:9: required from here 121179_a.C:9:8: error: no match for ‘operator!=’ (operand types are ‘E@foo’ and ‘int’) This is ultimately because our non-dependent rewritten operator expression handling throws away the result of unqualified lookup at template parse time, and so we have to repeat the lookup at instantiation time which fails because the operator== isn't exported. This is a known deficiency, but it's easy enough to narrowly fix this for simple != to == rewrites by making build_min_non_dep_op_overload look through logical negation. PR c++/121179 gcc/cp/ChangeLog: * call.cc (build_new_op): Don't clear *overload for a simple != to == rewrite. * tree.cc (build_min_non_dep_op_overload): Handle TRUTH_NOT_EXPR appearing in a rewritten operator expression. gcc/testsuite/ChangeLog: * g++.dg/lookup/operator-8.C: Strengthen test and remove one XFAIL. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-23c++: fix __is_invocable for std::reference_wrapper [PR121055]Patrick Palka1-0/+15
Our implementation of the INVOKE spec ([func.require]) was incorrectly treating reference_wrapper<T>::get() as returning T instead of T&, which notably makes a difference when invoking a ref-qualified memfn pointer. PR c++/121055 gcc/cp/ChangeLog: * method.cc (build_invoke): Correct reference_wrapper handling. gcc/testsuite/ChangeLog: * g++.dg/ext/is_invocable5.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-23aarch64: testsuite: Keep -mtune=generic when specifying -moverrideSpencer Abson1-5/+11
gcc/testsuite/ChangeLog: * lib/gcc-defs.exp (aarch64-arg-dg-options): Split add_tune into add_tune and add_override, so that specifying -moverride does not change the baseline tuning from the testuite's default (generic).
2025-07-23tree-optimization/121220 - improve sinking of storesRichard Biener1-0/+21
We currently do only very restricted store sinking into paths that have no loads or stores and end in a virtual PHI. The following extends this to sink towards a single virtual definition in addition to the case of a PHI, handling skipping of unrelated virtual uses. We later have to prune cases that would require virtual PHI insertion and the patch below basically restricts this to sinking to noreturn paths for now. PR tree-optimization/121220 * tree-ssa-sink.cc (statement_sink_location): For stores handle sinking to paths ending in a store. Skip loads that do not use the store. * gcc.dg/tree-ssa/ssa-sink-23.c: New testcase.
2025-07-23tree-sra: Avoid total SRA if there are incompat. aggregate accesses (PR119085)Martin Jambor1-0/+37
We currently use the types encountered in the function body and not in type declaration to perform total scalarization. Bug PR 119085 uncovered that we miss a check that when the same data is accessed with aggregate types that those are actually compatible. Without it, we can base total scalarization on a type that does not "cover" all live data in a different part of the function. This patch adds the check. gcc/ChangeLog: 2025-07-21 Martin Jambor <mjambor@suse.cz> PR tree-optimization/119085 * tree-sra.cc (sort_and_splice_var_accesses): Prevent total scalarization if two incompatible aggregates access the same place. gcc/testsuite/ChangeLog: 2025-07-21 Martin Jambor <mjambor@suse.cz> PR tree-optimization/119085 * gcc.dg/tree-ssa/pr119085.c: New test.
2025-07-23PR modula2/121164: Modula 2 build failure followupGaius Mulley2-0/+42
This is a followup patch for PR modula2/121164 to fix the location for the error message attributed to cc1gm2. gcc/m2/ChangeLog: PR modula2/121164 * gm2-compiler/P1SymBuild.mod: Remove PutProcTypeParam. Remove PutProcTypeParam. (CheckFileName): Remove. (P1EndBuildDefinitionModule): Correct spelling. (P1EndBuildImplementationModule): Ditto. (P1EndBuildProgramModule): Ditto. (EndBuildInnerModule): Ditto. * gm2-compiler/P2SymBuild.mod (P2EndBuildDefModule): Correct spelling. (P2EndBuildImplementationModule): Ditto. (P2EndBuildProgramModule): Ditto. (EndBuildInnerModule): Ditto. (CheckFormalParameterSection): Ditto. * gm2-compiler/P3SymBuild.mod (P3EndBuildDefModule): Ditto. * gm2-compiler/PCSymBuild.mod (PCEndBuildDefModule): Ditto. (fixupProcedureType): Pass tok to PutProcTypeVarParam. Pass tok to PutProcTypeParam. * gm2-compiler/SymbolTable.def (PutProcTypeParam): Add tok parameter. (PutProcTypeVarParam): Ditto. * gm2-compiler/SymbolTable.mod (SymParam): At change type to CARDINAL. New field FullTok. New field Scope. (SymVarParam): At change type to CARDINAL. New field FullTok. New field Scope. (GetVarDeclTok): Check ShadowVar for NulSym and return At. (PutParam): Initialize FullTok. Initialize At. Initialize Scope. (PutVarParam): Initialize FullTok. Assign At. Initialize Scope. (AddProcedureProcTypeParam): Add tok parameter. (GetScope): Add ParamSym and VarParamSym clause. (PutProcTypeVarParam): Add tok parameter. Initialize At. Initialize FullTok. (GetDeclaredDefinition): Clause ParamSym return At. Clause VarParamSym return At. (GetDeclaredModule): Ditto. (PutDeclaredDefinition): Remove clause ParamSym. Remove clause VarParamSym. (PutDeclaredModule): Remove clause ParamSym. Remove clause VarParamSym. libgm2/ChangeLog: PR modula2/121164 * libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Add -Wall. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.am (libm2log_la_M2FLAGS): Add -Wall. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.am (libm2min_la_M2FLAGS): Add -Wall. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Add -Wall. * libm2pim/Makefile.in: Regenerate. gcc/testsuite/ChangeLog: PR modula2/121164 * gm2/switches/pedantic-params/fail/arrayofchar.def: New test. * gm2/switches/pedantic-params/fail/arrayofchar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-07-23middle-end/121216 - ICE with VLA const string initializerRichard Biener1-0/+9
constant_byte_string fails to consider the string type might be VLA when initialized by an empty string CTOR. PR middle-end/121216 * expr.cc (constant_byte_string): Check the string type size fits an uhwi before converting to uhwi. * gcc.dg/pr121216.c: New testcase.
2025-07-22testsuite: Mark fn1 in pr81627.c as noinline [PR120101]Andrew Pinski1-0/+1
Since r16-372-g064cac730f88dc fn1 is now inlined into main which meant the scan dump was failing since it was looking for it only once. Marking fn1 as noinline gets us back to the old behavior and no longer dependent on the inliner. Pushed as obvious after a quick test. PR testsuite/120101 gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr81627.c (fn1): Mark as noinline. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-23testsuite: Fix overflow in gcc.dg/vect/pr116125.cSiddhesh Poyarekar1-3/+3
The test ends up writing a byte beyond bounds of the buffer, which gets trapped on some targets when the test is run with -fstack-protector-strong. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr116125.c (mem_overlap): Expand A to 10 members. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2025-07-23Daily bump.GCC Administrator1-0/+35
2025-07-22c++: constexpr union placement new [PR121068]Jason Merrill2-2/+23
The note and example in [class.union] p6 think that placement new can be used to change the active member of a union, but we didn't support that for array members in constant-evaluation even after implementing P1330 and P2747. First I tried to address this by introducing a CLOBBER_BEGIN_OBJECT for the entire array, but that broke the resolution of LWG3436, which invokes 'new T[1]' for an array T, and trying to clobber a multidimensional array when the actual object is single-dimensional breaks. So I've raised that issue with the committee. Until that is resolved, this patch takes a simpler approach: allow initialization of an element of an array to make the array the active member of a union. PR c++/121068 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_store_expression): Allow ARRAY_REFs when activating an array member of a union. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-union6.C: Expect x5 to work. * g++.dg/cpp26/constexpr-new4.C: New test.
2025-07-22c++: Wmismatched-new-delete-5.C tweakJason Merrill1-1/+1
A patch I was testing noticed that the allocation is too small for the placement new here, but that isn't the point of the testcase. gcc/testsuite/ChangeLog: * g++.dg/warn/Wmismatched-new-delete-5.C: Fix allocation.
2025-07-22Change __builtin_unreachable to __builtin_trap (or infinite loop) if only ↵Andrew Pinski4-1/+44
thing in function [PR109267] When we have an empty function, things can go wrong with cfi_startproc/cfi_endproc and a few other things like exceptions. So if the only thing the function does is a call to __builtin_unreachable, let's replace that with a __builtin_trap instead if the target has a trap instruction. For targets without a trap instruction defined, replace it with an infinite loop; this allows not to need for the abort call to happen but still get the correct behavior of not having two functions at the same location. The QOI idea for basic block reorder is recorded as PR 120004. Changes since v1: * v2: Move to final gimple cfg cleanup instead of expand and use BUILT_IN_UNREACHABLE_TRAP. * v3: For targets without a trap defined, create an infinite loop. Bootstrapped and tested on x86_64-linux-gnu. PR middle-end/109267 gcc/ChangeLog: * tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing): If the first non debug statement in the first (and only) basic block is a call to __builtin_unreachable change it to a call to __builtin_trap or an infinite loop. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_trap): New proc. * g++.dg/missing-return.C: Update testcase for the !trap case. * gcc.dg/pr109267-1.c: New test. * gcc.dg/pr109267-2.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-22middle-end: Enable masked load with non-constant offsetKarl Meakin1-2/+2
The function `vect_check_gather_scatter` requires the `base` of the load to be loop-invariant and the `off`set to be not loop-invariant. When faced with a scenario where `base` is not loop-invariant, instead of giving up immediately we can try swapping the `base` and `off`, if `off` is actually loop-invariant. Previously, it would only swap if `off` was the constant zero (and so trivially loop-invariant). This is too conservative: we can still perform the swap if `off` is a more complex but still loop-invariant expression, such as a variable defined outside of the loop. This allows loops like the function below to be vectorised, if the target has masked loads and sufficiently large vector registers (eg `-march=armv8-a+sve -msve-vector-bits=128`): ```c typedef struct Array { int elems[3]; } Array; int loop(Array **pp, int len, int idx) { int nRet = 0; for (int i = 0; i < len; i++) { Array *p = pp[i]; if (p) { nRet += p->elems[idx]; } } return nRet; } ``` gcc/ChangeLog: * tree-vect-data-refs.cc (vect_check_gather_scatter): Swap `base` and `off` in more scenarios. Also assert at the end of the function that `base` and `off` are loop-invariant and not loop-invariant respectively. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/mask_load_2.c: Update tests.
2025-07-22AArch64: precommit test for masked load vectorisation.Karl Meakin1-0/+23
Commit the test file `mask_load_2.c` before the vectorisation analysis is changed, so that the changes in codegen are more obvious in the next commit. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/mask_load_2.c: New test.
2025-07-22tree-optimization/121202 - fix vector stmt placementRichard Biener1-0/+11
When we have a vector shift with a scalar the shift operand can be external - in that case we should not use the shift operand def as hint where to place the vector shift instruction. The ICE in the PR is because stmt dominance queries only work inside of the vector region. But we should also never place stmts outside of it. PR tree-optimization/121202 * tree-vect-slp.cc (vect_schedule_slp_node): Do not take an out-of-region stmt as "last". * gcc.dg/pr121202.c: New testcase.
2025-07-22Fix gcc.dg/vect/slp-28.cRichard Biener1-5/+4
gcc.dg/vect/slp-28.c is now vectorized as expected even on targets without vect32. * gcc.dg/vect/slp-28.c: Adjust.
2025-07-22Daily bump.GCC Administrator1-0/+125
2025-07-21match: Add `cmp - 1` simplification to `-icmp` [PR110949]Andrew Pinski2-0/+33
I have seen this a few places though the testcase from PR 95906 is an obvious place where this shows up for sure. This convert `cmp - 1` into `-icmp` as that form is more useful in many cases. Changes since v1: * v2: Add check for outer type's precision being greater than 1. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/110949 PR tree-optimization/95906 gcc/ChangeLog: * match.pd (cmp - 1): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cmp-2.c: New test. * gcc.dg/tree-ssa/max-bitcmp-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-07-21RISC-V: Add test for vec_duplicate + vaaddu.vv combine for DImodePan Li7-0/+26
Add asm dump check and run test for vec_duplicate + vaaddu.vv combine to vaaddu.vx, with the GR2VR cost is 0, 1, 2 and 15 for the case 0 and case 1. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Add asm check. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-u64.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>