]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
12 days agodiagnostics: eliminate some redundant includes
David Malcolm [Fri, 25 Jul 2025 19:13:44 +0000 (15:13 -0400)] 
diagnostics: eliminate some redundant includes

No functional change intended.

gcc/ChangeLog:
* diagnostics/selftest-paths.cc: Don't include "demangle.h"
and "backtrace.h".
* diagnostics/source-printing.cc: Likewise.
* diagnostics/state-graphs.cc: Don't include "graphviz.h",
"xml.h", "xml-printer.h", or "intl.h".

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: simplify header files
David Malcolm [Fri, 25 Jul 2025 19:13:43 +0000 (15:13 -0400)] 
diagnostics: simplify header files

No functional change intended.

gcc/ChangeLog:
* diagnostic.h: Move include of "unique-argv.h"
and various forward decls into...
* diagnostics/context.h: ...here.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move diagnostic.c to diagnostics/context.cc
David Malcolm [Fri, 25 Jul 2025 19:13:43 +0000 (15:13 -0400)] 
diagnostics: move diagnostic.c to diagnostics/context.cc

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostic.o with
diagnostics/context.o.

gcc/c-family/ChangeLog:
* c-common.cc (c_family_tests): Add include of
"diagnostics/diagnostics-selftests.h".  Replace
c_diagnostic_cc_tests with
diagnostics::selftest::context_cc_tests.
* c-common.h: Drop c_diagnostic_cc_tests decl.

gcc/ChangeLog:
* diagnostic.h (num_digits): Move to...
(diagnostics::num_digits): ...here.
(get_cwe_url): Move to...
(diagnostics::get_cwe_url): ...here.
(maybe_line_and_column): Move to...
(diagnostics::maybe_line_and_column): ...here.
* diagnostic.cc: Move to...
* diagnostics/context.cc: ...here.
* diagnostics/diagnostics-selftests.cc
(run_diagnostics_selftests): Add comment about context_cc_tests.
* diagnostics/diagnostics-selftests.h: Add context_cc_tests decl.
* diagnostics/sarif-sink.cc: Update for file rename.
* diagnostics/source-printing.cc: Update for num_digits moving to
diagnostics::num_digits.
* errors.cc: Update for file rename.
* input.cc: Update for num_digits moving to
diagnostics::num_digits.

libcpp/ChangeLog:
* charset.cc: Update comment for file rename.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: convert diagnostic_t to enum class diagnostics::kind
David Malcolm [Fri, 25 Jul 2025 19:13:43 +0000 (15:13 -0400)] 
diagnostics: convert diagnostic_t to enum class diagnostics::kind

No functional change intended.

gcc/ChangeLog:
* Makefile.in: Replace diagnostic.def with diagnostics/kinds.def.
* config/aarch64/aarch64.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* config/i386/i386-options.cc: Likewise.
* config/s390/s390.cc: Likewise.
* diagnostic-core.h: Replace typedef diagnostic_t with
enum class diagnostics::kind in diagnostics/kinds.h and include
it.
* diagnostic-global-context.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostics/buffering.cc: Likewise.
* diagnostics/buffering.h: Likewise.
* diagnostics/context.h: Likewise.
* diagnostics/diagnostic-info.h: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostic.def: Move to...
* diagnostics/kinds.def: ...here and update for diagnostic_t
becoming enum class diagnostics::kind.
* diagnostics/kinds.h: New file, based on material in
diagnostic-core.h.
* diagnostics/lazy-paths.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostics/option-classifier.cc: Likewise.
* diagnostics/option-classifier.h: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/selftest-context.cc: Likewise.
* diagnostics/selftest-context.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* lto-wrapper.cc: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts.cc: Likewise.
* rtl-error.cc: Likewise.
* substring-locations.cc: Likewise.
* toplev.cc: Likewise.

gcc/ada/ChangeLog:
* gcc-interface/trans.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.

gcc/analyzer/ChangeLog:
* pending-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* program-point.cc: Likewise.

gcc/c-family/ChangeLog:
* c-common.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-format.cc: Likewise.
* c-lex.cc: Likewise.
* c-opts.cc: Likewise.
* c-pragma.cc: Likewise.
* c-warn.cc: Likewise.

gcc/c/ChangeLog:
* c-errors.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-parser.cc: Likewise.
* c-typeck.cc: Likewise.

gcc/cobol/ChangeLog:
* util.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.

gcc/cp/ChangeLog:
* call.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* constexpr.cc: Likewise.
* cp-tree.h: Likewise.
* decl.cc: Likewise.
* error.cc: Likewise.
* init.cc: Likewise.
* method.cc: Likewise.
* module.cc: Likewise.
* parser.cc: Likewise.
* pt.cc: Likewise.
* semantics.cc: Likewise.
* typeck.cc: Likewise.
* typeck2.cc: Likewise.

gcc/d/ChangeLog:
* d-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.

gcc/fortran/ChangeLog:
* cpp.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* error.cc: Likewise.
* options.cc: Likewise.

gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.

gcc/m2/ChangeLog:
* gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* gm2-gcc/rtegraph.cc: Likewise.

gcc/rust/ChangeLog:
* backend/rust-tree.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* backend/rust-tree.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ice-finalizer.cc: Likewise.
* resolve/rust-ice-finalizer.h: Likewise.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for
diagnostic_t becoming enum class diagnostics::kind.
* gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
* lib/gcc-dg.exp: Likewise.

libcpp/ChangeLog:
* internal.h: Update comment for diagnostic_t becoming
enum class diagnostics::kind.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: rename diagnostic_option_id to diagnostics::option_id and move to its...
David Malcolm [Fri, 25 Jul 2025 19:13:42 +0000 (15:13 -0400)] 
diagnostics: rename diagnostic_option_id to diagnostics::option_id and move to its own header

No functional change intended.

gcc/c-family/ChangeLog:
* c-common.cc: Update for renaming of diagnostic_option_id to
diagnostics::option_id.
* c-common.h: Likewise.
* c-cppbuiltin.cc: Likewise.
* known-headers.cc: Likewise.
* known-headers.h: Likewise.

gcc/c/ChangeLog:
* c-decl.cc: Update for renaming of diagnostic_option_id to
diagnostics::option_id.
* c-errors.cc: Likewise.
* c-tree.h: Likewise.

gcc/cobol/ChangeLog:
* util.cc: Update for renaming of diagnostic_option_id to
diagnostics::option_id.

gcc/cp/ChangeLog:
* cp-tree.h: Update for renaming of diagnostic_option_id to
diagnostics::option_id.
* decl.cc: Likewise.
* error.cc: Likewise.
* name-lookup.cc: Likewise.

gcc/ChangeLog:
* diagnostic-core.h: Include "diagnostics/option-id.h".
(struct diagnostic_option_id): Move there, renaming to
diagnostics::option_id.
* diagnostic-global-context.cc: Update for renaming of
diagnostic_option_id to diagnostics::option_id.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostics/context.h: Likewise.
* diagnostics/diagnostic-info.h: Likewise.
* diagnostics/lazy-paths.cc: Likewise.
* diagnostics/option-classifier.cc: Likewise.
* diagnostics/option-classifier.h: Likewise.
* diagnostics/option-id.h: New file, taken from material in
diagnostic-core.h.
* diagnostics/selftest-context.cc: Update for renaming of
diagnostic_option_id to diagnostics::option_id.
* diagnostics/selftest-context.h: Likewise.
* ipa-pure-const.cc: Likewise.
* lto-wrapper.cc: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts.cc: Likewise.
* substring-locations.cc: Likewise.
* substring-locations.h: Likewise.

gcc/fortran/ChangeLog:
* cpp.cc: Update for renaming of
diagnostic_option_id to diagnostics::option_id.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agoRename diagnostic-spec.{cc,h} to gcc-diagnostic-spec.{cc,h}
David Malcolm [Fri, 25 Jul 2025 19:13:41 +0000 (15:13 -0400)] 
Rename diagnostic-spec.{cc,h} to gcc-diagnostic-spec.{cc,h}

This has GCC-specific stuff in it (options and "GTY"), and so should
not be in the "diagnostics/" subdir, and should avoid a "diagnostics"
prefix in its name.

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostic-spec.o with
gcc-diagnostic-spec.o.
(GTFILES): Replace diagnostic-spec.h with gcc-diagnostic-spec.h.
* diagnostic-spec.cc: Move to...
* gcc-diagnostic-spec.cc: ...here.
* diagnostic-spec.h: Move to...
* gcc-diagnostic-spec.h: ...here.
* gengtype.cc (open_base_files): Replace diagnostic-spec.h with
gcc-diagnostic-spec.h.
* warning-control.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move diagnostics::edit_context -> diagnostics::changes::change_set
David Malcolm [Fri, 25 Jul 2025 19:13:41 +0000 (15:13 -0400)] 
diagnostics: move diagnostics::edit_context -> diagnostics::changes::change_set

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostics/changes.o with
diagnostics/edit-context.o.
* diagnostic.cc: Update for move of diagnostics/edit-context.h to
diagnostics/changes.h.
(diagnostics::context::initialize): Update for renaming of
m_edit_context_ptr to m_fixits_change_set.
(diagnostics::context::finish): Likewise.
(diagnostics::context::create_edit_context): Rename to...
(diagnostics::context::initialize_fixits_change_set): ...this and
update for other renamings.
(diagnostics::context::report_diagnostic): Update for renaming of
m_edit_context_ptr to m_fixits_change_set.
* diagnostic.h (diagnostics::edit_context): Drop forward decl
* diagnostics/edit-context.cc: Move to...
* diagnostics/changes.cc: ...here.  Update for move of
diagnostics/edit-context.h to diagnostics/changes.h.
Rename diagnostics::edit_context to
diagnostics::changes::change_set.  Rename diagnostics::edited_file
to diagnostics::changes::changed_file.  Rename
diagnostics::edited_line to diagnostics::changes::changed_line.
* diagnostics/edit-context.h: Move to...
* diagnostics/changes.h: ...here, renaming as above.
* diagnostics/context.h (diagnostics::changes::change_set): New
forward decl.
(diagnostics::context::create_edit_context): Rename to...
(diagnostics::context::initialize_fixits_change_set): ...this.
(diagnostics::context::get_edit_context): Rename to...
(diagnostics::context::get_fixits_change_set): ...this.
(diagnostics::context::m_edit_context_ptr): Rename to...
(diagnostics::context::m_fixits_change_set): ..this and update
type.
* diagnostics/diagnostics-selftests.cc: Update for renaming.
* diagnostics/diagnostics-selftests.h: Likewise.
* diagnostics/html-sink.cc: Update for above changes.
* libgdiagnostics.cc: Likewise.
* toplev.cc: Likewise.

gcc/c-family/ChangeLog:
* c-common.cc: Update comment for renaming of edit_context.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/expensive_selftests_plugin.cc: Update for change
from edit-context.h to changes.h.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: reorganize selftests
David Malcolm [Fri, 25 Jul 2025 19:13:41 +0000 (15:13 -0400)] 
diagnostics: reorganize selftests

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS): Move diagnostics/lazy-paths.o to...
(OBJS-libcommon): ...here.  Add
diagnostics/diagnostics-selftests.o.
* diagnostic.cc: Update for move of
selftest::test_diagnostic_context to
diagnostics::selftest::test_context.
* diagnostics/color.cc: Move selftests from selftest:: to
diagnostics::selftest::.
* diagnostics/diagnostics-selftests.cc: New file.
* diagnostics/diagnostics-selftests.h: New file.
* diagnostics/digraphs.cc: Move selftests from selftest:: to
diagnostics::selftest::.
* diagnostics/edit-context.cc: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostics/lazy-paths.cc: Likewise.  Eliminate use of "tree"
by porting selftests from simple-diagnostic-path.h to
diagnostics/selftest-paths.h.
* diagnostics/output-spec.cc: Move selftests from selftest:: to
diagnostics::selftest::.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/selftest-context.cc: Move
selftest::test_diagnostic_context to
diagnostics::selftest::test_context.
* diagnostics/selftest-context.h: Likewise.
* diagnostics/selftest-logical-locations.cc: Move selftests from
selftest:: to diagnostics::logical_locations::selftest::.
* diagnostics/selftest-logical-locations.h: Move
selftest::logical_location_manager to
diagnostics::logical_locations::selftest::logical_location_manager.
* diagnostics/selftest-paths.cc: Move
selftest::test_diagnostic_path to
diagnostics::paths::selftest::test_path.  Move
selftest::test_diagnostic_event to
diagnostics::paths::selftest::test_event.
* diagnostics/selftest-paths.h: Likewise, and move
selftest::test_diagnostic_thread to
diagnostics::paths::selftest::test_thread.
* diagnostics/selftest-source-printing.h: Move
selftest::diagnostic_show_locus_fixture to
diagnostics::selftest::source_printing_fixture.
* diagnostics/source-printing.cc: Move selftests from selftest::
to diagnostics::selftest:: and update for renames.
* diagnostics/state-graphs.cc: Likewise.
* selftest-run-tests.cc: Include
"diagnostics/diagnostics-selftests.h".
(selftest::run_tests): Replace invocation of the various diagnostics
selftests with a call to
diagnostics::selftest::run_diagnostics_selftests.
* selftest.h: Move decls of the various per-file diagnostics
invocation functions to diagnostics/diagnostics-selftests.h,
renaming due to diagostics prefix being implied by namespace.

gcc/c-family/ChangeLog:
* c-format.cc (test_type_mismatch_range_labels): Update for
move of selftest::test_diagnostic_context to
diagnostics::selftest::test_context.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/expensive_selftests_plugin.cc: Update for move of
selftest::test_diagnostic_context to
diagnostics::selftest::test_context.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: gcc/diagnostic-url.h -> gcc/diagnostics/url.h
David Malcolm [Fri, 25 Jul 2025 19:13:40 +0000 (15:13 -0400)] 
diagnostics: gcc/diagnostic-url.h -> gcc/diagnostics/url.h

No functional change intended.

gcc/ChangeLog:
* common.opt: Update for move of diagnostic-url.h to
diagnostics/url.h.
* diagnostic.cc: Likewise.
* diagnostics/color.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostic-url.h: Move to...
* diagnostics/url.h: ...here.
* libgdiagnostics.cc: Update for move of diagnostic-url.h to
diagnostics/url.h.
* pretty-print.h: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move gcc/diagnostic-color.{h,cc} to gcc/diagnostics/color.{h,cc}
David Malcolm [Fri, 25 Jul 2025 19:13:40 +0000 (15:13 -0400)] 
diagnostics: move gcc/diagnostic-color.{h,cc} to gcc/diagnostics/color.{h,cc}

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostic-color.o with
diagnostics/color.o.
(PLUGIN_HEADERS): Remove diagnostic-color.h in favor of glob.
* common.opt: Update for move of diagnostic-color.h to
diagnostics/color.h.
* diagnostic.cc: Likewise.
* diagnostic-color.cc: Move to...
* diagnostics/color.cc: ...here.
* diagnostic-color.h: Move to...
* diagnostics/color.h: ...here.
* diagnostics/edit-context.cc: Update for move of
diagnostic-color.h to diagnostics/color.h.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* opts.cc: Likewise.
* pretty-print-markup.h: Likewise.
* pretty-print.cc: Likewise.
* selftest-run-tests.cc: Likewise.
* selftest.h: Likewise.
* text-art/style.cc: Likewise.

gcc/cp/ChangeLog:
* error.cc: Update for move of diagnostic-color.h to
diagnostics/color.h.

gcc/fortran/ChangeLog:
* error.cc: Update for move of diagnostic-color.h to
diagnostics/color.h.

gcc/m2/ChangeLog:
* gm2-gcc/m2color.cc: Update for move of diagnostic-color.h to
diagnostics/color.h.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc: Update for move of
diagnostic-color.h to diagnostics/color.h.
* gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move gcc/selftest-diagnostic.{h,cc} -> gcc/diagnostics/selftest-context...
David Malcolm [Fri, 25 Jul 2025 19:13:40 +0000 (15:13 -0400)] 
diagnostics: move gcc/selftest-diagnostic.{h,cc} -> gcc/diagnostics/selftest-context.{h,cc}

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace selftest-diagnostic.o with
diagnostics/selftest-context.o.
* diagnostic.cc: Update for move of selftest-diagnostic.h to
diagnostics/selftest-context.h.
* diagnostics/html-sink.cc: Likewise.
* diagnostics/lazy-paths.cc: Likewise.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* selftest-diagnostic.cc: Move to...
* diagnostics/selftest-context.cc: ...here and update for move of
header file.
* selftest-diagnostic.h: Move to...
* diagnostics/selftest-context.h: ...here.
* diagnostics/source-printing.cc: Update for move of
selftest-diagnostic.h to diagnostics/selftest-context.h.

gcc/c-family/ChangeLog:
* c-format.cc: Update for move of selftest-diagnostic.h to
diagnostics/selftest-context.h.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/expensive_selftests_plugin.cc: Update for move of
selftest-diagnostic.h to diagnostics/selftest-context.h.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move buffering code to its own .cc file
David Malcolm [Fri, 25 Jul 2025 19:13:39 +0000 (15:13 -0400)] 
diagnostics: move buffering code to its own .cc file

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Add diagnostics/buffering.o.
* diagnostic.cc (diagnostics::context::set_diagnostic_buffer): Move to
diagnostics/buffering.cc.
(diagnostics::context::clear_diagnostic_buffer): Likewise.
(diagnostics::context::flush_diagnostic_buffer): Likewise.
(diagnostics::buffer::buffer): Likewise.
(diagnostics::buffer::~buffer): Likewise.
(diagnostics::buffer::dump): Likewise.
(diagnostics::buffer::empty_p): Likewise.
(diagnostics::buffer::move_to): Likewise.
(diagnostics::buffer::ensure_per_sink_buffers): Likewise.
* diagnostics/buffering.cc: New file, from material in diagnostic.cc.
* diagnostics/buffering.h: Fix comment.
* diagnostics/text-sink.h: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move option_classifier to its own files
David Malcolm [Fri, 25 Jul 2025 19:13:39 +0000 (15:13 -0400)] 
diagnostics: move option_classifier to its own files

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Add
diagnostics/option-classifier.o.
* diagnostic.cc (diagnostics::option_classifier::init): Move to
diagnostics/option-classifier.cc.
(diagnostics::option_classifier::fini): Likewise.
(diagnostics::option_classifier::pch_save): Likewise.
(diagnostics::option_classifier::pch_restore): Likewise.
(diagnostics::option_classifier::push): Likewise.
(diagnostics::option_classifier::pop): Likewise.
(diagnostics::option_classifier::classify_diagnostic): Likewise.
(diagnostics::option_classifier::update_effective_level_from_pragmas):
Likewise.
* diagnostics/context.h: Include
"diagnostics/option-classifier.h".
(class option_classifier): Move to
diagnostics/option-classifier.h.
* diagnostics/option-classifier.cc: New file, based on material
from diagnostic.cc.
* diagnostics/option-classifier.h: New file, based on material
from diagnostics/context.h.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move diagnostic_context to diagnostics::context in its own header
David Malcolm [Fri, 25 Jul 2025 19:13:39 +0000 (15:13 -0400)] 
diagnostics: move diagnostic_context to diagnostics::context in its own header

No functional change intended.

gcc/ada/ChangeLog:
* gcc-interface/misc.cc: Update for diagnostic_context becoming
diagnostics::context.

gcc/analyzer/ChangeLog:
* program-point.cc: : Update for diagnostic_context becoming
diagnostics::context, and for diagnostic_source_print_policy
becoming diagnostics::source_print_policy.

gcc/c-family/ChangeLog:
* c-common.h: Update for diagnostic_context becoming
diagnostics::context.
* c-opts.cc: Likewise.

gcc/c/ChangeLog:
* c-objc-common.cc: Update for diagnostic_context becoming
diagnostics::context.
* c-tree.h: Likewise.

gcc/ChangeLog:
* coretypes.h: Update for diagnostic_context becoming
diagnostics::context.
* diagnostic-global-context.cc: Likewise.
* diagnostic.cc: Likewise.  Also for diagnostic_option_classifier
becoming diagnostics::option_classifier.
* diagnostic.h (diagnostic_text_starter_fn): Rename to...
(diagnostics::text_starter_fn): ...this, and move to
diagnostics/context.h.
(get_printer): Rename to...
(diagnostics::get_printer): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_manager): Rename to...
(class diagnostics::option_manager): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_classifier): Rename to...
(class diagnostics::option_classifier): ...this, and move to
diagnostics/context.h.
(struct diagnostic_source_printing_options): Rename to...
(struct diagnostics::source_printing_options): ...this, and move
to diagnostics/context.h.
(class diagnostic_column_policy): Rename to...
(class diagnostics::column_policy): ...this, and move to
diagnostics/context.h.
(class diagnostic_location_print_policy): Rename to...
(class diagnostics::location_print_policy): ...this, and move to
diagnostics/context.h.
(class html_label_writer): Rename to...
(class diagnostics::html_label_writer): ...this, and move to
diagnostics/context.h.
(class diagnostic_source_print_policy): Rename to...
(class diagnostics::source_print_policy): ...this, and move to
diagnostics/context.h.
(struct diagnostic_counters): Rename to...
(struct diagnostics::counters): ...this, and move to
diagnostics/context.h.
(class diagnostic_context): Rename to...
(class diagnostics::context): ...this, and move to
diagnostics/context.h.
(diagnostic_text_starter): Rename to...
(diagnostics::text_starter): ...this, and move to
diagnostics/context.h.
(diagnostic_start_span): Rename to...
(diagnostics::start_span): ...this, and move to
diagnostics/context.h.
(diagnostic_text_finalizer): Rename to...
(diagnostics::text_finalizer): ...this, and move to
diagnostics/context.h.
Include "diagnostics/context.h".
* diagnostics/buffering.h: Update for diagnostic_context becoming
diagnostics::context; similarly for diagnostic_counters.
* diagnostics/client-data-hooks.h: Likewise.
* diagnostics/context.h: New file, taken from material in
diagnostic.h.
* diagnostics/html-sink.cc: : Update for diagnostic_context
becoming diagnostics::context.
* diagnostics/html-sink.h: Likewise.
* diagnostics/lazy-paths.cc: Likewise for
diagnostic_option_manager.
* diagnostics/output-file.h: Likewise for diagnostic_context.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/sarif-sink.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc-rich-location.h: Likewise.
* gcc.cc: Likewise.
* gdbinit.in: Likewise.
* langhooks-def.h: Likewise.
* langhooks.cc: Likewise.
* langhooks.h: Likewise.
* libgdiagnostics.cc: Likewise.
* optc-gen.awk: Likewise.
* opth-gen.awk: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts-global.cc: Likewise.
* opts.cc: Likewise.
* opts.h: Likewise.
* selftest-diagnostic.cc: Likewise.
* selftest-diagnostic.h: Likewise.
* toplev.cc: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.
* tree-diagnostic.h: Likewise.

gcc/cp/ChangeLog:
* cp-tree.h: Update for diagnostic_context becoming
diagnostics::context.
* error.cc: Likewise.
* module.cc: Likewise.

gcc/fortran/ChangeLog:
* error.cc: Update for diagnostic_context becoming
diagnostics::context.

gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_context becoming
diagnostics::context.
* jit-playback.h: Likewise.

gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-expr.cc: Update for diagnostic_text_finalizer
becoming diagnostics::text_finalizer.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.

gcc/testsuite/ChangeLog:
* g++.dg/plugin/show_template_tree_color_plugin.cc: Update for
moves to namespace diagnostics.
* gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move diagnostic_info to its own header
David Malcolm [Fri, 25 Jul 2025 19:13:38 +0000 (15:13 -0400)] 
diagnostics: move diagnostic_info to its own header

No functional change intended.

gcc/ChangeLog:
* diagnostic.h (struct diagnostic_info): Move to
diagnostics/diagnostic-info.h as diagnostics::diagnostic_info.
Add typedef bringing it back into root namespace, for now.
* diagnostics/diagnostic-info.h: New file, based on the above.
* langhooks-def.h: Update for diagnostic_info moving into
namespace diagnostics.
* langhooks.h: Likewise.

gcc/jit/ChangeLog:
* jit-playback.cc: Update for diagnostic_info moving into
namespace diagnostics.
* jit-playback.h: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: add m_ prefix to fields of diagnostic_info
David Malcolm [Fri, 25 Jul 2025 19:13:38 +0000 (15:13 -0400)] 
diagnostics: add m_ prefix to fields of diagnostic_info

No functional change intended.

gcc/c-family/ChangeLog:
* c-opts.cc (c_diagnostic_text_finalizer): Add "m_" prefix to
fields of diagnostic_info.

gcc/c/ChangeLog:
* c-errors.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.

gcc/cp/ChangeLog:
* constexpr.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
* error.cc: Likewise.

gcc/d/ChangeLog:
* d-diagnostic.cc (d_diagnostic_report_diagnostic): Update to add
"m_" prefix to fields of diagnostic_info throughout.

gcc/ChangeLog:
* diagnostic.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
* diagnostic.h: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* substring-locations.cc: Likewise.
* tree-diagnostic.cc: Likewise.

gcc/fortran/ChangeLog:
* error.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update to
add "m_" prefix to fields of diagnostic_info throughout.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move diagnostic-macro-unwinding.{cc,h} -> diagnostics/macro-unwinding...
David Malcolm [Fri, 25 Jul 2025 19:13:38 +0000 (15:13 -0400)] 
diagnostics: move diagnostic-macro-unwinding.{cc,h} -> diagnostics/macro-unwinding.{cc,h}

gcc/ChangeLog:
* Makefile.in (OBJS): Replace diagnostic-macro-unwinding.o with
diagnostics/macro-unwinding.o.
* diagnostic-macro-unwinding.cc: Move to...
* diagnostics/macro-unwinding.cc: ...here, moving content into
namespace diagnostics.
* diagnostic-macro-unwinding.h: Move to...
* diagnostics/macro-unwinding.h: ...here, moving content into
namespace diagnostics.
* diagnostics/paths-output.cc: Update for move of
"diagnostic-macro-unwinding.h" to "diagnostics/macro-unwinding.h".

gcc/c-family/ChangeLog:
* c-opts.cc: Update for move of "diagnostic-macro-unwinding.h"
to "diagnostics/macro-unwinding.h".

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: introduce diagnostics/source-printing.cc
David Malcolm [Fri, 25 Jul 2025 19:13:37 +0000 (15:13 -0400)] 
diagnostics: introduce diagnostics/source-printing.cc

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>
12 days agodiagnostics: move/rename output formats to diagnostics as "sinks"
David Malcolm [Fri, 25 Jul 2025 19:13:37 +0000 (15:13 -0400)] 
diagnostics: move/rename output formats to diagnostics as "sinks"

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>
12 days agodiagnostics: introduce namespace diagnostics::paths
David Malcolm [Fri, 25 Jul 2025 19:13:36 +0000 (15:13 -0400)] 
diagnostics: introduce namespace diagnostics::paths

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>
12 days agodiagnostics: move diagnostics_output_spec to diagnostics::output_spec
David Malcolm [Fri, 25 Jul 2025 19:13:36 +0000 (15:13 -0400)] 
diagnostics: move diagnostics_output_spec to diagnostics::output_spec

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostic-output-spec.o
with diagnostics/output-spec.o.
* diagnostic-output-spec.cc: Move to...
* diagnostics/output-spec.cc: ...here.  Update #include for
move of diagnostic-output-spec.h to diagnostics/output-spec.h.
(namespace::diagnostics_output_spec): Replace with...
(namespace diagnostics::output_spec): ...this, removing redundant
prefixes.
(diagnostics_output_spec::gcc_spec_context): Replace with...
(diagnostics::output_spec::dc_spec_context): ...this.
(diagnostic_output_spec_cc_tests): Rename to...
(diagnostics_output_spec_cc_tests): ...this.
* diagnostic-output-spec.h: Move to...
* diagnostics/output-spec.h: ...here and update inclusion guard.
(namespace::diagnostics_output_spec): Replace with...
(namespace diagnostics::output_spec): ...this, removing redundant
prefixes.
(diagnostics_output_spec::gcc_spec_context): Replace with...
(diagnostics::output_spec::dc_spec_context): ...this.
* libgdiagnostics.cc: Update #include for move of
diagnostic-output-spec.h to diagnostics/output-spec.h.
* opts-diagnostic.cc: Likewise.  Update for namespace and name
changes.
* selftest-run-tests.cc (selftest::run_tests): Update for renaming
of diagnostic_output_spec_cc_tests to
diagnostics_output_spec_cc_tests.
* selftest.h (diagnostic_output_spec_cc_tests): Rename decl to...
(diagnostics_output_spec_cc_tests): ...this.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: rename diagnostic_output_file to diagnostics::output_file
David Malcolm [Fri, 25 Jul 2025 19:13:36 +0000 (15:13 -0400)] 
diagnostics: rename diagnostic_output_file to diagnostics::output_file

No functional change intended.

gcc/ChangeLog:
* diagnostic-format-html.cc: Update #include for move of
diagnostic-output-file.h to diagnostics/output-file.h.  Update for
move of diagnostic_output_file to diagnostics::output_file.
* diagnostic-format-html.h: Likewise.
* diagnostic-format-sarif.cc: Likewise.
* diagnostic-format-sarif.h: Likewise.
* diagnostic-output-spec.cc: Likewise.
* diagnostic-output-spec.h (along): Likewise.
* diagnostic-output-file.h: Move to...
* diagnostics/output-file.h: ...here, updating header guard.
(class diagnostic_output_file): Move to...
(class diagnostics::output_file): ...here.
* libgdiagnostics.cc (sarif_sink::sarif_sink): Update for
move of diagnostic_output_file to diagnostics::output_file.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move client data hooks into namespace/dir "diagnostics"
David Malcolm [Fri, 25 Jul 2025 19:13:36 +0000 (15:13 -0400)] 
diagnostics: move client data hooks into namespace/dir "diagnostics"

No functional change intended.

Note that the tree-*.cc implementations are *not* moved into namespace
diagnostics.

gcc/ChangeLog:
* diagnostic-format-html.cc: Update #include for move of
diagnostic-client-data-hooks.h to diagnostics/client-data-hooks.h.
* diagnostic-format-sarif.cc: Likewise.  Update for move of
diagnostic_client_plugin_info to diagnostics::client_plugin_info.
* diagnostic-format-text.cc: Likewise.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostic-client-data-hooks.h: Move to...
* diagnostics/client-data-hooks.h: ...here, updating header guard.
(class diagnostic_client_data_hooks): Move to...
(class diagnostics::client_data_hooks): ...here.  Remove redundant
"diagnostics::" prefixes.
(class diagnostic_client_plugin_info): Move to...
(class diagnostics::client_plugin_info): ...here.
* libgdiagnostics.cc: : Update #include for move of
diagnostic-client-data-hooks.h to diagnostics/client-data-hooks.h.
Update for move of diagnostic_client_data_hooks to
diagnostics::client_data_hooks, and for move of
diagnostic_client_version_info to diagnostics::client_version_info.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: move edit_context to namespace/dir "diagnostics"
David Malcolm [Fri, 25 Jul 2025 19:13:35 +0000 (15:13 -0400)] 
diagnostics: move edit_context to namespace/dir "diagnostics"

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>
12 days agodiagnostics: move diagnostic_diagram to diagnostics::diagram
David Malcolm [Fri, 25 Jul 2025 19:13:35 +0000 (15:13 -0400)] 
diagnostics: move diagnostic_diagram to diagnostics::diagram

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>
12 days agodiagnostics: move diagnostic_metadata to diagnostics::metadata
David Malcolm [Fri, 25 Jul 2025 19:13:35 +0000 (15:13 -0400)] 
diagnostics: move diagnostic_metadata to diagnostics::metadata

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>
12 days agodiagnostics: move logical locations into "diagnostics"
David Malcolm [Fri, 25 Jul 2025 19:13:34 +0000 (15:13 -0400)] 
diagnostics: move logical locations into "diagnostics"

This patch moves gcc/logical-locations.h into gcc/diagnostics
and moves the classes into "namespace diagnostics", to better
indicate that this is part of the shared diagnostics code.

The type "logical_location" becomes diagnostics::logical_locations::key,
the class logical_location_manager becomes
class diagnostics::logical_locations::manager, and the enum
enum logical_location_kind becomes
enum diagnostics::logical_locations::kind.

Note that tree-logical-locations.{h,cc} are *not* part
of "namespace diagnostics", as they use tree.

  renamed:    gcc/logical-location.h -> gcc/diagnostics/logical-locations.h
  renamed:    gcc/selftest-logical-location.cc -> gcc/diagnostics/selftest-logical-locations.cc
  renamed:    gcc/selftest-logical-location.h -> gcc/diagnostics/selftest-logical-locations.h

No functional change intended.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace
selftest-logical-location.o with
diagnostics/selftest-logical-locations.o.
* diagnostic-client-data-hooks.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, and of logical_location
to diagnostics::logical_locations::key.
* diagnostic-format-html.cc: Add "using namespace diagnostics;",
and drop now-redundant "diagnostics::" prefixes.
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, of logical_location to
diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
* diagnostic-format-sarif.cc: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".  Add
"using namespace diagnostics;", and drop now-redundant
"diagnostics::" prefixes.
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, of logical_location to
diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
* diagnostic-format-sarif.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location to
diagnostics::logical_locations::key.
* diagnostic-path-output.cc: Add "using namespace diagnostics;".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, and
of logical_location to diagnostics::logical_locations::key,
* diagnostic-path.cc: Add "using namespace diagnostics;".
Update for conversion of logical_location to
diagnostics::logical_locations::key.
* diagnostic-path.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, and of logical_location
to diagnostics::logical_locations::key,
* diagnostic.cc: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
* diagnostic.h: Reorganize forward decls.
(class logical_location_manager): Replace this forward decl
with...
(class diagnostics::logical_locations::manager): ...this.
(diagnostic_context::get_logical_location_manager): Update
return type.
* diagnostics/digraphs.h: : Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location to
diagnostics::logical_locations::key.
* logical-location.h: Move to...
* diagnostics/logical-locations.h: ...here.
(enum class logical_location_kind): Convert to...
(enum class diagnostics::logical_locations::kind): ... this.
(class logical_location_manager::key): Convert to...
(class diagnostics::logical_locations::key): ... this.
(class logical_location_manager): Convert to...
(class diagnostics::logical_locations::manager): ... this.
(logical_location): Drop this typedef in favor of
diagnostics::logical_locations::key.
* selftest-logical-location.cc: Move to...
* diagnostics/selftest-logical-locations.cc: ...here.
Update #include for move of "selftest-logical-location.h" to
"diagnostics/selftest-logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, of logical_location to
diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
(selftest_logical_location_cc_tests): Rename to...
(diagnostics_selftest_logical_locations_cc_tests): ...this.
* selftest-logical-location.h: Move to...
* diagnostics/selftest-logical-locations.h: ...here, updating
include guard.
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, of logical_location to
diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
* diagnostics/state-graphs-to-dot.cc: Add
"using namespace diagnostics;" and drop now-redundant
"diagnostics::" prefixes.
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager.
* diagnostics/state-graphs.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager,
of logical_location to diagnostics::logical_locations::key.
* libgdiagnostics.cc: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, and of logical_location
to diagnostics::logical_locations::key.
* selftest-diagnostic-path.cc: Update for conversion of
logical_location to diagnostics::logical_locations::key.
* selftest-diagnostic-path.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location to
diagnostics::logical_locations::key.
* selftest-run-tests.cc (selftest::run_tests): Update for
renaming of selftest_logical_location_cc_tests to
diagnostics_selftest_logical_locations_cc_tests.
* selftest.h: Likewise.
* simple-diagnostic-path.h: Update for conversion of
logical_location to diagnostics::logical_locations::key.
* tree-diagnostic-client-data-hooks.cc: Update for conversion of
logical_location_manager to
diagnostics::logical_locations::manager, and of logical_location
to diagnostics::logical_locations::key.
* tree-logical-location.cc: Update for conversions.
Update for conversion of logical_location to
diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.
* tree-logical-location.h: Update #include for move of
"logical-location.h" to "diagnostics/logical-locations.h".
Update for conversion of logical_location_manager to
diagnostics::logical_locations::manager, of logical_location
to diagnostics::logical_locations::key, and of
enum logical_location_kind to
enum diagnostics::logical_locations::kind.

gcc/analyzer/ChangeLog:
* checker-event.h (checker_event::get_logical_location): Update
for conversion of logical_location to
diagnostics::logical_locations::key.
(checker_event::m_logical_loc): Likewise.
* diagnostic-manager.cc
(diagnostic_manager::get_logical_location_manager): Likewise.
* diagnostic-manager.h
(diagnostic_manager::get_logical_location_manager): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 days agodiagnostics: introduce a "gcc/diagnostics" subdirectory
David Malcolm [Fri, 25 Jul 2025 19:13:34 +0000 (15:13 -0400)] 
diagnostics: introduce a "gcc/diagnostics" subdirectory

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>
12 days agoc++: more name lookup for non-dep rewritten cmp ops
Patrick Palka [Fri, 25 Jul 2025 14:55:35 +0000 (10:55 -0400)] 
c++: more name lookup for non-dep rewritten cmp ops

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>
12 days agoRemove now redundant vect_get_vec_defs overload
Richard Biener [Fri, 25 Jul 2025 13:03:36 +0000 (15:03 +0200)] 
Remove now redundant vect_get_vec_defs overload

The following removes the vect_get_vec_defs overload receiving
a vector type to be used for the possibly constant/invariant
operand.  This was used for non-SLP code generation as there
constants/invariants are generated on the fly.  It also elides
the stmt_vec_info and ncopies argument which are not required
for SLP.

* tree-vectorizer.h (vect_get_vec_defs): Remove overload
with operand vector type.  Remove stmt_vec_info and
ncopies argument.
* tree-vect-stmts.cc (vect_get_vec_defs): Likewise.
(vectorizable_conversion): Adjust by not passing in
vector types, stmt_vec_info and ncopies.
(vectorizable_bswap): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_scan_store): Likewise.
(vectorizable_store): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison_1): Likewise.
* tree-vect-loop.cc (vect_transform_reduction): Likewise.
(vect_transform_lc_phi): Likewise.

12 days agoTidy vect_is_simple_use API for SLP only
Richard Biener [Fri, 25 Jul 2025 12:04:50 +0000 (14:04 +0200)] 
Tidy vect_is_simple_use API for SLP only

The following removes one vect_is_simple_use overload that shouldn't
be used anymore after removing the single remaining use related
to gather handling in get_group_load_store_type.  It also removes
the dual-purpose of the overload getting both SLP node and
stmt_vec_info and removes the latter argument.

That leaves us with a SLP overload handling vector code and the
stmt_info overload handling scalar code.  In theory the former
is only convenience and it should never fail given SLP build
checks the constraint already, but there's the 'op' argument
we have to get rid of first.

* tree-vectorizer.h (vect_is_simple_use): Remove stmt-info
with vectype output overload and remove stmt-info argument
from SLP based API.
* tree-vect-loop.cc (vectorizable_lane_reducing): Remove
unused def_stmt_info output argument to vect_is_simple_use.
Adjust.
* tree-vect-stmts.cc (get_group_load_store_type): Get
the gather/scatter offset vector type from the SLP child.
(vect_check_scalar_mask): Remove stmt_info argument.  Adjust.
(vect_check_store_rhs): Likewise.
(vectorizable_call): Likewise.
(vectorizable_simd_clone_call): Likewise.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_load): Likewise.
(vect_is_simple_cond): Remove stmt_info argument.  Adjust.
(vectorizable_condition): Likewise.
(vectorizable_comparison_1): Likewise.
(vectorizable_store): Likewise.
(vect_is_simple_use): Remove overload and non-SLP path.

12 days agoFix and simplify vect_model_simple_cost
Richard Biener [Fri, 25 Jul 2025 11:38:48 +0000 (13:38 +0200)] 
Fix and simplify vect_model_simple_cost

There's no longer any call without SLP node so we don't need dts.
I also figured based on the callers that some expect to cost
more than one stmt but still N times so this changes what we cost.

* tree-vect-stmts.cc (vect_model_simple_cost): Removed code
when no SLP node is passed, remove then unused dt and ndts
parameters and fix the number of vector stmts calculation.
(vectorizable_call): Adjust.
(vectorizable_simd_clone_call): Likewise.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison_1): Likewise.

13 days agoRISC-V: Prepare dynamic LMUL heuristic for SLP.
Robin Dapp [Mon, 21 Jul 2025 14:00:51 +0000 (16:00 +0200)] 
RISC-V: Prepare dynamic LMUL heuristic for SLP.

This patch prepares the dynamic LMUL vector costing to use the coming
SLP_TREE_TYPE instead of the (to-be-removed) STMT_VINFO_TYPE.

Even though the whole approach should be reviewed and adjusted at some
point, the patch chooses the path of least resistance and uses a hash
map for the stmt_info -> slp node relationship.  A node is mapped to the
accompanying stmt_info during add_stmt_cost.  In finish_cost we go
through all statements as before, and obtain the corresponding slp nodes
as well as their types.

This allows us to operate largely as before.  We don't yet do the switch
over from STMT_VINFO_TYPE to SLP_TREE_TYPE, though but only take care
of the necessary refactoring upfront.

Regtested on rv64gcv_zvl512b with -mrvv-max-lmul=dynamic.  There are a
few regressions but nothing worse than what we already have.  I'd rather
accept these now and take it as an incentive to work on the heuristic
later than block the SLP work until it is fixed.

gcc/ChangeLog:

* config/riscv/riscv-vector-costs.cc (get_live_range):
Move compute_local_program_points to cost class.
(variable_vectorized_p): Add slp node parameter.
(need_additional_vector_vars_p): Move from here...
(costs::need_additional_vector_vars_p): ... to here and add slp
parameter.
(compute_estimated_lmul): Move update_local_live_ranges to cost
class.
(has_unexpected_spills_p): Move from here...
(costs::has_unexpected_spills_p): ... to here.
(costs::record_lmul_spills): New function.
(costs::add_stmt_cost): Add stmt_info, slp mapping.
(costs::finish_cost): Analyze loop.
* config/riscv/riscv-vector-costs.h: Move declarations to class.

13 days agolibstdc++: doc: Rectify referencing of non-existent type
Tuur Martens [Tue, 22 Jul 2025 08:02:53 +0000 (08:02 +0000)] 
libstdc++: doc: Rectify referencing of non-existent type

The unordered_map header incorrectly refers to a non-existent template parameter
_Value in default template argument descriptions. They should refer to _Key instead.

This patch fixes these descriptions to match the actual template parameters.

libstdc++-v3/ChangeLog:

* include/bits/unordered_map.h: Rectify referencing of
non-existent type.

13 days agoReduce the number of STMT_VINFO_VECTYPE uses
Richard Biener [Fri, 25 Jul 2025 10:34:44 +0000 (12:34 +0200)] 
Reduce the number of STMT_VINFO_VECTYPE uses

The following adjusts uses of STMT_VINFO_VECTYPE to look elsewhere
where obvious.

* tree-vect-loop.cc (vect_analyze_loop_2): Get vectype
from the SLP node.
(vectorize_fold_left_reduction): Likewise.
(vect_transform_reduction): Likewise.
(vect_transform_cycle_phi): Likewise.
(vect_transform_lc_phi): Likewise.
* tree-vect-slp.cc (vect_analyze_slp): Likewise.
* tree-vect-stmts.cc (vect_truncate_gather_scatter_offset):
Pass in vectype and use that.
(vect_use_strided_gather_scatters_p): Likewise.
(get_group_load_store_type): Adjust.
(vect_check_scalar_mask): We always have a SLP node.
Use vectype from the SLP node.
(vect_check_store_rhs): Likewise.
(vect_build_one_gather_load_call): Pass in the vector type
and use that.
(vect_get_strided_load_store_ops): Likewise.
(vectorizable_store): Adjust.
(vectorizable_load): Use the vector type from the SLP node
and adjust.

13 days agoRemove unused stmt_vectype
Richard Biener [Fri, 25 Jul 2025 09:45:17 +0000 (11:45 +0200)] 
Remove unused stmt_vectype

The following removes an unused accessor to data that should go away.

* target.h (stmt_vectype): Remove.
* tree-vect-stmts.cc (stmt_vectype): Likewise.

13 days agoc++, coroutines: Handle allocation fail returns [PR121219].
Iain Sandoe [Wed, 23 Jul 2025 15:22:32 +0000 (16:22 +0100)] 
c++, coroutines: Handle allocation fail returns [PR121219].

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>
13 days agoRISC-V: Remove user-level interrupts
Christoph Müllner [Fri, 25 Jul 2025 08:27:59 +0000 (10:27 +0200)] 
RISC-V: Remove user-level interrupts

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>
13 days agoRemove STMT_VINFO_VEC_STMTS
Richard Biener [Fri, 25 Jul 2025 07:50:18 +0000 (09:50 +0200)] 
Remove STMT_VINFO_VEC_STMTS

The following removes the last uses of STMT_VINFO_VEC_STMTS and
the vector itself.  Vector stmts are recorded in SLP nodes now.

The last use is a bit strange - it was introduced by
Richard S. in r8-6064-ga57776a1136962 and affects only
power7 and below (the re-align optimized load path).  The
check should have never been true since vect_vfa_access_size
is only ever invoked before stmt transform.  I have done
the "conservative" change of making it always true now
(so the code is now entered).  I can as well remove it, but
I wonder if you remember anything about this ...

* tree-vectorizer.h (_stmt_vec_info::vec_stmts): Remove.
(STMT_VINFO_VEC_STMTS): Likewise.
* tree-vectorizer.cc (vec_info::new_stmt_vec_info): Do not
initialize it.
(vec_info::free_stmt_vec_info): Nor free it.
* tree-vect-data-refs.cc (vect_vfa_access_size): Remove
check on STMT_VINFO_VEC_STMTS.

13 days agoRemove load interleaving code
Richard Biener [Fri, 25 Jul 2025 07:34:32 +0000 (09:34 +0200)] 
Remove load interleaving code

The following removes the non-SLP load interleaving code which was
almost unused.

* tree-vectorizer.h (vect_transform_grouped_load): Remove.
(vect_record_grouped_load_vectors): Likewise.
* tree-vect-data-refs.cc (vect_permute_load_chain): Likewise.
(vect_shift_permute_load_chain): Likewise.
(vect_transform_grouped_load): Likewise.
(vect_record_grouped_load_vectors): Likewise.
* tree-vect-stmts.cc (vectorizable_load): Remove comments
about load interleaving.

13 days agoRemove store interleaving support
Richard Biener [Fri, 25 Jul 2025 07:40:27 +0000 (09:40 +0200)] 
Remove store interleaving support

The following removes the non-SLP store interleaving support which
was already almost unused.

* tree-vectorizer.h (vect_permute_store_chain): Remove.
* tree-vect-data-refs.cc (vect_permute_store_chain): Likewise.
* tree-vect-stmts.cc (vectorizable_store): Remove comment
about store interleaving.

13 days agoRemove vect_get_vec_defs_for_operand
Richard Biener [Fri, 25 Jul 2025 07:19:47 +0000 (09:19 +0200)] 
Remove vect_get_vec_defs_for_operand

This removes vect_get_vec_defs_for_operand and its remaining uses.
It also removes some remaining non-SLP paths in preparation to
elide STMT_VINFO_VEC_STMTS.

* tree-vectorizer.h (vect_get_vec_defs_for_operand): Remove.
* tree-vect-stmts.cc (vect_get_vec_defs_for_operand): Likewise.
(vect_get_vec_defs): Remove non-SLP path.
(check_load_store_for_partial_vectors): We always have an
SLP node.
(vect_check_store_rhs): Likewise.
(vect_get_gather_scatter_ops): Likewise.
(vect_create_vectorized_demotion_stmts): Likewise.
(vectorizable_store): Adjust.
(vectorizable_load): Likewise.

13 days agoRemove VMAT_CONTIGUOUS_PERMUTE
Richard Biener [Fri, 25 Jul 2025 07:09:35 +0000 (09:09 +0200)] 
Remove VMAT_CONTIGUOUS_PERMUTE

This VMAT was used for interleaving which was non-SLP only.  The
following removes code gated by it (code selecting it is already gone).

* tree-vectorizer.h (VMAT_CONTIGUOUS_PERMUTE): Remove.
* tree-vect-stmts.cc (check_load_store_for_partial_vectors):
Remove checks on VMAT_CONTIGUOUS_PERMUTE.
(vectorizable_load): Likewise.
(vectorizable_store): Likewise.  Prune dead code.

13 days agoRemove dead code from vectorizable_store
Richard Biener [Fri, 25 Jul 2025 07:04:49 +0000 (09:04 +0200)] 
Remove dead code from vectorizable_store

There's dead code in the else block of a if (!costing_p) block,
after trivial pruning only setting of 'op' remains but that has
no further uses downstream.  I found this looking for remaining
(must-be-dead) uses of vect_get_vec_defs_for_operand.

* tree-vect-stmts.cc (vectorizable_store): Remove trivially
dead code.

13 days agogcn: Add "s_nop"s for MI300
Tobias Burnus [Fri, 25 Jul 2025 09:24:22 +0000 (11:24 +0200)] 
gcn: Add "s_nop"s for MI300

MI300 requires some additional s_nop to be added between some instructions.
* As 'v_readlane' and 'v_writelane' have to be distinguished, the
  'laneselect' attribute was changed from no/yes to no/read/write.
* Add some missing 'laneselect' attributes for v_(read,write)lane.
* Replace 'delayeduse' by 'flatmemaccess' which is more explicit,
  especially as some uses have to destinguished more details.
  (Alongside, one off-by-two delayeduse has been fixed.)

On the other hand, RDNA 2, 3, and 3.5 do not require any added s_nop;
thus, there is no need to walk the instructions for them to insert
pointless S_NOP. (RDNA4 (not yet in GCC) requires it in a few cases.)

gcc/ChangeLog:

* config/gcn/gcn-opts.h (TARGET_NO_MANUAL_NOPS,
TARGET_CDNA3_NOPS): Define.
* config/gcn/gcn.md (define_attr "laneselect): Change 'yes' to
'read' and 'write'.
(define_attr "flatmemaccess"): Add with values store, storex34,
load, atomic, atomicwait, cmpswapx2, and no. Replacing ...
(define_attr "delayeduse"): Remove.
(define_attr "transop"): Add with values yes and no.
(various insns): Update 'laneselect', add flatmemaccess and transop,
remove delayeduse; fixing an issue for s_load_dwordx4 vs.
flat_store_dwordx4 related to delayeduse (now: flatmemaccess).
* config/gcn/gcn-valu.md: Update laneselect attribute and add
flatmemaccess.
* config/gcn/gcn.cc (gcn_cmpx_insn_p): New.
(gcn_md_reorg): Update for MI300 to add additional s_nop.
Skip s_nop-insertion part for RDNA{2,3}; add "VALU writes EXEC
followed by VALU DPP" unconditionally for CDNA2/CDNA3/GCN5.

13 days agoDetermine CONSTRAINT_LEN at run-time [PR121214]
Stefan Schulze Frielinghaus [Fri, 25 Jul 2025 09:04:38 +0000 (11:04 +0200)] 
Determine CONSTRAINT_LEN at run-time [PR121214]

Tests gcc.dg/asm-hard-reg-error-{4,5}.c ICE on sparc*-sun-solaris2.11
since in tm-preds.h we end up with

  #define CONSTRAINT_LEN(c_,s_) 1

and, therefore, do not parse hard register constraints correctly.
Hard register constraints are non-single character constraints and
require insn_constraint_len() in order to determine the length.

In write_tm_preds_h() from genpreds.cc, previously variable
constraint_max_namelen was used in order to decide whether we have
single or non-single character constraints.  The distinction shouldn't
be done anymore and we always must call into insn_constraint_len().

While being on it, remove guard constraint_max_namelen>0 since we always
have some constraints coming from common.md.  This leaves
constraint_max_namelen without users so remove it.

gcc/ChangeLog:

PR middle-end/121214
* genpreds.cc (constraint_max_namelen): Delete.
(write_tm_preds_h): Always write insn_constraint_len() and
define CONSTRAINT_LEN to it, i.e., remove guard
constraint_max_namelen>1.  Remove outer guard
constraint_max_namelen>0 and re-indent.
(write_insn_preds_c): Remove guard
constraint_max_namelen>0 and re-indent.

13 days agoada: Minor cleanup
Marc Poulhiès [Tue, 15 Jul 2025 08:22:09 +0000 (10:22 +0200)] 
ada: Minor cleanup

Renamed local variables to make it easier to read.

gcc/ada/ChangeLog:

* gcc-interface/utils.cc (update_pointer_to): Renamed ptr/old_ptr, ref/old_ref.

13 days agoada: ppc-vx6: pthread clocks and headers for decls
Alexandre Oliva [Wed, 16 Jul 2025 05:01:59 +0000 (02:01 -0300)] 
ada: ppc-vx6: pthread clocks and headers for decls

VxWorks 6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to
CLOCK_REALTIME to use the dummy definition of
__gnat_pthread_condattr_setup in libgnarl/thread.c.

socket.c and sysdep.c use FD_ZERO, that relies on bzero on VxWorks 6.
We need to include strings.h to get a declaration for bzero, but don't
require strings.h to exist, since it's nonstandard.

gcc/ada/ChangeLog:

* s-oscons-tmplt.c (CLOCK_RT_Ada) [__vxworks]: Define to
CLOCK_REALTIME on VxWorks6.
* gsocket.h [__vxworks]: Include strings.h if available.
* sysdep.c [__vxworks]: Likewise.

13 days agoada: Follow up fixes.
Steve Baird [Wed, 16 Jul 2025 20:37:44 +0000 (13:37 -0700)] 
ada: Follow up fixes.

Two follow-up fixes for the previous change for this issue.

gcc/ada/ChangeLog:

* exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): Do
nothing and simply return if either Ada_Version <= Ada_95 or if
the function being returned from lacks the extra formal parameter
needed to perform the check (typically because the result is
tagged).

13 days agoada: Bug in Indefinite_Holders instance passed to formal package
Bob Duff [Wed, 16 Jul 2025 14:29:01 +0000 (10:29 -0400)] 
ada: Bug in Indefinite_Holders instance passed to formal package

Fix bug when an instance of Indefinite_Holders with a class-wide type is
passed as a generic formal package; Program_Error was raised when
dealing with the implicit "=" function.

The fix is to disable legality checks in formal packages when the
entity is an E_Subprogram_Body, because these are implicitly generated
for class-wide predefined functions when passed to generics.

gcc/ada/ChangeLog:

* sem_ch12.adb (Check_Formal_Package_Instance):
Do nothing in case of E_Subprogram_Body.

13 days agoada: Update comments
Ronan Desplanques [Wed, 16 Jul 2025 13:27:03 +0000 (15:27 +0200)] 
ada: Update comments

A previous patch changed the mechanism of early usage detection for
discriminants but failed to update a couple of surrounding comments
accordingly. This patch fixes this omission.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Discriminants): Update comments

13 days agoada: Fix regression of finalization primitive selection
Ronan Desplanques [Fri, 11 Jul 2025 09:28:35 +0000 (11:28 +0200)] 
ada: Fix regression of finalization primitive selection

A recent patch introduced a new flag to mark the types for which looking
up finalization primitives needs special handling. But there was one
place in Build_Derived_Record_Type where the flag was not set when it
should, which introduced a regression in some cases.

This patch adds the missing setting of the flag.

gcc/ada/ChangeLog:

* sem_ch3.adb (Build_Derived_Record_Type): Set flag appropriately.

13 days agoada: Fix inconsistencies in conversion functions from Duration
Eric Botcazou [Mon, 14 Jul 2025 22:37:19 +0000 (00:37 +0200)] 
ada: Fix inconsistencies in conversion functions from Duration

The 3 units Ada.Calendar, GNAT.Calendar and GNAT.Sockets contain conversion
functions from the Duration fixed-point type that implement the same idiom
but with some inconsistencies:

  * GNAT.Sockets only handles Timeval_Duration, i.e. positive Duration, and
    is satisfactory, although a simpler implementation can be written,

  * GNAT.Calendar mishandles negative Duration values, as well as integral
    Duration values,

  * Ada.Calendar mishandles negative Duration values, and rounds nanoseconds
    instead of truncating them.

gcc/ada/ChangeLog:

* libgnat/a-calend.adb (To_Struct_Timespec_64): Deal with negative
Duration values and truncate the nanoseconds too.
* libgnat/g-calend.adb (timeval_to_duration): Unsuppress overflow
checks.
(duration_to_timeval): Likewise.  Deal with negative Duration values
as well as integral Duration values.
* libgnat/g-socket.adb (To_Timeval): Simplify the implementation.

13 days agoRISC-V: Add support for resumable non-maskable interrupt (RNMI) handlers
Christoph Müllner [Thu, 24 Jul 2025 21:08:40 +0000 (23:08 +0200)] 
RISC-V: Add support for resumable non-maskable interrupt (RNMI) handlers

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>
13 days agoDaily bump.
GCC Administrator [Fri, 25 Jul 2025 00:20:34 +0000 (00:20 +0000)] 
Daily bump.

13 days agoc++: Unwrap type traits defined in terms of builtins within diagnostics [PR117294]
Nathaniel Shead [Thu, 29 May 2025 10:08:13 +0000 (20:08 +1000)] 
c++: Unwrap type traits defined in terms of builtins within diagnostics [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>
13 days agoc++: one more PR114632 tweak
Jason Merrill [Thu, 24 Jul 2025 19:38:36 +0000 (15:38 -0400)] 
c++: one more PR114632 tweak

Patrick points out that after the PR114632 fix we can also rever the change
that moved cp_evaluated higher in tsubst_lambda_expr.

gcc/cp/ChangeLog:

* pt.cc (tsubst_lambda_expr): Revert r9-5971 change.

13 days agoc++: lambda convop in C++23 [PR114632]
Jason Merrill [Thu, 24 Jul 2025 18:07:11 +0000 (14:07 -0400)] 
c++: lambda convop in C++23 [PR114632]

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.

13 days agocobol: Honor the "-static" command-line option. [PR119231]
Robert Dubner [Thu, 24 Jul 2025 16:09:36 +0000 (12:09 -0400)] 
cobol: Honor the "-static" command-line option. [PR119231]

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.

13 days agoRemove vec_stmt from vectorizable_* API
Richard Biener [Thu, 24 Jul 2025 12:14:24 +0000 (14:14 +0200)] 
Remove vec_stmt from vectorizable_* API

The following removes the non-SLP gimple **vec_stmt argument from
the vectorizable_* functions API.  Checks on it can be replaced
by an inverted check on the passed cost_vec vector pointer.

* tree-vectorizer.h (vectorizable_induction): Remove
gimple **vec_stmt argument.
(vectorizable_phi): Likewise.
(vectorizable_recurr): Likewise.
(vectorizable_early_exit): Likewise.
* tree-vect-loop.cc (vectorizable_phi): Likewise and adjust.
(vectorizable_recurr): Likewise.
(vectorizable_nonlinear_induction): Likewise.
(vectorizable_induction): Likewise.
* tree-vect-stmts.cc (vectorizable_bswap): Likewise.
(vectorizable_call): Likewise.
(vectorizable_simd_clone_call): Likewise.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison_1): Likewise.
(vectorizable_comparison): Likewise.
(vectorizable_early_exit): Likewise.
(vect_analyze_stmt): Adjust.
(vect_transform_stmt): Likewise.
* tree-vect-slp.cc (vect_slp_analyze_operations): Adjust.
(vectorize_slp_instance_root_stmt): Likewise.

13 days agoFix minor typo in #ifdef docuementation
Andrew Pinski [Thu, 24 Jul 2025 16:26:38 +0000 (09:26 -0700)] 
Fix minor typo in #ifdef docuementation

As reported in https://gcc.gnu.org/pipermail/gcc/2025-July/246417.html,
This fixes the minor typo under the #ifdef documentation about adding
MACRO after the #endif and the MACRO matching of the #ifdef. It had `#ifndef`
in it, rather than `#ifdef`.

Pushed as obvious.

gcc/ChangeLog:

* doc/cpp.texi (#ifdef): Correct typo.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
13 days agoRemove non-SLP path from vectorizable_early_exit
Richard Biener [Thu, 24 Jul 2025 11:47:14 +0000 (13:47 +0200)] 
Remove non-SLP path from vectorizable_early_exit

This removes the non-SLP path from vectorizable_early_exit.

* tree-vect-stmts.cc (vectorizable_early_exit): Remove non-SLP
path.

13 days agoRemove non-SLP path from vectorizable_simd_clone_call
Richard Biener [Thu, 24 Jul 2025 10:46:01 +0000 (12:46 +0200)] 
Remove non-SLP path from vectorizable_simd_clone_call

This removes the non-SLP path from vectorizable_simd_clone_call and
the then unused simd_clone_info from the stmt_vec_info structure.

* tree-vectorizer.h (_stmt_vec_info::simd_clone_info): Remove.
(STMT_VINFO_SIMD_CLONE_INFO): Likewise.
* tree-vectorizer.cc (vec_info::free_stmt_vec_info): Do not
release it.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Remove
non-SLP path.

13 days agolibstdc++: Cleaned up string_vector_iterators.cc test [PR104874]
Tomasz Kamiński [Thu, 24 Jul 2025 07:14:38 +0000 (09:14 +0200)] 
libstdc++: Cleaned up string_vector_iterators.cc test [PR104874]

Removed the wrong_stuff() function, which was effectively empty for
actual test runs. Replaced the manual failure counter with the VERIFY
macro to simplify identifying failures.

PR libstdc++/104874

libstdc++-v3/ChangeLog:

* testsuite/24_iterators/random_access/string_vector_iterators.cc:
Reworked.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
13 days agoriscv: testsuite: Fix misalignment check.
Robin Dapp [Wed, 2 Jul 2025 08:28:57 +0000 (10:28 +0200)] 
riscv: testsuite: Fix misalignment check.

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.

13 days agovect: Misalign checks for gather/scatter.
Robin Dapp [Thu, 3 Jul 2025 09:04:29 +0000 (11:04 +0200)] 
vect: Misalign checks for gather/scatter.

This patch adds simple misalignment checks for gather/scatter
operations.  Previously, we assumed that those perform element accesses
internally so alignment does not matter.  The riscv vector spec however
explicitly states that vector operations are allowed to fault on
element-misaligned accesses.  Reasonable uarchs won't, but...

For gather/scatter we have two paths in the vectorizer:

 (1) Regular analysis based on datarefs.  Here we can also create
     strided loads.
 (2) Non-affine access where each gather index is relative to the
     initial address.

The assumption this patch works on is that once the alignment for the
first scalar is correct, all others will fall in line, as the index is
always a multiple of the first element's size.

For (1) we have a dataref and can check it for alignment as in other
cases.  For (2) this patch checks the object alignment of BASE and
compares it against the natural alignment of the current vectype's unit.

The patch also adds a pointer argument to the gather/scatter IFNs that
contains the necessary alignment.  Most of the patch is thus mechanical
in that it merely adjusts indices.

I tested the riscv version with a custom qemu version that faults on
element-misaligned vector accesses.  With this patch applied, there is
just a single fault left, which is due to PR120782 and which will be
addressed separately.

Bootstrapped and regtested on x86 and aarch64.  Regtested on
rv64gcv_zvl512b with and without unaligned vector support.

gcc/ChangeLog:

* internal-fn.cc (internal_fn_len_index): Adjust indices for new
alias_ptr param.
(internal_fn_else_index): Ditto.
(internal_fn_mask_index): Ditto.
(internal_fn_stored_value_index): Ditto.
(internal_fn_alias_ptr_index): Ditto.
(internal_fn_offset_index): Ditto.
(internal_fn_scale_index): Ditto.
(internal_gather_scatter_fn_supported_p): Ditto.
* internal-fn.h (internal_fn_alias_ptr_index): Ditto.
* optabs-query.cc (supports_vec_gather_load_p): Ditto.
* tree-vect-data-refs.cc (vect_check_gather_scatter): Add alias
pointer.
* tree-vect-patterns.cc (vect_recog_gather_scatter_pattern): Add
alias pointer.
* tree-vect-slp.cc (vect_get_operand_map): Adjust for alias
pointer.
* tree-vect-stmts.cc (vect_truncate_gather_scatter_offset): Add
alias pointer and misalignment handling.
(get_load_store_type): Move from here...
(get_group_load_store_type): ...To here.
(vectorizable_store): Add alias pointer.
(vectorizable_load): Ditto.
* tree-vectorizer.h (struct gather_scatter_info): Ditto.

13 days agovect: Add is_gather_scatter argument to misalignment hook.
Robin Dapp [Wed, 2 Jul 2025 08:02:16 +0000 (10:02 +0200)] 
vect: Add is_gather_scatter argument to misalignment hook.

This patch adds an is_gather_scatter argument to the
support_vector_misalignment hook.  All targets but riscv do not care
about alignment for gather/scatter so return true for is_gather_scatter.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_builtin_support_vector_misalignment):
Return true for gather/scatter.
* config/arm/arm.cc (arm_builtin_support_vector_misalignment):
Ditto.
* config/epiphany/epiphany.cc (epiphany_support_vector_misalignment):
Ditto.
* config/gcn/gcn.cc (gcn_vectorize_support_vector_misalignment):
Ditto.
* config/loongarch/loongarch.cc (loongarch_builtin_support_vector_misalignment):
Ditto.
* config/riscv/riscv.cc (riscv_support_vector_misalignment):
Add gather/scatter argument.
* config/rs6000/rs6000.cc (rs6000_builtin_support_vector_misalignment):
Return true for gather/scatter.
* config/s390/s390.cc (s390_support_vector_misalignment):
Ditto.
* doc/tm.texi: Add argument.
* target.def: Ditto.
* targhooks.cc (default_builtin_support_vector_misalignment):
Ditto.
* targhooks.h (default_builtin_support_vector_misalignment):
Ditto.
* tree-vect-data-refs.cc (vect_supportable_dr_alignment):
Ditto.

13 days agovect: Add helper macros for gather/scatter.
Robin Dapp [Thu, 3 Jul 2025 09:04:25 +0000 (11:04 +0200)] 
vect: Add helper macros for gather/scatter.

This encapsulates the IFN and the builtin-function way of handling
gather/scatter via three defines:

  GATHER_SCATTER_IFN_P
  GATHER_SCATTER_LEGACY_P
  GATHER_SCATTER_EMULATED_P

and introduces a helper define for SLP operand handling as well.

gcc/ChangeLog:

* tree-vect-slp.cc (GATHER_SCATTER_OFFSET): New define.
(vect_get_and_check_slp_defs): Use.
* tree-vectorizer.h (GATHER_SCATTER_LEGACY_P): New define.
(GATHER_SCATTER_IFN_P): Ditto.
(GATHER_SCATTER_EMULATED_P): Ditto.
* tree-vect-stmts.cc (vectorizable_store): Use.
(vectorizable_load): Use.

13 days agoifn: Add helper functions for gather/scatter.
Robin Dapp [Wed, 2 Jul 2025 08:04:58 +0000 (10:04 +0200)] 
ifn: Add helper functions for gather/scatter.

This patch adds access helpers for the gather/scatter offset and scale
parameters.

gcc/ChangeLog:

* internal-fn.cc (expand_scatter_store_optab_fn): Use new
function.
(expand_gather_load_optab_fn): Ditto.
(internal_fn_offset_index): Ditto.
(internal_fn_scale_index): Ditto.
* internal-fn.h (internal_fn_offset_index): New function.
(internal_fn_scale_index): Ditto.
* tree-vect-data-refs.cc (vect_describe_gather_scatter_call):
Use new function.

2 weeks agovect: remove cast to pointer for create_if in vect_create_data_ref_ptr
Alfie Richards [Thu, 24 Jul 2025 08:16:30 +0000 (08:16 +0000)] 
vect: remove cast to pointer for create_if in vect_create_data_ref_ptr

Removes `fold_convert (aggr_ptr_type, iv_step)` when using create_iv.

This was previously constructing statements like:
```
unsigned int _49;
vector([4,4]) int * _50;
sizetype _51;
vector([4,4]) int * vectp_x.6;
...
_50 = (vector([4,4]) int *) _49;
_51 = (sizetype) _50;
...
vectp_x.6_48 = vectp_x.6_47 + _51;
```

And instead creates:
```
unsigned int _49;
sizetype _50;
vector([4,4]) int * vectp_x.6;
...
_50 = (sizetype) _49;
...
vectp_x.6_48 = vectp_x.6_47 + _50;
```

As create_iv already has the logic to handle a pointer mode base and an integer
mode var this seems a more natural expression of this.

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_create_data_ref_ptr): Remove unnecessary
casts to aggr_ptr_type.

2 weeks agolibstdc++: Expand compile-time ranges tests for vector and basic_string.
Tomasz Kamiński [Wed, 23 Jul 2025 09:33:22 +0000 (11:33 +0200)] 
libstdc++: Expand compile-time ranges tests for vector and basic_string.

This replaces most test_constexpr invocations with direct calls to
test_ranges(), which is also used for runtime tests.

SimpleAllocator was made constexpr to simplify this refactoring. Other
test allocators, like uneq_allocator (used in from_range constructor
tests), were not updated.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/cons/from_range.cc: Replace
test_constexpr with test_ranges inside static_assert.
* testsuite/21_strings/basic_string/modifiers/append/append_range.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/assign/assign_range.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/insert/insert_range.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/replace/replace_with_range.cc:
Likewise.
* testsuite/23_containers/vector/bool/cons/from_range.cc: Likewise.
* testsuite/23_containers/vector/bool/modifiers/assign/assign_range.cc:
Likewise.
* testsuite/23_containers/vector/bool/modifiers/insert/insert_range.cc:
Likewise.
* testsuite/23_containers/vector/cons/from_range.cc: Likewise.
* testsuite/23_containers/vector/modifiers/assign/assign_range.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/insert/insert_range.cc:
Likewise.
* testsuite/23_containers/vector/bool/modifiers/insert/append_range.cc:
Run full test_ranges instead of span-only in test_constexpr.
* testsuite/23_containers/vector/modifiers/append_range.cc:
Replace test_constexpr with calls to test_ranges and test_overlapping.
* testsuite/util/testsuite_allocator.h (__gnu_test::SimpleAllocator):
Declared member functions as constexpr.

2 weeks agoRemove non-SLP path from vectorizable_comparison
Richard Biener [Thu, 24 Jul 2025 11:30:32 +0000 (13:30 +0200)] 
Remove non-SLP path from vectorizable_comparison

This removes the non-SLP path from vectorizable_comparison.

* tree-vect-stmts.cc (vectorizable_comparison_1): Remove
non-SLP path.
(vectorizable_comparison): Likewise.

2 weeks agoRemove non-SLP path from vectorizable_condition
Richard Biener [Thu, 24 Jul 2025 11:24:28 +0000 (13:24 +0200)] 
Remove non-SLP path from vectorizable_condition

The following removes the non-SLP paths from vectorizable_condition.

* tree-vect-stmts.cc (vectorizable_condition): Remove
non-SLP paths.

2 weeks agoRemove non-SLP path from vectorizable_scan_store
Richard Biener [Thu, 24 Jul 2025 11:19:20 +0000 (13:19 +0200)] 
Remove non-SLP path from vectorizable_scan_store

This removes the non-SLP paths from vectorizable_scan_store.

* tree-vect-stmts.cc (vectorizable_scan_store): Remove
non-SLP path and unused parameters.
(vectorizable_store): Adjust.

2 weeks agoRemove non-SLP path from vectorizable_shift
Richard Biener [Thu, 24 Jul 2025 11:11:05 +0000 (13:11 +0200)] 
Remove non-SLP path from vectorizable_shift

This removes the non-SLP paths from vectorizable_shift.

* tree-vect-stmts.cc (vectorizable_shift): Remove non-SLP paths.

2 weeks agoRemove non-SLP path from vectorizable_assignment
Richard Biener [Thu, 24 Jul 2025 11:07:33 +0000 (13:07 +0200)] 
Remove non-SLP path from vectorizable_assignment

This removes the non-SLP paths from vectorizable_assignment

* tree-vect-stmts.cc (vectorizable_assignment): Remove
non-SLP paths.

2 weeks agoRemove non-SLP path from vectorizable_call
Richard Biener [Thu, 24 Jul 2025 09:39:11 +0000 (11:39 +0200)] 
Remove non-SLP path from vectorizable_call

This removes the non-SLP paths from vectorizable_call, propagates
out ncopies == 1 and removes empty loops resulting from that.

* tree-vect-stmts.cc (vectorizable_call): Remove non-SLP path.

2 weeks agoRemove non-SLP path from vectorizable_bswap
Richard Biener [Thu, 24 Jul 2025 09:34:45 +0000 (11:34 +0200)] 
Remove non-SLP path from vectorizable_bswap

* tree-vect-stmts.cc (vectorizable_bswap): Remove non-SLP path.

2 weeks agoRemove non-SLP path from vectorizable_recurr
Richard Biener [Thu, 24 Jul 2025 09:17:57 +0000 (11:17 +0200)] 
Remove non-SLP path from vectorizable_recurr

This removes the non-SLP paths from vectorizable_recurr.

* tree-vect-loop.cc (vectorizable_recurr): Remove non-SLP path.

2 weeks agoaarch64: Relaxed SEL combiner patterns for unpacked SVE FP binary arithmetic
Spencer Abson [Tue, 8 Jul 2025 12:49:42 +0000 (12:49 +0000)] 
aarch64: Relaxed SEL combiner patterns for unpacked SVE FP binary arithmetic

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.

2 weeks agoaarch64: Add support for unpacked SVE FDIV
Spencer Abson [Tue, 8 Jul 2025 11:35:44 +0000 (11:35 +0000)] 
aarch64: Add support for unpacked SVE FDIV

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.

2 weeks agoaarch64: Add support for unpacked SVE FP binary arithmetic
Spencer Abson [Tue, 8 Jul 2025 10:51:33 +0000 (10:51 +0000)] 
aarch64: Add support for unpacked SVE FP binary arithmetic

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.

2 weeks agoada: Use-before-definition of a component of discriminated aggregate's itype.
Steve Baird [Fri, 11 Jul 2025 21:40:59 +0000 (14:40 -0700)] 
ada: Use-before-definition of a component of discriminated aggregate's itype.

In some cases involving assigning an aggregate to a formal parameter of
an unconstrained discriminated subtype that has a Dynamic_Predicate, and where
the discriminated type also has a component of an unconstrained discriminated
subtype, the front end generates a malformed tree which causes a compilation
failure when the backend fails a consistency check.

gcc/ada/ChangeLog:

* exp_aggr.adb (Convert_To_Assignments): Add calls to Ensure_Defined
before generating assignments to components that could be
associated with a not-yet-defined itype.

2 weeks agoada: Function return accessibility checking for result access discrims.
Steve Baird [Mon, 24 Mar 2025 22:34:34 +0000 (15:34 -0700)] 
ada: Function return accessibility checking for result access discrims.

RM 6.5 defines static and dynamic checks to ensure that a function result
with one or more access discriminants will not outlive the entity
designated by a non-null access discriminant value (see paragraphs
5.9 and 21). Implement these checks. Also fix a bug in passing along
an implicit parameter needed to perform the dynamic checks when a function
that takes such a parameter returns a call to another such function.

gcc/ada/ChangeLog:

* accessibility.adb (Function_Call_Or_Allocator_Level): Handle the
case where a function that has an Extra_Accessibility_Of_Result
parameter returns as its result a call to another such function.
In that case, the extra parameter should be passed along.
(Check_Return_Construct_Accessibility): Replace a warning about an
inevitable failure of a dynamic check with a legality-rule-violation
error message; adjust the text of the message accordingly.
* exp_ch6.ads (Apply_Access_Discrims_Accessibility_Check): New
procedure, following example of the existing
Apply_CW_Accessibility procedure.
* exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): body
for new procedure.
(Expand_Simple_Function_Return): Add call to new
Apply_Access_Discrims_Accessibility_Check procedure.
* exp_ch3.adb (Make_Allocator_For_Return): Add call to new
Apply_Access_Discrims_Accessibility_Check procedure.

2 weeks agoada: Minor adjustment to the doc of Last_Chance_Handler
Tonu Naks [Mon, 14 Jul 2025 13:52:30 +0000 (13:52 +0000)] 
ada: Minor adjustment to the doc of Last_Chance_Handler

gcc/ada/ChangeLog:

* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
clarify parameter description.
* gnat_rm.texi: Regenerate.

2 weeks agotestsuite: Fix gcc.target/powerpc/vsx-builtin-7.c test [PR119382]
Jeevitha [Thu, 24 Jul 2025 04:39:13 +0000 (23:39 -0500)] 
testsuite: Fix gcc.target/powerpc/vsx-builtin-7.c test [PR119382]

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.

2 weeks agoRISC-V: Add test case for vx combine polluting VXRM
Pan Li [Wed, 23 Jul 2025 05:02:55 +0000 (13:02 +0800)] 
RISC-V: Add test case for vx combine polluting VXRM

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>
2 weeks agoRISC-V: Avoid vaaddu.vx combine pattern pollute VXRM csr
Pan Li [Wed, 23 Jul 2025 04:08:02 +0000 (12:08 +0800)] 
RISC-V: Avoid vaaddu.vx combine pattern pollute VXRM csr

The vaaddu.vx combine almost comes from avg_floor, it will
requires the vxrm to be RDN.  But not all vaaddu.vx should
depends on the RDN.  The vaaddu.vx combine should leverage
the VXRM value as is instead of pollute them all to RDN.

This patch would like to fix this and set it as is.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*uavg_floor_vx_<mode>): Rename
from...
(*<sat_op_v_vdup>_vx_<mode>): Rename to...
(*<sat_op_vdup_v>_vx_<mode>): Rename to...
* config/riscv/riscv-protos.h (enum insn_flags): Add vxrm
RNE, ROD type.
(enum insn_type): Add RNE_P, ROD_P type.
(expand_vx_binary_vxrm_vec_vec_dup): Add new func decl.
(expand_vx_binary_vxrm_vec_dup_vec): Ditto.
* config/riscv/riscv-v.cc (get_insn_type_by_vxrm_val): Add
helper to get insn type by vxrm value.
(expand_vx_binary_vxrm_vec_vec_dup): Add new func impl
to expand vec + vec_dup pattern.
(expand_vx_binary_vxrm_vec_dup_vec): Ditto but for
vec_dup + vec pattern.
* config/riscv/vector-iterators.md: Add helper iterator
for sat vx combine.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 weeks agoc++/modules: Support re-streaming TU_LOCAL_ENTITYs [PR120412]
Nathaniel Shead [Sat, 24 May 2025 00:56:22 +0000 (10:56 +1000)] 
c++/modules: Support re-streaming TU_LOCAL_ENTITYs [PR120412]

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>
2 weeks agoDaily bump.
GCC Administrator [Thu, 24 Jul 2025 00:20:56 +0000 (00:20 +0000)] 
Daily bump.

2 weeks agoaarch64: Relaxed SEL combiner patterns for unpacked SVE FP unary operations
Spencer Abson [Mon, 7 Jul 2025 18:26:35 +0000 (18:26 +0000)] 
aarch64: Relaxed SEL combiner patterns for unpacked SVE FP unary operations

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.

2 weeks agoaarch64: Add support for unpacked SVE FP unary operations
Spencer Abson [Mon, 7 Jul 2025 16:49:17 +0000 (16:49 +0000)] 
aarch64: Add support for unpacked SVE FP unary operations

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.

2 weeks agoaarch64: Relaxed SEL combiner patterns for unpacked SVE FP conversions
Spencer Abson [Mon, 7 Jul 2025 15:00:31 +0000 (15:00 +0000)] 
aarch64: Relaxed SEL combiner patterns for unpacked SVE FP conversions

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.

2 weeks agocontrib: add 'zlib' to ignored_prefixes
Sam James [Wed, 23 Jul 2025 16:38:13 +0000 (17:38 +0100)] 
contrib: add 'zlib' to ignored_prefixes

This fixes the same problem for syncing zlib that H.J. hit for libffi
in r12-4561-g25ab851dd333d7.

contrib/ChangeLog:
PR other/105404

* gcc-changelog/git_commit.py (ignored_prefixes): Add zlib/.

2 weeks agoFortran: fix passing of character length of function to procedure [PR121203]
Harald Anlauf [Tue, 22 Jul 2025 18:16:16 +0000 (20:16 +0200)] 
Fortran: fix passing of character length of function to procedure [PR121203]

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.

2 weeks agoRISC-V: Rework broadcast handling [PR121073].
Robin Dapp [Thu, 17 Jul 2025 09:09:43 +0000 (11:09 +0200)] 
RISC-V: Rework broadcast handling [PR121073].

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.

2 weeks agoRISC-V: testsuite: Fix vx_vf_*run-1-f16.c run tests.
Robin Dapp [Mon, 21 Jul 2025 13:32:09 +0000 (15:32 +0200)] 
RISC-V: testsuite: Fix vx_vf_*run-1-f16.c run tests.

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.

2 weeks agoaarch64: Fix fma steering when rename fails [PR120119]
Andrew Pinski [Tue, 22 Jul 2025 17:26:54 +0000 (10:26 -0700)] 
aarch64: Fix fma steering when rename fails [PR120119]

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>
2 weeks agocobol: Tweak adjustments to location_t of GENERIC nodes for PERFORM.
Robert Dubner [Wed, 23 Jul 2025 12:44:54 +0000 (08:44 -0400)] 
cobol: Tweak adjustments to location_t of GENERIC nodes for PERFORM.

COBOL has a group of PERFORM statements that require careful adjustments to
the location_t elements of the GENERIC nodes so that the COBOL-aware version
of GDB behaves properly.  These changes are in service of that goal.

gcc/cobol/ChangeLog:

* genapi.cc (leave_procedure): Adjust location_t for PERFORM.
(parser_perform_times): Likewise.
(internal_perform_through_times): Likewise.
(perform_outofline_before_until): Likewise.
(perform_outofline_after_until): Likewise.
(perform_outofline_testafter_varying): Likewise.
(perform_outofline_before_varying): Likewise.

2 weeks agoc++: name lookup for non-dep rewritten != expr [PR121179]
Patrick Palka [Wed, 23 Jul 2025 12:38:12 +0000 (08:38 -0400)] 
c++: name lookup for non-dep rewritten != expr [PR121179]

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>